import{a as N,b as re}from"./chunk-VSFZHFCG.js";import{a as R}from"./chunk-UWYLU3BC.js";import{d as ne}from"./chunk-JVB6FOUY.js";import{b as Z,c as te}from"./chunk-3W54MN4Z.js";import{A as Q,B as W,c as K,g as z,h as w,m as H,p as j,s as B,x as J}from"./chunk-RB6U2MY6.js";import{$b as x,Cg as ie,Db as $,Dc as q,Eb as C,Fc as g,Ha as c,Qb as G,Rb as Y,Sa as A,Sb as b,Uf as I,Wa as F,Za as p,ba as m,eg as ee,gb as s,ha as P,ia as y,la as O,lc as D,ld as k,pb as o,pd as X,qb as r,rb as d,sb as M,ta as U,tb as v,vb as L,vg as T,xb as h,yb as V,zb as l}from"./chunk-ZXQQIUTT.js";import{i as f}from"./chunk-RE7RSUSQ.js";var le=e=>({"input-error":e});function ce(e,n){if(e&1&&(o(0,"div",13),Y(1),r()),e&2){let _=C(2);c(),b(_.formErrors["verify-email-email"]);}}function me(e,n){if(e&1){let _=L();o(0,"form",7),$("ngSubmit",function(){P(_);let i=C();return y(i.askSendVerifyEmail());}),o(1,"div",8)(2,"label",9),l(3,2),r(),d(4,"input",10),p(5,ce,2,1,"div",11),r(),d(6,"input",12),r();}if(e&2){let _=C();s("formGroup",_.form),c(4),s("ngClass",x(4,le,_.formErrors["verify-email-email"])),c(),s("ngIf",_.formErrors["verify-email-email"]),c(),s("disabled",!_.form.valid);}}function ue(e,n){e&1&&(o(0,"div"),l(1,3),r());}var _e=(()=>{let n=class n extends te{formReactiveService=m(Z);signupService=m(N);serverService=m(T);notifier=m(I);redirectService=m(ie);requiresEmailVerification=!1;ngOnInit(){this.serverService.getConfig().subscribe(t=>this.requiresEmailVerification=t.signup.requiresEmailVerification),this.buildForm({"verify-email-email":ne});}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:i=>this.notifier.error(i.message)});}};f(n,"\u0275fac",(()=>{let t;return function(a){return(t||(t=O(n)))(a||n);};})()),f(n,"\u0275cmp",A({type:n,selectors:[["my-verify-account-ask-send-email"]],features:[F],decls:6,vars:2,consts:()=>{let t;t="Request email for account verification";let i;i="Adres\xEB email";let a;a="D\xEBrgo email verifikimi";let u;u="Email";let E;return E="Kjo instanc\xEB nuk lyp verifikim email-i.",[["emailVerificationNotRequired",""],t,u,E,[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",i,"required","","formControlName","verify-email-email",1,"form-control",3,"ngClass"],["class","form-error","role","alert",4,"ngIf"],["type","submit","value",a,1,"peertube-button","primary-button",3,"disabled"],["role","alert",1,"form-error"]];},template:function(i,a){if(i&1&&(o(0,"div",4)(1,"h1",5),l(2,1),r(),p(3,me,7,6,"form",6)(4,ue,2,0,"ng-template",null,0,D),r()),i&2){let u=G(5);c(3),s("ngIf",a.requiresEmailVerification)("ngIfElse",u);}},dependencies:[g,Q,H,K,z,w,J,W,j,B,q],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 e=n;return e;})();function Ee(e,n){e&1&&(M(0),o(1,"p"),l(2,1),r(),o(3,"p"),l(4,2),r(),v());}function Se(e,n){e&1&&(M(0),o(1,"p"),l(2,3),r(),o(3,"p"),h(4,4),d(5,"a",8),V(),r(),v());}var ae=(()=>{let n=class n{requiresApproval=U(void 0);};f(n,"\u0275fac",function(i){return new(i||n)();}),f(n,"\u0275cmp",A({type:n,selectors:[["my-signup-success-after-email"]],inputs:{requiresApproval:[1,"requiresApproval"]},decls:6,vars:2,consts:()=>{let t;t="Email verified!";let i;i="Your email has been verified and your account request has been sent!";let a;a=" A moderator will check your registration request soon and you'll receive an email when it is accepted or rejected. ";let u;u="Your email has been verified and your account has been created!";let E;return E=" If you need help using PeerTube, you can have a look at the "+"\uFFFD#5\uFFFD"+"documentation"+"\uFFFD/#5\uFFFD"+". ",[t,i,a,u,E,["mascotImageName","success"],["type","primary"],[4,"ngIf"],["href","https://docs.joinpeertube.org/use/setup-account","target","_blank","rel","noopener noreferrer",1,"link-primary"]];},template:function(i,a){i&1&&(o(0,"my-signup-step-title",5)(1,"strong"),l(2,0),r()(),o(3,"my-alert",6),p(4,Ee,5,0,"ng-container",7)(5,Se,6,0,"ng-container",7),r()),i&2&&(c(4),s("ngIf",a.requiresApproval()),c(),s("ngIf",!a.requiresApproval()));},dependencies:[re,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 e=n;return e;})();function fe(e,n){if(e&1&&d(0,"my-signup-success-after-email",10),e&2){let _=C(2);s("requiresApproval",_.isRegistrationRequest()&&_.requiresApproval);}}function pe(e,n){e&1&&(o(0,"my-alert",11),l(1,1),r());}function de(e,n){e&1&&(o(0,"my-alert",12)(1,"span"),l(2,2),r(),o(3,"a",13),l(4,3),r()());}function Ce(e,n){if(e&1&&(o(0,"div",5)(1,"h1",6),l(2,0),r(),p(3,fe,1,1,"my-signup-success-after-email",7)(4,pe,2,0,"my-alert",8)(5,de,5,0,"my-alert",9),r()),e&2){let _=C();c(3),s("ngIf",_.displaySignupSuccess()),c(),s("ngIf",!_.isRegistrationRequest()&&_.isPendingEmail&&_.success),c(),s("ngIf",_.failed);}}var se=(()=>{let n=class n{signupService=m(N);server=m(T);authService=m(ee);notifier=m(I);route=m(k);success=!1;failed=!1;isPendingEmail=!1;requiresApproval;loaded=!1;userId;registrationId;verificationString;get instanceName(){return this.server.getHTMLConfig().instance.name;}ngOnInit(){let t=this.route.snapshot.queryParams;if(this.server.getConfig().subscribe(i=>{this.requiresApproval=i.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:i=>{this.failed=!0,this.notifier.error(i.message);}});}verifyRegistrationEmail(){let t={registrationId:this.registrationId,verificationString:this.verificationString};this.signupService.verifyRegistrationEmail(t).subscribe({next:()=>{this.success=!0;},error:i=>{this.failed=!0,this.notifier.error(i.message);}});}};f(n,"\u0275fac",function(i){return new(i||n)();}),f(n,"\u0275cmp",A({type:n,selectors:[["my-verify-account-email"]],decls:1,vars:1,consts:()=>{let t;t="Verify email";let i;i="Email updated.";let a;a="Ndodhi nj\xEB gabim.";let u;return u=" Request a new verification email ",[t,i,a,u,["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(i,a){i&1&&p(0,Ce,6,3,"div",4),i&2&&s("ngIf",a.loaded);},dependencies:[g,ae,X,R],encapsulation:2}));let e=n;return e;})();var Qe=[{path:"",providers:[N],children:[{path:"email",component:se,data:{meta:{title:"Verify account via email"}}},{path:"ask-send-email",component:_e,data:{meta:{title:"Ask to send an email to verify your account"}}}]}];export{Qe as default};/**i18n:4ea3d52b0fe89d1d8e6fff59c182aeadbd7786f17ffe9a1efa1c7ed627997eaf*///# sourceMappingURL=chunk-GWHRXWMZ.js.map