1import{n as e}from"./standalone-app-Bj-IdwrG.js";import{n as t,r as n}from"./polymer-C_GypsRJ.js";import{p as r,t as i}from"./institution-DyFDvNu6.js";import{n as a,o}from"./user-BMje1Le7.js";import"./xhr-promise-SX8oxAim.js";import{n as s,t as c}from"./display-strings-MZHh2uw2.js";import{t as l}from"./page-B8YwBOEr.js";import{Qt as u,a as d,an as f,n as p,nr as m,on as h,t as g,zn as _}from"./main-5Sl8yySz.js";import"./jha-card-DC-UH8vN.js";import"./jha-button-Dyau4S4K.js";import{t as v}from"./language-utils-DMDnwVwz.js";import"./jha-form-floating-group-DqE4-9IH.js";import"./bannoweb-password-rules-Dpj-QGn5.js";import{t as y}from"./light-dom-CYKHpBJx.js";import"./bannoweb-passwords-DC4qStI1.js";import{t as b}from"./form-utils-CEIyYoqC.js";var x=a.EventType,S={ATTEMPTED_CALL_WITHOUT_ABILITY:`AttemptedCallWithoutAbility`,PHONE_NUMBER_DOES_NOT_MATCH_CORE:`PhoneNumberDoesNotMatchCore`,AGE_RESTRICTION:`AgeRestriction`,UNKNOWN_AGE:`UnknownAge`,INVALID_IDENTIFIER:`InvalidIdentifier`,INELIGIBLE:`Ineligible`},C={AUTHY:`authy`,JSON_TYPE:`json`},w=class t extends u{constructor(e,t,n){super(e,t,n),this.acceptedEula=!1,this.validateCredsXhr_=null}async lookupUser(n,r,i,a,s,c){try{let e=window.sessionStorage.getItem(`institution`);window.sessionStorage.clear(),e&&window.sessionStorage.setItem(`institution`,e)}catch{}let l=this.createXhr_(),u=a.replace(/\D/g,``),d={id:n.split(`-`).join(``).trim(),i:this.institution_.id,a:r,ph:u,e:i,d:await this.deviceHash,di:await h},p={};s&&(p[`nds-data`]=s,p.reCAPTCHAToken=c);let m=await f(d,p,this.getServerTime());this.model_.deviceId=d.di;let g=`${e.API_SERVER}/v1/enrollment/lookup`;return l.post(g,m).then(e=>{this.dispatchEvent(new o(t.EventType.LOOKUP_SUCCESS,l.status,``,e))}).catch(e=>{this.handleEnrollmentStepFailedError(e)})}sendOtpCode(n,r){let i=this.createXhr_();return i.post(`${e.API_SERVER}/v1/enrollment/otp/send`,{phoneNumber:n,method:r}).then(()=>{this.dispatchEvent(new o(t.EventType.CODE_SENT,i.status))}).catch(e=>{switch(e&&e.statusCode){case 400:this.dispatchEvent(new o(t.EventType.OTP_SEND_BAD_REQUEST,e.statusCode));break;case 429:this.dispatchEvent(new o(t.EventType.OTP_SEND_TOO_MANY_ATTEMPTS,e.statusCode));break;case 500:this.dispatchEvent(new o(t.EventType.ENROLL_ERROR,e.statusCode,e.response.messages[0]));default:this.handleEnrollmentStepFailedError(e);break}})}verifyOtpCode(n,r,i){let a=this.createXhr_();return a.post(`${e.API_SERVER}/v1/enrollment/otp/verify`,{code:n,"nds-data":r,reCAPTCHAToken:i}).then(e=>{this.dispatchEvent(new o(t.EventType.VERIFY_CODE_SUCCESS,a.status,``,e))}).catch(e=>{switch(e&&e.statusCode){case 400:this.dispatchEvent(new o(t.EventType.OTP_VERIFY_BAD_REQUEST,e.statusCode));break;case 403:this.dispatchEvent(new o(t.EventType.INCORRECT_CODE,e.statusCode));break;case 429:this.dispatchEvent(new o(t.EventType.OTP_VERIFY_TOO_MANY_ATTEMPTS,e.statusCode));break;case 500:this.dispatchEvent(new o(t.EventType.ENROLL_ERROR,e.statusCode,e.response.messages[0]));default:this.handleEnrollmentStepFailedError(e);break}})}handleEnrollmentStepFailedError(n){switch(n&&n.statusCode){case 401:this.isIndexPageUpToDate()||l.ensureIndexPageUpdated(),e.console.error(n),this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR));break;case 403:if(n.response){let e=n.response;e.type===S.ATTEMPTED_CALL_WITHOUT_ABILITY?this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR)):e.type===S.PHONE_NUMBER_DOES_NOT_MATCH_CORE?this.dispatchEvent(new o(t.EventType.LOOKUP_INVALID_PHONE)):e.type===S.AGE_RESTRICTION?this.dispatchEvent(new o(t.EventType.AGE_RESTRICTION_ERROR,n.statusCode,``,{age:e.age})):e.type===S.UNKNOWN_AGE?this.dispatchEvent(new o(t.EventType.AGE_RESTRICTION_UNKNOWN)):e.type===S.INVALID_IDENTIFIER||e.type===S.INELIGIBLE?this.dispatchEvent(new o(t.EventType.LOOKUP_INVALID_IDENTIFIER)):this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR))}else this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR));break;case 404:this.dispatchEvent(new o(t.EventType.USER_NOT_FOUND));break;case 409:this.dispatchEvent(new o(t.EventType.LOOKUP_USER_ALREADY_ENROLLED));break;case 429:this.dispatchEvent(new o(t.EventType.LOOKUP_TOO_MANY_ATTEMPTS));break;case 400:if(n.response){let e=n.response;e&&e.type===C.AUTHY?this.dispatchEvent(new o(t.EventType.LOOKUP_AUTHY_ERROR,n.statusCode,``,e.messages)):this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR))}else this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR));break;case 503:if(n.response){let e=n.response;if(e&&e.type===`memoMode`){this.dispatchEvent(new o(x.MAINTENANCE_MODE));break}}default:this.dispatchEvent(new o(t.EventType.LOOKUP_ERROR))}}getCredentialsRules(){let n=this.createXhr_();return n.get(`${e.API_SERVER}/enrollment/credentials/rules`).then(e=>{let r=e;this.dispatchEvent(new o(t.EventType.RULES_SUCCESS,n.status,``,r))}).catch(e=>{switch(n.status){case 404:this.dispatchEvent(new o(t.EventType.USER_NOT_FOUND));break;
1default:this.dispatchEvent(new o(t.EventType.RULES_ERROR))}})}validateCredentials(n,r){this.validateCredsXhr_&&this.validateCredsXhr_.abort(),this.validateCredsXhr_=this.createXhr_();let i={username:n,password:r};return this.validateCredsXhr_.put(`${e.API_SERVER}/enrollment/credentials/validate`,i).then(e=>{this.dispatchEvent(new o(t.EventType.VALID_CREDS))}).catch(e=>{switch(e&&e.statusCode){case 400:this.dispatchEvent(new o(t.EventType.INVALID_CREDS,e.statusCode,``,e.response));break;case 404:this.dispatchEvent(new o(t.EventType.USER_NOT_FOUND));break;case 501:this.dispatchEvent(new o(t.EventType.VALIDATE_CREDS_UNSUPPORTED));break;default:this.dispatchEvent(new o(t.EventType.VALIDATE_CREDS_ERROR))}})}async enroll(n,r,i,a){this.validateCredsXhr_&&this.validateCredsXhr_.abort();try{let s=this.createXhr_(),c={username:n,password:r,"nds-data":i,reCAPTCHAToken:a},l=await s.post(`${e.API_SERVER}/enrollment`,c);await this.loginSuccess_(s.status,l),this.dispatchEvent(new o(t.EventType.ENROLL_SUCCESS))}catch(e){switch(e&&e.statusCode){case 400:e.response&&e.response.type===`InvalidCreds`?this.dispatchEvent(new o(t.EventType.ENROLL_INVALID_CREDS,e.statusCode,``,e.response)):this.dispatchEvent(new o(t.EventType.ENROLL_ERROR));break;case 401:this.dispatchEvent(new o(t.EventType.SESSION_TIMED_OUT));break;case 503:if(e.response&&e.response.type===`memoMode`){this.dispatchEvent(new o(x.MAINTENANCE_MODE));break}default:this.dispatchEvent(new o(t.EventType.ENROLL_ERROR))}}}storeAcceptEula(){this.acceptedEula=!0}};w.EventType={LOOKUP_SUCCESS:`lookup-success`,LOOKUP_INVALID_PHONE:`lookup-invalid-phone`,LOOKUP_TOO_MANY_ATTEMPTS:`lookup-too-many-attempts`,LOOKUP_INVALID_IDENTIFIER:`lookup-invalid-identifier`,USER_NOT_FOUND:`user-not-found`,LOOKUP_USER_ALREADY_ENROLLED:`lookup-user-already-enrolled`,LOOKUP_ERROR:`lookup-error`,LOOKUP_AUTHY_ERROR:`lookup-authy-error`,OTP_SEND_BAD_REQUEST:`otp-send-bad-request`,OTP_SEND_TOO_MANY_ATTEMPTS:`otp-send-too-many-attempts`,OTP_VERIFY_BAD_REQUEST:`otp-verify-bad-request`,OTP_VERIFY_TOO_MANY_ATTEMPTS:`otp-verify-too-many-attempts`,OTP_VERIFY_SUCCESS:`otp-verify-success`,CODE_SENT:`code-sent`,SEND_2FA_ERROR:`send-2fa-error`,SEND_2FA_AUTHY_ERROR:`send-2fa-authy-error`,VERIFY_CODE_SUCCESS:`verify-code-success`,INCORRECT_CODE:`incorrect-code`,VERIFY_CODE_ERROR:`verify-code-error`,RULES_SUCCESS:`rules-success`,RULES_ERROR:`rules-error`,VALID_CREDS:`valid-creds`,INVALID_CREDS:`invalid-creds`,VALIDATE_CREDS_UNSUPPORTED:`validate-creds-unsupported`,VALIDATE_CREDS_ERROR:`validate-creds-error`,ENROLL_SUCCESS:`enroll-success`,ENROLL_INVALID_CREDS:`enroll-invalid-creds`,ENROLL_ERROR:`enroll-error`,SESSION_TIMED_OUT:`session-timed-out`,AGE_RESTRICTION_ERROR:`age-restriction-error`,AGE_RESTRICTION_UNKNOWN:`age-restriction-unknown`},w.ChallengeType={MUST_SETUP_PHONE_FOR_2FA:`MUST_SETUP_PHONE_FOR_2FA`,MUST_VERIFY_OOB_CODE:`MUST_VERIFY_OOB_CODE`,MUST_VALIDATE_PHONE_NUMBER:`MUST_VALIDATE_PHONE_NUMBER`,MUST_ENROLL_THROUGH_UIS:`MUST_ENROLL_THROUGH_UIS`};var T=new w(_,i,m);d(T);var E=w.EventType,D=a.EventType,O=b(y(v(t)));window.BannowebEnrollmentCreateCredsElement=class extends O{static get is(){return`bannoweb-enrollment-create-creds`}static get properties(){return{credentialsAttempts:{type:Object,value:()=>({usernames:new Map,passwords:new Map})},isLoading:{type:Boolean,value:!1},errorMessage:{type:String},username:{type:String,observer:window.BannowebEnrollmentCreateCredsElement.prototype.observeUsername},password:{type:String,observer:window.BannowebEnrollmentCreateCredsElement.prototype.observePassword},passwordsMatch:{type:Boolean,value:!1},passwordRules:{type:Array,value:()=>[]},usernameRules:{type:Array,value:()=>[]},supportsValidation:{type:Boolean,value:!0},usernameErrors:{type:Array,value:()=>[]},passwordErrors:{type:Array,value:()=>[]},usernameChanged:{type:Boolean,value:!1},passwordChanged:{type:Boolean,value:!1},passwordLabel:{type:String,value:`Password`},validatingPassword:{type:Boolean,value:!1},validatingUsername:{type:Boolean,value:!1},uisEnrollment:{type:Boolean,value:!1}}}constructor(){super(),this.validationTimeout_=null}connectedCallback(){super.connectedCallback();let e=r.from(T).subscribe(t=>
1{if(t.type===E.RULES_SUCCESS){let e=t.data;this.passwordRules=e.password,this.usernameRules=e.username}e.unsubscribe()});T.getCredentialsRules()}isDisabled_(e,t,n,r,i,a){return!n||!e||e.trim().length===0||!t||t.trim().length===0?!0:r?!!(i.length||a.length):!1}getValidationErrors(e){return e&&e.length>0?e.reduce((e,t,n)=>(n!==0&&(e+=` 2\r`),e+=`${t}`,e),``):null}observeUsernamePassword(e,t){if(this.errorMessage=void 0,!this.supportsValidation){this.passwordErrors=[];return}this.supportsValidation&&(e||t)&&(clearTimeout(this.validationTimeout_),this.validationTimeout_=setTimeout(()=>{this.validateCredentials(e,t)},300))}observeUsername(e){let t=e.trim();if(this.usernameChanged=!0,this.usernameErrors=[],this.credentialsAttempts.usernames.has(t)){clearTimeout(this.validationTimeout_),this.usernameErrors=this.credentialsAttempts.usernames.get(t);return}t&&this.observeUsernamePassword(t,this.password.trim())}observePassword(e){let t=e.trim();if(this.passwordChanged=!0,this.passwordErrors=[],this.credentialsAttempts.passwords.has(t)){clearTimeout(this.validationTimeout_),this.passwordErrors=this.credentialsAttempts.passwords.get(t);return}t&&this.observeUsernamePassword(this.username.trim(),t)}validateCredentials(e,t){if(this.isLoading)return;this.usernameChanged&&this.username.trim()&&(this.usernameErrors=[],this.usernameChanged=!1,this.validatingPassword=!0),this.passwordChanged&&this.password.trim()&&(this.passwordErrors=[],this.passwordChanged=!1,this.validatingUsername=!0);let n=r.from(T).subscribe(r=>{let i=r.type;switch(n.unsubscribe(),this.validatingPassword=!1,this.validatingUsername=!1,i){case E.VALID_CREDS:this.usernameErrors=[],this.passwordErrors=[];break;case E.INVALID_CREDS:{let n=r.data,i=n.username,a=n.password;this.username.trim()&&(this.usernameErrors=i.violatedRules,i.isValid||this.credentialsAttempts.usernames.set(e,this.usernameErrors.slice())),this.password.trim()&&(this.passwordErrors=a.violatedRules,a.isValid||this.credentialsAttempts.passwords.set(t,this.passwordErrors.slice()));break}case E.VALIDATE_CREDS_UNSUPPORTED:this.supportsValidation=!1,this.passwordErrors=[];break;default:break}});T.validateCredentials(e,t)}onSubmit(e){if(e.preventDefault(),this.errorMessage=void 0,this.isLoading=!0,this.uisEnrollment){this.dispatchEvent(new CustomEvent(window.BannowebEnrollmentCreateCredsElement.Event.CREDENTIALS_SUBMITTED,{bubbles:!0,composed:!0,detail:{username:this.username.trim(),password:this.password.trim()}})),this.isLoading=!1;return}let t=r.from(T).subscribe(e=>{switch(e.type){case E.ENROLL_SUCCESS:t.unsubscribe();break;case E.ENROLL_INVALID_CREDS:{let n=e.data,r=n.username,i=n.password;this.usernameErrors=r.violatedRules,this.passwordErrors=i.violatedRules,this.isLoading=!1,t.unsubscribe();break}case E.INVALID_CREDS:break;case E.VALID_CREDS:break;case E.VALIDATE_CREDS_UNSUPPORTED:break;case D.MAINTENANCE_MODE:case E.SESSION_TIMED_OUT:this.isLoading=!1,t.unsubscribe();break;case E.ENROLL_ERROR:this.errorMessage=c.OOPS_OUR_BAD_TRY_AGAIN,t.unsubscribe(),this.isLoading=!1;break;case u.EventType.UNKNOWN_ERROR:this.dispatchEvent(new CustomEvent(window.BannowebEnrollmentCreateCredsElement.Event.POST_ENROLL_ERROR));break;default:break}});g.getReCAPTCHAToken(`enrollment_lookup`).then(e=>T.enroll(this.username.trim(),this.password.trim(),p.getNdsData(),e))}showRules(e){return!!(e&&e.length>0)}onOpenRulesChanged(e){e.detail.value&&Array.from(this.querySelectorAll(`bannoweb-password-rules`)).filter(t=>t!==e.currentTarget).forEach(e=>{e.isOpen=!1})}getUsernameLabel(){return s}static get template(){return n`<style>bannoweb-enrollment-create-creds jha-button[type=submit]{width:100%;margin:0 auto 12px}bannoweb-enrollment-create-creds bannoweb-passwords{--bannoweb-passwords-vertical-spacing:14px;margin-top:14px;margin-bottom:40px}</style> <template is="dom-if" if="[[errorMessage]]"> <jha-error-message>[[errorMessage]]</jha-error-message> </template> <form on-submit="onSubmit"> <input type="image" alt="" tabindex="-1" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" disabled="[[isDisabled_(username, password, passwordsMatch, supportsValidation, usernameErrors, passwordErrors)]]"> <jha-form-floating-group outline error="[[getValidationErrors(usernameErrors)]]"> <input title="username" type="text" value="{{username::input}}" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off"> <div class="label"> <template is="dom-if" if="[[!validatingUsername]]"> [[getUsernameLabel()]] </template> <template is="dom-if" if="[[validatingUsername]]"> validating... </template> </div> </jha-form-floating-group> <template is="dom-if" if="[[showRules(usernameRules)]]"> <bannoweb-password-rules rules="[[usernameRules]]" label$="[[getUsernameLabel()]] rules" on-is-open-changed="onOpenRulesChanged"></bannoweb-password-rules> </template> <bannoweb-passwords outline password="{{password}}" passwords-match="{{passwordsMatch}}
2" validation-errors="[[passwordErrors]]" password-rules="[[passwordRules]]"></bannoweb-passwords> <jha-button wide="" type="submit" is-loading="[[isLoading]]" disabled="[[isDisabled_(username, password, passwordsMatch, supportsValidation, usernameErrors, passwordErrors)]]"> Next </jha-button> </form>`}},window.BannowebEnrollmentCreateCredsElement.Event={POST_ENROLL_ERROR:`post-enroll-error`,CREDENTIALS_SUBMITTED:`credentials-submitted`},customElements.define(window.BannowebEnrollmentCreateCredsElement.is,window.BannowebEnrollmentCreateCredsElement),window.BannowebEnrollmentCreateCredsElement;export{w as n,T as t};
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.