"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3531],{43531:function(e,t,n){n.r(t),n.d(t,{RegistrationContext:function(){return eR},default:function(){return eO}});var r,a,i,s,o,c,u,l,g,d,m,p,h,f,x,v=n(20406),b=n(95235),j=n(7328),y=n(82841),T=n.n(y),w=n(2784),P=n(97729),R=n.n(P),k=n(4626),Z=n(41857),O=n(28885),S=n(92210),U=n(22182),C=n(96075),W=n(73716),z=n(51215),M=n(87977),I=n(11006),E=n(8529),A=n(53055),D=n(53460),L=n(52034),H=n(5632),N=n.n(H),_=n(51545),G=n(59131),K=n(58406),q=n(80545),F=n(58718),B=n(12786),V=n(87330),J=n(48840),Q=n(26710),X=n(31162),Y=n(51339),$=n(33341),ee=n(58410),et=n(51515),en=n(61710),er=n(53825),ea=n(52322),ei=I.zo.h2(a||(a=(0,j.Z)(["\n ","\n margin-top: ",";\n margin-bottom: ",";\n"])),(0,V.xv)("medium1","alternate"),(0,J.W0)(2),(0,J.W0)(3)),es=(0,D.ZP)(i||(i=(0,j.Z)(["\n query registerPageSocialProviders {\n socialLoginProviders @client {\n name\n code\n loginUrl\n iconUrl\n }\n }\n"]))),eo=function(e){var t,n=(0,A.aM)(es),r=n.data,a=n.loading,i=(0,Z.Dx)().originUrl;return(0,ea.jsx)(w.Fragment,{children:!a&&(null==r||null===(t=r.socialLoginProviders)||void 0===t?void 0:t.length)>0&&(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)(ei,{"data-testid":"social-register-title",children:e.reversedSurfaceHeader?(0,O.ag)("account.sociallogin.facebook.header.text.login"):(0,O.ag)("account.newaccount.createaccountform.customer.signup.with.text")}),(0,ea.jsx)(er.y,{providers:r.socialLoginProviders,originUrl:i,returnToUrl:e.returnToUrl})]})})},ec=I.zo.h1(s||(s=(0,j.Z)(["\n ","\n margin-bottom: ",";\n"])),(0,V.xv)("large1","alternate"),function(e){return e.reversedRegister?(0,J.W0)(4):(0,J.W0)(2)}),eu=I.zo.div(o||(o=(0,j.Z)(["\n ",";\n"])),(0,V.xv)("small","default")),el=function(e,t){return(0,ea.jsx)(_.J,{"aria-live":e,message:t})},eg=I.zo.div(c||(c=(0,j.Z)(["\n padding: "," 0px;\n"])),(0,J.W0)(2)),ed=I.zo.h2(u||(u=(0,j.Z)(["\n ","\n margin-top: ",";\n margin-bottom: ",";\n"])),(0,V.xv)("medium1","alternate"),(0,J.W0)(2),(0,J.W0)(4)),em=(0,I.zo)(Q.T)(l||(l=(0,j.Z)(["\n padding: ",";\n"])),(0,J.W0)(4)),ep=(0,I.zo)(X.Z)(g||(g=(0,j.Z)(["\n margin-top: ",";\n"])),(0,J.W0)(5)),eh=(0,I.zo)($.r)(d||(d=(0,j.Z)(["\n margin-top: ",";\n"])),(0,J.W0)(2)),ef=I.zo.h1(m||(m=(0,j.Z)(["\n ","\n margin-bottom: ",";\n"])),(0,V.xv)("large1","alternate"),(0,J.W0)(3)),ex=I.zo.p(p||(p=(0,j.Z)(["\n ","\n margin-bottom: ",";\n"])),(0,V.xv)("bodyText","default"),(0,J.W0)(4)),ev=(0,I.zo)(Y.zx)(h||(h=(0,j.Z)(["\n width: 100%;\n"]))),eb=(0,D.ZP)(f||(f=(0,j.Z)(['\n {\n form(input: { identifier: "ACCOUNT_CREATION" }) @client {\n fields {\n name\n defaultValue\n type\n required\n confirmable\n validators {\n name\n argument\n }\n options\n }\n }\n }\n']))),ej=function(e){var t=(0,A.aM)(eb),n=t.data,r=t.loading,a=(0,O.ag)("account.register.form.title.text");return(0,ea.jsxs)(w.Fragment,{children:[!e.removeHeading&&(0,ea.jsx)(ed,{children:a}),!r&&(null==n?void 0:n.form)&&(0,ea.jsx)(C.O,{featureMap:{dynamicNewsletterSubscription:"hasDynamicOptIn"},children:(0,ea.jsx)(en.B2,{fields:n.form.fields,onSuccessHandler:function(){(0,F.B)({key:"visitorLoginMethod",value:"Register"}),window.location.href.includes(S.Z5.AccountLink.replace("/",""))&&!1===window.location.href.includes("redirect_behaviour")?window.location.replace("".concat(window.location.href,"&redirect_behaviour=normal")):N().reload()},renderLiveMessage:function(e,t){return(0,ea.jsx)(G.x,{ariaLive:e,message:t})},renderAnnouncer:function(e,t){return(0,ea.jsx)(_.J,{"aria-live":e,message:t})}})})]})},ey=function(e){var t={accountRegistrationUnavailableStatus:(0,O.ag)("account.registration.unavailable.status"),accountRegistrationGuestCheckoutPrompt:(0,O.ag)("account.registration.guest.checkout.prompt"),accountRegistrationGuestHelper:(0,O.ag)("account.registration.guest.helper.purchase.sans.account"),accountRegistrationContinueBtxTxt:(0,O.ag)("account.registration.continue.shopping.button.text"),accountRegisterTitle:(0,O.ag)("account.register.title.text")},n=w.useContext(eR).pageMessage,r=(0,K.Vb)(),a=w.useState(""),i=(0,E.Z)(a,2),s=i[0],o=i[1],c=w.useState("error"),u=(0,E.Z)(c,2),l=u[0],g=u[1],d=(0,O.ag)("account.register.unavailable.error"),m=(0,O.ag)("account.useragent.nottrusted.text"),p=(0,Z.bW)().userAgent,h=w.useState(null),f=(0,E.Z)(h,2),x=f[0],v=f[1],b=(0,Z.ZR)().basketCookieKey,j=w.useState(!1),y=(0,E.Z)(j,2),T=y[0],P=y[1],R=w.useState(!1),k=(0,E.Z)(R,2),S=k[0],U=k[1];w.useEffect(function(){P(void 0===L.get(b)),U(!0)},[]);var C=n.messageKey||"unknown",W=(0,O.ag)(C),z=W.indexOf("unknown")>-1?"":W;return(w.useEffect(function(){r.includes(B.WN.RegistrationUnavailable)?(o(d),g("error")):o("")},[r,d]),w.useEffect(function(){!r.includes(B.WN.RegistrationUnavailable)&&p&&(0,q.bz)(p)&&(o(m),g("info"))},[p,r]),r.includes(B.WN.RegistrationUnavailable))?e.showGuestCheckout&&S&&!T?(0,ea.jsxs)(em,{"aria-labelledby":"registration-title",children:[(0,ea.jsx)(ef,{id:"registration-title",children:t.accountRegistrationUnavailableStatus||"Account registration is currently unavailable"}),(0,ea.jsx)(ex,{"data-testid":"guest-journey-message-acc-unavailable-basket-nonempty",children:t.accountRegistrationGuestCheckoutPrompt||"Please checkout as a guest"}),x&&(0,ea.jsx)(eh,{message:x,type:"error",flashMessageId:"guest checkout",renderAnnouncer:el}),(0,ea.jsx)(et.k,{containsSubscriptionProduct:e.containsSubscriptionProduct||!1,internalServerErrorCallback:v})]}):S?(0,ea.jsxs)(em,{"aria-labelledby":"registration-title",children:[(0,ea.jsx)(ef,{id:"registration-title",children:t.accountRegistrationUnavailableStatus||"Account registration is currently unavailable"}),(0,ea.jsx)(ex,{"data-testid":"guest-journey-message-acc-unavailable-basket-empty",children:t.accountRegistrationGuestHelper||"If you want to purchase something, you are still able to checkout without an account"}),(0,ea.jsx)(ev,{renderedAs:"a",href:"/",emphasis:"high",sizing:"regular","data-testid":"continue-shopping-button",children:t.accountRegistrationContinueBtxTxt||"Continue Shopping"})]}):null:(0,ea.jsxs)(em,{"aria-labelledby":"registration-title",children:[(0,ea.jsx)(ec,{reversedRegister:e.reversedRegistration,id:"registration-title",children:t.accountRegisterTitle}),(0,ea.jsx)(eu,{children:(0,O.ag)("account.form.mandatoryfield.message")}),s&&(0,ea.jsx)(eg,{children:(0,ea.jsx)($.r,{message:s,type:l,flashMessageId:"register",renderAnnouncer:el,urlParams:{messageId:n.messageId,messageType:n.messageType,messageText:z}})}),(0,ea.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:(0,ea.jsxs)(ee.O,{order:e.reversedRegistration?[2,1,0]:[0,1,2],children:[(0,ea.jsx)(eo,{reversedSurfaceHeader:e.reversedRegistration,returnToUrl:e.returnToUrl}),(0,ea.jsx)(ep,{}),(0,ea.jsx)(ej,{removeHeading:e.reversedRegistration})]})})]})};function eT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ew(e){for(var t=1;t