1"use strict";(globalThis.webpackChunktailored_industry||=[]).push([[3656],{88837(ie,Bt,o){o.d(Bt,{A:()=>ft});var t=o(74848),S=o(96540);const _=(0,S.createContext)({});function Ct({children:u,...C}){return(0,t.jsx)(_.Provider,{value:C,children:u})}function jt(){return(0,S.useContext)(_)}var Nt=o(46942),c=o.n(Nt),Z=o(84123),L=o(91235),V=o(74722),Ot=o(77500),tt=o(24401),lt=o(96291),E=o(30995),at=o(33551),Mt=o(54792),Et=o(98550),dt=o(90973),$=o(20440),X=o(87164),ht=o(11848);const Rt=(0,ht.A)(X.A,{shouldForwardProp:u=>u!=="fixed"})(({fixed:u})=>[{pointerEvents:"none"},u&&{position:"absolute",width:"max-content",height:"max-content",zIndex:1,top:0,bottom:0,left:0,right:0}]);function pt({className:u,fixed:C,...b}){const{colors:M,colorId:D}=ft.useContext(),B=(0,S.useMemo)(()=>{if(!(!D||!Array.isArray(M)))return(0,dt.A)(M,{id:D})},[M,D]),ot=c()("CatalogItem__SelectedColor",u);return B?(0,t.jsx)(Rt,{fixed:C,className:ot,...b,children:(0,t.jsx)($.A,{color:B})}):null}const Wt=pt,Gt={"6405d69dfcb7dd0028559386":"Biella (non-washable)","690ceb439a46aed0386aea63":"Zegna Baruffa (washable)"},At={root:"CatalogItem__Colors__Color"};ut.SelectedColor=Wt;function ut({className:u,...C}){const{product:b,colors:M,colorSurcharges:D,setColorId:B,availableColorIds:ot,setColorWasChanged:nt,colorId:xt}=ft.useContext(),it=c()(At.root,u),N=(0,S.useCallback)(Yt=>{nt(!0),B(Yt)},[B]),zt=(0,S.useMemo)(()=>(0,Et.d)({product:b,colors:M}),[b,M]),Dt=(0,S.useMemo)(()=>(0,Z.A)(zt),[zt]),kt=(0,L.A)(Dt)<=1;return(0,t.jsx)(E.A,{className:it,flexDirection:"column",gap:1,children:(0,V.A)(Dt,([Yt,ne])=>{const Ft=kt?S.Fragment:tt.A,xe=kt?{}:{label:(0,Ot.A)(Gt,Yt,"")};return(0,t.jsx)(Ft,{...xe,children:(0,t.jsx)(lt.A,{className:it,colors:ne,value:xt,onChange:N,availableColorIds:ot,renderDescription:({color:Pe,isSelected:ke})=>{if(!ke||!Pe?.id)return null;const Te=D?.[Pe.id]?.amount;return Te?(0,t.jsxs)(at.A,{fontWeight:"bold",variant:"body2",children:["+",(0,Mt.A)(Te,0)]}):null},...C})},Yt)})})}const rt=ut,d=(0,ht.A)("section")` 2 padding: 48px 24px; 3 & > .content{ 4 .features-row{ 5 width: 100%; 6 display: flex; 7 align-items: center; 8 9 &__left{ 10 justify-content: flex-start; 11 } 12 &__right{ 13 justify-content: flex-end; 14 } 15 } 16 .features-col{ 17 max-width: 450px; 18 padding: ${({theme:u})=>u.spacing(2)}px; 19 img{ 20 max-width: 100%; 21 } 22 h4{ 23 font-style: normal; 24 font-weight: ${({theme:u})=>u.typography.fontWeightBold}; 25 font-size: ${({theme:u})=>u.typography.h4.fontSize}; 26 line-height: 32px; 27 text-transform: capitalize; 28 color: ${({theme:u})=>u.palette.text.primary}; 29 margin-bottom: 40px; 30 } 31 p { 32 font-style: normal; 33 font-weight: 400; 34 font-size: ${({theme:u})=>u.typography.body2.fontSize}; 35 line-height: 180%; 36 color: ${({theme:u})=>u.palette.text.primary}; 37 } 38 } 39 } 40`;function y({htmlString:u,className:C,hidden:b,...M}){const D=(0,S.useRef)(null),B=c()("Features",C);return(0,S.useEffect)(()=>{!D.current||!u||(D.current.innerHTML=u)},[u,D.current]),!u||b?null:(0,t.jsx)(d,{className:B,...M,children:(0,t.jsx)("div",{ref:D,className:"content"})})}function W(u){const{features:C}=ft.useContext();return(0,t.jsx)(y,{htmlString:C,...u})}const w=W;var H=o(15016),et=o(93312);function Lt(){const[u,C]=(0,S.useState)(!1),[b,M]=(0,S.useState)(),[D,B]=(0,S.useState)(),[ot,nt]=(0,S.useState)(null),[xt,it]=(0,S.useState)(),[N,zt]=(0,S.useState)(!1),Dt=(0,S.useRef)(null),[kt,Yt]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{const ne=H.A.getNearestScrollableParent(Dt.current);ne&&ne.scrollTo({top:0,behavior:"instant"})},[]),{sizeId:ot,setSizeId:nt,colorId:b,setColorId:M,notFound:u,setNotFound:C,availableColorIds:D,setAvailableColorIds:B,availableSizeIds:xt,setAvailableSizeIds:it,loading:N,setLoading:zt,containerRef:Dt,setColorWasChanged:Yt,colorWasChanged:kt,isMobile:et.A.isMobile}}var yt=o(42531),De=o(11397),ve=o(76484);function ae(){const{images:u,isMobile:C,defaultImageId:b,colorWasChanged:M}=ft.useContext(),[D,B]=(0,S.useState)(),ot=(0,S.useMemo)(()=>(0,dt.A)(u,{id:D}),[D]);return(0,S.useEffect)(()=>
40{if(!(!Array.isArray(u)||!u.length)){if(!M&&b&&(0,dt.A)(u,{id:b})){B(b);return}B(u[0]?.id)}},[u,b,M]),{images:u,selectedImageId:D,onNavigationChange:B,isMobile:C,selectedImage:ot}}var vt=o(61625),ce=o(89610),Fe=o(25800);const Y=(0,ht.A)(X.A,{shouldForwardProp:u=>u!=="isSelected"})(({theme:u,isSelected:C})=>[{position:"relative",backgroundSize:"cover",width:50,minWidth:50,maxWidth:50,height:65,minHeight:65,maxHeight:65,borderRadius:u.shape.borderRadius,backgroundRepeat:"no-repeat",backgroundPosition:"center center",boxShadow:u.shadows[1],border:u.border.solid(1),cursor:"pointer",overflow:"hidden","&:hover":{borderColor:u.palette.primary.main,"&:before":{...u.mixins.hoverMask}}},C&&{borderColor:u.palette.primary.main,"&:before":{...u.mixins.hoverMask}}]);function Q({images:u,selectedImageId:C,onChange:b,className:M,maxHeight:D,isMobile:B=et.A.isMobile,...ot}){const nt=c()("CatalogItem__Navigation",M),xt=(0,S.useMemo)(()=>(0,vt.A)(u,N=>N?.id===C),[u,C]),it=N=>()=>(0,ce.A)(b)&&b(N?.id);return(0,t.jsx)(Fe.A,{variant:"vertical",maxHeight:D,skip:B,scrollToIndex:xt,className:nt,scrollStep:220,children:(0,t.jsx)(E.A,{gap:1.5,width:B?"100%":void 0,flexDirection:B?"row":"column",flexWrap:B?"wrap":"initial",justifyContent:B?"center":"initial",...ot,children:(0,V.A)(u,(N,zt)=>{const Dt=N?.smallSrc||N?.src,kt=!N?.id||!Dt;return(0,t.jsx)(Y,{onClick:it(N),isSelected:N?.id===C,hidden:kt,role:"presentation",style:{backgroundImage:`url(${N?.smallSrc||N?.src})`}},`${N?.id}_${zt}`)})})})}const Se=Q,Be=(0,ht.A)(E.A,{shouldForwardProp:u=>!(0,yt.A)(["isMobile","headerHeight"],u)})(({isMobile:u,headerHeight:C})=>[!u&&{position:"sticky",top:C+16},u&&{flexFlow:"column-reverse"}]),Ce={root:"CatalogItem__Images__Image"};le.useImages=ae,le.Navigation=Se;function le({className:u,hideNavigation:C=!1,hideSelectedColor:b=!1,...M}){const{images:D,selectedImage:B,onNavigationChange:ot,isMobile:nt,selectedImageId:xt}=ae(),it=c()(Ce.root,u,{mobile:nt}),N=(0,ve.g)();return(0,t.jsxs)(Be,{isMobile:nt,className:it,headerHeight:N.height,flexDirection:"row",alignItems:nt?"center":"flex-start",gap:2,position:"relative",...M,children:[!C&&(0,t.jsx)(Se,{images:D,onChange:ot,selectedImageId:xt,isMobile:nt,maxHeight:nt?"initial":620}),(0,t.jsxs)(X.A,{position:"relative",flex:1,children:[(0,t.jsx)(ft.Colors.SelectedColor,{hidden:b,style:{padding:8},fixed:!0}),(0,t.jsx)(De.A,{height:nt?350:void 0,maxHeight:700,src:B?.largeSrc||B?.mediumSrc||B?.previewSrc||B?.smallSrc||B?.src,wrapperClassName:"CatalogItem__Image",preview:{src:B?.highResolutionSrc}})]})]})}const Re=le;var de=o(96759);function Ve({label:u,value:C,...b}){return(0,t.jsx)(de.A,{title:u,value:C,striped:!1,gap:0,padding:0,border:"none",...b})}const Ne=Ve,mt={root:"CatalogItem__Info"};Ut.Item=Ne;function Ut({className:u,children:C,isMobile:b=et.A.isMobile,...M}){const D=c()(mt.root,u);return(0,t.jsx)(E.A,{gap:b?1.5:2,className:D,...M,children:C})}const Oe=Ut;var T=o(50077),ue=o(24978);function Zt({className:u,children:C,...b}){const{loading:M,notFound:D,isMobile:B}=ft.useContext(),ot=c()("CatalogItem",u),{containerRef:nt}=ft.useContext();return(0,t.jsxs)(T.A,{className:ot,containerRef:nt,bodySx:{padding:2,overflow:B?"hidden":"initial"},...b,children:[M&&(0,t.jsx)(ft.Skeleton,{}),!M&&(D?(0,t.jsx)(ue.A,{}):C)]})}const Vt=Zt,he=(0,ht.A)(E.A,{shouldForwardProp:u=>u!=="isMobile"})(({theme:u,isMobile:C})=>({paddingBlock:u.spacing(1),paddingInline:u.spacing(C?.5:2),"&:empty":{"& + .CatalogItem__Section_Title":{display:"none"}}}));function $t({children:u,className:C,title:b}){const M=c()("CatalogItem__Section",C);return u?(0,t.jsxs)(E.A,{className:M,width:"100%",gap:2,flexDirection:"column-reverse",children:[(0,t.jsx)(he,{width:"100%",isMobile:et.A.isMobile,gap:2,children:u}),(0,t.jsx)(at.A,{hidden:!b,className:"CatalogItem__Section_Title",paddingBlock:1,paddingInline:et.A.isMobile?1:2,fontWeight:"bold",sx:D=>({background:D.palette.action.hover,borderRadius:D.shape.borderRadius}),children:b})]}):null}const me=$t;var Ht=o(90077);const je={root:"CatalogItem__Sizes"};function We({className:u,showSurcharges:C=!0,...b}){const{availableSizeIds:M,sizeId:D,setSizeId:B,sizes:ot,sizeSurcharges:nt}=ft.useContext(),xt=c()(je.root,u);return(0,t.jsx)(Ht.A,{className:xt,sizes:ot,availableSizeIds:M,onChange:B,value:D,renderLabel:({size:it,isSelected:N})=>
40{const zt=it?.id;if(!zt)return;const Dt=nt?.[zt]?.amount;return!Dt||!C||!N?it.name:`${it.name} +${(0,Mt.A)(Dt,0)}`},borderLess:!0,...b})}const Ge=We;var Qt=o(54706),ee=o(71543),qt=o(36850);function oe(){const{isMobile:u}=ft.useContext();return(0,t.jsxs)(qt.A,{"max-height":"100vh",spacing:4,container:!0,children:[(0,t.jsx)(qt.A,{size:u?12:6,children:(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{minHeight:300,height:"100%"}})}),(0,t.jsx)(qt.A,{size:u?12:6,children:(0,t.jsxs)(E.A,{gap:3,children:[(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:60}}),(0,t.jsx)(ee.A,{}),(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:180}}),(0,t.jsx)(ee.A,{}),(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:120}}),(0,t.jsx)(ee.A,{}),(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:180}}),(0,t.jsx)(ee.A,{}),(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:60}}),(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:60}}),(0,t.jsx)(Qt.A,{variant:"rectangular",sx:{height:60}})]})})]})}const He=oe;function It({children:u}){const C=b=>b%2===0?{sm:8,md:8,lg:10,xl:12}:{sm:16,md:16,lg:14,xl:12};return(0,t.jsx)(qt.A,{columns:24,spacing:4,container:!0,children:S.Children.map(u,(b,M)=>(0,t.jsx)(qt.A,{size:C(M),children:b},b?.key??M))})}const _t=It;var ye=o(69554);const Ie={root:"CatalogItem__Title"};function fe({children:u,className:C,...b}){const{title:M,isMobile:D,product:B}=ft.useContext(),ot=c()({mobile:D},C);return(0,t.jsxs)(E.A,{flexDirection:D?"column":"row",alignItems:D?"flex-start":"center",gap:1,className:Ie.root,...b,children:[(0,t.jsx)(at.A,{className:ot,variant:"h4",fontWeight:"bold",children:u||M}),B?.isRecommended&&(0,t.jsx)(ye.A,{color:"success",label:"Recommended"})]})}const Qe=fe;ct.useContext=jt,ct.Provider=Ct,ct.Images=Re,ct.Title=Qe,ct.Info=Oe,ct.Colors=rt,ct.Sizes=Ge,ct.useCatalogItem=Lt,ct.Layout=Vt,ct.Features=w,ct.Skeleton=He,ct.Split=_t,ct.Section=me,ct.classes={Images:Ce,Title:Ie,Info:mt,Colors:At,Sizes:je};function ct({children:u,...C}){return(0,t.jsx)(Ct,{...C,children:(0,t.jsx)(Vt,{children:u})})}const ft=ct},23656(ie,Bt,o){o.d(Bt,{A:()=>p});var t=o(74848),S=o(88837),_=o(93312),Ct=o(46942),jt=o.n(Ct),Nt=o(69592),c=o(96540),Z=o(11201),L=o(2454),V=o(76429),Ot=o(72763),tt=o(35723),lt=o(22552),E=o(27354),at=o(49037),Mt=o(76705);function Et({productId:e,hidden:n,className:s,children:i,loading:r,removable:l=!0,isMobile:a=_.A.isMobile,...h}){const m=(0,c.useMemo)(()=>({productId:e}),[e]),f=(0,L.G)(bt=>(0,E.qM)(bt,m)),x=f?.isFavorite,{useAddToFavoritesMutation:v,useRemoveFromFavoritesMutation:j}=lt.G,[g,{isLoading:I,isError:R,isSuccess:F}]=v(),[K,{isLoading:G,isError:P,isSuccess:A}]=j(),z=(0,Ot.A)(),st=tt.A.Modal.useModal(),{errorSnackbar:O,savedSnackbar:St}=(0,V.d)(),J=()=>{if(e)return x?z.can(z.list.FAVORITES__DELETE)?K(e):st.open():z.can(z.list.FAVORITES__CREATE)?g(e):st.open()},wt=jt()("AddToFavorites",s,{mobile:a}),U=()=>(0,Nt.A)(i)?a?null:x?"Remove from Favorites":"Add to Favorites":i;return(0,c.useEffect)(()=>{F&&St("The product was added to your Favorites!")},[F]),(0,c.useEffect)(()=>{A&&St("The product was removed from your Favorites!")},[A]),(0,c.useEffect)(()=>{R&&O("Failed to add to your Favorites!")},[R]),(0,c.useEffect)(()=>{P&&O("Failed to remove from your Favorites!")},[P]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tt.A.Modal,{title:"Upgrade Plan to manage your collection!",open:st.visible,onClose:st.close,children:(0,t.jsx)(tt.A,{onSuccessSubscribe:st.close})}),(0,t.jsx)(Z.A,{className:wt,hidden:n||!f?.id||x&&!l,loading:I||G||r,onClick:J,color:"inherit",startIcon:x?(0,t.jsx)(at.A,{}):(0,t.jsx)(Mt.A,{}),...h,children:U()})]})}const dt=Et;var $=o(66401),X=o(74722),ht=o(92363),Rt=o(63325),pt=o(50077),Wt=o(84009),Gt=o(27352),At=o(87164),ut=o(11848),rt=o(51161);function d({productId:e}){const{useRelatedProductsQuery:n}=lt.G,{response:s}=n({productId:e},{skip:!e,selectFromResult:l=>({response:l.data})}),i=(0,c.useMemo)(()=>({productIds:(0,rt._)(s?.products,{field:"_id"})}),[s]);return{products:(0,L.G)(l=>(0,E.bj)(l,i))}}var y=o(1583),W=o(43535);const w=(0,ut.A)(Rt.RC)(({theme:e})=>({"--swiper-theme-color":e.palette.primary.main}));H.useRelatedProducts=d;function H({productId:e,title:n="Related Products",...s}){const{products:i}=d({productId:e});return!i||(0,$.A)(i)?null:(0,t.jsx)(pt.A,{title:n,...s,children:(0,t.jsx)(At.A,{width:"100%",overflow:"hidden",children:(0,t.jsx)(w,{slidesPerView:"auto",spaceBetween:8,modules:[ht.A],navigation:!0,children:(0,X.A)(i,r=>r?.id&&(0,t.jsx)(Rt.qr,{style:{width:"auto"},children:(0,t.jsx)(Wt.A.Item,{data:r,route:Gt.Ay.catalogProduct(r.id)})},r.id))})})})}const et=H;var Lt=o(81662),yt=o(42985),De=o(84123),ve=o(76618),ae=o(18139),vt=o(39241),ce=o(54346),Fe=o(41470),Y=o(20588),Q=o(31782);const Se=()=>Q.Nc.object().shape({barcodes:Q.Nc.object().test({name:"unique-barcodes",test(e){if(!e)return!0;const n=(0,De.A)(e),s=(0,ve.A)(n.filter(([,r])=>r.barcode),([,r])=>r.barcode),i=(0,ae.A)(s,r=>r.slice(1).map(([l])=>this.createError({path:`${this.path}.${l}.barcode`,message:"Must be unique"})));return(0,$.A)(i)?!0:new Q.Nc.ValidationError(i)}}).optional()});function Be({barcodes:e,groupedVariants:n}){const s=(0,c.useMemo)(()=>(0,vt.A)((0,ae.A)(n,a=>
40a.variants)),[n]),i=(0,c.useMemo)(()=>{const a=(0,ce.A)(e,"variant"),h={};return s.forEach(m=>{const f=m?.id;if(!f)return;const x=a[f];h[f]={barcode:x?.barcode||"",title:x?.title||""}}),{barcodes:h}},[e,s]),r=(0,Y.mN)({resolver:(0,Q.L2)(Se()),values:i}),l=(0,c.useCallback)(()=>{const a=r.getValues();return{barcodes:(0,Fe.A)(a.barcodes,m=>m.barcode||m.title)}},[r]);return{form:r,getSubmitValues:l}}function Ce({productId:e}){const n=(0,yt.hS)(),{savedSnackbar:s}=(0,V.d)(),i=(0,c.useMemo)(()=>({productId:e}),[e]),r=(0,L.G)(G=>(0,E.wW)(G,i)),{useProductBarcodesQuery:l,useEditProductBarcodesMutation:a}=lt.G,{data:h,isLoading:m}=l({productId:e},{skip:!e||!n.visible}),[f,{isLoading:x,isSuccess:v,error:j,reset:g}]=a(),{form:I,getSubmitValues:R}=Be({barcodes:h?.barcodes,groupedVariants:r}),F=I.handleSubmit(()=>{e&&f({productId:e,body:R()})}),K=(0,c.useCallback)(()=>{g(),I.reset()},[g]);return(0,c.useEffect)(()=>{v&&(s("Your changes have been saved."),n.close())},[v]),{productId:e,modal:n,form:I,groupedVariants:r,onSubmit:F,reset:K,error:j,loading:m||x}}var le=o(97515);function Re({hidden:e,...n}){const{modal:s,groupedVariants:i}=_t.useContext();return(0,t.jsx)(Z.A,{onClick:s.open,startIcon:(0,t.jsx)(le.A,{}),hidden:e||(0,$.A)(i),...n})}const de=(0,c.createContext)({});function Ve({children:e,...n}){return(0,t.jsx)(de.Provider,{value:n,children:e})}function Ne(){return(0,c.useContext)(de)}var mt=o(8977),Ut=o(62),Oe=o(42617),T=o(30995);function ue({productVariant:e,containerSx:n,children:s,...i}){return(0,t.jsxs)(T.A,{flexDirection:"row",alignItems:"center",gap:1,sx:n,children:[(0,t.jsx)(Oe.A,{sizeData:e?.size,color:"info",sx:{minWidth:40}}),(0,t.jsx)(Ut.A,{variant:"body2",breakType:"all",...i,children:s??e?.name})]})}var Zt=o(76881),Vt=o(91235),he=o(66070),$t=o(20440),me=o(69554),Ht=o(33551);const je=(0,ut.A)(Ht.A)(({theme:e})=>({...e.mixins.allBreakable}));function We({color:e,children:n,variants:s,barcodes:i,...r}){const l=(0,c.useMemo)(()=>(0,rt._)(s,{field:"_id"}),[s]),a=l?.length||0,h=(0,c.useMemo)(()=>(0,Vt.A)((0,he.A)(l,m=>!!i?.[m]?.barcode)),[l,i]);return(0,t.jsxs)(T.A,{flexDirection:"row",alignItems:"center",gap:1,width:"100%",...r,children:[(0,t.jsx)($t.A,{color:e,width:24}),(0,t.jsxs)(T.A,{flexDirection:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",paddingBlock:2,gap:1,flex:1,children:[(0,t.jsx)(je,{overflow:"hidden",children:n}),(0,t.jsx)(me.A,{color:h===a?"success":"warning",label:`Managed sizes: ${h} / ${a}`})]})]})}const Ge=We,Qt=(0,ut.A)(mt.A.Item)(({theme:e})=>({...e.mixins.striped})),ee=(0,ut.A)(mt.A.Summary)(()=>({minHeight:48,[`.${Zt.A.content}`]:{marginBlock:0},[`&.${Zt.A.expanded}`]:{minHeight:48,[`.${Zt.A.content}`]:{marginBlock:0}}}));function qt(){const{form:e,groupedVariants:n}=_t.useContext(),[s,i]=(0,c.useState)([]),r=(0,Y.FH)({control:e.control,name:"barcodes"});return(0,t.jsx)(Y.Ay,{form:e,children:(0,t.jsx)(mt.A,{activeTabs:s,setActiveTabs:i,multiple:!0,children:(0,X.A)(n,(l,a)=>{const h=(0,vt.A)(l.variants);return(0,t.jsxs)(Qt,{tab:a,children:[(0,t.jsx)(ee,{children:(0,t.jsx)(Ge,{variants:l?.variants,color:l?.color,barcodes:r,children:a})}),(0,t.jsx)(mt.A.Details,{children:(0,t.jsx)(T.A,{gap:2,children:(0,X.A)(h,m=>{const f=m.id;return f?(0,t.jsxs)(T.A,{flexDirection:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},gap:2,flex:1,children:[(0,t.jsx)(ue,{containerSx:{width:"100%"},productVariant:m}),(0,t.jsx)(Y.Ay.Input,{name:`barcodes.${f}.title`,control:e.control,label:"Title",size:"small",textFieldProps:{fullWidth:!0}}),(0,t.jsx)(Y.Ay.Input,{name:`barcodes.${f}.barcode`,control:e.control,label:"Barcode",size:"small",textFieldProps:{fullWidth:!0}})]},f):null})})})]},a)})})})}var oe=o(21548);function He(e){const{modal:n,onSubmit:s,form:i,reset:r,loading:l}=_t.useContext();return(0,t.jsx)(yt.Ay,{title:"Manage Barcodes and Titles",maxWidth:"md",open:n.visible,onClose:n.close,onTransitionExited:r,confirmOnClose:i.formState.isDirty,confirmProps:{children:(0,t.jsx)(oe.A.Message.UnsavedLost,{})},actions:(0,t.jsxs)(T.A,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[(0,t.jsx)(Z.A,{variant:"text",onClick:n.close,color:"warning",uppercase:!0,children:"Cancel"}),(0,t.jsx)(Y.Ay.Submit,{loading:l,onClick:s,fullWidth:!1,children:"Save"})]}),fullWidth:!0,...e})}It.Context=de,It.Provider=Ve,It.useContext=Ne,It.Modal=He,It.Form=qt,It.Button=Re;function It({productId:e,...n}){const s=Ce({productId:e});return(0,t.jsxs)(It.Provider,{...s,children:[(0,t.jsxs)(It.Modal,{children:[(0,t.jsx)(Lt.A,{error:"Manage barcodes and customize titles for your product variants.",type:"info"}),(0,t.jsx)(It.Form,{})]}),(0,t.jsx)(It.Button,{...n})]})}const _t=It;var ye=o(41791);function Ie({hidden:e,...n}){const{modal:s,product:i}=Xt.useContext();return(0,t.jsx)(Z.A,{startIcon:(0,t.jsx)(ye.A,{}),onClick:s.open,hidden:e||!i?.id,color:"primary",variant:"contained",fullWidth:_.A.isMobile,...n})}const fe=(0,c.createContext)({});function Qe({children:e,...n}){return(0,t.jsx)(fe.Provider,{value:n,children:e})}function ct(){return(0,c.useContext)(fe)}var ft=o(24401),u=o(92866),C=o(12486),b=o(62315),M=o(51998),D=o(27558);const B=(0,ut.A)(Ht.A)(({theme:e})=>({...e.mixins.allBreakable}));function ot({color:e,children:n,selectable:s,onSelect:i,selected:r,variants:l,...a}){const h=(0,L.G)(M.xZ),m=(0,c.useMemo)(()=>(0,rt._)(l,{field:"_id"}),[l]),f=m?.length||0,x=(0,c.useMemo)(()=>(0,Vt.A)((0,b.A)(h,m)),[h,m]);return(0,t.jsxs)(T.A,{flexDirection:"row",alignItems:"center",gap:1,width:"100%",...a,children:[!!s&&(0,t.jsx)(D.A,{checked:r,onChange:i,onClick:v=>v.stopPropagation()}),(0,t.jsx)($t.A,{color:e,width:24}),(0,t.jsxs)(T.A,{flexDirection:{xs:"column",md:"row"},alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",paddingBlock:2,gap:1,flex:1,children:[(0,t.jsx)(B,{overflow:"hidden",children:n}),(0,t.jsx)(me.A,{color:x===f?"success":"warning",label:`Synced sizes: ${x}
40 / ${f}`})]})]})}const nt=ot;var xt=o(8058),it=o(30679),N=o(42531),zt=o(43525),Dt=o(46996),kt=o(41343),Yt=o(62287);function ne({variants:e,value:n,onChange:s}){const[i,r]=(0,Yt.P)({value:n,onChange:s}),[l,a]=(0,c.useState)([]),[h,m]=(0,c.useState)([]),f=(0,c.useMemo)(()=>i||[],[i]),x=(0,c.useMemo)(()=>{const P={};return(0,xt.A)(e,A=>{const z=A?.colorId;!z||P[z]||(P[z]={id:z,name:A?.colorName||String(z),color:A?.color})}),(0,it.A)((0,u.A)(P),"name")},[e]),v=(0,c.useMemo)(()=>{const P={};return(0,xt.A)(e,A=>{const z=A?.sizeId;!z||P[z]||(P[z]={id:z,name:A?.sizeName||String(z),order:A?.size?.order??0})}),(0,X.A)((0,it.A)((0,u.A)(P),"order"),({id:A,name:z})=>({id:A,name:z}))},[e]),j=(0,c.useMemo)(()=>(0,rt._)(v,{field:"id"}),[v]),g=(0,c.useCallback)((P,A)=>{const z=[];return(0,xt.A)(e,st=>{const O=st?.id,St=st?.colorId,J=st?.sizeId;!O||!J||!St||(0,N.A)(P,St)&&(0,N.A)(A,J)&&z.push(O)}),z},[e]),I=(0,c.useCallback)((P,A)=>{a(P),m(A),r(g(P,A))},[g,r]),R=(0,c.useCallback)(P=>(0,N.A)(l,P)?"checked":"unchecked",[l]),F=(0,c.useCallback)(P=>(0,N.A)(h,P)?"checked":"unchecked",[h]),K=(0,c.useCallback)(P=>{I((0,zt.A)(l,[P]),h)},[I,l,h]),G=(0,c.useCallback)(P=>{I(l,(0,zt.A)(h,[P]))},[I,l,h]);return(0,c.useEffect)(()=>{f.length||!j.length||m(j)},[j]),(0,c.useEffect)(()=>{const P=g(l,h);if((0,Dt.A)((0,it.A)(P),(0,it.A)(f)))return;const A=(0,he.A)(e,st=>(0,N.A)(f,st?.id)),z=(0,kt.A)((0,rt._)(A,{field:"sizeId"}));a((0,kt.A)((0,rt._)(A,{field:"colorId"}))),m(z.length?z:j)},[f,e]),{colorOptions:x,sizeOptions:v,selectedVariantIds:f,selectedCount:f.length,totalCount:e.length,colorState:R,sizeState:F,toggleColor:K,toggleSize:G}}var Ft=o(53652),xe=o(72305),Pe=o(98818);function ke({shopifyMapping:e,children:n,hidden:s,...i}){return s?null:e?.admin_url?(0,t.jsx)(Z.A,{href:e?.admin_url,endIcon:(0,t.jsx)(Pe.A,{}),target:"_blank",onClick:r=>r.stopPropagation(),shape:"default",variant:"text",color:"inherit",...i,children:n}):n}const Te=ke;var ge=o(71543);function no({productVariant:e,children:n,shopifyMappings:s,...i}){if(e?.id)return(0,Vt.A)(s)?(0,t.jsx)(T.A,{gap:.5,children:(0,X.A)(s,(r,l)=>{const a=(0,vt.A)([r?.shopifyProductTitle,r?.shopifyVariantTitle]).join(" - ");return(0,t.jsxs)(c.Fragment,{children:[(0,t.jsx)(ge.A,{sx:{"&:first-of-type":{display:"none"}}}),(0,t.jsx)(Te,{shopifyMapping:r,children:(0,t.jsx)(Ut.A,{variant:"body2",...i,children:n??a})})]},l)})}):(0,t.jsx)(me.A,{label:"Not found in your shopify",color:"warning"})}var Ue=o(78405);function so(e){return(0,t.jsxs)(T.A,{flexDirection:"row",gap:1,alignItems:"center",children:[(0,t.jsx)(Ue.A,{type:"shopify",width:22}),(0,t.jsx)(Ut.A,{variant:"body2",...e})]})}var Bo=o(33876);function ro(e){return(0,t.jsxs)(T.A,{flexDirection:"row",gap:1,children:[(0,t.jsx)(Bo.A.Icon,{}),(0,t.jsx)(Ut.A,{variant:"body2",...e})]})}function Ro({variant:e,shopifyMappings:n,...s}){return(0,t.jsxs)(xe.A,{isMobile:!0,...s,children:[(0,t.jsx)(xe.A.Item,{label:(0,t.jsx)(ro,{children:"Title"}),children:(0,t.jsx)(ue,{productVariant:e})}),(0,t.jsx)(xe.A.Item,{label:(0,t.jsx)(so,{children:"Title"}),children:(0,t.jsx)(no,{productVariant:e,shopifyMappings:n})})]})}function Vo({variants:e,isMobile:n=_.A.isMobile,...s}){const i=(0,L.G)(M.xZ),r=h=>{if(h?.id)return i[h.id]},l=(0,c.useMemo)(()=>(0,it.A)(e,h=>!!r(h),"sku"),[i]),a=[{renderLabel:()=>(0,t.jsx)(ro,{children:"Title"}),span:12,renderField:h=>(0,t.jsx)(ue,{productVariant:h})},{renderLabel:()=>(0,t.jsx)(so,{children:"Title"}),span:12,renderField:h=>(0,t.jsx)(no,{productVariant:h,shopifyMappings:r(h)})}];return(0,t.jsx)(Ft.A,{config:a,items:l,size:"medium",stickyHeader:!1,renderItem:n&&(h=>(0,t.jsx)(Ro,{variant:h,shopifyMappings:r(h)})),hideHeader:n,borderless:!n,hideFooter:!0,horizontalBordered:!0,transparentHeader:!0,transparent:!0,...s})}const No=Vo,Oo="variants",Wo=(0,ut.A)(mt.A.Summary)(()=>({minHeight:48,[`.${Zt.A.content}`]:{marginBlock:0},[`&.${Zt.A.expanded}`]:{minHeight:48,[`.${Zt.A.content}`]:{marginBlock:0}}})),Go=(0,ut.A)(mt.A.Item)(({theme:e})=>({...e.mixins.striped}));function Ho({variants:e,selectable:n,value:s,onChange:i,isMobile:r=_.A.isMobile}){const[l,a]=(0,c.useState)([]),[h,m]=(0,c.useState)([]),{colorOptions:f,sizeOptions:x,selectedCount:v,totalCount:j,colorState:g,sizeState:I,toggleColor:R,toggleSize:F}=ne({variants:e,value:s,onChange:i}),K=(0,c.useMemo)(()=>(0,ce.A)(f,"id"),[f]),G=(0,c.useMemo)(()=>(0,ce.A)(x,"id"),[x]),P=(0,c.useMemo)(()=>(0,X.A)(f,"id"),[f]),A=(0,c.useMemo)(()=>(0,X.A)(x,"id"),[x]),z=(0,c.useMemo)(()=>(0,ve.A)(e,"colorId"),[e]),st=O=>(0,t.jsx)($t.A,{color:K[O]?.color,width:16});return(0,t.jsxs)(T.A,{gap:2.5,children:[(0,t.jsx)(C.A,{label:"Colors",multiple:!0,hidden:!P.length,options:P,getOptionLabel:O=>K[O]?.name,getOptionState:g,onOptionToggle:R,getOptionDisabled:()=>!n,buttonProps:({option:O})=>({endIcon:st(O)}),size:"small"}),(0,t.jsx)(C.A,{label:"Sizes",multiple:!0,hidden:!A.length,options:A,getOptionLabel:O=>G[O]?.name,getOptionState:I,onOptionToggle:F,getOptionDisabled:()=>!n,size:"small"}),(0,t.jsx)(mt.A,{activeTabs:l,setActiveTabs:a,transparent:!0,children:(0,t.jsxs)(mt.A.Item,{tab:Oo,children:[(0,t.jsx)(mt.A.Summary,{sx:{fontWeight:"normal"},children:(0,t.jsxs)(Ht.A,{variant:"body2",children:["Variants"," ",(0,t.jsxs)(Ht.A,{component:"span",variant:"body2",color:"text.secondary",children:[v,"/",j," selected"]})]})}),(0,t.jsx)(mt.A.Details,{sx:{padding:0},children:(0,t.jsx)(mt.A,{activeTabs:h,setActiveTabs:m,transparent:!0,multiple:!0,children:(0,X.A)(f,O=>{const St=z[O.id]||[];return(0,t.jsxs)(Go,{tab:O.id,children:[(0,t.jsx)(Wo,{children:(0,t.jsx)(nt,{variants:St,color:O.color,selectable:n,selected:g(O.id)==="checked",onSelect:()=>R(O.id),children:O.name})}),(0,t.jsx)(mt.A.Details,{sx:{paddingInline:r?1:2.5},children:(0,t.jsx)(No,{variants:St})})]},O.id)})})})]})})]})}
40$e.View=Ho;function $e({productId:e,withInactive:n=!0,...s}){const i=(0,c.useMemo)(()=>({productId:e}),[e]),r=(0,L.G)(a=>(0,E.ko)(a,i)),l=(0,c.useMemo)(()=>{const a=(0,vt.A)((0,u.A)(r));return n?a:(0,he.A)(a,h=>!!h?.isActive)},[r,n]);return(0,t.jsx)($e.View,{variants:l,...s})}const io=$e;function Qo(e){const{productId:n,form:s}=Xt.useContext();return(0,t.jsx)(Y.Ay,{...e,children:(0,t.jsx)(Y.Ay.Item,{name:"variants",control:s.control,render:({field:i,fieldState:r})=>(0,t.jsx)(ft.A,{label:"Variants",error:r.invalid,helperText:r.error?.message,required:!0,children:(0,t.jsx)(io,{value:i.value,onChange:i.onChange,productId:n,withInactive:!1,selectable:!0})})})})}function ko({loading:e,...n}){const{modal:s,reset:i,product:r,selectedVariantIds:l,setVariantIds:a,variantLimit:h,onProductExport:m,loading:f}=Xt.useContext();return(0,t.jsx)(yt.Ay,{maxWidth:"md",onClose:s.close,open:s.visible,loading:e||f,headerActions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Xt.SelectAllVariantsButton,{product:r,selectedVariantIds:l,setVariantIds:a}),(0,t.jsx)(Xt.VariantsLimit,{variantLimit:h,selectedVariantIds:l,hidden:h-(0,Vt.A)(l)>10})]}),actions:(0,t.jsx)(Y.Ay.Submit,{onClick:m,startIcon:(0,t.jsx)(ye.A,{}),children:"Export"}),title:`Export ${r?.name||"Product"}`,onTransitionExited:i,fullWidth:!0,fullHeight:!0,...n})}var ao=o(49785),Uo=o(51538);const $o=({variantLimit:e=2048}={})=>Q.Nc.object().shape({variants:Q.Nc.array().of(Q.Nc.string().trim().required()).min(1).max(e).required()});function Yo({variantLimit:e,...n}={}){return{form:(0,Y.mN)({...n,mode:"onChange",resolver:(0,Q.L2)($o({variantLimit:e}))})}}function Ko({productId:e,variantLimit:n=2048}){const{errorSnackbar:s}=(0,V.d)(),i=(0,yt.hS)(),{form:r}=Yo({variantLimit:n}),[l,{isLoading:a,isError:h,isSuccess:m,reset:f}]=lt.G.useExportProductMutation(),{useProductQuery:x}=lt.G,{isLoading:v}=x({productId:e},{skip:!e}),j=(0,c.useMemo)(()=>({productId:e}),[e]),g=(0,L.G)(G=>(0,E.qM)(G,j)),I=(0,ao.FH)({control:r.control,name:"variants"}),R=G=>{r.setValue("variants",G)},F=r.handleSubmit(G=>{const P=(0,vt.A)(["Export",g?.name]).join(" ");l({productId:e,variants:G.variants,filename:P})});(0,c.useEffect)(()=>{h&&s("Failed to export product!")},[h]),(0,c.useEffect)(()=>{m&&i.close()},[m]);const K=(0,c.useCallback)(()=>{r.reset(),f()},[f]);return{product:g,productId:e,onProductExport:F,modal:i,reset:K,variantLimit:n,setVariantIds:R,selectedVariantIds:I,form:r,loading:v||a}}var Jo=o(18100),Zo=o(77548);function Xo({product:e,selectedVariantIds:n,setVariantIds:s,children:i,...r}){const l=(0,c.useMemo)(()=>{const f=[];return(0,xt.A)(e?.variants,x=>{!x?.id||!x?.isActive||f.push(x.id)}),f},[e]),a=!!n?.length,h=()=>{s(a?[]:l)},m=()=>(0,Nt.A)(i)?a?"Deselect all":"Select All":i;return(0,t.jsx)(Z.A,{color:a?"warning":"inherit",variant:"text",shape:"round",onClick:h,startIcon:a?(0,t.jsx)(Jo.A,{}):(0,t.jsx)(Zo.A,{}),uppercase:!0,...r,children:m()})}const wo=Xo;function qo({variantLimit:e,selectedVariantIds:n,...s}){const i=n?.length||0;return(0,t.jsxs)(Ht.A,{variant:"body1",fontWeight:"bold",color:i>e?"error":"inherit",...s,children:[i," / ",e]})}const _o=qo;Pt.Context=fe,Pt.Provider=Qe,Pt.useContext=ct,Pt.Modal=ko,Pt.Form=Qo,Pt.Button=Ie,Pt.VariantsLimit=_o,Pt.SelectAllVariantsButton=wo;function Pt({productId:e,variantLimit:n,...s}){const i=Ko({productId:e,variantLimit:n});return(0,t.jsxs)(Pt.Provider,{...i,children:[(0,t.jsx)(Pt.Modal,{children:(0,t.jsx)(Pt.Form,{})}),(0,t.jsx)(Pt.Button,{...s})]})}const Xt=Pt;var tn=o(34770);function en({hidden:e,...n}){const{modal:s,product:i,shops:r}=Kt.useContext();return(0,t.jsx)(Z.A,{startIcon:(0,t.jsx)(Ue.A,{type:"shopify"}),onClick:s.open,hidden:e||!i?.id||!(0,Vt.A)(r),fullWidth:_.A.isMobile,size:"large",...n})}const Ye=(0,c.createContext)({});function on({children:e,...n}){return(0,t.jsx)(Ye.Provider,{value:n,children:e})}function nn(){return(0,c.useContext)(Ye)}var co=o(61774),se=o(77940);function sn({shopId:e,loading:n,onFocus:s,onBlur:i,onClose:r,value:l,onChange:a,...h}){const{useShopifyProductsQuery:m}=se.z,[f,x]=(0,c.useState)(""),[v,j]=(0,c.useState)(""),g=(0,c.useRef)(!1),[I,R]=(0,Yt.P)({value:l,onCh
40ange:a}),F=(0,c.useRef)(),{productsLoading:K,response:G,isError:P}=m({search:v,shopId:e||""},{skip:!e,selectFromResult:U=>({response:U?.isError?void 0:U.data,isError:U.isError,productsLoading:U.isLoading||U.isFetching})}),A=(U,bt)=>{x(bt),clearTimeout(F.current),F.current=setTimeout(()=>{g.current&&j(bt)},300)},z=(0,c.useMemo)(()=>(0,kt.A)((0,vt.A)([I,...(0,rt._)(G?.products,{field:"id"})])),[G,I]),st=(0,L.G)(M.Hx),O=()=>{clearTimeout(F.current),j("")},St=U=>{s?.(U),g.current=!0},J=U=>{i?.(U),g.current=!1,O()},wt=(U,bt)=>{r?.(U,bt),O()};return(0,c.useEffect)(()=>{P&&I&&R(null)},[P]),(0,t.jsx)(co.A,{options:K?[]:z,inputValue:f,onInputChange:A,getOptionLabel:U=>st?.[U]?.title||"",loading:n||K,label:"Shopify Product",onFocus:St,value:I,onChange:R,onBlur:J,onClose:wt,disableFilter:!0,...h})}const rn=sn;function an({className:e,...n}){const s=(0,L.G)(M.uP),{useShopListQuery:i}=se.z,{isLoading:r}=i(),l=jt()("ShopSelect",e),a=(0,c.useMemo)(()=>(0,rt._)(s,{field:"id"}),[s]);return(0,t.jsx)(co.A,{options:a,label:"Shopify Store",className:l,loading:r,getOptionLabel:h=>s?.[h]?.name||"",...n})}const cn=an;var lo=o(89610);const uo={create:{value:"create",label:"Create new Product"},sync:{value:"sync",label:"Sync existing Product"}},ln=(0,rt._)(uo,{field:"value"});function dn(e){const{creationType:n,onCreationTypeChange:s}=Kt.useContext(),i=r=>{const l=(0,lo.A)(r)?r(n):r;l&&s(l)};return(0,t.jsx)(C.A,{value:n,onChange:i,options:ln,getOptionLabel:r=>uo?.[r]?.label||r,buttonProps:{shape:"default",size:"small",fullWidth:!0},contentFlexWrap:"nowrap",hideIcon:!0,borderLess:!0,...e})}const un=dn;function hn(e){const{productId:n,form:s,selectedShop:i,showShopSelect:r,showShopifyProductSelect:l,selectedShopifyProductId:a,showSyncFields:h,variantsIsRequired:m,selectedVariantIds:f}=Kt.useContext(),x=!!f?.length,v=l?!!a:!0,j=()=>{if(!v)return"Select product first";if(!m)return"No need to select variant to sync media or description"};return(0,t.jsxs)(Y.Ay,{...e,children:[(0,t.jsxs)(T.A,{maxWidth:550,marginInline:"auto",width:"100%",gap:2.5,children:[(0,t.jsx)(un,{}),!!r&&(0,t.jsx)(Y.Ay.Item,{name:"shop",control:s.control,render:({field:g,fieldState:I})=>(0,t.jsx)(cn,{value:g.value,onChange:g.onChange,error:I.invalid,helperText:I.error?.message,inputRef:g.ref,required:!0})}),!i?.needReinstall&&!!h&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Y.Ay.Switch,{label:"Sync media",name:"sync_media",control:s.control,helperText:"Replace product and variant images in Shopify"}),(0,t.jsx)(Y.Ay.Switch,{label:"Sync description",name:"sync_description",control:s.control,helperText:"Replace product description in Shopify"}),(0,t.jsx)(Y.Ay.Switch,{label:"Remove unselected variants",name:"remove_unselected_variants",control:s.control,disabled:!x,helperText:x?"Delete variants on Shopify that are not in your selection":"Select at least one variant"})]}),!i?.needReinstall&&l&&(0,t.jsx)(Y.Ay.Item,{name:"shopify_product_id",control:s.control,render:({field:g,fieldState:I})=>(0,t.jsx)(rn,{shopId:i?.id,disabled:!i?.id,value:g.value,onChange:g.onChange,error:I.invalid,helperText:r&&!i?.id?"Select Shopify Store first":I.error?.message,inputRef:g.ref,required:!0})})]}),!i?.needReinstall&&(0,t.jsx)(Y.Ay.Item,{name:"variants",control:s.control,render:({field:g,fieldState:I})=>(0,t.jsx)(ft.A,{error:I.invalid,helperText:I.error?.message||j(),label:"Variants",required:m,children:(0,t.jsx)(io,{productId:n,withInactive:!1,selectable:v,value:g.value,onChange:g.onChange})})})]})}function mn(e){const{modal:n,reset:s,product:i,selectedVariantIds:r,setVariantIds:l,selectedShop:a,variantLimit:h,onSubmit:m,form:f,creationType:x,isMobile:v}=Kt.useContext(),j=(0,c.useMemo)(()=>(0,vt.A)([x==="create"?"Create":"Sync",!v&&(i?.name||"Product"),"in Shopify"]).join(" "),[x,v,i]);return(0,t.jsx)(yt.Ay,{onClose:n.close,open:n.visible,confirmOnClose:f.formState.isDirty,confirmProps:{children:(0,t.jsx)(oe.A.Message.UnsavedLost,{})},onTransitionExited:s,title:j,headerActions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Kt.SelectAllVariantsButton,{product:i,selectedVariantIds:r,setVariantIds:l,hidden:!!a?.needReinstall}),(0,t.jsx)(Kt.VariantsLimit,{variantLimit:h,selectedVariantIds:r,hidden:!!a?.needReinstall||h-(0,Vt.A)(r)>10})]}),actions:(0,t.jsxs)(T.A,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[(0,t.jsx)(Z.A,{variant:"text",onClick:n.close,color:"warning",uppercase:!0,children:"Cancel"}),(0,t.jsxs)(Y.Ay.Submit,{onClick:m,startIcon:(0,t.jsx)(Ue.A,{type:"shopify"}),fullWidth:!1,disabled:a?.needReinstall,children:[x==="sync"?"Sync with":"Create in"," your Shopify"]})]}),maxWidth:"md",fullWidth:!0,fullHeight:!0,...e})}var ho=o(61973),fn=o(57659);function xn(){const{savedSnackbar:e}=(0,V.d)(),{exportCreated:n,product:s}=Kt.useContext();return(0,c.useEffect)(()=>{n&&e((0,t.jsxs)(T.A,{gap:1,children:[(0,t.jsxs)(Ut.A,{fontWeight:"bold",children:[s?.name||"Product"," is exporting to Shopify."]}),(0,t.jsx)(Ut.A,{fontSize:"small",children:"Once done, the result will be available on Product Exports page"}),(0,t.jsx)(T.A,{width:"100%",alignItems:"flex-start",children:(0,t.jsx)(ho.k2,{to:fn.Ay.productExports(),children:(0,t.jsx)(Z.A.Open,{variant:"text",size:"small",uppercase:!0,children:"To Product Exports"})})})]}),{autoHideDuration:7e3})},[n]),null}var gn=o(47360),pn=o(72682),An=o(427);const vn=({variantLimit:e=2048,requiredShopifyProduct:n=!1,requiredVariants:s=!0,allowSyncFields:i=!1}={})=>{const r=Q.Nc.array().of(Q.Nc.string().required()).min(1).max(e).required();return Q.Nc.object().shape({product_id:Q.Nc.mixed(),shopify_product_id:n?Q.Nc.string().required():Q.Nc.mixed().nullable(),shop:Q.Nc.string().trim().required(),sync_media:i?Q.Nc.boolean().optional():Q.Nc.mixed(),sync_description:i?Q.Nc.boolean().optional():Q.Nc.mixed(),remove_unselected_variants:i?Q.Nc.boolean().optional():Q.Nc.mixed(),variants:s?r:Q.Nc.mixed()})};function Sn({variantLimit:e,requiredVariants:n,allowSyncFields:s,requiredShopifyProduct:i,...r}={}){return{form:(0,Y.mN)({...r,mode:"onChange",resolver:(0,Q.L2)(vn({variantLimit:e,requiredVariants:n,requiredShopifyProduct:i,allowSyncFields:s}))})}}function Cn({productId:e,variantLimit:n=2048,isMobile:s=_.A.isMobile}){const i=(0,yt.hS)(),l=(0,An.A)().params?.slug,[a,h]=(0,c.useState)("create"),[m,f]=(0,c.useState)(!0),x=gt=>{h(gt||"create"),gt==="create"&&J.resetField("shopify_product_id")},v=a==="sync",j=v,{useProductQuery:g}=lt.G,{isLoading:I}=g({productId:e},{skip:!e}),{useExportShopifyProductMutation:R}=se.z,[F,{isLoading:K,isSuccess:G,error:P,reset:A}]=R();se.z.useShopifyProductMappingsQuery({productId:e||""});const z=(0,L.G)(M.uP),st=(0,c.useMemo)(()=>({productId:e}),[e]),O=(0,L.G)(gt=>(0,E.qM)(gt,st)),St=(0,c.useMemo)(()=>(0,pn.v)(P),[P]),{form:J}=Sn({variantLimit:n,requiredShopifyProduct:v,allowSyncFields:j,errors:St,requiredVariants:m,values:{product_id:e}}),[wt,U,bt,Ee,Le]=(0,ao.FH)({control:J.control,name:["shop","variants","shopify_product_id","sync_description","sync_media"]}),{useShopListQuery:ze}=se.z,{isFetching:qe}=ze(),_e=gt=>{J.setValue("variants",gt)},to=J.handleSubmit(gt=>{gt.product_id&&F({shopId:gt.shop,body:gt})}),eo=(0,c.useCallback)(()=>{A(),J.reset()},[A]),Ae=(0,c.useMemo)(()=>(0,Vt.A)(z)!==1,[z]);return(0,c.useEffect)(()=>{G&&i.close()},[G]),(0,c.useEffect)(()=>
40{if(Ae||!i.visible)return;const gt=(0,gn.A)((0,u.A)(z))?.id;gt&&J.setValue("shop",gt,{shouldTouch:!1,shouldDirty:!1})},[Ae,i.visible]),(0,c.useEffect)(()=>{f(!Ee&&!Le)},[Ee,Le]),(0,c.useEffect)(()=>{U?.length||J.setValue("remove_unselected_variants",!1,{shouldDirty:!1,shouldTouch:!1})},[U?.length]),(0,c.useEffect)(()=>{a==="create"&&J.resetField("shopify_product_id"),a==="sync"&&!bt&&J.resetField("variants")},[a,bt]),{product:O,variantLimit:n,productId:e,error:P,shops:z,onSubmit:to,modal:i,reset:eo,isMobile:s,setVariantIds:_e,selectedVariantIds:U,form:J,showShopSelect:Ae,creationType:a,onCreationTypeChange:x,showShopifyProductSelect:v,variantsIsRequired:m,showSyncFields:j,exportCreated:G,selectedShopifyProductId:bt||void 0,loading:I||qe||K,slug:l,selectedShop:wt?z?.[wt]:void 0}}Tt.Context=Ye,Tt.Provider=on,Tt.useContext=nn,Tt.Modal=mn,Tt.Form=hn,Tt.Button=en,Tt.SelectAllVariantsButton=Xt.SelectAllVariantsButton,Tt.VariantsLimit=Xt.VariantsLimit;function Tt({productId:e,variantLimit:n,isMobile:s,...i}){const r=Cn({productId:e,variantLimit:n,isMobile:s});return(0,t.jsxs)(Tt.Provider,{...r,children:[(0,t.jsx)(xn,{}),(0,t.jsxs)(Tt.Modal,{children:[(0,t.jsx)(Lt.A,{error:r.error}),(0,t.jsx)(Tt.Form,{}),(0,t.jsx)(tn.A,{shopId:r.selectedShop?.id,entityType:Uo.bA.PRODUCT,entityId:r.product?.id,slug:r.slug,hidden:!r.selectedShop?.needReinstall,children:"Reconnect shop"})]}),(0,t.jsx)(Tt.Button,{...i})]})}const Kt=Tt;var Ke=o(82910);function mo({forBrandPartner:e,fromCollection:n,productId:s,skip:i,hideTour:r}){const l=p.useCatalogProduct({productId:s,forBrandPartner:e,fromCollection:n,skip:i,tracking:!0});return(0,t.jsxs)(p.Provider,{...l,children:[(0,t.jsxs)(T.A,{width:"100%",gap:2,ref:l.bodyRef,children:[(0,t.jsx)(p.Layout,{children:(0,t.jsxs)(p.Split,{children:[(0,t.jsx)(p.Images,{}),(0,t.jsxs)(T.A,{width:"100%",gap:2,children:[(0,t.jsxs)(T.A,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:2,children:[(0,t.jsx)(p.Title,{}),(0,t.jsx)(dt,{productId:s,variant:"text"})]}),(0,t.jsx)(p.Section,{title:"Product Overview",children:(0,t.jsx)(p.Info,{})}),(0,t.jsx)(p.Section,{title:"Colors",children:(0,t.jsx)(p.Colors,{})}),(0,t.jsx)(p.Section,{title:"Sizes",children:(0,t.jsx)(p.Sizes,{})}),!!l.product?.techPackId&&(0,t.jsx)(p.Section,{title:"Embroidery",children:(0,t.jsx)(p.Embroidery,{})}),(0,t.jsx)(p.Section,{title:"Pricing",children:(0,t.jsx)(p.Pricing,{})}),(0,t.jsxs)(p.Section,{title:"Customize",children:[(0,t.jsx)(Ke.A,{productId:s,variantId:l.selectedVariantId,disabled:!l.selectedVariantId,children:"Add to Development Studio"}),(0,t.jsx)(_t,{productId:s,color:"inherit",uppercase:!0,fullWidth:!0,children:"Manage Barcodes and Titles"})]}),!!l.showIntegrationSection&&(0,t.jsx)(p.Section,{title:"Shopify Integration",children:(0,t.jsx)(Kt,{productId:s,variantLimit:2048,color:"inherit",uppercase:!0,fullWidth:!0,children:"Create Product in Shopify"})})]})]})}),(0,t.jsx)(et,{productId:s,marginTop:2}),(0,t.jsx)(p.TechPackDetails,{marginTop:2})]}),!r&&(0,t.jsx)(p.Tour,{})]})}function jn({productId:e,...n}){const s=(0,L.G)(E.oB);if(e)return(0,t.jsx)(ho.k2,{to:Gt.Ay.catalogProduct(e,s?.slug),onClick:i=>i.stopPropagation(),...n})}function fo({forBrandPartner:e,fromCollection:n,productId:s,skip:i}){const r=p.useCatalogProduct({productId:s,forBrandPartner:e,fromCollection:n,skip:i,tracking:!0});return(0,t.jsx)(p.Provider,{...r,isMobile:!0,children:(0,t.jsxs)(T.A,{width:"100%",gap:2,ref:r.bodyRef,children:[(0,t.jsx)(p.Layout,{children:(0,t.jsxs)(T.A,{width:"100%",gap:2,children:[(0,t.jsxs)(T.A,{flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:2,children:[(0,t.jsx)(dt,{productId:s}),(0,t.jsx)(p.Title,{})]}),(0,t.jsxs)(p.Section,{title:"Product Overview",children:[(0,t.jsx)(p.Info,{}),(0,t.jsx)(ge.A,{}),(0,t.jsx)(p.Images,{hideSelectedColor:!0})]}),(0,t.jsx)(p.Section,{title:"Colors",children:(0,t.jsx)(p.Colors,{})}),(0,t.jsx)(p.Section,{title:"Sizes",children:(0,t.jsx)(p.Sizes,{})}),!!r.product?.techPackId&&(0,t.jsx)(p.Section,{title:"Embroidery",children:(0,t.jsx)(p.Embroidery,{})}),(0,t.jsx)(p.Section,{title:"Pricing",children:(0,t.jsx)(p.Pricing,{})}),(0,t.jsxs)(p.Section,{title:"Customize",children:[(0,t.jsx)(Ke.A,{productId:s,variantId:r.selectedVariantId,disabled:!r.selectedVariantId,children:"Add to Development Studio"}),(0,t.jsx)(_t,{productId:s,color:"inherit",uppercase:!0,fullWidth:!0,children:"Manage Barcodes and Titles"})]}),!!r.showIntegrationSection&&(0,t.jsx)(p.Section,{title:"Shopify Integration",children:(0,t.jsx)(Kt,{productId:s,variantLimit:2048,color:"inherit",uppercase:!0,fullWidth:!0,children:"Create Product in Shopify"})})]})}),(0,t.jsx)(et,{productId:s}
40),(0,t.jsx)(p.TechPackDetails,{})]})})}var yn=o(61230),re=o(33672),In=o(3939);function Pn(){const{loading:e,product:n}=p.useContext(),s=(0,c.useMemo)(()=>[{target:`.${p.classes.Images.root}`,content:"Click to view product images",title:"Images",spotlightClicks:!0,disableBeacon:!0},{target:`.${p.classes.Title.root}`,content:"Product title",title:"Title",spotlightClicks:!0,disableBeacon:!0},{target:`.${p.classes.Info.root}`,content:"Product information",title:"Product Info",disableBeacon:!0},{target:`.${p.classes.Colors.root}`,content:"Available colors",title:"Colors",disableBeacon:!0},{target:`.${p.classes.Sizes.root}`,content:"Available sizes",title:"Sizes",disableBeacon:!0},{target:`.${p.classes.Pricing.root}`,content:"Pricing information",title:"Pricing",disableBeacon:!0},{target:`.${Ke.C.root}`,title:"Development Studio",content:"Go through Development Studio to get more customization",disableBeacon:!0}],[]);return(0,t.jsx)(re.Ay,{id:re.Li.catalogProduct,steps:s,hidden:e||!n?.id,children:({runTour:i,modal:r})=>(0,t.jsxs)(re.Ay.Toolbar,{children:[(0,t.jsx)(re.Ay.Modal,{children:(0,t.jsx)(p,{productId:n?.id,tracking:!1,hideTour:!0})}),(0,t.jsxs)(yn.A,{label:"Need help?",startIcon:(0,t.jsx)(In.A,{}),uppercase:!0,children:[(0,t.jsx)(re.Ay.Button,{onClick:i,variant:"text",color:"inherit",shape:"default",children:"Tour Inline"}),(0,t.jsx)(re.Ay.Button,{onClick:r.open,variant:"text",color:"inherit",shape:"default",children:"Tour Modal"})]})]})})}var xo=o(27422),Tn=o(90973),bn=o(41778),go=o(23841),Je=o(95028),po=o(87084),pe=o(32123),Mn=o(65804),En=o(15016);function Ln({productId:e,fromCollection:n,forBrandPartner:s,skip:i,tracking:r,preselectDefaultVariant:l=!0}){const[a,h]=(0,c.useState)(),[m,f]=(0,c.useState)([]),x=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(!x?.current)return;const k=En.A.getNearestScrollableParent(x.current);k&&k.scrollTo({top:0,behavior:"smooth"})},[e]);const v=S.A.useCatalogItem(),{sizeId:j,colorId:g,setNotFound:I,setColorId:R,setSizeId:F,setColorWasChanged:K,loading:G}=v,P=(0,c.useMemo)(()=>({productId:e}),[e]),A=(0,L.G)(k=>(0,E.qM)(k,P)),z=(0,L.G)(E.EY),st=(0,c.useMemo)(()=>({variantId:a}),[a]),O=(0,L.G)(k=>(0,E.Ox)(k,st)),St=(0,L.G)(Je.im),J=!e||!(0,N.A)(z,e),{useProductQuery:wt}=lt.G,{isLoading:U,isError:bt}=wt({productId:e},{skip:!e||!!i}),{useSizesQuery:Ee}=go.h,{isFetching:Le,isError:ze}=Ee(void 0,{skip:!e||!!i}),{useColorsQuery:qe,useValuesQuery:_e}=go.h,{isLoading:to}=qe(),{isLoading:eo}=_e(void 0,{skip:!e}),{isLoading:Ae}=Mn.p.useInventoryFormDataQuery(void 0,{skip:!e||!!i}),{isLoading:gt}=(0,pe.M)({skipTrims:!0,skipLycras:!0,skipLabels:!0,skip:!!i}),{useBrandPartnerRecommendedProductsQuery:ns}=po.e,{isLoading:ss}=ns(),{useBrandPartnerOrderedProductQuery:rs}=po.e,{isLoading:is}=rs({productId:e},{skip:!e||!!i}),as=(0,L.G)(M.uP),{useShopListQuery:cs}=se.z,{isFetching:ls}=cs(),ds=(0,c.useMemo)(()=>a?(0,vt.A)(A?.variants?.[a]?.images):(0,vt.A)((0,u.A)(A?.images)),[a,A]),oo=G||U||Le||eo||to||Ae||gt||ss||is||ls,Do=(0,c.useMemo)(()=>({productId:e}),[e]),us=(0,L.G)(k=>(0,E.k0)(k,Do)),hs=(0,L.G)(k=>(0,E.IR)(k,Do)),ms=(0,c.useMemo)(()=>(0,vt.A)(A?.colors),[A]),fs=(0,c.useMemo)(()=>(0,vt.A)(A?.sizes),[A]),Fo=(0,bn.A)();return(0,c.useEffect)(()=>{if(n&&!J)return I(J)},[J]),(0,c.useEffect)(()=>{K(!1),R(void 0),F(null)},[e]),(0,c.useEffect)(()=>{if(oo||g||j)return;if(!A?.id||s&&!(0,N.A)(A.brandPartnerIds,St))return I(!0);const{defaultVariant:k}=A;if(!k?.id)return R(A?.colors?.[0]?.colorId);l&&(R(k.colorId),F(k.sizeId||null))},[A,oo]),(0,c.useEffect)(()=>{const k=A?.groupedVariants,Jt=g?(0,rt._)(k?.[g],{field:"sizeId"}):(0,vt.A)(A?.sizeIds);v.setAvailableSizeIds(Jt),v.setAvailableColorIds((0,xo.A)(k)),j&&!(0,N.A)(Jt,j)&&F(Jt?.[0])},[g,A]),(0,c.useEffect)(()=>{if(!j||g)return;const k=[];(0,xt.A)(A?.variants,Jt=>{Jt?.isActive&&Jt.sizeId===j&&Jt?.colorId&&!k.includes(Jt?.colorId)&&k.push(Jt.colorId)}),v.setAvailableColorIds(k)},[j,g]),(0,c.useEffect)(()=>{if(!g||!j)return h(void 0);const k=(0,Tn.A)(A?.variants,{colorId:g,sizeId:j,isActive:!0});if(k?.id)return h(k.id);h(void 0)},[g,j]),(0,c.useEffect)(()=>{!bt&&!ze||I(!0)},[bt,ze]),(0,c.useEffect)(()=>{!r||!e||Fo.product.opened({productId:e})},[r,e]),(0,c.useEffect)(()=>()=>{r&&Fo.product.closed({productId:e})},[]),{...v,forBrandPartner:s,fromCollection:n,colorSurcharges:hs,selectedVariantId:a,product:A,productId:e,sizeSurcharges:u
40s,images:ds,loading:oo,selectedVariant:O,bodyRef:x,defaultImageId:A?.image?.id,colors:ms,sizes:fs,title:A?.name,hasActiveVariants:!(0,$.A)(A?.groupedVariants),showIntegrationSection:!!A&&!!(0,Vt.A)(as)&&!(0,$.A)(A?.groupedVariants),embroideries:m,setEmbroideries:f}}var zn=o(81821);function Dn(){const{product:e,embroideries:n,setEmbroideries:s}=p.useContext();return(0,t.jsx)(zn.Ay,{techPackId:e?.techPackId,value:n,onChange:s})}function Fn(e){const{product:n,isMobile:s}=p.useContext();return(0,t.jsxs)(S.A.Info,{...e,children:[(0,t.jsxs)(T.A,{flexDirection:s?"column":"row",gap:s?1:6,children:[n?.fiberContent&&(0,t.jsx)(S.A.Info.Item,{label:"Fiber content",value:n?.fiberContent}),(0,t.jsx)(S.A.Info.Item,{label:"Gauge",value:n?.gaugeField?.label})]}),(0,t.jsx)(S.A.Info.Item,{label:"Description",value:n?.description})]})}const Bn=Fn;var Ao=o(85653),vo=o(39244),So=o(23008),Ze=o(31710),Co=o(46889),Rn=o(62852);function Vn({item:e,disabled:n,amount:s,minTotalAmount:i,embroideries:r,...l}){const a=Rn.A.calculateQtyByTotalAmount({pricing:e?.pricing,type:Ze.gK.JUST_IN_TIME,amount:s||0,minTotalAmount:i||0}),{setCartItem:h,removeAllCartItems:m}=So.F.actions,f=(0,Ao.j)(),x=R=>{f(h({item:R})),v("Added to Cart!")},{savedSnackbar:v}=(0,V.d)(),j=(0,L.G)(vo.fe),g=e?.id,I=()=>{j&&f(m());const R={id:g,qty:a,type:Ze.gK.JUST_IN_TIME,embroideries:[...r||[]]};x(R)};return(0,t.jsx)(Z.A,{onClick:I,disabled:!g||n,size:"large",startIcon:(0,t.jsx)(Co.A,{}),confirmOnClick:j,variant:"contained",color:"inherit",confirmProps:{title:"Your Cart will be cleared",children:(0,t.jsxs)(T.A,{children:[(0,t.jsx)(oe.A.Message,{children:"You have \u201COn Demand\u201D items in your cart."}),(0,t.jsx)(oe.A.Message,{children:"To add \u201CJust In Time\u201D item your cart have to be cleared"})]})},fullWidth:!0,...l})}const Nn=Vn;function On({item:e,disabled:n,qty:s,embroideries:i,...r}){const l=e?.id,{setCartItem:a,removeAllCartItems:h}=So.F.actions,m=(0,Ao.j)(),{savedSnackbar:f}=(0,V.d)(),x=g=>{m(a({item:g})),f("Added to Cart!")},v=(0,L.G)(vo.f1),j=()=>{const g={qty:s,id:l,type:Ze.gK.ON_DEMAND,embroideries:[...i||[]]};v&&m(h()),x(g)};return(0,t.jsx)(Z.A,{onClick:j,disabled:!l||n,size:"large",startIcon:(0,t.jsx)(Co.A,{}),confirmOnClick:v,variant:"contained",confirmProps:{title:"Your Cart will be cleared",children:` 41 You have "Just In Time" items in your cart. 42 To add "On Demand" item your cart have to be cleared 43 `},fullWidth:!0,...r})}const jo=On;var Xe=o(87924),we=o(4855),Wn=o(33318);function yo(){const{product:e,selectedVariant:n,embroideries:s=[]}=p.useContext(),i=(0,L.G)(Wn.ro),r=(0,L.G)(Je.cO),[l,a]=(0,c.useState)(1),[h,m]=(0,c.useState)(i),[f,x]=(0,c.useState)(1),v=()=>!!e?.pricing?.jit?.base,j=()=>r?!!e?.pricing?.retail?.base:!!e?.pricing?.od?.base;return{minJitTotalAmount:i,onJitAmountChange:m,onRetailQtyChange:x,product:e,jitAmount:h,isRetail:r,selectedVariant:n,onOdQtyChange:a,canAddJitItem:v(),odQty:r?f:l,canAddOdItem:j(),embroideries:s}}const Io={root:"CatalogProduct__Pricing"};Po.useProductPricing=yo;function Po({className:e,...n}){const{onJitAmountChange:s,product:i,jitAmount:r,isRetail:l,selectedVariant:a,onRetailQtyChange:h,odQty:m,onOdQtyChange:f,canAddOdItem:x,canAddJitItem:v,minJitTotalAmount:j,embroideries:g}=yo(),I=jt()(Io.root,e),R=()=>!a?.id&&"Select both size and color!";return(0,t.jsxs)(T.A,{gap:2,className:I,...n,children:[l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(T.A,{gap:2,children:[(0,t.jsx)(Xe.A,{data:a?.pricing?.retail,title:"Retail",onQtyChange:h,breakdownType:we.Th.QUANTITY,padding:0,hideBreakdowns:!0}),(0,t.jsx)(jo,{tooltip:R(),item:a,qty:m,hidden:!x,color:"primary",uppercase:!0,embroideries:g,children:"Add to cart"})]}),(0,t.jsx)(ge.A,{})]}),(0,t.jsxs)(T.A,{gap:2,flexDirection:l?"column-reverse":"column",children:[(0,t.jsxs)(T.A,{gap:2,children:[(0,t.jsx)(Xe.A,{data:a?.pricing?.od,title:"On-Demand",breakdownTitle:"OD pricing breakdown",breakdownType:we.Th.QUANTITY,onQtyChange:f,totalOrdered:i?.ordered?.total,inactive:l,padding:0}),(0,t.jsx)(jo,{tooltip:R(),item:a,qty:m,hidden:!x,color:"primary",disabled:l,uppercase:!0,embroideries:g,children:"Add to On-Demand PO"})]}),(0,t.jsx)(ge.A,{}),(0,t.jsxs)(T.A,{gap:2,children:[(0,t.jsx)(Xe.A,{data:a?.pricing?.jit,title:"Bulk",breakdownTitle:"Bulk pricing breakdown",minQty:j,onQtyChange:s,breakdownType:we.Th.SPEND_AMOUNT,step:2500,padding:0}),(0,t.jsx)(Nn,{tooltip:R(),item:a,hidden:!v,shape:"round",amount:r,minTotalAmount:j,variant:"outlined",uppercase:!0,embroideries:g,children:"Add to Bulk PO"})]})]})]})}const Gn=Po;var Hn=o(24978),Qn=o(17857),To=o(49497),bo=o(8976);function kn({variant:e,className:n,...s}){const i=jt()("BPVariant__ListItem",n);return(0,t.jsxs)(Ft.A.CompactItem,{className:i,gap:.5,...s,children:[!!e?.brandPartnerSku&&(0,t.jsx)(Ft.A.CompactItem.Title,{children:(0,t.jsx)(bo.A,{value:e?.brandPartnerSku,variant:"text",color:"inherit",sx:{fontSize:"inherit"},children:e?.brandPartnerSku})}),(0,t.jsx)(Ft.A.CompactItem.Description,{children:e?.name}),(0,t.jsxs)(T.A,{flexDirection:"row",gap:1,alignItems:"center",width:"100%",children:[(0,t.jsx)(Ft.A.CompactItem.Description,{children:e?.
43sizeName}),(0,t.jsx)($t.A,{color:e?.color,width:28})]})]})}const Un=kn;function $n({variants:e,loading:n,isMobile:s=_.A.isMobile,...i}){const r=[{field:"name",label:"Style name",span:9,renderField:l=>(0,t.jsxs)(T.A,{direction:"row",gap:1,alignItems:"center",children:[(0,t.jsx)($t.A,{color:l?.color}),(0,t.jsx)(Ht.A,{variant:"body2",children:l?.name})]})},{label:"Size",field:"sizeName",span:3},{field:"brandPartnerSku",label:"SKU",span:12,renderField:l=>(0,t.jsx)(bo.A,{value:l.brandPartnerSku,hidden:!l?.brandPartnerSku,variant:"text",color:"inherit",sx:{fontSize:"inherit"},children:l.brandPartnerSku})}];return(0,t.jsx)(Ft.A,{config:r,hideHeader:s,items:e,loading:n,extraRightWidth:100,bodyStyle:{gap:s?8:0},renderItem:s?(l=>(0,t.jsx)(Un,{variant:l})):void 0,...i})}const Yn=$n;var te=o(30025),Kn=o(54858),Mo=o(99041);function Eo(){const{productId:e,isMobile:n,setLoading:s,loading:i}=p.useContext(),r=(0,L.G)(Je.im),{isFetching:l,productTechPackId:a,techPackLoaded:h}=Mo.Yp.useProductTechPackQuery({productId:e},{skip:!e,selectFromResult:v=>({productTechPackId:v?.data?.techPack?._id,isFetching:v?.isFetching,techPackLoaded:v?.isSuccess})}),m=(0,Kn.b)({brandPartnerId:r,techPackId:a,urlBased:!1}),f=m.loading||l,{techPackLazyLoading:x}=Mo.Yp.useProductTechPackQuery({productId:e,only:m.lazyFields},{skip:!e||!m.lazyFields?.length,selectFromResult:v=>({techPackLazyLoading:v?.isFetching})});return(0,c.useEffect)(()=>{s(f)},[f]),(0,c.useEffect)(()=>{m.setLazyFieldsLoading(x)},[x]),{...m,techPackLoaded:h,isMobile:n,loading:i||f}}var be=o(11397),Me=o(62456);function Jn({variantId:e,...n}){const{isFetching:s}=(0,pe.M)({skipYarns:!0,skipLycras:!0,skipTrims:!0}),i=(0,c.useMemo)(()=>({variantId:e}),[e]),r=(0,L.G)(a=>(0,E.th)(a,i)),l=[{field:"data.system_name",label:"System Name",span:12},{field:"data.name",label:"Label Name",span:12}];if(!(!r?.label?.length&&!s))return(0,t.jsx)(Ft.A,{fetching:s,config:l,extraLeftWidth:50,showEmpty:!1,className:"yarn-info",items:r?.label,extraLeft:a=>(0,t.jsxs)(t.Fragment,{children:[!!a?.data?.previewImageSrc&&(0,t.jsx)(be.A,{maxHeight:40,src:a?.data?.previewImageSrc,preview:{src:a?.data?.image?.highResolutionSrc}}),!a?.data?.previewImageSrc&&(0,t.jsx)(Me.A,{fontSize:"large"})]}),hideFooter:!0,...n})}const Zn=Jn;function Xn({variantId:e,...n}){const{isFetching:s}=(0,pe.M)({skipTrims:!0,skipYarns:!0,skipLabels:!0}),i=(0,c.useMemo)(()=>({variantId:e}),[e]),r=(0,L.G)(a=>(0,E.th)(a,i)),l=[{field:"data.system_name",label:"Lycra Name",span:4},{field:"data.mill",label:"Mill",span:4,renderField:a=>a?.data?.millName},{field:"data.mill_color_name",label:"Mill Color",span:7,renderField(a){return(0,t.jsxs)(T.A,{flexDirection:"row",gap:1,alignItems:"center",children:[(0,t.jsx)($t.A,{color:a?.data?.color}),(0,t.jsx)(Ht.A,{variant:"body2",children:a?.data?.colorName||a?.data?.mill_color_name})]})}},{field:"data.fiberContentField.name",label:"Fiber Content",span:6},{field:"data.size",label:"Size",span:3}];if(!(!r?.lycra?.length&&!s))return(0,t.jsx)(Ft.A,{fetching:s,config:l,className:"yarn-info",extraLeftWidth:50,showEmpty:!1,items:r?.lycra,extraLeft:a=>(0,t.jsxs)(t.Fragment,{children:[!!a?.data?.previewImageSrc&&(0,t.jsx)(be.A,{maxHeight:40,src:a?.data?.previewImageSrc,preview:{src:a?.data?.image?.highResolutionSrc}}),!a?.data?.previewImageSrc&&(0,t.jsx)(Me.A,{fontSize:"large"})]}),hideFooter:!0,...n})}const wn=Xn;function qn({variantId:e,...n}){const{isFetching:s}=(0,pe.M)({skipYarns:!0,skipLycras:!0,skipLabels:!0}),i=(0,c.useMemo)(()=>({variantId:e}),[e]),r=(0,L.G)(a=>(0,E.th)(a,i)),l=[{field:"data.system_name",label:"System Name",span:12},{field:"data.name",label:"Trim Name",span:12}];if(!(!r?.trim?.length&&!s))return(0,t.jsx)(Ft.A,{fetching:s,config:l,extraLeftWidth:50,showEmpty:!1,className:"yarn-info",items:r?.trim,extraLeft:a=>(0,t.jsxs)(t.Fragment,{children:[!!a?.data?.previewImageSrc&&(0,t.jsx)(be.A,{maxHeight:40,src:a?.data?.previewImageSrc,preview:{src:a?.data?.image?.highResolutionSrc}}),!a?.data?.previewImageSrc&&(0,t.jsx)(Me.A,{fontSize:"large"})]}),hideFooter:!0,...n})}const _n=qn;function ts({variantId:e,...n}){const{isFetching:s}=(0,pe.M)({skipTrims:!0,skipLycras:!0,skipLabels:!0}),i=(0,c.useMemo)(()=>({variantId:e}),[e]),r=(0,L.G)(a=>(0,E.th)(a,i)),l=[{field:"data.system_name",label:"Yarn Name",span:4},{field:"data.mill",label:"Mill",span:4,renderField:a=>a?.data?.millName},{field:"data.mill_color_name",label:"Mill Color",span:7,renderField(a){return(0,t.jsxs)(T.A,{flexDirection:"row",gap:1,alignItems:"center",children:[(0,t.jsx)($t.A,{color:a?.data?.color}),(0,t.jsx)(Ht.A,{variant:"body2",children:a?.data?.colorName||a?.data?.mill_color_name})]})}},{field:"data.fiberContentField.name",label:"Fiber Content",span:6},{field:"data.size",label:"Size",span:3}];if(!(!r?.yarn?.length&&!s))return(0,t.jsx)(Ft.A,{fetching:s,config:l,className:"yarn-info",items:r?.yarn,extraLeftWidth:50,extraLeft:a=>(0,t.jsxs)(t.Fragment,{children:[!!a?.data?.previewImageSrc&&(0,t.jsx)(be.A,{maxHeight:40,src:a?.data?.previewImageSrc,preview:{src:a?.data?.image?.highResolutionSrc}}),!a?.data?.previewImageSrc&&(0,t.jsx)(Me.A,{fontSize:"large"})]}),hideFooter:!0,...n})}const es=ts;
43zo.useTechPackDetails=Eo;const Lo={tech_details:"Tech Details",yarn_info:"Yarn & Trims",specs:"Specs",grading:"Grade",label_placement:"Label",sku_codes:"SKU"};function zo(e){const n=Eo(),s=(0,To.I)(F=>F.TECH_PACK_GRADING__READ),i=(0,To.I)(F=>F.PRODUCT_VARIANTS_SKU__READ),{selectedVariantId:r,product:l}=p.useContext(),{loading:a,techPack:h,isMobile:m,techPackLoaded:f}=n,[x,v]=(0,c.useState)("tech_details"),j=F=>{const K=(0,lo.A)(F)?F(x):F;v(G=>!K||G===K?G:K)},g={tech_details:()=>(0,t.jsx)(te.A.Section.TechDetails,{transparent:!0}),specs:te.A.Subsection.Specification,grading:te.A.Subsection.GradingRules,yarn_info:()=>(0,t.jsxs)("div",{children:[(0,t.jsx)(es,{variantId:r,title:"Yarns",stickyHeader:!1,sx:{overflowY:"hidden"}}),(0,t.jsx)(wn,{variantId:r,title:"Lycras",stickyHeader:!1,sx:{overflowY:"hidden"}}),(0,t.jsx)(_n,{variantId:r,stickyHeader:!1,title:"Trims",sx:{overflowY:"hidden"}}),(0,t.jsx)(Zn,{variantId:r,stickyHeader:!1,title:"Labels",sx:{overflowY:"hidden"}})]}),label_placement:()=>(0,t.jsx)(te.A.Subsection,{subSectionKey:te.A.Subsection.LabelInstructions.subSectionKey,viewComponent:(0,t.jsx)(te.A.Subsection.LabelInstructions.CustomInstructions,{fallbackToDefault:!0})}),sku_codes:()=>(0,t.jsxs)(T.A,{children:[!(0,$.A)(l?.groupedVariants)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.A,{flexDirection:m?"column":"row",justifyContent:m?"center":"flex-end",width:"100%",gap:1,children:(0,t.jsx)(Xt,{productId:h?.productData?.id,variantLimit:2048,variant:"text",color:"primary",size:"large",uppercase:!0,children:"Export Variants"})}),(0,t.jsx)(ge.A,{})]}),(0,t.jsx)(Yn,{variants:h?.productData?.variants})]})},I=(0,c.useMemo)(()=>(0,xo.A)(Lo),[]),R=(0,c.useMemo)(()=>g[x||"tech_details"],[x,r,h]);return(0,t.jsx)(te.A.Provider,{...n,children:(0,t.jsxs)(T.A,{position:"relative",gap:3,...e,children:[!h?.id&&f&&(0,t.jsx)(Hn.A,{}),!!h?.id&&(0,t.jsx)(pt.A,{padding:2,bodySx:{padding:0},children:(0,t.jsx)(C.A,{options:I,value:x,onChange:j,getOptionLabel:F=>Lo[F],getOptionDisabled:F=>F==="grading"?!s:F==="sku_codes"?!i:!1,contentContainerProps:{display:m?"grid":"flex",gridTemplateColumns:"repeat(3, 1fr)"},contentFlexWrap:"wrap",contentJustifyContent:"space-around",contentGap:F=>F.spacing(1),buttonProps:{uppercase:!0,size:m?"small":"medium"},nonSelectedButtonProps:{variant:"text",color:"inherit"},hideIcon:!0,borderLess:!0})}),(0,t.jsx)(Qn.A,{loading:a}),!a&&(0,t.jsx)(R,{})]})})}const os=zo;q.useContext=S.A.useContext,q.Provider=S.A.Provider,q.Images=S.A.Images,q.Title=S.A.Title,q.Colors=S.A.Colors,q.Sizes=S.A.Sizes,q.Layout=S.A.Layout,q.Split=S.A.Split,q.Section=S.A.Section,q.Pricing=Gn,q.TechPackDetails=os,q.useCatalogProduct=Ln,q.Info=Bn,q.Tour=Pn,q.Desktop=mo,q.Mobile=fo,q.Embroidery=Dn,q.Link=jn,q.classes={...S.A.classes,Pricing:Io};function q(e){const n=_.A.isMobile?fo:mo;return(0,t.jsx)(n,{...e})}const p=q},34770(ie,Bt,o){o.d(Bt,{A:()=>lt});var t=o(74848),S=o(81662),_=o(30995),Ct=o(96540),jt=o(2454),Nt=o(77940),c=o(51998);function Z({shopId:E,slug:at,entityId:Mt,entityType:Et}){const dt=(0,Ct.useMemo)(()=>({shopId:E}),[E]),$=(0,jt.G)(rt=>(0,c.bx)(rt,dt)),{useReconnectShopMutation:X}=Nt.z,[ht,{isLoading:Rt,isSuccess:pt,data:Wt,reset:Gt}]=X();return(0,Ct.useEffect)(()=>{pt&&Wt?.redirect&&(window.location.href=Wt.redirect)},[pt]),{shop:$,onClick:()=>{$?.id&&ht({shopId:$.id,body:{slug:at,entityId:Mt,entityType:Et}})},afterClose:()=>{Gt()},loading:Rt}}var L=o(11201),V=o(45586);function Ot(E){return(0,t.jsx)(L.A,{color:"primary",variant:"contained",startIcon:(0,t.jsx)(V.A,{}),...E})}tt.useConnectShopify=Z,tt.Button=Ot;function tt({shopId:E,slug:at,entityType:Mt,entityId:Et,withDescription:dt=!0,hidden:$,...X}){const{onClick:ht}=Z({shopId:E,slug:at,entityType:Mt,entityId:Et});return(0,t.jsxs)(_.A,{hidden:$,gap:2,width:"100%",maxWidth:500,marginInline:"auto",children:[dt&&(0,t.jsx)(S.A,{error:"To activate these features, Shopify requires you to reauthorize the app with updated permissions. Please reconnect now to continue.",type:"warning"}),(0,t.jsx)(Ot,{onClick:ht,...X})]})}const lt=tt},51538(ie,Bt,o){o.d(Bt,{ru:()=>S,c1:()=>t,bA:()=>_});const t={QUEUED:"queued",IN_PROGRESS:"in_progress",SUCCEEDED:"succeeded",FAILED:"failed"},S={[t.QUEUED]:"Queued",[t.IN_PROGRESS]:"Exporting\u2026",[t.SUCCEEDED]:"Succeeded",[t.FAILED]:"Failed"},_={PRODUCT:"product"},Ct=2048},51998(ie,Bt,o){var t=o(8058),S=o(42531),_=o(21879),Ct=o(59116),jt=o(62315),Nt=o(48182),c=o(96443),Z=o(33318),L=o(51538),V=o(25508),Ot=o(66430);const tt=d=>d[Ot.r.name],lt=(0,V.Mz)(d=>tt(d),d=>d.shops),E=(0,V.Mz)(d=>tt(d),d=>lt(d)?.ids,(d,y)=>d.currentShopId&&(0,S.A)(y,d.currentShopId)?d.currentShopId:(0,Nt.A)(y?.[0])||void 0),at=(0,V.Mz)(d=>lt(d)?.entities||{},d=>E(d),d=>(0,Z.PZ)(d),(d,y,W)=>{const w={};return(0,t.A)(d,H=>{if(!H?._id)return;const et=H?.display_domain||H?.domain||"",Lt=H?.brand_partner?W[H.brand_partner]:void 0;w[H._id]={...H,brandPartner:Lt,isSelected:H._id===y,id:H._id,name:et.replace(/\b\.myshopify\.com\b(?!.*?\b\.myshopify\.com\b)/,"")}}),w}),Mt=(0,V.Mz)(d=>tt(d),d=>d.shopifyProducts),Et=(0,V.Mz)(d=>Mt(d)?.entities||{},d=>{const y={};return(0,t.A)(d,W=>{W?.id&&(y[W.id]=W)}),y}),dt=(0,V.Mz)((d,y)=>y?.productIds,d=>Et(d),(d,y)=>{if(!(!Array.isArray(d)||!d?.length))return(0,jt.A)(y,d)}),$=(0,V.Mz)(d=>tt(d),d=>d.shopifyProductMappings?.entities),X=(0,V.Mz)(d=>$(d),d=>({...d})),ht=(0,V.Mz)(d=>X(d),d=>{const y={};return(0,t.A)(d,W=>{!W?.id||!W?.variant||(y[W.variant]||(y[W.variant]={}),y[W.variant][W.id]=W)}),y}),Rt=(0,V.Mz)(d=>at(d),(d,y)=>y?.shopId,(d,y)=>{if(!(!y||!d))return d[y]}),pt=(0,V.Mz)(d=>tt(d),d=>d.productExportRecords),Wt=(0,V.Mz)(d=>pt(d)?.entities||{},d=>
43at(d),(d,y)=>{const W={};return(0,t.A)(d,w=>{if(!w?._id)return;const H=w?.shop?y?.[w.shop]:void 0;W[w._id]={...w,id:w._id,shopName:H?.name}}),W}),Gt=(0,V.Mz)((d,y)=>y?.recordIds,d=>Wt(d),(d,y)=>{if(!(!Array.isArray(d)||!d?.length))return(0,jt.A)(y,d)}),At=d=>(0,_.A)(d)?d:0,ut=(0,V.Mz)(d=>tt(d)?.onboardingStats,d=>{const y={stores:At(d?.total?.stores),products:At(d?.total?.products),orders:At(d?.total?.orders),fulfilled:At(d?.total?.fulfilled)},W={products:At(d?.thisWeek?.products),orders:At(d?.thisWeek?.orders)},w=[y.stores>0,y.products>0,y.orders>0];let H=0;for(const yt of w){if(!yt)break;H+=1}const et=H===w.length,Lt=yt=>yt<H?"done":yt===H?"active":"locked";return{totals:y,weekly:W,completed:H,activeStep:H,isEstablished:et,stepStatuses:{connect:Lt(0),export:Lt(1),orders:Lt(2)}}}),rt=(0,V.Mz)(d=>tt(d)?.productExportFilters,d=>at(d),(d,y)=>{const W=(0,Ct.A)(y,w=>w?.name);return(0,c._)({filters:d,overrideValueLabels:{shops:W,statuses:L.ru}})});o.d(Bt,["B5",0,E,"Hx",0,Et,"bx",0,Rt,"ki",0,rt,"uP",0,at,"xK",0,Gt,"xZ",0,ht,"zZ",0,ut])},82910(ie,Bt,o){o.d(Bt,{C:()=>at,A:()=>Et});var t=o(74848),S=o(46942),_=o.n(S),Ct=o(96540),jt=o(11201),Nt=o(2454),c=o(427),Z=o(20440),L=o(72763),V=o(14836),Ot=o(27354),tt=o(99041
43),lt=o(35496),E=o(60849);const at={root:"AddToDevStudioButton"};function Mt({productId:dt,variantId:$,loading:X,className:ht,...Rt}){const pt=(0,L.A)(),Wt=(0,c.A)(),Gt=_()(at.root,ht),At=(0,Ct.useMemo)(()=>({variantId:$}),[$]),ut=(0,Nt.G)(et=>(0,Ot.Ox)(et,At)),{useAddToDevStudioMutation:rt}=tt.Yp,[d,{isLoading:y,techPackId:W}]=rt({selectFromResult:et=>({isLoading:et?.isLoading,techPackId:et?.data?.techPack?._id})}),w=()=>{if(dt)return d({productId:dt})};if((0,Ct.useEffect)(()=>{if(!W)return;const et=lt.Ay.myDevelopmentCreate(W),Lt=$?`?${new URLSearchParams({variantId:`${$}`}).toString()}`:"";Wt.redirect(`${et}${Lt}`)},[W]),!pt.can(pt.list.REQUESTS_FROM_PRODUCT__CREATE))return(0,t.jsx)(V.A,{size:"large",loading:y,shape:"round",hidden:!dt||!pt.can(pt.list.REQUESTS__CREATE),fullWidth:!0,...Rt});const H=()=>ut?.colorway?(0,t.jsx)(Z.A,{color:ut.color,width:30,isSelected:!0,hideArrow:!0}):(0,t.jsx)(E.A,{});return(0,t.jsx)(jt.A,{className:Gt,onClick:w,loading:y||X,startIcon:H(),color:"inherit",hidden:!dt,uppercase:!0,fullWidth:!0,...Rt})}const Et=Mt}}]);
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.