1import"./chunk-5BFPFPD2.js";import"./chunk-S6DUGUKA.js";import{$ as S,$e as ne,A as G,Cb as V,Fa as L,Ga as p,L as U,Me as ee,Nb as Y,Q as v,R as E,Ra as _,Rb as B,Sa as C,Ta as N,Ue as te,Wb as $,Xa as P,Yb as q,Za as h,_a as j,aa as c,ae as Z,af as ie,da as K,ef as oe,fb as M,ff as re,ia as s,j as O,jb as y,ka as m,kc as z,l as w,m as D,n as A,nc as J,oa as R,oc as W,qc as Q,rc as X,sa as f,ta as g,ua as F,v as b,xa as u,xb as H,ya as k}from"./chunk-VF3PRVJA.js";import"./chunk-NF2EONNU.js";var ae=()=>({header:"Loading\u2026",description:""}),ce=()=>({header:"Redirecting\u2026",description:""}),se=()=>({header:"Setting up access\u2026",description:"Please wait until the process is complete."}),pe=()=>({header:"Congratulations",description:"Your account has been successfully linked and you now have access to the content on the platform."}),le=()=>({header:"Already linked",description:"It seems you already have access to the platform."}),me=e=>({header:e,description:`Please retry with a different account or if the problem persists, please 2 contact support.`});function ue(e,t){e&1&&F(0,"yo-icon",2)}function _e(e,t){e&1&&u(0)}function de(e,t){if(e&1&&s(0,_e,1,0,"ng-container",3),e&2){p();let o=_(9);m("ngTemplateOutlet",o)("ngTemplateOutletContext",h(2,ae))}}function fe(e,t){e&1&&u(0)}function ge(e,t){if(e&1&&s(0,fe,1,0,"ng-container",3),e&2){p();let o=_(9);m("ngTemplateOutlet",o)("ngTemplateOutletContext",h(2,ce))}}function he(e,t){e&1&&u(0)}function Se(e,t){if(e&1&&s(0,he,1,0,"ng-container",3),e&2){p();let o=_(9);m("ngTemplateOutlet",o)("ngTemplateOutletContext",h(2,se))}}function Ce(e,t){e&1&&u(0)}function xe(e,t){if(e&1){let o=k();s(0,Ce,1,0,"ng-container",3),f(1,"yo-button",4),L("click",function(){v(o);let i=p();return E(i.goToHomePage())}),C(2,"Start watching"),g()}if(e&2){p();let o=_(9);m("ngTemplateOutlet",o)("ngTemplateOutletContext",h(2,pe))}}function Ie(e,t){e&1&&u(0)}function Te(e,t){if(e&1){let o=k();s(0,Ie,1,0,"ng-container",3),f(1,"yo-button",4),L("click",function(){v(o);let i=p();return E(i.goToHomePage())}),C(2,"Start watching"),g()}if(e&2){p();let o=_(9);m("ngTemplateOutlet",o)("ngTemplateOutletContext",h(2,le))}}function ve(e,t){e&1&&u(0)}function Ee(e,t){if(e&1&&s(0,ve,1,0,"ng-container",3),e&2){let o=p(),n=_(9);m("ngTemplateOutlet",n)("ngTemplateOutletContext",j(2,me,"Error: "+o.linkingErrorReason()))}}function Re(e,t){if(e&1&&(f(0,"div",5)(1,"h3",6),C(2),g(),f(3,"p",7),C(4),g()()),e&2){let o=t.header,n=t.description;S(2),N(o),S(2),N(n)}}var He=(()=>{let t=class t{constructor(n,i,a,r,x,I,T,l){this.authService=n,this.ff=i,this.fs=a,this.router=r,this.activatedRoute=x,this.scopeService=I,this.windowService=T,this.platformService=l,this.linkingState=K("LOADING"),this.linkingErrorReason=y(()=>{let d=this.linkingState();return typeof d=="object"&&"reason"in d?d.reason:""}),this.showLoader=y(()=>{let d=this.linkingState();return typeof d=="string"&&["LOADING","REDIRECTING","PROCESSING"].includes(d)})}ngOnInit(){this.linkingState.set("LOADING"),!this.platformService.isServer()&&D([this.scopeService.listenToChannel(),this.authService.user$]).pipe(b(1),G(([n,i])=>i?A([oe(this.fs,n.docId,i.uid,!0),re(this.fs,this.authService,n.docId)]).pipe(w(([a,r])=>({settings:a,account:r,channel:n,user:i}))):O({channel:n,settings:void 0,account:void 0,user:void 0}))).subscribe(({settings:n,account:i,channel:a,user:r})=>{if(console.log(this.router.url),!a)throw new Error("No channel found, abort");if(!r){this.redirectToAuthApp(a);return}if(i){this.goToHomePage();return}if(!n){this.linkingState.set({type:"LINKING_ERROR",reason:"Unexpected configuration error, contact your administrator."});return}this.initiateLinking(a)})}initiateLinking(n){this.linkingState.set("PROCESSING");let i=this.activatedRoute.snapshot.queryParamMap.get("provider-token");if(!i){this.linkingState.set({type:"LINKING_ERROR",reason:"invalid link"});return}let[a,r,x,I]=i.split(","),T=ee(I);Z(this.ff,n.docId,this.windowService.document.location.toString(),"sport80",{token:[a,r,x,T].join(",")}).subscribe({next:l=>{if(l.success)switch(l.result){case"LINKED":this.linkingState.set("LINKED_SUCCESSFULLY");break;case"ACCOUNT_ALREADY_LINKED":this.linkingState.set("LINKED_SUCCESSFULLY");break;case"NO_LINKABLE_PLAN":this.linkingState.set({type:"LINKING_ERROR",reason:"not available anymore"});break;case"ACCOUNT_LINKED_TO_OTHER_USER":this.linkingState.set({type:"LINKING_ERROR",reason:"linked to another user"})}else this.linkingState.set({type:"LINKING_ERROR",reason:l.errorReason})},error:l=>{this.linkingState.set({type:"LINKING_ERROR",reason:l})}})}goToHomePage(){this.router.navigate([this.scopeService.getChannelUrl()])}redirectToAuthApp(n){this.linkingState.set("REDIRECTING");let i=new URL(this.authService.getAuthenticationUrl(n.docId,n.slug,this.windowService.document.location.href));this.windowService.document.location.assign(i)}};t.\u0275fac=function(i){return new(i||t)(c(te),c(B),c(Y),c(q),c($),c(ne),c(z),c(ie))},t.\u0275cmp=U({type:t,selectors:[["joymo-sport80"]],standalone:!0,features:[P],decls:10,vars:2,consts:[["headerDescription",""],[1,"standard-margins","m-y-64","flex","flex-column","flex-align-center","gap-32"],["icon","loader","size","xxl"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["role","primary",3,"click"],[1,"flex","flex-column","gap-16","text-center","md:w-50"],[1,"heading-sm"],[1,"text-md"]],template:function(i,a){if(i&1&&(f(0,"div",1),s(1,ue,1,0,"yo-icon",2)(2,de,1,3)(3,ge,1,3)(4,Se,1,3)(5,xe,3,3)(6,Te,3,3)(7,Ee,1,4),g(),s(8,Re,5,2,"ng-template",null,0,M)),i&2){let r;S(),R(1,a.showLoader()?1:-1),S(),R(2,(r=a.linkingState())==="LOADING"?2:r==="REDIRECTING"?3:r==="PROCESSING"?4:r==="LINKED_SUCCESSFULLY"?5:r==="ALREADY_LINKED"?6:7)}},dependencies:[X,Q,V,H,W,J]});let e=t;return e})();export{He as Sport80Component}; 3/**i18n:97d16af80b9e941913080ec17ee9bbcf9996ba7c137660b21174b8d4b6f2b4aa*/ 4//# sourceMappingURL=chunk-MRVGS5SP.js.map
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.