1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7839134d-d407-4e4b-a3f5-e8b3a003df81",e._sentryDebugIdIdentifier="sentry-dbid-7839134d-d407-4e4b-a3f5-e8b3a003df81")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6108],{5140:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/supplier-integrations",function(){return n(60130)}])},9171:(e,t,n)=>{"use strict";n.d(t,{IG:()=>a,KZ:()=>l,kB:()=>r,tm:()=>s}),n(68093);var o=n(1950),i=n.n(o);function l(e){return i()(e).format((Number.isInteger(e),"\xa30,0.00"))}function a(e){return i()(e/100).format("0.0%")}function r(e,t){return i()(e).format(t)}function s(e){return i()(e).format("0.0 b")}},60130:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>os});var o=n(6029),i=n(75155),l=n(43613),a=n(5925),r=n(55729),s=n(15086),c=n(6688),d=n(95344),u=n(37579),p=n(35197),m=n(72091),h=n(26673),y=n(35512),g=n(29113),f=n(74312),x=n.n(f),k=n(16932),v=n(12482),S=n(75119),b=n(84473),C=n(49428),A=n(66094),j=n(95051),I=n(28090),w=n(90944),T=n(61930),_=n(8013),P=n(1826),F=n(11510),O=n(26002),E=n(71330),D=n(76521),N=n(18582),B=n(28629),R=n(27070),M=n(39975);M.I.Madison,M.I.ZyroFisher,M.I.TheCycleDivision,M.I.OxfordProducts,M.I.Silverfish,M.I.BobElliot,M.I.Extra,M.I.JBI,M.I.HLC,M.I.Windwave,M.I.PaulLange,M.I.ChickenCycleKit,M.I.UpgradeBikes,M.I.TourdeSuisse,M.I.IndianSummer,M.I.TSTGPR,M.I.RaCo,M.I.Komenda,M.I.Grofa,M.I.MeridaCenturion,M.I.FuchsMovesa,M.I.NC17,M.I.SchmidAichach,M.I.Velok,M.I.Nusshold,M.I.Chrissports,M.I.Lindlau,M.I.SportImport,M.I.SportsNut,M.I.BBFBike,M.I.Intercycle,M.I.Amsler,M.I.Vitelli,M.I.Maxxis,M.I.FACT,M.I.Hartje,M.I.CosmicSports,M.I.BicyclePartsWholesale;let L={Madison:"https://cdn.bikebook.co.uk/SiteImages/partners/madisonlogo.webp",ZyroFisher:"https://cdn.bikebook.co.uk/general/supplier-logos/ZF-B2B-logo.svg",TheCycleDivision:"https://cdn.bikebook.co.uk/general/supplier-logos/cycle-division-logo.png",OxfordProducts:"https://cdn.bikebook.co.uk/general/supplier-logos/oxford-products-logo.png",Silverfish:"https://cdn.bikebook.co.uk/general/supplier-logos/silver-fish-logo.svg",BobElliot:"https://cdn.bikebook.co.uk/general/supplier-logos/bob-elliot-logo.png",Extra:"https://cdn.bikebook.co.uk/general/supplier-logos/extra-logo.png",Veloconnect:"https://cdn.bikebook.co.uk/general/supplier-logos/veloconnect-logo.webp",JBI:"https://cdn.bikebook.co.uk/general/supplier-logos/JBI_LOGO.png",HLC:"https://cdn.bikebook.co.uk/general/supplier-logos/HLC-Logo.png",Windwave:"https://cdn.bikebook.co.uk/SiteImages/partners/windwave-logo.svg",LightspeedRSeries:"https://cdn.bikebook.co.uk/general/pos-logos/lightspeed-r-series-logo.png",LightspeedXSeries:"https://cdn.bikebook.co.uk/general/pos-logos/lightspeed-x-series-logo.png",ChickenCycleKit:"https://cdn.bikebook.co.uk/general/supplier-logos/chicken-cycles-logo.png",UpgradeBikes:"https://cdn.bikebook.co.uk/general/supplier-logos/upgradebikes-logo.png",Workshop:"https://cdn.bikebook.co.uk/general/pos-logos/workshop-cropped.svg",Saledock:"https://cdn.bikebook.co.uk/general/pos-logos/SaledockLogo.svg",Shopify:"https://cdn.bikebook.co.uk/general/pos-logos/Shopify-Logo.png",Square:"https://cdn.bikebook.co.uk/general/pos-logos/Square_LogoLockup_Black.svg",Seanic:"https://cdn.bikebook.co.uk/general/pos-logos/seanic-logo.png"};var V=n(59550),W=n(68149),z=n(24395),K=n(80956),U=n(14521),q=n(80649),H=n(95179);function G(e){if(null==e||"object"!=typeof e||Array.isArray(e))return;let t=e.stockItemId;if("number"==typeof t&&Number.isFinite(t)&&!(t<=0))return e}let Y=(e,t,n)=>null==e?"-":(null==e?void 0:e.objectType)==="StockItem"?t(e,n):n(e),J=(e,t)=>{let n=Y(e.row,e=>{if(null!==e.variations&&void 0!==e.variations&&0!==e.variations.length)return e.variations[0].externalUrl},e=>e.externalUrl);null!=n&&window.open(n,"_blank"),t.stopPropagation()};var X=n(4696),Q=n(9761),Z=n(46831);let $=e=>Y(e,e=>[e.stockItemId.toString()],e=>void 0===e.stockItemId?[e.stockVariationId.toString()]:[e.stockItemId.toString(),e.stockVariationId.toString()]),ee=e=>{var t,n;let{id:i,field:l,row:a,rowNode:s}=e,[c,u]=(0,r.useState)(!1),[m,h]=(0,r.useState)(!1),y=(0,r.useRef)(null),g=(0,U.h)(),f=(0,_.jL)(),x=null!=(t=(0,q.Nc)(g,H.ZP)[s.id])?t:0;(0,r.useEffect)(()=>{y.current&&h((0,X.Dy)(y.current))},[a.name]);let k=(0,r.useCallback)(e=>{"group"===s.type&&(u(!c),g.current.setCellFocus(i,l),e.stopPropagation())},[s.type,c,g,i,l]);(0,r.useEffect)(()=>{"group"===s.type&&g.current.setRowChildrenExpansion(i,c)},[g,i,c,s.type]);let v=null!=(n=a.name)?n:"-",S="-"!==(null!=v?v:"").trim(),b=(0,o.jsx)(p.A,{ref:y,sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:S?(0,o.jsx)(Q.A,{copyValue:v,onCopy:e=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(e).then(()=>{f((0,Z.kw)("success","".concat(e," copied to clipboard")))}).catch(()=>{try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focu
1s(),t.select();let n=document.execCommand("copy");document.body.removeChild(t),f((0,Z.kw)(n?"success":"error",n?"".concat(e," copied to clipboard"):"Failed to copy to clipboard"))}catch(e){f((0,Z.kw)("error","Failed to copy to clipboard"))}})},sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:v}):v});return(0,o.jsxs)(p.A,{sx:{pl:6*s.depth,alignItems:"center",width:"100%",height:"100%",display:"flex",gap:1},children:[0===s.depth?(0,o.jsx)(p.A,{sx:{width:28,height:28,flexShrink:0,display:"flex",justifyContent:"center",alignItems:"center"},children:x>0?(0,o.jsx)(d.A,{tabIndex:-1,size:"small",onClick:k,children:c?(0,o.jsx)(W.A,{}):(0,o.jsx)(z.A,{})}):null}):null,m?(0,o.jsx)(K.A,{title:v,slotProps:{tooltip:{sx:{color:e=>e.palette.text.primary,backgroundColor:e=>e.palette.background.paper,boxShadow:e=>e.shadows[2],fontSize:e=>e.typography.body2}}},children:b}):b]})};var et=n(33191),en=n(11425),eo=n(60712),ei=n(45401),el=n(57678),ea=n(27254),er=n(13209),es=n(16829),ec=n(32194),ed=n(13918),eu=n(29992),ep=n(29723),em=n(85782);function eh(e,t,n){let o=((e,t)=>{var n;let{query:o,axios:i}=null!=t?t:{};return{queryKey:null!=(n=null==o?void 0:o.queryKey)?n:["/v2/StockItem/GetBySku/".concat(e)],queryFn:t=>{let n,{signal:o}=t;return n={signal:o,...i},S.A.get("/v2/StockItem/GetBySku/".concat(e),n)},enabled:!!e,staleTime:0,...o}})(e,t),i=(0,v.I)(o,n);return i.queryKey=o.queryKey,i}var ey=n(86332),eg=n(51462);let ef=e=>{let t,n,l,a,r,s,c=(0,i.c)(16),{stockItemId:d}=e,{t:u}=(0,w.WD)(),p=(0,_.jL)(),{mutateAsync:m,isPending:h}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["syncWithPos"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{params:t}=null!=e?e:{};return((e,t)=>S.A.post("/v2/StockItem/SyncWithPos",void 0,{...t,params:{...e,...null==t?void 0:t.params}}))(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})();c[0]!==p||c[1]!==d||c[2]!==m||c[3]!==u?(t=async()=>{await m({params:{id:d}}).then(()=>{p((0,Z.kw)("success",u("stockItems.syncSuccess","Stock item synced with POS successfully."))),p((0,eg.Cr)())}).catch(()=>{p((0,Z.kw)("error",u("stockItems.syncError","Failed to sync stock item with POS.")))})},c[0]=p,c[1]=d,c[2]=m,c[3]=u,c[4]=t):t=c[4];let y=t;return c[5]===Symbol.for("react.memo_cache_sentinel")?(n={color:"text.secondary"},c[5]=n):n=c[5],c[6]!==h?(l=(0,o.jsx)(el.A,{children:h?(0,o.jsx)(es.A,{size:14}):(0,o.jsx)(ey.P,{size:22})}),c[6]=h,c[7]=l):l=c[7],c[8]!==u?(a=u("stockItems.syncFromPOS","Sync From POS"),c[8]=u,c[9]=a):a=c[9],c[10]!==a?(r=(0,o.jsx)(ea.A,{primary:a}),c[10]=a,c[11]=r):r=c[11],c[12]!==y||c[13]!==l||c[14]!==r?(s=(0,o.jsxs)(ei.A,{onClick:y,sx:n,children:[l,r]}),c[12]=y,c[13]=l,c[14]=r,c[15]=s):s=c[15],s};var ex=n(46232),ek=n(38312),ev=n(40288),eS=n(4062),eb=n(21849);function eC(e){var t,n,l,a,s,d;let{stockItem:u,open:h,setOpen:y}=e,{t:g}=(0,w.WD)(),f=null!=(l=null==(n=u.variations)||null==(t=n[0])?void 0:t.sku)?l:"",{mutateAsync:x,isPending:v}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["copyPartnerItem"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let t,n,{params:i}=null!=e?e:{};return t=i,n=o,S.A.post("/v2/StockItem/CopyPartnerItem",void 0,{...n,params:{...t,...null==n?void 0:n.params}})},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})(),{data:b,isPending:C}=eh(f,{query:{enabled:null!=u&&h&&f.length>0,staleTime:0,gcTime:0,queryKey:["getBySku","copyPartner",f]}}),[A,I]=(0,r.useState)(null),T=G(null==b?void 0:b.data),[P,E]=(0,r.useState)(!1),D=(0,_.jL)(),N=null!=T,B=async()=>{try{var e;let t=await x({params:{id:u.stockItemId,trackingEnabled:P}});D((0,Z.kw)("success",g("stock.copy.success","Item copied into your stock"))),I(null!=(e=t.data)?e:null)}catch(e){D((0,Z.kw)("error",g("stock.copy.error","Something went wrong while trying to copy the stock.")))}},R=(0,o.jsx)(p.A,{children:g("stock.copy.confirmMessage","Are you sure you want to copy this item {name}
1 into your stock? This will create a new item in your stock with the same details.",{name:null!=(a=u.name)?a:""})}),M=(0,o.jsx)(p.A,{children:g("stock.copy.successMessage","Item {name} has been copied into your stock.",{name:null!=(d=null!=(s=null==A?void 0:A.name)?s:u.name)?d:""})});return(0,o.jsx)(j.A,{open:h,onClose:()=>y(!1),title:A?g("stock.copy.successTitle","Item Copied!"):g("stock.copy.confirmTitle","Copy Into My Stock?"),subheader:null==A?R:M,fullWidth:!0,maxWidth:"sm",actions:[{type:"button",content:g("vocab.close","Close"),hideOnMobile:!0,buttonProps:{onClick:()=>{y(!1)}},side:"left"},{type:"button",content:A?g("stock.copy.viewItem","View Item"):g("vocab.copy","Copy"),buttonProps:{variant:"contained",color:A?"tertiary":"success",loading:v,disabled:C||N,onClick:A?()=>{y(!1),null!=A&&D((0,eg.SN)(A.stockItemId))}:B},side:"right"}],children:!A&&(0,o.jsxs)(o.Fragment,{children:[C&&(0,o.jsxs)(m.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,o.jsx)(es.A,{size:20}),(0,o.jsx)(c.A,{variant:"body2",sx:{fontWeight:"600"},children:g("stock.copy.checking","Checking if copying is allowed...")})]}),!C&&(0,o.jsxs)(m.A,{spacing:1,children:[!N&&(0,o.jsxs)(c.A,{variant:"body2",sx:{fontWeight:"600",display:"flex",alignItems:"center",mb:1,gap:1},children:[(0,o.jsx)(F.r,{size:20,color:"#00AB55",weight:"fill"}),g("stock.copy.noExisting","No existing item found in your stock.")]}),N&&(0,o.jsxs)(c.A,{variant:"body2",sx:{fontWeight:"600",display:"flex",alignItems:"center",mb:1,gap:1},children:[(0,o.jsx)(O.J,{size:20,color:"#FF4842",weight:"fill"}),g("stock.copy.existingFound","We have found an item with the same SKU in your stock so we cannot copy it.")]}),N&&(0,o.jsx)(ex.A,{size:"large",variant:"outlined",color:"tertiary",startIcon:(0,o.jsx)(eb.I,{}),sx:{mt:"16px!important"},onClick:()=>{y(!1),D((0,eg.SN)(T.stockItemId))},children:g("stock.copy.viewExisting","View Existing Item")}),!N&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ek.A,{}),(0,o.jsx)(ev.A,{sx:{marginLeft:"-8px!important"},control:(0,o.jsx)(eS.A,{size:"small",checked:P,onChange:e=>E(e.target.checked),color:"tertiary"}),label:g("stock.copy.enableTracking","Enable Stock Tracking for this item?")})]})]})]})})}var eA=n(22350),ej=n(3547),eI=n(19588),ew=n(98877),eT=n(9835);let e_=/InputObject\s+'[^']+'\s+doesn't accept argument|doesn't accept argument\s+'[^']+'/i;function eP(e){var t,n,l,a,s,d,u,h,y,g,f,x,b,C,A,I,T,P,E;let{stockItem:D,open:N,setOpen:R}=e,{t:M}=(0,w.WD)(),L=null!=(f=null==(n=D.variations)||null==(t=n[0])?void 0:t.sku)?f:"",{mutateAsync:V,isPending:W}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["copyPartnerItemToShopify"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let t,n,{params:i}=null!=e?e:{};return t=i,n=o,S.A.post("/v2/StockItem/CopyPartnerItemToShopify",void 0,{...n,params:{...t,...null==n?void 0:n.params}})},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})(),{data:z,isPending:K}=eh(L,{query:{enabled:null!=D&&N&&L.length>0,staleTime:0,gcTime:0,queryKey:["getBySku","shopifyCopy",L]}}),[U,q]=(0,r.useState)("confirm"),{data:H,isPending:Y,isFetching:J}=function(e,t,n){let o=((e,t)=>{var n;let o,{query:i,axios:l}=null!=t?t:{};return{queryKey:null!=(n=null==i?void 0:i.queryKey)?n:["/v2/StockItem/GetCopyPartnerItemToShopifyStatus",...(o=e)?[o]:[]],queryFn:t=>{let n,o,{signal:i}=t;return n=e,o={signal:i,...l},S.A.get("/v2/StockItem/GetCopyPartnerItemToShopifyStatus",{...o,params:{...n,...null==o?void 0:o.params}})},staleTime:0,...i}})(e,t),i=(0,v.I)(o,void 0);return i.queryKey=o.queryKey,i}({id:D.stockItemId},{query:{enabled:N&&"confirm"===U&&D.stockItemId>0,staleTime:0,gcTime:0}}),X=null==H?void 0:H.data,[Q,$]=(0,r.useState)(null),[ee,et]=(0,r.useState)(null),[en,eo]=(0,r.useState)(!1),ei=(0,_.jL)(),el=G(null==z?void 0:z.data),er=null!=el,ec=N&&"confirm"===U&&(L.length>0&&K||Y||J),ed=(null==X?void 0:X.alreadyLinkedInWorkshop)===!0,eu=null!=(x=null==X||null==(l=X.linkedShopifyProductAdminUrl)?void 0:l.trim())?x:"",ep=(null==X?void 0:X.anySkuExistsInShopify)===!0&&(null==X?void 0:X.shopifyLookupSkipped)!==!0,em=(null==X?void 0:X.shopifyLookupSkipped)===!0&&!ed&&(null==X?void 0:X.anySkuExistsInShopify)!==!0,ey=!ec&&!er&&!ed&&!ep&&"confirm"===U,ef=W||"progress"===U||ec||er||ed||ep;(0,r.useEffect)(()=>{N&&(q("confirm"),$(null),et(null),eo(!1))},[N,D.stockItemId]);let ek=()=>{"progress"===U||W||R(!1)},ev=async()=>{q("progress"),et(null),eo(!1);try{var e;let t=await V({params:{id:D.stockItemId}});$(null!=(e=t.data)?e:null),q("success"),ei((0,eg.Cr)()),ei((0,Z.kw)("success",M("stock.copyShopify.success","Product created in Shopify and synced to your stock.")))}catch(e){et(function(e){let t=e.trim();if(!t)return{};if(/\s+at\s+[\w.+]+\(/i.test(t)||/lambda_method/i.test(t)||/BikeBook\./i.test(t)||/StockItemController/i.test(t)||/ShopifySdk\.cs/i.test(t)||/GraphService\.cs/i.test(t))return{technicalDetail
1:t};let n=t.replace(/^ShopifySharp\.ShopifyHttpException:\s*/i,"").replace(/^System\.[\w.]+\s*:\s*/i,"").trim();if(e_.test(n))return{technicalDetail:t};let o=n.split("\n")[0].trim();return o.length>0&&o.length<=240&&!n.includes("\n")?{customerMessage:o}:n.length<=280&&!n.includes("\n")?{customerMessage:n}:{customerMessage:o.slice(0,240).trim(),technicalDetail:t}}(function(e){var t;if(S.A.isAxiosError(e)&&(null==(t=e.response)?void 0:t.data)!=null){let t=e.response.data;if("string"==typeof t)return t;if(t.detail)return t.detail;if(t.message)return t.message;if(t.title)return t.title}return e instanceof Error&&e.message?e.message:""}(e)||M("stock.copyShopify.error","Something went wrong while copying to Shopify. Check your Shopify connection and try again."))),q("error"),ei((0,Z.kw)("error",M("stock.copyShopify.errorShort","Could not copy to Shopify.")))}},eS="success"===U?M("stock.copyShopify.successTitle","Product added to Shopify"):"error"===U?M("stock.copyShopify.errorTitle","Could not copy to Shopify"):"progress"===U?M("stock.copyShopify.progressTitle","Copying to Shopifyâ¦"):M("stock.copyShopify.confirmTitle","Copy to Shopify?");return(0,o.jsxs)(j.A,{open:N,onClose:ek,title:eS,subheader:"confirm"===U?(0,o.jsx)(p.A,{children:M("stock.copyShopify.confirmMessage","Create this product in your Shopify store, then add it to your workshop stock from Shopify data. Shopify remains the source of truth for inventory.",{name:null!=(b=D.name)?b:""})}):"progress"===U?(0,o.jsx)(p.A,{children:M("stock.copyShopify.progressSubheader","This may take a moment while we create the product and sync it.")}):"success"===U?(0,o.jsx)(p.A,{children:M("stock.copyShopify.successSubheader","You can manage the product in Shopify Admin. It also appears in your workshop stock list for use on jobs and invoices.")}):(0,o.jsx)(p.A,{children:M("stock.copyShopify.errorSubheader","We couldn't copy this product to your Shopify store. See below for more information.")}),fullWidth:!0,maxWidth:"sm",actions:[{type:"button",content:M("vocab.close","Close"),hideOnMobile:!0,buttonProps:{onClick:ek,disabled:"progress"===U||W},side:"left"},..."success"===U?[{type:"button",content:M("stock.copyShopify.viewInShopify","Open in Shopify Admin"),buttonProps:{variant:"contained",color:"tertiary",onClick:()=>{let e=null==Q?void 0:Q.shopifyProductAdminUrl;e&&window.open(e,"_blank","noopener,noreferrer")},disabled:!(null==Q?void 0:Q.shopifyProductAdminUrl)},side:"right"}]:"error"===U?[{type:"button",content:M("vocab.tryAgain","Try again"),buttonProps:{variant:"contained",color:"tertiary",onClick:()=>{q("confirm"),et(null),eo(!1)}},side:"right"}
1]:[{type:"button",content:M("stock.copyShopify.copyAction","Copy to Shopify"),buttonProps:{variant:"contained",color:"success",loading:W,disabled:ef,onClick:ev},side:"right"}]],children:["confirm"===U&&(0,o.jsxs)(o.Fragment,{children:[ec&&(0,o.jsxs)(m.A,{direction:"row",spacing:1,alignItems:"center",children:[(0,o.jsx)(es.A,{size:20}),(0,o.jsx)(c.A,{variant:"body2",sx:{fontWeight:600},children:M("stock.copy.checking","Checking if copying is allowed...")})]}),!ec&&(0,o.jsxs)(m.A,{spacing:2,children:[ed&&(0,o.jsxs)(m.A,{spacing:1.5,children:[(0,o.jsx)(eA.A,{severity:"info",children:M("stock.copyShopify.alreadyLinked","This supplier item is already linked to a Shopify product in your workshop stock as â{name}â. Manage the product in Shopify Admin; workshop stock items from Shopify cannot be opened in the stock editor here.",{name:null!=(C=null==X?void 0:X.linkedWorkshopStockItemName)?C:""})}),""!==eu?(0,o.jsx)(ex.A,{size:"large",variant:"outlined",color:"inherit",startIcon:(0,o.jsx)(eb.I,{size:20}),onClick:()=>{window.open(eu,"_blank","noopener,noreferrer")},children:M("stock.copyShopify.openLinkedInShopify","Open in Shopify Admin")}):null]}),!ed&&ep&&(0,o.jsxs)(eA.A,{severity:"warning",children:[M("stock.copyShopify.skuExistsInShopify","One or more SKUs from this item already exist in your Shopify store. Resolve those in Shopify (or change supplier SKUs) before copying."),(null==X?void 0:X.shopifySkuConflicts)!=null&&X.shopifySkuConflicts.length>0&&(0,o.jsx)(ej.A,{dense:!0,disablePadding:!0,sx:{mt:1},children:X.shopifySkuConflicts.map((e,t)=>{var n,i;return(0,o.jsx)(eI.Ay,{disableGutters:!0,sx:{py:0},children:(0,o.jsx)(ea.A,{primary:null!=(n=e.sku)?n:"",secondary:null!=(i=e.productTitle)?i:"",primaryTypographyProps:{variant:"body2",fontWeight:600},secondaryTypographyProps:{variant:"caption"}})},"".concat(e.sku,"-").concat(t))})})]}),em&&(0,o.jsx)(eA.A,{severity:"info",children:M("stock.copyShopify.lookupSkipped","We could not verify duplicate SKUs against Shopify. If a SKU already exists in Shopify, the copy may fail until you fix it there.")}),!ed&&er&&(0,o.jsxs)(c.A,{variant:"body2",sx:{fontWeight:600,display:"flex",alignItems:"center",gap:1},children:[(0,o.jsx)(O.J,{size:20,color:"#FF4842",weight:"fill"}),M("stock.copy.existingFound","We have found an item with the same SKU in your stock so we cannot copy it.")]}),!ed&&er&&(0,o.jsx)(ex.A,{size:"large",variant:"outlined",color:"tertiary",startIcon:(0,o.jsx)(eb.I,{size:20}),sx:{mt:"8px!important"},onClick:()=>{R(!1),(0,B.vP)(el,ei)},children:M("stock.copy.viewExisting","View Existing Item")}),ey&&(0,o.jsxs)(c.A,{variant:"body2",sx:{fontWeight:600,display:"flex",alignItems:"center",gap:1},children:[(0,o.jsx)(F.r,{size:20,color:"#00AB55",weight:"fill"}),M("stock.copyShopify.readyToCopy","No blocking issues found for your workshop stock or Shopify SKUs.")]})]})]}),"progress"===U&&(0,o.jsxs)(m.A,{spacing:2,sx:{py:1},children:[(0,o.jsx)(ew.A,{}),(0,o.jsx)(c.A,{variant:"body2",color:"text.secondary",children:M("stock.copyShopify.progressDetail","Creating the product in Shopify and syncing it into your workshop inventoryâ¦")})]}),"success"===U&&Q&&(0,o.jsx)(m.A,{spacing:2,sx:{py:.5},children:(0,o.jsxs)(eA.A,{severity:"success",variant:"outlined",icon:(0,o.jsx)(F.r,{weight:"fill",size:22}),sx:{alignItems:"flex-start","& .MuiAlert-message":{width:"100%"}},children:[(0,o.jsx)(c.A,{variant:"subtitle1",fontWeight:700,sx:{mb:.5},children:null!=(I=null!=(A=null==(a=Q.stockItem)?void 0:a.name)?A:D.name)?I:""}),(0,o.jsx)(c.A,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:M("stock.copyShopify.successBodyHint","Product details and inventory are managed in Shopify. This listing is available in your workshop stock for jobs and invoicing.")}),(0,o.jsxs)(m.A,{spacing:.75,sx:{pt:.25},children:[(0,o.jsx)(c.A,{variant:"body2",color:"text.secondary",children:M("stock.copyShopify.successVariantCount","{count} variant(s) created and linked.",{count:String(null!=(P=null!=(T=Q.variationCount)?T:null==(d=Q.stockItem)||null==(s=d.variations)?void 0:s.length)?P:0)})}),(null==(y=Q.stockItem)||null==(h=y.variations)||null==(u=h[0])?void 0:u.sku)!=null?(0,o.jsx)(c.A,{variant:"body2",color:"text.secondary",children:M("stock.copyShopify.primarySku","Primary SKU: {sku}",{sku:null!=(E=Q.stockItem.variations[0].sku)?E:""})}):null]})]})}),"error"===U&&null!=ee&&(0,o.jsxs)(m.A,{spacing:2,sx:{py:1},children:[(0,o.jsxs)(eA.A,{severity:"error",variant:"outlined",children:[(0,o.jsx)(c.A,{variant:"subtitle2",component:"div",fontWeight:600,sx:{mb:.5},children:M("stock.copyShopify.errorAlertTitle","Something went wrong")}),(0,o.jsx)(c.A,{variant:"body2",color:"text.secondary",children:(null==(g=ee.customerMessage)?void 0:g.trim())?ee.customerMessage:M("stock.copyShopify.errorCustomerDefault","Please check your Shopify connection and try again. If this keeps happening, contact supportâthey can use technical details if you choose to share them.")})]}),null!=ee.technicalDetail&&ee.technicalDetail.trim().length>0?(0,o.jsxs)(p.A,{children:[(0,o.jsx)(ex.A,{size:"small",variant:"text",color:"inherit",onClick:()=>eo(e=>!e),sx:{textTransform:"none",px:0},children:en?M("stock.copyShopify.hideTechnicalDetails","Hide technical details"):M("stock.copyShopify.showTechnicalDetails","Technical details (for support)")}),(0,o.jsx)(eT.A,{in:en,children:(0,o.jsx)(c.A,{component:"pre",variant:"caption",sx:{dis
1play:"block",mt:1,p:1.5,borderRadius:1,bgcolor:"action.hover",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"ui-monospace, monospace"},children:ee.technicalDetail})})]}):null]})]})}var eF=n(45162),eO=n(93251);let eE=e=>{let{open:t,onClose:n,stockItemId:l,stockItemName:a,origin:s,onSuccess:d}=e,{t:u}=(0,w.WD)(),p=(0,_.jL)(),h=(0,eO.jE)(),{mutateAsync:y,isPending:g}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["disconnectFromPos"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{params:t}=null!=e?e:{};return((e,t)=>S.A.post("/v2/StockItem/DisconnectFromPos",void 0,{...t,params:{...e,...null==t?void 0:t.params}}))(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})(),f=null!=s?(0,eF.D)(s):u("vocab.pos","POS"),x=(null==a?void 0:a.trim())||u("stock.disconnectFromPos.thisItem","this item"),v=(0,r.useCallback)(()=>{null!=l&&y({params:{stockItemId:l}}).then(async()=>{p((0,Z.kw)("success",u("stock.disconnectFromPos.success","{item} is now a workshop stock item. You can edit it and retry syncing payments.",{item:x}))),await p((0,eg.Cr)()),h.invalidateQueries({queryKey:["/v2/StockItem/SearchStockItem"]}),null==d||d(),n()}).catch(e=>{var t,n,o,i;let l,a=null==e||null==(t=e.response)?void 0:t.data;if("string"==typeof a&&a.trim())l=a.trim();else if(null!=a&&"object"==typeof a){let e=null!=(i=null!=(o=null!=(n=a.detail)?n:a.title)?o:a.Message)?i:a.message;"string"==typeof e&&e.trim()&&(l=e.trim())}p((0,Z.kw)("error",null!=l?l:u("stock.disconnectFromPos.failed","Failed to disconnect this item from {origin}. Try again or contact support if this keeps happening.",{origin:f})))})},[y,p,x,n,d,f,h,l,u]);return(0,o.jsx)(j.A,{open:t,onClose:n,title:u("stock.disconnectFromPos.confirmTitle","Unlink from {origin}?",{origin:f}),maxWidth:"sm",fullWidth:!0,actions:[{type:"button",content:u("vocab.close","Close"),hideOnMobile:!0,buttonProps:{onClick:n},side:"left"},{type:"button",content:u("stock.disconnectFromPos.confirmButton","Unlink and keep in stock"),buttonProps:{onClick:v,loading:g,variant:"contained",color:"warning"},side:"right"}],children:(0,o.jsxs)(m.A,{spacing:2,children:[(0,o.jsx)(c.A,{variant:"body2",children:u("stock.disconnectFromPos.intro",'You are about to disconnect "{item}" from {origin} and keep it as a workshop-only stock item.',{item:x,origin:f})}),(0,o.jsx)(eA.A,{severity:"warning",variant:"outlined",children:u("stock.disconnectFromPos.warningSync","Future invoice and payment sync will no longer try to match this item to the {origin} product. Use this when the POS product was deleted or is no longer available.",{origin:f})}),(0,o.jsx)(c.A,{variant:"body2",color:"text.secondary",children:u("stock.disconnectFromPos.details","The item name, SKU, price, and stock levels in Workshop will be kept. POS external IDs will be removed so you can edit the item and payments can continue syncing. This does not restore the product in {origin}.",{origin:f})})]})})};function eD(e,t){return!0===t&&null!=e&&e!==M.I.Workshop}var eN=function(e){return e.ITEM="item",e.IMAGE="image",e.SKU="sku",e.MANUFACTURER_SKU="manufacturer_sku",e.BRAND="brand",e.PRICE="price",e.BARCODE="barcode",e.AVAILABILITY="availability",e.CATEGORY="category",e.VENDOR="vendor",e.UPC="upc",e.EAN="ean",e.STOCK="stock",e.LOCATION="location",e.COST_PRICE="cost_price",e.TAX_RATE="tax_rate",e.ORIGIN="origin",e.EXTERNAL_ID="external_id",e.LAST_EDITED="last_edited",e}({}),eB=function(e){return e.NEEDS_ORDERING="needs_ordering",e.COPY="copy",e.COPY_TO_SHOPIFY="copy_to_shopify",e.POS_SYNC="pos_sync",e.DISCONNECT_FROM_POS="disconnect_from_pos",e.EDIT="edit",e.DUPLICATE="duplicate",e.DELETE="delete",e}({}),eR=n(52589),eM=n(4765);let eL={NeedsOrdering:"NeedsOrdering",WaitingOnDelivery:"WaitingOnDelivery",Received:"Received"};var eV=n(67890),eW=n(400);n(34677),eV.U,eW.b;var ez=n(92648);ez.o;let eK={Job:"Job",Invoice:"Invoice",General:"General"};n(89598).f,g.l;var eU=n(60427);eU.a;var eq=n(58534);let eH=new Map([["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M 178.072 41.238 C 184.024 42.833 186.017 50.273 181.66 54.63 L 133.66 102.63 C 130.535 105.758 125.465 105.758 122.34 102.63 L 74.34 54.63 C 72.318 52.608 71.528 49.661 72.268 46.898 C 73.863 40.946 81.303 38.953 85.66 43.31 L 128 85.66 L 170.34 43.31 C 172.362 41.288 175.309 40.498 178.072 41.238 Z M 74.34 212.69 C 71.212 209.565 71.212 204.495 74.34 201.37 L 122.34 153.37 C 125.465 150.242 130.535 150.242 133.66 153.37 L 181.66 201.37 C 186.017 205.727 184.024 213.167 178.072 214.762 C 175.309 215.502 172.362 214.712 170.34 212.69 L 128 170.34 L 85.66 212.69 C 82.535 215.818 77.465 215.818 74.34 212.69 Z"}))]]);(0,r.forwardRef)((e,t)=>r.createElement(eq.A,{ref:t,...e,weights:eH}
1)).displayName="CaretDownUp",n(75860),n(80132);var eG=n(20210),eY=n.n(eG);n(87025),x().extend(eY()),p.A;var eJ=n(33476);n(90288),eU.a,eJ.r;var eX=n(28106);eU.a,eX.Z,eU.a,eJ.r;var eQ=n(72471);eL.NeedsOrdering,eQ.A.palette.error.main,eL.WaitingOnDelivery,eQ.A.palette.info.main,eL.Received,eQ.A.palette.success.main,n(73685),n(81278);var eZ=n(59033),e$=n(59556);n(45305),n(28389),eK.Job,eZ.B,eK.Invoice,e$.q,eK.General,eR.l,ek.A,n(6603),m.A,eb.I,m.A,c.A,c.A,eK.Job,eZ.B,eK.Invoice,e$.q,eK.General,eR.l,ek.A;let e0="back-orders",e1=(0,o.jsx)(eR.l,{}),e2=e=>{let{disabled:t=!1,stockVariationId:n,invoiceId:l,serviceItemInstanceId:a}=e,{t:s}=(0,w.Wn)(),c=(0,_.jL)(),d=(0,eO.jE)(),{backOrder:u,isPending:p}=function(e){let t,n,o,l,a=(0,i.c)(10),{stockVariationId:r,invoiceId:s,serviceItemInstanceId:c}=e;a[0]!==s||a[1]!==c||a[2]!==r?(t=e=>(function(e,t){let{stockVariationId:n,invoiceId:o,serviceItemInstanceId:i}=t;return null==e?void 0:e.find(e=>e.stockVariation.stockVariationId===n&&(e.serviceItemInstanceId===i||null==e.serviceItemInstanceId&&null==i)&&(e.invoiceId===o||null==e.invoiceId&&null==o))})(e.data.items,{stockVariationId:r,invoiceId:s,serviceItemInstanceId:c}),a[0]=s,a[1]=c,a[2]=r,a[3]=t):t=a[3];let d=t;a[4]===Symbol.for("react.memo_cache_sentinel")?(n=[e0],a[4]=n):n=a[4],a[5]!==d?(o={query:{refetchInterval:3e5,staleTime:3e5,queryKey:n,select:d}},a[5]=d,a[6]=o):o=a[6];let{data:u,isPending:p}=function(e,t){let n=(e=>{var t;let{query:n,axios:o}=null!=e?e:{};return{queryKey:null!=(t=null==n?void 0:n.queryKey)?t:["/v2/Collection/GetNeedsOrderingCollection"],queryFn:e=>{let t,{signal:n}=e;return t={signal:n,...o},S.A.get("/v2/Collection/GetNeedsOrderingCollection",t)},staleTime:0,...n}})(e),o=(0,v.I)(n,void 0);return o.queryKey=n.queryKey,o}(o);return a[7]!==u||a[8]!==p?(l={backOrder:u,isPending:p},a[7]=u,a[8]=p,a[9]=l):l=a[9],l}({stockVariationId:n,invoiceId:l,serviceItemInstanceId:a}),{mutateAsync:m,isPending:h}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["setNeedsOrderingItemQuantity"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{params:t}=null!=e?e:{};return((e,t)=>S.A.post("/v2/Collection/SetNeedsOrderingItemQuantity",void 0,{...t,params:{...e,...null==t?void 0:t.params}}))(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})({mutation:{onSettled:async()=>d.invalidateQueries({queryKey:[e0]})}}),y=p||h,g=u?s("backOrders.button.viewOrder"):s("backOrders.button.backOrder"),f=(0,r.useCallback)(e=>{e.stopPropagation(),y||(u?c((0,eg.CO)(!0)).then(async()=>c((0,eg.rP)(u.stockVariation.stockVariationId,u.collectionItemId))).catch(async e=>((0,eM.Cp)(e),c((0,Z.kw)("error",s("vocab.somethingWentWrong","Something went wrong. Please try again or contact support if the problem persists."))))):null!=n&&m({params:{stockVariationId:n,quantity:1,invoiceId:l,serviceItemInstanceId:a}}).catch(async e=>((0,eM.Cp)(e),c((0,Z.kw)("error",s("backOrders.toast.createFailed"))))))},[y,u,n,c,m,l,a]);return(0,o.jsx)(ex.A,{variant:u?"contained":"outlined",size:"small",color:"tertiary",startIcon:e1,disabled:t||y,loading:y,sx:{textTransform:"none"},onClick:f,children:g})},e5=e=>{let{item:t,includeActions:n,canCopyPartnerItemToShopify:l=!1}=e,[a,s]=(0,em.A)(n,e=>e===eB.NEEDS_ORDERING),c=a.length>0,u=(0,_.jL)(),{t:p}=(0,w.WD)(),h=(0,r.useRef)(null),[y,f]=(0,r.useState)(!1),[x,v]=(0,r.useState)(!1),[b,C]=(0,r.useState)(!1),[A,j]=(0,r.useState)(!1),{mutateAsync:I,isPending:T}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["duplicateStockItem"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{params:t}=null!=e?e:{};return((e,t)=>S.A.post("/v2/StockItem/DuplicateStockItem",void 0,{...t,params:{...e,...null==t?void 0:t.params}}))(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})(),P=(0,r.useCallback)(e=>{f(!0),e.stopPropagation()},[]),F=(0,r.useCallback)(e=>{f(!1),e.stopPropagation()},[]),O=(0,r.useCallback)(e=>{f(!1),v(!0),e.stopPropagation()},[]),E=(0,r.useCallback)(e=>{f(!1),C(!0),e.stopPropagation()},[]),D=(0,r.useCallback)(e=>{f(!1),j(!0),e.stopPropagation()},[]),N=Y(t,e=>({stockItemId:e.stockItemId,stockItemName:e.name,origin:e.origin,canDisconnect:eD(e.origin,e.posItem)}),e=>{var t;return{stockItemId:e.stockItemId,stockItemName:null!=(t=e.stockItemName)?t:e.name,origin:e.origin,canDisconnect:eD(e.origin,e.posItem)}}),R=(0,r.useCallback)(e=>{f(!1),Y(t,e=>{(0,B.vP)(e,u)},e=>{(0,B.lm)(e,u)}),e.stopPropagation()},[u,t]),M=(0,r.useCallback)(e=>{Y(t,e=>{I({params:{stockItemId:e.stockItemId}}).then(async e=>(f(!1),u((0,eg.SN)(e.data.stockItemId)))).then(async()=>u((0,eg.Cr)())).catch(e=>{console.error(e)})},()=>null),e.stopPropagation()},[u,I,t]),L=(0,r.useCallback)(e=>{f(!1),Y(t,e=>{u((0,eg.yn)(e)).catch(e=>{console.error(e)})},e=>{u((0,eg.ZO)(e)).catch(e=>{console.error(e)})}),e.stopPropagation()},[u,t]),V=(0,r.useCallback)(e=>{switch(e){case eB.NEEDS_ORDERING:return Y(t,e=>{var t;return(null==(t=e.variations)?void 0:t.length)===1?(0,o.jsx)(e2,{stockVariationId:e.variations[0].stockVariationId}):(0,o.jsx)(K.A,{title:p("idk","Please add individual variations to cart."),children:(0,o.jsx)("span",{children:(0,o.jsx)(e2,{disabled:!0})})})},e=>(0,o.jsx)(e2,{stockVariationId:e.stockVariationId}));case eB.COPY:return Y(t,()=>(0,o.jsxs)(ei.A,{component:"li",sx:{color:"text.secondary"},onClick:O,children:[(0,o.jsx)(el.A,{children:(0,o.jsx)(ec.Q,{size:22})}),(0,o.jsx)(ea.A,{primary:p("stockTable.menu.copyToStock","Copy Into My Stock")})]}),()=>null);case eB.COPY_TO_SHOPIFY:if(!l)return null;return Y(t,()=>(0,o.jsxs)(ei.A,{component:"li",sx:{color:"text.secondary"},onClick:E,children:[(0,o.jsx)(el.A,{children:(0,o.jsx)(ed.f,{size:22})}),(0,o.jsx)(ea.A,{primary:p("stockTable.menu.copyToShopify","Copy to Shopify")})]}),()=>null);case eB.POS_SYNC:return Y(t,e=>!0===e.posItem?(0,o.jsx)(ef,{stockItemId:e.stockItemId,setIsOpen:f}):null,()=>null);case eB.DISCONNECT_FROM_POS:return N.canDisconnect?(0,o.jsxs)(ei.A,{component:"li",sx:{color:"text.secondary"},onClick:D,children:[(0,o.jsx)(el.A,{children:(0,o.jsx)(eu.U,{size:22})}),(0,o.jsx)(ea.A,{primary:function(e,t){let n=null!=e?(0,eF.D)(e):t("vocab.pos","POS");return t("stockTable.menu.disconnectFromPos","Unlink from {origin}",{origin:n})}(N.origin,p)})]}):null;case eB.EDIT:return(0,o.jsxs)(ei.A,{component:"li",sx:{color:"text.secondary"},onClick:R,children:[(0,o.jsx)(el.A,{children:(0,o.jsx)(ep.I,{size:22})}),(0,o.jsx)(ea.A,{primary:p("vocab.edit","Edit")})]});
1case eB.DUPLICATE:return Y(t,e=>!1===e.posItem?(0,o.jsxs)(ei.A,{component:"li",sx:{color:"text.secondary"},onClick:M,children:[(0,o.jsx)(el.A,{children:T?(0,o.jsx)(es.A,{size:14}):(0,o.jsx)(eo.In,{icon:et.A,width:20,height:20})}),(0,o.jsx)(ea.A,{primary:p("vocab.duplicate","Duplicate")})]}):null,()=>null);case eB.DELETE:return(0,o.jsxs)(ei.A,{component:"li",sx:{color:"text.secondary"},onClick:L,children:[(0,o.jsx)(el.A,{children:(0,o.jsx)(g.l,{size:22})}),(0,o.jsx)(ea.A,{primary:p("vocab.delete","Delete")})]});default:return null}},[l,N.canDisconnect,L,M,R,E,O,D,T,t,p]),W=(0,r.useCallback)(e=>{switch(e){case eB.COPY:return Y(t,e=>(0,o.jsx)(eC,{stockItem:e,open:x,setOpen:v},e.stockItemId),()=>null);case eB.COPY_TO_SHOPIFY:if(!l)return null;return Y(t,e=>(0,o.jsx)(eP,{stockItem:e,open:b,setOpen:C},"shopify-".concat(e.stockItemId)),()=>null);default:return null}},[l,x,b,t]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(m.A,{direction:"row",sx:{width:"100%",alignItems:"center",justifyContent:"space-between"},children:[c?V(eB.NEEDS_ORDERING):null,s.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d.A,{ref:h,onClick:P,children:(0,o.jsx)(eo.In,{icon:en.A,width:20,height:20})}),(0,o.jsx)(er.A,{open:y,anchorEl:h.current,slotProps:{paper:{sx:{width:200,maxWidth:"100%"}}},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},onClose:F,children:s.map(e=>V(e))})]})]}),s.map(e=>W(e)),N.canDisconnect&&(0,o.jsx)(eE,{open:A,onClose:()=>j(!1),stockItemId:N.stockItemId,stockItemName:N.stockItemName,origin:N.origin})]})};var e3=n(28692),e4=n(88189),e6=n(42013),e8=n(69741),e7=n(10926),e9=n(10379),te=n(6628),tt=n(4495),tn=n(38002);let to=(0,tt.Ay)(e6.A)(()=>({display:"flex",justifyContent:"space-between",paddingLeft:"0!important",paddingRight:"0!important"})),ti=(0,tt.Ay)(e8.A)(e=>{let{theme:t}=e;return{width:240,minWidth:240,flexGrow:1,transition:t.transitions.create(["box-shadow","width","max-width"],{easing:t.transitions.easing.easeInOut,duration:t.transitions.duration.shorter}),"&.Mui-focused":{width:320,maxWidth:320,boxShadow:t.shadows[8]},"& fieldset":{borderWidth:"1px !important"},[t.breakpoints.up(968)]:{maxWidth:240}}}),tl=e=>{let t,n,l,a,r,s,c,d,u,m,h,y,g,f,x,k,v,S=(0,i.c)(36),{setFilterName:b,setItemFilters:C,itemFilters:A}=e,{t:j}=(0,w.WD)();S[0]!==C?(t=(e,t)=>{C(t)},S[0]=C,S[1]=t):t=S[1];let I=t;S[2]!==b?(n=(0,tn.A)(e=>{b(e.target.value)},200),S[2]=b,S[3]=n):n=S[3];let T=n;return S[4]===Symbol.for("react.memo_cache_sentinel")?(l={display:"flex",justifyContent:"space-between",width:"100%",flexWrap:"wrap",gap:"8px",margin:"0",marginBottom:1,flexGrow:1},S[4]=l):l=S[4],S[5]!==j?(a=j("vocab.quickSearch","Quick search..."),S[5]=j,S[6]=a):a=S[6],S[7]===Symbol.for("react.memo_cache_sentinel")?(r=(0,o.jsx)(e7.A,{position:"start",children:(0,o.jsx)(p.A,{component:eo.In,icon:e4.A,sx:{color:"text.disabled"}})}),S[7]=r):r=S[7],S[8]!==T||S[9]!==a?(s=(0,o.jsx)(ti,{size:"small",placeholder:a,startAdornment:r,onChange:T}),S[8]=T,S[9]=a,S[10]=s):s=S[10],S[11]===Symbol.for("react.memo_cache_sentinel")?(c={display:"flex",gap:"8px",flexWrap:"wrap",flexGrow:{sm:1,md:1,lg:0},maxWidth:{}},S[11]=c):c=S[11],S[12]===Symbol.for("react.memo_cache_sentinel")?(d={minWidth:250,flexGrow:1},S[12]=d):d=S[12],S[13]!==j?(u=j("stockItems.soldOut","Sold Out"),S[13]=j,S[14]=u):u=S[14],S[15]!==u?(m={title:u,value:"SoldOutItems"},S[15]=u,S[16]=m):m=S[16],S[17]!==j?(h=j("stockItems.lowStockAlert","Low Stock Alert"),S[17]=j,S[18]=h):h=S[18],S[19]!==h?(y={title:h,value:"LowStockAlertTriggered"},S[19]=h,S[20]=y):y=S[20],S[21]!==m||S[22]!==y?(g=[m,y],S[21]=m,S[22]=y,S[23]=g):g=S[23],S[24]!==A?(f=(e,t)=>(0,o.jsxs)("li",{...e,children:[(0,o.jsx)(eS.A,{checked:A.some(e=>e.value===t.value),size:"small"}),t.title]}),S[24]=A,S[25]=f):f=S[25],S[26]!==j?(x=e=>(0,o.jsx)(e9.A,{...e,label:j("stockItems.itemFilters","Item Filters"),placeholder:j("vocab.all","All")}),S[26]=j,S[27]=x):x=S[27],S[28]!==I||S[29]!==g||S[30]!==f||S[31]!==x?(k=(0,o.jsx)(p.A,{sx:c,children:(0,o.jsx)(te.A,{multiple:!0,disableCloseOnSelect:!0,size:"small",style:d,options:g,isOptionEqualToValue:ta,getOptionLabel:tr,renderOption:f,renderInput:x,onChange:I})}),S[28]=I,S[29]=g,S[30]=f,S[31]=x,S[32]=k):k=S[32],S[33]!==k||S[34]!==s?(v=(0,o.jsx)(to,{children:(0,o.jsxs)(p.A,{sx:l,children:[s,k]})}),S[33]=k,S[34]=s,S[35]=v):v=S[35],v};function ta(e,t){return e.value===t.value}function tr(e){return e.title}let ts=e=>{var t,n;let{tableId:i,includeColumns:l,includeActions:a=[],refreshDataToken:s,stockOrigins:c=[],onRowClick:d,ignoreBusiness:u=!1,noVariations:p=!1,showToolbar:h=!1,allowOverflow:y=!1,checkboxSelection:g=!1,rowSelectionModelOverride:f=null,setRowSelectionModelOverride:k,extraColumns:v,excludePartnerStock:S=!0,defaultPageSize:C,sx:j,pinnedColumns:M,canCopyPartnerItemToShopify:W=!1}=e,{t:z}=(0,w.WD)(),K=(0,_.GV)(e=>e.business.data),U=(null==K||null==(t=K.settings)?void 0:t.vatRegistered)===!0,q=null!=(n=null==K?void 0:K.taxClasses)?n:[],[H,G]=(0,r.useState)([]),[J,X]=(0,r.useState)(),Q=(0,r.useMemo)(()=>
1{if(!U)return;let e=(0,T.hO)(z),t=(0,P.o2)(z("stockItem.defaultTaxClassInherit","Use business default"),(0,P.rw)("part",q,null==K?void 0:K.settings),e);return{inheritLabel:t,taxClasses:q,treatmentLabel:e,options:[{value:"0",label:t},...q.filter(e=>null!=e.taxClassId).map(t=>({value:String(t.taxClassId),label:(0,P.ZU)(t,e)}))]}},[null==K?void 0:K.settings,z,q,U]),Z=(0,r.useMemo)(()=>{let e=((e,t,n,i)=>{let l=((e,t)=>{var n;return{[eN.ITEM]:{field:"Name",type:"string",width:250,filterable:!0,sortable:!0,headerName:e("stockTable.items.columns.item","Item"),placeholder:e("stockTable.items.placeholders.item","Giant Bike Chassis"),disablePadding:!0,getPropValue:e=>{var t;return null!=(t=e.name)?t:"-"}},[eN.IMAGE]:{field:"Image",type:"string",width:50,filterable:!1,sortable:!1,headerName:"",disablePadding:!0,getPropValue:e=>{var t,n;return(0,o.jsx)(E.A,{src:(0,V.GA)(null!=(t=e.resourceHandleId)?t:void 0,null!=(n=e.resourceHandleUuid)?n:void 0,!1)})}},[eN.SKU]:{field:"Variations[0].SKU",type:"string",width:150,headerName:e("stockTable.columns.sku","SKU"),placeholder:e("stockTable.items.placeholders.sku","123456"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.length?null!=(n=null==(t=e.variations[0])?void 0:t.sku)?n:"-":"".concat(e.variations.length," Variations")},e=>{var t;return null!=(t=e.sku)?t:"-"})},[eN.MANUFACTURER_SKU]:{field:"Variations[0].ManufacturerSku",type:"string",width:180,headerName:e("stockTable.columns.manufacturerSku","Manufacturer SKU"),placeholder:e("stockTable.items.placeholders.manufacturerSku","MFG-123"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.length?null!=(n=null==(t=e.variations[0])?void 0:t.manufacturerSku)?n:"-":"".concat(e.variations.length," Variations")},e=>{var t;return null!=(t=e.manufacturerSku)?t:"-"})},[eN.BRAND]:{field:"Brand",type:"string",width:150,headerName:e("stockTable.columns.brand","Brand"),placeholder:e("stockTable.placeholders.brand","Giant"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t;return null!=(t=e.brand)?t:"-"},()=>"-")},[eN.PRICE]:{field:"Variations[0].Price",type:"string",width:160,sortable:!1,filterable:!1,headerName:e("stockTable.columns.price","Price"),disablePadding:!0,getPropValue:e=>Y(e,e=>(0,B.x6)(e),e=>void 0===e.pricingUnitType?"-":null!==e.price?"".concat((0,V.TI)(e.price)).concat(R.A[e.pricingUnitType].adornment):"-")},[eN.COST_PRICE]:{field:"Variations[0].CostPrice",type:"string",width:160,sortable:!1,filterable:!1,headerName:e("vocab.costPrice","Cost Price"),disablePadding:!0,getPropValue:e=>Y(e,e=>(0,B.c8)(e),e=>void 0===e.pricingUnitType?"-":null!==e.costPrice?"".concat((0,V.TI)(e.costPrice)).concat(R.A[e.pricingUnitType].adornment):"-")},[eN.TAX_RATE]:{field:"Variations[0].DefaultTaxClassId",type:"singleSelect",width:160,sortable:!0,filterable:!0,headerName:e("stockTable.columns.taxRate","Tax rate"),disablePadding:!0,options:null!=(n=null==t?void 0:t.options)?n:[],getPropValue:e=>Y(e,e=>{if(null===e.variations||void 0===e.variations||0===e.variations.length)return"-";if(1===e.variations.length){var n,o,i;let l=(0,P.B0)(null!=(o=null==t?void 0:t.taxClasses)?o:[],null==(n=e.variations[0])?void 0:n.defaultTaxClassId);return null!=l?(0,P.ZU)(l,null==t?void 0:t.treatmentLabel):null!=(i=null==t?void 0:t.inheritLabel)?i:"-"}return"".concat(e.variations.length," Variations")},e=>{var n,o;let i=(0,P.B0)(null!=(n=null==t?void 0:t.taxClasses)?n:[],e.defaultTaxClassId);return null!=i?(0,P.ZU)(i,null==t?void 0:t.treatmentLabel):null!=(o=null==t?void 0:t.inheritLabel)?o:"-"})},[eN.BARCODE]:{field:"Variations[0].Barcode",type:"string",width:150,headerName:e("stockTable.columns.barcode","Barcode"),placeholder:e("stockTable.placeholders.barcode","123456789"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.length?null!=(n=null==(t=e.variations[0])?void 0:t.barcode)?n:"-":"".concat(e.variations.length," Variations")},e=>{var t;return null!=(t=e.barcode)?t:"-"})}
1,[eN.AVAILABILITY]:{field:"Variations[0].ExternalInStock",type:"boolean",align:"left",headerName:e("stockTable.columns.availability","Availability"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.length?(null==(t=e.variations[0])?void 0:t.externalInStock)===!0:"".concat(e.variations.length," Variations")},e=>!0===e.externalInStock),renderCell:e=>{let t=e.value;return void 0===t?(0,o.jsx)("span",{children:"-"}):"string"==typeof t?(0,o.jsx)("span",{children:t}):t?(0,o.jsxs)(m.A,{direction:"row",spacing:1,sx:{justifyContent:"flex-start",alignItems:"center"},children:[(0,o.jsx)(F.r,{size:20,color:"#00AB55",weight:"fill"}),(0,o.jsx)("span",{children:"In Stock"})]}):(0,o.jsxs)(m.A,{direction:"row",spacing:1,sx:{justifyContent:"flex-start"},children:[(0,o.jsx)(O.J,{size:20,color:"#FF4842",weight:"fill"}),(0,o.jsx)("span",{children:"Out of Stock"})]})}},[eN.CATEGORY]:{field:"Category.Name",type:"singleSelect",width:150,headerName:e("vocab.category","Category"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null!=(n=null==(t=e.category)?void 0:t.name)?n:"-"},()=>"-")},[eN.VENDOR]:{field:"Vendor",type:"string",width:150,headerName:e("vocab.vendor","Vendor"),placeholder:e("stockItems.vendorPlaceholder","Madison"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t;return null!=(t=e.vendor)?t:"-"},()=>"-")},[eN.UPC]:{field:"Variations[0].UPC",type:"string",width:150,sortable:!1,headerName:e("vocab.upc","UPC"),placeholder:"123456789",disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.length?null!=(n=null==(t=e.variations[0])?void 0:t.upc)?n:"-":"".concat(e.variations.length," Variations")},e=>{var t;return null!=(t=e.upc)?t:"-"})},[eN.EAN]:{field:"Variations[0].EAN",type:"string",width:150,sortable:!1,headerName:e("vocab.ean","EAN"),placeholder:"123456789",disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.length?null!=(n=null==(t=e.variations[0])?void 0:t.ean)?n:"-":"".concat(e.variations.length," Variations")},e=>{var t;return null!=(t=e.ean)?t:"-"})},[eN.STOCK]:{field:"Variations[0].RemainingStock",type:"string",width:100,filterable:!1,sortable:!1,headerName:e("vocab.stock","Stock"),disablePadding:!0,getPropValue:e=>Y(e,e=>{if(null!==e.variations&&void 0!==e.variations&&0!==e.variations.length&&e.variations.some(e=>!0===e.trackingEnabled))return e.variations.filter(e=>!0===e.trackingEnabled).map(e=>{var t;return null!=(t=e.remainingStock)?t:0}).reduce((e,t)=>e+t,0)},e=>{if(void 0!==e.trackingEnabled&&e.trackingEnabled)return e.remainingStock}),renderCell:e=>{let t=e.value;if(void 0===t)return"-";let n=Y(e.row,(e,n)=>void 0!==e.variations&&null!==e.variations&&1===e.variations.length?n(e.variations[0]):t,e=>!1===e.trackingEnabled||void 0===e.lowStockAlertsValue||null===e.lowStockAlertsValue?t:!0===e.trackingEnabled&&t<e.lowStockAlertsValue?(0,o.jsx)(D.A,{color:"warning",sx:{fontWeight:"400",fontSize:14,marginLeft:"-4px"},children:t}):t);if(r.isValidElement(n))return n;let i=String(n);return"-"===i.trim()?i:(0,e3.r)({...e,value:i})}},[eN.LOCATION]:{field:"Location",type:"string",width:150,sortable:!1,headerName:e("vocab.location","Location"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t;return null!=(t=e.location)?t:"-"},()=>"-")},[eN.ORIGIN]:{field:"StockItem.Origin",type:"singleSelect",width:200,customFilterProperty:"StockOrigins",sortable:!1,headerName:e("vocab.origin","Origin"),placeholder:e("stockItems.originPlaceholder","Workshop"),disablePadding:!0,getPropValue:e=>{var t;let n=null!=(t=e.origin)?t:"Workshop",i=L[n];return(0,o.jsx)("img",{src:i,width:100,alt:n})}},[eN.EXTERNAL_ID]:{field:"Variations[0].POSExternalId",type:"string",width:150,sortable:!1,headerName:e("stock.variations.form.posExternalId","External ID"),disablePadding:!0,getPropValue:e=>Y(e,e=>{var t,n;return null===e.variations||void 0===e.variations||0===e.variations.length?"-":1===e.variations.filter(e=>null!==e.posExternalId).length?null!=(n=null==(t=e.variations.find(e=>null!==e.posExternalId))?void 0:t.posExternalId)?n:"-":e.variations.filter(e=>null!==e.posExternalId).length>1?"".concat(e.variations.filter(e=>null!==e.posExternalId).length," Variations"):"-"},e=>{var t;return null!=(t=e.posExternalId)?t:"-"})},[eN.LAST_EDITED]:{field:"Edited",type:"string",width:160,sortable:!0,headerName:e("vocab.lastEdited","Last edited"),disablePadding:!0,getPropValue:e=>Y(e,e=>e.edited?(0,A.Gl)(x()(e.edited),A.LN.NUMERIC_DATE_TIME):"-",e=>e.edited?(0,A.Gl)(x()(e.edited),A.LN.NUMERIC_DATE_TIME):"-")}}})(e,null==i?void 0:i.taxRate),a=t.map(e=>l[e]);return n.length>
10&&a.push({field:"actions",type:"actions",filterable:!1,sortable:!1,align:"left",headerName:"",width:180,flex:0,disablePadding:!0,renderCell:e=>{var t;return(0,o.jsx)(e5,{item:e.row,includeActions:n,canCopyPartnerItemToShopify:null!=(t=null==i?void 0:i.canCopyPartnerItemToShopify)&&t})}}),a})(z,l,a,{canCopyPartnerItemToShopify:W,taxRate:Q});return(null==v?void 0:v.length)?[...e.filter(e=>"actions"!==e.field),...v,...e.filter(e=>"actions"===e.field)]:e},[z,l,a,v,W,Q]),et=(0,r.useMemo)(()=>(e=>({leafField:"Name",headerName:e("stockTable.items.columns.item","Item"),placeholder:e("stockTable.items.placeholders.item","Giant Bike Chassis"),width:250,filterable:!0,renderCell:e=>(0,o.jsx)(ee,{id:e.id,field:e.field,row:e.row,rowNode:e.rowNode}),renderHeaderFilter:e=>{var t;return(null==(t=e.colDef)?void 0:t.filterable)===!1?null:(0,o.jsx)(N.A,{...e})}}))(z),[z]),en=(0,r.useCallback)(e=>["stock-table-theme--".concat(e.row.objectType),...d?["mui-data-grid-clickable"]:[]].join(" "),[d]);return(0,o.jsxs)(o.Fragment,{children:[h&&(0,o.jsx)(tl,{setFilterName:X,setItemFilters:G,itemFilters:H}),(0,o.jsx)(b.A,{disableExport:!0,treeData:!p,defaultPageSize:null!=C?C:10,tableId:i,searchQuery:J,style:{border:"none"},checkboxSelection:g,allowOverflow:y,refreshDataToken:null!=s?s:i,columns:Z,pinnedColumns:{left:[I.it],right:["actions"],...M},defaultDensity:"standard",title:void 0,url:"/StockItem/Search",additionalReqProps:{stockOrigins:c,ignoreBusiness:u,excludePartnerStock:S,soldOutItems:!!H.some(e=>"SoldOutItems"===e.value)||null,lowStockAlertTriggered:!!H.some(e=>"LowStockAlertTriggered"===e.value)||null},getTreeDataPath:$,groupingColDef:et,childrenPropertyKey:"variations",getRowClassName:en,rowSelectionModelOverride:null!=f?f:void 0,setRowSelectionModelOverride:null!=k?k:void 0,sx:{"& .stock-table-theme--StockVariation":{backgroundColor:e=>e.palette.grey[100]},...j},onRowClick:d})]})},tc=e=>
1{let t,n,l,a,r=(0,i.c)(7),{supplier:s}=e;r[0]===Symbol.for("react.memo_cache_sentinel")?(t=[eN.IMAGE,eN.SKU,eN.MANUFACTURER_SKU,eN.BRAND,eN.PRICE,eN.BARCODE,eN.AVAILABILITY],r[0]=t):t=r[0];let c=t,d="all-stock-".concat(s.name);return r[1]!==s.origin?(n=[s.origin],r[1]=s.origin,r[2]=n):n=r[2],r[3]===Symbol.for("react.memo_cache_sentinel")?(l={maxHeight:"100%"},r[3]=l):l=r[3],r[4]!==d||r[5]!==n?(a=(0,o.jsx)(ts,{ignoreBusiness:!0,allowOverflow:!0,tableId:d,stockOrigins:n,includeColumns:c,sx:l,onRowClick:J}),r[4]=d,r[5]=n,r[6]=a):a=r[6],a},td=e=>{let t,n,l,a,r,s,c=(0,i.c)(14),{open:d,setOpen:u,supplier:p}=e,{name:m}=p;c[0]!==u?(t=()=>{u(!1)},c[0]=u,c[1]=t):t=c[1];let h=t;c[2]!==h?(n=[{type:"button",content:"Close",hideOnMobile:!0,buttonProps:{onClick:h},side:"left"}],c[2]=h,c[3]=n):n=c[3];let y=n,g="".concat(m," Stock List");return c[4]===Symbol.for("react.memo_cache_sentinel")?(l={display:"flex"},a={flex:1},c[4]=l,c[5]=a):(l=c[4],a=c[5]),c[6]!==p?(r=(0,o.jsx)(tc,{supplier:p}),c[6]=p,c[7]=r):r=c[7],c[8]!==y||c[9]!==h||c[10]!==d||c[11]!==g||c[12]!==r?(s=(0,o.jsx)(j.A,{fullWidth:!0,maxWidth:"lg",open:d,title:g,actions:y,dialogContentSx:l,dialogContentContainerSx:a,onClose:h,children:r}),c[8]=y,c[9]=h,c[10]=d,c[11]=g,c[12]=r,c[13]=s):s=c[13],s},tu=e=>{let t,n,l,a,r,s,c=(0,i.c)(22),{open:d,setOpen:u,selectedSupplier:p,setSelectedSupplier:m,refreshTable:h}=e,{stockSupplierId:y,name:g}=p,f=(0,_.jL)(),{mutateAsync:x,isPending:v}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["deleteStock"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{data:t}=null!=e?e:{};return((e,t)=>{let n=new FormData;return void 0!==e.stockSupplierId&&n.append("stockSupplierId",e.stockSupplierId.toString()),S.A.post("/v2/Stock/DeleteStock",n,t)})(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})();c[0]!==u||c[1]!==m?(t=()=>{u(!1),m()},c[0]=u,c[1]=m,c[2]=t):t=c[2];let b=t;c[3]!==x||c[4]!==f||c[5]!==b||c[6]!==h||c[7]!==y?(n=()=>{x({data:{stockSupplierId:y}}).then(async()=>(b(),f((0,Z.kw)("success","Deleted all stock items.",{options:{autoHideDuration:2e3}})))).then(async()=>h()).catch(async()=>f((0,Z.kw)("error","Deletion failed"))).catch(tp)},c[3]=x,c[4]=f,c[5]=b,c[6]=h,c[7]=y,c[8]=n):n=c[8];let C=n;c[9]!==b?(l={type:"button",content:"Close",hideOnMobile:!0,buttonProps:{onClick:b},side:"left"},c[9]=b,c[10]=l):l=c[10],c[11]!==C||c[12]!==v?(a={type:"button",content:"Delete",buttonProps:{onClick:C,loading:v,variant:"contained",color:"error"},side:"right"}
1,c[11]=C,c[12]=v,c[13]=a):a=c[13],c[14]!==l||c[15]!==a?(r=[l,a],c[14]=l,c[15]=a,c[16]=r):r=c[16];let A=r,I="Are you sure you want to delete all stock from ".concat(g,"?");return c[17]!==A||c[18]!==b||c[19]!==d||c[20]!==I?(s=(0,o.jsx)(j.A,{title:"Delete Stock",subheader:I,open:d,actions:A,onClose:b}),c[17]=A,c[18]=b,c[19]=d,c[20]=I,c[21]=s):s=c[21],s};function tp(e){console.error(e)}var tm=n(65),th=n(53761),ty=n(54841),tg=n(808),tf=n(43543),tx=n(22769),tk=n(63676);let tv={borderRadius:8,borderRadiusSm:12,borderRadiusMd:16};var tS=n(77620);function tb(e,t){return"linear-gradient(to bottom, ".concat(e,", ").concat(t,")")}let tC={0:"#FFFFFF",100:"#F9FAFB",200:"#F4F6F8",300:"#DFE3E8",400:"#C4CDD5",500:"#919EAB",600:"#637381",700:"#454F5B",800:"#212B36",900:"#161C24","500_8":(0,tS.X4)("#919EAB",.08),"500_12":(0,tS.X4)("#919EAB",.12),"500_16":(0,tS.X4)("#919EAB",.16),"500_24":(0,tS.X4)("#919EAB",.24),"500_32":(0,tS.X4)("#919EAB",.32),"500_48":(0,tS.X4)("#919EAB",.48),"500_56":(0,tS.X4)("#919EAB",.56),"500_80":(0,tS.X4)("#919EAB",.8)},tA={lighter:"#697080",light:"#3e475c",main:"#212B36",dark:"#20293b",darker:"#181f2c",contrastText:"#fff"},tj={lighter:"#D0F2FF",light:"#74CAFF",main:"#1890FF",dark:"#0C53B7",darker:"#04297A",contrastText:"#fff"},tI={lighter:"#C8FACD",light:"#5BE584",main:"#00AB55",dark:"#007B55",darker:"#005249",contrastText:tC[0]},tw={lighter:"#FFF7CD",light:"#FFE16A",main:"#FFC107",dark:"#B78103",darker:"#7A4F01",contrastText:tC[800]},tT={lighter:"#FFE7D9",light:"#FFA48D",main:"#FF4842",dark:"#B72136",darker:"#7A0C2E",contrastText:"#fff"},t_={primary:tb(tA.light,tA.main),info:tb(tj.light,tj.main),success:tb(tI.light,tI.main),warning:tb(tw.light,tw.main),error:tb(tT.light,tT.main)},tP={common:{black:"#000",white:"#fff"},primary:{...tA},secondary:{lighter:"#e4bf5f",light:"#dcac31",main:"#d8a31a",dark:"#ad8215",darker:"#826210",contrastText:"#fff"},tertiary:{lighter:"#ffd6cc",light:"#ff8466",main:"#FF7A59",dark:"#991e00",darker:"#330a00",contrastText:"#fff"},info:{...tj},success:{...tI},warning:{...tw},alternate:"rgb(247, 249, 250)",chart:{green:["#2CD9C5","#60F1C8","#A4F7CC","#C0F2DC"],violet:["#826AF9","#9E86FF","#D0AEFF","#F7D2FF"],blue:["#2D99FF","#83CFFF","#A5F3FF","#CCFAFF"],yellow:["#FFE700","#FFEF5A","#FFF7AE","#FFF3D6"],red:["#FF6C40","#FF8F6D","#FFBD98","#FFF2D4"],orange:["#FFC107","#FF8F6D","#FFBD98","#FFF2D4"]},error:{...tT},grey:tC,white:{main:"#fff"},gradients:t_,divider:tC["500_24"],action:{hover:tC["500_8"],selected:tC["500_16"],disabled:tC["500_80"],disabledBackground:tC["500_24"],focus:tC["500_24"],hoverOpacity:.08,disabledOpacity:.48}},tF={light:{...tP,text:{primary:tC[800],secondary:tC[600],disabled:tC[500]},background:{paper:"#fff",default:"#fff",neutral:tC[200]},action:{active:tC[600],...tP.action},yellow:{searchButton:tw.light}},dark:{...tP,text:{primary:"rgba(255, 255, 255, 0.81)",secondary:tC[500],disabled:tC[600]},background:{paper:"rgb(32, 32, 32)",default:"rgb(32, 32, 32)",neutral:"rgb(32, 32, 32)"},sidebar:"rgba(255, 255, 255, 0.03)",action:{active:tC[500],...tP.action},yellow:{searchButton:tw.main}}};function tO(e){return"".concat(e/16,"rem")}function tE(e){let{sm:t,md:n,lg:o}=e;return{"@media (min-width:600px)":{fontSize:tO(t)},"@media (min-width:960px)":{fontSize:tO(n)},"@media (min-width:1280px)":{fontSize:tO(o)}}}let tD={fontFamily:"Public Sans, Verdana, sans-serif",fontWeightRegular:400,fontWeightMedium:600,fontWeightBold:700,h1:{fontWeight:700,lineHeight:1.25,fontSize:tO(40),...tE({sm:52,md:58,lg:64})},h2:{fontWeight:700,lineHeight:64/48,fontSize:tO(32),...tE({sm:40,md:44,lg:48})},h3:{fontWeight:700,lineHeight:1.1,fontSize:tO(24),...tE({sm:26,md:30,lg:32})},h4:{fontWeight:700,lineHeight:1.5,fontSize:tO(20),...tE({sm:20,md:24,lg:24})},h5:{fontWeight:700,lineHeight:1.5,fontSize:tO(18),...tE({sm:19,md:20,lg:20})},h6:{fontWeight:400,lineHeight:28/18,fontSize:tO(17),...tE({sm:18,md:18,lg:18})},subtitle1:{fontWeight:600,lineHeight:1.5,fontSize:tO(16)},subtitle2:{fontWeight:600,lineHeight:22/14,fontSize:tO(14)},body1:{lineHeight:1.5,fontSize:tO(16)},body2:{lineHeight:22/14,fontSize:tO(14)},caption:{lineHeight:1.5,fontSize:tO(12)},overline:{fontWeight:700,lineHeight:1.5,fontSize:tO(12),letterSpacing:1.1,textTransform:"uppercase"},button:{fontWeight:700,lineHeight:24/14,fontSize:tO(14),textTransform:"capitalize"}},tN={values:{xs:0,sm:600,md:960,lg:1280,xl:1920}},tB=e=>{let{children:t}=e,n=(0,r.useMemo)(()=>({palette:tF.light,zIndex:{appBar:1200,drawer:1100,snackbar:5e3},shape:tv,typography:tD,breakpoints:tN}),[]),i=(0,tf.A)(n);
1return(0,o.jsx)(tx.A,{injectFirst:!0,children:(0,o.jsx)(tk.A,{theme:i,children:(0,o.jsxs)(tk.A,{theme:i,children:[(0,o.jsx)(tg.Ay,{}),t]})})})};var tR=n(87109);let tM=(0,r.createContext)({}),tL=e=>{let t,n,l=(0,i.c)(10),{useBuiltInTheme:a,children:r,rsiValues:s}=e;if(!s.fields)throw Error("Fields must be provided to react-spreadsheet-import");if(!a){let e,t;return l[0]!==r?(e=(0,o.jsx)(tR.n,{maxSnack:3,children:r}),l[0]=r,l[1]=e):e=l[1],l[2]!==s||l[3]!==e?(t=(0,o.jsx)(tM.Provider,{value:s,children:e}),l[2]=s,l[3]=e,l[4]=t):t=l[4],t}return l[5]!==r?(t=(0,o.jsx)(tR.n,{maxSnack:3,children:(0,o.jsx)(tB,{children:r})}),l[5]=r,l[6]=t):t=l[6],l[7]!==s||l[8]!==t?(n=(0,o.jsx)(tM.Provider,{value:s,children:t}),l[7]=s,l[8]=t,l[9]=n):n=l[9],n},tV=()=>(0,r.useContext)(tM),tW=e=>{let t,n,l,a,s,d,u,m,h,y,g=(0,i.c)(32),{onContinue:f,isLoading:x}=e,{translations:k,maxFileSize:v,dateFormat:S,parseRaw:b}=tV(),[C,A]=(0,r.useState)(!1),{enqueueSnackbar:j}=(0,tR.dh)();g[0]===Symbol.for("react.memo_cache_sentinel")?(t={"application/vnd.ms-excel":[".xls"],"text/csv":[".csv"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"]},g[0]=t):t=g[0],g[1]!==j||g[2]!==k.uploadStep.dropzone.errorToastDescription?(n=e=>{A(!1),e.forEach(e=>{j("".concat(e.file.name," ").concat(k.uploadStep.dropzone.errorToastDescription),{variant:"success"})})},g[1]=j,g[2]=k.uploadStep.dropzone.errorToastDescription,g[3]=n):n=g[3],g[4]!==S||g[5]!==f||g[6]!==b?(l=async e=>{let[t]=e;A(!0);let n=await new Promise((e,n)=>{let o=new FileReader;o.onload=()=>{e(o.result)},o.onerror=n,o.readAsArrayBuffer(t)}),o=ty.LF(n,{cellDates:!0,dateNF:S,raw:b,codepage:65001,type:t.name.endsWith(".csv")?"string":"array",WTF:!0});A(!1),f(o)},g[4]=S,g[5]=f,g[6]=b,g[7]=l):l=g[7],g[8]!==v||g[9]!==n||g[10]!==l?(a={noClick:!0,noKeyboard:!0,maxFiles:1,maxSize:v,accept:t,onDropRejected:n,onDrop:l},g[8]=v,g[9]=n,g[10]=l,g[11]=a):a=g[11];let{getRootProps:I,getInputProps:w,isDragActive:T,open:_}=(0,th.VB)(a);return(g[12]!==I?(s=I(),g[12]=I,g[13]=s):s=g[13],g[14]===Symbol.for("react.memo_cache_sentinel"))?(d={backgroundImage:"repeating-linear-gradient(0deg, #5d55fa, #5d55fa 10px, rgba(0,0,0,0) 10px, rgba(0,0,0,0) 20px, #5d55fa 20px),repeating-linear-gradient(90deg, #5d55fa, #5d55fa 10px, rgba(0,0,0,0) 10px, rgba(0,0,0,0) 20px, #5d55fa 20px),repeating-linear-gradient(180deg, #5d55fa, #5d55fa 10px, rgba(0,0,0,0) 10px, rgba(0,0,0,0) 20px, #5d55fa 20px),repeating-linear-gradient(270deg, #5d55fa, #5d55fa 10px, rgba(0,0,0,0) 10px, rgba(0,0,0,0) 20px, #5d55fa 20px)",backgroundSize:"2px 100%, 100% 2px, 2px 100% , 100% 2px",backgroundPosition:"0 0, 0 0, 100% 0, 0 100%",backgroundRepeat:"no-repeat",borderRadius:"4px"},g[14]=d):d=g[14],g[15]!==w?(u=w(),g[15]=w,g[16]=u):u=g[16],g[17]!==u?(m=(0,o.jsx)("input",{...u,"data-testid":"rsi-dropzone"}),g[17]=u,g[18]=m):m=g[18],g[19]!==T||g[20]!==x||g[21]!==C||g[22]!==_||g[23]!==k.uploadStep.dropzone.activeDropzoneTitle||g[24]!==k.uploadStep.dropzone.buttonTitle||g[25]!==k.uploadStep.dropzone.loadingTitle||g[26]!==k.uploadStep.dropzone.title?(h=T?(0,o.jsx)(c.A,{children:k.uploadStep.dropzone.activeDropzoneTitle}):C||x?(0,o.jsx)(c.A,{children:k.uploadStep.dropzone.loadingTitle}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.A,{children:k.uploadStep.dropzone.title}),(0,o.jsx)(ex.A,{onClick:_,variant:"contained",children:k.uploadStep.dropzone.buttonTitle})]}),g[19]=T,g[20]=x,g[21]=C,g[22]=_,g[23]=k.uploadStep.dropzone.activeDropzoneTitle,g[24]=k.uploadStep.dropzone.buttonTitle,g[25]=k.uploadStep.dropzone.loadingTitle,g[26]=k.uploadStep.dropzone.title,g[27]=h):h=g[27],g[28]!==s||g[29]!==m||g[30]!==h?(y=(0,o.jsxs)(p.A,{...s,style:d,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",flex:1,children:[m,h]}),g[28]=s,g[29]=m,g[30]=h,g[31]=y):y=g[31],y};var tz=n(66785);let tK=e=>{let t,n,l,a=(0,i.c)(7);a[0]!==e?({className:t,...n}=e,a[0]=e,a[1]=t,a[2]=n):(t=a[1],n=a[2]);let{rtl:r}=tV(),s="rdg-light "+t,c=r?"rtl":"ltr";return a[3]!==n||a[4]!==s||a[5]!==c?(l=(0,o.jsx)(tz.zh,{className:s,direction:c,...n}),a[3]=n,a[4]=s,a[5]=c,a[6]=l):l=a[6],l};var tU=n(45686);let tq={checkbox:"Boolean",select:"Options",input:"Text"},tH=e=>
1{let t,n,l,a=(0,i.c)(7),{fields:r}=e;a[0]!==r?(t=[r.reduce((e,t)=>(e[t.key]=t.example||tq[t.fieldType.type],e),{})],a[0]=r,a[1]=t):t=a[1];let s=t;a[2]!==r?(n=r.map(e=>({key:e.key,name:e.label,minWidth:150,headerRenderer:()=>(0,o.jsxs)(p.A,{display:"flex",gap:1,alignItems:"center",position:"relative",children:[(0,o.jsx)(p.A,{flex:1,overflow:"hidden",textOverflow:"ellipsis",children:e.label}),e.description&&(0,o.jsx)(K.A,{title:e.description,children:(0,o.jsx)(p.A,{style:{flex:"0 0 auto"},children:(0,o.jsx)(tU.R,{size:20})})})]}),formatter:t=>{let{row:n}=t;return(0,o.jsx)(p.A,{style:{minWidth:"100%",minHeight:"100%",overflow:"hidden",textOverflow:"ellipsis"},children:n[e.key]})}})),a[2]=r,a[3]=n):n=a[3];let c=n;return a[4]!==c||a[5]!==s?(l=(0,o.jsx)(tK,{rows:s,columns:c,className:"rdg-example"}),a[4]=c,a[5]=s,a[6]=l):l=a[6],l},tG=()=>{let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.jsx)(p.A,{style:{position:"absolute",left:0,right:0,bottom:0,height:"48px",pointerEvents:"none",backgroundImage:"linear-gradient(to bottom, rgba(0,0,0,0), #ffffff)"}}),t[0]=e):e=t[0],e},tY=e=>{let t,n,l,a,s,d,u,m,h,y,g,f,x=(0,i.c)(23),{onContinue:k}=e,[v,S]=(0,r.useState)(!1),{translations:b,fields:C}=tV();x[0]!==k?(t=async e=>{S(!0),await k(e),S(!1)},x[0]=k,x[1]=t):t=x[1];let A=t;return x[2]===Symbol.for("react.memo_cache_sentinel")?(n={height:"100%",display:"flex",flexDirection:"column"},x[2]=n):n=x[2],x[3]===Symbol.for("react.memo_cache_sentinel")?(l=(0,o.jsx)(c.A,{variant:"h5",style:{fontWeight:"bold",marginBottom:20},children:"Upload File"}),x[3]=l):l=x[3],x[4]!==b.uploadStep.manifestTitle?(a=(0,o.jsx)(c.A,{variant:"h6",children:b.uploadStep.manifestTitle}),x[4]=b.uploadStep.manifestTitle,x[5]=a):a=x[5],x[6]===Symbol.for("react.memo_cache_sentinel")?(s={marginBottom:15},x[6]=s):s=x[6],x[7]!==b.uploadStep.manifestDescription?(d=(0,o.jsx)(c.A,{variant:"subtitle1",style:s,children:b.uploadStep.manifestDescription}),x[7]=b.uploadStep.manifestDescription,x[8]=d):d=x[8],x[9]===Symbol.for("react.memo_cache_sentinel")?(u={marginBottom:"0.5rem",position:"relative",height:"72px",overflow:"hidden"},x[9]=u):u=x[9],x[10]!==C?(m=(0,o.jsx)(tH,{fields:C}),x[10]=C,x[11]=m):m=x[11],x[12]===Symbol.for("react.memo_cache_sentinel")?(h=(0,o.jsx)(tG,{}),x[12]=h):h=x[12],x[13]!==m?(y=(0,o.jsxs)(p.A,{style:u,children:[m,h]}),x[13]=m,x[14]=y):y=x[14],x[15]!==A||x[16]!==v?(g=(0,o.jsx)(tW,{onContinue:A,isLoading:v}),x[15]=A,x[16]=v,x[17]=g):g=x[17],x[18]!==y||x[19]!==g||x[20]!==a||x[21]!==d?(f=(0,o.jsxs)(tm.A,{style:n,children:[l,a,d,y,g]}),x[18]=y,x[19]=g,x[20]=a,x[21]=d,x[22]=f):f=x[22],f};var tJ=n(30259),tX=n(36646),tQ=n(74492),tZ=n(48445),t$=n(69227),t0=n(74634);let t1=(0,tt.Ay)(tJ.A)(e=>{let{theme:t}=e;return{[t.breakpoints.down("sm")]:{"& tr .MuiTableCell-root:first-of-type":{paddingLeft:"8px"},"& tr .MuiTableCell-root:last-of-type":{paddingRight:"8px"}}}}),t2=e=>{let{data:t,selectedRows:n,setSelectedRows:i}=e,l=(0,r.useMemo)(()=>t.reduce((e,t)=>e>t.length?e:t.length,0),[t]);return(0,o.jsx)(tX.A,{sx:{height:"100%",maxHeight:"calc(100vh - 300px)",overflowX:"auto",overflowY:"auto","& tbody tr:not(:last-of-type)":{borderBottom:"1px #f2f2f2 solid"}},children:(0,o.jsx)(t1,{size:"small",sx:{"& .MuiTableCell-root":{borderRadius:0,px:"8px"},"& .MuiTableCell-root:first-of-type":{paddingLeft:0},"& .MuiTableCell-root:last-of-type":{paddingRight:0}},children:(0,o.jsxs)(tQ.A,{children:[t.map((e,t)=>{let a=n.has(t);return(0,o.jsxs)(tZ.A,{onClick:()=>{i(new Set([t]))},sx:{cursor:"pointer","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:[(0,o.jsx)(t$.A,{align:"center",sx:{width:"60px",paddingLeft:"10px",paddingRight:"0px"},children:(0,o.jsx)(t0.A,{checked:a,onChange:e=>{e.stopPropagation(),i(new Set([t]))},onClick:e=>e.stopPropagation(),size:"small"})}),Array.from(Array(l),(t,n)=>{var i;return(0,o.jsx)(t$.A,{align:"left",sx:{minWidth:"150px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:null!=(i=e[n])?i:""},n)})]},t)}),0===t.length&&(0,o.jsx)(tZ.A,{children:(0,o.jsx)(t$.A,{style:{textAlign:"center",padding:24},colSpan:l+1,children:"No data available"})})]})})})},t5=e=>{let t,n,l,a,r,s=(0,i.c)(11),{onContinue:c,title:d,isLoading:u,onBack:m}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t={background:"#edf2f7",display:"flex",justifyContent:"space-between",paddingInlineStart:24,paddingInlineEnd:24,paddingTop:"1.5rem",paddingBottom:"1.5rem"},s[0]=t):t=s[0],s[1]!==m?(n=(0,o.jsx)(ex.A,{onClick:m,children:"Restart"}),s[1]=m,s[2]=n):n=s[2],s[3]===Symbol.for("react.memo_cache_sentinel")?(l={width:"21rem"},s[3]=l):l=s[3],s[4]!==u||s[5]!==c||s[6]!==d?(a=(0,o.jsx)(ex.A,{size:"large",style:l,variant:"contained",onClick:c,loading:u,children:d}),s[4]=u,s[5]=c,s[6]=d,s[7]=a):a=s[7],s[8]!==n||s[9]!==a?(r=(0,o.jsxs)(p.A,{style:t,children:[n,a]}),s[8]=n,s[9]=a,s[10]=r):r=s[10],r},t3=e=>{let t,n,l,a,s,d,u,m,h,y,g,f,x=(0,i.c)(29),{data:k,onContinue:v,onBack:S}=e,{translations:b}=tV();x[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set([0]),x[0]=t):t=x[0];let[C,A]=(0,r.useState)(t),[j,I]=(0,r.useState)(!1),w=(0,r.useRef)(!1);x[1]!==k.length||x[2]!==C?(n=()=>
1{if(k.length>0&&!w.current){let e=C.values().next().value;(void 0===e||e>=k.length)&&A(new Set([0])),w.current=!0}},x[1]=k.length,x[2]=C,x[3]=n):n=x[3],x[4]!==k.length?(l=[k.length],x[4]=k.length,x[5]=l):l=x[5],(0,r.useEffect)(n,l),x[6]!==k||x[7]!==v||x[8]!==C?(a=async()=>{let e=C.values().next().value,t=k.slice(e+1);I(!0),await v(k[e],t),I(!1)},x[6]=k,x[7]=v,x[8]=C,x[9]=a):a=x[9];let T=a;return x[10]===Symbol.for("react.memo_cache_sentinel")?(s={paddingBottom:0,display:"flex",flexDirection:"column",flex:1},x[10]=s):s=x[10],x[11]===Symbol.for("react.memo_cache_sentinel")?(d={fontWeight:"bold",marginBottom:20},x[11]=d):d=x[11],x[12]!==b.selectHeaderStep.title?(u=(0,o.jsx)(c.A,{variant:"h5",style:d,children:b.selectHeaderStep.title}),x[12]=b.selectHeaderStep.title,x[13]=u):u=x[13],x[14]===Symbol.for("react.memo_cache_sentinel")?(m={flex:1,minHeight:0,display:"flex",flexDirection:"column"},x[14]=m):m=x[14],x[15]!==k||x[16]!==C?(h=(0,o.jsx)(p.A,{sx:m,children:(0,o.jsx)(t2,{data:k,selectedRows:C,setSelectedRows:A})}),x[15]=k,x[16]=C,x[17]=h):h=x[17],x[18]!==u||x[19]!==h?(y=(0,o.jsxs)(tm.A,{style:s,children:[u,h]}),x[18]=u,x[19]=h,x[20]=y):y=x[20],x[21]!==T||x[22]!==j||x[23]!==S||x[24]!==b.selectHeaderStep.nextButtonTitle?(g=(0,o.jsx)(t5,{onBack:S,onContinue:T,title:b.selectHeaderStep.nextButtonTitle,isLoading:j}),x[21]=T,x[22]=j,x[23]=S,x[24]=b.selectHeaderStep.nextButtonTitle,x[25]=g):g=x[25],x[26]!==y||x[27]!==g?(f=(0,o.jsxs)(o.Fragment,{children:[y,g]}),x[26]=y,x[27]=g,x[28]=f):f=x[28],f};var t4=n(32369),t6=n(62739);let t8=e=>{let t,n,l,a,s,d,u,m,h,y,g,f=(0,i.c)(26),{sheetNames:x,onContinue:k,onBack:v}=e,[S,b]=(0,r.useState)(!1),{translations:C}=tV(),[A,j]=(0,r.useState)(x[0]);f[0]!==k?(t=async e=>{b(!0),await k(e),b(!1)},f[0]=k,f[1]=t):t=f[1];let I=t;return f[2]===Symbol.for("react.memo_cache_sentinel")?(n={display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",flex:1},f[2]=n):n=f[2],f[3]===Symbol.for("react.memo_cache_sentinel")?(l={fontWeight:"bold"},f[3]=l):l=f[3],f[4]!==C.uploadStep.selectSheet.title?(a=(0,o.jsx)(c.A,{variant:"h4",style:l,children:C.uploadStep.selectSheet.title}),f[4]=C.uploadStep.selectSheet.title,f[5]=a):a=f[5],f[6]===Symbol.for("react.memo_cache_sentinel")?(s=e=>j(e.target.value),f[6]=s):s=f[6],f[7]!==x?(d=x.map(t7),f[7]=x,f[8]=d):d=f[8],f[9]!==d||f[10]!==A?(u=(0,o.jsx)(t6.A,{children:(0,o.jsx)(t4.A,{value:A,onChange:s,children:d})}),f[9]=d,f[10]=A,f[11]=u):u=f[11],f[12]!==a||f[13]!==u?(m=(0,o.jsxs)(p.A,{style:n,children:[a,u]}),f[12]=a,f[13]=u,f[14]=m):m=f[14],f[15]!==I||f[16]!==A?(h=()=>I(A),f[15]=I,f[16]=A,f[17]=h):h=f[17],f[18]!==S||f[19]!==v||f[20]!==h||f[21]!==C.uploadStep.selectSheet.nextButtonTitle?(y=(0,o.jsx)(t5,{onBack:v,isLoading:S,onContinue:h,title:C.uploadStep.selectSheet.nextButtonTitle}),f[18]=S,f[19]=v,f[20]=h,f[21]=C.uploadStep.selectSheet.nextButtonTitle,f[22]=y):y=f[22],f[23]!==y||f[24]!==m?(g=(0,o.jsxs)(o.Fragment,{children:[m,y]}),f[23]=y,f[24]=m,f[25]=g):g=f[25],g};function t7(e){return(0,o.jsx)(ev.A,{value:e,control:(0,o.jsx)(t0.A,{}),label:e})}let t9=(e,t)=>{let n=e.Sheets[t||e.SheetNames[0]];return ty.Wp.sheet_to_json(n,{header:1,blankrows:!1,raw:!1})};var ne=n(68815),nt=n(29911);let nn=(e,t,n,o)=>{let i={},l=(e,t,n)=>{i[e]={...i[e],[t]:n}};return o&&(e=o(e,l)),n&&(e=e.map((t,o)=>n(t,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return l(o,...t)},e))),t.forEach(t=>{var n;null==(n=t.validations)||n.forEach(n=>{switch(n.rule){case"unique":{let o=e.map(e=>e[t.key]),l=new Set,a=new Set;o.forEach(e=>{(!n.allowEmpty||e)&&(l.has(e)?a.add(e):l.add(e))}),o.forEach((e,o)=>{a.has(e)&&(i[o]={...i[o],[t.key]:{level:n.level||"error",message:n.errorMessage||"Field must be unique"}})});break}case"required":e.forEach((e,o)=>{(null===e[t.key]||void 0===e[t.key]||""===e[t.key])&&(console.log(e),i[o]={...i[o],[t.key]:{level:n.level||"error",message:n.errorMessage||"Field is required"}})});break;case"regex":{let o=new RegExp(n.value,n.flags);e.forEach((e,l)=>{var a,r;(null!=(r=null==(a=e[t.key])?void 0:a.toString())?r:"").match(o)||(console.log(e),i[l]={...i[l],[t.ke
1y]:{level:n.level||"error",message:n.errorMessage||"Field did not match the regex /".concat(n.value,"/").concat(n.flags," ")}})})}}})}),e.map((e,t)=>("__index"in e||(e.__index=(0,nt.A)()),i[t])?{...e,__errors:i[t]}:!i[t]&&(null==e?void 0:e.__errors)?{...e,__errors:null}:e)};var no=n(69276);let ni=e=>{let t,n,l,a,r=(0,i.c)(9),{onChange:s,value:c,options:d}=e;r[0]!==s?(t=e=>{s({value:e.target.value})},r[0]=s,r[1]=t):t=r[1];let u=t,p=null==c?void 0:c.value;return r[2]===Symbol.for("react.memo_cache_sentinel")?(n={maxHeight:32},r[2]=n):n=r[2],r[3]!==d?(l=d.map(nl),r[3]=d,r[4]=l):l=r[4],r[5]!==u||r[6]!==p||r[7]!==l?(a=(0,o.jsx)(no.A,{autoFocus:!0,size:"small",fullWidth:!0,value:p,onChange:u,style:n,children:l}),r[5]=u,r[6]=p,r[7]=l,r[8]=a):a=r[8],a};function nl(e){return(0,o.jsx)(ei.A,{value:e.value,children:e.label})}var na=n(56314);let nr=e=>{let t,n,l,a,s,d,u,m,h=(0,i.c)(23),{isOpen:y,onClose:g,onConfirm:f}=e,{allowInvalidSubmit:x,translations:k}=tV(),v=(0,r.useRef)(null);h[0]!==k.alerts.submitIncomplete.headerTitle?(t=(0,o.jsx)(c.A,{fontSize:"lg",fontWeight:"bold",children:k.alerts.submitIncomplete.headerTitle}),h[0]=k.alerts.submitIncomplete.headerTitle,h[1]=t):t=h[1];let S=x?k.alerts.submitIncomplete.bodyText:k.alerts.submitIncomplete.bodyTextSubmitForbidden;return h[2]!==S?(n=(0,o.jsx)(p.A,{children:S}),h[2]=S,h[3]=n):n=h[3],h[4]===Symbol.for("react.memo_cache_sentinel")?(l={marginTop:10,display:"flex",justifyContent:"space-between"},h[4]=l):l=h[4],h[5]!==g||h[6]!==k.alerts.submitIncomplete.cancelButtonTitle?(a=(0,o.jsx)(ex.A,{ref:v,onClick:g,children:k.alerts.submitIncomplete.cancelButtonTitle}),h[5]=g,h[6]=k.alerts.submitIncomplete.cancelButtonTitle,h[7]=a):a=h[7],h[8]!==x||h[9]!==f||h[10]!==k.alerts.submitIncomplete.finishButtonTitle?(s=x&&(0,o.jsx)(ex.A,{variant:"contained",onClick:f,children:k.alerts.submitIncomplete.finishButtonTitle}),h[8]=x,h[9]=f,h[10]=k.alerts.submitIncomplete.finishButtonTitle,h[11]=s):s=h[11],h[12]!==a||h[13]!==s?(d=(0,o.jsxs)(p.A,{style:l,children:[a,s]}),h[12]=a,h[13]=s,h[14]=d):d=h[14],h[15]!==t||h[16]!==n||h[17]!==d?(u=(0,o.jsxs)(tm.A,{children:[t,n,d]}),h[15]=t,h[16]=n,h[17]=d,h[18]=u):u=h[18],h[19]!==y||h[20]!==g||h[21]!==u?(m=(0,o.jsx)(na.A,{open:y,onClose:g,id:"rsi",children:u}),h[19]=y,h[20]=g,h[21]=u,h[22]=m):m=h[22],m},ns=e=>{let{initialData:t,onBack:n}=e,{translations:i,fields:l,onClose:a,onSubmit:s,rowHook:d,tableHook:m}=tV(),[h,y]=(0,r.useState)((0,r.useMemo)(()=>nn(t,l,d,m),[])),[g,f]=(0,r.useState)(new Set),[x,k]=(0,r.useState)(!1),[v,S]=(0,r.useState)(!1),b=(0,r.useCallback)(e=>{y(nn(e,l,d,m))},[y,d,m,l]),C=(0,r.useCallback)((e,t)=>{let n=null==t?void 0:t.indexes.reduce((t,n)=>(t[h.findIndex(t=>t.__index===e[n].__index)]=e[n],t),{});b(Object.assign([],h,n))},[h,b]),A=(0,r.useMemo)(()=>[{key:"select-row",name:"",width:60,maxWidth:60,resizable:!1,sortable:!1,frozen:!0,cellClass:"rdg-checkbox",formatter:e=>{let[t,n]=(0,tz.Uk)();return(0,o.jsx)("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignContent:"center"},children:(0,o.jsx)(eS.A,{checked:t,style:{marginLeft:-5},onChange:t=>{n({type:"ROW",row:e.row,checked:t.target.checked,isShiftClick:t.nativeEvent.shiftKey})}})})}},...l.map(e=>({key:e.key,name:e.label,minWidth:150,resizable:!0,headerRenderer:()=>(0,o.jsxs)(p.A,{display:"flex",gap:1,alignItems:"center",position:"relative",children:[(0,o.jsx)(p.A,{flex:1,overflow:"hidden",textOverflow:"ellipsis",children:e.label}),e.description&&(0,o.jsx)(K.A,{title:e.description,children:(0,o.jsx)(p.A,{flex:"0 0 auto",children:(0,o.jsx)(tU.R,{size:16})})})]}),editable:"checkbox"!==e.fieldType.type,editor:t=>{let{row:n,onRowChange:i,onClose:l}=t;return"select"===e.fieldType.type?(0,o.jsx)(ni,{value:e.fieldType.options.find(t=>t.value===n[e.key]),onChange:t=>{i({...n,[e.key]:null==t?void 0:t.value},!0)},options:e.fieldType.options}):(0,o.jsx)(p.A,{children:(0,o.jsx)(e9.A,{style:{border:"none",maxHeight:32},sx:{"& .MuiInputBase-root":{maxHeight:32}},fullWidth:!0,value:n[e.key],onChange:t=>{i({...n,[e.key]:t.target.value})},onBlur:()=>l(!0)})})},formatter:t=>{var n,i,l,a;let r,{row:s,onRowChange:c}=t;switch(e.fieldType.type){case"checkbox":r=(0,o.jsx)(p.A,{display:"flex",alignItems:"center",height:"100%",onClick:e=>{e.stopPropagation()},children:(0,o.jsx)(u.A,{checked:s[e.key],onChange:()=>{c({...s,[e.key]:!s[e.key]})}})});break;case"select":r=(0,o.jsx)(p.A,{minWidth:"100%",minHeight:"100%",overflow:"hidden",textOverflow:"ellipsis",children:(null==(i=e.fieldType.options.find(t=>t.value===s[e.key]))?void 0:i.label)||null});break;default:r=(0,o.jsx)(p.A,{minWidth:"100%",minHeight:"100%",overflow:"hidden",textOverflow:"ellipsis",children:s[e.key]})}return(null==(n=s.__errors)?void 0:n[e.key])?(0,o.jsx)("div",{style:{background:"#ffacac",width:"calc(100% + 16px)",marginLeft:-8,padding:"0 8px"},children:(0,o.jsx)(K.A,{title:null==(a=s.__errors)||null==(l=a[e.key])?void 0:l.message,children:r})}):r},cellClass:t=>{var n,o;switch(null==(o=t.__errors)||null==(n=o[e.key])?void 0:n.level){case"error":return"rdg-cell-error";case"warning":return"rdg-cell-warning";case"info":return"rdg-cell-info";default:return""}}}))],[l]),j=(0,r.useMemo)(()=>x?h.filter(e=>{if(null==e?void 0:e.__errors){var t;return null==(t=Object.values(e.__errors))?void 0:t.filter(e=>"error"===e.level).length}return!1}):h,[h,x]),I=(0,r.useCallback)(e=>e.__index,[]),w=()=>{let e=h.map(e=>{let{__index:t,__errors:n,...o}=e;return{...o}}),t=e.filter((e,t)=>
1{let n=h[t];if(null==n?void 0:n.__errors){var o;return!(null==(o=Object.values(n.__errors))?void 0:o.filter(e=>"error"===e.level).length)}return!0}),n=e.filter(e=>!t.includes(e));s({validData:t,invalidData:n,all:h}),a()};var T=Array.from(new Set(h.reduce((e,t)=>{if(null==t?void 0:t.__errors){let n=Object.values(t.__errors).filter(e=>"error"===e.level);n.length>0&&e.push(...n.map(e=>({message:e.message,level:e.level})))}return e},[]).map(e=>JSON.stringify(e)))).map(e=>JSON.parse(e));return console.error(T),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(nr,{isOpen:v,onClose:()=>S(!1),onConfirm:()=>{S(!1),w()}}),(0,o.jsxs)(p.A,{style:{flex:1,margin:5},children:[(0,o.jsxs)(p.A,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:"2rem",flexWrap:"wrap",gap:"8px",style:{marginRight:40},children:[(0,o.jsx)(c.A,{variant:"h5",style:{fontWeight:"bold",marginBottom:20,padding:"20px 0px 0px 20px"},children:i.validationStep.title}),(0,o.jsxs)(p.A,{display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",children:[(0,o.jsx)(ex.A,{variant:"outlined",size:"small",onClick:()=>{g.size&&(b(h.filter(e=>!g.has(e.__index))),f(new Set))},children:i.validationStep.discardButtonTitle}),(0,o.jsx)(ne.A,{children:(0,o.jsx)(ev.A,{control:(0,o.jsx)(u.A,{checked:x,onChange:()=>k(!x)}),label:i.validationStep.filterSwitchTitle})})]})]}),null!=T&&T.length>0&&(0,o.jsxs)(p.A,{sx:{px:3,pb:3},children:[(0,o.jsx)(c.A,{variant:"h6",color:"error",style:{fontWeight:"600"},children:"Errors:"}),(0,o.jsx)(ej.A,{children:T.map(e=>(0,o.jsx)(eI.Ay,{children:(0,o.jsx)(c.A,{variant:"body1",color:"error",style:{},children:null==e?void 0:e.message})}))})]}),0===j.length?(0,o.jsx)(p.A,{display:"flex",justifyContent:"center",gridColumn:"1/-1",mt:"32px",children:x?i.validationStep.noRowsMessageWhenFiltered:i.validationStep.noRowsMessage}):(0,o.jsx)(p.A,{children:(0,o.jsx)(tK,{rowKeyGetter:I,rows:j,onRowsChange:C,columns:A,selectedRows:g,onSelectedRowsChange:f})})]}),(0,o.jsx)(t5,{onContinue:()=>{h.find(e=>{if(null==e?void 0:e.__errors){var t;return!!(null==(t=Object.values(e.__errors))?void 0:t.filter(e=>"error"===e.level).length)}return!1})?S(!0):w()},title:i.validationStep.nextButtonTitle,onBack:n})]})};var nc=n(29040);let nd=e=>{let t,n,l,a,r,s,u,m=(0,i.c)(17),{column:h,entries:y,onIgnore:g,onRevertIgnore:f}=e,{header:x,index:k,type:v}=h;return m[0]===Symbol.for("react.memo_cache_sentinel")?(t={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4,paddingLeft:0},m[0]=t):t=m[0],m[1]===Symbol.for("react.memo_cache_sentinel")?(n={fontWeight:"bold"},m[1]=n):n=m[1],m[2]!==x?(l=(0,o.jsx)(c.A,{variant:"subtitle2",style:n,children:x}),m[2]=x,m[3]=l):l=m[3],m[4]!==k||m[5]!==g||m[6]!==f||m[7]!==v?(a=v===nL.ignored?(0,o.jsx)(d.A,{size:"small","aria-label":"Ignore column",onClick:()=>f(k),children:(0,o.jsx)(ez.o,{size:20})}):(0,o.jsx)(d.A,{size:"small","aria-label":"Ignore column",onClick:()=>g(k),children:(0,o.jsx)(nc.X,{size:20})}),m[4]=k,m[5]=g,m[6]=f,m[7]=v,m[8]=a):a=m[8],m[9]!==l||m[10]!==a?(r=(0,o.jsxs)(p.A,{style:t,children:[l,a]}),m[9]=l,m[10]=a,m[11]=r):r=m[11],m[12]!==y?(s=y.map(nu),m[12]=y,m[13]=s):s=m[13],m[14]!==r||m[15]!==s?(u=(0,o.jsxs)(p.A,{children:[r,s]}),m[14]=r,m[15]=s,m[16]=u):u=m[16],u};function nu(e,t){return(0,o.jsx)(c.A,{variant:"body2",children:e},(e||"")+t)}var np=n(22292),nm=n(27860),nh=n(51135),ny=n(87891),ng=n(98817);let nf=(0,nh.P)(p.A),nx={transition:{duration:.1},exit:{scale:.5,opacity:0},initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},style:{display:"flex",alignItems:"center"}},nk=e=>{let t,n,l=(0,i.c)(3);return l[0]===Symbol.for("react.memo_cache_sentinel")?(t={display:"flex",justifyContent:"center",alignItems:"center",marginLeft:5},l[0]=t):t=l[0],l[1]!==e.isChecked?(n=(0,o.jsx)("div",{style:t,children:e.isChecked?(0,o.jsx)(nf,{...nx,children:(0,o.jsx)(ny.A,{color:"success"})}):(0,o.jsx)(nf,{...nx,children:(0,o.jsx)(ng.A,{color:"error"})})}),l[1]=e.isChecked,l[2]=n):n=l[2],n};var nv=n(91276);let nS=e=>{let t,n,l,a,s,c,d,u,m=(0,i.c)(17),{onChange:h,value:y,options:g,name:f}=e;m[0]!==h?(t=e=>{h({value:e.target.value})},m[0]=h,m[1]=t):t=m[1];let x=t,[,k]=(0,r.useState)(!1);m[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{k(!0)},l=[],m[2]=n,m[3]=l):(n=m[2],l=m[3]),(0,r.useEffect)(n,l),m[4]===Symbol.for("react.memo_cache_sentinel")?(a={minWidth:120,paddingLeft:0},m[4]=a):a=m[4],m[5]!==f?(s=(0,o.jsx)(nv.A,{children:f}),m[5]=f,m[6]=s):s=m[6];let v=(null==y?void 0:y.value)||"";return m[7]!==g?(c=g.map(nb),m[7]=g,m[8]=c):c=m[8],m[9]!==x||m[10]!==f||m[11]!==v||m[12]!==c?(d=(0,o.jsx)(no.A,{value:v,label:f,onChange:x,children:c}
1),m[9]=x,m[10]=f,m[11]=v,m[12]=c,m[13]=d):d=m[13],m[14]!==s||m[15]!==d?(u=(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(p.A,{sx:a,children:(0,o.jsxs)(t6.A,{fullWidth:!0,size:"small",children:[s,d]})})}),m[14]=s,m[15]=d,m[16]=u):u=m[16],u};function nb(e){return(0,o.jsx)(ei.A,{value:e.value,children:e.label})}let nC=e=>{let t,n,l,a,r,s=(0,i.c)(18),{option:c,column:d,onSubChange:u}=e,{translations:m,fields:h}=tV();if(s[0]!==d.value||s[1]!==h||s[2]!==c.value){let e;t=((e,t)=>{let n=e.find(e=>{let{key:n}=e;return t===n});return"select"===n.fieldType.type?n.fieldType.options:[]})(h,d.value),s[5]!==c.value?(e=e=>e.value==c.value,s[5]=c.value,s[6]=e):e=s[6],n=t.find(e),s[0]=d.value,s[1]=h,s[2]=c.value,s[3]=t,s[4]=n}else t=s[3],n=s[4];let y=n;return s[7]===Symbol.for("react.memo_cache_sentinel")?(l={paddingLeft:0,paddingBottom:10},s[7]=l):l=s[7],s[8]!==d.index||s[9]!==u||s[10]!==c.entry?(a=e=>u(null==e?void 0:e.value,d.index,c.entry),s[8]=d.index,s[9]=u,s[10]=c.entry,s[11]=a):a=s[11],s[12]!==c.entry||s[13]!==t||s[14]!==a||s[15]!==m.matchColumnsStep.subSelectPlaceholder||s[16]!==y?(r=(0,o.jsx)(p.A,{style:l,children:(0,o.jsx)(nS,{value:y,placeholder:m.matchColumnsStep.subSelectPlaceholder,onChange:a,options:t,name:c.entry})}),s[12]=c.entry,s[13]=t,s[14]=a,s[15]=m.matchColumnsStep.subSelectPlaceholder,s[16]=y,s[17]=r):r=s[17],r};var nA=n(67871),nj=n(63839);let nI=e=>{let t,n,l,a,r=(0,i.c)(18),{column:s,onChange:d,onSubChange:u}=e,{translations:m,fields:h}=tV(),y=s.type===nL.ignored,g=s.type===nL.matched||s.type===nL.matchedCheckbox||s.type===nL.matchedSelectOptions,f="matchedOptions"in s;if(r[0]!==s||r[1]!==h){let e;t=h.map(nw),r[4]!==s?(e=e=>{let{value:t}=e;return"value"in s&&s.value===t},r[4]=s,r[5]=e):e=r[5],n=t.find(e),r[0]=s,r[1]=h,r[2]=t,r[3]=n}else t=r[2],n=r[3];let x=n;return r[6]===Symbol.for("react.memo_cache_sentinel")?(l={display:"flex",flexDirection:"column",justifyContent:"center",height:"100%"},r[6]=l):l=r[6],r[7]!==s||r[8]!==h||r[9]!==g||r[10]!==y||r[11]!==f||r[12]!==d||r[13]!==u||r[14]!==t||r[15]!==x||r[16]!==m?(a=(0,o.jsx)(p.A,{style:l,children:y?(0,o.jsx)(c.A,{children:m.matchColumnsStep.ignoredColumnText}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(p.A,{style:{display:"flex",alignItems:"center",paddingLeft:0},children:[(0,o.jsx)(p.A,{flex:1,children:(0,o.jsx)(nS,{placeholder:m.matchColumnsStep.selectPlaceholder,value:x,onChange:e=>d(null==e?void 0:e.value,s.index),options:t,name:s.header})}),(0,o.jsx)(nk,{isChecked:g})]}),f&&(0,o.jsx)(p.A,{width:"100%",children:(0,o.jsxs)(np.A,{style:{boxShadow:"0 0 2px 0 rgba(145, 158, 171, 0.24), 0 16px 32px -4px rgba(145, 158, 171, 0.24)",marginTop:5},children:[(0,o.jsx)(nA.A,{expandIcon:(0,o.jsx)(nj.A,{}),children:(0,o.jsx)(p.A,{textAlign:"left",children:(0,o.jsx)(c.A,{children:((e,t,n)=>{let o=e.find(e=>"value"in t&&e.key===t.value).label;return"".concat(n.matchColumnsStep.matchDropdownTitle," ").concat(o," (").concat("matchedOptions"in t&&t.matchedOptions.length," ").concat(n.matchColumnsStep.unmatched,")")})(h,s,m)})})}),(0,o.jsx)(nm.A,{children:s.matchedOptions.map(e=>(0,o.jsx)(nC,{option:e,column:s,onSubChange:u},e.entry))})]})})]})}),r[7]=s,r[8]=h,r[9]=g,r[10]=y,r[11]=f,r[12]=d,r[13]=u,r[14]=t,r[15]=x,r[16]=m,r[17]=a):a=r[17],a};function nw(e){let{label:t,key:n}=e;return{value:n,label:t}}let nT=e=>{let t,n,l,a=(0,i.c)(9),{gridColumn:r,gridRow:s}=e;return a[0]!==r||a[1]!==s?(t=(0,o.jsx)(p.A,{style:{gridColumn:r,gridRow:s,borderRadius:"1.2rem",border:"1px solid #e2e8f0",borderColor:"border",pointerEvents:"none"}}),a[0]=r,a[1]=s,a[2]=t):t=a[2],a[3]!==r||a[4]!==s?(n=(0,o.jsx)(p.A,{style:{gridColumn:r,gridRow:s,pointerEvents:"none",background:"linear-gradient(to bottom, rgba(0,0,0,0), #ffffff)"}}),a[3]=r,a[4]=s,a[5]=n):n=a[5],a[6]!==t||a[7]!==n?(l=(0,o.jsxs)(o.Fragment,{children:[t,n]}),a[6]=t,a[7]=n,a[8]=l):l=a[8],l},n_=e=>{let t,n,l,a,r,s,d,u,m,h,y,g,f,x,k,v,S,b,C,A=(0,i.c)(54),{columns:j,userColumn:I,templateColumn:w,onContinue:T,isLoading:_,onBack:P}=e,{translations:F}=tV();A[0]===Symbol.for("react.memo_cache_sentinel")?(t={fontWeight:"bold",marginBottom:20},A[0]=t):t=A[0],A[1]!==F.matchColumnsStep.title?(n=(0,o.jsx)(c.A,{variant:"h5",style:t,children:F.matchColumnsStep.title}),A[1]=F.matchColumnsStep.title,A[2]=n):n=A[2];let O="0.75rem repeat(".concat(j.length,", minmax(18rem, auto)) 0.75rem");A[3]!==O?(l={display:"grid",flex:1,gridTemplateRows:"auto auto auto 1fr",gridTemplateColumns:O},A[3]=O,A[4]=l):l=A[4];let E="1/".concat(j.length+3);if(A[5]!==E?(a={gridColumn:E},A[5]=E,A[6]=a):a=A[6],A[7]===Symbol.for("react.memo_cache_sentinel")?(r={marginBottom:10},A[7]=r):r=A[7],A[8]!==F.matchColumnsStep.userTableTitle?(s=(0,o.jsx)(c.A,{variant:"h6",style:r,children:F.matchColumnsStep.userTableTitle}),A[8]=F.matchColumnsStep.userTableTitle,A[9]=s):s=A[9],A[10]!==a||A[11]!==s?(d=(0,o.jsx)(p.A,{style:a,children:s}
1),A[10]=a,A[11]=s,A[12]=d):d=A[12],A[13]!==j||A[14]!==I){let e;A[16]!==I?(e=(e,t)=>(0,o.jsx)(p.A,{style:{gridRow:"2/3",gridColumn:"".concat(t+2,"/").concat(t+3),paddingRight:24,paddingTop:8},children:I(e)},e.header+t),A[16]=I,A[17]=e):e=A[17],u=j.map(e),A[13]=j,A[14]=I,A[15]=u}else u=A[15];let D="1/".concat(j.length+3);A[18]!==D?(m=(0,o.jsx)(nT,{gridColumn:D,gridRow:"2/3"}),A[18]=D,A[19]=m):m=A[19];let N="1/".concat(j.length+3);A[20]!==N?(h={gridColumn:N,marginTop:7},A[20]=N,A[21]=h):h=A[21],A[22]===Symbol.for("react.memo_cache_sentinel")?(y={marginBottom:10},A[22]=y):y=A[22],A[23]!==F.matchColumnsStep.templateTitle?(g=(0,o.jsx)(c.A,{variant:"h6",style:y,children:F.matchColumnsStep.templateTitle}),A[23]=F.matchColumnsStep.templateTitle,A[24]=g):g=A[24],A[25]!==h||A[26]!==g?(f=(0,o.jsx)(p.A,{style:h,children:g}),A[25]=h,A[26]=g,A[27]=f):f=A[27];let B="1/".concat(j.length+3);if(A[28]!==B?(x=(0,o.jsx)(nT,{gridColumn:B,gridRow:"4/5"}),A[28]=B,A[29]=x):x=A[29],A[30]!==j||A[31]!==w){let e;A[33]!==w?(e=(e,t)=>(0,o.jsx)(p.A,{style:{gridRow:"4/5",gridColumn:"".concat(t+2,"/").concat(t+3),padding:"1.125rem",paddingLeft:0,paddingRight:24},children:w(e)},e.header+t),A[33]=w,A[34]=e):e=A[34],k=j.map(e),A[30]=j,A[31]=w,A[32]=k}else k=A[32];return A[35]!==u||A[36]!==m||A[37]!==f||A[38]!==x||A[39]!==k||A[40]!==l||A[41]!==d?(v=(0,o.jsxs)(p.A,{style:l,children:[d,u,m,f,x,k]}),A[35]=u,A[36]=m,A[37]=f,A[38]=x,A[39]=k,A[40]=l,A[41]=d,A[42]=v):v=A[42],A[43]!==n||A[44]!==v?(S=(0,o.jsxs)(tm.A,{children:[n,v]}),A[43]=n,A[44]=v,A[45]=S):S=A[45],A[46]!==_||A[47]!==P||A[48]!==T||A[49]!==F.matchColumnsStep.nextButtonTitle?(b=(0,o.jsx)(t5,{onBack:P,isLoading:_,onContinue:T,title:F.matchColumnsStep.nextButtonTitle}),A[46]=_,A[47]=P,A[48]=T,A[49]=F.matchColumnsStep.nextButtonTitle,A[50]=b):b=A[50],A[51]!==S||A[52]!==b?(C=(0,o.jsxs)(o.Fragment,{children:[S,b]}),A[51]=S,A[52]=b,A[53]=C):C=A[53],C};var nP=n(831),nF=n.n(nP);let nO=(e,t,n)=>{switch(null==t?void 0:t.fieldType.type){case"select":{let o,i,l=((e,t)=>{if("select"!==t.fieldType.type||!t.fieldType.options)return e;let n=t.fieldType.options;return e.map(e=>{if(!e.entry)return e;let t=e.entry.trim().toLowerCase().trim(),o=n.find(e=>{var n;let o=e.value.trim(),i=(null!=(n=e.label)?n:"").trim(),l=o.toLowerCase(),a=i.toLowerCase();if(t===l||t===a)return!0;let r=t.replace(/\s+/g,""),s=l.replace(/\s+/g,""),c=a.replace(/\s+/g,"");return r===s||r===c});if(o){let t=o.value;return{entry:e.entry,value:t}}return{entry:e.entry}})})((o=n||[],i=e.index,nF()(o.map(e=>({entry:e[i]})),"entry").filter(e=>{let{entry:t}=e;return!!t})),t),a=l.every(e=>!!e.value);return{...e,type:a?nL.matchedSelectOptions:nL.matchedSelect,value:t.key,matchedOptions:l}}case"checkbox":return{index:e.index,type:nL.matchedCheckbox,value:t.key,header:e.header};case"input":return{index:e.index,type:nL.matched,value:t.key,header:e.header};default:return{index:e.index,header:e.header,type:nL.empty}}},nE={yes:!0,no:!1,true:!0,false:!1},nD=e=>!!(e&&e.toLowerCase()in nE)&&nE[e.toLowerCase()],nN=(e,t,n)=>t.map(t=>e.reduce((e,o,i)=>{let l=t[i];switch(o.type){case nL.matchedCheckbox:{let t=n.find(e=>e.key===o.value);if("booleanMatches"in t.fieldType&&Object.keys(t.fieldType).length){var a;let n=Object.keys(t.fieldType.booleanMatches||[]).find(e=>e.toLowerCase()===(null==l?void 0:l.toLowerCase())),i=null==(a=t.fieldType.booleanMatches)?void 0:a[n];e[o.value]=n?i:nD(l)}else e[o.value]=nD(l);return e}case nL.matched:return e[o.value]=""===l?void 0:l,e;case nL.matchedSelect:case nL.matchedSelectOptions:{let t=o.matchedOptions.find(e=>{let{entry:t,value:n}=e;return t===l});return e[o.value]=(null==t?void 0:t.value)||void 0,e}case nL.empty:case nL.ignored:default:return e}},{}));var nB=n(21009),nR=n.n(nB);let nM=e=>{let t,n,l,a,s,d,u,m,h,y,g,f,x=(0,i.c)(33),{isOpen:k,onClose:v,onConfirm:S,fields:b}=e,{allowInvalidSubmit:C,translations:A}=tV(),j=(0,r.useRef)(null);x[0]!==A.alerts.unmatchedRequiredFields.headerTitle?(t=(0,o.jsx)(c.A,{fontSize:"lg",fontWeight:"bold",children:A.alerts.unmatchedRequiredFields.headerTitle}),x[0]=A.alerts.unmatchedRequiredFields.headerTitle,x[1]=t):t=x[1];let I=A.alerts.unmatchedRequiredFields.bodyText;return x[2]!==A.alerts.unmatchedRequiredFields.listTitle?(n=(0,o.jsx)(c.A,{display:"inline",children:A.alerts.unmatchedRequiredFields.listTitle}),x[2]=A.alerts.unmatchedRequiredFields.listTitle,x[3]=n):n=x[3],x[4]!==b?(l=b.join(", "),x[4]=b,x[5]=l):l=x[5],x[6]!==l?(a=(0,o.jsxs)(c.A,{display:"inline",fontWeight:"bold",children:[" ",l]}),x[6]=l,x[7]=a):a=x[7],x[8]!==n||x[9]!==a?(s=(0,o.jsxs)(p.A,{pt:3,children:[n,a]}),x[8]=n,x[9]=a,x[10]=s):s=x[10],x[11]!==s||x[12]!==A.alerts.unmatchedRequiredFields.bodyText?(d=(0,o.jsxs)(p.A,{children:[I,s]}),x[11]=s,x[12]=A.alerts.unmatchedRequiredFields.bodyText,x[13]=d):d=x[13],x[14]===Symbol.for("react.memo_cache_sentinel")?(u={marginTop:10,display:"flex",justifyContent:"space-between"},x[14]=u):u=x[14],x[15]!==v||x[16]!==A.alerts.unmatchedRequiredFields.cancelButtonTitle?(m=(0,o.jsx)(ex.A,{ref:j,onClick:v,variant:"contained",children:A.alerts.unmatchedRequiredFields.cancelButtonTitle}),x[15]=v,x[16]=A.alerts.unmatchedRequiredFields.cancelButtonTitle,x[17]=m):m=x[17],x[18]!==C||x[19]!==S||x[20]!==A.alerts.unmatchedRequiredFields.continueButtonTitle?(h=C&&(0,o.jsx)(ex.A,{onClick:S,variant:"contained",children:A.alerts.unmatchedRequiredFields.continueButtonTitle}),x[18]=C,x[19]=S,x[20]=A.alerts.unmatchedRequiredFields.continueButtonTitle,x[21]=h):h=x[21],x[22]!==h||x[23]!==m?(y=(0,o.jsxs)(p.A,{style:u,children:[m,h]}),x[22]=h,x[23]=m,x[24]=y):y=x[24],x[25]!==t||x[26]!==y||x[27]!==d?(g=(0,o.jsxs)(tm.A,{children:[t,d,y]}),x[25]=t,x[26]=y,x[27]=d,x[28]=g):g=x[28],x[29]!==k||x[30]!==v||x[31]!==g?(f=(0,o.jsx)(na.A,{fullWidth:!0,maxWidth:"xs",open:k,onClose:v,children:g}),x[29]=k,x[30]=v,x[31]=g,x[32]=f):f=x[32],f},nL=function(e){return e[e.empty=0]="empty",e[e.ignored=1]="ignored",e[e.matched=2]="matched",e[e.matchedCheckbox=3]="matchedCheckbox",e[e.matchedSelect=4]="matchedSelect",e[e.matchedSelectOptions=5]="matchedSelectOptions",e}({}),nV=e=>{let{data:t,headerValues:n,onContinue:i,onBack:l}=e,a=t.slice(0,2),{fields:s,autoMapHeaders:c,autoMapDistance:d,translations:u}=tV(),[p,m]=(0,r.useState)(!1),[h,y]=(0,r.useState)([...n].map((e,t)=>({type:nL.empty,index:t,header:null!=e?e:""}))),[g,f]=(0,r.useState)(!1),{enqueueSnackbar:x,closeSnackbar:k}=(0,tR.dh)(),v=(0,r.useCallback)((e,n)=>{let o=s.find(t=>t.key===e),i=h.findIndex(e=>"value"in e&&e.value===o.key);console.log(i),y(h.map((e,l)=>
1(n===l&&nO(e,o,t),n===l)?nO(e,o,t):l===i?(x(u.matchColumnsStep.duplicateColumnWarningTitle,{variant:"warning"}),nO(e)):e))},[h,t,s,u.matchColumnsStep.duplicateColumnWarningDescription,u.matchColumnsStep.duplicateColumnWarningTitle]),S=(0,r.useCallback)(e=>{y(h.map((t,n)=>e===n?(e=>{let{header:t,index:n}=e;return{header:t,index:n,type:nL.ignored}})(t):t))},[h,y]),b=(0,r.useCallback)(e=>{y(h.map((t,n)=>e===n?nO(t):t))},[h,y]),C=(0,r.useCallback)((e,t,n)=>{y(h.map((o,i)=>t===i&&"matchedOptions"in o?((e,t,n)=>{let o=e.matchedOptions.map(e=>e.entry===t?{...e,value:n}:e);return o.every(e=>{let{value:t}=e;return!!t})?{...e,matchedOptions:o,type:nL.matchedSelectOptions}:{...e,matchedOptions:o,type:nL.matchedSelect}})(o,n,e):o))},[h,y]),A=(0,r.useMemo)(()=>s.filter(e=>{var t;return null==(t=e.validations)?void 0:t.some(e=>"required"===e.rule)}).filter(e=>-1===h.findIndex(t=>"value"in t&&t.value===e.key)).map(e=>e.label)||[],[s,h]),j=(0,r.useCallback)(async()=>{A.length>0?f(!0):(m(!0),await i(nN(h,t,s),t,h),m(!1))},[A.length,i,h,t,s]),I=(0,r.useCallback)(async()=>{f(!1),m(!0),await i(nN(h,t,s),t,h),m(!1)},[i,h,t,s]);return(0,r.useEffect)(()=>{c&&y(((e,t,n,o)=>e.reduce((e,i)=>{let l=((e,t,n)=>{let o=t.reduce((t,n)=>{var o;let i=Math.min(nR()(n.key,e),...(null==(o=n.alternateMatches)?void 0:o.map(t=>nR()(t,e)))||[]);return i<t.distance||void 0===t.distance?{value:n.key,distance:i}:t},{});return o.distance<=n?o.value:void 0})(i.header,t,o);if(!l)return[...e,i];{let o=t.find(e=>e.key===l),a=e.findIndex(e=>"value"in e&&e.value===o.key),r=e[a];return r&&"value"in r?nR()(r.value,r.header)<nR()(l,i.header)?[...e.slice(0,a),nO(e[a],o,n),...e.slice(a+1),nO(i)]:[...e.slice(0,a),nO(e[a]),...e.slice(a+1),nO(i,o,n)]:[...e,nO(i,o,n)]}},[]))(h,s,t,d))},[]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(nM,{isOpen:g,onClose:()=>f(!1),fields:A,onConfirm:I}),(0,o.jsx)(n_,{onBack:l,columns:h,onContinue:j,isLoading:p,userColumn:e=>(0,o.jsx)(nd,{column:e,onIgnore:S,onRevertIgnore:b,entries:a.map(t=>t[e.index])}),templateColumn:e=>(0,o.jsx)(nI,{column:e,onChange:v,onSubChange:C})})]})},nW=(e,t)=>{var n;let[o,i]=(null==(n=e["!ref"])?void 0:n.split(":").map(e=>parseInt(e.replace(/\D/g,""),10)))||[];return i-o>t},nz=function(e){return e.upload="upload",e.selectSheet="selectSheet",e.selectHeader="selectHeader",e.matchColumns="matchColumns",e.validateData="validateData",e}({}),nK=e=>{let{nextStep:t,prevStep:n}=e,{initialStepState:i}=tV(),[l,a]=(0,r.useState)(i||{type:nz.upload}),{maxRecords:s,translations:c,uploadStepHook:d,selectHeaderStepHook:u,matchColumnsStepHook:m}=tV(),{enqueueSnackbar:h,closeSnackbar:y}=(0,tR.dh)(),g=(0,r.useCallback)(e=>{h("".concat(c.alerts.toast.error),{variant:"error"})},[c]);switch(l.type){case nz.upload:return(0,o.jsx)(tY,{onBack:()=>{a({...l,type:nz.upload}),n()},onContinue:async e=>{if(1===e.SheetNames.length){if(s&&nW(e.Sheets[e.SheetNames[0]],s)){g(c.uploadStep.maxRecordsExceeded(s.toString())),console.error(c.uploadStep.maxRecordsExceeded(s.toString()));return}try{let n=await d(t9(e));a({type:nz.selectHeader,data:n}),t()}catch(e){console.error(e),g(e.message)}}else a({type:nz.selectSheet,workbook:e})}});case nz.selectSheet:return(0,o.jsx)(t8,{sheetNames:l.workbook.SheetNames,onBack:()=>{a({...l,type:nz.upload}),n()},onContinue:async e=>{if(s&&nW(l.workbook.Sheets[e],s)){g(c.uploadStep.maxRecordsExceeded(s.toString())),console.error(c.uploadStep.maxRecordsExceeded(s.toString()));return}try{let n=await d(t9(l.workbook,e));a({type:nz.selectHeader,data:n}),t()}catch(e){g(e.message),console.error(e)}}});case nz.selectHeader:return(0,o.jsx)(t3,{onBack:()=>{a({...l,type:nz.upload}),n()},data:l.data,onContinue:async function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];try{let{data:e,headerValues:o}=await u(...n);a({type:nz.matchColumns,data:e,headerValues:o}),t()}catch(e){g(e.message),console.error(e)}}});case nz.matchColumns:return(0,o.jsx)(nV,{onBack:()=>{a({...l,type:nz.upload}),n()},data:l.data,headerValues:l.headerValues,onContinue:async(e,n,o)=>{try{let i=await m(e,n,o);a({type:nz.validateData,data:i}),t()}catch(e){g(e.message),console.error(e)}}});case nz.validateData:return(0,o.jsx)(ns,{initialData:l.data,onBack:()=>{a({...l,type:nz.upload}),n()}});default:return(0,o.jsx)(p.A,{sx:{width:"100%"},children:(0,o.jsx)(ew.A,{variant:"indeterminate"})})}};var nU=n(97481),nq=n.n(nU),nH=n(91284),nG=n(78014),nY=n(8395);let nJ=["uploadStep","selectHeaderStep","matchColumnsStep","validationStep"],nX=()=>{let e,t,n,l,a,s,d,u=(0,i.c)(14),{translations:m}=tV(),[h,y]=(0,r.useState)(0);return u[0]===Symbol.for("react.memo_cache_sentinel")?(e={padding:"20px 20px",background:"rgb(237, 242, 247)",paddingRight:60},u[0]=e):e=u[0],u[1]!==m?(t=nJ.map(e=>(0,o.jsx)(nH.A,{children:(0,o.jsx)(nG.A,{children:(0,o.jsx)(c.A,{variant:"subtitle1",style:{fontWeight:"bold"},children:m[e].title})})},e)),u[1]=m,u[2]=t):t=u[2],u[3]!==h||u[4]!==t?(n=(0,o.jsx)(p.A,{style:e,children:(0,o.jsx)(nY.A,{activeStep:h,children:t})}),u[3]=h,u[4]=t,u[5]=n):n=u[5],u[6]!==h?(l=()=>y(h+1),u[6]=h,u[7]=l):l=u[7],u[8]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{y(0)},u[8]=a):a=u[8],u[9]!==l?(s=(0,o.jsx)(nK,{nextStep:l,prevStep:a}),u[9]=l,u[10]=s):s=u[10],u[11]!==n||u[12]!==s?(d=(0,o.jsxs)(o.Fragment,{children:[n,s]}),u[11]=n,u[12]=s,u[13]=d):d=u[13],d},nQ=e=>{let t,n,l,a,s,d,u,m,h=(0,i.c)(22),{isOpen:y,onClose:g,onConfirm:f}=e,{translations:x}=tV(),k=(0,r.useRef)(null);return h[0]!==x.alerts.confirmClose.headerTitle?(t=(0,o.jsx)(c.A,{fontSize:"lg",fontWeight:"bold",children:x.alerts.confirmClose.headerTitle}),h[0]=x.alerts.confirmClose.headerTitle,h[1]=t):t=h[1],h[2]!==x.alerts.confirmClose.bodyText?(n=(0,o.jsx)(p.A,{children:x.alerts.confirmClose.bodyText}),h[2]=x.alerts.confirmClose.bodyText,h[3]=n):n=h[3],h[4]===Symbol.for("react.memo_cache_sentinel")?(l={display:"flex",justifyContent:"space-between",marginTop:10},h[4]=l):l=h[4],h[5]!==g||h[6]!==x.alerts.confirmClose.cancelButtonTitle?(a=(0,o.jsx)(ex.A,{ref:k,onClick:g,children:x.alerts.confirmClose.cancelButtonTitle}),h[5]=g,h[6]=x.alerts.confirmClose.cancelButtonTitle,h[7]=a):a=h[7],h[8]!==f||h[9]!==x.alerts.confirmClose.exitButtonTitle?(s=(0,o.jsx)(ex.A,{color:"error",onClick:f,variant:"contained",children:x.alerts.confirmClose.exitButtonTitle}),h[8]=f,h[9]=x.alerts.confirmClose.exitButtonTitle,h[10]=s):s=h[10],h[11]!==a||h[12]!==s?(d=(0,o.jsxs)(p.A,{style:l,children:[a,s]}),h[11]=a,h[12]=s,h[13]=d):d=h[13],h[14]!==t||h[15]!==n||h[16]!==d?(u=(0,o.jsxs)(tm.A,{children:[t,n,d]}),h[14]=t,h[15]=n,h[16]=d,h[17]=u):u=h[17],h[18]!==y||h[19]!==g||h[20]!==u?(m=(0,o.jsx)(na.A,{open:y,onClose:g,id:"rsi",children:u}),h[18]=y,h[19]=g,h[20]=u,h[21]=m):m=h[21],m},nZ=e=>{let t,n,l,a,s,c=(0,i.c)(9),{onClose:u}=e,[p,m]=(0,r.useState)(!1);return c[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>m(!1),c[0]=t):t=c[0],c[1]!==u?(n=()=>{m(!1),u()},c[1]=u,c[2]=n):n=c[2],c[3]!==p||c[4]!==n?(l=(0,o.jsx)(nQ,{isOpen:p,onClose:t,onConfirm:n}),c[3]=p,c[4]=n,c[5]=l):l=c[5],c[6]===Symbol.for("react.memo_cache_sentinel")?(a=(0,o.jsx)(d.A,{style:{color:"primary",position:"absolute",transform:"translate(50%, -50%)",right:"30px",top:"30px"},onClick:()=>m(!0),children:(0,o.jsx)(nc.X,{size:20})}),c[6]=a):a=c[6],c[7]!==l?(s=(0,o.jsxs)(o.Fragment,{children:[l,a]}),c[7]=l,c[8]=s):s=c[8],s},n$=e=>{let t,n,l,a,r,s,c,d,u=(0,i.c)(16),{children:p,isOpen:m,onClose:h}=e,{rtl:y}=tV();u[0]===Symbol.for("react.memo_cache_sentinel")?(t={height:"100%"},n={style:{height:"100%"}},u[0]=t,u[1]=n):(t=u[0],n=u[1]);let g=y?"rtl":"ltr";return u[2]===Symbol.for("react.memo_cache_sentinel")?(l={height:"100%"},u[2]=l):l=u[2],u[3]!==h?(a=(0,o.jsx)(nZ,{onClose:h}),u[3]=h,u[4]=a):a=u[4],u[5]===Symbol.for("react.memo_cache_sentinel")?(r={padding:0,height:"100%",display:"flex",flexDirection:"column"},u[5]=r):r=u[5],u[6]!==p?(s=(0,o.jsx)(tm.A,{style:r,children:p}),u[6]=p,u[7]=s):s=u[7],u[8]!==g||u[9]!==a||u[10]!==s?(c=(0,o.jsxs)("div",{dir:g,style:l,children:[a,s]}),u[8]=g,u[9]=a,u[10]=s,u[11]=c):c=u[11],u[12]!==m||u[13]!==h||u[14]!==c?(d=(0,o.jsx)(na.A,{open:m,onClose:h,id:"rsi",fullWidth:!0,maxWidth:"xl",style:t,PaperProps:n,children:c}),u[12]=m,u[13]=h,u[14]=c,u[15]=d):d=u[15],d},n0={uploadStep:{title:"Upload file",manifestTitle:"Data that we expect:",manifestDescription:"(You will have a chance to rename or remove columns in next steps)",maxRecordsExceeded:e=>
1"Too many records. Up to ".concat(e," allowed"),dropzone:{title:"Upload .xlsx, .xls or .csv file",errorToastDescription:"upload rejected",activeDropzoneTitle:"Drop file here...",buttonTitle:"Select file",loadingTitle:"Processing..."},selectSheet:{title:"Select the sheet to use",nextButtonTitle:"Next"}},selectHeaderStep:{title:"Select header row",nextButtonTitle:"Next"},matchColumnsStep:{title:"Match Columns",nextButtonTitle:"Next",userTableTitle:"Your table",templateTitle:"Will become",selectPlaceholder:"Select column...",ignoredColumnText:"Column ignored",subSelectPlaceholder:"Select...",matchDropdownTitle:"Match",unmatched:"Unmatched",duplicateColumnWarningTitle:"Another column unselected",duplicateColumnWarningDescription:"Columns cannot duplicate"},validationStep:{title:"Validate data",nextButtonTitle:"Confirm",noRowsMessage:"No data found",noRowsMessageWhenFiltered:"No data containing errors",discardButtonTitle:"Discard selected rows",filterSwitchTitle:"Show only rows with errors"},alerts:{confirmClose:{headerTitle:"Exit import flow",bodyText:"Are you sure? Your current information will not be saved.",cancelButtonTitle:"Cancel",exitButtonTitle:"Exit flow"},submitIncomplete:{headerTitle:"Errors detected",bodyText:"There are still some rows that contain errors. Rows with errors will be ignored when submitting.",bodyTextSubmitForbidden:"There are still some rows containing errors.",cancelButtonTitle:"Cancel",finishButtonTitle:"Submit"},unmatchedRequiredFields:{headerTitle:"Not all columns matched",bodyText:"There are required columns that are not matched or ignored. Do you want to continue?",listTitle:"Columns not matched:",cancelButtonTitle:"Cancel",continueButtonTitle:"Continue"},toast:{error:"Error"}}},n1={autoMapHeaders:!0,allowInvalidSubmit:!0,autoMapDistance:2,translations:n0,uploadStepHook:async e=>e,selectHeaderStepHook:async(e,t)=>({headerValues:e,data:t}),matchColumnsStepHook:async e=>e,dateFormat:"yyyy-mm-dd",parseRaw:!0,useBuiltInTheme:!1},n2=e=>{let t,n,l,a,r,s,c=(0,i.c)(14);c[0]!==e?(n=(t={...n1,...e}).translations!==n0?nq()(n0,t.translations):n0,c[0]=e,c[1]=t,c[2]=n):(t=c[1],n=c[2]);let d=n;return c[3]!==t||c[4]!==d?(l={...t,translations:d},c[3]=t,c[4]=d,c[5]=l):l=c[5],c[6]===Symbol.for("react.memo_cache_sentinel")?(a=(0,o.jsx)(nX,{}),c[6]=a):a=c[6],c[7]!==t.isOpen||c[8]!==t.onClose?(r=(0,o.jsx)(n$,{isOpen:t.isOpen,onClose:t.onClose,children:a}),c[7]=t.isOpen,c[8]=t.onClose,c[9]=r):r=c[9],c[10]!==t.useBuiltInTheme||c[11]!==l||c[12]!==r?(s=(0,o.jsx)(tL,{useBuiltInTheme:t.useBuiltInTheme,rsiValues:l,children:r}),c[10]=t.useBuiltInTheme,c[11]=l,c[12]=r,c[13]=s):s=c[13],s},n5=[{label:"Name",key:"StockItemName",alternateMatches:["Name","Item","item","name","ProductName","Short Description (40 Chars)","ModelName","Product Name","Stock Item Name"],fieldType:{type:"input"},example:"Continental Bike Chassis",validations:[{rule:"required",errorMessage:"Name is required",level:"error"}]},{label:"Variation",key:"VariationName",alternateMatches:["Variation","Variation Name","SageName"],fieldType:{type:"input"},example:"Small"},{label:"Pricing Unit Type",key:"PricingUnitType",alternateMatches:["Unit and Precision"],fieldType:{type:"select",options:[{label:"PerItem",value:"PerItem"},{label:"PerLitre",value:"PerLitre"},{label:"PerMetre",value:"PerMetre"},{label:"PerHour",value:"PerHour"},{label:"PerKilogram",value:"PerKilogram"},{label:"PerKilogram",value:"PerKilogram"},{label:"Variable",value:"Variable"}]},example:"PerItem"},{label:"Brand",key:"Brand",alternateMatches:["brand","BrandName"],fieldType:{type:"input"},example:"Shimano"},{label:"Vendor",key:"Vendor",alternateMatches:["Vendor","vendor"],fieldType:{type:"input"},example:"Madison"},{label:"SKU",key:"SKU",alternateMatches:["sku","CatalogueRef","Product Code","ModelCodeSingleVariant"],fieldType:{type:"input"},example:"123456",validations:[{rule:"required",errorMessage:"SKU is required",level:"error"}]},{label:"Manufacturer SKU",key:"ManufacturerSKU",alternateMatches:["Manufacturer SKU","manufacturer sku","manufacturer sku","manufacturer sku","manufacturer sku","MSKU","Manufact. SKU"],fieldType:{type:"input"},example:"123456"},{label:"Image",key:"Image",alternateMatches:["Image Name","Image","Image URL","img","Img","ImageUrl","Image 1","Image_URL"],fieldType:{type:"input"},example:"qkprstt"},{label:"Location",key:"Location",alternateMatches:["location","
1Location","loc","Loc"],fieldType:{type:"input"},example:"Brighton"},{label:"Barcode",key:"Barcode",alternateMatches:["barcode","Barcode","Bar Code","bar code","barCode","BarCode"],fieldType:{type:"input"},example:"0799439112766"},{label:"EAN",key:"EAN",alternateMatches:["ean","EAN","European Article Number","european article number","europeanarticlenumber"],fieldType:{type:"input"},example:"978â0521425575"},{label:"UPC",key:"UPC",alternateMatches:["UPC","upc","Universal Product Code","universal product code","universalproductcode"],fieldType:{type:"input"},example:"00123456789012"},{label:"Description",key:"Description",alternateMatches:["description","desc","ExtendedDescription"],fieldType:{type:"input"},example:"The bike chassis is made from aluminium and is very light."},{label:"Category",key:"Category",alternateMatches:["category","cat","Product Categories","CategoryNames"],fieldType:{type:"input"},example:"Wheels"},{label:"Weight (kg)",key:"Weight",alternateMatches:["Weight","weight","PackagedWeight","WeightInKG"],fieldType:{type:"input"},example:"20"},{label:"Price (\xa3)",key:"MRRP",alternateMatches:["RRP","MRRP","RetailPrice","Unit MSRP","PriceMSRP","True"],fieldType:{type:"input"},example:(0,V.TI)(55),validations:[{rule:"regex",errorMessage:"Price must be a valid number (e.g. \xa355.00, 55.00, 0.026)",value:"^\xa3?[\\d,]*(?:\\.\\d{0,4})?$"}]},{label:"In Stock?",key:"InStock",alternateMatches:["Stock Level"],fieldType:{type:"input"},example:"Y"},{label:"Current Stock",key:"RemainingStock",alternateMatches:["Remaining Stock","CurrentStock","current stock","currentstock","stock","Stock","Qty","Qty.","Quantity"],fieldType:{type:"input"},example:"100",validations:[{rule:"regex",errorMessage:"Current stock must be a number",value:"^$|^\\d*\\.?\\d+$"}]},{label:"Tracking Enabled",key:"TrackingEnabled",alternateMatches:["Tracking Enabled","Tracking","tracking","track","Track"],fieldType:{type:"checkbox"},example:"True"},{label:"Low Stock Alerts Enabled",key:"LowStockAlertsEnabled",alternateMatches:["Low Stock Alerts Enabled","low stock alerts","lowstockalerts","low stock","lowstock","low","Low"],fieldType:{type:"checkbox"},example:"True"},{label:"LowStockAlertsValue",key:"LowStockAlertsValue",alternateMatches:["Low Stock Alerts Value","low stock alerts value","lowstockalertsvalue","low stock value","lowstockvalue","low value","Low Value","lowvalue","LowValue"],fieldType:{type:"input"},example:"10"},{label:"Option Name 1",key:"OptionName1",alternateMatches:["Option Name 1","option name 1","optionname1","option name","optionname","Option1 Name","MatrixLabel1"],fieldType:{type:"input"},example:"Size"},{label:"Option Value 1",key:"OptionValue1",alternateMatches:["Option Value 1","option value 1","optionvalue1","option value","optionvalue","Option1 Value","MatrixOption1"],fieldType:{type:"input"},example:"Small"},{label:"Option Name 2",key:"OptionName2",alternateMatches:["Option Name 2","option name 2","optionname2","option name","optionname","Option2 Name","MatrixLabel2"],fieldType:{type:"input"},example:"Size"},{label:"Option Value 2",key:"OptionValue2",alternateMatches:["Option Value 2","option value 2","optionvalue2","option value","optionvalue","Option2 Value","MatrixOption2"],fieldType:{type:"input"},example:"Small"},{label:"Option Name 3",key:"OptionName3",alternateMatches:["Option Name 3","option name 3","optionname3","option name","optionname","Option3 Name","MatrixLabel3"],fieldType:{type:"input"},example:"Size"},{label:"Option Value 3",key:"OptionValue3",alternateMatches:["Option Value 3","option value 3","optionvalue3","option value","optionvalue","Option3 Value","MatrixOption3"],fieldType:{type:"input"},example:"Small"},{label:"Option Name 4",key:"OptionName4",alternateMatches:["Option Name 4","option name 4","optionname4","option name","optionname","Option4 Name"],fieldType:{type:"input"},example:"Size"},{label:"Option Value 4",key:"OptionValue4",alternateMatches:["Option Value 4","option value 4","optionvalue4","option value","optionvalue","Option4 Value"],fieldType:{type:"input"},example:"Small"},{label:"Option Name 5",key:"OptionName5",alternateMatches:["Option Name 5","option name 5","optionname5","option name","optionname","Option5 Name"],fieldType:{type:"input"},example:"Size"},{label:"Option Value 5",key:"OptionValue5",alternateMatches:["Option Value 5","option value 5","optionvalue5","option value","o
1ptionvalue","Option5 Value"],fieldType:{type:"input"},example:"Small"},{label:"Option Name 6",key:"OptionName6",alternateMatches:["Option Name 6","option name 6","optionname6","option name","optionname","Option6 Name"],fieldType:{type:"input"},example:"Size"},{label:"Option Value 6",key:"OptionValue6",alternateMatches:["Option Value 6","option value 6","optionvalue6","option value","optionvalue","Option6 Value"],fieldType:{type:"input"},example:"Small"}],n3=e=>{let t,n,l,a=(0,i.c)(12),{open:r,setOpen:s,selectedSupplier:c,setSelectedSupplier:d,refreshTable:u}=e,{stockSupplierId:p}=c,m=(0,_.jL)(),{mutateAsync:h}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["queueImportStock"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{data:t}=null!=e?e:{};return((e,t)=>{let n=new FormData;return void 0!==e.stockSupplierId&&n.append("stockSupplierId",e.stockSupplierId.toString()),void 0!==e.stockJson&&n.append("stockJson",e.stockJson),S.A.post("/v2/Stock/QueueImportStock",n,t)})(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})();a[0]!==s||a[1]!==d?(t=()=>{s(!1),d()},a[0]=s,a[1]=d,a[2]=t):t=a[2];let y=t;a[3]!==m||a[4]!==h||a[5]!==u||a[6]!==p?(n=e=>{m((0,Z.kw)("loading","Queuing import of ".concat(e.validData.length," stock itemsâ¦"),{options:{autoHideDuration:1e7}})).then(async()=>h({data:{stockSupplierId:p,stockJson:JSON.stringify(e.validData)}})).then(async()=>m((0,Z.kw)("success","Stock import queued successfully! It will be processed in the background.",{options:{autoHideDuration:5e3}}))).then(async()=>u()).catch(async()=>m((0,Z.kw)("error","Failed to queue stock import"))).then(async()=>m((0,Z.T_)("loading"))).catch(n4)},a[3]=m,a[4]=h,a[5]=u,a[6]=p,a[7]=n):n=a[7];let g=n;return a[8]!==y||a[9]!==g||a[10]!==r?(l=(0,o.jsx)(n2,{useBuiltInTheme:!0,isOpen:r,fields:n5,onClose:y,onSubmit:g}),a[8]=y,a[9]=g,a[10]=r,a[11]=l):l=a[11],l};function n4(e){console.error(e)}let n6=[{label:"CatRef",key:"CatRef",alternateMatches:["SKU"],fieldType:{type:"input"},example:"WT123"},{label:"In Stock?",key:"InStock",alternateMatches:["Stock Level"],fieldType:{type:"input"},example:"Y"}],n8=e=>{let t,n,l,a=(0,i.c)(11),{open:r,setOpen:s,selectedSupplier:c,setSelectedSupplier:d}=e,{stockSupplierId:u}=c,p=(0,_.jL)(),{mutateAsync:m}=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["importStockStatus"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{data:t}=null!=e?e:{};return((e,t)=>{let n=new FormData;return void 0!==e.stockSupplierId&&n.append("stockSupplierId",e.stockSupplierId.toString()),void 0!==e.stockJson&&n.append("stockJson",e.stockJson),S.A.post("/v2/Stock/ImportStockStatus",n,t)})(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})();a[0]!==s||a[1]!==d?(t=()=>{s(!1),d()},a[0]=s,a[1]=d,a[2]=t):t=a[2];let h=t;a[3]!==p||a[4]!==m||a[5]!==u?(n=e=>{p((0,Z.kw)("loading","Importing stock status for ".concat(e.validData.length," itemsâ¦"),{options:{autoHideDuration:1e7}})).then(async()=>m({data:{stockSupplierId:u,stockJson:JSON.stringify(e.validData)}})).then(async e=>p((0,Z.kw)("success","Imported stock status for ".concat(e.data," items!"),{options:{autoHideDuration:2e3}}))).catch(async()=>p((0,Z.kw)("error","Import failed"))).then(async()=>p((0,Z.T_)("loading"))).catch(n7)},a[3]=p,a[4]=m,a[5]=u,a[6]=n):n=a[6];let y=n;return a[7]!==h||a[8]!==y||a[9]!==r?(l=(0,o.jsx)(n2,{useBuiltInTheme:!0,isOpen:r,fields:n6,onClose:h,onSubmit:y}),a[7]=h,a[8]=y,a[9]=r,a[10]=l):l=a[10],l};function n7(e){console.error(e)}let n9=()=>{let e,t,n,l,a,s,f,x,C,A,j,I,w,T,_,P,F,O,E,D,N,B,R,M,L,V,W,z=(0,i.c)(53),[K,U]=(0,r.useState)(!1),[q,H]=(0,r.useState)(!1),[G,Y]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),[Q,Z]=(0,r.useState)(),[$,ee]=(0,r.useState)(""),[et,en]=(0,r.useState)(),{data:eo,isLoading:ei,refetch:el}=function(e,t){let n=(e=>{var t;let{query:n,axios:o}=null!=e?e:{};return{queryKey:null!=(t=null==n?void 0:n.queryKey)?t:["/v2/Stock/GetImportedCounts"],queryFn:e=>{let t,{signal:n}=e;return t={signal:n,...o},S.A.get("/v2/Stock/GetImportedCounts",t)},staleTime:0,...n}})(void 0),o=(0,v.I)(n,void 0);return o.queryKey=n.queryKey,o}(),ea=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["updateHideStatus"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{data:t}=null!=e?e:{};return((e,t)=>{let n=new FormData;return void 0!==e.stockSupplierId&&n.append("stockSupplierId",e.stockSupplierId.toString()),void 0!==e.hide&&n.append("hide",e.hide.toString()),S.A.post("/v2/StockSupplier/UpdateHideStatus",n,t)}
1)(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})(),er=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["updateComingSoonStatus"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{data:t}=null!=e?e:{};return((e,t)=>{let n=new FormData;return void 0!==e.stockSupplierId&&n.append("stockSupplierId",e.stockSupplierId.toString()),void 0!==e.comingSoon&&n.append("comingSoon",e.comingSoon.toString()),S.A.post("/v2/StockSupplier/UpdateComingSoonStatus",n,t)})(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})(),es=((e,t)=>{let n,o=(0,i.c)(2);o[0]!==e?(n=(e=>{let t=["updateDisableStockSyncing"],{mutation:n,axios:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:t}}:{mutation:{mutationKey:t},axios:void 0};return{mutationFn:e=>{let{data:t}=null!=e?e:{};return((e,t)=>{let n=new FormData;return void 0!==e.stockSupplierId&&n.append("stockSupplierId",e.stockSupplierId.toString()),void 0!==e.disableStockSyncing&&n.append("disableStockSyncing",e.disableStockSyncing.toString()),S.A.post("/v2/StockSupplier/UpdateDisableStockSyncing",n,t)})(t,o)},...n}})(e),o[0]=e,o[1]=n):n=o[1];let l=n;return(0,k.n)(l,t)})();z[0]!==eo?(e=()=>{eo&&en(eo.data)},t=[eo],z[0]=eo,z[1]=e,z[2]=t):(e=z[1],t=z[2]),(0,r.useEffect)(e,t),z[3]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{Z(e),U(!0)},z[3]=n):n=z[3];let ec=n;z[4]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{Z(e),H(!0)},z[4]=l):l=z[4];let ed=l;z[5]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{Z(e),Y(!0)},z[5]=a):a=z[5];let eu=a;z[6]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{Z(e),X(!0)},z[6]=s):s=z[6];let ep=s;z[7]!==el?(f=async()=>{try{return await el(),ee(Date.now().toString()),!0}catch(e){return console.error(e),!1}},z[7]=el,z[8]=f):f=z[8];let em=f;z[9]===Symbol.for("react.memo_cache_sentinel")?(x={field:"StockSupplierId",type:"string",numeric:!0,headerName:"Id",flex:1,getPropValue:oe},C={field:"Name",type:"string",headerName:"Name",flex:1,getPropValue:ot},z[9]=x,z[10]=C):(x=z[9],C=z[10]),z[11]!==et?(A=e=>{var t;return et&&null!=(t=et[e.origin])?t:0},z[11]=et,z[12]=A):A=z[12],z[13]!==ei?(j=e=>{var t;let n=e.row,i=null!=(t=e.value)?t:0;return(0,o.jsxs)(m.A,{direction:"row",alignItems:"center",children:[(0,o.jsx)(c.A,{variant:"caption",children:ei?"Loading...":i.toLocaleString()}),i>0&&(0,o.jsx)(d.A,{size:"small",onClick:()=>{ec(n)},children:(0,o.jsx)(h.B,{size:16})})]})},z[13]=ei,z[14]=j):j=z[14],z[15]!==j||z[16]!==A?(I={field:"Stock",type:"string",numeric:!0,headerName:"Stock",flex:1,getPropValue:A,renderCell:j},z[15]=j,z[16]=A,z[17]=I):I=z[17],z[18]===Symbol.for("react.memo_cache_sentinel")?(w={field:"Last Stock Sync",type:"string",headerName:"Last Stock Sync",flex:1,getPropValue:on},T={field:"Last Stock Status Sync",type:"string",headerName:"Last Stock Status Sync",flex:1,getPropValue:oo},_={field:"Region",type:"string",headerName:"Region",flex:1,getPropValue:oi},z[18]=w,z[19]=T,z[20]=_):(w=z[18],T=z[19],_=z[20]),z[21]!==em||z[22]!==ea?(P={field:"Hide",type:"boolean",headerName:"Hide",flex:1,getPropValue:ol,renderCell:e=>{var t;let n=e.row,i=null!=(t=e.value)&&t,l=async()=>{try{await ea.mutateAsync({data:{stockSupplierId:n.stockSupplierId,hide:!i}}),await em()}catch(e){console.error("Error updating hide status:",e)}};return(0,o.jsx)(u.A,{checked:i,onChange:l,size:"small"})}},z[21]=em,z[22]=ea,z[23]=P):P=z[23],z[24]!==em||z[25]!==er?(F={field:"ComingSoon",type:"boolean",headerName:"Coming Soon",flex:1,getPropValue:oa,renderCell:e=>{var t;let n=e.row,i=null!=(t=e.value)&&t,l=async()=>{try{await er.mutateAsync({data:{stockSupplierId:n.stockSupplierId,comingSoon:!i}}),await em()}catch(e){console.error("Error updating coming soon status:",e)}};return(0,o.jsx)(u.A,{checked:i,onChange:l,size:"small"})}},z[24]=em,z[25]=er,z[26]=F):F=z[26],z[27]!==em||z[28]!==es?(O={field:"DisableStockSyncing",type:"boolean",headerName:"Disable Stock Syncing",flex:1,getPropValue:or,renderCell:e=>{var t;let n=e.row,i=null!=(t=e.value)&&t,l=async()=>{try{await es.mutateAsync({data:{stockSupplierId:n.stockSupplierId,disableStockSyncing:!i}}),await em()}catch(e){console.error("Error updating disable stock syncing status:",e)}};return(0,o.jsx)(u.A,{checked:i,onChange:l,size:"small"})}},z[27]=em,z[28]=es,z[29]=O):O=z[29],z[30]===Symbol.for("react.memo_cache_sentinel")?(E={label:"Import Stock",onClick:e=>{ed(e)},icon:(0,o.jsx)(y.z,{size:20})},z[30]=E):E=z[30],z[31]===Symbol.for("react.memo_cache_sentinel")?(D={label:"Import Stock Status",onClick:e=>{eu(e)},icon:(0,o.jsx)(y.z,{size:20})},z[31]=D):D=z[31],z[32]===Symbol.for("react.memo_cache_sentinel")?(N={field:"action",type:"action",headerName:"",disablePadding:!0,flex:1,options:[E,D,{label:"Delete Stock",onClick:e=>{ep(e)},icon:(0,o.jsx)(g.l,{size:20})}]},z[32]=N):N=z[32],z[33]!==I||z[34]!==P||z[35]!==F||z[36]!==O?(B=[x,C,I,w,T,_,P,F,O,N],z[33]=I,z[34]=P,z[35]=F,z[36]=O,z[37]=B):B=z[37];let eh=B;return z[38]===Symbol.for("react.memo_cache_sentinel")?(R={mt:3},z[38]=R):R=z[38],z[39]===Symbol.for("react.memo_cache_sentinel")?(M={field:"Created",sort:"desc"},z[39]=M):M=z[39],z[40]!==eh||z[41]!==$?(L=(0,o.jsx)(b.A,{objectName:"SupplierIntegration",defaultPageSize:20,tableId:"supplier-integrations",columns:eh,url:"/v2/StockSupplier/SearchStockSuppliers",refreshDataToken:$,defaultSortModel:M}),z[40]=eh,z[41]=$,z[42]=L):L=z[42],z[43]!==K||z[44]!==J||z[45]!==q||z[46]!==G||z[47]!==em||z[48]!==Q?(V=Q?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(td,{open:K,setOpen:U,supplier:Q}),(0,o.jsx)(n3,{open:q,setOpen:H,selectedSupplier:Q,setSelectedSupplier:Z,refreshTable:em}),(0,o.jsx)(n8,{open:G,setOpen:Y,selectedSupplier:Q,setSelectedSupplier:Z}),(0,o.jsx)(tu,{open:J,setOpen:X,selectedSupplier:Q,setSelectedSupplier:Z,refreshTable:em})]}):null,z[43]=K,z[44]=J,z[45]=q,z[46]=G,z[47]=em,z[48]=Q,z[49]=V):V=z[49],z[50]!==L||z[51]!==V?(W=(0,o.jsxs)(p.A,{sx:R,children:[L,V]}),z[50]=L,z[51]=V,z[52]=W):W=z[52],W};function oe(e){return e.stockSupplierId}function ot(e){return e.name}function on(e){return null===e.lastStockSync?"-":(0,C.Gl)(x()(e.lastStockSync),A.LN.DATE)}function oo(e){return null===e.lastStockStatusSync?"-":(0,C.Gl)(x()(e.lastStockStatusSync),A.LN.DATE)}function oi(e){return e.region}function ol(e){return e.hide}function oa(e){return e.comingSoon}function or(e){return e.disableStockSyncing}let os=()=>{let e,t,n=(0,i.c)(2);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.jsx)(s.A,{title:"Supplier Integrations",icon:(0,o.jsx)(a.w,{size:20})}),n[0]=e):e=n[0],n[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.jsxs)(o.Fragment,{children:[e,(0,o.jsx)(l.A,{maxWidth:"xl",children:(0,o.jsx)(n9,{})})]}),n[1]=t):t=n[1],t}},71330:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var o=n(6029),i=n(75155),l=n(3113),a=n(60712),r=n(55729);let s=e=>{let t,n,s,c,d,u,p,m=(0,i.c)(22),{src:h,style:y,defaultSize:g,defaultBorderRadius:f,icon:x,objectFit:k}=e;m[0]!==y?(t=void 0===y?{}:y,m[0]=y,m[1]=t):t=m[1];let v=t,S=void 0===g?39:g,b=void 0===f?4:f,C=void 0===x?null:x,A=void 0===k?"cover":k,[j,I]=(0,r.useState)(!1);m[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{I(!0)},m[2]=n):n=m[2];let w=n;m[3]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{I(!1)},m[3]=s):s=m[3];let T=s,_=null==h||""==h;m[4]!==b||m[5]!==S||m[6]!==v?(c={width:S,height:S,minWidth:S,minHeight:S,marginTop:"2px",marginBottom:"2px",background:"#f2f2f2",borderRadius:b,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",...v},m[4]=b,m[5]=S,m[6]=v,m[7]=c):c=m[7],m[8]!==C||m[9]!==j||m[10]!==_?(d=(_||j)&&null==C&&(0,o.jsx)(a.In,{icon:l.A,style:{width:24,height:24,color:"#d9d9d9"}}),m[8]=C,m[9]=j,m[10]=_,m[11]=d):d=m[11];let P=(_||j)&&null!=C&&C;return m[12]!==j||m[13]!==_||m[14]!==A||m[15]!==h?(u=!_&&!j&&(0,o.jsx)("img",{style:{objectFit:A,height:"100%",width:"100%"},src:h,onError:w,onLoad:T}),m[12]=j,m[13]=_,m[14]=A,m[15]=h,m[16]=u):u=m[16],m[17]!==d||m[18]!==P||m[19]!==u||m[20]!==c?(p=(0,o.jsxs)("div",{style:c,children:[d,P,u]}),m[17]=d,m[18]=P,m[19]=u,m[20]=c,m[21]=p):p=m[21],p}},76809:()=>{},84470:()=>{}},e=>{e.O(0,[239,1474,8600,9664,3652,3761,1909,9610,7874,3834,8149,6282,8948,4148,4100,1933,6593,636,8792],()=>e(e.s=5140)),_N_E=e.O()}]); 2//# sourceMappingURL=supplier-integrations-d58c2ad611ac91c6.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.