import{h}from"./index-38ad4957.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{A as AuthWrapper,a as AuthColumn,H as HostBlock,b as AuthButtonsContainer,E as ErrorStyles}from"./mixins-f750863a.js";import{T as TextSpanView}from"./sqm-text-span-view-72f43dff.js";var style={Wrapper:AuthWrapper,Column:AuthColumn,HostBlock:HostBlock,":host":{margin:"0 auto",width:"100%"},ButtonsContainer:AuthButtonsContainer,ErrorStyle:ErrorStyles};var vanillaStyle="\nsqm-portal-register {\n  margin: 0 auto;\n  width: 100%;\n  display: block;\n}\n\n:host{\n  display: block;\n}\n\n:host([hidden]) {\n  display: none;\n}\n";var sheet=createStyleSheet(style);var styleString=sheet.toString();function PortalRegistrationFormView(e){var r,t,a,i,o,s,l,n,d,m,u,v,p,c,b,g,f,S,x,y;var w=e.states,E=e.refs,F=e.callbacks,T=e.content;if(w.error){window.scrollTo({top:0,left:0,behavior:"smooth"})}return h("div",{class:sheet.classes.Wrapper,part:"sqm-base"},h("style",{type:"text/css"},vanillaStyle,styleString),h(TextSpanView,{type:"h3"},T.pageLabel),h("sl-form",{class:sheet.classes.Column,"onSl-submit":F.submit,ref:function(e){return E.formRef.current=e},novalidate:true},((r=w.registrationFormState)===null||r===void 0?void 0:r.disabled)?h("sqm-form-message",{type:"error",exportparts:"erroralert-icon"},h("div",{part:"erroralert-text"},w.registrationFormState.disabledMessage)):w.error&&h("sqm-form-message",{type:"error",exportparts:"erroralert-icon"},h("div",{part:"erroralert-text"},e.states.error)),T.formData,!w.hideInputs&&h("sl-input",Object.assign({exportparts:"label: input-label, base: input-base",type:"email",name:"/email",label:T.emailLabel||"Email",disabled:w.loading||((t=w.registrationFormState)===null||t===void 0?void 0:t.disabled)||w.emailDisabled,required:true,validationError:function(e){var r=e.value;if(!r){return T.requiredFieldErrorMessage}if(!r.includes("@")){return T.invalidEmailErrorMessage}}},((i=(a=w.registrationFormState)===null||a===void 0?void 0:a.initialData)===null||i===void 0?void 0:i.email)?{value:(s=(o=w.registrationFormState)===null||o===void 0?void 0:o.initialData)===null||s===void 0?void 0:s.email}:{},((n=(l=w.registrationFormState)===null||l===void 0?void 0:l.validationErrors)===null||n===void 0?void 0:n.email)?{class:sheet.classes.ErrorStyle,helpText:((m=(d=w.registrationFormState)===null||d===void 0?void 0:d.validationErrors)===null||m===void 0?void 0:m.email)||T.requiredFieldErrorMessage}:[])),!(w.hideInputs||w.hidePasswords)&&h("sqm-password-field",{fieldLabel:T.passwordLabel,"disable-validation":!w.enablePasswordValidation,meetsRequirementsText:T.meetsRequirementsText,doesNotMeetRequirementsText:T.doesNotMeetRequirementsText,minErrorText:T.minErrorText,uppercaseErrorText:T.uppercaseErrorText,lowercaseErrorText:T.lowercaseErrorText,hasErrorText:T.hasErrorText}),T.passwordField,!(w.hideInputs||w.hidePasswords)&&w.confirmPassword&&h("sl-input",Object.assign({exportparts:"label: input-label, base: input-base",type:"password",name:"/confirmPassword",label:T.confirmPasswordLabel,disabled:w.loading||((u=w.registrationFormState)===null||u===void 0?void 0:u.disabled),required:true},((p=(v=w.registrationFormState)===null||v===void 0?void 0:v.initialData)===null||p===void 0?void 0:p.confirmPassword)?{value:(b=(c=w.registrationFormState)===null||c===void 0?void 0:c.initialData)===null||b===void 0?void 0:b.confirmPassword}:{},((f=(g=w.registrationFormState)===null||g===void 0?void 0:g.validationErrors)===null||f===void 0?void 0:f.confirmPassword)?{class:sheet.classes.ErrorStyle,helpText:((x=(S=w.registrationFormState)===null||S===void 0?void 0:S.validationErrors)===null||x===void 0?void 0:x.confirmPassword)||T.requiredFieldErrorMessage}:[])),T.emailOptIn,T.terms,h("div",{class:sheet.classes.ButtonsContainer},h("sl-button",{submit:true,loading:w.loading,disabled:(y=w.registrationFormState)===null||y===void 0?void 0:y.disabled,exportparts:"base: primarybutton-base",type:"primary"},T.submitLabel||"Register"),T.secondaryButton)))}export{PortalRegistrationFormView as P};