1!function(){try{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]="9c3cd0c1-0eb2-4982-85ee-948a78fd0669",e._sentryDebugIdIdentifier="sentry-dbid-9c3cd0c1-0eb2-4982-85ee-948a78fd0669")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2219],{11555:(e,t,n)=>{"use strict";let r;n.d(t,{c:()=>F});var s=n(67112),i=n(38375),o=n(40644),a=n(95059),l=n(1474),c=n(2260),d=n(36142),u=n(72532),p=n(61237),m=n(35185),h=n(48017),f=n(82324),g=n(46242),v=n(94970);class b extends v.m{}class w extends Error{constructor(...e){super(...e),this.name="PrintessError"}}class y extends w{constructor(...e){super(...e),this.name="PrintessLoaderNotLoadedError"}}class P extends w{constructor(...e){super(...e),this.name="PrintessLoadingError"}}class x extends w{constructor(...e){super(...e),this.name="PrintessNotLoadedError"}}class _ extends w{constructor(...e){super(...e),this.name="PrintessEditorAlreadyConnectedError"}}class C extends w{constructor(...e){super(...e),this.name="PrintessConfigMissingError"}}var k=n(23081),T=n(62354);class j{get config(){let{printessConfig:e}=k.i;if(!e)throw new C("Printess config not available. Add config to storeConfig.");return e}async do(e){let t=()=>{throw new P("Printess operation aborted")};this.controller.signal.addEventListener("abort",t);try{return await e()}finally{this.controller.signal.removeEventListener("abort",t)}}async mount(e,t){this.controller&&(this.controller.abort(),this.controller=new AbortController),await this.do(async()=>{if(window.printessLoader)return;let e=document.createElement("script");e.type="module",e.innerHTML='if(!window.printessLoader){window.printessLoader = await import("https://editor.printess.com/v/3.2.18/printess-editor/loader.js");}',document.body.appendChild(e),await new Promise((e,t)=>{let n=setInterval(()=>{window.printessLoader&&(clearInterval(n),clearTimeout(r),e())},100),r=setTimeout(()=>{clearInterval(n),t(new y("Printess loader script not loaded"))},5e3)})}),await this.do(async()=>{if(!this.node){let e=document.createElement("div");e.style.position="absolute",e.style.width="inherit",e.style.height="inherit",e.style.inset="0",this.node=e}if(this.node.isConnected)throw new _("Printess does not support mounting the web component multiple times on a single page");e.appendChild(this.node)}),await this.do(async()=>{if(!this.api){if(!window.printessLoader)throw new P("Printess loader not loaded");this.api=await window.printessLoader.load({basketId:(0,T.Q)(),container:this.node,formFields:[],offensiveCheckAll:!0,templateName:t.name,formFieldProperties:t.properties,priceCategoryLabels:t.categories,mergeTemplates:[],token:this.config.token,theme:this.config.theme,suppressLoadingAnimation:!0,translationKey:new Intl.Locale(this.locale).language,translations:{ui:{buttonBasket:this.t("apply"),personalisation:this.t("printessPersonalisationModalTitle")}},resourcePath:this.config.resourcePath,noUserInteractionOnStage:!0,priceChangeCallback:e=>{var t;for(let n of null!=(t=this.listeners.get("price-change"))?t:new Set)n(e)},addToBasketCallback:(e,t)=>{var n;for(let r of null!=(n=this.listeners.get("add-to-basket"))?n:new Set)r(e,t)}})}}),await this.do(async()=>{if(!this.api)throw new P("Printess API not initialized");this.api.api.loadTemplateAndFormFields(t.name,void 0,void 0,t.categories,t.properties),this.api.api.setPriceCategoryLabels(t.categories),this.api.ui.loadTheme(this.config.theme),await new Promise(e=>{setTimeout(()=>{e()},1e3)})})}update(e,t){if(!this.api)throw new x("Cannot update Printess UI if it is not loaded, printess.load() must be called first");this.api.ui.refreshPriceDisplay({price:"".concat(this.t("total"),": ").concat(e),legalNotice:this.getLegalNotice(t),infoUrl:this.config.infoUrl?'<a href="'.concat(this.config.infoUrl,'" target="_blank" rel="noopener noreferrer">').concat(this.t("getDetails"),"</a>"):""})}getLegalNotice(e){let t=document.createElement("ul");t.classList.add("printess-legal-notice");let n=document.createElement("li");if(n.innerText=this.t("printessLegalNoticeRefund"),t.appendChild(n),(null==e?void 0:e.trim())==="Domestic Replica Shirts"||(null==e?void 0:e.trim())==="International Replica Shirts"||(null==e?void 0:e.trim())==="Domestic Replica Minikits"||(null==e?void 0:e.trim())==="International Replica Minikits"){let e=document.createElement("li");e.innerText=this.t("printessLegalNoticeFootballShirt"),t.appendChild(e)}
1let r=document.createElement("li");return r.innerText=this.t("printessLegalNoticeProcessing"),t.appendChild(r),t.outerHTML}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);let n=this.listeners.get(e);n&&n.add(t)}off(e,t){let n=this.listeners.get(e);n&&n.delete(t)}constructor(e,t){this.t=e,this.controller=new AbortController,this.listeners=new Map,this.locale=t.locale}}let L=new WeakMap;var N=n(37209),S=n.n(N);let E=e=>{let{colourCode:t,saveToken:n,onPriceChange:a,onSubmit:c,target:p,subCategory:m}=e,{t:h}=(0,i.Bd)(),[f,v]=(0,o.useState)(!1),{template:w}=(0,u.OT)({colourCode:t});(0,u.gk)(w);let{locale:y,currency:P}=(0,l.f)(),x=(0,o.useMemo)(()=>{var e;return null!=(e=w.formFieldProperties)?e:[]},[w.formFieldProperties]),_=((e,t)=>{let n,s=(0,o.useRef)(t),{t:a}=(0,i.Bd)(),{locale:c}=(0,l.f)();r||(r=new j(a,{locale:c}));let d=((e,t,n)=>{let r=L.get(t);return r||(r={status:"pending",suspender:new Promise((r,s)=>{e.mount(t,n).then(()=>{L.set(t,{status:"resolved",suspender:void 0}),r()}).catch(e=>{L.set(t,{status:"rejected",suspender:void 0}),s(e)})})},L.set(t,r)),r})(r,e,s.current);if("pending"===d.status)throw d.suspender;if("resolved"===d.status&&(n=r),!n)throw new b;return{on:n.on.bind(n),off:n.off.bind(n),update:n.update.bind(n)}})(p,{name:n||t,properties:x,categories:(0,o.useMemo)(()=>w.priceCategoryLabels.reduce((e,t)=>{let{label:n,name:r}=t;return e[n]=r,e},{}),[w.priceCategoryLabels])});return((0,o.useEffect)(()=>{n||_.update((0,d.BU)({currency:P,centPrice:0,locale:y}))},[P,y,_,n]),(0,o.useEffect)(()=>{let e=e=>{let t=[],n=0;x.forEach(r=>{let s=e.priceRelevantFormFields[r.name];""!==s.value&&r.price&&r.priceDisplay&&("checkbox"===s.type?n+="true"===s.value?r.price.centAmount:0:r.hasPerLetterPricing?n+=r.price.centAmount*s.value.length:n+=r.price.centAmount),t.push({fieldName:r.name,value:s.value})}),_.update((0,d.BU)({currency:P,centPrice:n,locale:y}),m),a({price:{centAmount:n,currency:P},customizations:t})},t=async(e,t)=>{v(!0),new Promise(e=>setTimeout(e,1e3)),c({saveToken:e,thumbnailUrl:t}),v(!1)};return _.on("price-change",e),_.on("add-to-basket",t),()=>{_.off("price-change",e),_.off("add-to-basket",t)}},[_,x,y,a,c,h,P,m]),f)?(0,s.jsx)("div",{className:S().overlay,children:(0,s.jsx)(g.U,{isLoading:!0})}):null},A=e=>{let{children:t}=e,{t:n}=(0,i.Bd)();return(0,s.jsx)(f.g,{children:e=>{let{error:r}=e;if(r)if(r instanceof w||r instanceof p.u||r instanceof b)return(0,s.jsxs)("div",{className:S().error,children:[(0,s.jsx)(h.o,{variant:"body1",children:n("somethingWentWrong")}),(0,s.jsx)(m.Button,{onClick:()=>window.location.reload(),children:n("reloadPage")})]});else throw r;return t}})},M=e=>{let{onSubmit:t,colourCode:n,saveToken:r,subCategory:i}=e,{currency:a,locale:d,storeKey:p}=(0,l.f)(),[m,h]=(0,o.useState)(null);(0,o.useEffect)(()=>{c.q.prefetchQuery((0,u.jw)({colourCode:n,locale:d,storeKey:p,currency:a}))},[n,d,p,a]);let f=(0,o.useRef)({saveToken:r,thumbnailUrl:void 0,customizations:[]});return(0,s.jsxs)("div",{className:S().widget,children:[(0,s.jsx)("div",{ref:h}),m?(0,s.jsx)(o.Suspense,{fallback:(0,s.jsx)("div",{className:S().overlay,children:(0,s.jsx)(g.U,{isLoading:!0})}),children:(0,s.jsx)(A,{children:(0,s.jsx)(E,{subCategory:i,saveToken:f.current.saveToken,colourCode:n,onPriceChange:e=>{f.current={...f.current,...e}},onSubmit:e=>{f.current={...f.current,...e},t(f.current)},target:m})})}):null]})};var I=n(96855),U=n.n(I);let F=(0,o.memo)(e=>{let{onClose:t,...n}=e,{t:r}=(0,i.Bd)();return(0,s.jsx)(a.aF,{maxWidth:"md",onClose:t,disableBodyScrollWhenOpen:!0,title:r("printessPersonalisationModalTitle"),classes:{wrapper:U().wrapper,content:U().content},children:(0,s.jsx)(M,{...n})})});F.displayName="PrintessModal"},27373:e=>{e.exports={root:"PersonalisationOverview_root__XbAYG",icon:"PersonalisationOverview_icon__ATwLE",button:"PersonalisationOverview_button__CUAwd",edit:"PersonalisationOverview_edit__qm2cX",remove:"PersonalisationOverview_remove__7KQrv"}},37209:e=>{e.exports={widget:"PrintessWidget_widget__bbWHp",error:"PrintessWidget_error__Di4Od",overlay:"PrintessWidget_overlay__yhxfs"}},37239:e=>{e.exports={root:"AddPersonalisationButton_root__ENC4k"}},42219:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PrintessTrigger:()=>C});var r=n(67112),s=n(45284),i=n(69738),o=n(69263),a=n(72532),l=n(40644),c=n(93817),d=n(11555),u=n(38375),p=n(77703),m=n(48017),h=n(37239),f=n.n(h);let g=e=>{let{onClick:t,isVariantSelected:n}=e,{t:s}=(0,u.Bd)(),[i,o]=(0,l.useState)(!1);return(0,r.jsx)(p.m,{title:s("selectSize"),open:i,variant:"danger",children:(0,r.jsx)("button",{className:f().root,onClick:e=>{n?t(e):(o(!0),setTimeout(()=>{o(!1)},2e3))},children:(0,r.jsx)(m.o,{component:"span",fontWeight:"bold",children:s("addPersonalisation")})})})};var v=n(1474),b=n(36142),w=n(97375),y=n(48023),P=n(27373),x=n.n(P);let _=e=>{var t;let{onEdit:n,onRemove:s,price:i}=e,{t:o}=(0,u.Bd)(),{locale:a}=(0,v.f)();return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:x().root,children:[(0,r.jsx)("div",{className:x().icon,children:(0,r.jsx)(y.I,{name:"checkmark",color:"white",size:"extraSmall"})}),(0,r.jsxs)(m.o,{component:"p",fontWeight:"bold",children:[o("personalisation"),i?(0,r.jsxs)(r.Fragment,{children:[": ",(0,r.jsx)(m.o,{component:"span",children:(0,b.BU)({currency:i.currency,centPrice:null!=(t=i.centAmount)?t:0,locale:a})})]}):null]}),(0,r.jsx)("button",{className:(0,w.cx)(x().button,x().edit),onClick:n,children:(0,r.jsx)(m.o,{component:"span",children:o("edit")})})]}),(0,r.jsx)("button",{className:(0,w.cx)(x().button,x().remove),onClick:s,children:(0,r.jsx)(m.o,{component:"span",children:o("removePersonalisation")})})]})},C=(0,l.forwardRef)((e,t)=>{let{colourCode:n,setPersonalisationDraft:u,selectedProduct:p,selectedVariant:m,quantity:h}=e,[f,v]=(0,l.useState)(),[b,w]=(0,l.useState)(null),{cart:y}=(0,o.M6)(),{closeModal:P,openModal:x}=(0,c.useModal)(),C=null!=m?m:p.variants[0],k=(0,l.useMemo)(()=>{var e;return{...(0,i.sJ)(p.key,window.location.href,p),cart_id:null!=(e=null==y?void 0:y.id)?e:"",quantity:h,variant:null==C?void 0:C.size}},[p,y,h,C]),T=(0,l.useCallback)(e=>{if(f&&0===e.customizations.length)u(t=>{var n;return{customizations:null!=(n=null==t?void 0:t.customizations)?n:[],personalisationType:"PRINTESS",printessThumbnailUrl:e.thumbnailUrl,printessToken:e.saveToken}});else{var t;w(null!=(t=e.price)?t:null),u({customizations:e.customizations,personalisationType:"PRINTESS",printessThumbnailUrl:e.thumbnailUrl,printessToken:e.saveToken})}v(e.saveToken),P()},[P,f,u]),j=(0,l.useCallback)(()=>{P()},[P]),L=(0,l.useCallback)(e=>
1{x({focusElementAfterClose:e.currentTarget,modal:(0,r.jsx)(d.c,{subCategory:p.attributes.subCategory,colourCode:n,onClose:j,onSubmit:T,saveToken:f})})},[n,j,T,x,f,p.attributes.subCategory]),N=(0,l.useCallback)(e=>{s.zS.printessPersonalisationStarted({product:k}),L(e)},[L,k]),S=(0,l.useCallback)(e=>{s.zS.printessPersonalisationEdited({product:k}),L(e)},[L,k]),E=(0,l.useCallback)(()=>{w(null),v(void 0),u(void 0)},[u]),A=(0,l.useCallback)(()=>{s.zS.printessPersonalisationRemoved({product:k}),E()},[k,E]);(0,l.useImperativeHandle)(t,()=>({resetPersonalisation:E}));let{template:M}=(0,a.OT)({colourCode:n});return M?f?(0,r.jsx)(_,{price:b,onEdit:S,onRemove:A}):(0,r.jsx)(g,{onClick:N,isVariantSelected:!!m}):null});C.displayName="PrintessTrigger"},42615:e=>{e.exports={root:"OverlayLoader_root__J4Sz4",backdrop:"OverlayLoader_backdrop__bRPnA",container:"OverlayLoader_container__UOMd2"}},46242:(e,t,n)=>{"use strict";n.d(t,{U:()=>l});var r=n(67112),s=n(97375),i=n(13751),o=n(42615),a=n.n(o);let l=e=>{let{isLoading:t,className:n}=e;return(0,r.jsx)(c,{isLoading:t,className:n,children:(0,r.jsx)(i.Loader,{isLoading:t})})},c=e=>{let{isLoading:t,className:n,children:i}=e;return t?(0,r.jsxs)("div",{className:(0,s.cx)(a().root),"data-testid":"overlay-loader",children:[(0,r.jsx)("div",{className:a().backdrop}),(0,r.jsx)("div",{className:(0,s.cx)(a().container,n),children:i})]}):null}},61237:(e,t,n)=>{"use strict";n.d(t,{u:()=>s});var r=n(94970);class s extends r.m{}},72532:(e,t,n)=>{"use strict";n.d(t,{jw:()=>y,gk:()=>x,OT:()=>P});var r=n(1474),s=n(19350),i=n(17137),o=n(40644),a=n(34659),l=n(36921),c=n(63065),d=n(30957);function u(){let e=(0,l._)(["\n fragment formFieldProperty on PersonalisationTemplateField {\n name\n price {\n ...customMoney\n }\n priceDisplay\n pricePrefix\n hasPerLetterPricing\n }\n ","\n"]);return u=function(){return e},e}function p(){let e=(0,l._)(["\n fragment priceCategoryLabel on PriceCategoryLabel {\n name\n label\n }\n"]);return p=function(){return e},e}function m(){let e=(0,l._)(["\n fragment printessPersonalisationTemplate on PrintessPersonalisationTemplate {\n description\n templateName\n formFieldProperties {\n ...formFieldProperty\n }\n priceCategoryLabels {\n ...priceCategoryLabel\n }\n }\n ","\n ","\n"]);return m=function(){return e},e}let h=(0,c.Ay)(u(),d.gM),f=(0,c.Ay)(p()),g=(0,c.Ay)(m(),h,f);function v(){let e=(0,l._)(["\n query PrintessPersonalisationTemplate(\n $colourCode: String!\n $currency: Currency!\n $locale: String!\n $storeKey: String!\n ) {\n PrintessPersonalisationTemplate(\n colourCode: $colourCode\n currency: $currency\n locale: $locale\n storeKey: $storeKey\n ) {\n ...printessPersonalisationTemplate\n }\n }\n ","\n"]);return v=function(){return e},e}let b=(0,c.Ay)(v(),g);var w=n(61237);let y=e=>(0,s.j)({queryKey:["printessTemplate",e],queryFn:async()=>{try{let t=await (0,a.G)(b,e);if(t.PrintessPersonalisationTemplate)return t.PrintessPersonalisationTemplate;return null}catch(e){return null}}}),P=e=>{let{locale:t,storeKey:n,currency:s}=(0,r.f)(),{data:a}=(0,i.U)((0,o.useMemo)(()=>y({...e,locale:t,storeKey:n,currency:s}),[t,n,s,e]));return{template:a}};function x(e){if(!e)throw new w.u}},96855:e=>{e.exports={wrapper:"PrintessModal_wrapper__DGGPq",content:"PrintessModal_content__s2Fer"}}}]);
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.