1import{bL as q,bK as nt,r as n,cf as vt,cl as Ce,j as e,bQ as Be,dd as xn,fB as Ot,ec as fn}from"./vendor-BBNELK6W_bundle.js";import{T as j,ag as kt,G as he,F as d,a4 as Vt,a2 as W,H as Ge,de as Ve,a6 as Ee,a3 as Rt,aa as Cn,e as ye,eh as Wt,u as Qe,a as Ut,A as ue,df as $t,s1 as Gt,ae as bn,h as wt,k as Ft,jy as qt,h5 as lt,l2 as Sn,fr as Qt,gS as wn,a8 as Yt,rP as _n,V as jn}from"./registration-8fW6h2tH_bundle.js";import{h as _t,a0 as Te,C as yn}from"./slackIntegration-CyZu6SDu_bundle.js";import"./moment-Dt2i7U-U_bundle.js";import{d0 as En,bg as In,kb as vn,kc as Jt,kd as Zt,ke as st,kf as pt,b as kn,kg as Fn,hG as Xt,bd as Kt,be as en,iI as tn,cu as qn,kh as ze,jj as nn,jE as Nt,ki as it,kj as ke,kk as Oe,kl as Pe,km as rt,kn as ht,ko as Ne,kp as sn,kq as $e,kr as tt,ks as At,aM as Mn,kt as St,P as rn,ku as Tn,kv as Rn,kw as Nn}from"./index-yTdTJQbB_bundle.js";import{S as xt}from"./question-mark-DKn8E8fN_bundle.js";import{S as An}from"./info-circle-large-C7uDyte7_bundle.js";import{f as Hn}from"./locations.api-2KmF98fh_bundle.js";import{r as ln}from"./index-C284GLkD_bundle.js";import"./sentry-Bq-jBV13_bundle.js";import"./datadog-DxmyjtSX_bundle.js";import"./stripe-rL9tfl_U_bundle.js";import"./speedboat-vendor-DJ0pA_pR_bundle.js";const Ht=q.div.withConfig({displayName:"ui__DropzoneArea"})(["width:100%;border:2px dashed ",";border-radius:16px;background-color:",";padding:32px 16px;cursor:pointer;transition:background-color 0.15s ease,border-color 0.15s ease;&:hover{background-color:",";}"," "," ",""],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.neutral25,({theme:t})=>t.bg.neutral50,({$isDragActive:t})=>t&&nt(["border-color:",";background-color:",";"],({theme:s})=>s.delimiter.blue400,({theme:s})=>s.bg.neutral50),({$hasFile:t})=>t&&nt(["border-style:solid;border-color:",";background-color:",";"],({theme:s})=>s.delimiter.blue400,({theme:s})=>s.bg.neutral50),({$isUploading:t,theme:s})=>t&&nt(["cursor:default;&:hover{background-color:",";}"],s.bg.neutral50)),Ln=q.div.withConfig({displayName:"ui__IconCircle"})(["width:48px;height:48px;border-radius:50%;background-color:",";display:flex;align-items:center;justify-content:center;color:",";"],({theme:t})=>t.bg.neutral100,({theme:t})=>t.icon.neutral700),Bn=q(j).withConfig({displayName:"ui__BrowseText"})(["cursor:pointer;"]),Dn=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,fill:"none",viewBox:"0 0 48 48",...t},n.createElement("g",{clipPath:"url(#spinner-bulk-import_svg__clip0_2814_9396)"},n.createElement("g",{opacity:.2},n.createElement("mask",{id:"spinner-bulk-import_svg__path-1-inside-1_2814_9396",fill:"#fff"},n.createElement("path",{d:"M48 24c0 13.255-10.745 24-24 24S0 37.255 0 24 10.745 0 24 0s24 10.745 24 24M6.01 24c0 9.935 8.055 17.99 17.99 17.99S41.99 33.934 41.99 24 33.934 6.01 24 6.01 6.01 14.066 6.01 24"})),n.createElement("path",{stroke:"#DD2A3B",strokeWidth:5.313,d:"M48 24c0 13.255-10.745 24-24 24S0 37.255 0 24 10.745 0 24 0s24 10.745 24 24ZM6.01 24c0 9.935 8.055 17.99 17.99 17.99S41.99 33.934 41.99 24 33.934 6.01 24 6.01 6.01 14.066 6.01 24Z",mask:"url(#spinner-bulk-import_svg__path-1-inside-1_2814_9396)"})),n.createElement("mask",{id:"spinner-bulk-import_svg__path-2-inside-2_2814_9396",fill:"#fff"},n.createElement("path",{d:"M24 0a24 24 0 0 1 21.031 35.562l-5.257-2.89A18 18 0 0 0 24 6z"})),n.createElement("path",{stroke:"#DD2A3B",strokeWidth:5.313,d:"M24 0a24 24 0 0 1 21.031 35.562l-5.257-2.89A18 18 0 0 0 24 6z",mask:"url(#spinner-bulk-import_svg__path-2-inside-2_2814_9396)"})),n.createElement("defs",null,n.createElement("clipPath",{id:"spinner-bulk-import_svg__clip0_2814_9396"},n.createElement("path",{fill:"#fff",d:"M0 0h48v48H0z"})))),zn=vt(["from{transform:rotate(0deg);}to{transform:rotate(360deg);}"]),on=q(Dn).withConfig({displayName:"Spinner"})(["animation:"," 1s linear infinite;@media (prefers-reduced-motion:reduce){animation:none;}"],zn),Lt=30*1024*1024,Pn=({file:t,isUploading:s,onFileChange:a})=>{const{t:r}=Ce(),l=n.useRef(null),m=n.useCallback((c,u)=>{if(u.length>0){const A=u[0].size>Lt?r("import.file_size_exceeded"):r("import.unsupported_file_type");kt({type:"error",message:A}),he.importFileError({errorMessage:A});return}c.length>0&&a(c[0])},[a]),S=()=>{s||l.current?.open()},N=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),S())};return s?e.jsx(Ht,{$isUploading:!0,style:{height:"232px"},children:e.jsxs(d,{center:!0,column:!0,gap:24,style:{height:"100%"},children:[e.jsx(on,{"aria-hidden":!0,"data-testid":"uploading-spinner"}),e.jsxs(d,{center:!0,column:!0,gap:4,children:[e.jsx(j,{center:!0,neutral700:!0,size:"18px",lineHeight:"24px",weight:500,children:r("import.uploading_title")}),e.jsx(j,{center:!0,mediumSize:!0,neutral500:!0,lineHeight:"20px",children:Vt(r("import.uploading_subtitle"))})]})]})}):e.jsx(En,{ref:l,disableClick:!0,accept:".csv,.xlsx,.xls",maxSize:Lt,multiple:!1,style:{width:"100%"},onDrop:m,children:({isDragActive:c})=>e.jsx(Ht,{$hasFile:!!t,$isDragActive:c,role:"button",tabIndex:0,onClick:S,onKeyDown:N,children:e.jsxs(d,{center:!0,column:!0,gap:24,children:[e.jsx(Ln,{children:e.jsx(In,{})}),e.jsxs(d,{center:!0,column:!0,gap:4,children:[e.jsx(Bn,{neutral700:!0,size:"18px",lineHeight:"24px",children:t?t.name:r("import.click_to_browse")}),e.jsx(W,{when:!t,children:e.jsx(j,{mediumSize:!0,neutral500:!0,lineHeight:"20px",children:r("import.drag_drop_hint")})})]}),e.jsx(j,{center:!0,mediumSize:!0,neutral500:!0,lineHeight:"20px",children:r("import.supported_formats")})]})})})},ot=q.div.withConfig({displayName:"ui__CardWrapper"})(["width:min(600px,100%);background-color:",";border:1px solid ",";border-radius:18px;padding:40px;overflow:hidden;"],({theme:t})=>t.bg.white,({theme:t})=>t.delimiter.neutral200),On=({folderId:t,file:s,isUploading:a,onFolderChange:r,onFileChange:l})=>{const{t:m}=Ce();return e.jsx(ot,{children:e.jsxs(d,{column:!0,gap:24,children:[e.jsxs(d,{column:!0,gap:4,children:[e.jsx(j,{fontSemiBold:!0,neutral800:!0,style:{fontSize:"22px",lineHeight:"32px"},children:m("import.interactive_title")}),e.jsx(j,{mediumSize:!0,neutral800:!0,style:{lineHeight:"20px"},children:m("import.interactive_subtitle")})]}),e.jsx(vn,{folderId:t,onChange:r}),e.jsx(Pn,{file:s,isUploading:a,onFileChange:l})]})})},ft=q.div.withConfig({displayName:"ui__SummaryRow"})(["display:flex;align-items:center;justify-content:space-between;padding:6px 0;border-bottom:",";"],({$noBorder:t,theme:s})=>t?"none":`1px solid ${s.delimiter.neutral200}`),Ct={display:"flex",alignItems:"center"},Vn=({fileName:t,itemsReady:s,totalItems:a,customFieldsCreated:r,columnsSkipped:l,itemsAutocorrected:m,totalAutocorrectItems:S,onImportNow:N,onReviewEdits:c})=>{const{t:u}=Ce();return e.jsx(ot,{children:e.jsxs(d,{center:!0,column:!0,gap:56,children:[e.jsxs(d,{center:!0,column:!0,gap:32,children:[e.jsx(d,{center:!0,column:!0,children:e.jsxs(d,{column:!0,gap:7,style:{width:"100%"},children:[e.jsx(j,{center:!0,fontSemiBold:!0,neutral800:!0,size:"22px",lineHeight:"32px",children:u("import.summary_title")}),e.jsx(j,{center:!0,neutral800:!0,size:"12px",lineHeight:"16px",letterSpacing:"0.4px",children:t})]})}),e.jsxs(Ge,{width:"394px",children:[e.jsxs(ft,{children:[e.jsxs(d,{center:!0,gap:4,children:[e.jsx(j,{fontMedium:!0,mediumSize:!0,neutral700:!0,lineHeight:"20px",children:u("import.items_ready_to_import")}),e.jsx(Ve,{content:u("import.tooltip_items_ready"),placement:"top",wrapperStyles:Ct,children:e.jsx(xt,{height:"16",viewBox:"0 0 16 16",width:"16"})})]}),e.jsxs(j,{mediumSize:!0,neutral700:!0,lineHeight:"20px",textAlign:"right",children:[s,"/",a]})]}),e.jsxs(ft,{children:[e.jsxs(d,{center:!0,gap:4,children:[e.jsx(j,{fontMedium:!0,mediumSize:!0,neutral700:!0,lineHeight:"20px",children:u("import.new_custom_fields_created")}),e.jsx(Ve,{content:u("import.tooltip_custom_fields"),placement:"top",wrapperStyles:Ct,children:e.jsx(xt,{height:"16",viewBox:"0 0 16 16",width:"16"})})]}),e.jsx(j,{mediumSize:!0,neutral700:!0,lineHeight:"20px",textAlign:"right",children:r})]}),e.jsxs(ft,{children:[e.jsxs(d,{center:!0,gap:4,children:[e.jsx(j,{fontMedium:!0,mediumSize:!0,neutral700:!0,lineHeight:"20px",children:u("import.columns_skipped")}),e.jsx(Ve,{content:u("import.tooltip_columns_skipped"),placement:"top",wrapperStyles:Ct,children:e.jsx(xt,{height:"16",viewBox:"0 0 16 16",width:"16"})})]}),e.jsx(j,{mediumSize:!0,neutral700:!0,lineHeight:"20px",textAlign:"right",children:l})]}),e.jsxs(ft,{$noBorder:!0,children:[e.jsxs(d,{center:!0,gap:4,children:[e.jsx(j,{fontMedium:!0,mediumSize:!0,neutral700:!0,lineHeight:"20px",children:u("import.items_autocorrected_with_
1sage")}),e.jsx(Ve,{content:u("import.tooltip_autocorrected"),placement:"top",wrapperStyles:Ct,children:e.jsx(xt,{height:"16",viewBox:"0 0 16 16",width:"16"})})]}),e.jsxs(j,{mediumSize:!0,neutral700:!0,lineHeight:"20px",textAlign:"right",children:[m,"/",S]})]})]})]}),e.jsxs(d,{gap:16,children:[e.jsxs(d,{center:!0,column:!0,gap:4,style:{width:"220px"},children:[e.jsx(Ee,{style:{width:"100%"},styleType:"secondaryCTA",type:"button",onClick:N,children:u("import.import_now")}),e.jsx(j,{center:!0,neutral700:!0,size:"10px",lineHeight:"12px",letterSpacing:"0.4px",children:u("import.import_now_subtitle",{count:s,autocorrected:m})})]}),e.jsx(Ee,{styleType:"brandCTA",type:"button",onClick:c,children:u("import.review_edits_to_data")})]})]})})},Wn=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},n.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,clipPath:"url(#tags-24px_svg__clip0_2631_1114)"},n.createElement("path",{d:"M3 8v4.172a2 2 0 0 0 .586 1.414l5.71 5.71a2.41 2.41 0 0 0 3.408 0l3.592-3.592a2.41 2.41 0 0 0 0-3.408l-5.71-5.71A2 2 0 0 0 9.172 6H5a2 2 0 0 0-2 2"}),n.createElement("path",{d:"m18 19 1.592-1.592a4.82 4.82 0 0 0 0-6.816L15 6M7 10h-.01"})),n.createElement("defs",null,n.createElement("clipPath",{id:"tags-24px_svg__clip0_2631_1114"},n.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Un=q(d).withConfig({displayName:"ui__HeaderBadge"})(["width:64px;height:64px;border-radius:50%;background-color:",";color:",";"],({theme:t})=>t.bg.green50,({theme:t})=>t.text.green500),$n=q(d).withConfig({displayName:"ui__IconBadge"})(["flex-shrink:0;width:40px;height:40px;border-radius:50%;background-color:",";color:",";"],({$orange:t,theme:s})=>t?s.bg.orange50:s.bg.neutral50,({$orange:t,theme:s})=>t?s.text.orange500:s.text.neutral800),Gn=q(d).withConfig({displayName:"ui__InfoBanner"})(["width:100%;padding:12px 16px;border-radius:8px;background-color:",";border:1px solid ",";"],({theme:t})=>t.bg.blue25,({theme:t})=>t.bg.blue300),Qn=q(j).withConfig({displayName:"ui__BannerText"})(["color:",";"],({theme:t})=>t.text.blue700),bt=({icon:t,boldText:s,labelText:a,caption:r,orange:l})=>e.jsxs(d,{gap:12,alignItems:r?"flex-start":"center",style:{width:"100%"},children:[e.jsx($n,{center:!0,$orange:l,children:t}),e.jsxs(d,{column:!0,gap:4,children:[e.jsxs(j,{neutral800:!0,size:"14px",lineHeight:"20px",children:[e.jsx(j,{as:"span",fontSemiBold:!0,neutral800:!0,size:"14px",lineHeight:"20px",children:s})," ",a]}),!!r&&e.jsx(j,{neutral600:!0,size:"12px",lineHeight:"16px",letterSpacing:"0.4px",children:r})]})]}),Yn=({fileName:t,itemsReady:s,totalItems:a,customFieldsCreated:r,columnsSkipped:l,itemsAutocorrected:m,onImportNow:S,onReviewEdits:N})=>{const{t:c}=Ce(),u=n.useContext(Be),B=r>0,A=m>0,D=l>0,$=B||A;return e.jsx(ot,{children:e.jsxs(d,{column:!0,gap:24,children:[e.jsxs(d,{center:!0,column:!0,gap:16,style:{width:"100%"},children:[e.jsx(Un,{center:!0,children:e.jsx(Jt,{width:32,height:32})}),e.jsxs(d,{center:!0,column:!0,gap:4,children:[e.jsx(j,{center:!0,fontSemiBold:!0,neutral800:!0,size:"22px",lineHeight:"32px",children:c("import.summary_title")}),e.jsxs(j,{center:!0,neutral600:!0,size:"14px",lineHeight:"20px",children:[t," ⢠",c("import.summary_rows",{count:a})]})]}),e.jsx(Rt,{neutral200:!0,height:"1px",width:"100%"})]}),e.jsxs(d,{column:!0,gap:24,style:{width:"100%"},children:[e.jsx(bt,{icon:e.jsx(Zt,{width:24,height:24}),boldText:c("import.items_ready_count",{count:s}),labelText:c("import.items_ready_label")}),B&&e.jsx(bt,{icon:e.jsx(Wn,{width:24,height:24}),boldText:c("import.custom_fields_count",{count:r}),labelText:c("import.custom_fields_label"),caption:c("import.custom_fields_caption")}),A&&e.jsx(bt,{icon:e.jsx(st,{width:24,height:24}),boldText:c("import.autocorrected_count",{count:m}),labelText:c("import.autocorrected_label"),caption:c("import.autocorrected_caption")}),D&&e.jsx(bt,{orange:!0,icon:e.jsx(pt,{color:u.icon.red500}),boldText:c("import.columns_skipped_count",{count:l}),labelText:c("import.columns_skipped_label"),caption:c("import.columns_skipped_caption")})]}),e.jsx(Rt,{neutral200:!0,height:"1px",width:"100%"}),$&&e.jsxs(Gn,{gap:12,alignItems:"flex-start",children:[e.jsx(An,{width:24,height:24,color:u.icon.blue500}),e.jsx(Qn,{size:"14px",lineHeight:"20px",children:c("import.sage_changes_banner")})]}),e.jsxs(d,{column:!0,gap:8,style:{width:"100%"},children:[e.jsx(Ee,{style:{width:"100%"},styleType:"brandCTA",type:"button",onClick:N,children:c("import.review_before_importing")}),e.jsx(Ee,{style:{width:"100%"},styleType:"userCancel",type:"button",onClick:S,children:c("import.import_now_without_reviewing")})]})]})})},Jn=t=>{const{featureFlags:s}=Cn(),a=kn(),r=!!s.enableSpeedboat&&!!a.id,l=n.useRef(t);l.current=t,n.useEffect(()=>{if(!r)return;let m=!1;return Hn(String(a.id)).then(S=>{const N=S.find(c=>c.isMainLocation);!m&&N&&l.current(Number(N.id))}).catch(()=>{}),()=>{m=!0}},[r,a.id])},Zn=()=>{const t=ye(Fn),[s]=xn(),a=s.get("location"),r=a&&!Number.isNaN(Number(a))?Number(a):void 0,[l,m]=n.useState(r??t),S=n.useCallback(u=>m(B=>r===void 0&&B===t?u:B),[t,r]);Jn(S);const N=ye(u=>Xt(u)(l)?.name),c=n.useCallback(u=>{m(u)},[]);return{folderId:l,folderName:l?N??"":Wt.name,folderIdForAnalytics:l??0,onFolderChange:c}},Xn=({onExitImport:t,onReviewEdits:s,onError:a,onStartImporting:r,onImportComplete:l,onPartialSuccess:m})=>{const{t:S}=Ce(),N=Qe(),{locationPush:c}=Ut(),u=_t(),{folderId:B,folderName:A,folderIdForAnalytics:D,onFolderChange:$}=Zn(),[M,k]=n.useState(null),{isAtLimit:de}=Kt(),H=en(),{session:_,stats:y,isUploading:O,isLoadingExistingSession:J,isFetchingSession:ae,isProcessingImport:pe,error:ge}=ye(z=>z.bulkImport);n.useEffect(()=>{ge&&(kt({type:"error",message:ge}),k(null))},[ge]);const ce=n.useCallback(()=>
1{if(pe)return;if(de){H();return}const z=y?.totalRows??0,Se=y?.rowsWithErrors??0,ne=y?.rowsWithSuggestions??0,me=y?.unmappedColumns??0,Ie=y?.newCustomAttributes??0,Ae=(_?.mappings?.length??0)-me,xe=z-Se+ne;he.bulkImportNow({folderName:A,folderId:D,itemsCount:z,itemsReady:xe,itemsSageAutocorrectedCount:ne,customFieldsCreatedCount:Ie,fieldsSkippedCount:me,fieldsMappedCount:Ae}),N({type:ue.SHOW_MODAL,payload:{component:"ConfirmImportModal",styleType:"light",isDefaultHeadingHidden:!0,showCrossBtn:!1,autoWidth:!0,data:{itemsCorrected:ne,customFieldsCreated:Ie,cancelHandler:()=>{he.cancelBulkImportNow({folderName:A,folderId:D,itemsCount:z,itemsReady:xe,itemsSageAutocorrectedCount:ne,customFieldsCreatedCount:Ie,fieldsSkipped:me,fieldsMapped:Ae}),N({type:ue.HIDE_MODAL})},submitHandler:()=>{N({type:ue.HIDE_MODAL}),u?(r(),N({type:ue.PROCESS_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:_?.id,onSuccess:l,onPartialSuccess:m,onError:a,applyCorrections:!0}})):N({type:ue.PROCESS_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:_?.id,onSuccess:()=>c("/items"),applyCorrections:!0}})}}}})},[N,_,y,c,A,D,u,r,l,m,a,pe,de,H]),b=n.useCallback(()=>{const z=y?.totalRows??0,Se=y?.rowsWithErrors??0,ne=y?.rowsWithSuggestions??0,me=y?.unmappedColumns??0,Ie=_?.mappings?.length??0;he.reviewEditsToData({folderName:A,folderId:D,itemsCount:z,itemsReady:z-Se+ne,customFieldsCreatedCount:y?.newCustomAttributes??0,fieldsSkipped:me,fieldsMapped:Ie-me}),s()},[_,y,A,D,s]),Z=n.useCallback(z=>{k(z),z&&N({type:ue.CREATE_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{file:z,folderId:B,folderName:A,onError:a}})},[N,B,A,a]),re=!!_&&!!y&&!O,oe=!!_&&!y&&!O,ie=J||ae||pe&&!u,v=!re&&!ie,Y=y?.totalRows-y?.rowsWithErrors+y?.rowsWithSuggestions;return e.jsxs(e.Fragment,{children:[e.jsxs(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:S("item.bulk_import")}),e.jsx(Ee,{style:{minWidth:"auto"},styleType:"userCancel",type:"button",onClick:t,children:S("import.exit_bulk_import")})]}),e.jsx(Te.Body,{left:0,maxWidth:1272,right:0,children:e.jsxs(d,{justifyContent:"center",style:{paddingTop:"72px"},children:[e.jsx(W,{when:ie,children:e.jsx($t,{largeRed:!0,hasNoBg:!0})}),e.jsx(W,{when:re&&u,children:e.jsx(Yn,{fileName:_?.fileName??"",itemsReady:Y,totalItems:y?.totalRows,customFieldsCreated:y?.newCustomAttributes,columnsSkipped:y?.unmappedColumns,itemsAutocorrected:y?.rowsWithSuggestions,onImportNow:ce,onReviewEdits:b})}),e.jsx(W,{when:re&&!u,children:e.jsx(Vn,{fileName:_?.fileName??"",itemsReady:Y,totalItems:y?.totalRows,customFieldsCreated:y?.newCustomAttributes,columnsSkipped:y?.unmappedColumns,itemsAutocorrected:y?.rowsWithSuggestions,totalAutocorrectItems:y?.totalRows,onImportNow:ce,onReviewEdits:b})}),e.jsx(W,{when:v,children:e.jsx(On,{file:M,folderId:B,isUploading:O||oe,onFileChange:Z,onFolderChange:$})})]})})]})},an=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:389,height:48,fill:"none",viewBox:"0 0 389 48",...t},n.createElement("path",{stroke:"#E4E4E5",strokeWidth:2,d:"M72.266 12.93h114M202.977 12.93h114"}),n.createElement("path",{fill:"#DD2A3B",fillRule:"evenodd",d:"M64.76 8c-2.24 0-4 1.76-4 4s1.76 4 4 4 4-1.76 4-4-1.76-4-4-4m0-5c-4.95 0-9 4.05-9 9s4.05 9 9 9 9-4.05 9-9-4.05-9-9-9m0 16.2c-3.96 0-7.2-3.24-7.2-7.2s3.24-7.2 7.2-7.2 7.2 3.24 7.2 7.2-3.24 7.2-7.2 7.2",clipRule:"evenodd"}),n.createElement("path",{fill:"#54565D",d:"M38.059 33.27V43h-1.596v-6.664L33.495 43h-1.106l-2.983-6.664V43h-1.595v-9.73h1.721l3.417 7.63 3.401-7.63zm1.565 5.838q0-1.162.476-2.058a3.56 3.56 0 0 1 3.164-1.89q.91 0 1.582.364.687.35 1.092.882v-1.12h1.61V43h-1.61v-1.148q-.406.546-1.106.91t-1.596.364q-.994 0-1.82-.504a3.74 3.74 0 0 1-1.316-1.428q-.476-.924-.476-2.086m6.314.028q0-.798-.336-1.386-.322-.588-.854-.896a2.25 2.25 0 0 0-1.148-.308q-.615 0-1.148.308-.532.294-.868.882-.322.574-.322 1.372t.322 1.4q.336.602.868.924.546.308 1.148.308.616 0 1.148-.308.533-.308.854-.896.336-.602.336-1.4m5.302-2.716q.407-.532 1.106-.896a3.4 3.4 0 0 1 1.583-.364q1.007 0 1.834.504.84.49 1.316 1.386.475.895.475 2.058t-.476 2.086a3.6 3.6 0 0 1-1.315 1.428 3.45 3.45 0 0 1-1.834.504q-.883 0-1.569-.35a3.6 3.6 0 0 1-1.12-.896v4.788h-1.596V35.286h1.596zm4.69 2.688q0-.799-.336-1.372a2.14 2.14 0 0 0-.867-.882 2.25 2.25 0 0 0-1.148-.308q-.603 0-1.148.308a2.36 2.36 0 0 0-.868.896q-.323.588-.323 1.386t.322 1.4q.336.588.869.896.545.308 1.148.308.615 0 1.148-.308.546-.323.867-.924.337-.602.337-1.4m12.566-5.838v1.302h-4.13v2.87h3.22v1.302h-3.22V43H62.77v-9.73zm2.29.994a1 1 0 0 1-.727-.294 1 1 0 0 1-.294-.728q0-.434.294-.728a1 1 0 0 1 .728-.294q.42 0 .714.294a1 1 0 0 1 .294.728q0 .434-.294.728a.97.97 0 0 1-.714.294m.785 1.022V43h-1.596v-7.714zm9.165 3.668q0 .434-.056.784h-5.894q.07.924.686 1.484t1.512.56q1.288 0 1.82-1.078h1.722a3.5 3.5 0 0 1-1.274 1.75q-.91.672-2.268.672-1.106 0-1.988-.49a3.66 3.66 0 0 1-1.372-1.4q-.49-.91-.49-2.1t.476-2.086a3.44 3.44 0 0 1 1.358-1.4q.882-.49 2.016-.49 1.092 0 1.946.476.855.476 1.33 1.344.476.854.476 1.974m-1.666-.504q-.015-.883-.63-1.414-.616-.532-1.526-.532-.826 0-1.414.532-.588.518-.7 1.414zm4.833-5.81V43h-1.596V32.64zm1.563 6.468q0-1.162.476-2.058a3.56 3.56 0 0 1 3.178-1.89q.756 0 1.484.336.743.322 1.176.868V32.64h1.61V43h-1.61v-1.162q-.391.56-1.092.924-.686.364-1.582.364a3.5 3.5 0 0 1-1.848-.504 3.74 3.74 0 0 1-1.316-1.428q-.476-.924-.476-2.086m6.314.028q0-.798-.336-1.386-.323-.588-.854-.896a2.25 2.25 0 0 0-1.148-.308q-.615 0-1.148.308-.532.294-.868.882-.322.574-.322 1.372t.322 1.4q.336.602.868.924.546.308 1.148.308.615 0 1.148-.308t.854-.896q.336-.602.336-1.4m6.506 3.99a4 4 0 0 1-1.638-.322 2.96 2.96 0 0 1-1.134-.896 2.27 2.27 0 0 1-.448-1.274h1.652q.042.49.462.826.435.322 1.078.322.672 0 1.036-.252.378-.266.378-.672 0-.434-.42-.644-.405-.21-1.302-.462a13 13 0 0 1-1.414-.462 2.54 2.54 0 0 1-.952-.686q-.392-.462-.392-1.218 0-.
1615.364-1.12.364-.518 1.036-.812.686-.294 1.568-.294 1.316 0 2.114.672.813.658.868 1.806h-1.596a1.14 1.14 0 0 0-.42-.826q-.378-.308-1.022-.308-.63 0-.966.238a.74.74 0 0 0-.336.63q0 .308.224.518.225.21.546.336.322.113.952.294.84.224 1.372.462.546.224.938.672.393.448.406 1.19 0 .658-.364 1.176t-1.036.812q-.657.294-1.554.294"}),n.createElement("path",{fill:"#A8A8AC",fillRule:"evenodd",d:"M194.28 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14m-9 7a9 9 0 0 1 9-9 9 9 0 0 1 9 9 9 9 0 0 1-9 9 9 9 0 0 1-9-9",clipRule:"evenodd"}),n.createElement("path",{fill:"#8F9095",d:"M155.882 36.098q0 1.218-.84 2.03-.826.798-2.534.798h-1.876V43h-1.274v-9.758h3.15q1.652 0 2.506.798.868.798.868 2.058m-3.374 1.778q1.064 0 1.568-.462t.504-1.316q0-1.806-2.072-1.806h-1.876v3.584zm6.231-1.302q.337-.659.952-1.022.63-.364 1.526-.364v1.316h-.336q-2.142 0-2.142 2.324V43h-1.274v-7.672h1.274zm10.949 2.296q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.33 3.33 0 0 1-1.232 1.806q-.924.686-2.296.686-1.092 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1t.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.868-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2.03 2.03 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.672.615-.77 1.708zm5.854 3.22 2.38-6.496h1.358L174.954 43h-1.484l-3.01-7.672h1.372zm5.649-7.742a.84.84 0 0 1-.616-.252.84.84 0 0 1-.252-.616q0-.364.252-.616a.84.84 0 0 1 .616-.252q.351 0 .588.252a.84.84 0 0 1 .252.616.84.84 0 0 1-.252.616.78.78 0 0 1-.588.252m.616 1.246V43h-1.274v-7.672zm9.172 3.542q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.34 3.34 0 0 1-1.232 1.806q-.925.686-2.296.686-1.092 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1t.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.867-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2.03 2.03 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.672.615-.77 1.708zm13.217-3.276L199.17 43h-1.316l-1.848-6.09-1.848 6.09h-1.316l-2.408-7.672h1.302l1.764 6.44 1.904-6.44h1.302l1.862 6.454 1.736-6.454zm8.035-2.086q1.596 0 2.758.602a4.1 4.1 0 0 1 1.792 1.694q.63 1.105.63 2.604t-.63 2.604q-.616 1.092-1.792 1.68-1.162.574-2.758.574h-3.038v-9.758zm0 8.708q1.89 0 2.884-.994.994-1.008.994-2.814 0-1.82-1.008-2.842-.994-1.022-2.87-1.022h-1.764v7.672zm6.385-2.814q0-1.176.476-2.058a3.45 3.45 0 0 1 1.302-1.386q.84-.49 1.862-.49 1.008 0 1.75.434.741.434 1.106 1.092v-1.4h1.288V43h-1.288v-1.428q-.378.672-1.134 1.12-.743.434-1.736.434a3.47 3.47 0 0 1-1.848-.504 3.53 3.53 0 0 1-1.302-1.414q-.477-.91-.476-2.072m6.496.014q0-.869-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.5 2.5 0 0 0-1.302-.35q-.714 0-1.302.336-.588.335-.938.98-.35.644-.35 1.512 0 .882.35 1.54.35.644.938.994.588.336 1.302.336t1.302-.336q.601-.35.952-.994.35-.658.35-1.526m4.995-2.772V40.9q0 .56.238.798.238.224.826.224h.938V43h-1.148q-1.065 0-1.596-.49t-.532-1.61v-4.522h-.994v-1.05h.994v-1.932h1.274v1.932h2.002v1.05zm3.069 2.758q0-1.176.476-2.058a3.45 3.45 0 0 1 1.302-1.386 3.63 3.63 0 0 1 1.862-.49q1.008 0 1.75.434t1.106 1.092v-1.4h1.288V43h-1.288v-1.428q-.378.672-1.134 1.12-.742.434-1.736.434a3.5 3.5 0 0 1-1.848-.504 3.53 3.53 0 0 1-1.302-1.414q-.476-.91-.476-2.072m6.496.014q0-.869-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.5 2.5 0 0 0-1.302-.35q-.714 0-1.302.336-.588.335-.938.98-.35.644-.35 1.512 0 .882.35 1.54.35.644.938.994.588.336 1.302.336t1.302-.336q.602-.35.952-.994.35-.658.35-1.526"}),n.createElement("path",{fill:"#A8A8AC",fillRule:"evenodd",d:"M323.802 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14m-9 7a9 9 0 1 1 18 0 9 9 0 0 1-18 0",clipRule:"evenodd"}),n.createElement("path",{fill:"#8F9095",d:"M281.154 33.242V43h-1.274v-9.758zm11.397 1.946q.896 0 1.596.378.7.364 1.106 1.106t.406 1.806V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.274v-7.672h1.274v1.106a2.53 2.53 0 0 1 1.008-.924q.643-.322 1.414-.322.966 0 1.708.434.741.434 1.106 1.274a2.5 2.5 0 0 1 1.064-1.26 3.13 3.13 0 0 1 1.652-.448m6.472 1.554q.378-.658 1.12-1.092.756-.448 1.75-.448 1.022 0 1.848.49.84.49 1.316 1.386.476.882.476 2.058 0 1.162-.476 2.072a3.51 3.51 0 0 1-3.164 1.918q-.98 0-1.736-.434-.743-.448-1.134-1.106v5.054h-1.274V35.328h1.274zm5.208 2.394q0-.868-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.6 2.6 0 0 0-1.302-.336q-.7 0-1.302.35-.589.336-.952.994-.35.645-.35 1.498 0 .868.35 1.526.363.644.952.994.601.336 1.302.336.714 0 1.302-.336.601-.35.952-.994.35-.658.35-1.54m6.325 3.99a3.97 3.97 0 0 1-1.96-.49 3.56 3.56 0 0 1-1.372-1.386q-.49-.91-.49-2.1 0-1.176.504-2.072a3.5 3.5 0 0 1 1.4-1.386 4 4 0 0 1 1.974-.49q1.092 0 1.974.49a3.44 3.44 0 0 1 1.386 1.372q.518.896.518 2.086t-.532 2.1a3.6 3.6 0 0 1-1.414 1.386q-.896.49-1.988.49m0-1.12q.685 0 1.288-.322a2.4 2.4 0 0 0 .966-.966q.378-.645.378-1.568 0-.924-.364-1.568-.364-.645-.952-.952a2.6 2.6 0 0 0-1.274-.322q-.7 0-1.288.322-.575.308-.924.952-.35.645-.35 1.568 0 .938.336 1.582.35.644.924.966.573.308 1.26.308m6.883-5.432q.336-.659.952-1.022.63-.364 1.526-.364v1.316h-.336q-2.142 0-2.142 2.324V43h-1.274v-7.672h1.274zm5.502-.196V40.9q0 .56.238.798.238.224.826.224h.938V43h-1.148q-1.064 0-1.596-.49-.531-.49-.532-1.61v-4.522h-.994v-1.05h.994v-1.932h1.274v1.932h2.002v1.05zm8.552-3.136V43h-1.274v-9.7
158zm3.726 3.136V40.9q0 .56.238.798.238.224.826.224h.938V43h-1.148q-1.065 0-1.596-.49t-.532-1.61v-4.522h-.994v-1.05h.994v-1.932h1.274v1.932h2.002v1.05zm10.545 2.492q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.33 3.33 0 0 1-1.232 1.806q-.924.686-2.296.686-1.092 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1t.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.869-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2 2 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.672.615-.77 1.708zm12.224-3.416q.896 0 1.596.378.7.364 1.106 1.106t.406 1.806V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.274v-7.672h1.274v1.106a2.53 2.53 0 0 1 1.008-.924 3.1 3.1 0 0 1 1.414-.322q.966 0 1.708.434t1.106 1.274a2.52 2.52 0 0 1 1.064-1.26 3.13 3.13 0 0 1 1.652-.448m7.914 7.938q-.883 0-1.582-.294-.7-.307-1.106-.84a2.27 2.27 0 0 1-.448-1.246h1.316q.055.574.532.938.49.364 1.274.364.728 0 1.148-.322t.42-.812a.79.79 0 0 0-.448-.742q-.449-.252-1.386-.49-.854-.225-1.4-.448a2.65 2.65 0 0 1-.924-.686q-.378-.462-.378-1.204 0-.588.35-1.078t.994-.77q.643-.294 1.47-.294 1.274 0 2.058.644t.84 1.764h-1.274a1.3 1.3 0 0 0-.49-.966q-.435-.364-1.176-.364-.687 0-1.092.294-.406.294-.406.77a.88.88 0 0 0 .238.63q.252.239.616.392.378.14 1.036.322.825.225 1.344.448.517.21.882.644.378.434.392 1.134 0 .63-.35 1.134t-.994.798q-.63.28-1.456.28"})),Kn=q(d).withConfig({displayName:"ui__TableRoot"})(["border-radius:8px;"]),es=q(d).withConfig({displayName:"ui__HeaderCell"})(["flex:1 0 0;min-width:280px;padding:4px 16px;background-color:",";"],({theme:t})=>t.bg.neutral800),dn=q.button.withConfig({displayName:"ui__EditAction"})(["display:flex;align-items:center;justify-content:center;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;opacity:0;transition:opacity 0.15s ease;svg{width:16px;height:16px;fill:",";}"],({theme:t})=>t.icon.neutral500),ts=q(d).withConfig({displayName:"ui__StyledRow"})(["background-color:",";&:hover ","{opacity:1;}"],({theme:t,$variant:s})=>s==="sage"?t.bg.blue25:t.bg.white,dn),jt=q(d).withConfig({displayName:"ui__Cell"})(["flex:1 0 0;min-width:280px;padding:8px 8px 8px 16px;"]),ns=q(d).withConfig({displayName:"ui__MappingInputContainer"})(["padding:4px 8px 4px 16px;border-radius:6px;flex:1;min-width:0;"]),ss=q(j).withConfig({displayName:"ui__SampleDataText"})(["font-style:italic;color:",";"],({theme:t,$muted:s})=>s?t.text.neutral500:t.text.neutral800),is=q(d).withConfig({displayName:"ui__DividerContainer"})(["padding:12px 20px;background-color:",";",""],({theme:t,$transparent:s})=>s?"transparent":t.bg.white,({$hasBorderTop:t,theme:s})=>t&&nt(["border-top:1px solid ",";"],s.delimiter.neutral200)),rs=q(d).withConfig({displayName:"ui__RequiredBadge"})(["padding:4px 12px 4px 10px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:12px;font-weight:400;line-height:16px;letter-spacing:0.4px;white-space:nowrap;"],({theme:t})=>t.bg.neutral100,({theme:t})=>t.text.neutral600),ls=q(d).withConfig({displayName:"ui__NewBadge"})(["padding:4px 12px 4px 10px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:12px;font-weight:400;line-height:16px;letter-spacing:0.4px;white-space:nowrap;"],({theme:t})=>t.bg.blue700,({theme:t})=>t.bg.white),os=q(d).withConfig({displayName:"ui__MappedStatusBadge"})(["padding:4px 12px 4px 8px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:14px;font-weight:500;line-height:20px;white-space:nowrap;"],({theme:t})=>t.bg.green50,({theme:t})=>t.text.green600),as=q(d).withConfig({displayName:"ui__SageStatusBadge"})(["padding:4px 12px 4px 8px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:14px;font-weight:500;line-height:20px;white-space:nowrap;"],({theme:t})=>t.bg.blue700,({theme:t})=>t.bg.white),ds=q(Ee).attrs({styleType:"userCancel",type:"button"}).withConfig({displayName:"ui__ReviewButton"})(["min-width:auto;height:auto;padding:0;letter-spacing:normal;text-transform:none;"]),cs=q.button.withConfig({displayName:"ui__ExpandToggle"})(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:16px;border:1px solid ",";background-color:",";cursor:pointer;padding:0;flex-shrink:0;transform:rotate(",");transition:transform 0.2s ease;svg{width:16px;height:16px;}"],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.white,({$expanded:t})=>t?"-90deg":"90deg"),us=q(d).withConfig({displayName:"ui__FieldNameContainer"})(["min-width:0;"]),ps=q(Ee).attrs({styleType:"userCancel",type:"button"}).withConfig({displayName:"ui__AddCustomFieldButton"})(["display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;min-width:auto;height:58px;padding:8px 20px;border:none;border-top:1px solid ",";border-radius:0;background-color:",";color:",";font-size:14px;font-weight:500;line-height:20px;letter-spacing:normal;text-transform:none;text-align:left;&:hover{background-color:",";}"],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.white,({theme:t})=>t.text.neutral700,({theme:t})=>t.bg.neutral50),hs=({children:t,...s})=>e.jsx(Kn,{column:!0,fullWidth:!0,hiddenOverflow:!0,...s,children:t}),ms=({columns:t})=>e.jsx(d,{fullWidth:!0,height:"48px",children:t.map(s=>e.jsx(es,{alignItems:"center",children:e.jsx(j,{white:!0,fontMedium:!0,size:"14px",lineHeight:"20px",letterSpacing:"0.6px",uppercase:!0,nowrap:!0,trimLongString:!0,children:s})}
1,s))}),gs=({children:t,variant:s="default",...a})=>e.jsx(ts,{alignItems:"center",fullWidth:!0,height:"58px",$variant:s,...a,children:t}),xs=({children:t,column:s,...a})=>e.jsx(jt,{column:s,fullHeight:!0,...s?{justifyContent:"center"}:{alignItems:"center",gap:12},...a,children:t}),fs=({children:t,...s})=>e.jsx(jt,{fullHeight:!0,alignItems:"center",gap:12,...s,children:e.jsx(ns,{alignItems:"center",height:"40px",hiddenOverflow:!0,children:e.jsx(j,{neutral700:!0,size:"14px",lineHeight:"20px",nowrap:!0,trimLongString:!0,children:t})})}),Cs=({children:t,muted:s,...a})=>e.jsx(jt,{fullHeight:!0,alignItems:"center",gap:12,...a,children:e.jsx(ss,{block:!0,size:"14px",lineHeight:"20px",trimLongString:!0,width:"100%",minWidth:"0",$muted:s,children:t})}),bs=({children:t,...s})=>e.jsx(jt,{alignItems:"center",gap:8,fullHeight:!0,...s,children:t}),Ss=({name:t,tooltip:s})=>e.jsxs(us,{alignItems:"center",gap:4,children:[e.jsx(j,{fontMedium:!0,neutral800:!0,size:"14px",lineHeight:"20px",trimLongString:!0,minWidth:"0",children:t}),e.jsx(Ve,{content:s??t,placement:"top"})]}),ws=({children:t})=>e.jsx(j,{neutral600:!0,size:"12px",lineHeight:"16px",letterSpacing:"0.4px",nowrap:!0,children:t}),_s=({variant:t})=>{const{t:s}=Ce();
1return t==="required"?e.jsx(rs,{inline:!0,center:!0,hiddenOverflow:!0,children:s("import.mapping_table.required")}):e.jsx(ls,{inline:!0,center:!0,hiddenOverflow:!0,children:s("import.mapping_table.new")})},js=({status:t,editable:s,onEdit:a})=>{const{t:r}=Ce();return t==="mapped"?e.jsxs(os,{inline:!0,center:!0,gap:8,hiddenOverflow:!0,children:[e.jsx(Jt,{width:16,height:16}),r("import.mapping_table.mapped")]}):e.jsxs(e.Fragment,{children:[e.jsxs(as,{inline:!0,center:!0,gap:8,hiddenOverflow:!0,children:[e.jsx(st,{width:16,height:16}),r("import.mapping_table.mapped_with_sage")]}),e.jsx(W,{when:s,children:e.jsx(dn,{onClick:a,type:"button","aria-label":r("import.mapping_table.edit_mapping"),children:e.jsx(qn,{})})})]})},ys=({children:t,expandable:s,expanded:a,onToggle:r,onReview:l})=>{const{t:m}=Ce(),S=n.useContext(Be);return e.jsxs(is,{alignItems:"center",fullWidth:!0,children:[e.jsx("div",{style:{flexGrow:1}}),e.jsx(j,{fontMedium:!0,neutral500:!0,size:"14px",lineHeight:"20px",children:t}),e.jsxs(d,{grow:1,justifyContent:"flex-end",alignItems:"center",gap:8,children:[e.jsx(W,{when:s,children:e.jsx(cs,{$expanded:a,onClick:r,type:"button","aria-label":m("import.mapping_table.toggle_section"),children:e.jsx(tn,{})})}),e.jsx(W,{when:!!l,children:e.jsx(ds,{onClick:l,children:e.jsxs(d,{alignItems:"center",gap:8,children:[e.jsx(j,{neutral500:!0,size:"14px",lineHeight:"20px",children:m("import.review")}),e.jsx(Gt,{width:16,height:16,fillColor:S.text.neutral500})]})})})]})]})},Es=({label:t,onClick:s})=>e.jsxs(ps,{onClick:s,children:[e.jsx("span",{"aria-hidden":!0,children:"+"}),t]}),se=Object.assign(hs,{Header:ms,Row:gs,FieldCell:xs,MappingCell:fs,SampleCell:Cs,StatusCell:bs,FieldName:Ss,FieldSubtype:ws,FieldBadge:_s,StatusBadge:js,Divider:ys,AddCustomFieldRow:Es}),Is=({unmappedCustomFieldsCount:t,onViewSuggestions:s})=>{const{t:a}=Ce(),r=n.useContext(Be);return e.jsxs(ze,{children:[e.jsxs(ze.Content,{children:[e.jsx(ze.Title,{children:a("import.mapping_banner_title")}),e.jsx(ze.Description,{children:a("import.mapping_banner_description",{count:t})})]}),e.jsx(ze.Actions,{children:e.jsx(ze.DefaultAction,{icon:e.jsx(nn,{width:16,height:16,style:{color:r.icon.neutral700}}),onClick:s,children:a("import.view_sage_suggestions")})})]})},cn=({value:t,onChange:s})=>{const a=n.useContext(Be),r=n.useMemo(()=>Nt.find(l=>l.value===t)??null,[t]);return e.jsx(bn,{name:"label-type-select",isPartOfForm:!1,isFocusApplicable:!1,isSearchable:!1,options:Nt,value:r,onChange:l=>{l&&s(l.value)},noFieldWrapper:!0,wrapperStyles:"width: fit-content;",componentStyles:{containerStyles:{minHeight:"24px"},controlStyles:{minHeight:"24px",backgroundColor:a.bg.neutral50,border:"none",borderRadius:"4px",boxShadow:"none",outline:"none",padding:"0"},valueContainerStyles:{padding:"0 6px"},inputStyles:{margin:0,padding:0},indicatorsContainerStyles:{padding:"0 4px",alignItems:"center","& > div":{padding:0},"& svg":{width:"14px",height:"14px"},"& span":{position:"static",top:"auto",right:"auto"}},singleValueStyles:{color:a.text.neutral700,fontFamily:"Poppins",fontSize:"12px",fontStyle:"normal",fontWeight:400,lineHeight:"20px",letterSpacing:"0.4px",margin:0},menuStyles:{minWidth:"160px"},menuListStyles:{maxHeight:"240px"}}})},Mt=()=>{const{userStorage:t}=wt(),s=ye(c=>c.bulkImport.targetFolderId),a=ye(c=>c.bulkImport.targetFolderName),l=ye(c=>!!c.bulkImport.session)?void 0:t[it],m=s||l?.folderId||0,S=ye(c=>Xt(c)(m)?.name),N=s?a:l?.folderName;return{id:m,name:m&&(S||N)||Wt.name,path:m?`/folder/${m}/content`:"/items"}},vs=(t,s)=>{const{userStorage:a}=wt(),r=a[it],l=ye(S=>S.bulkImport.importResult),m=n.useRef(null);return n.useEffect(()=>{m.current=l?{...l,folderId:t.id,folderName:t.name}:null},[l,t.id,t.name]),{itemCount:l?.importedCount??r?.importedCount??s.itemCount,errorCount:l?.failedCount??r?.failedCount??s.errorCount,readResultToPersist:n.useCallback(()=>m.current,[])}},ks=()=>{const t=ye(m=>m.bulkImport.stats),[s,a]=n.useState(0),[r,l]=n.useState(0);return n.useEffect(()=>{t&&(a(Math.max((t.totalRows??0)-(t.rowsWithErrors??0),0)),l(t.rowsWithErrors??0))},[t]),{itemCount:s,errorCount:r}},Fs=()=>{const{userStorage:t}=wt();return t[Oe]||ke.FILE_UPLOAD},qs=()=>{const t=Qe(),{session:s,isUpdatingMappings:a}=ye(h=>h.bulkImport),r=ye(h=>h.customAttributes?.byId??{}),l=ye(h=>
1h.plan?.subscriptionDetails?.usageStats?.custom_fields?.limit??null),m=Object.keys(r).length,S=Ft(l),N=S?Math.max(0,Number(l)-m):1/0,[c,u]=n.useState(!0),[B,A]=n.useState({}),[D,$]=n.useState({}),[M,k]=n.useState({}),[de,H]=n.useState({}),[_,y]=n.useState({}),[O,J]=n.useState([]);n.useEffect(()=>{t({type:ue.FETCH_CUSTOM_ATTRIBUTES_REQUEST})},[t]);const ae=n.useMemo(()=>s?.mappings??[],[s?.mappings]),pe=n.useMemo(()=>ae.map(h=>({sourceIndex:h.sourceIndex,sourceHeader:h.sourceHeader})),[ae]),{sortlyFieldMappings:ge,labelFieldMappings:ce,customFieldMappings:b,unmappedSortlyFields:Z}=n.useMemo(()=>{const h=[],F=[],I=[];ae.forEach(G=>{G.targetField?h.push(G):G.targetLabel?.code?F.push(G):I.push(G)});const V=h.map(G=>G.targetField).filter(Boolean),T=Pe.filter(G=>!V.includes(G));return{sortlyFieldMappings:h,labelFieldMappings:F,customFieldMappings:I,unmappedSortlyFields:T}},[ae]),re=n.useCallback(h=>!h.targetCustomAttribute?.id&&(!!h.targetCustomAttribute||!!h.mappingSource),[]),oe=n.useMemo(()=>{const h={};if(!S)return h;let F=0;return b.forEach(I=>{re(I)&&(h[I.sourceIndex]=F<N,F<N&&(F+=1))}),h},[S,N,b,re]),ie=n.useMemo(()=>{const h={};return ge.forEach(F=>{F.targetField&&(h[F.targetField]=F.sourceIndex)}),h},[ge]),v=n.useCallback(h=>h in B?B[h]:ie[h]??null,[B,ie]),Y=n.useCallback(h=>h in M?M[h]:h,[M]),z=n.useCallback(h=>h in D?D[h]:h,[D]),Se=n.useCallback(h=>{const F=de[String(h.sourceIndex)];return F?F.checked:h.targetCustomAttribute?.id?!0:h.sourceIndex in oe?oe[h.sourceIndex]:!!h.targetCustomAttribute||!!h.mappingSource},[de,oe]),ne=n.useMemo(()=>b.filter(Se),[b,Se]),me=b.length-ne.length,Ie=n.useMemo(()=>{const h=new Set;return Pe.forEach(F=>{const I=v(F);I!==null&&h.add(I)}),ce.forEach(F=>{const I=Y(F.sourceIndex);I!==null&&h.add(I)}),ne.forEach(F=>{const I=z(F.sourceIndex);I!==null&&h.add(I)}),O.forEach(F=>{F.sourceIndex!==null&&h.add(F.sourceIndex)}),h},[v,Y,z,ce,ne,O]),ve=n.useCallback((h,F,I)=>{const V=[];I!==null&&(Pe.forEach(T=>{h==="sortly"&&T===F||v(T)===I&&V.push({kind:"sortly",key:T})}),ce.forEach(T=>{h==="label"&&T.sourceIndex===F||Y(T.sourceIndex)===I&&V.push({kind:"label",key:T.sourceIndex})}),ne.forEach(T=>{h==="custom"&&T.sourceIndex===F||z(T.sourceIndex)===I&&V.push({kind:"custom",key:T.sourceIndex})}),O.forEach(T=>{h==="newCustom"&&T.id===F||T.sourceIndex===I&&V.push({kind:"newCustom",key:T.id})})),A(T=>{const G={...T};return V.forEach(ee=>{ee.kind==="sortly"&&(G[ee.key]=null)}),h==="sortly"&&(G[F]=I),G}),k(T=>{const G={...T};return V.forEach(ee=>{ee.kind==="label"&&(G[ee.key]=null)}),h==="label"&&(G[F]=I),G}),$(T=>{const G={...T};return V.forEach(ee=>{ee.kind==="custom"&&(G[ee.key]=null)}),h==="custom"&&(G[F]=I),G}),J(T=>{const G=new Set(V.filter(ee=>ee.kind==="newCustom").map(ee=>ee.key));return T.map(ee=>G.has(ee.id)?{...ee,sourceIndex:null}:h==="newCustom"&&ee.id===F?{...ee,sourceIndex:I}:ee)})},[v,Y,z,ce,ne,O]),Ae=n.useCallback(h=>{if(h.length===0)return;const F=new Set(h.map(I=>I.sourceIndex).filter(I=>I!==null));F.size>0&&(A(I=>{const V={...I};return Pe.forEach(T=>{const G=T in V?V[T]:ie[T]??null;G!==null&&F.has(G)&&(V[T]=null)}),V}),k(I=>{const V={...I};return ce.forEach(T=>{const G=T.sourceIndex in V?V[T.sourceIndex]:T.sourceIndex;G!==null&&F.has(G)&&(V[T.sourceIndex]=null)}),V}),$(I=>{const V={...I};return ne.forEach(T=>{const G=T.sourceIndex in V?V[T.sourceIndex]:T.sourceIndex;G!==null&&F.has(G)&&(V[T.sourceIndex]=null)}),V})),J(I=>{const T=[...I.map(ee=>ee.sourceIndex!==null&&F.has(ee.sourceIndex)?{...ee,sourceIndex:null}:ee),...h],G=new Set;for(let ee=T.length-1;ee>=0;ee--){const He=T[ee];He.sourceIndex!==null&&(G.has(He.sourceIndex)?T[ee]={...He,sourceIndex:null}:G.add(He.sourceIndex))}return T})},[ie,ce,ne]),xe=n.useMemo(()=>b.map(h=>{const F=!!h.targetCustomAttribute?.id,I=F?r[String(h.targetCustomAttribute.id)]:null;let V=!!h.mappingSource;return F?V=!0:h.sourceIndex in oe&&(V=oe[h.sourceIndex]),{id:String(h.sourceIndex),name:h.targetCustomAttribute?.name??h.sourceHeader,type:h.targetCustomAttribute?.type??I?.kind?.value??"string",sample:h.sampleData?.[0]??"",checked:V,editable:!F,disabled:F,createsNewField:!F}}),[b,r,oe]),Fe=n.useMemo(()=>rt.some(h=>v(h)===null),[v]),_e=n.useCallback(h=>{const F=de[String(h.sourceIndex)],I=!!h.targetCustomAttribute?.id,V=!I&&h.mappingSource==="ai",T=I?r[String(h.targetCustomAttribute.id)]:null,G=I?T?.name??h.sourceHeader:F?.name??h.targetCustomAttribute?.name??h.sourceHeader,ee=I?T?.kind?.label:F?.type??h.targetCustomAttribute?.type;return{fieldName:G,fieldType:ee,isSageSuggested:V}},[de,r]);return{session:s,isUpdatingMappings:a,isNextDisabled:Fe,mappings:ae,sortlyFieldMappings:ge,labelFieldMappings:ce,customFieldMappings:b,visibleCustomFieldMappings:ne,excludedColumnsCount:me,customFieldsLimit:l,existingCustomFieldsCount:m,unmappedSortlyFields:Z,unmappedExpanded:c,sourceHeaders:pe,alreadyMappedIndices:Ie,manualMappings:B,customSourceMappings:D,labelSourceMappings:M,editedFields:de,labelMappings:_,newCustomFields:O,sidePanelFields:xe,setUnmappedExpanded:u,setManualMappings:A,setCustomSourceMappings:$,setLabelSourceMappings:k,setEditedFields:H,setLabelMappings:y,setNewCustomFields:J,registerNewCustomFields:Ae,getSortlyEffectiveSource:v,getLabelEffectiveSource:Y,getCustomEffectiveSource:z,handleSourceChange:ve,getCustomFieldDisplay:_e}},et=q.div.withConfig({displayName:"ui__HeaderWrapper"})(["display:grid;grid-template-columns:1fr auto 1fr;align-items:center;width:100%;"]),Ms=t=>rt.includes(t),Ts=({onExitImport:t,onNext:s,onError:a})=>{const{t:r}=Ce(),l=Qe(),{showSlidingModal:m}=qt(),{session:S,isUpdatingMappings:N,isNextDisabled:c,mappings:u,sortlyFieldMappings:B,labelFieldMappings:A,customFieldMappings:D,visibleCustomFieldMappings:$,excludedColumnsCount:M,customFieldsLimit:k,existingCustomFieldsCount:de,unmappedSortlyFields:H,unmappedExpanded:_,sourceHeaders:y,alreadyMappedIndices:O,editedFields:J,labelMappings:ae,newCustomFields:pe,sidePanelFields:ge,setUnmappedExpanded:ce,setManualMappings:b,setEditedFields:Z,setLabelMappings:re,registerNewCustomFields:oe,getSortlyEffectiveSource:ie,getLabelEffectiveSource:v,getCustomEffectiveSource:Y,handleSourceChange:z,getCustomFieldDisplay:Se}=qs(),ne=Mt(),me=n.useRef(!1),[Ie,ve]=n.useState(!1),Ae=n.useRef(!1);n.useEffect(()=>{if(!S?.id)return;const x=[],g=[];D.forEach(L=>{const{fieldName:be,isSageSuggested:qe}=Se(L);qe?g.push(be??L.sourceHeader):L.targetCustomAttribute?.id&&x.push(be??L.sourceHeader)});const P=B.map(L=>ht(L)??L.sourceHeader),K=A.map(L=>ht(L)??L.sourceHeader);he.bulkImportFieldsMapped({fileType:S.fileName?.split(".").pop()?.toLowerCase(),fieldsMapped:[...P,...K,...x,...g],folderName:ne.name,folderId:ne.id,totalFieldsCount:u.length+H.length,sortlyFieldsMapped:[...P,...K],customFieldsExistingMapped:x,sageFieldsMapped:g,sortlyFieldsUnmapped:H})},[S?.id]),n.useEffect(()=>{if(N||Ie)return l(lt(!0)),()=>{Ae.current||l(lt(!1))}},[l,N,Ie]);const xe=n.useCallback(x=>{for(const g of Pe)if(ie(g)===x)return{kind:"sortly",field:g};for(const g of A)if(v(g.sourceIndex)===x){const P=ae[String(g.sourceIndex)]??g.targetLabel?.code??"";return{kind:"label",originalSourceIndex:g.sourceIndex,code:P}}for(const g of $)if(Y(g.sourceIndex)===x)return{kind:"custom",originalSourceIndex:g.sourceIndex};
1for(const g of pe)if(g.sourceIndex===x)return{kind:"newCustom",id:g.id};return null},[ie,v,Y,A,$,ae,pe]),Fe=n.useCallback((x,g)=>{const P=ie(x);if(P!==g){const K=P!==null?u.find(be=>be.sourceIndex===P)?.sourceHeader:void 0,L=g!==null?u.find(be=>be.sourceIndex===g)?.sourceHeader:void 0;he.changedFieldMapping({fieldName:Ne(x),...K&&{originalField:K},...L&&{newField:L},type:"sortly field"})}z("sortly",x,g)},[z,ie,u]),_e=n.useCallback((x,g)=>{z("label",x,g)},[z]),h=n.useCallback((x,g)=>{z("custom",x,g)},[z]),F=n.useCallback((x,g)=>{z("newCustom",x,g)},[z]),I=n.useCallback((x,g)=>{re(P=>({...P,[String(x)]:g}))},[re]),V=n.useCallback(()=>{ce(x=>!x)},[ce]),T=n.useCallback(x=>{const g={},P=new Set,K=[];x.forEach(L=>{if(L.isNew){L.checked&&K.push({id:L.id,name:L.name,type:L.type,sourceIndex:L.sourceIndex??null});return}g[L.id]=L,L.checked&&P.add(Number(L.id))}),Z(g),b(L=>{const be={};return Object.entries(L).forEach(([qe,Me])=>{Me!==null&&P.has(Me)||(be[qe]=Me)}),be}),oe(K)},[Z,b,oe]),G=n.useCallback(x=>{const g=ge.map(K=>J[K.id]??K),P=D.filter(K=>K.mappingSource==="ai"&&!K.targetCustomAttribute?.id);me.current=!0,he.viewCustomFieldsSuggestions({sageFieldsMapped:P.map(K=>K.targetCustomAttribute?.name??K.sourceHeader),customFieldsSkipped:M,origin:x}),m("BulkImportMappingSidePanel",{data:{suggestedColumnsCount:P.length,totalAvailableFields:D.length,customFieldsLimit:k,existingCustomFieldsCount:de,fields:g,sourceHeaders:y,alreadyMappedIndices:O,onDone:T}})},[m,D,ge,J,M,k,de,y,O,T]),ee=n.useCallback(x=>{const g=xe(x);if(g?.kind==="sortly")return{sourceIndex:x,targetField:sn[g.field]??g.field,targetCustomAttribute:null,targetLabel:null};if(g?.kind==="label")return{sourceIndex:x,targetField:null,targetCustomAttribute:null,targetLabel:{code:g.code}};if(g?.kind==="custom"){const P=D.find(qe=>qe.sourceIndex===g.originalSourceIndex),K=J[String(g.originalSourceIndex)];if(P?.targetCustomAttribute?.id)return{sourceIndex:x,targetField:null,targetCustomAttribute:{id:P.targetCustomAttribute.id},targetLabel:null};const L=K?.name??P?.targetCustomAttribute?.name??P?.sourceHeader??"",be=K?.type??P?.targetCustomAttribute?.type??"string";return{sourceIndex:x,targetField:null,targetCustomAttribute:{name:L,type:be},targetLabel:null}}if(g?.kind==="newCustom"){const P=pe.find(K=>K.id===g.id);return{sourceIndex:x,targetField:null,targetCustomAttribute:{name:P?.name??"",type:P?.type??"string"},targetLabel:null}}return{sourceIndex:x,targetField:null,targetCustomAttribute:null,targetLabel:null}},[xe,D,J,pe]),He=n.useCallback((x,g)=>{const P=x.targetField??null,K=g.targetField??null;if(P!==K)return!0;const L=x.targetLabel?.code??null,be=g.targetLabel&&"code"in g.targetLabel?g.targetLabel.code??null:null;if(L!==be)return!0;const qe=x.targetCustomAttribute,Me=g.targetCustomAttribute,We=qe?.id??null,Ue=Me&&"id"in Me?Me.id??null:null,Ye=qe?.name??null,o=Me&&"name"in Me?Me.name??null:null,w=qe?.type??null,R=Me&&"type"in Me?Me.type??null:null;return We!==Ue||Ye!==o||w!==R},[]),te=n.useCallback(()=>{const x=[],g=[],P=[];Pe.forEach(X=>{const i=ie(X),f=B.find(C=>C.targetField===X)?.sourceIndex??null;i!==null?x.push(Ne(X)):g.push(X),i!==f&&P.push(Ne(X))});const K=A.filter(X=>v(X.sourceIndex)!==null).map(()=>Ne("barcode")),L=[],be=[];$.forEach(X=>{const{fieldName:i,isSageSuggested:p}=Se(X);if(p){const f=J[String(X.sourceIndex)];be.push(f?.name??i??X.sourceHeader)}else X.targetCustomAttribute?.id&&L.push(i??X.sourceHeader)});const qe=u.filter(X=>!!X.targetCustomAttribute?.id),Me=u.filter(X=>X.mappingSource==="ai"&&!!X.targetCustomAttribute?.name&&!X.targetCustomAttribute?.id),We=[];qe.forEach(X=>{const i=J[String(X.sourceIndex)];if(i&&i.checked===!1){const{fieldName:p}=Se(X);We.push(p??X.sourceHeader)}});const Ue=[],Ye=[],o=[],w=[],R=[];Me.forEach(X=>{const i=X.targetCustomAttribute.name,p=X.targetCustomAttribute?.type,f=J[String(X.sourceIndex)];if(!f){Ue.push(i);return}if(!f.checked){Ye.push(i),R.push(i);return}const C=f.name!==i,E=f.type!==p;C&&o.push(f.name),E&&w.push(f.name),C||E?R.push(f.name):Ue.push(i)});const we=P.length+We.length+R.length;return{fieldsMapped:[...x,...K,...L,...be],sortlyFieldsMapped:[...x,...K],customFieldsExistingMapped:L,sageFieldsMapped:be,sortlyFieldsUnmapped:g,totalFieldsCount:u.length+g.length,sortlyFieldsUserChanged:P,customFieldsExistingUserChanged:We,sageFieldsUserChanged:R,sageFieldsAccepted:Ue,s
1ageFieldsRejected:Ye,sageFieldsRenamed:o,sageFieldsTypeChanged:w,userChangedMapping:we>0,userChangedMappingCount:we,fieldsSkipped:M,viewedSageSuggestions:me.current}},[u,B,A,$,ie,v,J,M,Se]),Le=n.useCallback(()=>{const x=[];u.forEach(g=>{const P=ee(g.sourceIndex);He(g,P)&&x.push(P)}),he.completeFieldMapping(te()),ve(!0),l({type:ue.UPDATE_INTERACTIVE_IMPORT_MAPPINGS_REQUEST,payload:{sessionId:S?.id,mappings:x,onSuccess:()=>{Ae.current=!0,s()},onError:()=>{ve(!1),a()}}})},[u,ee,He,te,S,l,s,a]),Re=(x,g)=>{const P=ie(x),K=P!==null?u.find(be=>be.sourceIndex===P):null,L=Ms(x);return e.jsxs(se.Row,{children:[e.jsx(se.FieldCell,{children:e.jsxs(d,{center:!0,gap:8,children:[e.jsx(se.FieldName,{name:Ne(x)}),e.jsx(W,{when:L,children:e.jsx(se.FieldBadge,{variant:"required"})})]})}),e.jsx(se.FieldCell,{children:e.jsx($e,{sourceHeaders:y,alreadyMappedIndices:O,value:P,hasError:L&&P===null,onChange:be=>Fe(x,be)})}),e.jsx(se.SampleCell,{muted:P===null||g.variant==="unmapped",children:K?.sampleData?.[0]??"-"}),e.jsx(se.StatusCell,{children:e.jsx(W,{when:P!==null,children:e.jsx(se.StatusBadge,{status:"mapped"})})})]},`sortly-${x}`)};return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:r("item.bulk_import")}),e.jsx(an,{}),e.jsxs(d,{gap:16,justifyContent:"flex-end",children:[e.jsx(Ee,{style:{minWidth:"auto"},styleType:"userCancel",type:"button",onClick:t,children:r("import.exit_bulk_import")}),e.jsx(Ee,{styleType:"brandCTA",type:"button",disabled:c,onClick:Le,children:r("import.next")})]})]})}),e.jsxs(Te.Body,{left:0,maxWidth:1272,right:0,children:[e.jsx(Ge,{top:24,horizontal:24,children:e.jsx(Is,{unmappedCustomFieldsCount:M,onViewSuggestions:()=>G("view sage suggestion button")})}),e.jsx(Ge,{top:24,horizontal:24,children:e.jsxs(se,{children:[e.jsx(se.Header,{columns:[r("import.sortly_field_header"),r("import.map_to_column_header"),r("import.sample_data_header"),r("import.status_header")]}),B.map(x=>Re(x.targetField,{variant:"mapped"})),A.map(x=>{const g=v(x.sourceIndex),P=g!==null?u.find(L=>L.sourceIndex===g):null,K=ae[String(x.sourceIndex)]??x.targetLabel?.code??null;return e.jsxs(se.Row,{children:[e.jsx(se.FieldCell,{children:e.jsxs(d,{center:!0,gap:8,children:[e.jsx(se.FieldName,{name:Ne("barcode")}),e.jsx(cn,{value:K,onChange:L=>I(x.sourceIndex,L)})]})}),e.jsx(se.FieldCell,{children:e.jsx($e,{sourceHeaders:y,alreadyMappedIndices:O,value:g,onChange:L=>_e(x.sourceIndex,L)})}),e.jsx(se.SampleCell,{muted:g===null,children:P?.sampleData?.[0]??"-"}),e.jsx(se.StatusCell,{children:e.jsx(W,{when:g!==null,children:e.jsx(se.StatusBadge,{status:"mapped"})})})]},`label-${x.sourceIndex}`)}),e.jsxs(W,{when:H.length>0,children:[e.jsx(se.Divider,{expandable:!0,expanded:_,onToggle:V,children:r("import.unused_sortly_fields",{count:H.length})}),e.jsx(W,{when:_,children:H.map(x=>Re(x,{variant:"unmapped"}))})]}),e.jsx(se.Header,{columns:[r("import.custom_field_header"),r("import.map_to_column_header"),r("import.sample_data_header"),r("import.status_header")]}),$.map(x=>{const{fieldName:g,fieldType:P,isSageSuggested:K}=Se(x),L=Y(x.sourceIndex),be=L!==null?u.find(qe=>qe.sourceIndex===L):null;return e.jsxs(se.Row,{variant:K?"sage":"default",children:[e.jsx(se.FieldCell,{children:e.jsxs(d,{column:!0,gap:2,fullWidth:!0,children:[e.jsxs(d,{alignItems:"center",gap:8,children:[e.jsx(se.FieldName,{name:g}),e.jsx(W,{when:K,children:e.jsx(se.FieldBadge,{variant:"new"})})]}),e.jsx(W,{when:!!P,children:e.jsx(se.FieldSubtype,{children:P})})]})}),e.jsx(se.FieldCell,{children:e.jsx($e,{sourceHeaders:y,alreadyMappedIndices:O,value:L,onChange:qe=>h(x.sourceIndex,qe)})}),e.jsx(se.SampleCell,{muted:L===null||!x.mappingSource,children:be?.sampleData?.[0]??"-"}),e.jsx(se.StatusCell,{children:e.jsx(W,{when:L!==null&&!!x.mappingSource,children:e.jsx(se.StatusBadge,{status:K?"mappedWithSage":"mapped",editable:K,onEdit:()=>G("created with sage")})})})]},`custom-${x.sourceIndex}`)}),pe.map(x=>{const g=x.sourceIndex,P=g!==null?u.find(L=>L.sourceIndex===g):null,K=r(`custom_attribute.type_names.${x.type}.title`);return e.jsxs(se.Row,{children:[e.jsx(se.FieldCell,{children:e.jsxs(d,{column:!0,gap:2,fullWidth:!0,children:[e.jsxs(d,{alignItems:"center",gap:8,children:[e.jsx(se.FieldName,{name:x.name}),e.jsx(se.FieldBadge,{variant:"new"})]}),e.jsx(se.FieldSubtype,{children:K})]})}),e.jsx(se.FieldCell,{children:e.jsx($e,{sourceHeaders:y,alreadyMappedIndices:O,value:g,onChange:L=>F(x.id,L)})}),e.jsx(se.SampleCell,{muted:g===null,children:P?.sampleData?.[0]??"-"}),e.jsx(se.StatusCell,{children:e.jsx(W,{when:g!==null,children:e.jsx(se.StatusBadge,{status:"mapped"})})})]},`new-custom-${x.id}`)}),e.jsx(se.AddCustomFieldRow,{label:r("import.add_custom_field"),onClick:()=>G("add custom field button")})]})}),e.jsx(W,{when:M>0,children:e.jsx(Ge,{top:16,horizontal:24,children:e.jsx(se.Divider,{transparent:!0,onReview:()=>G("review not imported columns"),children:r("import.columns_not_imported",{count:M})})})})]})]})},Rs=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},n.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,clipPath:"url(#pencil_svg__clip0_2698_1403)"},n.createElement("path",{d:"M4 20h4L18.5 9.5a2.828 2.828 0 0 0-4-4L4 16zM13.5 6.5l4 4"})),n.createElement("defs",null,n.createElement("clipPath",{id:"pencil_svg__clip0_2698_1403"},n.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Ns=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},n.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})),As=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},n.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,clipPath:"url(#unlink-1_svg__clip0_2673_1496)"},n.createElement("path",{d:"M17 22v-2M9 15l6-6M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13M13 18l-.397.534a5.07 5.07 0 0 1-7.127 0 4.97 4.97 0 0 1 0-7.071L6 11M20 17h2M2 7h2M7 2v2"})),n.createElement("defs",null,n.createElement("clipPath",{id:"unlink-1_svg__clip0_2673_1496"},n.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Hs=q(d).withConfig({displayName:"ui__TableRoot"})(["border-radius:12px;border:1px solid #e5e7eb;"]),Ls=q(d).withConfig({displayName:"ui__HeaderCell"})(["flex:1 0 0;min-width:280px;padding:4px 16px;background-color:",";"],({theme:t})=>t.bg.neutral800),Bs=q(d).withConfig({displayName:"ui__RowActionsContainer"})(["margin-left:auto;flex-shrink:0;padding-right:10px;"]),Et=q.button.withConfig({displayName:"ui__RowActionButton"})(["display:flex;align-items:center;justify-content:center;background:none;border:none;cursor:pointer;padding:2px;border-radius:6px;flex-shrink:0;color:",";transition:color 0.15s ease,background-color 0.15s ease;&:hover{color:",";background-color:",";}max-height:28px;max-width:28px;height:100%;width:100%;"],({theme:t})=>t.icon.neutral500,({theme:t})=>t.icon.neutral700,({theme:t})=>t.bg.neutral50),Ds=q(d).withConfig({displayName:"ui__StyledRow"})(["background-color:",";height:64px;"],({theme:t})=>t.bg.white),yt=q(d).withConfig({displayName:"ui__Cell"})(["flex:1 0 0;min-width:280px;padding:8px 8px 8px 16px;"]),zs=q(d).withConfig({displayName:"ui__MappingInputContainer"})(["padding:4px 8px 4px 16px;border-radius:6px;flex:1;min-width:0;"]),Ps=q(j).withConfig({displayName:"ui__SampleDataText"})(["font-style:italic;color:",";"],({theme:t,$muted:s})=>s?t.text.neutral500:t.text.neutral800),Os=q(d).withConfig({displayName:"ui__DividerContainer"})(["padding:12px 20px;background-color:#f4f5f7;gap:12px;"]),Vs=q(d).withConfig({displayName:"ui__LimitNoticeContainer"})(["padding:12px 22px;height:48px;border-bottom:1px solid ",";background-color:",";"],({theme:t})=>t.delimiter.neutral100,({theme:t,$atLimit:s})=>s?t.bg.orange50:t.bg.neutral50),Ws=q(d).withConfig({displayName:"ui__LimitNoticeIcon"})(["flex-shrink:0;color:",";",""],({theme:t})=>t.icon.neutral500,({$atLimit:t,theme:s})=>t&&nt(["svg path{stroke:",";}"],s.text.orange600)),Us=q(d).withConfig({displayName:"ui__RequiredBadge"})(["padding:4px 12px 4px 10px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:12px;font-weight:400;line-height:16px;letter-spacing:0.4px;white-space:nowrap;"],({theme:t})=>t.bg.neutral100,({theme:t})=>
1t.text.neutral600),$s=q(d).withConfig({displayName:"ui__NewBadge"})(["padding:4px 12px 4px 10px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:12px;font-weight:400;line-height:16px;letter-spacing:0.4px;white-space:nowrap;"],({theme:t})=>t.bg.blue700,({theme:t})=>t.bg.white),Gs=q(d).withConfig({displayName:"ui__MappedStatusBadge"})(["padding:4px 12px 4px 8px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:14px;font-weight:500;line-height:20px;white-space:nowrap;"],({theme:t})=>t.bg.green50,({theme:t})=>t.text.green600),Qs=q(d).withConfig({displayName:"ui__SageStatusBadge"})(["padding:4px 12px 4px 8px;border-radius:4px;flex-shrink:0;background-color:",";color:",";font-size:14px;font-weight:400;line-height:20px;white-space:nowrap;"],({theme:t})=>t.bg.blue50,({theme:t})=>t.text.blue500),Ys=q(Ee).attrs({styleType:"userCancel",type:"button"}).withConfig({displayName:"ui__ReviewButton"})(["min-width:auto;height:auto;padding:0;letter-spacing:normal;text-transform:none;"]),Js=q.button.withConfig({displayName:"ui__ExpandToggle"})(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:16px;border:1px solid ",";background-color:",";cursor:pointer;padding:0;flex-shrink:0;transform:rotate(",");transition:transform 0.2s ease;svg{width:16px;height:16px;}"],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.white,({$expanded:t})=>t?"-90deg":"90deg"),Zs=q(d).withConfig({displayName:"ui__FieldNameContainer"})(["min-width:0;"]),Xs=q(Ee).attrs({styleType:"userCancel",type:"button"}).withConfig({displayName:"ui__AddCustomFieldButton"})(["display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;min-width:auto;height:58px;padding:8px 20px;border:none;border-top:1px solid ",";border-radius:0;background-color:",";color:",";font-size:14px;font-weight:500;line-height:20px;letter-spacing:normal;text-transform:none;text-align:left;&:hover{background-color:",";}"],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.white,({theme:t})=>t.text.neutral700,({theme:t})=>t.bg.neutral50),Ks=({children:t,...s})=>e.jsx(Hs,{column:!0,fullWidth:!0,hiddenOverflow:!0,...s,children:t}),ei=({columns:t,id:s})=>e.jsx(d,{fullWidth:!0,height:"48px",id:s,children:t.map(a=>e.jsx(Ls,{alignItems:"center",children:e.jsx(j,{white:!0,fontMedium:!0,size:"14px",lineHeight:"20px",letterSpacing:"0.6px",uppercase:!0,nowrap:!0,trimLongString:!0,children:a})},a))}),ti=({children:t,...s})=>e.jsx(Ds,{alignItems:"center",fullWidth:!0,...s,children:t}),ni=({children:t,column:s,...a})=>e.jsx(yt,{column:s,fullHeight:!0,...s?{justifyContent:"center"}:{alignItems:"center",gap:12},...a,children:t}),si=({children:t,...s})=>e.jsx(yt,{fullHeight:!0,alignItems:"center",gap:12,...s,children:e.jsx(zs,{alignItems:"center",height:"40px",hiddenOverflow:!0,children:e.jsx(j,{neutral700:!0,size:"14px",lineHeight:"20px",nowrap:!0,trimLongString:!0,children:t})})}),ii=({children:t,muted:s,...a})=>e.jsx(yt,{fullHeight:!0,alignItems:"center",gap:12,...a,children:e.jsx(Ps,{block:!0,size:"14px",lineHeight:"20px",trimLongString:!0,width:"100%",minWidth:"0",$muted:s,children:t})}),ri=({children:t,...s})=>e.jsx(yt,{alignItems:"center",gap:8,fullHeight:!0,...s,children:t}),li=({name:t,tooltip:s,showTooltip:a=!1})=>e.jsxs(Zs,{alignItems:"center",gap:4,children:[e.jsx(j,{fontMedium:!0,neutral800:!0,size:"14px",lineHeight:"20px",trimLongString:!0,minWidth:"0",children:t}),a&&e.jsx(Ve,{content:s??t,placement:"top"})]}),oi=({children:t})=>e.jsx(j,{neutral600:!0,size:"12px",lineHeight:"16px",letterSpacing:"0.4px",nowrap:!0,children:t}),ai=({variant:t})=>{const{t:s}=Ce();return t==="required"?e.jsx(Us,{inline:!0,center:!0,hiddenOverflow:!0,children:s("import.mapping_table.required")}):e.jsx($s,{inline:!0,center:!0,hiddenOverflow:!0,children:s("import.mapping_table.new")})},di=({status:t})=>{const{t:s}=Ce();return t==="mapped"?e.jsxs(Gs,{inline:!0,center:!0,gap:8,hiddenOverflow:!0,children:[e.jsx(Qt,{width:14,height:14}),s("import.mapping_table.mapped")]}):e.jsxs(Qs,{inline:!0,center:!0,gap:8,hiddenOverflow:!0,children:[e.jsx(st,{width:18,height:18}
1),s("import.mapping_table.created_with_sage")]})},ci=({onEdit:t,onDelete:s,onUnlink:a})=>{const{t:r}=Ce(),l=n.useContext(Be);return e.jsxs(Bs,{alignItems:"center",gap:4,children:[e.jsx(W,{when:!!t,children:e.jsx(Et,{type:"button",onClick:t,"aria-label":r("import.mapping_table.edit_mapping"),children:e.jsx(Rs,{color:l.icon.neutral500})})}),e.jsx(W,{when:!!s,children:e.jsx(Ve,{content:r("import.delete_field_tooltip"),placement:"top",children:e.jsx(Et,{type:"button",onClick:s,"aria-label":r("import.delete_field"),children:e.jsx(Ns,{color:l.icon.neutral500})})})}),e.jsx(W,{when:!!a,children:e.jsx(Ve,{content:r("import.unlink_field_tooltip"),placement:"top",children:e.jsx(Et,{type:"button",onClick:a,"aria-label":r("import.unlink_field"),children:e.jsx(As,{color:l.text.neutral500})})})})]})},ui=({children:t,expandable:s,expanded:a,onToggle:r,onReview:l})=>{const{t:m}=Ce(),S=n.useContext(Be);return e.jsxs(Os,{alignItems:"center",fullWidth:!0,children:[e.jsxs(d,{justifyContent:"flex-end",alignItems:"center",gap:8,children:[e.jsx(W,{when:s,children:e.jsx(Js,{$expanded:a,onClick:r,type:"button","aria-label":m("import.mapping_table.toggle_section"),children:e.jsx(tn,{})})}),e.jsx(W,{when:!!l,children:e.jsx(Ys,{onClick:l,children:e.jsxs(d,{alignItems:"center",gap:8,children:[e.jsx(j,{neutral500:!0,size:"14px",lineHeight:"20px",children:m("import.review")}),e.jsx(Gt,{width:16,height:16,fillColor:S.text.neutral500})]})})})]}),e.jsx(j,{fontMedium:!0,neutral500:!0,size:"14px",lineHeight:"20px",color:"#6B7280",children:t})]})},pi=({label:t,onClick:s})=>e.jsxs(Xs,{onClick:s,children:[e.jsx("span",{"aria-hidden":!0,children:"+"}),t]}),hi=({atLimit:t,children:s})=>{const a=n.useContext(Be);return e.jsxs(Vs,{alignItems:"center",gap:6,fullWidth:!0,$atLimit:t,children:[e.jsx(Ws,{center:!0,$atLimit:t,children:t?e.jsx(pt,{color:a.icon.red500,width:24,height:24}):e.jsx(Sn,{width:24,height:24})}),s]})},U=Object.assign(Ks,{Header:ei,Row:ti,FieldCell:ni,MappingCell:si,SampleCell:ii,StatusCell:ri,FieldName:li,FieldSubtype:oi,FieldBadge:ai,StatusBadge:di,RowActions:ci,Divider:ui,AddCustomFieldRow:pi,LimitNotice:hi}),mi=q(d).withConfig({displayName:"ui__SageBanner"})(["width:100%;gap:12px;border-radius:12px;border:1px solid ",";background-color:",";padding:12px 24px;min-height:56px;"],({theme:t})=>t.delimiter.blue400,({theme:t})=>t.bg.blue25),gi=q(d).withConfig({displayName:"ui__SparkleWrapper"})(["flex-shrink:0;color:",";"],({theme:t})=>t.text.blue500),xi=({sageFieldsCount:t})=>{const{t:s}=Ce(),a=n.useContext(Be);return e.jsxs(d,{column:!0,fullWidth:!0,gap:16,children:[e.jsxs(d,{column:!0,gap:6,children:[e.jsx(j,{fontBold:!0,neutral800:!0,size:"17px",lineHeight:"24px",children:s("import.mapping_review_title")}),e.jsx(j,{neutral600:!0,size:"14px",lineHeight:"20px",children:s("import.mapping_review_description")})]}),e.jsx(W,{when:t>0,children:e.jsxs(mi,{alignItems:"center",children:[e.jsx(gi,{center:!0,children:e.jsx(st,{})}),e.jsx(j,{size:"14px",lineHeight:"20px",style:{flex:1,minWidth:0,color:a.text.blue600},children:Vt(s("import.mapping_sage_banner",{count:t}))})]})})]})},fi=()=>{const t=Qe(),{session:s,isUpdatingMappings:a}=ye(o=>o.bulkImport),r=ye(o=>o.customAttributes?.byId??{}),l=ye(wn),m=ye(o=>o.plan?.subscriptionDetails?.usageStats?.custom_fields?.limit??null),S=Object.keys(r).length,N=Ft(m),c=N?Math.max(0,Number(m)-S):1/0,[u,B]=n.useState(!1),[A,D]=n.useState(!1),[$,M]=n.useState({}),[k,de]=n.useState({}),[H,_]=n.useState({}),[y,O]=n.useState({}),[J,ae]=n.useState({}),[pe,ge]=n.useState({}),[ce,b]=n.useState([]),Z=n.useRef(0);n.useEffect(()=>{t({type:ue.FETCH_CUSTOM_ATTRIBUTES_REQUEST})},[t]);const re=n.useMemo(()=>s?.mappings??[],[s?.mappings]),oe=n.useMemo(()=>re.map(o=>({sourceIndex:o.sourceIndex,sourceHeader:o.sourceHeader})),[re]),{sortlyFieldMappings:ie,labelFieldMappings:v,customFieldMappings:Y,unmappedSortlyFields:z,requiredUnmappedFields:Se}=n.useMemo(()=>{const o=[],w=[],R=[];re.forEach(i=>{i.targetField?o.push(i):i.targetLabel?.code?w.push(i):R.push(i)});const we=o.map(i=>i.targetField).filter(Boolean),X=Pe.filter(i=>!we.includes(i));return{sortlyFieldMappings:o,labelFieldMappings:w,customFieldMappings:R,unmappedSortlyFields:X.filter(i=>!rt.includes(i)),requiredUnmappedFields:X.filter(i=>rt.includes(i))}},[re]),ne=n.useMemo(()=>Y.filter(o=>!o.targetCustomAttribute?.id&&(!!o.targetCustomAttribute||!!o.mappingSource)),[Y]),me=n.useMemo(()=>(l??[]).map(o=>({id:Number(o.id),name:o.name,type:o.kind?.value??"string",typeLabel:o.kind?.label??""})),[l]),Ie=n.useMemo(()=>{const o={};return Y.forEach(w=>{const R=w.targetCustomAttribute?.id;R!=null&&(o[Number(R)]=w.sourceIndex)}),o},[Y]),ve=n.useMemo(()=>{const o={};if(!N)return o;let w=0;return ne.forEach(R=>{o[R.sourceIndex]=w<c,w<c&&(w+=1)}),o},[N,c,ne]),Ae=n.useMemo(()=>{const o={};return ie.forEach(w=>{w.targetField&&(o[w.targetField]=w.sourceIndex)}),o},[ie]),xe=n.useCallback(o=>o in $?$[o]:Ae[o]??null,[$,Ae]),Fe=n.useCallback(o=>o in H?H[o]:o,[H]),_e=n.useCallback(o=>o in k?k[o]:o,[k]),h=n.useCallback(o=>o in y?y[o]:Ie[o]??null,[y,Ie]),F=n.useCallback(o=>{const w=J[String(o.sourceIndex)];return w?w.checked!==!1:o.sourceIndex in ve?ve[o.sourceIndex]:!0},[J,ve]),I=n.useMemo(()=>ne.filter(F),[ne,F]),{existingMappedFields:V,existingUnusedFields:T}=n.useMemo(()=>{const o=[],w=[];return me.forEach(R=>{const we=h(R.id);we!==null?o.push({...R,sourceIndex:we}):w.push(R)}),{existingMappedFields:o,existingUnusedFields:w}},[me,h]),G=n.useMemo(()=>{const o=new Set;return Pe.forEach(w=>{const R=xe(w);R!==null&&o.add(R)}),v.forEach(w=>{const R=Fe(w.sourceIndex);R!==null&&o.add(R)}),I.forEach(w=>{const R=_e(w.sourceIndex);R!==null&&o.add(R)}
1),V.forEach(w=>o.add(w.sourceIndex)),ce.forEach(w=>{w.sourceIndex!==null&&o.add(w.sourceIndex)}),o},[xe,Fe,_e,v,I,V,ce]),ee=re.length-G.size,He=I.length,te=He+ce.length,Le=S+te,Re=N&&te>=c,x=n.useCallback(o=>{const w=J[String(o.sourceIndex)],R=!!o.targetCustomAttribute?.id,we=!R&&o.mappingSource==="ai",X=R?r[String(o.targetCustomAttribute.id)]:null,i=R?X?.name??o.sourceHeader:w?.name??o.targetCustomAttribute?.name??o.sourceHeader,p=R?X?.kind?.label:w?.type??o.targetCustomAttribute?.type;return{fieldName:i,fieldType:p,isSageSuggested:we}},[J,r]),g=n.useCallback(o=>{const w=ne.find(R=>R.sourceIndex===o);return{id:String(o),name:w?.targetCustomAttribute?.name??w?.sourceHeader??"",type:w?.targetCustomAttribute?.type??"string",sample:w?.sampleData?.[0]??"",checked:!0,editable:!0,disabled:!1}},[ne]),P=n.useCallback((o,w,R)=>{const we=[],X=[],i=[],p=[],f=[];R!==null&&(Pe.forEach(C=>{o==="sortly"&&C===w||xe(C)===R&&we.push(C)}),v.forEach(C=>{o==="label"&&C.sourceIndex===w||Fe(C.sourceIndex)===R&&X.push(C.sourceIndex)}),I.forEach(C=>{o==="custom"&&C.sourceIndex===w||_e(C.sourceIndex)===R&&p.push(C.sourceIndex)}),V.forEach(C=>{o==="existingCustom"&&C.id===w||C.sourceIndex===R&&i.push(C.id)}),ce.forEach(C=>{o==="newCustom"&&C.id===w||C.sourceIndex===R&&f.push(C.id)})),M(C=>{const E={...C};return we.forEach(Q=>{E[Q]=null}),o==="sortly"&&(E[w]=R),E}),_(C=>{const E={...C};return X.forEach(Q=>{E[Q]=null}),o==="label"&&(E[w]=R),E}),de(C=>o!=="custom"?C:{...C,[w]:R}),O(C=>{const E={...C};return i.forEach(Q=>{E[Q]=null}),o==="existingCustom"&&(E[w]=R),E}),p.length>0&&ae(C=>{const E={...C};return p.forEach(Q=>{const fe=String(Q);E[fe]={...E[fe]??g(Q),checked:!1}}),E}),b(C=>{let E=C;return f.length>0&&(E=E.filter(Q=>!f.includes(Q.id))),o==="newCustom"&&(E=E.map(Q=>Q.id===w?{...Q,sourceIndex:R}:Q)),E})},[xe,Fe,_e,v,I,V,ce,g]),K=n.useCallback((o,w,R)=>{Z.current+=1;const we=`new-${Z.current}-${R??"x"}`;b(X=>[{id:we,name:o,type:w,sourceIndex:null},...X]),R!==null&&P("newCustom",we,R)},[P]),L=n.useCallback((o,w,R)=>{b(we=>we.map(X=>X.id===o?{...X,name:w,type:R}:X))},[]),be=n.useCallback(o=>{b(w=>w.filter(R=>R.id!==o))},[]),qe=n.useCallback((o,w,R)=>{ae(we=>({...we,[String(o)]:{...we[String(o)]??g(o),name:w,type:R,checked:!0}}))},[g]),Me=n.useCallback(o=>{ae(w=>({...w,[String(o)]:{...w[String(o)]??g(o),checked:!1}}))},[g]),We=n.useCallback(o=>o===null?"":re.find(w=>w.sourceIndex===o)?.sampleData?.[0]??"",[re]),Ue=n.useMemo(()=>rt.some(o=>xe(o)===null),[xe]),Ye=T.map(o=>o.name).join(", ");return{session:s,isUpdatingMappings:a,isNextDisabled:Ue,mappings:re,sortlyFieldMappings:ie,labelFieldMappings:v,sageFieldMappings:ne,visibleSageFields:I,existingCustomFields:me,existingMappedFields:V,existingUnusedFields:T,newSageFieldsCount:He,usedCustomFieldsCount:Le,isAtCustomFieldLimit:Re,excludedColumnsCount:ee,customFieldsLimit:m,existingCustomFieldsCount:S,unmappedSortlyFields:z,requiredUnmappedFields:Se,unmappedExpanded:u,unusedCustomExpanded:A,unusedCustomFieldNames:Ye,sourceHeaders:oe,alreadyMappedIndices:G,editedFields:J,manualMappings:$,customSourceMappings:k,existingFieldSource:y,labelMappings:pe,newCustomFields:ce,setUnmappedExpanded:B,setUnusedCustomExpanded:D,setManualMappings:M,setLabelMappings:ge,createNewCustomField:K,updateNewCustomField:L,deleteNewCustomField:be,updateSageField:qe,deleteSageField:Me,getSortlyEffectiveSource:xe,getLabelEffectiveSource:Fe,getCustomEffectiveSource:_e,getExistingEffectiveSource:h,getSampleForSource:We,handleSourceChange:P,getCustomFieldDisplay:x}},It="BulkImportMappingSidePanelGA",Ci="bulk-import-custom-fields-section",bi=t=>rt.includes(t),Si=({onExitImport:t,onNext:s,onError:a})=>{const{t:r}=Ce(),l=Qe(),{showSlidingModal:m}=qt(),{session:S,isUpdatingMappings:N,isNextDisabled:c,mappings:u,sortlyFieldMappings:B,labelFieldMappings:A,sageFieldMappings:D,visibleSageFields:$,existingMappedFields:M,existingUnusedFields:k,newSageFieldsCount:de,usedCustomFieldsCount:H,isAtCustomFieldLimit:_,excludedColumnsCount:y,customFieldsLimit:O,unmappedSortlyFields:J,requiredUnmappedFields:ae,unmappedExpanded:pe,unusedCustomExpanded:ge,unusedCustomFieldNames:ce,sourceHeaders:b,alreadyMappedIndices:Z,editedFields:re,existingCustomFields:oe,labelMappings:ie,newCustomFields:v,setUnmappedExpanded:Y,setUnusedCustomExpanded:z,setLabelMappings:Se,createNewCustomField:ne,updateNewCustomField:me,deleteNewCustomField:Ie,updateSageField:ve,deleteSageField:Ae,getSortlyEffectiveSource:xe,getLabelEffectiveSource:Fe,getCustomEffectiveSource:_e,getExistingEffectiveSource:h,getSampleForSource:F,handleSourceChange:I,getCustomFieldDisplay:V}=fi(),T=Mt(),[G,ee]=n.useState(!1),He=n.useRef(!1),te=Ft(O);n.useEffect(()=>{if(!S?.id)return;const i=M.map(Q=>Q.name),p=$.map(Q=>V(Q).fieldName??Q.sourceHeader),f=B.map(Q=>ht(Q)??Q.sourceHeader),C=A.map(Q=>ht(Q)??Q.sourceHeader),E=k.map(Q=>Q.name);he.bulkImportFieldsMapped({fileType:S.fileName?.split(".").pop()?.toLowerCase(),fieldsMapped:[...f,...C,...i,...p],folderName:T.name,folderId:T.id,totalFieldsCount:u.length+J.length,sortlyFieldsMapped:[...f,...C],customFieldsExistingMapped:i,sageFieldsMapped:p,sortlyFieldsUnmapped:J,customFieldsUnmapped:E,customFieldsUnmappedCount:E.length,customFieldsSkipped:y,planLimitReached:_})},[S?.id]),n.useEffect(()=>{if(N||G)return l(lt(!0)),()=>{He.current||l(lt(!1))}},[l,N,G]);const Le=n.useCallback(i=>{for(const p of Pe)if(xe(p)===i)return{kind:"sortly",field:p};for(const p of A)if(Fe(p.sourceIndex)===i){const f=ie[String(p.sourceIndex)]??p.targetLabel?.code??"";return{kind:"label",originalSourceIndex:p.sourceIndex,code:f}}for(const p of $)if(_e(p.sourceIndex)===i)return{kind:"custom",originalSourceIndex:p.sourceIndex};for(const p of M)if(p.sourceIndex===i)return{kind:"existingCustom",attrId:p.id};for(const p of v)if(p.sourceIndex===i)return{kind:"newCustom",id:p.id};return null},[xe,Fe,_e,A,$,M,ie,v]),Re=n.useCallback((i,p,f,C)=>{if(C===null||f===C)return;const E=f!==null?u.find(fe=>fe.sourceIndex===f)?.sourceHeader:void 0,Q=u.find(fe=>fe.sourceIndex===C)?.sourceHeader;he.changedFieldMapping({fieldName:i,...E&&{originalField:E},...Q&&{newField:Q},type:p})},[u]),x=n.useCallback((i,p)=>{Re(Ne(i),"sortly field",xe(i),p),I("sortly",i,p)},[Re,I,xe]),g=n.useCallback((i,p)=>{Re(Ne("barcode"),"sortly field",Fe(i),p),I("label",i,p)},[Re,I,Fe]),P=n.useCallback((i,p)=>{const f=D.find(C=>C.sourceIndex===i);Re(f?V(f).fieldName??f.sourceHeader:"","sage field",_e(i),p),I("custom",i,p)},[Re,I,_e,D,V]),K=n.useCallback((i,p)=>{Re(oe.find(f=>f.id===i)?.name??"","custom field existing",h(i),p),I("existingCustom",i,p)},[Re,I,h,oe]),L=n.useCallback((i,p)=>{const f=v.find(C=>C.id===i);Re(f?.name??"","custom field new",f?.sourceIndex??null,p),I("newCustom",i,p)},[Re,I,v]),be=n.useCallback((i,p)=>{Se(f=>({...f,[String(i)]:p}))},[Se]),qe=n.useCallback(()=>{Y(i=>!i)},[Y]),Me=n.useCallback(()=>{he.toggleUnusedFields({action:ge?"collapse":"expand",customFieldsUnmapped:k.map(i=>i.name),customFieldsUnmappedCount:k.length}),z(i=>!i)},[z,ge,k]),We=n.useCallback(i=>{const{fieldName:p,fieldType:f}=V(i),C=_e(i.sourceIndex),E=p??i.sourceHeader,Q=f??"string";he.startEditCustomFieldSuggestions({fieldName:E,mappedFieldName:u.find(fe=>fe.sourceIndex===C)?.sourceHeader,fieldType:tt(Q),type:"sage field"}),m(It,{data:{mode:"edit",initialName:E,initialType:Q,sample:F(C),onSubmit:({name:fe,type:je})=>{const Je=fe!==E,Ze=je!==Q;if(Je||Ze){const at=[...Je?[At.RENAME]:[],...Ze?[At.CHANGE_TYPE]:[]];he.editCustomFieldSuggestions({action:at,fieldName:[fe],originalName:[E],fieldType:[tt(je)],originalType:[tt(Q)]})}ve(i.sourceIndex,fe,je)}}})},[m,V,_e,F,ve,u]),Ue=n.useCallback(i=>{he.startEditCustomFieldSuggestions({fieldName:i.name,mappedFieldName:u.find(p=>p.sourceIndex===i.sourceIndex)?.sourceHeader,fieldType:tt(i.type),type:"custom field new"}),m(It,{data:{mode:"edit",initialName:i.name,initialType:i.type,sample:F(i.sourceIndex),onSubmit:({name:p,type:f})=>me(i.id,p,f)}})},[m,F,me,u]),Ye=n.useCallback(()=>{he.startCreateCustomField({availableSlotsTotal:O,availableSlotsUsed:H,planLimitReached:_,page:"ai import"}),m(It,{data:{mode:"create",sourceHeaders:b,alreadyMappedIndices:Z,limitReached:_,getSampleForSource:F,onSubmit:({name:i,type:p,sourceIndex:f})=>{he.createCustomFieldImport({fieldName:i,fieldType:tt(p),mappedToColumn:f!==null?u.find(C=>C.sourceIndex===f)?.sourceHeader:void 0,availableSlotsTotal:O,availableSlotsUsed:H,planLimitReached:_}),ne(i,p,f)}}})},[m,b,Z,_,F,ne,O,H,u]),o=n.useCallback(i=>{const p=Le(i);if(p?.kind==="sortly")return{sourceIndex:i,targetField:sn[p.field]??p.field,targetCustomAttribute:null,targetLabel:null};if(p?.kind==="label")return{sourceIndex:i,targetField:null,targetCustomAttribute:null,targetLabel:{code:p.code}};if(p?.kind==="existingCustom")return{sourceIndex:i,targetField:null,targetCustomAttribute:{id:p.attrId},targetLabel:null};if(p?.kind==="custom"){const f=D.find(fe=>fe.sourceIndex===p.originalSourceIndex),C=re[String(p.originalSourceIndex)],E=C?.name??f?.targetCustomAttribute?.name??f?.sourceHeader??"",Q=C?.type??f?.targetCustomAttribute?.type??"string";return{sourceIndex:i,targetField:null,targetCustomAttribute:{name:E,type:Q},targetLabel:null}}if(p?.kind==="newCustom"){const f=v.find(C=>C.id===p.id);return{sourceIndex:i,targetField:null,targetCustomAttribute:{name:f?.name??"",type:f?.type??"string"},targetLabel:null}}return{sourceIndex:i,targetField:null,targetCustomAttribute:null,targetLabel:null}},[Le,D,re,v]),w=n.useCallback((i,p)=>{const f=i.targetField??null,C=p.targetField??null;if(f!==C)return!0;const E=i.targetLabel?.code??null,Q=p.targetLabel&&"code"in p.targetLabel?p.targetLabel.code??null:null;if(E!==Q)return!0;const fe=i.targetCustomAttribute,je=p.targetCustomAttribute,Je=fe?.id??null,Ze=je&&"id"in je?je.id??null:null,at=fe?.name??null,dt=je&&"name"in je?je.n
1ame??null:null,ct=fe?.type??null,ut=je&&"type"in je?je.type??null:null;return Je!==Ze||at!==dt||ct!==ut},[]),R=n.useCallback(()=>{const i=[];u.forEach(le=>{const De=o(le.sourceIndex);w(le,De)&&i.push(De)});const p=[],f=[];Pe.forEach(le=>{xe(le)!==null?p.push(Ne(le)):f.push(le)});const C=A.filter(le=>Fe(le.sourceIndex)!==null).map(()=>Ne("barcode")),E=M.map(le=>le.name),Q=$.map(le=>V(le).fieldName??le.sourceHeader),fe=[],je=[],Je=[],Ze=[],at=new Set($.map(le=>le.sourceIndex));D.forEach(le=>{const De=le.targetCustomAttribute?.name??le.sourceHeader,Xe=le.targetCustomAttribute?.type??"string",Ke=re[String(le.sourceIndex)];if(!at.has(le.sourceIndex)){je.push(De);return}const gt=Ke?.name??De,gn=Ke?.type??Xe;fe.push(gt),Ke&>!==De&&Je.push(gt),Ke&&gn!==Xe&&Ze.push(gt)});const dt=[];Pe.forEach(le=>{const De=B.find(Ke=>Ke.targetField===le)?.sourceIndex??null,Xe=xe(le);Xe!==null&&Xe!==De&&dt.push(Ne(le))});const ct=[];oe.forEach(le=>{const De=u.find(Ke=>Ke.targetCustomAttribute?.id===le.id)?.sourceIndex??null,Xe=h(le.id);Xe!==null&&Xe!==De&&ct.push(le.name)});const ut=[];D.forEach(le=>{const De=_e(le.sourceIndex);De!==null&&De!==le.sourceIndex&&ut.push(V(le).fieldName??le.sourceHeader)});const Tt=dt.length+ct.length+ut.length+Je.length+Ze.length+je.length+v.length;he.completeFieldMapping({fieldsMapped:[...p,...C,...E,...Q],sortlyFieldsMapped:[...p,...C],customFieldsExistingMapped:E,sageFieldsMapped:Q,sortlyFieldsUnmapped:f,totalFieldsCount:u.length+J.length,fieldsSkipped:y,viewedSageSuggestions:!1,customFieldsUnmapped:k.map(le=>le.name),planLimitReached:_,sortlyFieldsUserChanged:dt,customFieldsExistingUserChanged:ct,sageFieldsUserChanged:ut,sageFieldsAccepted:fe,sageFieldsRejected:je,sageFieldsRenamed:Je,sageFieldsTypeChanged:Ze,userChangedMapping:Tt>0,userChangedMappingCount:Tt}),ee(!0),l({type:ue.UPDATE_INTERACTIVE_IMPORT_MAPPINGS_REQUEST,payload:{sessionId:S?.id,mappings:i,onSuccess:()=>{He.current=!0,s()},onError:()=>{ee(!1),a()}}})},[u,o,w,y,J,xe,Fe,h,_e,A,B,M,k,oe,_,$,D,re,v,V,S,l,s,a]),we=(i,p)=>{const f=xe(i),C=f!==null?u.find(fe=>fe.sourceIndex===f):null,E=bi(i),Q=!E&&f!==null;return e.jsxs(U.Row,{children:[e.jsx(U.FieldCell,{children:e.jsxs(d,{center:!0,gap:8,children:[e.jsx(U.FieldName,{name:Ne(i)}),e.jsx(W,{when:E,children:e.jsx(U.FieldBadge,{variant:"required"})})]})}),e.jsx(U.FieldCell,{children:e.jsx($e,{sourceHeaders:b,alreadyMappedIndices:Z,value:f,hasError:E&&f===null,onChange:fe=>x(i,fe)})}),e.jsx(U.SampleCell,{muted:f===null||p.variant==="unmapped",children:C?.sampleData?.[0]??"-"}),e.jsxs(U.StatusCell,{children:[e.jsx(W,{when:f!==null,children:e.jsx(U.StatusBadge,{status:"mapped"})}),e.jsx(W,{when:Q,children:e.jsx(U.RowActions,{onUnlink:()=>{he.unmapFieldMapping({fieldName:Ne(i),mappedFieldName:C?.sourceHeader,type:"sortly field"}),x(i,null)}})})]})]},`sortly-${i}`)},X=(i,p)=>{const f=h(i.id),C=f!==null?u.find(E=>E.sourceIndex===f):null;return e.jsxs(U.Row,{children:[e.jsx(U.FieldCell,{children:e.jsxs(d,{column:!0,gap:2,fullWidth:!0,children:[e.jsx(U.FieldName,{name:i.name}),e.jsx(W,{when:!!i.typeLabel,children:e.jsx(U.FieldSubtype,{children:i.typeLabel})})]})}),e.jsx(U.FieldCell,{children:e.jsx($e,{sourceHeaders:b,alreadyMappedIndices:Z,value:f,onChange:E=>K(i.id,E)})}),e.jsx(U.SampleCell,{muted:f===null||p.variant==="unused",children:C?.sampleData?.[0]??"-"}),e.jsx(U.StatusCell,{children:e.jsxs(W,{when:f!==null,children:[e.jsx(U.StatusBadge,{status:"mapped"}),e.jsx(U.RowActions,{onUnlink:()=>{he.unmapFieldMapping({fieldName:i.name,mappedFieldName:C?.sourceHeader,type:"custom field existing"}),K(i.id,null)}})]})})]},`existing-${i.id}`)};return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:r("item.bulk_import")}),e.jsx(an,{}),e.jsxs(d,{gap:16,justifyContent:"flex-end",children:[e.jsx(Ee,{style:{minWidth:"auto"},styleType:"userCancel",type:"button",onClick:t,children:r("import.exit_bulk_import")}),e.jsx(Ee,{styleType:"brandCTA",type:"button",disabled:c,onClick:R,children:r("import.next")})]})]})}),e.jsxs(Te.Body,{left:0,maxWidth:1272,right:0,children:[e.jsx(Ge,{top:24,horizontal:24,children:e.jsx(xi,{sageFieldsCount:de})}),e.jsx(Ge,{top:24,horizontal:24,children:e.jsxs(U,{children:[e.jsx(U.Header,{columns:[r("import.sortly_field_header"),r("import.map_to_column_header"),r("import.sample_data_header"),r("import.status_header")]}),ae.map(i=>we(i,{variant:"mapped"})),B.map(i=>we(i.targetField,{variant:"mapped"})),A.map(i=>{const p=Fe(i.sourceIndex),f=p!==null?u.find(E=>E.sourceIndex===p):null,C=ie[String(i.sourceIndex)]??i.targetLabel?.code??null;return e.jsxs(U.Row,{children:[e.jsx(U.FieldCell,{children:e.jsxs(d,{center:!0,gap:8,children:[e.jsx(U.FieldName,{name:Ne("barcode")}),e.jsx(cn,{value:C,onChange:E=>be(i.sourceIndex,E)})]})}),e.jsx(U.FieldCell,{children:e.jsx($e,{sourceHeaders:b,alreadyMappedIndices:Z,value:p,onChange:E=>g(i.sourceIndex,E)})}),e.jsx(U.SampleCell,{muted:p===null,children:f?.sampleData?.[0]??"-"}),e.jsx(U.StatusCell,{children:e.jsxs(W,{when:p!==null,children:[e.jsx(U.StatusBadge,{status:"mapped"}),e.jsx(U.RowActions,{onUnlink:()=>{he.unmapFieldMapping({fieldName:Ne("barcode"),mappedFieldName:f?.sourceHeader,type:"sortly field"}),g(i.sourceIndex,null)}})]})})]},`label-${i.sourceIndex}`)}),e.jsxs(W,{when:J.length>0,children:[e.jsx(U.Divider,{expandable:!0,expanded:pe,onToggle:qe,children:r("import.unused_sortly_fields",{count:J.length})}),e.jsx(W,{when:pe,children:J.map(i=>we(i,{variant:"unmapped"}))})]}),e.jsx(U.Header,{id:Ci,columns:[r("import.custom_field_header"),r("import.map_to_column_header"),r("import.sample_data_header"),r("import.status_header")]}),e.jsx(W,{when:te,children:e.jsxs(U.LimitNotice,{atLimit:_,children:[e.jsx(j,{fontMedium:!0,lineHeight:"16px",..._?{orange600:!0}:{neutral500:!0},children:r("import.mapping_table.custom_fields_used",{used:H,total:O})}),e.jsx(W,{when:_,children:e.jsx(j,{lineHeight:"16px",orange600:!0,children:r("import.mapping_table.custom_fields_limit_hint")})})]})}),v.map(i=>{const p=i.sourceIndex,f=p!==null?u.find(E=>E.sourceIndex===p):null,C=tt(i.type);return e.jsxs(U.Row,{variant:"sage",children:[e.jsx(U.FieldCell,{children:e.jsxs(d,{column:!0,gap:2,fullWidth:!0,children:[e.jsx(U.FieldName,{name:i.name,showTooltip:!0}),e.jsx(U.FieldSubtype,{children:C})]})}),e.jsx(U.FieldCell,{children:e.jsx($e,{sourceHeaders:b,alreadyMappedIndices:Z,value:p,onChange:E=>L(i.id,E)})}),e.jsx(U.SampleCell,{muted:p===null,children:f?.sampleData?.[0]??"-"}),e.jsxs(U.StatusCell,{children:[e.jsx(W,{when:p!==null,children:e.jsx(U.StatusBadge,{status:"mapped"})}),e.jsx(U.RowActions,{onEdit:()=>Ue(i),onDelete:()=>{he.deleteCustomFieldMapping({fieldName:i.name,mappedFieldName:f?.sourceHeader,type:"custom field new",availableSlotsTotal:O,availableSlotsUsed:H,planLimitReached:_}),Ie(i.id)}})]})]},`new-custom-${i.id}`)}),$.map(i=>{const{fieldName:p,fieldType:f,isSageSuggested:C}=V(i),E=_e(i.sourceIndex),Q=E!==null?u.find(je=>je.sourceIndex===E):null,fe=f?tt(f):"";return e.jsxs(U.Row,{variant:"sage",children:[e.jsx(U.FieldCell,{children:e.jsxs(d,{column:!0,gap:2,fullWidth:!0,children:[e.jsx(U.FieldName,{name:p,showTooltip:!0}),e.jsx(W,{when:!!fe,children:e.jsx(U.FieldSubtype,{children:fe})})]})}),e.jsx(U.FieldCell,{children:e.jsx($e,{sourceHeaders:b,alreadyMappedIndices:Z,value:E,onChange:je=>P(i.sourceIndex,je)})}),e.jsx(U.SampleCell,{muted:E===null,children:Q?.sampleData?.[0]??"-"}),e.jsxs(U.StatusCell,{children:[e.jsx(W,{when:E!==null,children:e.jsx(U.StatusBadge,{status:C?"mappedWithSage":"mapped"})}),e.jsx(U.RowActions,{onEdit:()=>We(i),onDelete:()=>{he.deleteCustomFieldMapping({fieldName:p,mappedFieldName:Q?.sourceHeader,type:"sage field",availableSlotsTotal:O,availableSlotsUsed:H,planLimitReached:_}),Ae(i.sourceIndex)}})]})]},`sage-${i.sourceIndex}`)}),M.map(i=>X(i,{variant:"mapped"})),e.jsxs(W,{when:k.length>0,children:[e.jsx(U.Divider,{expandable:!0,expanded:ge,onToggle:Me,children:r("import.unused_custom_fields",{count:k.length,fields:ce})}),e.jsx(W,{when:ge,children:k.map(i=>X(i,{variant:"unused"}))})]}),e.jsx(U.AddCustomFieldRow,{label:r("import.add_custom_field"),onClick:Ye})]})})]})]})},wi=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:389,height:48,fill:"none",viewBox:"0 0 389 48",...t},n.createElement("path",{stroke:"#E4E4E5",strokeWidth:2,d:"M72.266 12.93h114M202.977 12.93h114"}),n.createElement("path",{fill:"#DD2A3B",d:"m63.433 16.088 6.369-6.369-1.036-1.013-5.333 5.334-2.701-2.7-1.013 1.012z"}),n.createElement("path",{fill:"#DD2A3B",d:"M72.14 11.992a7.38 7.38 0 1 0-7.38 7.38v1.62l-.462-.012a9 9 0 0 1-8.526-8.525l-.011-.463a9 9 0 0 1 9-9l.462.012a9 9 0 0 1 8.537 8.988l-.011.463a9 9 0 0 1-8.989 8.537v-1.62a7.38 7.38 0 0 0 7.38-7.38"}
1),n.createElement("path",{fill:"#54565D",d:"M38.237 33.312V43h-1.275v-7.224L33.743 43h-.895l-3.235-7.238V43H28.34v-9.688h1.372l3.584 8.008 3.584-8.008zm1.684 5.824q0-1.176.476-2.058a3.46 3.46 0 0 1 1.302-1.386q.84-.49 1.862-.49 1.008 0 1.75.434t1.106 1.092v-1.4h1.288V43h-1.288v-1.428q-.378.672-1.134 1.12-.742.434-1.736.434a3.5 3.5 0 0 1-1.848-.504 3.53 3.53 0 0 1-1.302-1.414q-.476-.91-.476-2.072m6.496.014q0-.869-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.5 2.5 0 0 0-1.302-.35q-.714 0-1.302.336-.588.335-.938.98-.35.644-.35 1.512 0 .882.35 1.54.35.644.938.994.588.336 1.302.336t1.302-.336q.602-.35.952-.994.35-.658.35-1.526m4.715-2.408q.378-.658 1.12-1.092.756-.448 1.75-.448 1.021 0 1.848.49.84.49 1.316 1.386.476.882.476 2.058 0 1.162-.476 2.072a3.5 3.5 0 0 1-3.164 1.918q-.98 0-1.736-.434-.742-.448-1.134-1.106v5.054h-1.274V35.328h1.274zm5.208 2.394q0-.868-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.6 2.6 0 0 0-1.302-.336q-.7 0-1.302.35a2.5 2.5 0 0 0-.952.994q-.35.645-.35 1.498 0 .868.35 1.526.364.644.952.994.602.336 1.302.336.714 0 1.302-.336.602-.35.952-.994.35-.658.35-1.54m12.227-5.894v1.036h-4.242v3.29h3.444v1.036h-3.444V43h-1.274v-9.758zm2.197.84a.84.84 0 0 1-.616-.252.84.84 0 0 1-.252-.616q0-.364.252-.616a.84.84 0 0 1 .616-.252q.35 0 .588.252a.84.84 0 0 1 .252.616.84.84 0 0 1-.252.616.78.78 0 0 1-.588.252m.616 1.246V43h-1.274v-7.672zm9.171 3.542q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.33 3.33 0 0 1-1.232 1.806q-.923.686-2.296.686-1.091 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1.001-1.19.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.87-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2.03 2.03 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.671.615-.77 1.708zm4.272-5.964V43h-1.274V32.64zm1.695 6.496q0-1.176.476-2.058a3.46 3.46 0 0 1 1.302-1.386 3.65 3.65 0 0 1 1.876-.49q.897 0 1.666.42.771.406 1.176 1.078v-4.06h1.288V43h-1.288v-1.442a3.03 3.03 0 0 1-1.12 1.134q-.741.434-1.736.434a3.55 3.55 0 0 1-1.862-.504 3.54 3.54 0 0 1-1.302-1.414q-.476-.91-.476-2.072m6.496.014q0-.869-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.5 2.5 0 0 0-1.302-.35q-.714 0-1.302.336-.587.335-.938.98-.35.644-.35 1.512 0 .882.35 1.54.35.644.938.994.588.336 1.302.336t1.302-.336q.603-.35.952-.994.35-.658.35-1.526m6.157 3.976q-.882 0-1.582-.294-.7-.307-1.106-.84a2.27 2.27 0 0 1-.448-1.246h1.316q.057.574.532.938.49.364 1.274.364.728 0 1.148-.322t.42-.812a.79.79 0 0 0-.448-.742q-.447-.252-1.386-.49-.855-.225-1.4-.448a2.66 2.66 0 0 1-.924-.686q-.378-.462-.378-1.204 0-.588.35-1.078t.994-.77q.645-.294 1.47-.294 1.275 0 2.058.644.784.644.84 1.764h-1.274a1.3 1.3 0 0 0-.49-.966q-.434-.364-1.176-.364-.686 0-1.092.294-.405.294-.406.77 0 .378.238.63.252.239.616.392.379.14 1.036.322.826.225 1.344.448.519.21.882.644.378.434.392 1.134 0 .63-.35 1.134t-.994.798q-.63.28-1.456.28"}),n.createElement("path",{fill:"#DD2A3B",fillRule:"evenodd",d:"M194.28 8c-2.24 0-4 1.76-4 4s1.76 4 4 4 4-1.76 4-4-1.76-4-4-4m0-5c-4.95 0-9 4.05-9 9s4.05 9 9 9 9-4.05 9-9-4.05-9-9-9m0 16.2c-3.96 0-7.2-3.24-7.2-7.2s3.24-7.2 7.2-7.2 7.2 3.24 7.2 7.2-3.24 7.2-7.2 7.2",clipRule:"evenodd"}),n.createElement("path",{fill:"#54565D",d:"M155.634 36.168q0 .742-.35 1.4t-1.12 1.078q-.77.406-1.974.406h-1.764V43h-1.596v-9.73h3.36q1.12 0 1.89.392.784.378 1.162 1.036.392.658.392 1.47m-3.444 1.582q.91 0 1.358-.406.448-.42.448-1.176 0-1.596-1.806-1.596h-1.764v3.178zm6.562-1.344q.351-.588.924-.91.588-.336 1.386-.336v1.652h-.406q-.937 0-1.428.476-.476.476-.476 1.652V43h-1.596v-7.714h1.596zm10.847 2.548q0 .434-.056.784h-5.894q.07.924.686 1.484t1.512.56q1.289 0 1.82-1.078h1.722a3.5 3.5 0 0 1-1.274 1.75q-.909.672-2.268.672-1.106 0-1.988-.49a3.67 3.67 0 0 1-1.372-1.4q-.49-.91-.49-2.1t.476-2.086a3.45 3.45 0 0 1 1.358-1.4q.882-.49 2.016-.49 1.092 0 1.946.476.855.476 1.33 1.344.476.854.476 1.974m-1.666-.504q-.013-.883-.63-1.414-.615-.532-1.526-.532-.826 0-1.414.532-.588.518-.7 1.414zm6.219 3.122 2.184-6.286h1.694L175.09 43h-1.904l-2.926-7.714h1.708zm5.896-7.308a1 1 0 0 1-.728-.294 1 1 0 0 1-.294-.728q0-.434.294-.728a1 1 0 0 1 .728-.294q.42 0 .714.294a1 1 0 0 1 .294.728q0 .434-.294.728a.97.97 0 0 1-.714.294m.784 1.022V43h-1.596v-7.714zm9.166 3.668q0 .434-.056.784h-5.894q.07.924.686 1.484.615.56 1.512.56 1.287 0 1.82-1.078h1.722a3.5 3.5 0 0 1-1.274 1.75q-.91.672-2.268.672-1.107 0-1.988-.49a3.66 3.66 0 0 1-1.372-1.4q-.49-.91-.49-2.1t.476-2.086a3.44 3.44 0 0 1 1.358-1.4q.882-.49 2.016-.49 1.091 0 1.946.476a3.36 3.36 0 0 1 1.33 1.344q.476.854.476 1.974m-1.666-.504q-.015-.883-.63-1.414-.617-.532-1.526-.532-.826 0-1.414.532-.589.518-.7 1.414zm13.596-3.164L199.534 43h-1.68l-1.554-5.698L194.746 43h-1.68l-2.408-7.714h1.624l1.61 6.202 1.638-6.202h1.666l1.568 6.174 1.596-6.174zm8.008-2.016q1.554 0 2.716.602a4.15 4.15 0 0 1 1.806 1.708q.644 1.105.644 2.59t-.644 2.576a4.2 4.2 0 0 1-1.806 1.68q-1.162.574-2.716.574h-3.178v-9.73zm0 8.428q1.707 0 2.618-.924t.91-2.604q0-1.694-.91-2.646t-2.618-.952h-1.582v7.126zm6.216-2.59q0-1.162.476-2.058a3.55 3.55 0 0 1 3.164-1.89q.91 0 1.582.364.685.35 1.092.882v-1.12h1.61V43h-1.61v-1.148q-.407.546-1.106.91t-1.596.364q-.995 0-1.82-.504a3.73 3.73 0 0 1-1.316-1.428q-.477-.924-.476-2.086m6.314.028q0-.798-.336-1.386-.323-.588-.854-.896a2.26 2.26 0 0 0-1.148-.308 2.25 2.25 0 0 0-1.148.308q-.532.294-.868.882-.322.574-.322 1.372t.322 1.4q.336.602.868.924a2.3 2.3 0 0 0 2.296 0q.531-.308.854-.896.336-.602.336-1.4m5.568-2.548v4.27q0 .435.196.63.21.182.7.182h.98V43h-1.26q-1.079 0-1.652-.504-.574-.504-.574-1.638v-4.27h-.91v-1.302h.91v-1.918h1.61v1.918h1.876v1.302zm2.815 2.52q0-1.162.476-2.058a3.55 3.55 0 0 1 3.164-1.89q.91 0 1.582.364.685.35 1.092.882v-1.12h1.61V43h-1.61v-1.148q-.407.546-1.106.91t-1.596.364q-.995 0-1.82-.504a3.73 3.73 0 0 1-1.316-1.428q-.476-.924-.476-2.086m6.314.028q0-.798-.336-1.386-.323-.588-.854-.896a2.26 2.26 0 0 0-1.148-.308 2.25 2.25 0 0 0-1.148.308q-.532.294-.868.882-.322.574-.322 1.372t.322 1.4q.336.602.868.924a2.3 2.3 0 0 0 2.296 0q.531-.308.854-.896.336-.602.336-1.4"}),n.createElement("path",{fill:"#A8A8AC",fillRule:"evenodd",d:"M323.802 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14m-9 7a9 9 0 1 1 18 0 9 9 0 0 1-18 0",clipRule:"evenodd"}),n.createElement("path",{fill:"#8F9095",d:"M281.154 33.242V43h-1.274v-9.7
158zm11.397 1.946q.896 0 1.596.378.7.364 1.106 1.106t.406 1.806V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.274v-7.672h1.274v1.106a2.53 2.53 0 0 1 1.008-.924q.643-.322 1.414-.322.966 0 1.708.434.741.434 1.106 1.274a2.5 2.5 0 0 1 1.064-1.26 3.13 3.13 0 0 1 1.652-.448m6.472 1.554q.378-.658 1.12-1.092.756-.448 1.75-.448 1.022 0 1.848.49.84.49 1.316 1.386.476.882.476 2.058 0 1.162-.476 2.072a3.51 3.51 0 0 1-3.164 1.918q-.98 0-1.736-.434-.743-.448-1.134-1.106v5.054h-1.274V35.328h1.274zm5.208 2.394q0-.868-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.6 2.6 0 0 0-1.302-.336q-.7 0-1.302.35-.589.336-.952.994-.35.645-.35 1.498 0 .868.35 1.526.363.644.952.994.601.336 1.302.336.714 0 1.302-.336.601-.35.952-.994.35-.658.35-1.54m6.325 3.99a3.97 3.97 0 0 1-1.96-.49 3.56 3.56 0 0 1-1.372-1.386q-.49-.91-.49-2.1 0-1.176.504-2.072a3.5 3.5 0 0 1 1.4-1.386 4 4 0 0 1 1.974-.49q1.092 0 1.974.49a3.44 3.44 0 0 1 1.386 1.372q.518.896.518 2.086t-.532 2.1a3.6 3.6 0 0 1-1.414 1.386q-.896.49-1.988.49m0-1.12q.685 0 1.288-.322a2.4 2.4 0 0 0 .966-.966q.378-.645.378-1.568 0-.924-.364-1.568-.364-.645-.952-.952a2.6 2.6 0 0 0-1.274-.322q-.7 0-1.288.322-.575.308-.924.952-.35.645-.35 1.568 0 .938.336 1.582.35.644.924.966.573.308 1.26.308m6.883-5.432q.336-.659.952-1.022.63-.364 1.526-.364v1.316h-.336q-2.142 0-2.142 2.324V43h-1.274v-7.672h1.274zm5.502-.196V40.9q0 .56.238.798.238.224.826.224h.938V43h-1.148q-1.064 0-1.596-.49-.531-.49-.532-1.61v-4.522h-.994v-1.05h.994v-1.932h1.274v1.932h2.002v1.05zm8.552-3.136V43h-1.274v-9.758zm3.726 3.136V40.9q0 .56.238.798.238.224.826.224h.938V43h-1.148q-1.065 0-1.596-.49t-.532-1.61v-4.522h-.994v-1.05h.994v-1.932h1.274v1.932h2.002v1.05zm10.545 2.492q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.33 3.33 0 0 1-1.232 1.806q-.924.686-2.296.686-1.092 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1t.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.869-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2 2 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.672.615-.77 1.708zm12.224-3.416q.896 0 1.596.378.7.364 1.106 1.106t.406 1.806V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.26v-4.34q0-1.148-.574-1.75-.56-.615-1.526-.616-.994 0-1.582.644-.588.63-.588 1.834V43h-1.274v-7.672h1.274v1.106a2.53 2.53 0 0 1 1.008-.924 3.1 3.1 0 0 1 1.414-.322q.966 0 1.708.434t1.106 1.274a2.52 2.52 0 0 1 1.064-1.26 3.13 3.13 0 0 1 1.652-.448m7.914 7.938q-.883 0-1.582-.294-.7-.307-1.106-.84a2.27 2.27 0 0 1-.448-1.246h1.316q.055.574.532.938.49.364 1.274.364.728 0 1.148-.322t.42-.812a.79.79 0 0 0-.448-.742q-.449-.252-1.386-.49-.854-.225-1.4-.448a2.65 2.65 0 0 1-.924-.686q-.378-.462-.378-1.204 0-.588.35-1.078t.994-.77q.643-.294 1.47-.294 1.274 0 2.058.644t.84 1.764h-1.274a1.3 1.3 0 0 0-.49-.966q-.435-.364-1.176-.364-.687 0-1.092.294-.406.294-.406.77a.88.88 0 0 0 .238.63q.252.239.616.392.378.14 1.036.322.825.225 1.344.448.517.21.882.644.378.434.392 1.134 0 .63-.35 1.134t-.994.798q-.63.28-1.456.28"})),_i=({onFixWithSage:t})=>{const{t:s}=Ce(),a=n.useContext(Be);return e.jsxs(ze,{children:[e.jsxs(ze.Content,{children:[e.jsx(ze.Title,{children:s("import.data_ready_title")}),e.jsx(ze.Description,{children:s("import.data_ready_description")})]}),e.jsx(ze.Actions,{children:e.jsx(ze.DefaultAction,{icon:e.jsx(nn,{width:16,height:16,style:{color:a.icon.neutral700}}),onClick:t,children:s("import.fix_with_sage")})})]})},ji=q(d).withConfig({displayName:"ui__HeaderWrapper"})(["gap:8px;"]),un=q(d).withConfig({displayName:"ui__TitleBlock"})(["gap:4px;"]),pn=q(j).withConfig({displayName:"ui__HeaderTitle"})(["color:",";font-size:18px;font-weight:500;line-height:24px;"],({theme:t})=>t.text.neutral800),hn=q(j).withConfig({displayName:"ui__HeaderSubtitle"})(["color:",";font-size:14px;line-height:20px;"],({theme:t})=>t.text.neutral600),yi=q(d).withConfig({displayName:"ui__ControlsRow"})(["width:100%;"]),Ei=q(j).withConfig({displayName:"ui__ItemsTotalText"})(["color:",";font-size:14px;font-weight:500;line-height:20px;letter-spacing:0.6px;text-transform:uppercase;white-space:nowrap;"],({theme:t})=>t.text.neutral800),mn=nt(["padding:4px 16px;border-radius:99px;border:1px solid;white-space:nowrap;font-size:14px;font-weight:500;line-height:20px;"]),Ii=q(d).withConfig({displayName:"ui__ReadyBadge"})(["",";background-color:",";border-color:",";color:",";"],mn,({theme:t})=>t.bg.green50,({theme:t})=>t.delimiter.green100,({theme:t})=>t.text.green600),vi=q(d).withConfig({displayName:"ui__ErrorsBadge"})(["",";background-color:",";border-color:",";color:",";"],mn,({theme:t})=>t.bg.red50,({theme:t})=>t.delimiter.red100,({theme:t})=>t.text.red500),ki=q.button.withConfig({displayName:"ui__RowSageButton"})(["display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border-radius:6px;border:1px solid ",";background-color:",";cursor:pointer;&:disabled{cursor:default;}"],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.white),Fi=q.button.withConfig({displayName:"ui__FixErrorsButton"})(["display:flex;align-items:center;justify-content:center;gap:16px;flex-shrink:0;padding:9px 24px 9px 16px;border-radius:6px;border:1px solid ",";background-color:",";color:",";font-size:11px;font-weight:700;line-height:20px;letter-spacing:1.6px;text-transform:uppercase;cursor:pointer;&:disabled{cursor:default;opacity:0.5;}"],({theme:t})=>t.delimiter.neutral200,({theme:t})=>t.bg.white,({theme:t})=>t.text.neutral700),qi=q.span.withConfig({displayName:"ui__MissingValuePlaceholder"})(["color:",";"],({theme:t})=>t.text.red500),Mi=vt(["0%{opacity:1;}50%{opacity:0.35;}100%{opacity:1;}
1"]),Ti=vt(["0%,62%{background-color:var(--sage-row-fixed-color);}100%{background-color:transparent;}"]),Ri=q(d).withConfig({displayName:"ui__GridWrapper"})(["flex:1;min-height:0;background:",";border-radius:10px;overflow:hidden;--ag-header-background-color:",";--ag-border-color:transparent;--ag-pinned-left-header-border:none;--ag-pinned-right-header-border:none;--ag-pinned-column-border:none;--ag-input-focus-border:1px solid ",";--ag-cell-editing-border:1px solid ",";--ag-range-selection-border-color:",";&& .ag-cell-focus:not(.ag-cell-range-selected):focus-within{border-right-style:solid !important;border-right-width:1px !important;}",""],({theme:t})=>t.bg.white,({theme:t})=>t.bg.neutral800,({theme:t,$isGA:s})=>s?t.delimiter.neutral800:"transparent",({theme:t,$isGA:s})=>s?t.delimiter.neutral800:"transparent",({theme:t,$isGA:s})=>s?t.delimiter.neutral700:"transparent",({$isGA:t,theme:s})=>t&&nt(["--ag-odd-row-background-color:",";--ag-row-hover-color:",";--sage-row-fixed-color:",";.ag-row{border-bottom:none;}.ag-row.sage-row-fixing{animation:"," 0.7s ease-in-out infinite;}.ag-row.sage-row-fixed{animation:"," 1.6s ease-out;}"],s.bg.neutral25,s.bg.neutral100,s.bg.green50,Mi,Ti)),Ni=({totalItems:t,itemsReadyCount:s,errorCount:a,showSkippedOnly:r,onToggleSkippedOnly:l,onFixWithSage:m})=>{const{t:S}=Ce(),N=n.useContext(Be),c=a>0;return e.jsxs(ji,{column:!0,children:[e.jsxs(un,{column:!0,children:[e.jsx(pn,{as:"h2",children:S("import.preview_title")}),e.jsx(hn,{children:S("import.preview_subtitle")})]}),e.jsxs(yi,{alignItems:"flex-end",justifyContent:"space-between",children:[e.jsxs(d,{alignItems:"center",gap:16,children:[e.jsx(Ei,{children:S("import.items_total",{count:t})}),e.jsxs(d,{alignItems:"center",gap:4,children:[e.jsx(Ii,{center:!0,children:S("import.ready_to_import",{count:s})}),e.jsx(W,{when:c,children:e.jsx(vi,{center:!0,children:S("import.with_errors",{count:a})})})]}),e.jsx(W,{when:c,children:e.jsx(Yt,{name:"onlyShowErrors",label:S("import.only_show_errors"),checked:r,onChange:l})})]}),e.jsx(W,{when:c,children:e.jsxs(Fi,{type:"button","data-testid":"fix-errors-with-sage-button",onClick:m,children:[e.jsx(st,{width:24,height:24,color:N.icon.neutral400}),S("import.fix_errors_with_sage")]})})]})]})},Ai=112,Hi=200,Li=({displayName:t})=>e.jsx(j,{white:!0,fontMedium:!0,uppercase:!0,mediumLetterSpacing:!0,smallLineHeight:!0,children:t}),Bi=(t,s,a,r,l=!1,m,S={})=>{const{t:N}=Ce(),c=n.useContext(Be),u=n.useMemo(()=>new Map(s.map(H=>[H.rowIndex,H])),[s]),B=n.useCallback(H=>_=>{const O=!!u.get(_.data?.rowIndex)?.validationErrors[H];return O&&!_.value?e.jsx(qi,{children:N("import.missing_value")}):O&&!l?e.jsx(j,{white:!0,style:{backgroundColor:c.brand,padding:"2px 4px",borderRadius:"2px"},children:_.value}):_.value},[u,l,c.brand]),A=n.useCallback(H=>_=>l?u.get(_.data?.rowIndex)?.validationErrors[H]?{backgroundColor:c.bg.red50,border:`1px solid ${c.delimiter.red500}`,color:c.text.red500}:{backgroundColor:"",border:"",color:""}:void 0,[u,l,c.bg.red50,c.delimiter.red500,c.text.red500]),D=n.useCallback(H=>{const _=u.get(H.data?.rowIndex);if(_?.hasValidationErrors){if(l){const y=_.rowIndex;return e.jsx(d,{fullHeight:!0,justifyContent:"center",alignItems:"center",children:e.jsx(Ve,{content:N("import.fix_errors"),portalAnchor:"#page-content-wrapper",children:e.jsx(ki,{type:"button","data-testid":"row-sage-button",disabled:S[y]==="fixing",onClick:()=>m?m(y):r?.(),children:e.jsx(st,{color:c.icon.neutral800})})})})}return e.jsx(d,{fullHeight:!0,justifyContent:"center",alignItems:"center",style:{cursor:"pointer"},onClick:r,children:e.jsx(st,{color:c.icon.neutral800})})}return e.jsx(d,{fullHeight:!0,justifyContent:"center",alignItems:"center",children:e.jsx(Mn,{color:c.icon.green400})})},[u,r,m,S,l,c.icon.green400,c.icon.neutral800]),$=n.useMemo(()=>({headerComponent:Li,sortable:!1,filter:!1}),[]),M=n.useMemo(()=>{const H=t.filter(O=>O?.targetField||O?.targetCustomAttribute||O?.targetLabel).sort((O,J)=>{const ae=O.targetField?0:1,pe=J.targetField?0:1;return ae-pe}),_=O=>{const J=String(O.sourceIndex),ae=O.targetField===St;return{headerName:ae?Ne(St):O.sourceHeader,field:J,cellRenderer:B(J),cellStyle:A(J),editable:!0,minWidth:Ai,...ae?{pinned:"left",width:Hi}:{flex:1}}},y=H.find(O=>O.targetField===St);return[{headerName:N("import.row_header"),field:"rowIndex",width:60,pinned:"left",cellStyle:{borderRight:"none"},headerClass:"ag-no-border-right"},...y?[_(y)]:[],...H.filter(O=>O!==y).map(_),{headerName:"",field:"status",width:60,pinned:"right",cellRenderer:D,cellRendererParams:{suppressMouseEventHandling:()=>!0},cellStyle:{borderLeft:"none"},headerClass:"ag-no-border-left"}]},[t,B,A,D]),k=n.useMemo(()=>s,[s,a]),de=n.useMemo(()=>k.map(H=>({rowIndex:H.rowIndex,...H.values})),[k]);return{columnDefs:M,defaultColDef:$,rowData:de,rowsByIndex:u}};ln();const Bt=48,Di=()=>{const{t}=Ce(),s=n.useContext(Be);return e.jsx(d,{alignItems:"center",justifyContent:"center",fullWidth:!0,style:{height:"100%"},children:e.jsx(j,{size:"14px",lineHeight:"20px",style:{color:s.text.neutral600},children:t("import.no_items_to_show")})})},zi=({mappings:t,rows:s,page:a,pageSize:r,totalRows:l,totalItems:m,itemsReadyCount:S,errorCount:N,showSkippedOnly:c,rowFixStates:u,onPageChange:B,onPageSizeChange:A,onToggleSkippedOnly:D,onOpenFixErrors:$,onFixRow:M,onCellUpdate:k})=>{const{t:de}=Ce(),H=n.useContext(Be),_=_t(),y=ye(v=>v.customAttributes?.byId),{columnDefs:O,defaultColDef:J,rowData:ae,rowsByIndex:pe}=Bi(t,s,!1,$,_,M,u),ge=n.useCallback(v=>{if(pe.get(v.data?.rowIndex)?.hasValidationErrors)return{backgroundColor:_?H.bg.red25:H.bg.red50}},[pe,_]),ce=n.useCallback(v=>
1{const Y=v.data?.rowIndex,z=_&&Y!==void 0?u?.[Y]:void 0;if(z)return z==="fixing"?"sage-row-fixing":"sage-row-fixed"},[_,u]),b=n.useCallback(v=>String(v.data.rowIndex),[]),Z=n.useRef(null),re=n.useCallback(v=>{Z.current=v.api},[]);n.useEffect(()=>{_&&Z.current?.refreshCells({force:!0})},[_,s]);const oe=n.useRef({});n.useEffect(()=>{const v=Z.current,Y=oe.current,z=u??{};if(oe.current=z,!_||!v)return;const ne=[...new Set([...Object.keys(Y),...Object.keys(z)])].filter(me=>Y[Number(me)]!==z[Number(me)]).map(me=>v.getRowNode(me)).filter(me=>!!me);ne.length&&v.redrawRows({rowNodes:ne})},[_,u]);const ie=n.useCallback(v=>{if(v.oldValue===v.newValue)return;const Y=v.colDef.field;if(!Y||Y==="rowIndex"||Y==="status")return;const z=pe.get(v.data.rowIndex),Se=z?.suggestedCorrections[Y]??null;if(_&&Se!==null){const ne=t.find(ve=>ve.targetField===St),me=ne?String(ne.sourceIndex):null,Ie=t.find(ve=>String(ve.sourceIndex)===Y);he.editSageFix({source:"inline",rowName:me?z?.values[me]??"":"",fieldName:ht(Ie,y)??Ie?.sourceHeader??v.colDef.headerName,originalValue:v.oldValue??null,sageSuggestedValue:Se,userValue:v.newValue??null})}k({rowIndex:v.data.rowIndex,sourceIndex:Y,value:v.newValue??null})},[k,t,pe,_,y]);return e.jsxs(d,{column:!0,fullWidth:!0,style:{flex:1,minHeight:0},children:[e.jsx(W,{when:_,children:e.jsx(Ni,{totalItems:m,itemsReadyCount:S,errorCount:N,showSkippedOnly:c,onToggleSkippedOnly:D,onFixWithSage:$})}),e.jsxs(W,{when:!_,children:[e.jsx(_i,{onFixWithSage:$}),e.jsxs(d,{justifyContent:"space-between",alignItems:"center",style:{padding:"24px 0 0"},children:[e.jsx(W,{when:S>=0,children:e.jsxs(d,{alignItems:"center",gap:6,style:{backgroundColor:H.bg.green50,color:H.text.green600,padding:"4px 12px",borderRadius:"6px"},children:[e.jsx(Qt,{width:14,height:14}),e.jsx(j,{size:"14px",lineHeight:"20px",style:{color:H.text.green600},children:de("import.items_ready",{count:S})})]})}),e.jsx(Yt,{name:"viewSkippedItems",label:de("import.view_skipped_items",{count:N}),checked:c,onChange:D})]})]}),e.jsxs(Ri,{column:!0,className:"ag-theme-alpine",$isGA:_,style:{marginTop:"24px"},children:[e.jsx(Ge,{style:{flex:1},children:e.jsx(Ot,{columnDefs:O,defaultColDef:J,rowData:ae,onGridReady:re,getRowId:b,getRowStyle:ge,getRowClass:ce,rowHeight:Bt,headerHeight:Bt,onCellValueChanged:ie,noRowsOverlayComponent:Di,singleClickEdit:!_,suppressMovableColumns:!0,alwaysShowHorizontalScroll:!0,alwaysShowVerticalScroll:!0})}),e.jsx(Ge,{style:{borderTop:`1px solid ${H.delimiter.neutral200}`},children:e.jsx(rn,{values:{currentPage:a,perPage:r},totalCount:l,wrapperStyles:{padding:"16px 32px"},onChange:({currentPage:v,perPage:Y})=>{B(v),Y!==r&&A(Y)}})})]})]})},Pi=1600,Oi=({sessionId:t,rows:s})=>{const a=Qe(),[r,l]=n.useState({}),m=n.useRef(!0),S=n.useRef({});n.useEffect(()=>()=>{m.current=!1,Object.values(S.current).forEach(clearTimeout)},[]);const N=n.useCallback(u=>{delete S.current[u],l(B=>{const{[u]:A,...D}=B;return D})},[]),c=n.useCallback(u=>{if(!t||r[u])return!1;const B=s.find(D=>D.rowIndex===u);if(!B)return!1;
1const A=Object.keys(B.validationErrors).reduce((D,$)=>{const M=B.suggestedCorrections[$];return M!=null&&(D[$]=M),D},{});return Object.keys(A).length===0?!1:(l(D=>({...D,[u]:"fixing"})),a({type:ue.UPDATE_INTERACTIVE_IMPORT_ROWS_REQUEST,payload:{sessionId:t,rows:[{row_index:u,values:A}],onSuccess:()=>{m.current&&(l(D=>({...D,[u]:"fixed"})),S.current[u]=setTimeout(()=>{m.current&&N(u)},Pi))},onError:()=>{m.current&&N(u)}}}),!0)},[a,t,s,r,N]);return{rowFixStates:r,fixRow:c}},Vi=20,Wi=({onBack:t,onExitImport:s,onStartImporting:a,onImportComplete:r,onPartialImport:l,onFinishPartialImport:m,onImportError:S})=>{const{t:N}=Ce(),c=Qe(),u=fn(),{showSlidingModal:B}=qt(),A=_t(),{isAtLimit:D}=Kt(),$=en(),{session:M,stats:k,rows:de,rowsMeta:H,isFetchingRows:_,isFetchingStats:y,isApplyingSuggestions:O}=ye(te=>te.bulkImport),J=ye(te=>te.slidingModal.show&&te.slidingModal.component==="FixErrorsSidePanel"),[ae,pe]=n.useState(1),[ge,ce]=n.useState(Vi),[b,Z]=n.useState(!1),[re,oe]=n.useState(!1),[ie,v]=n.useState(!1),Y=n.useCallback((te,Le,Re)=>{M?.id&&c({type:ue.FETCH_INTERACTIVE_IMPORT_ROWS_REQUEST,payload:{sessionId:M.id,page:te,pageSize:Le,hasValidationErrors:Re}})},[c,M?.id]);n.useEffect(()=>{Y(ae,ge,b)},[Y,ae,ge,b]);const Se=_||O&&!(re&&J);n.useEffect(()=>{if(Se)return c(lt(!0)),()=>{c(lt(!1))}},[c,Se]);const ne=n.useCallback(te=>{pe(te)},[]),me=n.useCallback(te=>{ce(te),pe(1)},[]),Ie=n.useCallback(()=>{Z(te=>{const Le=!te;return Le&&he.viewedSkippedRows({itemsSkipped:k?.rowsWithErrors??0}),Le}),pe(1)},[k?.rowsWithErrors]),{rowFixStates:ve,fixRow:Ae}=Oi({sessionId:M?.id,rows:de}),xe=n.useMemo(()=>M?.mappings??[],[M?.mappings]),Fe=H?.totalRows??0,_e=Math.max((k?.totalRows??0)-(k?.rowsWithErrors??0),0),h=n.useCallback(te=>{c({type:ue.SHOW_MODAL,payload:{component:A?"PartialImportModalGA":"PartialImportModal",styleType:"light",isDefaultHeadingHidden:!0,showCrossBtn:!1,autoWidth:!0,data:{errorCount:te,finishHandler:()=>{c({type:ue.HIDE_MODAL}),m()},reviewHandler:()=>{c({type:ue.HIDE_MODAL}),l()}}}})},[c,m,l,A]),F=n.useCallback(()=>{M?.id&&(a(),c({type:ue.PROCESS_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:M.id,onSuccess:r,onPartialSuccess:h,onError:S}}))},[c,M,a,r,h,S]),I=n.useCallback(()=>{if(M?.id){if(D){$();return}c({type:ue.FETCH_INTERACTIVE_IMPORT_SESSION_STATS_REQUEST,payload:{sessionId:M.id,onSuccess:te=>{te>0?(he.viewSkipImportModal({itemsSkipped:te,itemsReady:Math.max((k?.totalRows??0)-te,0)}),c({type:ue.SHOW_MODAL,payload:{component:A?"ConfirmImportWithErrorsModalGA":"ConfirmImportWithErrorsModal",styleType:"light",size:"small",isDefaultHeadingHidden:!0,showCrossBtn:!1,data:{errorCount:te,cancelHandler:()=>c({type:ue.HIDE_MODAL}),submitHandler:()=>{he.confirmImportWithErrors({itemsSkipped:te,itemsReady:Math.max((k?.totalRows??0)-te,0)}),c({type:ue.HIDE_MODAL}),F()}}}})):F()}}})}},[c,M?.id,k?.totalRows,F,A,D,$]),V=n.useCallback(te=>{M?.id&&c({type:ue.UPDATE_INTERACTIVE_IMPORT_ROWS_REQUEST,payload:{sessionId:M.id,rows:[{row_index:te.rowIndex,values:{[te.sourceIndex]:te.value}}]}})},[c,M?.id]),T=n.useCallback((te,Le)=>{if(!M?.id){Le?.onError?.();return}oe(!0),c({type:ue.APPLY_INTERACTIVE_IMPORT_SUGGESTIONS_REQUEST,payload:{sessionId:M.id,overrides:te?.overrides,excludeRowIndices:te?.excludeRowIndices,onSuccess:()=>{oe(!1),Le?.onSuccess?.()},onError:()=>{oe(!1),Le?.onError?.()}}})},[c,M?.id]),G=!Se&&!!H,ee=n.useCallback(()=>{!M?.id||ie||(he.fixWithSage({itemsSkipped:k?.rowsWithErrors??0}),v(!0),c({type:ue.FETCH_INTERACTIVE_IMPORT_SESSION_STATS_REQUEST,payload:{sessionId:M.id,onSuccess:te=>{v(!1),B("FixErrorsSidePanel",{data:{sessionId:M.id,mappings:xe,errorRowCount:te,itemsReadyCount:Math.max((k?.totalRows??0)-te,0),onApplyFixes:T}})},onFailure:()=>v(!1)}}))},[c,B,xe,T,M?.id,k?.rowsWithErrors,k?.totalRows,ie]),He=n.useCallback(te=>{ve[te]||Ae(te)||ee()},[ve,Ae,ee]);return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsxs(d,{column:!0,children:[e.jsx(_n,{color:u.text.neutral600,message:N("import.back_to_map_fields"),onClick:t}),e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:N("item.bulk_import")})]}),e.jsx(wi,{}),e.jsxs(d,{gap:16,justifyContent:"flex-end",children:[e.jsx(Ee,{style:{minWidth:"auto"},styleType:"userCancel",type:"button",onClick:s,children:N("import.exit_bulk_import")}),e.jsx(Ee,{styleType:"brandCTA",type:"button",onClick:I,disabled:y,showSpinner:y&&!ie,children:N("import.import")})]})]})}),e.jsx(Te.Body,{left:0,right:0,style:{padding:"24px",display:"flex",flexDirection:"column",height:"calc(100vh - 65px)",overflow:"hidden"},children:e.jsx(W,{when:G,children:e.jsx(zi,{mappings:xe,rows:de,page:ae,pageSize:ge,totalRows:Fe,totalItems:k?.totalRows??0,itemsReadyCount:_e,errorCount:k?.rowsWithErrors??0,showSkippedOnly:b,rowFixStates:ve,onPageChange:ne,onPageSizeChange:me,onToggleSkippedOnly:Ie,onOpenFixErrors:ee,onFixRow:He,onCellUpdate:V})})})]})},mt=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:389,height:48,fill:"none",viewBox:"0 0 389 48",...t},n.createElement("path",{stroke:"#E4E4E5",strokeWidth:2,d:"M72.266 12.93h114M202.977 12.93h114"}),n.createElement("path",{fill:"#DD2A3B",d:"m63.433 16.088 6.369-6.369-1.036-1.013-5.333 5.334-2.701-2.7-1.013 1.012z"}),n.createElement("path",{fill:"#DD2A3B",d:"M72.14 11.992a7.38 7.38 0 1 0-7.38 7.38v1.62l-.462-.012a9 9 0 0 1-8.526-8.525l-.011-.463a9 9 0 0 1 9-9l.462.012a9 9 0 0 1 8.537 8.988l-.011.463a9 9 0 0 1-8.989 8.537v-1.62a7.38 7.38 0 0 0 7.38-7.38"}
1),n.createElement("path",{fill:"#54565D",d:"M38.059 33.27V43h-1.596v-6.664L33.495 43h-1.106l-2.983-6.664V43h-1.595v-9.73h1.721l3.417 7.63 3.401-7.63zm1.565 5.838q0-1.162.476-2.058a3.56 3.56 0 0 1 3.164-1.89q.91 0 1.582.364.687.35 1.092.882v-1.12h1.61V43h-1.61v-1.148q-.406.546-1.106.91t-1.596.364q-.994 0-1.82-.504a3.74 3.74 0 0 1-1.316-1.428q-.476-.924-.476-2.086m6.314.028q0-.798-.336-1.386-.322-.588-.854-.896a2.25 2.25 0 0 0-1.148-.308q-.615 0-1.148.308-.532.294-.868.882-.322.574-.322 1.372t.322 1.4q.336.602.868.924.546.308 1.148.308.616 0 1.148-.308.533-.308.854-.896.336-.602.336-1.4m5.302-2.716q.407-.532 1.106-.896a3.4 3.4 0 0 1 1.583-.364q1.007 0 1.834.504.84.49 1.316 1.386.475.895.475 2.058t-.476 2.086a3.6 3.6 0 0 1-1.315 1.428 3.45 3.45 0 0 1-1.834.504q-.883 0-1.569-.35a3.6 3.6 0 0 1-1.12-.896v4.788h-1.596V35.286h1.596zm4.69 2.688q0-.799-.336-1.372a2.14 2.14 0 0 0-.867-.882 2.25 2.25 0 0 0-1.148-.308q-.603 0-1.148.308a2.36 2.36 0 0 0-.868.896q-.323.588-.323 1.386t.322 1.4q.336.588.869.896.545.308 1.148.308.615 0 1.148-.308.546-.323.867-.924.337-.602.337-1.4m12.566-5.838v1.302h-4.13v2.87h3.22v1.302h-3.22V43H62.77v-9.73zm2.29.994a1 1 0 0 1-.727-.294 1 1 0 0 1-.294-.728q0-.434.294-.728a1 1 0 0 1 .728-.294q.42 0 .714.294a1 1 0 0 1 .294.728q0 .434-.294.728a.97.97 0 0 1-.714.294m.785 1.022V43h-1.596v-7.714zm9.165 3.668q0 .434-.056.784h-5.894q.07.924.686 1.484t1.512.56q1.288 0 1.82-1.078h1.722a3.5 3.5 0 0 1-1.274 1.75q-.91.672-2.268.672-1.106 0-1.988-.49a3.66 3.66 0 0 1-1.372-1.4q-.49-.91-.49-2.1t.476-2.086a3.44 3.44 0 0 1 1.358-1.4q.882-.49 2.016-.49 1.092 0 1.946.476.855.476 1.33 1.344.476.854.476 1.974m-1.666-.504q-.015-.883-.63-1.414-.616-.532-1.526-.532-.826 0-1.414.532-.588.518-.7 1.414zm4.833-5.81V43h-1.596V32.64zm1.563 6.468q0-1.162.476-2.058a3.56 3.56 0 0 1 3.178-1.89q.756 0 1.484.336.743.322 1.176.868V32.64h1.61V43h-1.61v-1.162q-.391.56-1.092.924-.686.364-1.582.364a3.5 3.5 0 0 1-1.848-.504 3.74 3.74 0 0 1-1.316-1.428q-.476-.924-.476-2.086m6.314.028q0-.798-.336-1.386-.323-.588-.854-.896a2.25 2.25 0 0 0-1.148-.308q-.615 0-1.148.308-.532.294-.868.882-.322.574-.322 1.372t.322 1.4q.336.602.868.924.546.308 1.148.308.615 0 1.148-.308t.854-.896q.336-.602.336-1.4m6.506 3.99a4 4 0 0 1-1.638-.322 2.96 2.96 0 0 1-1.134-.896 2.27 2.27 0 0 1-.448-1.274h1.652q.042.49.462.826.435.322 1.078.322.672 0 1.036-.252.378-.266.378-.672 0-.434-.42-.644-.405-.21-1.302-.462a13 13 0 0 1-1.414-.462 2.54 2.54 0 0 1-.952-.686q-.392-.462-.392-1.218 0-.615.364-1.12.364-.518 1.036-.812.686-.294 1.568-.294 1.316 0 2.114.672.813.658.868 1.806h-1.596a1.14 1.14 0 0 0-.42-.826q-.378-.308-1.022-.308-.63 0-.966.238a.74.74 0 0 0-.336.63q0 .308.224.518.225.21.546.336.322.113.952.294.84.224 1.372.462.546.224.938.672.393.448.406 1.19 0 .658-.364 1.176t-1.036.812q-.657.294-1.554.294"}),n.createElement("path",{fill:"#DD2A3B",d:"m192.952 16.088 6.369-6.369-1.035-1.013-5.334 5.334-2.7-2.7-1.013 1.012z"}),n.createElement("path",{fill:"#DD2A3B",d:"M201.659 11.992a7.379 7.379 0 1 0-14.758 0 7.38 7.38 0 0 0 7.379 7.38v1.62l-.463-.012a9 9 0 0 1-8.525-8.525l-.012-.463a9 9 0 0 1 9-9l.463.012a9 9 0 0 1 8.537 8.988l-.012.463a9 9 0 0 1-8.988 8.537v-1.62a7.38 7.38 0 0 0 7.379-7.38"}),n.createElement("path",{fill:"#54565D",d:"M155.882 36.098q0 1.218-.84 2.03-.826.798-2.534.798h-1.876V43h-1.274v-9.758h3.15q1.652 0 2.506.798.868.798.868 2.058m-3.374 1.778q1.064 0 1.568-.462t.504-1.316q0-1.806-2.072-1.806h-1.876v3.584zm6.231-1.302q.337-.659.952-1.022.63-.364 1.526-.364v1.316h-.336q-2.142 0-2.142 2.324V43h-1.274v-7.672h1.274zm10.949 2.296q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.33 3.33 0 0 1-1.232 1.806q-.924.686-2.296.686-1.092 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1t.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.868-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2.03 2.03 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.672.615-.77 1.708zm5.854 3.22 2.38-6.496h1.358L174.954 43h-1.484l-3.01-7.672h1.372zm5.649-7.742a.84.84 0 0 1-.616-.252.84.84 0 0 1-.252-.616q0-.364.252-.616a.84.84 0 0 1 .616-.252q.351 0 .588.252a.84.84 0 0 1 .252.616.84.84 0 0 1-.252.616.78.78 0 0 1-.588.252m.616 1.246V43h-1.274v-7.672zm9.172 3.542q0 .365-.042.77h-6.132q.07 1.134.77 1.778.714.63 1.722.63.826 0 1.372-.378.56-.392.784-1.036h1.372a3.34 3.34 0 0 1-1.232 1.806q-.925.686-2.296.686-1.092 0-1.96-.49a3.5 3.5 0 0 1-1.344-1.386q-.49-.91-.49-2.1t.476-2.086a3.3 3.3 0 0 1 1.33-1.372q.867-.49 1.988-.49 1.092 0 1.932.476t1.288 1.316q.462.826.462 1.876m-1.316-.266q0-.727-.322-1.246a2.03 2.03 0 0 0-.882-.798 2.6 2.6 0 0 0-1.218-.28q-.966 0-1.652.616-.672.615-.77 1.708zm13.217-3.276L199.17 43h-1.316l-1.848-6.09-1.848 6.09h-1.316l-2.408-7.672h1.302l1.764 6.44 1.904-6.44h1.302l1.862 6.454 1.736-6.454zm8.035-2.086q1.596 0 2.758.602a4.1 4.1 0 0 1 1.792 1.694q.63 1.105.63 2.604t-.63 2.604q-.616 1.092-1.792 1.68-1.162.574-2.758.574h-3.038v-9.7
158zm0 8.708q1.89 0 2.884-.994.994-1.008.994-2.814 0-1.82-1.008-2.842-.994-1.022-2.87-1.022h-1.764v7.672zm6.385-2.814q0-1.176.476-2.058a3.45 3.45 0 0 1 1.302-1.386q.84-.49 1.862-.49 1.008 0 1.75.434.741.434 1.106 1.092v-1.4h1.288V43h-1.288v-1.428q-.378.672-1.134 1.12-.743.434-1.736.434a3.47 3.47 0 0 1-1.848-.504 3.53 3.53 0 0 1-1.302-1.414q-.477-.91-.476-2.072m6.496.014q0-.869-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.5 2.5 0 0 0-1.302-.35q-.714 0-1.302.336-.588.335-.938.98-.35.644-.35 1.512 0 .882.35 1.54.35.644.938.994.588.336 1.302.336t1.302-.336q.601-.35.952-.994.35-.658.35-1.526m4.995-2.772V40.9q0 .56.238.798.238.224.826.224h.938V43h-1.148q-1.065 0-1.596-.49t-.532-1.61v-4.522h-.994v-1.05h.994v-1.932h1.274v1.932h2.002v1.05zm3.069 2.758q0-1.176.476-2.058a3.45 3.45 0 0 1 1.302-1.386 3.63 3.63 0 0 1 1.862-.49q1.008 0 1.75.434t1.106 1.092v-1.4h1.288V43h-1.288v-1.428q-.378.672-1.134 1.12-.742.434-1.736.434a3.5 3.5 0 0 1-1.848-.504 3.53 3.53 0 0 1-1.302-1.414q-.476-.91-.476-2.072m6.496.014q0-.869-.35-1.512a2.4 2.4 0 0 0-.952-.98 2.5 2.5 0 0 0-1.302-.35q-.714 0-1.302.336-.588.335-.938.98-.35.644-.35 1.512 0 .882.35 1.54.35.644.938.994.588.336 1.302.336t1.302-.336q.602-.35.952-.994.35-.658.35-1.526"}),n.createElement("path",{fill:"#DD2A3B",fillRule:"evenodd",d:"M323.802 8c-2.24 0-4 1.76-4 4s1.76 4 4 4 4-1.76 4-4-1.76-4-4-4m0-5c-4.95 0-9 4.05-9 9s4.05 9 9 9 9-4.05 9-9-4.05-9-9-9m0 16.2c-3.96 0-7.2-3.24-7.2-7.2s3.24-7.2 7.2-7.2 7.2 3.24 7.2 7.2-3.24 7.2-7.2 7.2",clipRule:"evenodd"}),n.createElement("path",{fill:"#54565D",d:"M280.948 33.27V43h-1.596v-9.73zm11.433 1.89q.91 0 1.624.378.728.378 1.134 1.12.42.742.42 1.792V43h-1.582v-4.312q0-1.035-.518-1.582-.518-.56-1.414-.56t-1.428.56q-.518.546-.518 1.582V43h-1.582v-4.312q0-1.035-.518-1.582-.518-.56-1.414-.56t-1.428.56q-.518.546-.518 1.582V43h-1.596v-7.714h1.596v.882q.392-.476.994-.742a3.15 3.15 0 0 1 1.288-.266q.924 0 1.652.392t1.12 1.134a2.54 2.54 0 0 1 1.092-1.106 3.2 3.2 0 0 1 1.596-.42m6.805 1.26q.405-.532 1.106-.896a3.4 3.4 0 0 1 1.582-.364q1.008 0 1.834.504.84.49 1.316 1.386t.476 2.058-.476 2.086a3.6 3.6 0 0 1-1.316 1.428 3.45 3.45 0 0 1-1.834.504q-.882 0-1.568-.35a3.6 3.6 0 0 1-1.12-.896v4.788h-1.596V35.286h1.596zm4.69 2.688q0-.799-.336-1.372a2.14 2.14 0 0 0-.868-.882 2.301 2.301 0 0 0-2.296 0 2.36 2.36 0 0 0-.868.896q-.322.588-.322 1.386t.322 1.4q.336.588.868.896a2.3 2.3 0 0 0 2.296 0 2.3 2.3 0 0 0 .868-.924q.336-.602.336-1.4m6.548 4.018a4 4 0 0 1-1.974-.49 3.63 3.63 0 0 1-1.386-1.4q-.504-.91-.504-2.1 0-1.176.518-2.086a3.6 3.6 0 0 1 1.414-1.4 4.1 4.1 0 0 1 2.002-.49q1.106 0 2.002.49a3.6 3.6 0 0 1 1.414 1.4q.518.91.518 2.086t-.532 2.086a3.7 3.7 0 0 1-1.456 1.414 4.2 4.2 0 0 1-2.016.49m0-1.386q.616 0 1.148-.294.546-.294.882-.882t.336-1.428-.322-1.414a2.16 2.16 0 0 0-.854-.882 2.34 2.34 0 0 0-1.148-.294q-.616 0-1.148.294-.518.294-.826.882-.308.574-.308 1.414 0 1.246.63 1.932.644.672 1.61.672m7.178-5.334q.35-.588.924-.91.588-.336 1.386-.336v1.652h-.406q-.939 0-1.428.476-.476.476-.476 1.652V43h-1.596v-7.714h1.596zm5.639.182v4.27q0 .435.196.63.21.182.7.182h.98V43h-1.26q-1.078 0-1.652-.504t-.574-1.638v-4.27h-.91v-1.302h.91v-1.918h1.61v1.918h1.876v1.302zm8.58-3.318V43h-1.596v-9.73zm3.957 3.318v4.27q0 .435.196.63.21.182.7.182h.98V43h-1.26q-1.078 0-1.652-.504t-.574-1.638v-4.27h-.91v-1.302h.91v-1.918h1.61v1.918h1.876v1.302zm10.417 2.366q0 .434-.056.784h-5.894q.07.924.686 1.484t1.512.56q1.288 0 1.82-1.078h1.722a3.5 3.5 0 0 1-1.274 1.75q-.91.672-2.268.672-1.106 0-1.988-.49a3.66 3.66 0 0 1-1.372-1.4q-.49-.91-.49-2.1t.476-2.086a3.44 3.44 0 0 1 1.358-1.4q.882-.49 2.016-.49 1.092 0 1.946.476a3.35 3.35 0 0 1 1.33 1.344q.476.854.476 1.974m-1.666-.504q-.014-.883-.63-1.414-.616-.532-1.526-.532-.826 0-1.414.532-.588.518-.7 1.414zm12.575-3.29q.91 0 1.624.378.728.378 1.134 1.12.42.742.42 1.792V43H358.7v-4.312q0-1.035-.518-1.582-.519-.56-1.414-.56-.897 0-1.428.56-.518.546-.518 1.582V43h-1.582v-4.312q0-1.035-.518-1.582-.519-.56-1.414-.56-.897 0-1.428.56-.519.546-.518 1.582V43h-1.596v-7.714h1.596v.882q.391-.476.994-.742.601-.266 1.288-.266.923 0 1.652.392.727.392 1.12 1.134a2.54 2.54 0 0 1 1.092-1.106 3.2 3.2 0 0 1 1.596-.42m8.008 7.966a4 4 0 0 1-1.638-.322 2.96 2.96 0 0 1-1.134-.896 2.27 2.27 0 0 1-.448-1.274h1.652q.042.49.462.826.435.322 1.078.322.672 0 1.036-.252.378-.266.378-.672 0-.434-.42-.644-.405-.21-1.302-.462a13 13 0 0 1-1.414-.462 2.54 2.54 0 0 1-.952-.686q-.392-.462-.392-1.218 0-.
1615.364-1.12.364-.518 1.036-.812.687-.294 1.568-.294 1.317 0 2.114.672.813.658.868 1.806h-1.596a1.14 1.14 0 0 0-.42-.826q-.378-.308-1.022-.308-.63 0-.966.238a.74.74 0 0 0-.336.63q0 .308.224.518.225.21.546.336.322.113.952.294a9 9 0 0 1 1.372.462q.546.224.938.672.393.448.406 1.19 0 .658-.364 1.176t-1.036.812q-.657.294-1.554.294"})),Ui=()=>{const{t}=Ce();return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:t("item.bulk_import")}),e.jsx(mt,{}),e.jsx("div",{})]})}),e.jsx(Te.Body,{left:0,maxWidth:1272,right:0,children:e.jsx(d,{justifyContent:"center",style:{paddingTop:"72px"},children:e.jsx(ot,{children:e.jsxs(d,{center:!0,column:!0,gap:16,style:{padding:"48px 64px"},children:[e.jsx($t,{solidRed:!0}),e.jsx(j,{fontSemiBold:!0,neutral800:!0,size:"18px",lineHeight:"24px",center:!0,children:t("import.importing_title")}),e.jsx(j,{neutral500:!0,size:"14px",lineHeight:"20px",center:!0,children:t("import.importing_subtitle")})]})})})})]})},$i=({itemCount:t})=>{const{t:s}=Ce();return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:s("item.bulk_import")}),e.jsx(mt,{}),e.jsx("div",{})]})}),e.jsx(Te.Body,{maxWidth:1272,$customStyle:"margin: auto;",children:e.jsxs(d,{center:!0,column:!0,gap:16,style:{paddingBottom:"200px"},children:[e.jsx(on,{"aria-hidden":!0,"data-testid":"importing-spinner"}),e.jsx(j,{fontSemiBold:!0,neutral800:!0,size:"18px",lineHeight:"24px",center:!0,children:s("import.importing_ga_title")}),e.jsx(j,{neutral500:!0,size:"14px",lineHeight:"20px",center:!0,children:s("import.importing_ga_subtitle",{count:t})})]})})]})},Gi=({itemCount:t,folderName:s,onViewItems:a,onExit:r})=>{const{t:l}=Ce(),m=n.useContext(Be);return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:l("item.bulk_import")}),e.jsx(mt,{}),e.jsx("div",{})]})}),e.jsx(Te.Body,{maxWidth:1272,$customStyle:"margin: auto;",children:e.jsx(d,{justifyContent:"center",style:{paddingBottom:"200px"},children:e.jsx(ot,{children:e.jsxs(d,{center:!0,column:!0,gap:16,children:[e.jsx(d,{center:!0,style:{width:64,height:64,borderRadius:"50%",backgroundColor:m.bg.green50},children:e.jsx(Tn,{color:m.text.green600})}),e.jsx(j,{fontSemiBold:!0,neutral800:!0,size:"22px",lineHeight:"28px",center:!0,children:l("import.import_complete_title")}),e.jsx(j,{neutral500:!0,size:"14px",lineHeight:"20px",center:!0,children:l("import.import_complete_subtitle",{count:t,folderName:s})}),e.jsxs(d,{column:!0,gap:8,fullWidth:!0,style:{marginTop:8},children:[e.jsx(Ee,{styleType:"brandCTA",$fullWidth:!0,type:"button",onClick:a,children:l("import.view_imported_items")}),e.jsx(Ee,{styleType:"userCancel",type:"button",style:{minWidth:"auto"},onClick:r,children:l("import.exit_bulk_import")})]})]})})})})]})},Qi=q(d).withConfig({displayName:"ui__HeaderBadge"})(["flex-shrink:0;width:64px;height:64px;border-radius:50%;background-color:",";color:",";"],({theme:t})=>t.bg.orange50,({theme:t})=>t.text.orange500),Yi=q(d).withConfig({displayName:"ui__IconBadge"})(["flex-shrink:0;width:40px;height:40px;border-radius:50%;background-color:",";color:",";"],({theme:t})=>t.bg.neutral50,({$orange:t,theme:s})=>t?s.text.orange500:s.text.neutral800),Dt=({icon:t,boldText:s,labelText:a,orange:r})=>e.jsxs(d,{gap:12,alignItems:"center",fullWidth:!0,children:[e.jsx(Yi,{center:!0,$orange:r,children:t}),e.jsxs(j,{neutral800:!0,size:"14px",lineHeight:"20px",children:[e.jsx(j,{as:"span",fontSemiBold:!0,neutral800:!0,size:"14px",lineHeight:"20px",children:s})," ",a]})]}),Ji=({itemCount:t,errorCount:s,folderName:a,onViewItems:r,onExit:l})=>{const{t:m}=Ce();return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:m("item.bulk_import")}),e.jsx(mt,{}),e.jsx("div",{})]})}),e.jsx(Te.Body,{maxWidth:1272,$customStyle:"margin: auto;",children:e.jsx(d,{justifyContent:"center",style:{paddingBottom:"200px"},children:e.jsx(ot,{children:e.jsxs(d,{center:!0,column:!0,gap:24,children:[e.jsx(Qi,{center:!0,children:e.jsx(pt,{width:32,height:32})}),e.jsxs(d,{column:!0,gap:8,fullWidth:!0,children:[e.jsx(j,{fontSemiBold:!0,neutral800:!0,size:"22px",lineHeight:"32px",center:!0,children:m("import.import_complete_with_errors_title")}),e.jsx(Dt,{icon:e.jsx(Zt,{width:24,height:24}),boldText:m("import.import_complete_imported_count",{count:t}),labelText:m("import.import_complete_imported_label",{folderName:a})}),e.jsx(Dt,{orange:!0,icon:e.jsx(pt,{width:24,height:24}),boldText:m("import.import_complete_failed_count",{count:s}),labelText:m("import.import_complete_failed_label")})]}),e.jsxs(d,{column:!0,gap:8,fullWidth:!0,children:[e.jsx(Ee,{styleType:"brandCTA",$fullWidth:!0,type:"button",onClick:r,children:m("import.view_imported_items")}),e.jsx(Ee,{styleType:"userCancel",type:"button",style:{minWidth:"auto"},onClick:l,children:m("import.exit_bulk_import")})]})]})})})})]})};ln();
1const zt=48,Pt=20,Zi=({displayName:t})=>e.jsx(j,{white:!0,fontMedium:!0,uppercase:!0,mediumLetterSpacing:!0,smallLineHeight:!0,children:t}),Xi=({onExitImport:t,onFinish:s})=>{const{t:a}=Ce(),r=n.useContext(Be),l=Qe(),{session:m,rows:S,rowsMeta:N,isFetchingRows:c}=ye(b=>b.bulkImport),[u,B]=n.useState(1),[A,D]=n.useState(Pt);n.useEffect(()=>{m?.id&&l({type:ue.FETCH_INTERACTIVE_IMPORT_ROWS_REQUEST,payload:{sessionId:m.id,page:1,pageSize:Pt,hasProcessingErrors:!0}})},[l,m?.id]);const $=n.useCallback((b,Z)=>{m?.id&&l({type:ue.FETCH_INTERACTIVE_IMPORT_ROWS_REQUEST,payload:{sessionId:m.id,page:b,pageSize:Z,hasProcessingErrors:!0}})},[l,m?.id]),M=n.useCallback(b=>{B(b),$(b,A)},[$,A]),k=n.useCallback(b=>{D(b),B(1),$(1,b)},[$]),de=n.useMemo(()=>m?.mappings??[],[m?.mappings]),H=N?.totalRows??0,_=n.useMemo(()=>(m?.errors??[]).some(b=>b.code===Rn.PLAN_LIMIT_ITEMS_EXCEEDED),[m?.errors]),y=n.useMemo(()=>new Map(S.map(b=>[b.rowIndex,b])),[S]),O=n.useCallback(b=>{const Z=y.get(b),re=Z?.processingErrors??[],oe=Object.values(Z?.validationErrors??{}),ie=[...re,...oe].filter(Boolean);return ie.length===0?null:e.jsx(Ve,{content:ie.join(` 2`),portalAnchor:"body",placement:"top",children:e.jsx(d,{fullHeight:!0,justifyContent:"center",alignItems:"center",children:e.jsx(pt,{color:r.icon.red500})})})},[y,r]),J=n.useCallback(b=>{const Z=y.get(b.data?.rowIndex);if(Z?.hasProcessingErrors||Z?.hasValidationErrors)return{backgroundColor:r.bg.red25}},[y,r]),ae=n.useMemo(()=>({headerComponent:Zi,sortable:!1,filter:!1}),[]),pe=n.useMemo(()=>[{headerName:a("import.row_header"),field:"rowIndex",width:70,pinned:"left"},...de.filter(b=>b?.targetField||b?.targetCustomAttribute||b?.targetLabel).sort((b,Z)=>{const re=b.targetField?0:1,oe=Z.targetField?0:1;return re-oe}).map(b=>({headerName:b.sourceHeader,field:String(b.sourceIndex),minWidth:112})),{headerName:"",field:"status",width:60,pinned:"right",cellStyle:{display:"flex",alignItems:"center",justifyContent:"center"},cellRenderer:b=>O(b.data.rowIndex)}],[de,O]),ge=n.useMemo(()=>S.map(b=>({rowIndex:b.rowIndex,...b.values})),[S]),ce=n.useCallback(b=>String(b.data.rowIndex),[]);return e.jsxs(e.Fragment,{children:[e.jsx(Te.Header,{padding:"16px 32px 16px 24px",top:0,children:e.jsxs(et,{children:[e.jsx(j,{fontSemiBold:!0,neutral700:!0,as:"h1",children:a("item.bulk_import")}),e.jsx(mt,{}),e.jsxs(d,{center:!0,gap:16,children:[e.jsx(Ee,{style:{minWidth:"auto"},styleType:"userCancel",type:"button",onClick:t,children:a("import.exit_bulk_import")}),e.jsx(Ee,{styleType:"brandCTA",type:"button",onClick:s,children:a("import.finish")})]})]})}),e.jsxs(Te.Body,{left:0,right:0,style:{padding:"24px",display:"flex",flexDirection:"column",height:"calc(100vh - 65px)",overflow:"hidden"},children:[e.jsx(Ge,{bottom:16,children:e.jsxs(un,{column:!0,children:[e.jsx(pn,{as:"h2",children:a("import.errors_step_title",{count:H})}),e.jsx(hn,{children:a(_?"import.errors_step_plan_limit_subtitle":"import.errors_step_subtitle")})]})}),e.jsx("div",{className:"ag-theme-alpine",style:{width:"100%",flex:1,minHeight:0,"--ag-header-background-color":r.bg.neutral800,"--ag-border-color":"transparent","--ag-pinned-left-header-border":"none","--ag-pinned-right-header-border":"none","--ag-input-focus-border-color":"transparent","--ag-range-selection-border-color":"transparent"},children:e.jsx(Ot,{columnDefs:pe,defaultColDef:ae,rowData:ge,getRowId:ce,getRowStyle:J,rowHeight:zt,headerHeight:zt,suppressMovableColumns:!0,alwaysShowHorizontalScroll:!0,alwaysShowVerticalScroll:!0,loading:c})}),e.jsx(rn,{values:{currentPage:u,perPage:A},wrapperStyles:{padding:"16px 32px"},totalCount:H,onChange:({currentPage:b,perPage:Z})=>{Z!==A?k(Z):M(b)}})]})]})},pr=()=>{const{t}=Ce(),s=Qe(),{locationPush:a}=Ut(),{updateUserStorage:r}=wt(),{session:l,currentSessionId:m,isLoadingExistingSession:S,isFetchingSession:N,preflightError:c}=ye(z=>z.bulkImport),u=ks(),B=Mt(),A=vs(B,{itemCount:u.itemCount,errorCount:0}),{readResultToPersist:D}=A,$=_t(),M=S||N,k=Fs(),{showModal:de,hideModal:H}=jn();n.useEffect(()=>{l||s({type:ue.LIST_INTERACTIVE_IMPORT_SESSIONS_REQUEST})},[s,l]);const _=n.useRef(!1);n.useEffect(()=>{k===ke.IMPORT_COMPLETE&&(_.current=!1)},[k]);const y=n.useRef(!1);n.useEffect(()=>{const z=y.current&&!M;y.current=M,z&&!l&&!_.current&&k!==ke.FILE_UPLOAD&&k!==ke.IMPORT_COMPLETE&&r({[Oe]:ke.FILE_UPLOAD})},[M,l,k,r]);const O=n.useCallback(()=>{r({[Oe]:ke.FILE_UPLOAD})},[r]),J=n.useCallback(()=>{r({[Oe]:ke.MAPPINGS})},[r]),ae=n.useCallback(()=>{r({[Oe]:ke.DATA_PREVIEW})}
2,[r]),pe=n.useCallback(()=>{r({[Oe]:ke.IMPORTING,[it]:null})},[r]),ge=n.useCallback(()=>{r({[Oe]:ke.IMPORT_ERRORS})},[r]),ce=n.useCallback(()=>{_.current=!1,r({[Oe]:ke.FILE_UPLOAD,[it]:null}),kt({type:"success",message:t("import.imported_successfully")}),a(B.path)},[r,a,B.path]),b=n.useCallback(()=>{he.exitBulkImport({screenName:k,hasFileUploaded:!!l}),_.current=!1,r({[Oe]:ke.FILE_UPLOAD,[it]:null}),a("/items")},[r,a,k,l]),Z=n.useCallback(()=>{if($){_.current=!0,r({[Oe]:ke.IMPORT_COMPLETE,[it]:D()});return}ce()},[$,r,ce,D]),re=n.useCallback(()=>{l?.id&&s({type:ue.DELETE_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:l.id}}),Z()},[s,l?.id,Z]),oe=n.useCallback(z=>{he.viewPartialImportResult({itemsSkipped:z}),de($?"PartialImportModalGA":"PartialImportModal",{styleType:"light",isDefaultHeadingHidden:!0,showCrossBtn:!1,autoWidth:!0,data:{errorCount:z,finishHandler:()=>{H(),re()},reviewHandler:()=>{he.reviewImportErrors({itemsSkipped:z}),H()}}}),ge()},[re,ge,$,de,H]),ie=n.useRef(!1);n.useEffect(()=>{if(!c&&ie.current){ie.current=!1;return}if(!c||!l?.id||ie.current)return;ie.current=!0;const z=l.id;he.importFolderMissing({folderId:B.id,folderName:B.name}),de("ImportFolderNotFoundModal",{styleType:"light",size:"medium",isDefaultHeadingHidden:!0,showCrossBtn:!1,disableOutsideClick:!0,data:{submitHandler:ne=>{s({type:ue.UPDATE_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:z,targetFolderId:ne,onSuccess:()=>{H(),s({type:ue.PROCESS_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:z,onSuccess:Z,onPartialSuccess:oe}})}}})}}})},[c,l?.id,s,Z,oe,B.id,B.name,de,H]);const v=n.useRef(null);n.useEffect(()=>{l?.id&&Nn.includes(l.status)&&v.current!==l.id&&(v.current=l.id,s({type:ue.RESUME_INTERACTIVE_IMPORT_JOB_WATCH_REQUEST,payload:{sessionId:l.id,activeJobId:l.metadata?.activeJobId,onSuccess:Z,onPartialSuccess:oe}}))},[s,l?.id,l?.status,l?.metadata?.activeJobId,Z,oe]);const Y=n.useCallback(()=>{de("ConfirmExitImportModal",{styleType:"dark",size:"small",isDefaultHeadingHidden:!0,showCrossBtn:!1,autoWidth:!0,modalRootStyles:{width:408,borderRadius:16},data:{cancelHandler:H,submitHandler:()=>{he.exitBulkImport({screenName:k,hasFileUploaded:!!l}),r({[Oe]:ke.FILE_UPLOAD}),s({type:ue.STOP_INTERACTIVE_IMPORT_JOB_WATCH}),s({type:ue.CLEAR_INTERACTIVE_IMPORT_ERROR}),H(),m&&s({type:ue.DELETE_INTERACTIVE_IMPORT_SESSION_REQUEST,payload:{sessionId:m,onSuccess:()=>a("/items")}}),a("/items")}}})},[r,a,m,s,k,l,de,H]);return e.jsxs(yn,{$greyBg:!0,children:[e.jsx(W,{when:k===ke.FILE_UPLOAD,children:e.jsx(Xn,{onExitImport:Y,onReviewEdits:J,onError:O,onStartImporting:pe,onImportComplete:Z,onPartialSuccess:oe})}),e.jsx(W,{when:k===ke.MAPPINGS,children:$?e.jsx(Si,{onExitImport:Y,onNext:ae,onError:J}):e.jsx(Ts,{onExitImport:Y,onNext:ae,onError:J})}),e.jsx(W,{when:k===ke.DATA_PREVIEW,children:e.jsx(Wi,{onBack:J,onExitImport:Y,onStartImporting:pe,onImportComplete:Z,onPartialImport:ge,onFinishPartialImport:re,onImportError:ae})}),e.jsx(W,{when:k===ke.IMPORTING,children:$?e.jsx($i,{itemCount:u.itemCount}):e.jsx(Ui,{})}),e.jsx(W,{when:k===ke.IMPORT_COMPLETE,children:A.errorCount>0?e.jsx(Ji,{itemCount:A.itemCount,errorCount:A.errorCount,folderName:B.name,onViewItems:ce,onExit:b}):e.jsx(Gi,{itemCount:A.itemCount,folderName:B.name,onViewItems:ce,onExit:b})}),e.jsx(W,{when:k===ke.IMPORT_ERRORS,children:e.jsx(Xi,{onExitImport:Y,onFinish:re})})]})};export{pr as default}; 3//# sourceMappingURL=index-Cn0FxuL4_bundle.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.