1import{a as B,b as Xe}from"./chunk-DTKGZN5P.js";import"./chunk-KTNCM7KX.js";import"./chunk-O5UD2LEX.js";import"./chunk-SKQRBEGY.js";import{a as Qe}from"./chunk-44QTN3WH.js";import"./chunk-S5GIXA6R.js";import"./chunk-M2PPJWVQ.js";import"./chunk-7DOZSFJT.js";import"./chunk-GTUJ6KJM.js";import"./chunk-H265YVRF.js";import"./chunk-HERVHQD4.js";import"./chunk-FK3AYKEM.js";import"./chunk-4FWHBLU3.js";import{a as Ye,b as Je}from"./chunk-PGGQTCHK.js";import"./chunk-GGR34ZC6.js";import"./chunk-KJPNLY7Q.js";import"./chunk-RUHGDOSU.js";import"./chunk-VALVK5GN.js";import"./chunk-ZNPPCW4L.js";import"./chunk-XH6BEHGY.js";import"./chunk-6BB2P36Q.js";import"./chunk-4SXIL6RB.js";import"./chunk-7WMFJWTR.js";import"./chunk-MS4AQ6UA.js";import"./chunk-REWHUV3E.js";import"./chunk-T6C34YYY.js";import"./chunk-NX27Y33N.js";import"./chunk-HWPGI4JY.js";import"./chunk-HOJ36SEL.js";import"./chunk-XSS4FIQP.js";import"./chunk-I4LNEYGG.js";import"./chunk-KUQBXGWM.js";import"./chunk-M4XPG5ND.js";import"./chunk-NMD7BNDY.js";import"./chunk-IER535FF.js";import"./chunk-RNV27XOH.js";import"./chunk-ZCDK4TE2.js";import"./chunk-CWI4HD4C.js";import"./chunk-VYSZY2RF.js";import"./chunk-FRAOFR6K.js";import"./chunk-O2HTKXBS.js";import"./chunk-KIPGNHHL.js";import"./chunk-FVQU7U56.js";import"./chunk-62CDGUSA.js";import"./chunk-VIJF72ZQ.js";import"./chunk-MIJ4BSDV.js";import"./chunk-LU67H3NU.js";import"./chunk-SLO7444R.js";import"./chunk-J3UGQKB5.js";import"./chunk-3XORJJA4.js";import"./chunk-YB3EGUOV.js";import"./chunk-5GIAIL6D.js";import"./chunk-2RNO6VAM.js";import"./chunk-EBOM3FLD.js";import"./chunk-WVJHT65Q.js";import"./chunk-HRXSP2SL.js";import"./chunk-IVR6OPIX.js";import"./chunk-SUTBK5PK.js";import"./chunk-23UOLJGU.js";import"./chunk-C3M5GFWG.js";import"./chunk-XG3ZOYLF.js";import{i as Ve}from"./chunk-LJRNXR4Z.js";import"./chunk-T4MK7QAN.js";import"./chunk-N5H33MAT.js";import"./chunk-DCR4YP2M.js";import"./chunk-SWDGNTZF.js";import"./chunk-F5X5MWHG.js";import"./chunk-57JUTFV6.js";import"./chunk-SGYCFQGT.js";import"./chunk-GWZHENGH.js";import"./chunk-PYVFHOBF.js";import"./chunk-4ZZX3EUT.js";import"./chunk-FHNA7NOX.js";import"./chunk-UKOH47LE.js";import"./chunk-YYOXQINR.js";import"./chunk-W4J2SMRF.js";import"./chunk-ICLKOHZ2.js";import"./chunk-E4JDWYYD.js";import"./chunk-STYHDWK5.js";import"./chunk-3RK6DDJD.js";import"./chunk-PX3ZDZPI.js";import"./chunk-EWTLMG7H.js";import"./chunk-XFQOOWRA.js";import"./chunk-HVXXTVPX.js";import"./chunk-YOQYUK2P.js";import"./chunk-OM52GCBP.js";import"./chunk-6RGPRWVV.js";import"./chunk-U44HLD2S.js";import"./chunk-R4DV5QZ2.js";import"./chunk-VNN7MPNT.js";import{b as Y,c as J,f as qe,g as Ke}from"./chunk-KLYQFF2A.js";import{H as He,I as We}from"./chunk-H2ADB6ED.js";import{a as $}from"./chunk-UNBDIFOL.js";import{$d as $e,Bb as g,Ca as Ee,Cd as Ue,Da as Te,K as be,Lc as S,Mc as N,Nc as V,Qb as c,Rb as h,Sb as Me,Tb as b,Ub as y,Wb as ze,X as U,Yc as Le,Zd as ke,_b as Ne,_d as Ge,a as j,aa as ye,ac as u,b as H,ce as Be,gb as l,hc as Re,ic as De,ie as Q,jc as Pe,mb as x,oc as m,od as Fe,pc as A,qc as C,ra as Ae,rb as Oe,sa as k,sb as G,va as W,xb as I,xd as je}from"./chunk-POIHHM7P.js";var q={REPLACE:"EventOrganizerReplaceAthlete.Replace",SOMETHING_WENT_WRONG:"EventOrganizerReplaceAthlete.Something went wrong"},X="/images/homePage/exclamation.svg",Z="#FF375B",Ze={ATHLETE_REPLACED:i=>"/events/".concat(i,"/athlete-replaced")},we="en",et=["newTeam","newTeamInfo","teamId","teamName","teamAlias","teamMates","teamAvatarPath"];var K=(()=>{let n=class n{constructor(e,t){this.http=e,this.attributeService=t,this.baseUrl=this.attributeService.base_url}fetchModel(e,t){return this.http.getReq({url:"".concat(this.baseUrl,"v1/registrations/organizer/event/").concat(e,"/replace/").concat(t,"/model")}).pipe(U(1))}fetchSchema(e,t){return this.http.getReq({url:"".concat(this.baseUrl,"v1/registrations/organizer/event/").concat(e,"/replace/").concat(t,"/schema")}).pipe(U(1))}submit(e,t,a){return this.http.postReq({url:"".concat(this.baseUrl,"v1/registrations/organizer/event/").concat(e,"/replace/").concat(t),body:a,config:{showServerErrorMessage:!1}}).pipe(U(1))}};n.\u0275fac=function(t){return new(t||n)(W(Ke),W($))},n.\u0275prov=Ae({token:n,factory:n.\u0275fac});let i=n;return i})();function rt(i,n){i&1&&Me(0,"app-spinner",3)}
1function ot(i,n){if(i&1&&(b(0),m(1),S(2,"date"),y()),i&2){let r=u(4);l(),C(" - ",V(2,1,r.eventEndDate,"MMMM d, y"),"")}}function st(i,n){if(i&1&&(b(0),m(1),S(2,"date"),I(3,ot,3,4,"ng-container",2),y()),i&2){let r=u(3);l(),C(" ",V(2,2,r.eventStartDate,"MMMM d, y"),""),l(2),g("ngIf",r.eventEndDate&&r.eventEndDate!==r.eventStartDate)}}function lt(i,n){i&1&&(b(0),m(1,"\xA0\xA0\xB7\xA0\xA0"),y())}function pt(i,n){if(i&1&&(b(0),m(1),y()),i&2){let r=u(3);l(),A(r.eventLocation)}}function mt(i,n){if(i&1&&(c(0,"p",15),I(1,st,4,5,"ng-container",2)(2,lt,2,0,"ng-container",2)(3,pt,2,1,"ng-container",2),h()),i&2){let r=u(2);l(),g("ngIf",r.eventStartDate),l(),g("ngIf",r.eventStartDate&&r.eventLocation),l(),g("ngIf",r.eventLocation)}}function dt(i,n){if(i&1&&(c(0,"h2",16),m(1),S(2,"translate"),c(3,"strong"),m(4),h()()),i&2){let r=u(2);l(),C(" ",N(2,2,"EventOrganizerReplaceAthlete.Athlete"),": "),l(3),A(r.replacedAthleteName)}}function ct(i,n){if(i&1&&(c(0,"div",17)(1,"span",11),m(2),S(3,"translate"),h(),c(4,"strong",12),m(5),h()()),i&2){let r=u(2);l(2),C(" ",N(3,2,r.isCaptain?"EventOrganizerReplaceAthlete.Captain of team":"EventOrganizerReplaceAthlete.Teammate of team"),": "),l(3),A(r.teamName)}}function ht(i,n){if(i&1){let r=ze();b(0),c(1,"header",4)(2,"div",5)(3,"h1",6),m(4),S(5,"translate"),c(6,"strong"),m(7),h()(),I(8,mt,4,3,"p",7)(9,dt,5,4,"h2",8),h()(),c(10,"div",9)(11,"div",10)(12,"div")(13,"span",11),m(14),S(15,"translate"),h(),c(16,"strong",12),m(17),h()(),I(18,ct,6,4,"div",13),h(),c(19,"app-organizer-registration-form",14),Ne("formSubmit",function(t){Ee(r);let a=u();return Te(a.onFormSubmit(t))}),h()(),y()}if(i&2){let r=u();l(4),C(" ",N(5,11,"EventOrganizerReplaceAthlete.Replace athlete for")," "),l(3),A(r.eventName),l(),g("ngIf",r.eventStartDate||r.eventLocation),l(),g("ngIf",r.replacedAthleteName),l(5),C("",N(15,13,"EventOrganizerReplaceAthlete.Division"),":"),l(3),A(r.divisionTitle),l(),g("ngIf",r.isTeam&&r.teamName),l(),g("schema",r.schema)("model",r.model)("submitting",r.submitting)("submitLabelKey",r.submitLabelKey)}}var tt=(()=>{let n=class n{constructor(e,t,a,o,s,p,d){this.api=e,this.attributeService=t,this.route=a,this.alertService=o,this.translate=s,this.registerTranslateService=p,this.cdr=d,this.eventName="",this.eventStartDate=null,this.eventEndDate=null,this.eventLocation="",this.divisionTitle="",this.replacedAthleteName="",this.replacedAthleteEmail="",this.teamName="",this.isTeam=!1,this.isCaptain=!1,this.loadingModel=!1,this.submitting=!1,this.info=null,this.schema=null,this.model=null,this.eventId=this.route.snapshot.params.eventID||this.attributeService.event_id,this.athleteId=this.route.snapshot.params.athleteID,this.eventId&&(this.attributeService.event_id=String(this.eventId))}ngOnInit(){this.registerTranslateService.setTranslation({id:we}),this.loadModelAndSchema()}get submitLabelKey(){return q.REPLACE}loadModelAndSchema(){!this.eventId||!this.athleteId||(this.loadingModel=!0,this.info=null,this.schema=null,this.model=null,be([this.api.fetchModel(this.eventId,this.athleteId),this.api.fetchSchema(this.eventId,this.athleteId)]).subscribe({next:([e,t])=>{try{if(this.info=(e==null?void 0:e.body)||null,this.schema=this.normalizeSchema(t==null?void 0:t.body),!this.info)throw new Error("replace/model response had no body");this.applyContext(this.info),this.model=this.buildModel(this.info,this.schema),this.loadingModel=!1,this.cdr.detectChanges()}catch{this.loadingModel=!1,this.failOpen()}},error:()=>{this.loadingModel=!1,this.failOpen()}}))}applyContext(e){var s,p,d,v,_,f,E,T,R,D,P,L,F,O,M;let t=e.event||{},a=e.division||{},o=e.model||{};this.eventName=(p=(s=t.Name)!=null?s:t.name)!=null?p:"",this.eventStartDate=(v=(d=t.StartDate)!=null?d:t.startDate)!=null?v:null,this.eventEndDate=(f=(_=t.EndDate)!=null?_:t.endDate)!=null?f:null,this.eventLocation=[(E=t.Venue)!=null?E:t.venue,(T=t.City)!=null?T:t.city,(R=t.Region)!=null?R:t.region].filter(z=>typeof z=="string"&&z.trim().length>0).join(", "),this.divisionTitle=(P=(D=a.Title)!=null?D:a.title)!=null?P:"",this.replacedAthleteName=(F=(L=o.ReplacedAthleteName)!=null?L:o.replacedAthleteName)!=null?F:"",this.teamName=(M=(O=o.TeamName)!=null?O:o.teamName)!=null?M:"",this.isTeam=!!e.isTeam,this.isCaptain=!!e.isCaptain,this.replacedAthleteEmail=e.replacedAthleteEmail||""}failOpen(){this.alertService.addError(new Y(J.successCustom,this.translate.instant(q.SOMETHING_WENT_WRONG),X,Z))}normalizeSchema(e){var s,p,d,v,_;let t=Array.isArray(e==null?void 0:e.visible)?e.visible.slice():[],a=Array.isArray(e==null?void 0:e.required)?e.required.slice():[],o=new Set(et);return{visible:t.filter(f=>!o.has(f)),required:a.filter(f=>!o.has(f)),labels:(e==null?void 0:e.labels)||{},settings:(e==null?void 0:e.settings)||{},customFields:Array.isArray((s=e==null?void 0:e.settings)==null?void 0:s.customFields)?e.settings.customFields:[],waiver:(d=(p=e==null?void 0:e.settings)==null?void 0:p.waiver)!=null?d:e==null?void 0:e.waiver,paymentSettings:(_=(v=e==null?void 0:e.settings)==null?void 0:v.paymentSettings)!=null?_:e==null?void 0:e.paymentSettings}}buildModel(e,t){var O,M,z,ee,te,ie,ne,ae,re,oe,se,le,pe,me,de,ce,he,ge,fe,ue,ve,xe,_e,Ce,Se,Ie;let a=e.event||{},o=e.division||{},s=e.model||{},p=(M=(O=s.EventId)!=null?O:a.Id)!=null?M:a.id,d=(ee=(z=s.DivisionId)!=null?z:o.Id)!=null?ee:o.id,v=(ie=(te=a.Name)!=null?te:a.name)!=null?ie:"",_=(ae=(ne=a.StartDate)!=null?ne:a.startDate)!=null?ae:null,f=(oe=(re=a.Currency)!=null?re:a.currency)!=null?oe:null,E=(le=(se=o.Title)!=null?se:o.title)!=null?le:"",T=(me=(pe=o.Format)!=null?pe
1:o.format)!=null?me:"individual",R=(he=(ce=(de=o.Price)!=null?de:o.price)!=null?ce:o.DivisionPrice)!=null?he:o.divisionPrice,D=(ge=s.Characteristic)!=null?ge:"replace_athlete",P=e.isTeam?"team":"individual",L=(fe=s.ShirtSize)!=null?fe:"",F=Array.isArray(s.TimeslotIds)?s.TimeslotIds:[];return H(j(j({},t.settings),(ue=t.settings)==null?void 0:ue.paymentSettings),{eventId:p,divisionId:d,divisionsIds:d!=null?String(d):null,subcategoryId:(ve=s.SubcategoryId)!=null?ve:null,subGroupId:(xe=s.SubGroupId)!=null?xe:null,events:[{eventId:p,eventName:v,date:_,currency:f,divisions:[{id:d,title:E,format:T,divisionPrice:R}],timeslotSessions:[]}],eventFormat:T,eventTitle:v,divisionTitle:E,timeslotTitle:[],customFields:t.customFields||[],paymentSettings:(_e=t.settings)==null?void 0:_e.paymentSettings,characteristic:D,registrationType:P,timeslotIds:F,currency:f,gender:(Ce=t.settings)==null?void 0:Ce.gender,firstName:"",lastName:"",email:"",shirtSize:L,replacedAthleteId:s.ReplacedAthleteId,replacedAthleteName:s.ReplacedAthleteName,teamDataId:(Se=s.TeamDataId)!=null?Se:null,teamName:(Ie=s.TeamName)!=null?Ie:null,isCaptain:!!s.IsCaptain})}onFormSubmit(e){if(!this.info||!this.schema||!this.model)return;let t=H(j({},e),{eventId:this.model.eventId,divisionId:this.model.divisionId,characteristic:this.model.characteristic,registrationType:this.model.registrationType,timeslotIds:this.model.timeslotIds||[],replacedAthleteId:this.model.replacedAthleteId,replacedAthleteName:this.model.replacedAthleteName,teamDataId:this.model.teamDataId,teamName:this.model.teamName,isCaptain:this.model.isCaptain});this.submitting=!0,this.api.submit(this.eventId,this.athleteId,t).pipe(ye(()=>this.submitting=!1)).subscribe(a=>this.handleSuccess(a.body),a=>this.handleError(a))}handleSuccess(e){let t=new URLSearchParams({isReplaced:"true",isTeam:String(this.isTeam),eventName:this.eventName||""});window.location.href="".concat(Ze.ATHLETE_REPLACED(e.eventId),"?").concat(t.toString())}handleError(e){let t=e&&typeof e=="object"&&"modelState"in e?e:void 0;t!=null&&t.modelState&&this.formComponent&&this.formComponent.applyServerErrors(t.modelState);let a=t!=null&&t.modelState?Object.values(t.modelState).filter(Boolean):[],o=[t==null?void 0:t.error,...a].filter(p=>typeof p=="string"&&p.trim().length>0),s=Array.from(new Set(o)).join("\n")||(typeof e=="string"?e:null)||this.translate.instant(q.SOMETHING_WENT_WRONG)||"Something went wrong";this.alertService.addError(new Y(J.successCustom,s,X,Z))}};n.\u0275fac=function(t){return new(t||n)(x(K),x($),x(Be),x(qe),x(ke),x(Qe),x(Le))},n.\u0275cmp=Oe({type:n,selectors:[["app-organizer-replace-athlete-container"]],viewQuery:function(t,a){if(t&1&&Re(B,5),t&2){let o;De(o=Pe())&&(a.formComponent=o.first)}},standalone:!1,decls:3,vars:2,consts:[[1,"organizer-replace-athlete"],["class","dark-spinner dark-spinner-default",4,"ngIf"],[4,"ngIf"],[1,"dark-spinner","dark-spinner-default"],[1,"organizer-replace-header"],[1,"organizer-replace-header__inner"],[1,"header-title"],["class","header-date",4,"ngIf"],["class","header-athlete",4,"ngIf"],[1,"organizer-replace-body"],[1,"cc-admin-mb--16px","replace-context"],[1,"cc-admin-input-label"],[1,"cc-admin-ml--8px"],["class","cc-admin-mt--8px",4,"ngIf"],[3,"formSubmit","schema","model","submitting","submitLabelKey"],[1,"header-date"],[1,"header-athlete"],[1,"cc-admin-mt--8px"]],template:function(t,a){t&1&&(c(0,"div",0),I(1,rt,1,0,"app-spinner",1)(2,ht,20,15,"ng-container",2),h()),t&2&&(l(),g("ngIf",a.loadingModel),l(),g("ngIf",a.model&&a.schema&&!a.loadingModel))},dependencies:[Fe,Ye,B,je,Ge],styles:["[_nghost-%COMP%]{display:block;overflow-x:clip} .main-content{padding:0!important} .radio-btn-cover{padding-bottom:0!important} .tel-number-field .mdc-text-field__input{height:48px!important} ni-legend-field h2{padding:0!important}.organizer-replace-athlete[_ngcontent-%COMP%]{margin:0 auto} app-spinner.dark-spinner-default{position:fixed!important;left:50%!important;top:50%!important;display:block!important;width:80px;height:80px;margin-left:-40px;margin-top:-40px;z-index:1050} app-spinner.dark-spinner-default .inner-spinner{top:50%!important;left:50%!important;bottom:auto!important;margin:-20px 0 0 -20px}.organizer-replace-header[_ngcontent-%COMP%]{background-color:#fff;box-shadow:0 3px 6px #30303029,0 3px 6px #3030303b;padding:70px 0;margin-bottom:32px}@media (max-width: 1200px){.organizer-replace-header[_ngcontent-%COMP%]{padding-left:64px}}@media (max-width: 767px){.organizer-replace-header[_ngcontent-%COMP%]{padding-top:24px;padding-bottom:24px;margin-bottom:20px}}.organizer-replace-header__inner[_ngcontent-%COMP%]{max-width:960px;margin:0 auto;padding:0 24px}@media (max-width: 767px){.organizer-replace-header__inner[_ngcontent-%COMP%]{padding:0 16px}}.organizer-replace-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%]{font-size:24px!important;line-height:1.2!important;margin:0!important;color:#303030!important;font-family:Roboto,sans-serif!important}.organizer-replace-header[_ngcontent-%COMP%] .header-date[_ngcontent-%COMP%]{font-size:13px!important;color:#757575!important;margin:4px 0 0!important;font-weight:400!important;letter-spacing:.1px!important;line-height:24px!important}.organizer-replace-header[_ngcontent-%COMP%] .header-athlete[_ngcontent-%COMP%]{font-size:16px!important;color:#303030!important;margin:12px 0 0!important;font-weight:400!important;line-height:24px!important;font-family:Roboto,sans-serif!important}.organizer-replace-body[_ngcontent-%COMP%]{max-width:960px;margin:0 auto;padding:0 24px 24px}@media (max-width: 1200px){.organizer-replace-body[_ngcontent-%COMP%]{padding-left:64px}}@media (max-width: 767px){.organizer-replace-body[_ngcontent-%COMP%]{padding-right:16px;padding-bottom:24px}}.replace-context[_ngcontent-%COMP%]{padding:12px 16px;border:1px solid #e7eaee;border-radius:8px;background:#f7f9fc;max-width:700px}"]});let i=n;return i})();var gt=[{path:"",component:tt}],it=(()=>{let n=class n{};n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=G({type:n}),n.\u0275inj=k({imports:[Q.forChild(gt),Q]});let i=n;return i})();var Wt=(()=>{let n=class n{};n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=G({type:n}),n.\u0275inj=k({providers:[K],imports:[Ue,He,We,$e,Je,Ve,Xe,it]});let i=n;return i})();export{Wt as EventOrganizerReplaceAthleteModule};
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.