1import{e as z,i as J}from"./chunk-RHD6BBWP.js";import{a as Y}from"./chunk-6XZIC5CN.js";import{kb as f}from"./chunk-GNOMKHH2.js";import"./chunk-MIYW5325.js";import"./chunk-FJFH4XCE.js";import"./chunk-T52FVTMS.js";import"./chunk-4I6Y24VE.js";import"./chunk-VHBEXHUY.js";import"./chunk-IXNXTOPZ.js";import"./chunk-GGY6QDTV.js";import"./chunk-3WQEZLC2.js";import{a as q}from"./chunk-DB7AUQFG.js";import"./chunk-GLFTJW2T.js";import"./chunk-BHLMCFFK.js";import"./chunk-IS3P6TAG.js";import"./chunk-VHXJDH4D.js";import"./chunk-NP4PC25X.js";import{e as U,f as F}from"./chunk-D6IOGJMO.js";import{m as K}from"./chunk-MKJMCBBH.js";import"./chunk-KKDZHWJ2.js";import"./chunk-RS4X3CMD.js";import"./chunk-7DHSGR33.js";import{g as R,i as B}from"./chunk-4KDBBJRG.js";import"./chunk-3SEIXLDK.js";import{b as G,c as D,d as j}from"./chunk-UIEAU6S2.js";import{l as H,x as L}from"./chunk-H3Y6JSWE.js";import{Oc as O,Rb as _,Sb as o,Tb as a,Ub as C,Uc as s,Vc as p,Wc as y,Yb as P,Zb as A,_c as N,bc as g,db as r,gc as x,ic as d,kd as M,mb as h,oa as v,pa as u,qa as T,ra as E,sb as b,sc as k,wc as c,xc as S,yb as V,yc as l}from"./chunk-AHLRJ2EW.js";import"./chunk-AMJ4GB2S.js";import"./chunk-OXDKANHF.js";import"./chunk-WGJEEJGF.js";import"./chunk-6ACFICIG.js";import"./chunk-K7BHMZHH.js";import"./chunk-FE7444LI.js";import"./chunk-XUHYVR5R.js";var X=e=>({shopName:e});function Q(e,m){e&1&&(o(0,"div",6),C(1,"div",7),o(2,"p",8),c(3),s(4,"translate"),a()()),e&2&&(r(3),S(p(4,1,"V2.SHOP.INVITE_ACCEPT.ACCEPTING")))}function Z(e,m){if(e&1){let t=g();o(0,"div",6)(1,"div",9),T(),o(2,"svg",10),C(3,"polyline",11),a()(),E(),o(4,"h1",12),c(5),s(6,"translate"),a(),o(7,"p",13),c(8),s(9,"translate"),a(),o(10,"button",14),x("click",function(){v(t);let n=d();return u(n.goToShop())}),c(11),s(12,"translate"),a()()}if(e&2){let t=d();r(5),l(" ",y(6,3,"V2.SHOP.INVITE_ACCEPT.JOINED_TITLE",O(10,X,t.shopName))," "),r(3),S(p(9,6,"V2.SHOP.INVITE_ACCEPT.REDIRECTING")),r(3),l(" ",p(12,8,"V2.SHOP.INVITE_ACCEPT.GO_TO_SHOP")," ")}}function tt(e,m){if(e&1){let t=g();o(0,"div",6)(1,"div",15),T(),o(2,"svg",16),C(3,"circle",17)(4,"line",18)(5,"line",19),a()(),E(),o(6,"h1",12),c(7),s(8,"translate"),a(),o(9,"p",13),c(10),s(11,"translate"),a(),o(12,"button",14),x("click",function(){v(t);let n=d();return u(n.onGoToLogin())}),c(13),s(14,"translate"),a()()}e&2&&(r(7),l(" ",p(8,3,"V2.SHOP.INVITE_ACCEPT.INVALID_TITLE")," "),r(3),l(" ",p(11,5,"V2.SHOP.INVITE_ACCEPT.INVALID_BODY")," "),r(3),l(" ",p(14,7,"V2.SHOP.INVITE_ACCEPT.GO_TO_SIGN_IN")," "))}function et(e,m){if(e&1){let t=g();o(0,"button",22),x("click",function(){v(t);let n=d(3);return u(n.signOutAndSwitch())}),c(1),s(2,"translate"),a()}e&2&&(r(),l(" ",p(2,1,"V2.SHOP.INVITE_ACCEPT.SIGN_OUT_SWITCH")," "))}function it(e,m){if(e&1){let t=g();o(0,"button",22),x("click",function(){v(t);let n=d(3);return u(n.goToShop())}),c(1),s(2,"translate"),a()}e&2&&(r(),l(" ",p(2,1,"V2.SHOP.INVITE_ACCEPT.GO_TO_SHOP")," "))}function nt(e,m){if(e&1){let t=g();o(0,"button",22),x("click",function(){v(t);let n=d(3);return u(n.goHome())}),c(1),s(2,"translate"),a()}e&2&&(r(),l(" ",p(2,1,"V2.SHELL.GO_HOME")," "))}function rt(e,m){if(e&1&&(P(0),V(1,et,3,3,"button",21)(2,it,3,3,"button",21)(3,nt,3,3,"button",21),A()),e&2){let t=d(2);r(),_("ngIf",t.errorKind==="emailMismatch"),r(),_("ngIf",t.errorKind==="alreadyUsed"),r(),_("ngIf",t.errorKind==="expired"||t.errorKind==="generic")}}function ot(e,m){if(e&1){let t=g();o(0,"button",22),x("click",function(){v(t);let n=d(2);return u(n.onGoToLogin())}),c(1),s(2,"translate"),a()}e&2&&(r(),l(" ",p(2,1,"V2.SHOP.INVITE_ACCEPT.BACK_TO_SIGN_IN")," "))}function at(e,m){if(e&1){let t=g();o(0,"div",6)(1,"div",15),T(),o(2,"svg",16),C(3,"circle",17)(4,"line",18)(5,"line",19),a()(),E(),o(6,"h1",12),c(7),s(8,"translate"),a(),o(9,"p",13),c(10),a(),o(11,"button",14),x("click",function(){v(t);let n=d();return u(n.retry())}),c(12),s(13,"translate"),a(),V(14,rt,4,3,"ng-container",20)(15,ot,3,3,"ng-template",null,0,N),a()}if(e&2){let t=k(16),i=d();r(7),S(p(8,5,"V2.SHOP.INVITE_ACCEPT.FAILED_TITLE")),r(3),l(" ",i.errorMessage," "),r(2),l(" ",p(13,7,"V2.SHOP.INVITE_ACCEPT.RETRY")," "),r(2),_("ngIf",i.isSignedIn)("ngIfElse",t)}}var Ct=(()=>{class e{constructor(t,i,n,I,w,W,$){this.route=t,this.router=i,this.store=n,this.toastr=I,this.translate=w,this.cdr=W,this.startupAuth=$,this.state="loading",this.errorMessage="",this.errorKind="generic",this.shopName="",this.token=""}
1ngOnInit(){let t=this.route.snapshot.queryParamMap.get("token");if(!t){this.state="missing-token";return}if(this.token=t,this.store.selectSnapshot(f.currentUser)){this.acceptInvitation(t);return}this.startupAuth.init().then(()=>{if(this.store.selectSnapshot(f.currentUser)){this.acceptInvitation(t);return}this.redirectToLogin(t)})}redirectToLogin(t){let i=`/v2/invite/accept?token=${t}`;this.router.navigate(["/v2/login"],{queryParams:{returnUrl:i}})}acceptInvitation(t){this.store.dispatch(new z(t)).subscribe({next:()=>{let i=this.store.selectSnapshot(J.selectShop);this.shopName=i?.name??this.translate.instant("V2.SHOP.INVITE_ACCEPT.FALLBACK_SHOP"),this.state="success",this.cdr.markForCheck(),this.toastr.success(this.translate.instant("V2.SHOP.INVITE_ACCEPT.JOINED_TOAST",{shopName:this.shopName}),this.translate.instant("V2.SHOP.INVITE_ACCEPT.WELCOME")),setTimeout(()=>{this.router.navigate(["/v2/shop-account"])},2e3)},error:i=>{let n=i,I=n?.status,w=n?.error?.code;I===410||I===404?(this.errorMessage=this.translate.instant("V2.SHOP.INVITE_ACCEPT.ERR_EXPIRED"),this.errorKind="expired"):I===403&&w==="InvitationEmailMismatch"?(this.errorMessage=this.translate.instant("V2.SHOP.INVITE_ACCEPT.ERR_EMAIL_MISMATCH"),this.errorKind="emailMismatch"):I===409?(this.errorMessage=this.translate.instant("V2.SHOP.INVITE_ACCEPT.ERR_ALREADY_USED"),this.errorKind="alreadyUsed"):(this.errorMessage=this.translate.instant("V2.SHOP.INVITE_ACCEPT.ERR_GENERIC"),this.errorKind="generic"),this.state="error",this.cdr.markForCheck()}})}onGoToLogin(){this.router.navigate(["/v2/login"])}goToShop(){this.router.navigate(["/v2/shop-account"])}get isSignedIn(){return!!this.store.selectSnapshot(f.currentUser)}retry(){this.token&&(this.state="loading",this.cdr.markForCheck(),this.isSignedIn?this.acceptInvitation(this.token):this.startupAuth.init().then(()=>{if(this.store.selectSnapshot(f.currentUser)){this.acceptInvitation(this.token);return}this.redirectToLogin(this.token)}))}signOutAndSwitch(){let t=`/v2/invite/accept?token=${this.token}`,i=()=>{this.router.navigate(["/v2/login"],{queryParams:{returnUrl:t}})};this.store.dispatch(new U).subscribe({next:i,error:()=>{this.store.dispatch(new F),i()}})}goHome(){this.router.navigate(["/v2/home"])}static{this.\u0275fac=function(i){return new(i||e)(h(R),h(B),h(K),h(q),h(G),h(M),h(Y))}}static{this.\u0275cmp=b({type:e,selectors:[["app-v2-invite-accept"]],decls:9,vars:4,consts:[["invalidSignedOutCta",""],[1,"invite-accept-page"],[1,"invite-accept-card"],[1,"tw-flex","tw-items-center","tw-justify-center","tw-gap-2","tw-mb-8"],[1,"tw-text-xl","tw-font-extrabold","tw-tracking-tight","tw-text-mech-text","tw-uppercase"],["class","tw-flex tw-flex-col tw-items-center tw-gap-4 tw-py-6",4,"ngIf"],[1,"tw-flex","tw-flex-col","tw-items-center","tw-gap-4","tw-py-6"],[1,"invite-spinner"],[1,"tw-text-sm","tw-text-mech-text-muted"],[1,"invite-success-icon"],["aria-hidden","true","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2.5","stroke-linecap","round","stroke-linejoin","round",1,"tw-w-8","tw-h-8"],["points","20 6 9 17 4 12"],[1,"tw-text-xl","tw-font-bold","tw-text-mech-text","tw-text-center"],[1,"tw-text-sm","tw-text-mech-text-muted","tw-text-center"],["type","button",1,"invite-btn","invite-btn--primary","tw-mt-2",3,"click"],[1,"invite-error-icon"],["aria-hidden","true","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round",1,"tw-w-8","tw-h-8"],["cx","12","cy","12","r","10"],["x1","12","y1","8","x2","12","y2","12"],["x1","12","y1","16","x2","12.01","y2","16"],[4,"ngIf","ngIfElse"],["type","button","class","invite-btn invite-btn--secondary",3,"click",4,"ngIf"],["type","button",1,"invite-btn","invite-btn--secondary",3,"click"]],template:function(i,n){i&1&&(o(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),c(4,"MECH AI"),a()(),V(5,Q,5,3,"div",5)(6,Z,13,12,"div",5)(7,tt,15,9,"div",5)(8,at,17,9,"div",5),a()()),i&2&&(r(5),_("ngIf",n.state==="loading"),r(),_("ngIf",n.state==="success"),r(),_("ngIf",n.state==="missing-token"),r(),_("ngIf",n.state==="error"))},dependencies:[L,H,j,D],styles:[".invite-accept-page[_ngcontent-%COMP%]{min-height:100dvh;display:flex;align-items:center;justify-content:center;background:var(--color-bg);padding:24px}.invite-accept-card[_ngcontent-%COMP%]{background:var(--color-surface);border:1px solid var(--color-border-strong);border-radius:20px;padding:40px 32px;width:100%;max-width:400px;box-shadow:0 20px 50px #0f172a33}.invite-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:10px 20px;border-radius:12px;font-size:14px;font-weight:600;cursor:pointer;border:none;transition:background-color .15s cubic-bezier(.4,0,.2,1)}.invite-btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:#fff;width:100%}.invite-btn--primary[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover)}.invite-btn--secondary[_ngcontent-%COMP%]{background:var(--color-surface);color:var(--color-text);border:1px solid var(--color-border-strong);width:100%}.invite-btn--secondary[_ngcontent-%COMP%]:hover{border-color:var(--color-primary)}.invite-success-icon[_ngcontent-%COMP%]{width:64px;
1height:64px;border-radius:9999px;background:#0dae301f;color:var(--color-success-text);display:flex;align-items:center;justify-content:center;flex-shrink:0}.invite-error-icon[_ngcontent-%COMP%]{width:64px;height:64px;border-radius:9999px;background:#e50f2e1a;color:var(--color-danger-text);display:flex;align-items:center;justify-content:center;flex-shrink:0}.invite-spinner[_ngcontent-%COMP%]{width:40px;height:40px;border:3px solid var(--color-border-strong);border-top-color:var(--color-primary);border-radius:9999px;animation:_ngcontent-%COMP%_invite-spin .7s linear infinite}@keyframes _ngcontent-%COMP%_invite-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.invite-spinner[_ngcontent-%COMP%]{animation-duration:1.6s}}"],changeDetection:0})}}return e})();export{Ct as V2InviteAcceptComponent};
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.