PageSourceSearch

https://am-cycling.com/application/assets/storefront/chunk-authentication_initializer.-E5dP4i.js

js am-cycling.com collected 2026-10-03 00:36:24 UTC 77,666 bytes, 1,115 lines download raw bytes

1import{bW as S,c as ue,l as pe,b8 as f,s as B,bX as J,R,u as $,bY as _e,bZ as me,g as ge,b as fe,G as be,ad as L,J as F,P as q,h as ye,aQ as I,i as $e,aw as O,v as p,T as D,b_ as Se,x as Ae,N as ve,y as Ce,H as we,e as Me,D as Re,r as Fe,C as Ie}from"./storefrontApp.CsApItsi.min.js";import{A as ke}from"./chunk-additional_field_mapper.BGljDzk.js";import{W as Ee}from"./chunk-webapi_http_api.C3s8IQv.js";import{A}from"./chunk-authentication_events._gjIzqq.js";import{U as Te,$ as r,t as u,b as m,d as h,f as _,w as d,a as Z,T as xe,g as P,c as ee}from"./chunk-vendor-lit.NvY0u02.js";import{S as y}from"./chunk-storefront_base_lit_element.lX23Jvc.js";import{o as se}from"./chunk-observe_when_directive.DWgxaey.js";import{t as a}from"./chunk-translations_directive.DWSzkd6.js";import{S as C,R as v}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{B as V}from"./chunk-btn_controller.BPcEEeZ.js";import{F as G}from"./chunk-form_state_constants.Gcz9tYH.js";import{m as Le}from"./chunk-vendor-rxjs.Dp7kflo.js";import{B as te}from"./chunk-backdrop_constants.5bk4eBT.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-vendor-phoenix.cdKS79L.js";import"./chunk-keystrokes_controller.BSiCZ0Y.js";const Pe={email:"",status:S.unauthorized},Oe=()=>ue({name:f.store},pe(Pe));class Ne{#e;constructor(e){this.#e=e}getStatus(){return this.#e.getValue().status}selectStatus$(){return this.#e.pipe(B(e=>e.status))}updateStatus(e){this.#e.update(J("status",e))}getLoginEmail(){return this.#e.getValue().email}selectLoginEmail$(){return this.#e.pipe(B(e=>e.email))}setLoginEmail(e){this.#e.update(J("email",e))}}class qe{login(){return"/auth/login/"}logout(){return"/auth/logout/"}status(){return"/auth/status/"}remindPassword(){return"/auth/remind/"}additionalFieldsForRegistration(){return"/additional-fields/user-registration/?limit=100&newsletter=1"}register(){return"/user/register/"}}class Be extends Ee{constructor(e){super(e),this.httpApi=e,this.#e=new qe}static{this.moduleName=f.httpApi}#e;login(e,t){const o={url:this.#e.login(),method:R.post,headers:{Authorization:`Basic ${btoa(`${e}:${t}`)}`},sanitizeOptions:{disable:!0}};return this.fetch(o,{callback:n=>({...n,data:{session:n.data.session}}),decorators:[$.flashMessages,$.status]})}logout(){const t={url:this.#e.logout(),method:R.post,sanitizeOptions:{disable:!0}};return this.fetch(t,{decorators:[$.flashMessages,$.status]})}checkStatus(){const t={url:this.#e.status(),method:R.get,sanitizeOptions:{disable:!0},cacheOptions:{type:me,ttlInMs:_e}};return this.fetch(t,{decorators:[$.status]})}remindPassword(e){const s={url:this.#e.remindPassword(),method:R.post,data:{email:e},sanitizeOptions:{disable:!0}};return this.fetch(s,{decorators:[$.flashMessages,$.status]})}register(e){const s={url:this.#e.register(),method:R.post,data:e,sanitizeOptions:{disable:!0}};return this.fetch(s,{decorators:[$.flashMessages,$.status]})}getAdditionalFieldsForRegistration(){const t={url:this.#e.additionalFieldsForRegistration(),method:R.get,sanitizeOptions:{disable:!0},cacheOptions:{type:ge.memory,ttlInMs:1e6}};return this.fetch(t,{callback:s=>({...s,data:{...s.data.list,list:this._mapAdditionalFields(s.data.list)}})})}_mapAdditionalFields(e){const t=new ke;return e.map(s=>t.toModel(s))}}const k="authenticationUi",g={openLoginModal:`${k}.openLoginModal`,closeLoginModal:`${k}.closeLoginModal`,openRegisterModal:`${k}.openRegisterModal`,closeRegisterModal:`${k}.closeRegisterModal`,openRemindPasswordModal:`${k}.openRemindPasswordModal`,closeRemindPasswordModal:`${k}.closeRemindPasswordModal`};class He extends fe{constructor({authenticationRepository:e,httpApi:t,flashMessengerApi:s,translationApi:o,pageManagerApi:n,settingsApi:i}){super(),this._lastUrl=null,this._displayFlashMessages=c=>{c&&this.#o.parseAndAddFlashMessages(c,be)},this.#e=new Be(t),this.#t=e,this.#o=s,this.#i=o,this.#n=n,this.#s=i,this._checkStatus(),this._lastUrl=this.#s.isFeatureEnabled("dev_email_redirect_fix")?this.#s.getSkinSettings().lastUrl:null}#e;#t;#o;#i;#n;#s;async _checkStatus(){try{const{response:e}=this.#e.checkStatus(),t=await e,{status:s}=t.data;s===L.success&&this._updateStatus(S.authorized)}catch{this._updateStatus(S.unauthorized)}}_updateStatus(e){this.#t.updateStatus(e),this.eventBus.emit(new F(A[e]))}selectAuthStatus$(){return this.#t.selectStatus$()}getAuthStatus(){return this.#t.getStatus()}selectIsAuthorized$(){return this.selectAuthStatus$().pipe(B(e=>e===S.authorized))}isAuthorized(){return this.getAuthStatus()===S.authorized}async login(e,t){try{const{response:s}=this.#e.login(e,t),o=await s,{status:n,flashMessages:i}=o.data;n===L.success&&(this._updateStatus(S.authorized),this.eventBus.emit(new F(A.loggedIn)));const c=this.#s.isFeatureEnabled("dev_email_redirect_fix")&&this._lastUrl&&this._lastUrl?.length>0?this._lastUrl:location.href;this.#n.visit(c);const b=()=>{this._displayFlashMessages(i),this.eventBus.off(q.rendered,b)};return this.eventBus.on(q.rendered,b),o.data}catch(s){const{_flash_messenger:o}=s.response.data;return this._displayFlashMessages(o),s.response.status===ye.badRequest?this._doAllreadyLoggedInAction():this.eventBus.emit(new F(A.failedLogin)),null}}_doAllreadyLoggedInAction(){this._displayAlreadyLoggedInMessage(),this._updateStatus(S.authorized),this.eventBus.emit(new F(A.loggedIn))}async logout(){try{const{response:e}
1=this.#e.logout(),t=await e,{status:s,flashMessages:o}=t.data;s===L.success&&(this._updateStatus(S.unauthorized),this.eventBus.emit(new F(A.loggedOut))),this.#n.visit(location.href);const n=()=>{this._displayFlashMessages(o),this.eventBus.off(q.rendered,n)};return this.eventBus.on(q.rendered,n),t.data}catch{return null}}async resetPassword(e){try{const{response:t}=this.#e.remindPassword(e),s=await t,{flashMessages:o}=s.data;return this._displayFlashMessages(o),s.data}catch(t){const{_flash_messenger:s}=t.response.data;return this._displayFlashMessages(s),null}}async register(e){try{const{response:t}=this.#e.register(e),s=await t,{flashMessages:o,status:n}=s.data;return this._displayFlashMessages(o),n===L.success&&this.eventBus.emit(new F(A.registered)),s.data}catch(t){const{_flash_messenger:s,validation_messages:o}=t.response.data;return this._displayFlashMessages(s),{status:"failed",errors:o}}}async getAdditionalFieldsForRegistration(){try{const{response:e}=this.#e.getAdditionalFieldsForRegistration(),t=await e,{list:s}=t.data;return s}catch{return null}}setLoginEmail(e){this.#t.setLoginEmail(e)}getLoginEmail(){return this.#t.getLoginEmail()}selectLoginEmail$(){return this.#t.selectLoginEmail$()}async openLoginModal(){if(!this.isAuthorized())return this.commandBus.execute(new I(g.openLoginModal));this._displayAlreadyLoggedInMessage()}async closeLoginModal(){return this.commandBus.execute(new I(g.closeLoginModal))}async openRegisterModal(){if(!this.isAuthorized())return this.commandBus.execute(new I(g.openRegisterModal));this._displayAlreadyLoggedInMessage()}async closeRegisterModal(){return this.commandBus.execute(new I(g.closeRegisterModal))}async openRemindPasswordModal(){if(!this.isAuthorized())return this.commandBus.execute(new I(g.openRemindPasswordModal));this._displayAlreadyLoggedInMessage()}async closeRemindPasswordModal(){return this.commandBus.execute(new I(g.closeRemindPasswordModal))}_displayAlreadyLoggedInMessage(){this.#o.addFlashMessage({type:"warning",content:this.#i.translate("You are already logged in.")})}}class ze extends $e{constructor(e){super(),this.moduleName=f.api,this.#e=e}#e;selectAuthStatus$(){return this.#e.selectAuthStatus$()}getAuthStatus(){return this.#e.getAuthStatus()}selectIsAuthorized$(){return this.selectAuthStatus$().pipe(B(e=>e===S.authorized))}isAuthorized(){return this.#e.isAuthorized()}async login(e,t){return this.#e.login(e,t)}async logout(){return this.#e.logout()}async resetPassword(e){return this.#e.resetPassword(e)}setLoginEmail(e){this.#e.setLoginEmail(e)}getLoginEmail(){return this.#e.getLoginEmail()}selectLoginEmail$(){return this.#e.selectLoginEmail$()}async register(e){return this.#e.register(e)}async getAdditionalFieldsForRegistration(){return this.#e.getAdditionalFieldsForRegistration()}async openLoginModal(){return this.#e.openLoginModal()}async closeLoginModal(){return this.#e.closeLoginModal()}async openRegisterModal(){return this.#e.openRegisterModal()}async closeRegisterModal(){return this.#e.closeRegisterModal()}async openRemindPasswordModal(){return this.#e.openRemindPasswordModal()}async closeRemindPasswordModal(){return this.#e.closeRemindPasswordModal()}}const U={loggedIn:"logged-in",loggedOut:"logged-out"};var Ue=Object.defineProperty,De=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&Ue(e,t,o),o};class ne extends y{static{this.moduleName=f.component}constructor(){super(),this._authenticationApi=this.getApiSync(f.api),Te.show(this)}connectedCallback(){super.connectedCallback(),this.querySelector(`[slot="${U.loggedIn}"]`)?.removeAttribute("hidden")}render(){return r`${se(this._authenticationApi.selectIsAuthorized$(),this.getSlot(U.loggedIn),this.get
1Slot(U.loggedOut))}`}}De([u()],ne.prototype,"_templateSlot");class j{constructor({host:e,modalRef:t,formRef:s}){this.focusFirstInput=()=>{setTimeout(()=>{this.#o.value?.querySelector("input")?.focus()})},this.#e=e,this.#t=t,this.#o=s,this.#e.addController(this)}#e;#t;#o;hostConnected(){}async open(){return this.#t.value?.open()}async close(){return this.#t.value?.close()}}var Ve=Object.defineProperty,ie=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&Ve(e,t,o),o};class W extends y{constructor(){super(),this._modal=m(),this._form=m(),this._isRendered=!1,this._isSSOModalVisible=!1,this._storefrontSettingsApi=this.getApiSync(C.api),this._authenticationModalController=new j({host:this,modalRef:this._modal,formRef:this._form})}static{this.moduleName="login-modal"}connectedCallback(){super.connectedCallback(),this.commandBus.on(g.openLoginModal,async()=>{this._isRendered=!0,O.nextTick(async()=>{await this._authenticationModalController.open()})}),this.commandBus.on(g.closeLoginModal,async()=>{await this._authenticationModalController.close()}),this.eventBus.on(A.loggedIn,async()=>{await this._authenticationModalController.close()}),this.querySelectorAll("[hidden]").forEach(e=>{e.removeAttribute("hidden")})}_renderHeader(){return r`<h2 class="font_semibold h2">${a("Login")}</h2>`}_renderHeaderCloseIcon(){return r`
2            <h-icon
3                icon-name="icon-x"
4                role="button"
5                size="xl"
6                clickable
7            ></h-icon>
8        `}_renderLoginForm(){return r`<login-form
9            @showSSOModal="${()=>{this._isSSOModalVisible=!0}}"
10            @hideSSOModal="${()=>{this._isSSOModalVisible=!1}}"
11            ${h(this._form)}
12        >
13            <div slot="additional-login-providers">${this.getSlot("additional-login-providers")}</div>
14        </login-form>`}_renderAsModal(){return r`${_(this._isRendered,()=>r`<h-modal
15                class="${Z({modal_login:!0,"modal-wrapper_s":!0,"modal-wrapper_layer-out":this._isSSOModalVisible})}"
16                ${h(this._modal)}
17                hidden
18                >s
19                <h-modal-header>
20                    ${this._renderHeader()}
21                    <h-modal-close
22                        aria-label="${a("Close window")}"
23                        class="btn btn_icon"
24                    >
25                        ${this._renderHeaderCloseIcon()}
26                    </h-modal-close>
27                </h-modal-header>
28                <h-modal-body> ${this._renderLoginForm()} </h-modal-body>
29            </h-modal>`,()=>d)}`}_renderAsSheet(){return r`${_(this._isRendered,()=>r`<h-sheet
30                class="${Z({sheet_login:!0,"sheet-wrapper_layer-out":this._isSSOModalVisible})}"
31                ${h(this._modal)}
32                hidden
33            >
34                <h-sheet-header>
35                    ${this._renderHeader()}
36                    <h-sheet-close
37                        aria-label="${a("Close window")}"
38                        class="btn btn_icon"
39                    >
40                        ${this._renderHeaderCloseIcon()}
41                    </h-sheet-close>
42                </h-sheet-header>
43                <h-sheet-body> ${this._renderLoginForm()} </h-sheet-body>
44            </h-sheet>`,()=>d)}`}render(){return r`${_(this._storefrontSettingsApi.getSkinSettings().loginDisplayMode==="sheet",()=>this._renderAsSheet(),()=>this._renderAsModal())}`}}ie([u()],W.prototype,"_isRendered");ie([u()],W.prototype,"_isSSOModalVisible");class Ge extends y{constructor(){super(),this._openLoginModal=()=>{this._authenticationApi.openLoginModal()},this._btnController=new V(this,this._openLoginModal),this._authenticationApi=this.getApiSync(f.api)}static{this.moduleName="login-modal-opener"}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._openLoginModal),this.setAttribute("aria-haspopup","dialog")}}class je extends y{constructor(){super(),this._logout=()=>{this._authenticationApi.logout()},this._authenticationApi=this.getApiSync(f.api),this._btnController=new V(this,this._logout)}static{this.moduleName="logout-btn"}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._logout)}}var We=Object.defineProperty,Ye=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&We(e,t,o),o};class re extends y{constructor(){super(),this._modal=m(),this._form=m(),this._isRendered=!1,this._storefrontSettingsApi=this.getApiSync(C.api),this._authenticationModalController=new j({host:this,modalRef:this._modal,formRef:this._form})}static{this.moduleName="remind-password-modal"}connectedCallback(){super.connectedCallback(),this.commandBus.on(g.openRemindPasswordModal,async()=>{this._isRendered=!0,O.nextTick(async()=>{await this._authenticationModalController.open()})}),this.commandBus.on(g.closeRemindPasswordModal,async()=>{await this._authenticationModalController.close()})}_renderHeader(){return r`<h2 class="font_semibold h2">${a("Remind password")}</h2>`}
44_renderHeaderCloseIcon(){return r`<h-icon
45            icon-name="icon-x"
46            role="button"
47            size="xl"
48            clickable
49        ></h-icon>`}_renderRemindPasswordForm(){return r`<remind-password-form
50            ${h(this._form)}
51            @connected="${async e=>{e.target===this._form.value&&setTimeout(()=>{this._form.value?.updateEmailFromLoginForm(),this._authenticationModalController.focusFirstInput()})}}"
52        ></remind-password-form>`}_renderAsModal(){return r`${_(this._isRendered,()=>r`<h-modal
53                class="modal-wrapper_s modal_remind-password"
54                ${h(this._modal)}
55                hidden
56            >
57                <h-modal-header>
58                    ${this._renderHeader()}
59                    <h-modal-close
60                        aria-label="${a("Close window")}"
61                        class="btn btn_icon"
62                    >
63                        ${this._renderHeaderCloseIcon()}
64                    </h-modal-close>
65                </h-modal-header>
66                <h-modal-body> ${this._renderRemindPasswordForm()} </h-modal-body>
67            </h-modal>`,()=>d)}`}_renderAsSheet(){return r`${_(this._isRendered,()=>r`<h-sheet
68                ${h(this._modal)}
69                hidden
70            >
71                <h-sheet-header>
72                    ${this._renderHeader()}
73                    <h-sheet-close
74                        aria-label="${a("Close window")}"
75                        class="btn btn_icon"
76                    >
77                        ${this._renderHeaderCloseIcon()}
78                    </h-sheet-close>
79                </h-sheet-header>
80                <h-sheet-body> ${this._renderRemindPasswordForm()} </h-sheet-body>
81            </h-sheet>`,()=>d)}`}render(){return r`${_(this._storefrontSettingsApi.getSkinSettings().loginDisplayMode==="sheet",()=>this._renderAsSheet(),()=>this._renderAsModal())}`}}Ye([u()],re.prototype,"_isRendered");var Ke=Object.defineProperty,Qe=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&Ke(e,t,o),o};class ae extends y{constructor(){super(),this._modal=m(),this._form=m(),this._isRendered=!1,this._storefrontSettingsApi=this.getApiSync(C.api),this._authenticationModalController=new j({host:this,modalRef:this._modal,formRef:this._form})}static{this.moduleName="register-modal"}connectedCallback(){super.connectedCallback(),this.commandBus.on(g.openRegisterModal,async()=>{this._isRendered=!0,O.nextTick(async()=>{await this._authenticationModalController.open()})}),this.commandBus.on(g.closeRegisterModal,async()=>{await this._authenticationModalController.close()}),this.eventBus.on(A.registered,async()=>{await this._authenticationModalController.close()}),this.querySelectorAll("[hidden]").forEach(e=>{e.removeAttribute("hidden")})}_renderHeader(){return r`<h2 class="font_semibold h2">${a("Account registration")}</h2>`}_renderHeaderCloseIcon(){return r`
82            <h-icon
83                icon-name="icon-x"
84                role="button"
85                size="xl"
86                clickable
87            ></h-icon>
88        `}_renderRegisterForm(){return r`${this.getSlot("additional-login-providers")}
89
90            <register-form
91                ${h(this._form)}
92                @connected="${async e=>{e.target===this._form.value&&setTimeout(()=>{this._form.value?.updateEmailFromLoginForm()})}}"
93            >
94                <div slot="additional-login-providers">${this.getSlot("additional-login-providers")}</div>
95            </register-form>`}_renderAsModal(){return r`${_(this._isRendered,()=>r`<h-modal
96                id="remind-password-modal-form"
97                class="modal-wrapper_s modal_register"
98                ${h(this._modal)}
99            >
100                <h-modal-header>
101                    ${this._renderHeader()}
102                    <h-modal-close
103                        aria-label="${a("Close window")}"
104                        class="btn btn_icon"
105                    >
106                        ${this._renderHeaderCloseIcon()}
107                    </h-modal-close>
108                </h-modal-header>
109                <h-modal-body>${this._renderRegisterForm()} </h-modal-body>
110            </h-modal>`,()=>d)}`}_renderAsSheet(){return r`${_(this._isRendered,()=>r`<h-sheet ${h(this._modal)}>
111                <h-sheet-header>
112                    ${this._renderHeader()}
113                    <h-sheet-close
114                        aria-label="${a("Close window")}"
115                        class="btn btn_icon"
116                    >
117                        ${this._renderHeaderCloseIcon()}
118                    </h-sheet-close>
119                </h-sheet-header>
120                <h-sheet-body> ${this._renderRegisterForm()} </h-sheet-body>
121            </h-sheet>`,()=>d)}`}render(){return r`${_(this._storefrontSettingsApi.getSkinSettings().loginDisplayMode==="sheet",()=>this._renderAsSheet(),()=>this._renderAsModal())}`}}Qe([u()],ae.prototype,"_isRendered");class Y{constructor({host:e,formRef:t,authenticationApi:s}){this.getFormValues=async()=>{const o=this.getFormService(),n=o.getFormControls();await o.validateControls();const i={};
121return n.forEach(c=>{xe.isDefined(c.value)&&(i[c.name]=c.value)}),i},this.#e=e,this.#t=t,this.#o=s,this.#e.addController(this)}#e;#t;#o;hostConnected(){}updateEmailFromLoginForm(e){const t=this.getFormService();t&&t.updateFormControl(e,{value:this.#o.getLoginEmail()})}getFormState(){return this.getFormService().getFormState()}getFormService(){if(!this.#t.value)throw"No form found";return this.#t.value?.formService}}var Xe=Object.defineProperty,le=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&Xe(e,t,o),o};class K extends y{constructor(){super(),this._ssoApi=null,this._modalSSO=m(),this._modalBodySSO=m(),this._emailInput=m(),this._formId=`form-${p()}`,this._emailId=`email-${p()}`,this._passwordId=`password-${p()}`,this._reactiveFormRef=m(),this._emailSubscription=void 0,this._userEmail="",this._ssoInfo="",this._login=async e=>{e.preventDefault();const t=await this._authenticationFormController.getFormValues();this._authenticationFormController.getFormState()!==G.validationFailed&&await this._authenticationApi.login(t.email,t.password)},this._openRegisterModal=async()=>{await this._authenticationApi.closeLoginModal(),await this._authenticationApi.openRegisterModal()},this._openRemindPasswordModal=async()=>{await this._authenticationApi.closeLoginModal(),await this._authenticationApi.openRemindPasswordModal()},this._subscribeToTemporaryUserEmail=e=>{if(e.target!==this._reactiveFormRef.value)return;const t=this._authenticationFormController.getFormService();this._emailSubscription=t.selectFormControl$(this._emailId).subscribe(s=>{typeof s?.value=="string"&&this._authenticationApi.setLoginEmail(s.value)})},this._unsubscribeFromTemporaryUserEmail=e=>{e.target===this._reactiveFormRef.value&&this._emailSubscription?.unsubscribe()},this.captureBackdropClickForSSOModal=e=>{e.stopImmediatePropagation(),this._modalSSO.value?.close()},this._updateSSOModalPosition=()=>{O.nextTick(async()=>{const e=this._modalBodySSO.value?.closest(".modal-wrapper"),t=this._emailInput.value;if(!e||!t)return;const s=16,o="1rem",n={SIDE_LEFT:"modal-wrapper_sso-side-left",SIDE:"modal-wrapper_sso-side",UNDER:"modal-wrapper_sso-under",BOTTOM:"modal-wrapper_sso-bottom"},i=t.getBoundingClientRect(),c=e.getBoundingClientRect(),{innerWidth:b,innerHeight:z}=window,ce=i.right+s+c.width<=b&&i.top+c.height<=z&&i.top>=0,de=i.left-c.width<=b&&i.bottom+s+c.height<=z&&i.left>=0,he=i.left-c.width>0&&i.left-c.width<=b&&i.top+c.height<=z&&i.top>=0&&i.left>=0;e.classList.remove(n.SIDE,n.UNDER,n.BOTTOM);let N=n.BOTTOM,M="";const X=!!this.closest(".sheet");if(X&&he){N=n.SIDE_LEFT;const T=`calc(${i.left-c.width}px - ${o})`,x=`${i.top-i.height}px`;M=`translate3d(${T}, ${x}, 0)`}else if(ce){N=n.SIDE;const T=`calc(${i.left+i.width}px + ${o})`,x=`${i.top-i.height}px`;M=`translate3d(${T}, ${x}, 0)`}else if(de&&!X&&b>1e3){N=n.UNDER;const T=`${i.left}px`,x=`calc(${i.top+i.height}px + ${o})`;M=`translate3d(${T}, ${x}, 0)`}e.classList.add(N),e.style.transform=M,e.style.left=M?"0":"",e.style.top=M?"0":""})},this._authenticationApi=this.getApiSync(f.api),this._storefrontSettingsApi=this.getApiSync(C.api),this._translationApi=this.getApiSync(D.api),this._isRegistrationEnabled=this._storefrontSettingsApi.selectSkinSettings$().pipe(Le(({isRegistrationEnabled:e})=>e==="1")),this._authenticationFormController=new Y({host:this,formRef:this._reactiveFormRef,authenticationApi:this._authenticationApi}),this._ssoInfo=this._translationApi.translate("By using Shoper ONE to register or log in to online stores, we will share your data with the selected store. Please note that cyber_Folks S.A. will have access to the data you provide or that is collected in the given online store. Detailed information can be found in the {{- link }}Terms of Service{{- linkEnd }} and {{- link2 }}Privacy Policy.{{- linkEnd2 }}",{link:'<a href="https://shoper.one/dokumenty/regulamin_1.pdf" target="_blank" rel="noopener noreferrer" class="link link_secondary">',linkEnd:"</a>",link2:'<a href="https://shoper.one/dokumenty/polityka_prywatnosci_1.pdf" target="_blank" rel="noopener noreferrer" class="link link_secondary">',linkEnd2:"</a>"})}static{this.moduleName="login-form"}connectedCallback(){super.connectedCallback(),this._showSocialLogins()}_showSocialLogins(){!this.closest(".modal")&&!this.closest(".sheet")&&this.querySelectorAll("[hidden]").forEach(e
121=>{e.removeAttribute("hidden")})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._updateSSOModalPosition)}async _checkEmailInSso(e){const t=e.target;this._checkUserSSO(t.value.trim())}async _checkUserSSO(e){this._storefrontSettingsApi.getSkinSettings().isShoperSSOActive==="1"&&(this._ssoApi||(this._ssoApi=await this.getApi(Se.api)),await this._ssoApi.checkUser(e)&&(document.addEventListener(te.clicked,this.captureBackdropClickForSSOModal,{capture:!0,once:!0}),this._userEmail=e,O.nextTick(async()=>{window.addEventListener("resize",this._updateSSOModalPosition),this._modalSSO.value?.open(),this._updateSSOModalPosition()}),this.emitCustomEvent("showSSOModal")))}renderHasSSOAccountModal(){const e=document.querySelector("a.shoper_sso")?.href;return r`<h-modal
122            @close="${()=>{document.removeEventListener(te.clicked,this.captureBackdropClickForSSOModal,!0),this.emitCustomEvent("hideSSOModal")}}"
123            class="modal-wrapper_s modal-wrapper_sso"
124            ${h(this._modalSSO)}
125            hidden
126        >
127            <h-modal-header>
128                <header>
129                    <h2 class="font_semibold h2">${a("You have Shoper One account")}<br /></h2>
130                    <small class="color_secondary">${a("You log in with one account in thousands of stores")}</small>
131                </header>
132
133                <h-modal-close
134                    aria-label="${a("Close window")}"
135                    class="btn btn_icon"
136                >
137                    <h-icon
138                        icon-name="icon-x"
139                        role="button"
140                        size="xl"
141                        clickable
142                    ></h-icon>
143                </h-modal-close>
144            </h-modal-header>
145            <h-modal-body ${h(this._modalBodySSO)}>
146                <div class="d-flex align-items-center mt-xs-2">
147                    <div
148                        class="user-menu__user-icon"
149                        aria-hidden="true"
150                    >
151                        ${this._userEmail[0]?.toUpperCase()}
152                    </div>
153
154                    <p class="ml-xs-2 font_semibold">${this._userEmail}</p>
155                </div>
156
157                <div class="modal-sso__indicator"></div>
158            </h-modal-body>
159            <h-modal-footer>
160                <footer>
161                    <a
162                        href="${e}"
163                        data-turbo="false"
164                        class="btn btn_primary btn_full-width mb-xs-2"
165                    >
166                        ${a("Continue")}
167                    </a>
168
169                    <small class="color_secondary"> ${P(this._ssoInfo)} </small>
170                </footer>
171            </h-modal-footer>
172        </h-modal> `}render(){return r`
173            <reactive-form
174                @connected="${this._subscribeToTemporaryUserEmail}"
175                @disconnected="${this._unsubscribeFromTemporaryUserEmail}"
176                ${h(this._reactiveFormRef)}
177            >
178                <div
179                    class="form__additional-info mt-xs-0"
180                    aria-hidden="true"
181                >
182                    <i>
183                        ${a("Required fields are marked with")} -
184                        <span class="form__additional-info_secondary">*</span>
185                    </i>
186                </div>
187
188                <form
189                    class="pb-xs-1"
190                    id=${this._formId}
191                    @submit=${this._login}
192                >
193                    <control-connector
194                        min="3"
195                        required
196                        class="control"
197                        validationMode="change"
198                    >
199                        <h-control>
200                            <h-control-label class="control__label">
201                                <label
202                                    class="label label_required"
203                                    for=${this._emailId}
204                                >
205                                    <span
206                                        class="label__asterisk"
207                                        aria-hidden="true"
208                                        >*</span
209                                    >
210                                    ${a("E-mail address")}
211                                </label>
212                            </h-control-label>
213
214                            <h-control-content class="control">
215                                <h-control-element class="control__element">
216                                    <h-input
217                                        ${h(this._emailInput)}
218                                        controlId=${this._emailId}
219                                        controlName="email"
220                                        required
221                                        @focusout="${e=>{this._checkEmailInSso(e)}}"
222                                    >
223                                        <h-input-control type="email"></h-input-control>
224                                    </h-input>
225                                </h-control-element>
226
227                                <control-errors></control-errors>
228                            </h-control-content>
229                        </h-control>
230                    </control-connector>
231
232                    <control-connector
233                        validationMode="change"
234                        required
235                        class="control"
236                    >
237                        <h-control>
238                            <h-control-label class="control__label">
239                                <label
240                                    class="label label_required"
241                                    for=${this._passwordId}
242                                >
243                                    <span
244                                        class="label__asterisk"
245                                        aria-hidden="true"
246                                        >*</span
247                                    >
248                                    ${a("Password")}
249                                </label>
250                            </h-control-label>
251
252                            <h-control-content class="control">
253                                <h-control-element class="control__element">
254                                    <h-input
255                                        controlId=${this._passwordId}
256                                        controlName="password"
257                                        type="password"
258                                        required
259                                    >
260                                        <h-input-control></h-input-control>
261                                    </h-input>
262                                </h-control-element>
263
264                                <control-errors></control-errors>
265                            </h-control-content>
266                        </h-control>
267                    </control-connector>
268
269                    <p class="align_right font_size-s mb-xs-2">
270                        <span
271                            @click="${this._openRemindPasswordModal}"
272                            @keydown="${e=>{(e.key==="Enter"||e.code==="Space")&&this._openRemindPasswordModal()}}"
273                            tabindex="0"
274                            class="link link_secondary"
275                            >${a("Forgot your password?")}</span
276                        >
277                    </p>
278
279                    <button
280                        type="submit"
281                        class="btn btn_primary btn_full-width"
282                        @click=${this._login}
283                    >
284                        ${a("Log in")}
285                    </button>
286                </form>
287            </reactive-form>
288
289            ${this.getSlot("additional-login-providers")}
290            ${se(this._isRegistrationEnabled,r`<p class="font_size-s align_center mb-xs-2 color_main">
291                    ${a("Don't have an account?")}
292                    <span
293                        @click="${this._openRegisterModal}"
294                        @keydown="${e=>{(e.key==="Enter"||e.code==="Space")&&this._openRegisterModal()}}"
295                        tabindex="0"
296                        class="link link_no-underline"
297                        ><b>${a("Register now")}</b></span
298                    >
299                </p>`,d)}
300            ${this.renderHasSSOAccountModal()}
301        `}}le([u()],K.prototype,"_userEmail");le([u()],K.prototype,"_ssoInfo");var Je=Object.defineProperty,E=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&Je(e,t,o),o};class w extends y{constructor(){super(),this._formId=`form-${p()}`,this._emailId=`email-${p()}`,this._newPasswordId=`new-password-${p()}`,this._firstNameId=`first-name-${p()}`,this._lastNameId=`last-name-${p()}`,this._phoneId=`phone-${p()}`,this._countryId=`country-${p()}`,this._streetId=`street-${p()}`,this._postalCodeId=`postal-code-${p()}`,this._cityId=`city-${p()}`,this._reactiveFormRef=m(),this._postalCodeInputRef=m(),this._selectOptionsCache=new Map,this._isCompany=!1,this._additionalFields=[],this._allCountries=[],this._isFullRegistrationMode=!1,this._selectedCountryCode="",this._register=async s=>{if(s.preventDefault(),this._storefrontSettings.isFeatureEnabled("dev_storefront_form_honeypot")&&this._inHoneypotTrap())return;const o=await this._authenticationFormController.getFormValues();if(typeof o.country_code=="object"&&(o.country_code=o.country_code?o.country_code[0]:""),this._registrationType&&(o.force_reg_type="1"),this._authenticationFormController.getFormState()!==G.validationFailed){const n=await this._authenticationApi.register(o);if(n.status===L.failed&&"errors"in n&&n.errors)for(const[i,c]of Object.entries(n.errors))this.getFormService().updateFormControlByName(i,{errors:c})}},this._goBackToLoginModal=async()=>{await this._authenticationApi.closeRegisterModal(),await this._authenticationApi.openLoginModal()},this._authenticationApi=this.getApiSync(f.api),this._storefrontSettings=this.getApiSync(C.api),this._translationApi=this.getApiSync(D.api),this._authenticationFormController=new Y({host:this,formRef:this._reactiveFormRef,authenticationApi:this._authenticationApi}),this._setAdditionalFields();const e=this._storefrontSettings.getSkinSettings().locale.replace("_","-"),t=e.slice(-2).toUpperCase();this._selectedCountryCode=t,this._storefrontSettings.selectCountries$().subscribe(s=>{const o=this._selectedCountryCode||t,n=s.map(c=>({value:c.isocode,content:this._translationApi.translate(c.name)})),i=n.some(({value:c})=>c===o)?o:n[0]?.value||"";this._selectedCountryCode=i,this._allCountries=n.map(c=>({...c,selected:c.value===i})).sort((c,b)=>c.content.localeCompare(b.content,e))}),this._storefrontSettings.selectSkinSettings$().subscribe(({registrationType:s,isFullRegistrationMode:o})=>{s&&(this._registrationType=s),this._isFullRegistrationMode=o==="1"})}static{this.moduleName="register-form"}async _setAdditionalFields(){const e=await this._authenticationApi.getAdditionalFieldsForRegistration();e&&(this._additionalFields=e,this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")&&this._cacheSelectOptions(this._additionalFields))}_cacheSelectOptions(e){e.forEach(t=>{t.type==="select"&&t.options&&t.options.length>
3010&&this._selectOptionsCache.set(t.id,t.options.map(s=>({value:String(s.id),content:s.value})))})}_inHoneypotTrap(){const e=this._reactiveFormRef.value?.querySelector('[name="email_verify"]');return e&&e.value?(alert("Message sent"),!0):!1}getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}updateEmailFromLoginForm(){this._authenticationFormController.updateEmailFromLoginForm(this._emailId)}_isPolishCountrySelected(){return this._selectedCountryCode==="PL"}_updatePostalCodeMask(){this._isPolishCountrySelected()?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()}_renderSelect(e){const t=this._storefrontSettings.isFeatureEnabled("dev_cached_select_options"),s=t?this._selectOptionsCache.get(e.id)||[]:void 0;return r`<control-connector
302            ?required=${e.isRequired}
303            class="control"
304            validationMode="change"
305        >
306            <h-control>
307                <h-control-label class="control__label">
308                    <label
309                        class="label${e.isRequired?" label_required":""}"
310                        for=${`additional_${e.id}_${this._formId}`}
311                        id="${e.id}_${this._formId}-label"
312                    >
313                        ${e.isRequired?r`<span
314                                  class="label__asterisk"
315                                  aria-hidden="true"
316                                  >*</span
317                              >`:d}
318                        ${e.description}
319                    </label>
320                </h-control-label>
321
322                <h-control-content class="control">
323                    <h-control-element class="control__element">
324                        <h-select
325                            class="select"
326                            control-id=${`additional_${e.id}_${this._formId}`}
327                            control-name=${`additional_${e.id}`}
328                            assistive-title-id="${e.id}_${this._formId}-label"
329                            ?required=${e.isRequired}
330                            .optionsList=${s}
331                            ?dev_cached_select_options=${t}
332                        >
333                            <h-select-toggler
334                                class="select-toggler"
335                                aria-labelledby="${e.id}_${this._formId}-label"
336                            >
337                                <span
338                                    class="select-toggler__placeholder"
339                                    slot="placeholder"
340                                    >${a("Select")}</span
341                                >
342                            </h-select-toggler>
343
344                            ${t?d:ee(e.options,o=>o.id,o=>r`<h-option
345                                              slot="content"
346                                              value=${o.id}
347                                              id="${o.id}"
348                                          >
349                                              <h-option-content>${o.value}</h-option-content>
350                                          </h-option>`)}
351                        </h-select>
352                    </h-control-element>
353
354                    <control-errors></control-errors>
355                </h-control-content>
356            </h-control>
357        </control-connector>`}_renderDescription(e){return r`<p class="font_size-s">${P(e.description)}</p>`}_renderCheckbox(e){return r`<control-connector
358            ?required=${e.isRequired}
359            class="control"
360        >
361            <h-control>
362                <h-control-content class="control">
363                    <h-control-element class="control__element">
364                        <h-checkbox
365                            controlId=${`additional_${e.id}_${this._formId}`}
366                            controlName=${`additional_${e.id}`}
367                            ?checked=${e.isChecked}
368                            value="1"
369                            ?required=${e.isRequired}
370                        >
371                            <h-checkbox-control></h-checkbox-control>
372
373                            <h-checkbox-content>
374                                <span
375                                    slot="label"
376                                    class="label${e.isRequired?" label_required":""}"
377                                >
378                                    ${e.isRequired?r`<span
379                                              class="label__asterisk"
380                                              aria-hidden="true"
381                                              >*</span
382                                          >`:d}
383                                    ${P(e.description)}
384                                </span>
385                            </h-checkbox-content>
386                        </h-checkbox>
387                    </h-control-element>
388
389                    <control-errors></control-errors>
390                </h-control-content>
391            </h-control>
392        </control-connector>`}_renderCheckboxNewsletter(e){return r`<control-connector
393            ?required=${e.isRequired}
394            class="control"
395        >
396            <h-control>
397                <h-control-content class="control">
398                    <h-control-element class="control__element">
399                        <h-checkbox
400                            controlId="${e.id}_${this._formId}"
401                            controlName=${e.id}
402                            ?checked=${e.isChecked}
403                            value="1"
404                            ?required=${e.isRequired}
405                        >
406                            <h-checkbox-control></h-checkbox-control>
407
408                            <h-checkbox-content>
409                                <span
410                                    slot="label"
411                                    class="label${e.isRequired?" label_required":""}"
412                                >
413                                    ${e.isRequired?r`<span
414                                              class="label__asterisk"
415                                              aria-hidden="true"
416                                              >*</span
417                                          >`:d}
418                                    ${P(e.label)}
419                                </span>
420
421                                <span slot="description">${P(e.description)}</span>
422                            </h-checkbox-content>
423                        </h-checkbox>
424                    </h-control-element>
425
426                    <control-errors></control-errors>
427                </h-control-content>
428            </h-control>
429        </control-connector>`}_renderTextInput(e){return r`<control-connector
430            ?required=${e.isRequired}
431            class="control"
432        >
433            <h-control>
434                <h-control-label class="control__label">
435                    <label
436                        class="label${e.isRequired?" label_required":""}"
437                        for=${`additional_${e.id}_${this._formId}`}
438                    >
439                        ${e.isRequired?r`<span
440                                  class="label__asterisk"
441                                  aria-hidden="true"
442                                  >*</span
443                              >`:d}
444                        ${e.description}
445                    </label>
446                </h-control-label>
447
448                <h-control-content class="control">
449                    <h-control-element class="control__element">
450                        <h-input
451                            controlId=${`additional_${e.id}_${this._formId}`}
452                            controlName=${`additional_${e.id}`}
453                            ?required=${e.isRequired}
454                        >
455                            <h-input-control></h-input-control>
456                        </h-input>
457                    </h-control-element>
458
459                    <control-errors></control-errors>
460                </h-control-content>
461            </h-control>
462        </control-connector>`}_renderHiddenInput(e){return r`<control-connector
463            ?required=${e.isRequired}
464            class="control"
465            hidden
466        >
467            <h-input
468                type="hidden"
469                controlId=${`additional_${e.id}_${this._formId}`}
470                controlName=${`additional_${e.id}`}
471                ?required=${e.isRequired}
472            >
473                <h-input-control type="hidden"></h-input-control>
474            </h-input>
475        </control-connector>`}_renderFullRegistrationFields(){return r` ${_(this._isCompany||this._registrationType===v.company,()=>r` <control-connector
476                        ?required=${this._isCompany||this._registrationType===v.company}
477                        class="control"
478                    >
479                        <h-control>
480                            <h-control-label class="control__label">
481                                <label
482                                    class="label label_required"
483                                    for="tax_id"
484                                >
485                                    <span
486                                        class="label__asterisk"
487                                        aria-hidden="true"
488                                        >*</span
489                                    >
490                                    ${a("Taxpayer Identification Number (TIN)")}
491                                </label>
492                            </h-control-label>
493
494                            <h-control-content class="control">
495                                <h-control-element class="control__element">
496                                    <h-input
497                                        controlId="tax_id"
498                                        controlName="tax_id"
499                                        ?required=${this._isCompany||this._registrationType===v.company}
500                                    >
501                                        <h-input-control></h-input-control>
502                                    </h-input>
503                                </h-control-element>
504
505                                <control-errors></control-errors>
506                            </h-control-content>
507                        </h-control>
508                    </control-connector>
509
510                    <control-connector
511                        ?required=${this._isCompany||this._registrationType===v.company}
512                        class="control"
513                    >
514                        <h-control>
515                            <h-control-label class="control__label">
516                                <label
517                                    class="label label_required"
518                                    for="company_name"
519                                >
520                                    <span
521                                        class="label__asterisk"
522                                        aria-hidden="true"
523                                        >*</span
524                                    >
525                                    ${a("Company name")}
526                                </label>
527                            </h-control-label>
528
529                            <h-control-content class="control">
530                                <h-control-element class="control__element">
531                                    <h-input
532                                        controlId="company_name"
533                                        controlName="company_name"
534                                        ?required=${this._isCompany||this._registrationType===v.company}
535                                    >
536                                        <h-input-control></h-input-control>
537                                    </h-input>
538                                </h-control-element>
539
540                                <control-errors></control-errors>
541                            </h-control-content>
542                        </h-control>
543                    </control-connector>`,()=>d)}
544
545            <control-connector
546                required
547                class="control"
548            >
549                <h-control>
550                    <h-control-label class="control__label">
551                        <label
552                            class="label label_required"
553                            for=${this._firstNameId}
554                        >
555                            <span
556                                class="label__asterisk"
557                                aria-hidden="true"
558                                >*</span
559                            >
560                            ${a("First name")}
561                        </label>
562                    </h-control-label>
563
564                    <h-control-content class="control">
565                        <h-control-element class="control__element">
566                            <h-input
567                                controlId=${this._firstNameId}
568                                controlName="firstname"
569                                required
570                            >
571                                <h-input-control></h-input-control>
572                            </h-input>
573                        </h-control-element>
574
575                        <control-errors></control-errors>
576                    </h-control-content>
577                </h-control>
578            </control-connector>
579
580            <control-connector
581                required
582                class="control"
583            >
584                <h-control>
585                    <h-control-label class="control__label">
586                        <label
587                            class="label label_required"
588                            for=${this._lastNameId}
589                        >
590                            <span
591                                class="label__asterisk"
592                                aria-hidden="true"
593                                >*</span
594                            >
595                            ${a("Last name")}
596                        </label>
597                    </h-control-label>
598
599                    <h-control-content class="control">
600                        <h-control-element class="control__element">
601                            <h-input
602                                controlId=${this._lastNameId}
603                                controlName="lastname"
604                                required
605                            >
606                                <h-input-control></h-input-control>
607                            </h-input>
608                        </h-control-element>
609
610                        <control-errors></control-errors>
611                    </h-control-content>
612                </h-control>
613            </control-connector>
614
615            <control-connector
616                required
617                class="control"
618            >
619                <h-control>
620                    <h-control-label class="control__label">
621                        <label
622                            class="label label_required"
623                            for=${this._phoneId}
624                        >
625                            <span
626                                class="label__asterisk"
627                                aria-hidden="true"
628                                >*</span
629                            >
630                            ${a("Phone number")}
631                        </label>
632                    </h-control-label>
633
634                    <h-control-content class="control">
635                        <h-control-element class="control__element">
636                            <h-input
637                                controlId=${this._phoneId}
638                                controlName="phone"
639                                required
640                            >
641                                <h-input-control type="tel"></h-input-control>
642                            </h-input>
643                        </h-control-element>
644
645                        <control-errors></control-errors>
646                    </h-control-content>
647                </h-control>
648            </control-connector>
649
650            <control-connector
651                required
652                class="control"
653            >
654                <h-control>
655                    <h-control-label class="control__label">
656                        <label
657                            class="label"
658                            id="${this._countryId}-label"
659                            for="${this._countryId}"
660                            >${a("Country")}</label
661                        >
662                    </h-control-label>
663
664                    <h-control-content class="control">
665                        <h-control-element class="control__element">
666                            <h-select
667                                @change=${e=>{const s=e.target?.selectedOptions?.[0]?.value;s&&(this._selectedCountryCode=s),this._updatePostalCodeMask()}}
668                                class="select"
669                                control-id=${this._countryId}
670                                control-name="country_code"
671                                no-deselect
672                                .optionsList="${this._allCountries}"
673                                required
674                                assistive-title-id="${this._countryId}-label"
675                                ?dev_cached_select_options=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")}
676                            >
677                                <h-select-toggler
678                                    class="select-toggler"
679                                    aria-labelledby="${this._countryId}-label"
680                                >
681                                    <span
682                                        class="select-toggler__placeholder"
683                                        slot="placeholder"
684                                    ></span>
685                                </h-select-toggler>
686                            </h-select>
687                        </h-control-element>
688
689                        <control-errors></control-errors>
690                    </h-control-content>
691                </h-control>
692            </control-connector>
693
694            <control-connector
695                required
696                class="control"
697            >
698                <h-control>
699                    <h-control-label class="control__label">
700                        <label
701                            class="label label_required"
702                            for=${this._streetId}
703                        >
704                            <span
705                                class="label__asterisk"
706                                aria-hidden="true"
707                                >*</span
708                            >
709                            ${a("Street name and house number")}
710                        </label>
711                    </h-control-label>
712
713                    <h-control-content class="control">
714                        <h-control-element class="control__element">
715                            <h-input
716                                controlId=${this._streetId}
717                                controlName="street_1"
718                                required
719                            >
720                                <h-input-control></h-input-control>
721                            </h-input>
722                        </h-control-element>
723
724                        <control-errors></control-errors>
725                    </h-control-content>
726                </h-control>
727            </control-connector>
728
729            <control-connector
730                required
731                class="control"
732            >
733                <h-control>
734                    <h-control-label class="control__label">
735                        <label
736                            class="label label_required"
737                            for=${this._postalCodeId}
738                        >
739                            <span
740                                class="label__asterisk"
741                                aria-hidden="true"
742                                >*</span
743                            >
744                            ${a("Postal code")}
745                        </label>
746                    </h-control-label>
747
748                    <h-control-content class="control">
749                        <h-control-element class="control__element control__element_half">
750                            <h-input
751                                controlId=${this._postalCodeId}
752                                controlName="zip_code"
753                                required
754                            >
755                                <h-input-control
756                                    @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._updatePostalCodeMask()},50)}}"
757                                    ${h(this._postalCodeInputRef)}
758                                    mask-disabled=${this._selectedCountryCode!=="PL"||d}
759                                    mask="__-___"
760                                    pattern="^(\\d{2})(-)(\\d{3})$"
761                                    valid-pattern="00-000"
762                                ></h-input-control>
763                            </h-input>
764                        </h-control-element>
765
766                        <control-errors></control-errors>
767                    </h-control-content>
768                </h-control>
769            </control-connector>
770
771            <control-connector
772                required
773                class="control"
774            >
775                <h-control>
776                    <h-control-label class="control__label">
777                        <label
778                            class="label label_required"
779                            for=${this._cityId}
780                        >
781                            <span
782                                class="label__asterisk"
783                                aria-hidden="true"
784                                >*</span
785                            >
786                            ${a("City")}
787                        </label>
788                    </h-control-label>
789
790                    <h-control-content class="control">
791                        <h-control-element class="control__element">
792                            <h-input
793                                controlId=${this._cityId}
794                                controlName="city"
795                                required
796                            >
797                                <h-input-control></h-input-control>
798                            </h-input>
799                        </h-control-element>
800
801                        <control-errors></control-errors>
802                    </h-control-content>
803                </h-control>
804            </control-connector>`}render(){return r`
805            <reactive-form ${h(this._reactiveFormRef)}>
806                <form
807                    id=${this._formId}
808                    @submit=${this._register}
809                >
810                    <div
811                        class="form__additional-info mt-xs-0"
812                        aria-hidden="true"
813                    >
814                        <i>
815                            ${a("Required fields are marked with")} -
816                            <span class="form__additional-info_secondary">*</span>
817                        </i>
818                    </div>
819
820                    ${_(this._isFullRegistrationMode&&(!this._registrationType||this._registrationType===v.consumerAndCompany),()=>r`<control-connector
821                            requiredInGroup
822                            class="control control_row pt-xs-1"
823                            @change=${e=>{const t=e.target;t instanceof HTMLInputElement&&(this._isCompany=t.value==="true")}}
824                        >
825                            <h-control-content class="control__content_auto">
826                                <h-control-element class="control__element">
827                                    <div class="radio-box">
828                                        <input
829                                            type="radio"
830                                            id="account-type-consumer"
831                                            name="isCompany"
832                                            .checked=${!this._isCompany}
833                                            value="false"
834                                            class="radio-box__input"
835                                        />
836
837                                        <label
838                                            class="radio-box__label"
839                                            for="account-type-consumer"
840                                        >
841                                            ${a("Consumer")}
842                                        </label>
843                                    </div>
844                                </h-control-element>
845
846                                <control-errors></control-errors>
847                            </h-control-content>
848                            <h-control-content class="control__content_auto">
849                                <h-control-element class="control__element">
850                                    <div class="radio-box">
851                                        <input
852                                            type="radio"
853                                            id="account-type-company"
854                                            name="isCompany"
855                                            .checked=${this._isCompany}
856                                            value="true"
857                                            class="radio-box__input"
858                                        />
859
860                                        <label
861                                            class="radio-box__label"
862                                            for="account-type-company"
863                                        >
864                                            ${a("Company")}
865                                        </label>
866                                    </div>
867                                </h-control-element>
868
869                                <control-errors></control-errors>
870                            </h-control-content>
871                        </control-connector>`,()=>d)}
872
873                    <control-connector
874                        validationMode="change"
875                        min="3"
876                        required
877                        email
878                        class="control"
879                    >
880                        <h-control>
881                            <h-control-label class="control__label">
882                                <label
883                                    class="label label_required"
884                                    for=${this._emailId}
885                                >
886                                    <span
887                                        class="label__asterisk"
888                                        aria-hidden="true"
889                                        >*</span
890                                    >
891                                    ${a("E-mail address")}
892                                </label>
893                            </h-control-label>
894
895                            <h-control-content class="control">
896                                <h-control-element class="control__element">
897                                    <h-input
898                                        controlId=${this._emailId}
899                                        controlName="mail"
900                                        required
901                                    >
902                                        <h-input-control></h-input-control>
903                                    </h-input>
904                                </h-control-element>
905
906                                <control-errors></control-errors>
907                            </h-control-content>
908                        </h-control>
909                    </control-connector>
910
911                    <control-connector
912                        validationMode="change"
913                        min="12"
914                        required
915                        class="control"
916                    >
917                        <h-control>
918                            <h-control-label class="control__label">
919                                <label
920                                    class="label label_required"
921                                    for=${this._newPasswordId}
922                                >
923                                    <span
924                                        class="label__asterisk"
925                                        aria-hidden="true"
926                                        >*</span
927                                    >
928                                    ${a("Create password")}
929                                </label>
930                            </h-control-label>
931
932                            <h-control-content class="control">
933                                <h-control-element class="control__element">
934                                    <h-input
935                                        controlId=${this._newPasswordId}
936                                        controlName="password"
937                                        type="password"
938                                        required
939                                    >
940                                        <h-input-control aria-describedby="${this._newPasswordId}-helper"></h-input-control>
941                                    </h-input>
942                                </h-control-element>
943
944                                <div
945                                    class="helper"
946                                    id="${this._newPasswordId}-helper"
947                                >
948                                    ${a("The password should have min. 12 characters")}
949                                </div>
950                                <control-errors></control-errors>
951                            </h-control-content>
952                        </h-control>
953                    </control-connector>
954
955                    ${_(this._storefrontSettings.isFeatureEnabled("dev_storefront_form_honeypot"),()=>r`<input
956                            type="text"
957                            name="email_verify"
958                            aria-hidden="true"
959                            tabindex="-1"
960                            autocomplete="verify-email"
961                        />`,()=>d)}
962                    ${_(this._isFullRegistrationMode,()=>this._renderFullRegistrationFields(),()=>d)}
963                    ${ee(this._additionalFields,e=>e.id,e=>{if(e.type==="select")return this._renderSelect(e);if(e.type==="description")return this._renderDescription(e);if(e.id==="newsletter"&&e.type==="checkbox")return this._renderCheckboxNewsletter(e);if(e.type==="checkbox")return this._renderCheckbox(e);if(e.type==="text")return this._renderTextInput(e);if(e.type==="hidden")return this._renderHiddenInput(e)})}
964
965                    <button
966                        type="submit"
967                        class="btn btn_primary btn_full-width mb-xs-2"
968                        @click=${this._register}
969                    >
970                        ${a("Create an account")}
971                    </button>
972                </form>
973            </reactive-form>
974
975            ${this.getSlot("additional-login-providers")}
976
977            <p class="font_size-s align_center mb-xs-2 color_main">
978                ${a("Have an account?")}
979                <span
980                    @click="${this._goBackToLoginModal}"
981                    @keydown="${e=>{(e.key==="Enter"||e.code==="Space")&&this._goBackToLoginModal()}}"
982                    tabindex="0"
983                    class="link link_no-underline"
984                    ><b>${a("Log in")}</b></span
985                >
986            </p>
987        `}}E([u()],w.prototype,"_isCompany");E([u()],w.prototype,"_additionalFields");E([u()],w.prototype,"_allCountries");E([u()],w.prototype,"_isFullRegistrationMode");E([u()],w.prototype,"_registrationType");E([u()],w.prototype,"_selectedCountryCode");class Ze extends y{constructor(){super(),this._formId=`form-${p()}`,this._emailId=`email-${p()}`,this._reactiveFormRef=m(),this._remindPassword=async e=>{e.preventDefault();const t=await this._authenticationFormController.getFormValues();this._authenticationFormController.getFormState()!==G.validationFailed&&await this._authenticationApi.resetPassword(t.email)},this._goBackToLoginModal=async()=>{await this._authenticationApi.closeRemindPasswordModal(),await this._authenticationApi.openLoginModal()},this._authenticationApi=this.getApiSync(f.api),this._authenticationFormController=new Y({host:this,formRef:this._reactiveFormRef,authenticationApi:this._authenticationApi})}static{this.moduleName="remind-password-form"}updateEmailFromLoginForm(){this._authenticationFormController.updateEmailFromLoginForm(this._emailId)}render(){return r`
988            <reactive-form ${h(this._reactiveFormRef)}>
989                <p class="font_size-s">
990                    ${a("Please enter the e-mail address associated with your customer account. We will send a link to set up a new password.")}
991                </p>
992
993                <form
994                    id=${this._formId}
995                    @submit=${this._remindPassword}
996                >
997                    <control-connector
998                        min="3"
999                        required
1000                        email
1001                        class="control"
1002                        validationMode="change"
1003                    >
1004                        <h-control>
1005                            <h-control-label class="control__label">
1006                                <label
1007                                    class="label"
1008                                    for=${this._emailId}
1009                                    >${a("E-mail address")}</label
1010                                >
1011                            </h-control-label>
1012
1013                            <h-control-content class="control">
1014                                <h-control-element class="control__element">
1015                                    <h-input
1016                                        controlId=${this._emailId}
1017                                        controlName="email"
1018                                    >
1019                                        <h-input-control></h-input-control>
1020                                    </h-input>
1021                                </h-control-element>
1022
1023                                <control-errors></control-errors>
1024                            </h-control-content>
1025                        </h-control>
1026                    </control-connector>
1027
1028                    <button
1029                        type="submit"
1030                        class="btn btn_primary btn_full-width mb
1030-xs-2"
1031                        @click=${this._remindPassword}
1032                    >
1033                        ${a("Send password change link")}
1034                    </button>
1035                </form>
1036
1037                <p class="font_size-s align_center mb-xs-2">
1038                    <span
1039                        @click="${this._goBackToLoginModal}"
1040                        @keydown="${e=>{(e.key==="Enter"||e.code==="Space")&&this._goBackToLoginModal()}}"
1041                        tabindex="0"
1042                        class="link link_no-underline"
1043                        ><b>${a("Go back to login")}</b></span
1044                    >
1045                </p>
1046            </reactive-form>
1047        `}}class et extends y{constructor(){super(),this._openRegisterModal=()=>{this._authenticationApi.openRegisterModal()},this._btnController=new V(this,this._openRegisterModal),this._authenticationApi=this.getApiSync(f.api)}static{this.moduleName="register-modal-opener"}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._openRegisterModal)}}var tt=Object.defineProperty,Q=(l,e,t,s)=>{for(var o=void 0,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=i(e,t,o)||o);return o&&tt(e,t,o),o};const oe="g-recaptcha-response";class H extends y{constructor(){super(),this._storefrontSettings=null,this._isCompany=!1,this._isFullRegistrationMode=!1,this._$companyFieldsContainer=null,this._recaptchaApi=null,this._isRecaptchaSocialRegisterFixEnabled=!1,this._storefrontSettings=this.getApiSync(C.api),this._isRecaptchaSocialRegisterFixEnabled=this._storefrontSettings.isFeatureEnabled("dev_recaptcha_social_register_fix");const e=this._storefrontSettings.getSkinSettings();e?.registrationType&&(this._isCompany=e.registrationType===v.company,this._registrationType=e?.registrationType),this._isFullRegistrationMode=e?.isFullRegistrationMode==="1"}static{this.moduleName="social-register-form"}connectedCallback(){super.connectedCallback(),this._$companyFieldsContainer||(this._$companyFieldsContainer=this.querySelector(".company-fields-container")),this._updateCompanyFieldsContainerVisibility(this._isCompany),this._isRecaptchaSocialRegisterFixEnabled&&this._resolveRecaptchaApi()}async _resolveRecaptchaApi(){try{this._recaptchaApi=await this.getApi(Ae.api)}catch{this._recaptchaApi=null}}updated(e){super.updated(e),e.has("_isCompany")&&this._updateCompanyFieldsContainerVisibility(this._isCompany)}_updateCompanyFieldsContainerVisibility(e){if(!this._$companyFieldsContainer)return;this._$companyFieldsContainer.hidden=!e,[...this._$companyFieldsContainer.querySelectorAll("input")].forEach(s=>{s.disabled=!e})}async _addRecaptchaTokenToForm(e){if(!this._recaptchaApi||!this._recaptchaApi.isRecaptchaEnabled())return;e.preventDefault();const t=e.target;try{this._setRecaptchaToken(t,await this._recaptchaApi.getToken("submit"))}catch(s){console.error(s)}t.submit()}_setRecaptchaToken(e,t){const s=e.querySelector(`[name="${oe}"]`);if(s){s.value=t;return}const o=document.createElement("input");o.type="hidden",o.name=oe,o.value=t,e.appendChild(o)}render(){return r`
1048            <form
1049                action=""
1050                method="post"
1051                enctype="multipart/form-data"
1052                data-turbo="false"
1053                @submit=${this._isRecaptchaSocialRegisterFixEnabled?this._addRecaptchaTokenToForm:d}
1054            >
1055                ${_(this._isFullRegistrationMode&&(!this._registrationType||this._registrationType===v.consumerAndCompany),()=>r`
1056                        <fieldset class="mb-xs-2 account-type">
1057                            <legend class="sr-only">${a("Account type")}</legend>
1058
1059                            <control-connector
1060                                requiredInGroup
1061                                class="control control_row"
1062                                @change=${e=>{const t=e.target;t instanceof HTMLInputElement&&(this._isCompany=t.value==="true")}}
1063                            >
1064                                <h-control-content class="control__content_auto">
1065                                    <h-control-element class="control__element">
1066                                        <div class="radio-box">
1067                                            <input
1068                                                type="radio"
1069                                                id="account-type-consumer"
1070                                                name="isCompany"
1071                                                .checked=${!this._isCompany}
1072                                                value="false"
1073                                                class="radio-box__input"
1074                                            />
1075
1076                                            <label
1077                                                class="radio-box__label"
1078                                                for="account-type-consumer"
1079                                            >
1080                                                ${a("Consumer")}
1081                                            </label>
1082                                        </div>
1083                                    </h-control-element>
1084
1085                                    <control-errors></control-errors>
1086                                </h-control-content>
1087                                <h-control-content class="control__c
1087ontent_auto">
1088                                    <h-control-element class="control__element">
1089                                        <div class="radio-box">
1090                                            <input
1091                                                type="radio"
1092                                                id="account-type-company"
1093                                                name="isCompany"
1094                                                .checked=${this._isCompany}
1095                                                value="true"
1096                                                class="radio-box__input"
1097                                            />
1098
1099                                            <label
1100                                                class="radio-box__label"
1101                                                for="account-type-company"
1102                                            >
1103                                                ${a("Company")}
1104                                            </label>
1105                                        </div>
1106                                    </h-control-element>
1107
1108                                    <control-errors></control-errors>
1109                                </h-control-content>
1110                            </control-connector>
1111                        </fieldset>
1112                    `,()=>d)}
1113                ${this.getSlot("default")}
1114            </form>
1115        `}}Q([u()],H.prototype,"_isCompany");Q([u()],H.prototype,"_isFullRegistrationMode");Q([u()],H.prototype,"_registrationType");class yt extends ve{static{this.dependencies=[Ce.feature]}static{this.featureName=f.feature}async init(){const e=this.getApiSync(we),t=await this.getApi(Me.api),s=await this.getApi(D.api),o=await this.getApi(Re.api),n=await this.getApi(C.api),i=Oe(),c=new Ne(i),b=new He({authenticationRepository:c,httpApi:e,flashMessengerApi:t,translationApi:s,pageManagerApi:o,settingsApi:n});return{cores:[{type:Fe.api,instance:[new ze(b)]},{type:Ie,instance:[ne,Ge,K,et,w,W,je,re,ae,Ze,H]}]}}}export{yt as AuthenticationInitializer};

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.