import{a as I,b as te}from"./chunk-DF76UAZA.js";import{a as R}from"./chunk-YXDC36MS.js";import{d as ie}from"./chunk-JVYYBNMN.js";import{b as B,c as ee}from"./chunk-2P2POCS2.js";import{A as J,B as Q,c as k,g as X,h as K,m as z,p as w,s as j,x as H}from"./chunk-I267ADJP.js";import{$a as s,Fa as u,Ga as E,Gb as V,Hb as $,Ib as G,La as A,Pa as O,Qf as N,Rb as Y,Sa as f,Sf as W,bc as b,bd as D,fd as q,hg as T,ia as P,ib as _,ja as y,jb as r,kb as p,lb as M,mb as v,ob as U,og as Z,qb as h,rb as F,sb as c,tc as x,vc as g,wb as L,xb as C}from"./chunk-4JM6MIZ5.js";import{i as d}from"./chunk-QJQRWPYR.js";var le=i=>({"input-error":i});function ce(i,n){if(i&1&&(_(0,"div",13),$(1),r()),i&2){let a=C(2);u(),G(a.formErrors["verify-email-email"]);}}function me(i,n){if(i&1){let a=U();_(0,"form",7),L("ngSubmit",function(){P(a);let e=C();return y(e.askSendVerifyEmail());}),_(1,"div",8)(2,"label",9),c(3,2),r(),p(4,"input",10),f(5,ce,2,1,"div",11),r(),p(6,"input",12),r();}if(i&2){let a=C();s("formGroup",a.form),u(4),s("ngClass",Y(4,le,a.formErrors["verify-email-email"])),u(),s("ngIf",a.formErrors["verify-email-email"]),u(),s("disabled",!a.form.valid);}}function ue(i,n){i&1&&(_(0,"div"),c(1,3),r());}var re=(()=>{let n=class n extends ee{formReactiveService;signupService;serverService;notifier;redirectService;requiresEmailVerification=!1;constructor(t,e,o,l,m){super(),this.formReactiveService=t,this.signupService=e,this.serverService=o,this.notifier=l,this.redirectService=m;}ngOnInit(){this.serverService.getConfig().subscribe(t=>this.requiresEmailVerification=t.signup.requiresEmailVerification),this.buildForm({"verify-email-email":ie});}askSendVerifyEmail(){let t=this.form.value["verify-email-email"];this.signupService.askSendVerifyEmail(t).subscribe({next:()=>{this.notifier.success("An email with verification link will be sent to "+t+"."),this.redirectService.redirectToHomepage();},error:e=>this.notifier.error(e.message)});}};d(n,"\u0275fac",function(e){return new(e||n)(E(B),E(I),E(T),E(N),E(Z));}),d(n,"\u0275cmp",A({type:n,selectors:[["my-verify-account-ask-send-email"]],features:[O],decls:6,vars:2,consts:()=>{let t;t="Request email for account verification";let e;e="Email address";let o;o="Send verification email";let l;l="Email";let m;return m="This instance does not require email verification.",[["emailVerificationNotRequired",""],t,l,m,[1,"margin-content"],[1,"title-page"],[3,"formGroup","ngSubmit",4,"ngIf","ngIfElse"],[3,"ngSubmit","formGroup"],[1,"form-group"],["for","verify-email-email"],["type","email","id","verify-email-email","placeholder",e,"required","","formControlName","verify-email-email",1,"form-control",3,"ngClass"],["class","form-error","role","alert",4,"ngIf"],["type","submit","value",o,1,"peertube-button","primary-button",3,"disabled"],["role","alert",1,"form-error"]];},template:function(e,o){if(e&1&&(_(0,"div",4)(1,"h1",5),c(2,1),r(),f(3,me,7,6,"form",6)(4,ue,2,0,"ng-template",null,0,b),r()),e&2){let l=V(5);u(3),s("ngIf",o.requiresEmailVerification)("ngIfElse",l);}},dependencies:[g,J,z,k,X,K,H,Q,w,j,x],styles:[`input[type=email][_ngcontent-%COMP%]{font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:340px;max-width:340px;color:var(--input-fg);background-color:var(--input-bg);border:1px solid var(--input-border-color);border-radius:var(--input-border-radius);line-height:24px}input[type=email][_ngcontent-%COMP%]::placeholder{color:var(--input-placeholder);font-size:14px}input[type=email][readonly][_ngcontent-%COMP%]{color:var(--fg-300)}input[type=email][_ngcontent-%COMP%]:focus, input[type=email][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}input[type=email][disabled][_ngcontent-%COMP%]{opacity:.4}@media screen and (max-width: 380px){input[type=email][_ngcontent-%COMP%]{width:100%}}
/*# sourceMappingURL=verify-account-ask-send-email.component-QG4IGALX.css.map */`]}));let i=n;return i;})();function Ee(i,n){i&1&&(M(0),_(1,"p"),c(2,1),r(),_(3,"p"),c(4,2),r(),v());}function Se(i,n){i&1&&(M(0),_(1,"p"),c(2,3),r(),_(3,"p"),h(4,4),p(5,"a",8),F(),r(),v());}var oe=(()=>{let n=class n{requiresApproval;};d(n,"\u0275fac",function(e){return new(e||n)();}),d(n,"\u0275cmp",A({type:n,selectors:[["my-signup-success-after-email"]],inputs:{requiresApproval:"requiresApproval"},decls:6,vars:2,consts:()=>{let t;t="Email verified!";let e;e="Your email has been verified and your account request has been sent!";let o;o=" A moderator will check your registration request soon and you'll receive an email when it is accepted or rejected. ";let l;l="Your email has been verified and your account has been created!";let m;return m=" If you need help using PeerTube, you can have a look at the "+"\uFFFD#5\uFFFD"+"documentation"+"\uFFFD/#5\uFFFD"+". ",[t,e,o,l,m,["mascotImageName","success"],["type","primary"],[4,"ngIf"],["href","https://docs.joinpeertube.org/use/setup-account","target","_blank","rel","noopener noreferrer",1,"link-primary"]];},template:function(e,o){e&1&&(_(0,"my-signup-step-title",5)(1,"strong"),c(2,0),r()(),_(3,"my-alert",6),f(4,Ee,5,0,"ng-container",7)(5,Se,6,0,"ng-container",7),r()),e&2&&(u(4),s("ngIf",o.requiresApproval),u(),s("ngIf",!o.requiresApproval));},dependencies:[te,g,R],styles:[`my-alert[_ngcontent-%COMP%]{display:block;font-size:18px;max-width:900px;text-align:center;margin:auto}
/*# sourceMappingURL=signup-success.component-LNJKY4EL.css.map */`]}));let i=n;return i;})();function de(i,n){if(i&1&&p(0,"my-signup-success-after-email",10),i&2){let a=C(2);s("requiresApproval",a.isRegistrationRequest()&&a.requiresApproval);}}function fe(i,n){i&1&&(_(0,"my-alert",11),c(1,1),r());}function pe(i,n){i&1&&(_(0,"my-alert",12)(1,"span"),c(2,2),r(),_(3,"a",13),c(4,3),r()());}function Ce(i,n){if(i&1&&(_(0,"div",5)(1,"h1",6),c(2,0),r(),f(3,de,1,1,"my-signup-success-after-email",7)(4,fe,2,0,"my-alert",8)(5,pe,5,0,"my-alert",9),r()),i&2){let a=C();u(3),s("ngIf",a.displaySignupSuccess()),u(),s("ngIf",!a.isRegistrationRequest()&&a.isPendingEmail&&a.success),u(),s("ngIf",a.failed);}}var _e=(()=>{let n=class n{signupService;server;authService;notifier;route;success=!1;failed=!1;isPendingEmail=!1;requiresApproval;loaded=!1;userId;registrationId;verificationString;constructor(t,e,o,l,m){this.signupService=t,this.server=e,this.authService=o,this.notifier=l,this.route=m;}get instanceName(){return this.server.getHTMLConfig().instance.name;}ngOnInit(){let t=this.route.snapshot.queryParams;if(this.server.getConfig().subscribe(e=>{this.requiresApproval=e.signup.requiresApproval,this.loaded=!0;}),this.userId=t.userId,this.registrationId=t.registrationId,this.verificationString=t.verificationString,this.isPendingEmail=t.isPendingEmail==="true",!this.verificationString){this.notifier.error("Unable to find verification string in URL query.");return;}if(!this.userId&&!this.registrationId){this.notifier.error("Unable to find user id or registration id in URL query.");return;}this.verifyEmail();}isRegistrationRequest(){return!!this.registrationId;}displaySignupSuccess(){return!(!this.success||!this.isRegistrationRequest()&&this.isPendingEmail);}verifyEmail(){return this.isRegistrationRequest()?this.verifyRegistrationEmail():this.verifyUserEmail();}verifyUserEmail(){let t={userId:this.userId,verificationString:this.verificationString,isPendingEmail:this.isPendingEmail};this.signupService.verifyUserEmail(t).subscribe({next:()=>{this.authService.isLoggedIn()&&this.authService.refreshUserInformation(),this.success=!0;},error:e=>{this.failed=!0,this.notifier.error(e.message);}});}verifyRegistrationEmail(){let t={registrationId:this.registrationId,verificationString:this.verificationString};this.signupService.verifyRegistrationEmail(t).subscribe({next:()=>{this.success=!0;},error:e=>{this.failed=!0,this.notifier.error(e.message);}});}};d(n,"\u0275fac",function(e){return new(e||n)(E(I),E(T),E(W),E(N),E(D));}),d(n,"\u0275cmp",A({type:n,selectors:[["my-verify-account-email"]],decls:1,vars:1,consts:()=>{let t;t="Verify email";let e;e="Email updated.";let o;o="An error occurred.";let l;return l=" Request a new verification email ",[t,e,o,l,["class","margin-content",4,"ngIf"],[1,"margin-content"],[1,"title-page"],[3,"requiresApproval",4,"ngIf"],["type","success",4,"ngIf"],["type","danger",4,"ngIf"],[3,"requiresApproval"],["type","success"],["type","danger"],["routerLink","/verify-account/ask-send-email",1,"ms-1","link-primary"]];},template:function(e,o){e&1&&f(0,Ce,6,3,"div",4),e&2&&s("ngIf",o.loaded);},dependencies:[g,oe,q,R],encapsulation:2}));let i=n;return i;})();var ke=[{path:"",providers:[I],children:[{path:"email",component:_e,data:{meta:{title:"Verify account via email"}}},{path:"ask-send-email",component:re,data:{meta:{title:"Ask to send an email to verify your account"}}}]}];export{ke as default};/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*///# sourceMappingURL=chunk-4WRLLT63.js.map