"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 eP},default:function(){return eZ}});var r,a,i,s,o,c,u,l,g,d,m,p,h,x,f,v=n(20406),b=n(95235),j=n(7328),y=n(82841),T=n.n(y),w=n(2784),O=n(97729),P=n.n(O),R=n(4626),k=n(41857),Z=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),F=n(51545),_=n(59131),G=n(58406),K=n(80545),q=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,k.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,Z.ag)("account.sociallogin.facebook.header.text.login"):(0,Z.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)(F.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)),ex=I.zo.h1(m||(m=(0,j.Z)(["\n ","\n margin-bottom: ",";\n"])),(0,V.xv)("large1","alternate"),(0,J.W0)(3)),ef=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)(x||(x=(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={registerFormTitleText:(0,Z.ag)("account.register.form.title.text"),registerOptionalText:(0,Z.ag)("account.register.form.optional.text")};return(0,ea.jsxs)(w.Fragment,{children:[!e.removeHeading&&(0,ea.jsx)(ed,{children:a.registerFormTitleText}),a.registerOptionalText&&(0,ea.jsx)("span",{style:{marginBottom:(0,J.W0)(4)},children:a.registerOptionalText}),!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,q.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)(_.x,{ariaLive:e,message:t})},renderAnnouncer:function(e,t){return(0,ea.jsx)(F.J,{"aria-live":e,message:t})}})})]})},ey=function(e){var t={accountRegistrationUnavailableStatus:(0,Z.ag)("account.registration.unavailable.status"),accountRegistrationGuestCheckoutPrompt:(0,Z.ag)("account.registration.guest.checkout.prompt"),accountRegistrationGuestHelper:(0,Z.ag)("account.registration.guest.helper.purchase.sans.account"),accountRegistrationContinueBtxTxt:(0,Z.ag)("account.registration.continue.shopping.button.text"),accountRegisterTitle:(0,Z.ag)("account.register.title.text")},n=w.useContext(eP).pageMessage,r=(0,G.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,Z.ag)("account.register.unavailable.error"),m=(0,Z.ag)("account.useragent.nottrusted.text"),p=(0,k.bW)().userAgent,h=w.useState(null),x=(0,E.Z)(h,2),f=x[0],v=x[1],b=(0,k.ZR)().basketCookieKey,j=w.useState(!1),y=(0,E.Z)(j,2),T=y[0],O=y[1],P=w.useState(!1),R=(0,E.Z)(P,2),S=R[0],U=R[1];w.useEffect(function(){O(void 0===L.get(b)),U(!0)},[]);var C=n.messageKey||"unknown",W=(0,Z.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,K.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)(ex,{id:"registration-title",children:t.accountRegistrationUnavailableStatus||"Account registration is currently unavailable"}),(0,ea.jsx)(ef,{"data-testid":"guest-journey-message-acc-unavailable-basket-nonempty",children:t.accountRegistrationGuestCheckoutPrompt||"Please checkout as a guest"}),f&&(0,ea.jsx)(eh,{message:f,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)(ex,{id:"registration-title",children:t.accountRegistrationUnavailableStatus||"Account registration is currently unavailable"}),(0,ea.jsx)(ef,{"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,Z.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