1import{t as r}from"./chunk-CPhnWVyu.js";import{$ as Lw,$n as ju$1,$r as ud$1,$t as Wl$4,A as FD,B as Iu$2,Br as qn$4,Bt as UD,C as Dm,Cn as bm,Ct as Rh$3,D as Eu$2,Di as yw,Dn as cj,Dr as pe$3,E as El$4,Er as pc$4,F as HD,Fn as gC,Ft as Tg,Gr as sE,Gt as Vh$3,Hn as hn$4,Hr as rj,Ht as Ur$4,In as gT,It as Th$2,J as Le$3,Jn as jC,Kt as Vm,Ln as gl$4,M as Fw,Mn as ej,Mt as T$4,Nr as pw,Nt as TC,O as F$2,Oi as z1,On as dg,Ot as Sh$2,Pn as fw,Pr as q$1,Pt as Te$6,Q as Lr$5,Qn as jm,R as Il$4,Rn as gw,Rt as Tl$4,Sn as bh$1,Sr as oj,St as Qe$1,T as E,Tr as or$5,Tt as Rw,Un as hw,Ur as rn$5,Vr as qy,Wn as ig,Xr as tj,Xt as WE,Y as Lh$3,Yr as ti$3,Yt as WD,Zn as jh$3,Zt as We$2,_ as Cl$4,_i as xd$2,_n as aI,_t as PD,an as Y1,ar as lC,b as Cw,bn as b$1,bt as Pw,c as Ar$5,cn as Z$4,cr as lp$1,d as Bi$3,di as we$4,dn as Zh$2,dr as mT,ei as ue$3,en as Wn$4,er as jw,f as Bo$5,fi as wh$3,fn as _C,g as Ci$3,gt as Oo$4,hr as mw,ii as vC,in as Xw,ir as kw,jn as ee$5,jr as ps$4,k as FC,ki as zE,kn as dm,kr as pm,li as wc$4,ln as Z1,lr as lv,m as Ce$3,mi as wp$1,mn as _t$9,mt as OC,n as $h$2,ni as um,nn as XE,nr as kh$3,nt as Mm,o as Ae$3,oi as vl$4,on as Yh$3,or as ld$2,ot as My,p as CC,pn as _m,pt as Ny,q as LC,qn as is$5,qr as sg,qt as W$4,rt as Ms$4,s as Ah$2,st as N$2,t as $C,ti as ug,tr as ke$5,u as Bh$3,ui as wd$1,v as Cm,vi as xh$2,vn as ag,vr as ni$3,vt as Ph$3,w as Du$2,wi as yi$4,wn as bt$8,wt as Rr$5,x as Dd$1,xi as xw,xn as bC,xt as Q1,yi as xm,zr as qh$2,zt as Tm}from"./chunk-Drmdr-QX.js";import{$ as Zi$3,A as Or$4,B as Tt$4,C as Kr$5,Ct as ra$5,D as Oc$4,E as Nt$6,Ft as xn$4,G as Ws$4,J as Xp$1,L as Th$3,M as Re$2,N as Rr$6,Nt as ws$4,Pt as xc$4,Q as Za$2,Rt as yn$4,S as Ka$3,T as Nh$3,Tt as rm,W as Wi$3,X as Yi$2,Z as Ys$4,_ as Ho$5,b as Jp$1,ct as gc$4,dt as hr$5,et as Zs$4,f as Dr$5,g as Gr$5,ht as mc$4,i as At$4,it as be$3,jt as wp$2,l as Cr$5,lt as ge$3,m as Er$5,mt as kt$6,nt as aa$4,ot as es$4,p as En$3,pt as k$2,r as Ap$1,t as $h$3,tt as _d$2,u as Dc$4,x as Js$4,xt as pe$4,yt as nt$5,z as Tr$5,zt as yo$5}from"./chunk-ft49rYsP.js";import{A as vi$4,E as mi$2,O as q$2,S as di$3,_ as Xt$4,b as bt$9,c as It$5,h as Ue$2,i as Ft$4,l as Le$4,n as B$4,p as Re$3,r as Bt$5,s as I$4,u as Mt$6,v as Yt$2,w as je$2}from"./chunk-DOcZup1X.js";import{n as ut$6,t as ht$8}from"./chunk-C3a2I6ze.js";import{i as uu$2,n as lt$5,r as rp$1,t as kR}from"./chunk-CNKbW6qq.js";import{i as g$1,n as R$3,r as f$2,t as E$1}from"./chunk-DxHRMUyN.js";import{n as ce$5,r as ie$4,t as G$1}from"./chunk-MKmBfn59.js";import{n as G$2,r as O$3,t as E$2}from"./chunk-CKumVIsC.js";import{C as bt$10,D as qn$5,E as pn$4,O as un$5,S as bn$4,T as h$1,_ as Yn$5,b as _$2,c as Jn$4,d as P,f as Qe$2,g as Xn$4,h as Vn$4,i as C$1,j as ye$4,l as Kn$4,n as $n$4,o as E$3,p as Qn$4,r as $t$4,t as $$1,v as Zn$4,w as fn$5,x as be$4,y as Zt$4}from"./chunk-Cdk0kn8B.js";import{C as nt$6,E as tt$1,T as rt$5,_ as U$3,a as D$5,c as J$4,g as T$5,i as C$2,n as A$2,p as P$1,s as I$5,t as $$2,v as W$5,x as et$2}from"./chunk-B2BKG2bI.js";import{t as A$3}from"./chunk-XcqO2dCv.js";import{C as b$2,I as q$3,N as ne$4,a as G$3,v as X$3}from"./chunk-zfVmXzvD.js";import{n as wt$5,r as yt$7,t as et$3}from"./chunk-BBilGygY.js";import{i as b$3,n as W$6,r as X$4,t as Q$1}from"./chunk-D9ik1GIh.js";import{t as I$6}from"./chunk-Bz4U6148.js";import{t as Ln$5}from"./chunk-tKvxL98W.js";import{a as le$5,i as h$2,n as de$3,o as pe$5,r as f$3,t as Me$3}from"./chunk-DXEn9AUU.js";import{t as Ct$5}from"./chunk-Btroqr1p.js";import{t as v$2}from"./chunk-BNaMWn1u.js";import{t as m$2}from"./chunk-U3ozonZd.js";import{c as gt$7,d as we$5,f as xt$5,i as X$5,l as je$3,n as Fn$4,p as yt$8,r as St$5,s as en$4,t as En$4,u as qe$2}from"./chunk-5BKEoovl.js";import{i as Hi$3,o as ji$3,r as Gi$3,t as $$3,u as vt$7}from"./chunk-BChcMF4O.js";import{n as Pe$4,r as Y$4,t as Be$2}from"./chunk-CWV-5OQT.js";import{a as ea$4,c as yi$5,i as Xo$4,n as G$4,o as mr$5,r as V$2,s as si$3,t as $$4}from"./chunk-DH-yZAry.js";import{n as l$2,r as m$3,t as d$3}from"./chunk-BybB2Vgl.js";import{n as S,o as p$2,r as _$3}from"./chunk-B-z3KEEt.js";var Te$5=mT(ce$5());var fr$4=6e4;var st$6=class r{http=E(yo$5);configService=E(kR);apiUrl=this.configService.config()?.apiUrl||``;readiness=ni$3(new Map,{equal:()=>!1});workoutCounts=ni$3(new Map,{equal:()=>!1});clientWarnings=ni$3(new Map,{equal:()=>!1});profileImageUrls=ni$3(new Map,{equal:()=>!1});profileImageExpiresAtMs=new Map;currentWorkoutProgramStatuses=ni$3(new Map,{equal:()=>!1});settledResources=ni$3(new Set,{equal:()=>!1});markSettled(e,t){this.settledResources.update(n=>(n.add(`${e}:${t}`),n))}isReadinessLoaded(e){return this.settledResources().has(`readiness:${e}`)}isCommitmentLoaded(e){return this.settledResources().has(`commitment:${e}`)}isWarningsLoaded(e){return this.settledResources().has(`warnings:${e}`)}isProfileImageLoaded(e){return this.settledResources().has(`profileImage:${e}`)}getProfileImageUrl(e){return this.profileImageUrls().get(e)}resetData(){this.readiness.set(new Map),this.workoutCounts.set(new Map),this.clientWarnings.set(new Map),this.currentWorkoutProgramStatuses.set(new Map),this.profileImageUrls.set(new Map),this.profileImageExpiresAtMs.clear(),this.settledResources.set(new Set)}getReadinessPercentage(e){let n=this.readiness().get(e)?.readinessIndex;if(n!=null)return Math.round(n).toString()}getCommitmentPercentage(e){let t=this.workoutCounts().get(e)?.workout_commitment_score;if(t!==void 0)return t+`%`}getWorkoutCounts(e){return this.workoutCounts().get(e)}getWarnings(e){return this.clientWarnings().get(e)?.warnings||[]}warningCount=$C(()=>{let e=0;for(let t of this.clientWarnings().values())(t.warnings?.length??0)>0&&e++;return e});warningClientIds=$C(()=>{let e=[];for(let[t,n]of this.clientWarnings())(n.warnings?.length??0)>0&&e.push(t);return e});getCurrentWorkoutProgramStatus(e){return this.currentWorkoutProgramStatuses().get(e)?.parsedString||`-`}getCurrentWorkoutProgramProgress(e){let t=this.currentWorkoutProgramStatuses().get(e);return t?t.ongoingWeek/t.totalWeeks*100:0}fetchReadiness(e){this.http.get(`${this.apiUrl}/api/v3/athletes/${e}/statistics/readiness`).subscribe({next:t=>{t.readiness&&this.readiness.update(n=>(n.set(e,t.readiness),n)),this.markSettled(`readiness`,e)},error:t=>{t?.status!==404&&uu$2.error(`Failed to fetch readiness:`,t),this.markSettled(`readiness`,e)}})}fetchWorkoutCounts(e){this.http.get(`${this.apiUrl}/api/v3/athletes/${e}/statistics/commitment`).subscribe({next:t=>{this.workoutCounts.update(n=>(n.set(e,{workout_commitment_score:t.commitmentPercentage,workout_done_last_week_count:t.workoutsDone,workout_last_week_count:t.workoutsPlanned}),n)),this.markSettled(`commitment`,e)},error:t=>{uu$2.error(`Failed to fetch workout counts:`,t),this.markSettled(`commitment`,e)}})}fetchWorkoutCountsForWeek(e,t,n){return this.http.get(`${this.apiUrl}/api/v3/athletes/${e}/statistics/commitment`,{params:{isoWeek:t.toString(),year:n.toString()}})}fetchAllWorkoutCounts(){this.http.get(`${this.apiUrl}/api/v3/coach/statistics/commitment/batch`).subscribe({next:e=>{this.workoutCounts.update(t=>{for(let n of e.athletes)t.set(n.athleteId,{workout_commitment_score:n.commitmentPercentage,workout_done_last_week_count:n.workoutsDone,workout_last_week_count:n.workoutsPlanned}),this.markSettled(`commitment`,n.athleteId);return t})},error:e=>uu$2.error(`Failed to fetch batch workout counts:`,e)})}fetch_user_warnings(e){this.http.get(`${this.apiUrl}/api/v3/athletes/${e}/warnings`).subscribe({next:t=>{t.warnings&&this.clientWarnings.update(n=>(n.set(e,{warnings:t.warnings}),n)),this.markSettled(`warnings`,e)},error:t=>{uu$2.error(`Failed to fetch user warnings:`,t),this.markSettled(`warnings`,e)}})}fetch_current_workoutProgram(e){this.http.get(`${this.apiUrl}/api/v3/athletes/${e}/programs`).subscribe({next:t=>{let n=(0,Te$5.default)(),o=t.programs?.find(a=>{let i=(0,Te$5.default)(a.start),c=i.add(a.weeks,`week`);return n.isAfter(i)&&n.isBefore(c)});if(o){let a=o.weeks,i=(0,Te$5.default)().diff((0,Te$5.default)(o.start).format(`YYYY-MM-DD`),`week`)+1;this.currentWorkoutProgramStatuses.update(c=>(c.set(e,{parsedString:`${i} / ${a}`,ongoingWeek:i,totalWeeks:a}),c))}},error:t=>uu$2.error(`Failed to fetch workout programs:`,t)})}fetchAllClientStatus(e){this.fetchReadiness(e),this.fetchWorkoutCounts(e),this.fetch_user_warnings(e),this.fetch_current_workoutProgram(e),this.fetchProfileImageUrl(e)}fetchProfileImageUrl(e,t=!1){if(!t){let n=this.profileImageExpiresAtMs.get(e);if(this.isProfileImageLoaded(e)&&n!==void 0&&Date.now()<n-fr$4)return}this.http.get(`${this.apiUrl}/api/v3/athletes/${e}/profile-image-url`).subscribe({next:n=>{this.profileImageUrls.update(o=>(o.set(e,n.image_url??null),o)),this.profileImageExpiresAtMs.set(e,n.expires_at?new Date(n.expires_at).getTime():0),this.markSettled(`profileImage`,e)},error:n=>{uu$2.error(`Failed to fetch profile image url:`,n),this.markSettled(`profileImage`,e)}})}fetchWarningsForClients(e,t=!1){for(let n of e)(t||!this.isWarningsLoaded(n))&&this.fetch_user_warnings(n)}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var ae$7=mT(ce$5());function na$4(r){if(r.length===0)return 0;let e=r.find(o=>o.domain===`strength`)?.weeks,t=r.find(o=>o.domain===`endurance`)?.weeks;if(e!=null&&t!=null)return Math.max(0,Math.min(12-e,12-t));let n=Math.max(...r.map(o=>o.weeks));return Math.max(0,12-n)}function br$4(r){return r.days.reduce((e,t)=>
1e+t.trainings.length,0)}function ra$4(r){return br$4(r)===0}function Tn$3(r,e){return Number.isInteger(r)&&r>=1&&r<=e}function On$5(r){let e=(r??[]).map(t=>t.copiedWorkoutCount??0);return e.some(t=>t>0)&&e.some(t=>t===0)}function Nn$4(r,e,t){let n=Math.min(t,12);return Number.isInteger(r)&&Number.isInteger(e)&&r!==e&&r>=1&&e>=1&&r<=n&&e<=n}var An$2=8;var yr$4=2;var vr$4=500;function _r$4(r){let e=r?.status;return e===0||e>=500}function Pr$4(r){return new Promise(e=>setTimeout(e,r))}var Se$3=class r{api=E(E$1);translate=E(Gr$5);toast=E(ut$6);monitoring=E(rp$1);clientDataService=E(E$2);trainingBankService=E(q$3);trainings=ni$3(new Map,{equal:()=>!1});workoutPrograms=ni$3(new Map,{equal:()=>!1});workoutGenerationInProgress=ni$3(!1);recurringCopyPendingDateKeys=ni$3(new Set);copyWorkoutInProgress=$C(()=>this.recurringCopyPendingDateKeys().size>0);loading=this.api.loading;fetchTrainings(e,t,n){return ps$4(this,null,function*(){let o={startDate:t??`1970-01-01`,endDate:n??`2999-12-31`,includeDraft:!0};try{let i=((e?yield this.api.get(`/api/v3/athletes/{athlete_id}/workouts`,{pathParams:{athlete_id:e},queryParams:o}):yield this.api.get(`/api/v3/me/workouts`,{queryParams:o})).workouts??[]).map(f=>this.mapApiWorkoutToTraining(f)),c=this.trainings(),b=e??0;c.set(b,this.formatInputTrainingData(i,b)),this.trainings.set(c)}catch(a){uu$2.error(`[FETCH] fetchTrainings FAILED:`,a)}})}setRecurringCopyPendingDates(e){let t=new Set(e.map(n=>(0,ae$7.default)(n).format(`YYYY-MM-DD`)));this.recurringCopyPendingDateKeys.set(t)}clearRecurringCopyPendingDates(){this.recurringCopyPendingDateKeys.set(new Set)}isRecurringCopyPendingForDate(e){return this.recurringCopyPendingDateKeys().has((0,ae$7.default)(e).format(`YYYY-MM-DD`))}addTraining(e,t){return ps$4(this,null,function*(){try{let n=this.formatTrainingForCreate(e);if(e.athlete_id){let a=yield this.api.post(`/api/v3/athletes/{athlete_id}/workouts`,n,{pathParams:{athlete_id:e.athlete_id}});return t?.skipRefresh||(yield this.fetchTrainings(e.athlete_id)),a.id}return(yield this.api.post(`/api/v3/me/workouts`,n)).id}catch(n){uu$2.error(`Failed to add training:`,n);return}})}updateTraining(e,t){return ps$4(this,null,function*(){if(!e.id){uu$2.error(`Training ID is required to update`);return}try{let n=this.formatTrainingForUpdate(e);e.athlete_id?(yield this.api.put(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}`,n,{pathParams:{athlete_id:e.athlete_id,workout_id:e.id},queryParams:t?.allFuture?{updateAll:!0}:void 0}),t?.skipRefresh||(yield this.fetchTrainings(e.athlete_id))):yield this.api.put(`/api/v3/me/workouts/{workout_id}`,n,{pathParams:{workout_id:e.id}})}catch(n){uu$2.error(`Failed to update training:`,n)}})}deleteTraining(e,t,n=!1){return ps$4(this,null,function*(){if(!e||!t){uu$2.error(`Training ID and Client ID are required to delete a training`);return}try{t?yield this.api.delete(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}`,{pathParams:{athlete_id:t,workout_id:e},queryParams:{deleteAll:n}}):yield this.api.delete(`/api/v3/me/workouts/{workout_id}`,{pathParams:{workout_id:e},queryParams:{deleteAll:n}}),this.monitoring.trackEvent(`workout_delete`,{outcome:`deleted`,status:`200`,workoutId:String(e),clientId:String(t),deleteAll:String(n)}),uu$2.log(`[WorkoutDelete] outcome=deleted status=200`,{trainingId:e,clientId:t,allLinked:n}),yield this.fetchTrainings(t)}catch(o){let a=o;if(a?.status===403){this.monitoring.trackEvent(`workout_delete`,{outcome:`forbidden`,status:`403`,workoutId:String(e),clientId:String(t),deleteAll:String(n)}),uu$2.warn(`[WorkoutDelete] outcome=forbidden status=403`,{trainingId:e,clientId:t,allLinked:n,detail:a.detail}),this.toast.show(a.detail||`Workout delete not allowed`,`error`);return}if(a?.status===404){this.monitoring.trackEvent(`workout_delete`,{outcome:`already_deleted_or_not_found`,status:`404`,workoutId:String(e),clientId:String(t),deleteAll:String(n)}),uu$2.warn(`[WorkoutDelete] outcome=already_deleted_or_not_found status=404`,{trainingId:e,clientId:t,allLinked:n,detail:a.detail}),this.toast.show(a.detail||`Workout not found or already deleted`,`warning`),yield this.fetchTrainings(t);return}this.monitoring.trackEvent(`workout_delete`,{outcome:`error`,status:String(a?.status??`unknown`),workoutId:String(e),clientId:String(t),deleteAll:String(n)}),uu$2.error(`[TrainingService] Failed to delete training:`,o)}})}moveTrainingToDate(e,t,n,o=!1){return ps$4(this,null,function*(){if(!e||!t){uu$2.error(`Training ID and date are required to move training`);return}try{let A=`${t.getFullYear()}
1-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}T${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`;n?yield this.api.patch(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/move`,{start:A,moveChain:o},{pathParams:{athlete_id:n,workout_id:e}}):yield this.api.patch(`/api/v3/me/workouts/{workout_id}/move`,{start:A,moveChain:o},{pathParams:{workout_id:e}}),yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to move training:`,a)}})}copyWorkout(e,t,n){return ps$4(this,null,function*(){if(!e||!t.start||!n){uu$2.error(`Workout ID, start date, and Athlete ID are required to copy workout`);return}let o={start:(0,ae$7.default)(t.start).format(`YYYY-MM-DD`),end:t.end?(0,ae$7.default)(t.end).format(`YYYY-MM-DD`):void 0};try{n?yield this.api.post(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/copy`,o,{pathParams:{athlete_id:n,workout_id:e}}):yield this.api.post(`/api/v3/me/workouts/{workout_id}/copy`,o,{pathParams:{workout_id:e}}),yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to copy workout:`,a)}})}copyWorkoutToDates(e,t,n,o){return ps$4(this,null,function*(){if(!e||!t.length||!n)return uu$2.error(`Workout ID, dates, and Athlete ID are required`),[];let a=[],i=b=>this.api.post(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/copy`,{start:(0,ae$7.default)(b).format(`YYYY-MM-DD`),end:(0,ae$7.default)(b).format(`YYYY-MM-DD`)},{pathParams:{athlete_id:n,workout_id:e}}),c=b=>ps$4(this,null,function*(){for(let f=0;;f++)try{return yield i(b)}catch(k){if(f>=yr$4||!_r$4(k))throw k;yield Pr$4(vr$4*(f+1))}});for(let b=0;b<t.length;b+=An$2){let f=t.slice(b,b+An$2);(yield Promise.allSettled(f.map(A=>c(A)))).forEach((A,O)=>{A.status===`fulfilled`?A.value.workoutId&&a.push(A.value.workoutId):uu$2.error(`Failed to copy workout to date:`,(0,ae$7.default)(f[O]).format(`YYYY-MM-DD`),A.reason)})}return o?.skipRefresh||(yield this.fetchTrainings(n)),a})}linkWorkoutsInRecurrenceChain(e,t,n){return ps$4(this,null,function*(){if(e.length<2||!t)return;let o=this.trainings().get(t)??[];for(let a=0;a<e.length-1;a++){let i=e[a],c=e[a+1],b=o.find(f=>f.id===i);b||(n?.skipRefresh||(yield this.fetchTrainings(t)),o=this.trainings().get(t)??[],b=o.find(f=>f.id===i)),!(!b||b.next_workout_id===c)&&(yield this.updateTraining({id:b.id,athlete_id:b.athlete_id,next_workout_id:c},n))}})}changeDraftStatus(e,t,n,o){return ps$4(this,null,function*(){try{yield this.api.patch(`/api/v3/athletes/{athlete_id}/workouts/drafts`,{workoutIds:t,athleteId:e,draft:n},{pathParams:{athlete_id:e}}),n?this.toast.show(`training.workoutHidden`,`info`):this.toast.show(`training.workoutPublished`,`success`),o?.skipRefresh||(yield this.fetchTrainings(e))}catch(a){uu$2.error(`Failed to change draft status:`,a)}})}submitAIRating(e,t,n){return ps$4(this,null,function*(){try{return n?yield this.api.post(`/api/v3/athletes/{athlete_id}/programs/{program_id}/ai-rating`,t,{pathParams:{athlete_id:n,program_id:e}}):yield this.api.post(`/api/v3/me/programs/{program_id}/ai-rating`,t,{pathParams:{program_id:e}})}catch(o){throw uu$2.error(`Failed to submit AI rating:`,o),o}})}completeWorkout(e,t,n){return ps$4(this,null,function*(){try{n?yield this.api.patch(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/complete`,{done:t},{pathParams:{athlete_id:n,workout_id:e}}):yield this.api.patch(`/api/v3/me/workouts/{workout_id}/complete`,{done:t},{pathParams:{workout_id:e}}),yield this.fetchTrainings(n)}catch(o){uu$2.error(`Failed to complete workout:`,o)}})}listWorkoutComments(e,t){return ps$4(this,null,function*(){return this.api.get(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/comments`,{pathParams:{athlete_id:e,workout_id:t}})})}addWorkoutComment(e,t,n){return ps$4(this,null,function*(){return this.api.post(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/comments`,{content:n},{pathParams:{athlete_id:e,workout_id:t}})})}addExercise(e,t,n){return ps$4(this,null,function*(){if(!e||!n){uu$2.error(`Workout ID and Athlete ID are required to add exercise`);return}try{let o=this.formatExerciseForCreate(t);n?yield this.api.post(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/exercises`,o,{pathParams:{athlete_id:n,workout_id:e}}):yield this.api.post(`/api/v3/me/workouts/{workout_id}/exercises`,o,{pathParams:{workout_id:e}}),yield this.fetchTrainings(n)}catch(o){uu$2.error(`Failed to add exercise:`,o)}})}deleteExercise(e,t,n,o){return ps$4(this,null,function*(){if(!e||!n){uu$2.error(`Exercise ID and Athlete ID are required to delete exercise`);return}if(!o){uu$2.error(`Workout ID is required to delete exercise via HTTP API`);return}try{n?yield this.api.delete(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/exercises/{workout_exercise_id}`,{pathParams:{athlete_id:n,workout_id:o,workout_exercise_id:e}}):yield this.api.delete(`/api/v3/me/workouts/{workout_id}/exercises/{workout_exercise_id}`,{pathParams:{workout_id:o,workout_exercise_id:e}}),yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to delete exercise:`,a)}})}changeExerciseDuration(e,t,n,o){return ps$4(this,null,function*(){if(!e||!n){uu$2.error(`Exercise ID and Athlete ID are required to change exercise duration`);return}if(!o){uu$2.error(`Workout ID is required to update exercise via HTTP API`);return}try{uu$2.warn(`changeExerciseDuration: Consider updating through series instead`),yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to change exercise duration:`,a)}})}changeExerciseRepetitions(e,t,n,o){return ps$4(this,null,function*(){if(!e||!n){uu$2.error(`Exercise ID and Athlete ID are required to change exercise repetitions`);return}if(!o){uu$2.error(`Workout ID is required to update exercise via HTTP API`);return}try{uu$2.warn(`changeExerciseRepetitions: Consider updating through series instead`),yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to change exercise repetitions:`,a)}})}changeExerciseSets(e,t,n,o){return ps$4(this,null,function*(){if(!e||!n){uu$2.error(`Exercise ID and Athlete ID are required to change exercise sets`);return}if(!o){uu$2.error(`Workout ID is required to update exercise via HTTP API`);return}try{uu$2.warn(`changeExerciseSets: Consider updating through series instead`),yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to change exercise sets:`,a)}})}updateSetAmount(e,t,n,o,a){return ps$4(this,null,function*(){if(!a){uu$2.error(`Workout ID is required to update sets via HTTP API`);return}try{let i=o.slice(0,t).map((c,b)=>({id:c.id??null,repetitions:c.repetitions,weight:c.weight!==null&&c.weight!==void 0?Math.floor(c.weight*1e3):null,duration:typeof c.duration==`number`?c.duration:c.duration?$$2(c.duration):null,distance:c.distance?Math.floor(c.distance):null,rest:c.rest,done:c.done??!1,idx:b}));n?yield this.api.patch(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/exercises/{workout_exercise_id}`,{series:i},{pathParams:{athlete_id:n,workout_id:a,workout_exercise_id:e}}):yield this.api.patch(`/api/v3/me/workouts/{workout_id}/exercises/{workout_exercise_id}`,{series:i},{pathParams:{workout_id:a,workout_exercise_id:e}}),yield this.fetchTrainings(n)}
1catch(i){uu$2.error(`Failed to update set amount:`,i)}})}updateSetDone(e,t,n,o){return ps$4(this,null,function*(){if(!e||!n||!t){uu$2.error(`Exercise ID, Athlete ID, and done list are required to update set done status`);return}if(!o){uu$2.error(`Workout ID is required to update sets via HTTP API`);return}try{let c=(this.trainings().get(n)??[]).find(b=>b.id===o)?.exercises.find(b=>b.id===e);if(c?.series){let b=c.series.map((f,k)=>({id:f.id??null,repetitions:f.repetitions,weight:f.weight!==null&&f.weight!==void 0?Math.floor(f.weight*1e3):null,duration:typeof f.duration==`number`?f.duration:f.duration?parseInt(f.duration,10):null,distance:f.distance?Math.floor(f.distance):null,rest:f.rest,done:t[k]??f.done??!1,idx:f.idx}));n?yield this.api.patch(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/exercises/{workout_exercise_id}`,{series:b},{pathParams:{athlete_id:n,workout_id:o,workout_exercise_id:e}}):yield this.api.patch(`/api/v3/me/workouts/{workout_id}/exercises/{workout_exercise_id}`,{series:b},{pathParams:{workout_id:o,workout_exercise_id:e}})}yield this.fetchTrainings(n)}catch(a){uu$2.error(`Failed to update set done status:`,a)}})}groupExercises(e,t,n,o=!1){return ps$4(this,null,function*(){try{return yield this.api.post(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/exercises/group`,{workoutExerciseIds:n,updateAll:o},{pathParams:{athlete_id:e,workout_id:t}})}catch(a){let i=a;throw i?.status===422?(uu$2.warn(`[ExerciseGroup] outcome=non_adjacent status=422`,{athleteId:e,workoutId:t,workoutExerciseIds:n,detail:i.detail}),this.toast.show(i.detail||`Selected exercises must be next to each other to form a superset`,`error`),i):(uu$2.error(`Failed to group exercises:`,a),a)}})}detachFromGroup(e,t,n,o=!1){return ps$4(this,null,function*(){try{return yield this.api.patch(`/api/v3/athletes/{athlete_id}/workouts/{workout_id}/exercises/{workout_exercise_id}/detach-group`,{updateAll:o},{pathParams:{athlete_id:e,workout_id:t,workout_exercise_id:n}})}catch(a){throw uu$2.error(`Failed to detach exercise from group:`,a),a}})}fetchWorkoutPrograms(e){return ps$4(this,null,function*(){try{let n=(e?yield this.api.get(`/api/v3/athletes/{athlete_id}/programs`,{pathParams:{athlete_id:e}}):yield this.api.get(`/api/v3/me/programs`)).programs??[],o=new Map;if(e?o.set(e,n.map(a=>this.mapApiProgramToWorkoutProgram(a))):n.forEach(a=>{let i=this.mapApiProgramToWorkoutProgram(a),c=i.athlete_id;o.has(c)||o.set(c,[]),o.get(c).push(i)}),e){this.workoutPrograms.update(a=>{let i=new Map(a);return i.set(e,o.get(e)??[]),i});return}this.workoutPrograms.set(o)}catch(t){uu$2.error(`Failed to fetch workout programs:`,t)}})}addWorkoutProgram(e){return ps$4(this,null,function*(){if(!e.athlete_id||!e.coach_id){uu$2.error(`Athlete ID and Coach ID are required to add workout program`);return}this.workoutGenerationInProgress.set(!0);try{let t={athlete_id:e.athlete_id,title:e.title,weeks:e.weeks??6,start:e.start??new Date().toISOString().split(`T`)[0],comment:e.comment,use_only_favorites:e.use_only_favorites??!1,domain:e.domain};e.athlete_id?yield this.api.post(`/api/v3/athletes/{athlete_id}/programs`,t,{pathParams:{athlete_id:e.athlete_id}}):yield this.api.post(`/api/v3/me/programs`,t),yield this.fetchWorkoutPrograms(e.athlete_id),yield this.fetchTrainings(e.athlete_id)}catch(t){uu$2.error(`Failed to add workout program:`,t)}finally{this.workoutGenerationInProgress.set(!1)}})}createEmptyWorkoutProgram(e,t,n){return ps$4(this,null,function*(){if(!e)return uu$2.error(`Athlete ID is required to create an empty workout program`),null;try{let o=yield this.api.post(`/api/v3/athletes/{athlete_id}/programs/empty`,{start:t,weeks:n},{pathParams:{athlete_id:e}});return yield this.fetchWorkoutPrograms(e),yield this.fetchTrainings(e),this.mapApiProgramToWorkoutProgram(o)}catch(o){return uu$2.error(`Failed to create empty workout program:`,o),null}})}updateWorkoutProgram(e){return ps$4(this,null,function*(){if(!e.id||!e.athlete_id){uu$2.error(`Program ID and Athlete ID are required to update workout program`);return}try{let t={athlete_id:e.athlete_id,title:e.title,weeks:e.weeks??6,start:e.start??new Date().toISOString().split(`T`)[0],comment:e.comment,use_only_favorites:e.use_only_favorites??!1,domain:e.domain};e.athlete_id?yield this.api.put(`/api/v3/athletes/{athlete_id}/programs/{program_id}`,t,{pathParams:{athlete_id:e.athlete_id,program_id:e.id}}):yield this.api.put(`/api/v3/me/programs/{program_id}`,t,{pathParams:{program_id:e.id}}),yield this.fetchWorkoutPrograms(e.athlete_id)}catch(t){uu$2.error(`Failed to update workout program:`,t)}})}deleteWorkoutProgram(e,t){return ps$4(this,null,function*(){if(!e){uu$2.error(`Workout Program ID is required to delete a workout program`);return}try{t?yield this.api.delete(`/api/v3/athletes/{athlete_id}/programs/{program_id}`,{pathParams:{athlete_id:t,program_id:e}}):yield this.api.delete(`/api/v3/me/programs/{program_id}`,{pathParams:{program_id:e}}),this.monitoring.trackEvent(`workout_program_delete`,{outcome:`deleted`,status:`200`,programId:String(e),athleteId:String(t??``)}),uu$2.log(`[WorkoutProgramDelete] outcome=deleted status=200`,{workoutProgramId:e,athleteId:t}),yield this.fetchWorkoutPrograms(t),t&&(yield this.fetchTrainings(t)),this.toast.show(this.translate.instant(`trainingProgram.deleteCompletedWorkoutsInfo`),`info`)}catch(n){let o=n;this.monitoring.trackEvent(`workout_program_delete`,{outcome:`error`,status:String(o?.status??`unknown`),programId:String(e),athleteId:String(t??``)}),uu$2.error(`Failed to delete workout program:`,n)}})}deleteWorkoutProgramByScope(e,t){return ps$4(this,null,function*(){try{yield this.api.delete(`/api/v3/athletes/{athlete_id}/programs`,{pathParams:{athlete_id:t},queryParams:{scope:e}}
1),this.monitoring.trackEvent(`workout_program_delete`,{outcome:`deleted`,status:`200`,programId:e,athleteId:String(t)}),uu$2.log(`[WorkoutProgramDelete] outcome=deleted status=200 scope=`+e,{athleteId:t}),yield this.fetchWorkoutPrograms(t),yield this.fetchTrainings(t),this.toast.show(this.translate.instant(`trainingProgram.deleteCompletedWorkoutsInfo`),`info`)}catch(n){let o=n;this.monitoring.trackEvent(`workout_program_delete`,{outcome:`error`,status:String(o?.status??`unknown`),programId:e,athleteId:String(t)}),uu$2.error(`Failed to delete workout program by scope:`,n)}})}emptyWorkoutProgram(e,t){return ps$4(this,null,function*(){if(!e){uu$2.error(`Workout Program ID is required to empty a workout program`);return}try{t?yield this.api.post(`/api/v3/athletes/{athlete_id}/programs/{program_id}/empty`,void 0,{pathParams:{athlete_id:t,program_id:e}}):yield this.api.post(`/api/v3/me/programs/{program_id}/empty`,void 0,{pathParams:{program_id:e}}),yield this.fetchWorkoutPrograms(t),t&&(yield this.fetchTrainings(t))}catch(n){uu$2.error(`Failed to empty workout program:`,n)}})}extendWorkoutProgram(e,t,n,o){return ps$4(this,null,function*(){if(!e)return uu$2.error(`Program ID is required to extend a workout program`),null;if(!Tn$3(n,o))return null;let a={additionalWeeks:n,copyLastWeek:!1};try{let i=t?yield this.api.post(`/api/v3/athletes/{athlete_id}/programs/{program_id}/extend`,a,{pathParams:{athlete_id:t,program_id:e}}):yield this.api.post(`/api/v3/me/programs/{program_id}/extend`,a,{pathParams:{program_id:e}});return yield this.fetchWorkoutPrograms(t),yield this.fetchTrainings(t),i}catch(i){let c=i;return c?.status===400?this.toast.show(`trainingProgram.extend.maxWeeks`,`error`):c?.status===409?this.toast.show(`trainingProgram.extend.successorHasDoneWorkouts`,`error`):c?.status===404&&this.toast.show(`trainingProgram.notFound`,`error`),uu$2.error(`Failed to extend workout program:`,i),null}})}copyProgramWeek(e,t,n,o){return ps$4(this,null,function*(){if(!e)return uu$2.error(`Program ID is required to copy a program week`),null;if(!Nn$4(n.fromWeek,n.toWeek,o))return null;let a={fromWeek:n.fromWeek,toWeek:n.toWeek};try{let i=t?yield this.api.post(`/api/v3/athletes/{athlete_id}/programs/{program_id}/copy-week`,a,{pathParams:{athlete_id:t,program_id:e}}):yield this.api.post(`/api/v3/me/programs/{program_id}/copy-week`,a,{pathParams:{program_id:e}});return yield this.fetchTrainings(t),On$5(i.programs)&&this.toast.show(`trainingProgram.copyWeek.siblingEmpty`,`info`),i}catch(i){let c=i;return c?.status===400?this.toast.show(`trainingProgram.copyWeek.invalidRequest`,`error`):c?.status===404&&this.toast.show(`trainingProgram.notFound`,`error`),uu$2.error(`Failed to copy program week:`,i),null}})}getModalities(){return ps$4(this,null,function*(){try{return(yield this.api.get(`/api/v3/modalities`)).modalities??[]}catch(e){return uu$2.error(`[TrainingService] getModalities failed:`,e),[]}})}getClientTrainings(e){return $C(()=>this.trainings().get(e)??[])}getSingleData(e){return $C(()=>this.trainings().get(e))}getLatestTraining(e){return $C(()=>{let t=this.trainings().get(e)??[];return t.length>0?t[0]:null})}getTrainingByDate(e,t){return $C(()=>(this.trainings().get(e)??[]).find(a=>{let i=new Date(W$5(a.start));return i.getDate()===t.getDate()&&i.getMonth()===t.getMonth()&&i.getFullYear()===t.getFullYear()})??null)}getClientWorkoutPrograms(e){return $C(()=>this.workoutPrograms().get(e)??[])}getClientProgramReservedDays(e){let t=[];return this.workoutPrograms().get(e)?.forEach(n=>{let o=(0,ae$7.default)(new Date(W$5(n.start))),a=o.add(n.weeks,`week`),i=o;for(;(!a||i.isBefore(a))&&(t.push(i),i=i.add(1,`day`),!(!a||t.length>=365)););}),t}resetData(){this.trainings.set(new Map),this.workoutPrograms.set(new Map),this.trainingBankService.resetData(),uu$2.log(`Training data has been reset`)}getHeartRateZoneData(e,t=`3_months`,n=0,o=1){return $C(()=>{uu$2.log(`Fetching heart rate zone data for client ${e} with timeframe ${t}, period offset ${n}, and period count ${o}`);let a=1;switch(t){case`1_month`:a=.5;break;case`3_months`:a=1;break;case`6_months`:a=2;break;case`year`:a=4;break;case`3_years`:a=12;break}let i=[];for(let c=0;c<o;c++){let b=n-c,f=Math.max(.5,1+b*.2),k=[{zoneId:1,minutes:Math.floor((Math.random()*e+100)*a*f)},{zoneId:2,minutes:Math.floor((Math.random()*e+50)*a*f)},{zoneId:3,minutes:Math.floor((Math.random()*e+25)*a*f)},{zoneId:4,minutes:Math.floor((Math.random()*e+15)*a*f)},{zoneId:5,minutes:Math.floor(Math.random()*e*a*f)}],A=k.reduce((O,Y)=>O+Y.minutes,0);
1k.forEach(O=>{O.percentage=A>0?Math.floor(O.minutes/A*100):0}),i.push(k)}return i})}formatInputTrainingData(e,t){let n=t?this.clientDataService.userDatas().get(t):void 0;return e.map(o=>W$4(q$1({},o),{start:W$5(o.start),end:W$5(o.end),exercises:o.exercises.map(a=>W$4(q$1({},a),{translation:b$2(a,this.translate),series:a.series?.map(i=>W$4(q$1({},i),{weight:i.weight?i.weight/1e3:i.weight})),heartRateZoneInfo:a.heart_rate_zone&&n?this.getExerciseHRZoneInfo(a,n):void 0})).sort((a,i)=>(a.idx??0)-(i.idx??0))}))}getExerciseHRZoneInfo(e,t){let n=e.heart_rate_zone;if(!(!t?.resolvedHeartRateZones||!n))return t.resolvedHeartRateZones.find(o=>o.zone===n)}formatTrainingForCreate(e){return{athleteId:e.athlete_id,coachId:e.coach_id,category:e.category,nextWorkoutId:e.next_workout_id,draft:e.draft??!1,repetition:e.repetition,repetitionCount:e.repetition_count,info:e.info,feelingDuration:e.feeling_duration,feeling:e.feeling,start:e.start?P$1(e.start):void 0,end:e.end?P$1(e.end):void 0,workoutProgramId:e.workout_program_id,exercises:e.exercises?.map(t=>this.formatExerciseForCreate(t))??[]}}formatTrainingForUpdate(e){return{category:e.category,adapted:e.adapted,nextWorkoutId:e.next_workout_id,draft:e.draft,repetition:e.repetition,info:e.info,feelingDuration:e.feeling_duration,feeling:e.feeling,start:e.start?P$1(e.start):void 0,end:e.end?P$1(e.end):void 0,exercises:e.exercises?.map(t=>this.formatExerciseForCreate(t))}}formatExerciseForCreate(e){let n=X$3(e.target_rpe??G$3(e));return{exerciseId:e.exercise_id,category:e.category,subCategory:e.sub_category,modality:e.modality,feeling:e.feeling,idx:e.idx,rpe:n.rpe??e.rpe??void 0,rpeMin:n.rpeMin??e.rpe_min??void 0,rpeMax:n.rpeMax??e.rpe_max??void 0,heartRateZone:e.heart_rate_zone,coachNotes:e.coachNotes??null,groupIdx:e.group_idx??void 0,setRecovery:typeof e.set_recovery==`number`?e.set_recovery:e.set_recovery?$$2(e.set_recovery):void 0,series:e.series?.map(o=>({repetitions:o.repetitions,weight:o.weight!==null&&o.weight!==void 0?Math.floor(o.weight*1e3):null,duration:typeof o.duration==`number`?o.duration:o.duration?$$2(o.duration):null,distance:o.distance?Math.floor(o.distance):null,rest:o.rest,done:o.done??!1,idx:o.idx}))??[]}}mapApiWorkoutToTraining(e){return{id:e.id,athlete_id:e.athleteId??0,coach_id:e.coachId??0,category:e.category??`Strength Training`,start:e.start??``,end:e.end??``,done:e.done??!1,draft:e.draft??!1,adapted:e.adapted??!1,comment:e.comment??``,latest_comment:e.latestComment??null,info:e.info??``,feeling:e.feeling??0,feeling_duration:e.feelingDuration,repetition:e.repetition??``,workout_program_id:e.workoutProgramId??0,next_workout_id:e.nextWorkoutId??void 0,exercises:(e.exercises??[]).map(t=>this.mapApiExerciseToExercise(t)),modality:`Not Selected`,title:e.title??void 0,durationSeconds:e.durationSeconds??void 0}}mapApiExerciseToExercise(e){let t=e,n=(t.series??[]).map(a=>{let i=a;return{id:i.id,repetitions:i.repetitions,weight:i.weight,duration:i.duration,distance:i.distance,done:i.done,idx:i.idx??0,heart_rate_zone:I$5(i,`heart_rate_zone`),rest:i.rest}}),o=n.length>0?n:t.duration?[{repetitions:void 0,weight:null,duration:t.duration,distance:t.distance??null,done:void 0,idx:0,heart_rate_zone:I$5(t,`heart_rate_zone`)}]:[];return{id:t.id??0,name:t.name??``,info:t.info??``,exercise_id:I$5(t,`exercise_id`)??0,idx:t.idx??0,done:t.done??!1,modality:t.modality,category:t.category,sub_category:I$5(t,`sub_category`),heart_rate_zone:I$5(t,`heart_rate_zone`),set_recovery:I$5(t,`set_recovery`),rep_recovery:I$5(t,`rep_recovery`),feeling:t.feeling,mode:t.mode??void 0,intensity:t.intensity??void 0,rpe:t.rpe??null,rpe_min:I$5(t,`rpe_min`)??null,rpe_max:I$5(t,`rpe_max`)??null,target_rpe:G$3({rpe:t.rpe??null,rpeMin:I$5(t,`rpe_min`)??null,rpeMax:I$5(t,`rpe_max`)??null}),video:t.video??void 0,translation:t.translation??void 0,coachNotes:t.coachNotes??void 0,group_idx:I$5(t,`group_idx`)??null,series:o}}mapApiProgramToWorkoutProgram(e){return{id:e.id,athlete_id:e.athlete_id,coach_id:e.coach_id??0,start:W$5(e.start),weeks:e.weeks,title:e.title??void 0,comment:e.comment??void 0,domain:e.domain??void 0,ai_reasoning:e.ai_reasoning??e.aiReasoning??null}}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var Ot$6=`blokki-ai-chat-history`;var kr$3=100;var xr$4=1800;var Cr$4=900;var Fn$3={understanding:`agent.status.understanding`,generating_sql:`agent.status.generating_sql`,searching_knowledge:`agent.status.searching_knowledge`,querying:`agent.status.querying`,consulting_expert:`agent.status.consulting_expert`,composing:`agent.status.composing`};var lt$4=class r{http=E(yo$5);config=E(kR);localStorage=E(G$1);toast=E(ut$6);profileService=E(ie$4);aiQuota=E(f$2);get chatBase(){return this.profileService.isAdminOrManager()?`/api/v3/manager/chat`:`/api/v3/coach/chat`}messages=ni$3([]);conversationId=ni$3(null);isLoading=ni$3(!1);error=ni$3(null);streamingContent=ni$3(``);streamingMetadata=ni$3(null);streamingStatus=ni$3(null);abortController=null;constructor(){this.loadHistory()}sendMessage(e){return ps$4(this,null,function*(){if(!e.trim())return;this.abortController?.abort();let t={id:crypto.randomUUID(),role:`user`,content:e.trim(),timestamp:new Date};this.messages.update(n=>[...n,t]),this.isLoading.set(!0),this.error.set(null),this.streamingContent.set(``),this.streamingMetadata.set(null),this.streamingStatus.set(null);try{let n=this.conversationId(),o=q$1({messages:this.messages().map(a=>({role:a.role,content:a.content}))},n!=null?{conversationId:n}:{});yield this.streamChat(o)}catch(n){if(n instanceof Error&&n.name===`AbortError`)return;let o=n instanceof Error?n.message:`Failed to get response`;this.error.set(o),o!==`ai_quota_exhausted`&&this.toast.show(o,`error`)}finally{this.isLoading.set(!1),this.streamingContent.set(``),this.streamingStatus.set(null),this.abortController=null}})}sendChip(e,t,n,o){return ps$4(this,null,function*(){if(this.isLoading())return;this.abortController?.abort(),this.abortController=null;let a={id:crypto.randomUUID(),role:`user`,content:n,timestamp:new Date};this.messages.update(i=>[...i,a]),this.isLoading.set(!0),this.error.set(null),this.streamingContent.set(``),this.streamingMetadata.set(null),this.streamingStatus.set(null);try{let i=t.type===`group`?{groupId:t.id}:{athleteId:t.id};this.setStreamingStatus(`querying`);let c=yield this.runChipLoadingPhases(()=>this.postChip({chipId:e,scope:i}));this.finalizeStreamMessage(c.content)}catch(i){this.error.set(o),this.toast.show(o,`error`)}finally{this.isLoading.set(!1),this.streamingStatus.set(null)}})}postChip(e){return ps$4(this,null,function*(){let n=`${this.config.getConfig()().apiUrl}${this.chatBase}/chip`;return pm(this.http.post(n,e).pipe(Ms$4(o=>{let a=o.error?.detail||o.message||`Request failed`;return dm(()=>new Error(a))})))})}runChipLoadingPhases(e){return ps$4(this,null,function*(){let t=setTimeout(()=>this.setStreamingStatus(`composing`),Cr$4);
1try{let[n]=yield Promise.all([e(),this.delay(xr$4)]);return n}finally{clearTimeout(t)}})}setStreamingStatus(e){this.streamingStatus.set({phase:e,message:``,translationKey:Fn$3[e]??`agent.status.processing`})}delay(e){return new Promise(t=>setTimeout(t,e))}clearHistory(){this.abortController?.abort(),this.abortController=null,this.messages.set([]),this.conversationId.set(null),this.streamingContent.set(``),this.streamingMetadata.set(null),this.streamingStatus.set(null),this.isLoading.set(!1),this.localStorage.removeItem(Ot$6)}loadHistory(){let e=this.localStorage.getItem(Ot$6);if(e){if(Array.isArray(e)){this.messages.set(this.restoreMessages(e));return}this.messages.set(this.restoreMessages(e.messages)),this.conversationId.set(e.conversationId??null)}}saveHistory(){let e=this.messages().slice(-kr$3);this.localStorage.setItem(Ot$6,{conversationId:this.conversationId(),messages:e})}postChat(e){return ps$4(this,null,function*(){let n=`${this.config.getConfig()().apiUrl}${this.chatBase}/completions`;return pm(this.http.post(n,e).pipe(Ms$4(o=>{let a=o.error?.detail||o.message||`Request failed`;return dm(()=>new Error(a))})))})}streamChat(e){return ps$4(this,null,function*(){let n=`${this.config.getConfig()().apiUrl}${this.chatBase}/stream`,o=document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]*)/),a=o?decodeURIComponent(o[1]):``;this.abortController=new AbortController;let i=yield fetch(n,{method:`POST`,headers:q$1({"Content-Type":`application/json`,Accept:`text/event-stream`},a?{"X-XSRF-TOKEN":a}:{}),credentials:`include`,body:JSON.stringify(e),signal:this.abortController.signal});if(!i.ok){let O=yield i.text(),Y=`HTTP ${i.status}: ${O}`;try{let re=JSON.parse(O);if(R$3(re)===`ai_quota_exhausted`)throw this.aiQuota.markExhausted(),new Error(g$1);let ie=re,K=ie.detail??ie.message,wt=typeof K==`object`&&K!==null&&`message`in K&&typeof K.message==`string`?K.message:null;Y=typeof K==`string`?K:wt??Y}catch(re){if(re instanceof Error&&re.message===`ai_quota_exhausted`)throw re}throw new Error(Y)}let c=i.body?.getReader();if(!c)throw new Error(`No response body`);let b=new TextDecoder,f=``,k=``,A;try{for(;;){let{done:O,value:Y}=yield c.read();if(O)break;f+=b.decode(Y,{stream:!0});let re=this.parseSSEBuffer(f);f=re.remaining;for(let ie of re.parsed)switch(ie.type){case`metadata`:A=ie.data,this.streamingMetadata.set(A);break;case`token`:k+=ie.data.content,this.streamingContent.set(k);break;case`status`:{let K=ie.data,wt=Fn$3[K.phase]??`agent.status.processing`;this.streamingStatus.set({phase:K.phase,message:K.message?.trim()||``,translationKey:wt});break}case`done`:this.finalizeStreamMessage(k,A),k=``;break;case`error`:uu$2.warn(`SSE error event:`,ie.data);break}}k&&this.finalizeStreamMessage(k,A)}finally{c.releaseLock()}})}finalizeStreamMessage(e,t){if(!e)return;this.conversationId.set(t?.conversation_id??this.conversationId());let n={id:crypto.randomUUID(),role:`assistant`,content:e,timestamp:new Date,metadata:t};this.messages.update(o=>[...o,n]),this.saveHistory()}restoreMessages(e){return e.map(t=>W$4(q$1({},t),{timestamp:new Date(t.timestamp)}))}parseSSEBuffer(e){let t=[],n=e.split(` 2`),o=``,a=``,i=0,c=0;for(let f of n)if(c+=f.length+1,!f.startsWith(`:`)){if(f.startsWith(`event:`)){if(o&&a)try{t.push({type:o,data:JSON.parse(a)}),i=c}catch(k){uu$2.warn(`[AiChat] parseSSEBuffer: failed to JSON.parse "${o}" event data`,k,a)}o=f.slice(6).trim(),a=``}else if(f.startsWith(`data:`))a=f.slice(5).trim();else if(f.trim()===``&&o&&a){try{t.push({type:o,data:JSON.parse(a)}),i=c}catch(k){uu$2.warn(`[AiChat] parseSSEBuffer: failed to JSON.parse "${o}" event data`,k,a)}o=``,a=``}}if(o&&a)try{return t.push({type:o,data:JSON.parse(a)}),{parsed:t,remaining:``}}catch(f){}return{parsed:t,remaining:o||a?e.slice(i):``}}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var Oe$3=10;var ct$8=class r$1{api=E(E$1);loading=ni$3(!1);loadingMore=ni$3(!1);feedItems=ni$3(new Map,{equal:()=>!1});hasMoreMap=ni$3(new Map,{equal:()=>!1});getFeedItems(e){return $C(()=>this.feedItems().get(e)??[])}getHasMore(e){return $C(()=>this.hasMoreMap().get(e)??!1)}appendFeedItem(e,t){this.feedItems.update(n=>{let o=n.get(e)??[];return new Map(n).set(e,[...o,t])})}resetData(){this.feedItems.set(new Map),this.hasMoreMap.set(new Map),this.loading.set(!1),this.loadingMore.set(!1)}fetchFeed(e){return ps$4(this,null,function*(){this.loading.set(!0);try{let t=yield this.api.get(`/api/v3/athletes/{athlete_id}/feed`,{pathParams:{athlete_id:e},queryParams:{limit:Oe$3}}),n=t.map(o=>W$4(q$1({},o),{datetime:r(o.datetime)}));this.feedItems.update(o=>new Map(o).set(e,n)),this.hasMoreMap.update(o=>new Map(o).set(e,t.length>=Oe$3))}catch(t){uu$2.error(`Failed to fetch feed:`,t)}finally{this.loading.set(!1)}})}fetchMoreFeed(e){return ps$4(this,null,function*(){let t=this.feedItems().get(e)??[];if(t.length===0)return;let n=t.reduce((o,a)=>a.datetime<o?a.datetime:o,t[0].datetime);this.loadingMore.set(!0);try{let o=yield this.api.get(`/api/v3/athletes/{athlete_id}/feed`,{pathParams:{athlete_id:e},queryParams:{limit:Oe$3,before_datetime:n}}),a=o.map(i=>W$4(q$1({},i),{datetime:r(i.datetime)}));this.feedItems.update(i=>new Map(i).set(e,[...a,...t])),this.hasMoreMap.update(i=>new Map(i).set(e,o.length>=Oe$3))}catch(o){uu$2.error(`Failed to fetch more feed items:`,o)}finally{this.loadingMore.set(!1)}})}fetchNewFeed(e,t){return ps$4(this,null,function*(){let n=this.feedItems().get(e)??[];if(n.length!==0)try{let o=yield this.api.get(`/api/v3/athletes/{athlete_id}/feed`,{pathParams:{athlete_id:e},queryParams:{limit:Oe$3,after_datetime:t}});if(o.length===0)return;let a=o.map(i=>W$4(q$1({},i),{datetime:r(i.datetime)}));this.feedItems.update(i=>new Map(i).set(e,[...a,...n]))}catch(o){uu$2.error(`Failed to fetch new feed items:`,o)}})}static ɵfac=function(t){return new(t||r$1)};static ɵprov=ue$3({token:r$1,factory:r$1.ɵfac,providedIn:`root`})};var dt$8=class r{goals=ni$3(new Map,{equal:()=>!1});constructor(){}getClientGoals(e){return $C(()=>this.goals().get(e)??[])}getSingleGoal(e){return $C(()=>this.goals().get(e))}getLatestGoal(e){return $C(()=>{let t=this.goals().get(e)??[];return t.length>0?t[0]:null})}addGoal(e,t){this.goals.update(n=>{let o=n.get(e)||[];return o.push(t),n.set(e,o),n})}resetData(){this.goals.set(new Map),uu$2.log(`Goals data has been reset`)}updateClientGoal(e,t){this.goals.update(n=>{let o=n.get(e)||[],a=o.findIndex(i=>i.id===t.id);return a!==-1&&(o[a]=t),n.set(e,o),n})}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var pt$6=class r{notes=ni$3(new Map,{equal:()=>!1});constructor(){}getClientNotes(e){return $C(()=>this.notes().get(e)??[])}getSingleNote(e){return $C(()=>this.notes().get(e))}getLatestNote(e){return $C(()=>{let t=this.notes().get(e)??[];return t.length>0?t[0]:null})}addNote(e,t){this.notes.update(n=>{let o=n.get(e)||[];return o.push(t),n.set(e,o),n})}resetData(){this.notes.set(new Map),uu$2.log(`Notes data has been reset`)}updateClientNote(e,t){this.notes.update(n=>{let o=n.get(e)||[],a=o.findIndex(i=>i.id===t.id);return a!==-1&&(o[a]=t),n.set(e,o),n})}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var wr$4=2e4;var ut$5=class r{api=E(E$1);locked=ni$3(!1);code=ni$3(null);pollHandle=null;constructor(){xd$2(()=>{this.locked()?this.startPolling():this.stopPolling()})}
2lock(e){this.code.set(e??null),this.locked.set(!0)}unlock(){this.stopPolling(),this.code.set(null),this.locked.set(!1)}startPolling(){this.pollHandle||(this.pollHandle=setInterval(()=>{this.checkAccessStatus()},wr$4),this.checkAccessStatus())}stopPolling(){this.pollHandle&&(clearInterval(this.pollHandle),this.pollHandle=null)}checkAccessStatus(){return ps$4(this,null,function*(){try{let e=yield this.api.get(`/api/v3/me/access-status`);e.locked_out?this.code.set(e.code??null):this.unlock()}catch(e){}})}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};function Ne$3(r){return!!r?.athleteId&&!!r.programId}function Bn$4(r){return r.type===`clarification`}function jn$3(r){return r.type===`planProposal`}function Ln$4(r){return r.type===`unsupported`}function Hn$3(r){return r.type===`changeHistory`}function Un$3(r){return r.type===`swapReview`}function qn$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return(e.bodyRegion==null||typeof e.bodyRegion==`string`)&&(e.movementPattern==null||typeof e.movementPattern==`string`)}function Vn$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.startDate==`string`&&typeof e.endDate==`string`&&(e.requestedStartDate==null||typeof e.requestedStartDate==`string`)}function Sr$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return e.kind===`relative_percent`&&typeof e.percentDelta==`number`||e.kind===`absolute_delta`&&typeof e.valueDelta==`number`}function Mr$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.fieldName==`string`&&typeof e.adjustmentKind==`string`&&typeof e.description==`string`}function $n$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.reasonCode==`string`&&typeof e.count==`number`&&Array.isArray(e.examples)&&e.examples.every(t=>typeof t==`string`)}function Er$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r,t=e.locator;
2return typeof e.operationId==`string`&&(e.label==null||typeof e.label==`string`)&&(e.before==null||typeof e.before==`string`||typeof e.before==`number`)&&(e.after==null||typeof e.after==`string`||typeof e.after==`number`)&&(e.setNumber==null||typeof e.setNumber==`number`)&&(t==null||typeof t==`object`&&t!==null&&!Array.isArray(t)&&(t.workoutId==null||typeof t.workoutId==`number`)&&(t.workoutExerciseId==null||typeof t.workoutExerciseId==`number`)&&(t.idx==null||typeof t.idx==`number`))}function Dr$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.workoutExerciseId==`number`&&typeof e.label==`string`&&Array.isArray(e.operations)&&e.operations.every(Er$4)}function Rr$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.workoutId==`number`&&typeof e.startDate==`string`&&typeof e.label==`string`&&Array.isArray(e.exercises)&&e.exercises.every(Dr$4)}function Gn$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.weekStart==`string`&&typeof e.weekEnd==`string`&&Array.isArray(e.workouts)&&e.workouts.every(Rr$4)}function Ir$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return e.capabilityKey===`batch_exercise_changes`?Yn$4(e):(e.capabilityKey===`batch_set_scaling`||e.capabilityKey===`exercise_prescription_edits`)&&(e.operation==null||e.operation===`adjust`)&&typeof e.fieldName==`string`&&qn$3(e.selector)&&Vn$3(e.dateRange)&&typeof e.includePlaceholders==`boolean`&&Sr$4(e.adjustment)&&Mr$4(e.roundingRule)&&typeof e.exclusionCount==`number`&&Array.isArray(e.exclusions)&&e.exclusions.every($n$3)&&Array.isArray(e.groupedByWeek)&&e.groupedByWeek.every(Gn$3)}function Tr$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;
2return typeof e.operationId==`string`&&typeof e.workoutExerciseId==`number`&&typeof e.label==`string`&&Array.isArray(e.matchedAttributes)&&e.matchedAttributes.every(t=>typeof t==`string`)}function Or$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.workoutExerciseId==`number`&&typeof e.label==`string`&&typeof e.reasonCode==`string`}function Nr$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.workoutId==`number`&&typeof e.startDate==`string`&&Array.isArray(e.remove)&&e.remove.every(Tr$4)&&Array.isArray(e.keep)&&e.keep.every(Or$3)}function Ar$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.removeCount==`number`&&typeof e.keepCount==`number`&&Array.isArray(e.workouts)&&e.workouts.every(Nr$4)}function Yn$4(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r,t=e.narrowed;return e.capabilityKey===`batch_exercise_changes`&&e.operation===`remove`&&e.fieldName===null&&qn$3(e.selector)&&Vn$3(e.dateRange)&&e.adjustment===null&&e.roundingRule===null&&Array.isArray(e.exclusions)&&e.exclusions.every($n$3)&&Array.isArray(e.groupedByWeek)&&e.groupedByWeek.every(Gn$3)&&Ar$4(e.membership)&&(t==null||typeof t==`object`&&!Array.isArray(t)&&typeof t.fromProposalId==`number`&&typeof t.deselectedCount==`number`)}function Fr$3(r){if(typeof r.preview!=`object`||r.preview===null||Array.isArray(r.preview))return null;let e=r.preview.batch;return Ir$4(e)?e:null}function gi$3(r){let e=Fr$3(r);return e&&Yn$4(e)?e:null}function hi$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.field==`string`&&typeof e.label==`string`&&typeof e.workout==`string`&&(`before`in e||`after`in e)&&(e.before==null||typeof e.before==`string`||typeof e.before==`number`)&&(e.after==null||typeof e.after==`string`||typeof e.after==`number`)}var Wr$4=new Set([`rpe`,`setRecovery`,`set_recovery`,`heartRateZone`,`heart_rate_zone`]);function fi$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r,t=e.field;return typeof t==`string`&&Wr$4.has(t)&&typeof e.label==`string`&&typeof e.workout==`string`&&(`before`in e||`after`in e)&&(e.before==null||typeof e.before==`string`||typeof e.before==`number`)&&(e.after==null||typeof e.after==`string`||typeof e.after==`number`)}function bi$2(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.label==`string`&&e.before==null&&typeof e.after==`string`&&typeof e.catalogExerciseId==`number`}function yi$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.label==`string`&&typeof e.workout==`string`&&typeof e.before==`string`&&e.after==null}function vi$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r,t=e.compatibility;return typeof e.label==`string`&&typeof e.workout==`string`&&typeof e.before==`string`&&typeof e.after==`string`&&typeof e.catalogExerciseId==`number`&&(e.structureKind===`set`||e.structureKind===`interval`)&&typeof t==`object`&&t!==null&&!Array.isArray(t)&&typeof t.category==`string`&&(t.mode==null||typeof t.mode==`string`)}function Wn$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.workoutExerciseId==`number`&&typeof e.position==`number`&&(e.label==null||typeof e.label==`string`)}function _i$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r,t=e.locator;return e.field===`idx`&&typeof e.label==`string`&&typeof e.workout==`string`&&Array.isArray(e.before)&&e.before.every(Wn$3)&&Array.isArray(e.after)&&e.after.every(Wn$3)&&typeof e.beforePosition==`number`&&typeof e.afterPosition==`number`&&typeof t==`object`&&t!==null&&!Array.isArray(t)&&typeof t.workoutId==`number`&&typeof t.workoutExerciseId==`number`}var zr$2=new Set([`intervalCount`,`setRecovery`,`heartRateZone`,`duration`,`distance`]);function zn$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r;return typeof e.interval==`number`&&(e.duration==null||typeof e.duration==`string`)&&(e.distance==null||typeof e.distance==`string`)&&(e.recovery==null||typeof e.recovery==`string`)&&(e.heartRateZone==null||typeof e.heartRateZone==`number`)}function Pi$3(r){if(typeof r!=`object`||r===null||Array.isArray(r))return!1;let e=r,t=e.field,n=e.locator;return typeof t!=`string`||!zr$2.has(t)||!(typeof e.label==`string`&&typeof e.workout==`string`&&typeof e.structureKind==`string`&&Array.isArray(e.before)&&e.before.every(zn$3)&&Array.isArray(e.after)&&e.after.every(zn$3)&&typeof n==`object`&&n!==null&&!Array.isArray(n)&&typeof n.workoutId==`number`&&typeof n.workoutExerciseId==`number`&&(n.idx==null||typeof n.idx==`number`))?!1:t===`intervalCount`?typeof e.beforeCount==`number`&&typeof e.afterCount==`number`:(`beforeValue`in e||`afterValue`in e)&&(e.beforeValue==null||typeof e.beforeValue==`string`||typeof e.beforeValue==`number`)&&(e.afterValue==null||typeof e.afterValue==`string`||typeof e.afterValue==`number`)}var mt$7=class r{api=E(E$1);profileService=E(ie$4);get base(){return this.profileService.isAdminOrManager()?`/api/v3/manager/
2plan-editor`:`/api/v3/coach/plan-editor`}createCompletion(e){return ps$4(this,null,function*(){return this.api.post(`${this.base}/completions`,e)})}confirmProposal(e){return ps$4(this,null,function*(){return this.api.post(`${this.base}/proposals/{proposal_id}/confirm`,void 0,{pathParams:{proposal_id:e}})})}rejectProposal(e){return ps$4(this,null,function*(){return this.api.post(`${this.base}/proposals/{proposal_id}/reject`,void 0,{pathParams:{proposal_id:e}})})}narrowProposal(e,t){return ps$4(this,null,function*(){return this.api.post(`${this.base}/proposals/{proposal_id}/narrow`,t,{pathParams:{proposal_id:e}})})}selectSwapReplacements(e){return ps$4(this,null,function*(){return this.api.post(`${this.base}/swap/select`,e)})}undoLatestAction(e,t){return ps$4(this,null,function*(){return this.api.post(`${this.base}/undo-latest`,{athleteId:e,programId:t})})}getHistory(e,t,n=10){return ps$4(this,null,function*(){return(yield this.api.get(`${this.base}/history`,{queryParams:{athleteId:e,programId:t,limit:n}})).actions??[]})}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var gt$6=class r{planEditorService=E(mt$7);profileService=E(ie$4);trainingService=E(Se$3);aiQuota=E(f$2);isOpen=ni$3(!1);context=ni$3(null);messages=ni$3([]);conversationId=ni$3(null);clarification=ni$3(null);changeHistory=ni$3(null);proposal=ni$3(null);swapReview=ni$3(null);proposalLifecycle=ni$3(null);unsupported=ni$3(null);history=ni$3([]);isSending=ni$3(!1);isLoadingHistory=ni$3(!1);isApplyingProposal=ni$3(!1);isNarrowingProposal=ni$3(!1);isSelectingSwap=ni$3(!1);isUndoing=ni$3(!1);error=ni$3(null);hasStableContext=$C(()=>Ne$3(this.context()));latestUndoableAction=$C(()=>this.history().find(e=>e.canUndo)??null);isProposalExpired=$C(()=>{let e=this.proposal()?.expiresAt;return e?new Date(e).getTime()<=Date.now():!1});openWorkspace(e){if(e){let t=this.normalizeContext(e,this.context());!this.sameContext(this.context(),t)?(this.resetConversationState(),this.context.set(t),this.refreshHistory()):this.context()||this.context.set(t)}this.error.set(null),this.isOpen.set(!0)}closeWorkspace(){this.isOpen.set(!1)}resetData(){this.closeWorkspace(),this.context.set(null),this.history.set([]),this.resetConversationState()}clearConversation(){this.resetConversationState(),this.refreshHistory()}sendMessage(e){return ps$4(this,null,function*(){yield this.sendCompletion(e)})}sendCompletion(e){return ps$4(this,null,function*(){let t=e.trim();if(!t||this.isSending()||this.isSelectingSwap()||this.aiQuota.exhausted())return;let n=this.context();this.messages.update(o=>[...o,this.createUiMessage(`user`,t)]),this.isSending.set(!0),this.error.set(null),this.clarification.set(null),this.changeHistory.set(null),this.proposal.set(null),this.swapReview.set(null),this.proposalLifecycle.set(null),this.unsupported.set(null);try{let o={messages:[{role:`user`,content:t}],conversationId:this.conversationId(),athleteId:n?.athleteId??null,programId:n?.programId??null,actingCoachId:n?.actingCoachId??null,surfaceHint:`auto`},a=yield this.planEditorService.createCompletion(o);this.applyCompletionResponse(a)}catch(o){this.handleActionError(`sendMessage`,o)}finally{this.isSending.set(!1)}})}chooseClarificationOption(e){return ps$4(this,null,function*(){let t=this.extractContextFromOption(e);t&&(this.mergeContext(t),this.refreshHistory()),yield this.sendCompletion(e.label)})}confirmProposal(){return ps$4(this,null,function*(){let e=this.proposal();if(!(!e||this.isApplyingProposal())){this.isApplyingProposal.set(!0),this.error.set(null);try{let t=yield this.planEditorService.confirmProposal(e.id);this.messages.update(n=>[...n,this.createUiMessage(`assistant`,t.message)]),this.proposalLifecycle.set({status:t.status===`confirmed`?`confirmed`:`stale`,message:t.message,proposalId:e.id}),this.proposal.set(null),this.mergeContext({athleteId:e.athleteId,programId:e.workoutProgramId}),(t.status===`confirmed`||t.status===`already_confirmed`)&&(yield this.refreshTrainingData(e.athleteId)),yield this.refreshHistory()}catch(t){let n=this.getErrorMessage(t);this.proposalLifecycle.set({status:`failed`,message:n,proposalId:e.id}),this.handleActionError(`confirmProposal`,t)}finally{this.isApplyingProposal.set(!1)}}})}rejectProposal(){return ps$4(this,null,function*(){let e=this.proposal();if(!(!e||this.isApplyingProposal())){this.isApplyingProposal.set(!0),this.error.set(null);try{let t=yield this.planEditorService.rejectProposal(e.id);this.messages.update(n=>[...n,this.createUiMessage(`assistant`,t.message)]),this.proposalLifecycle.set({status:t.status===`rejected`?`rejected`:`stale`,message:t.message,proposalId:e.id}),this.proposal.set(null),this.mergeContext({athleteId:e.athleteId,programId:e.workoutProgramId}),yield this.refreshHistory()}catch(t){let n=this.getErrorMessage(t);this.proposalLifecycle.set({status:`failed`,message:n,proposalId:e.id}),this.handleActionError(`rejectProposal`,t)}finally{this.isApplyingProposal.set(!1)}}})}narrowProposal(e){return ps$4(this,null,function*(){let t=this.proposal();if(!(!t||e.length===0||this.isNarrowingProposal()||this.aiQuota.exhausted())){this.isNarrowingProposal.set(!0),this.error.set(null);try{let n=yield this.planEditorService.narrowProposal(t.id,{keptOperationIds:e});this.applyCompletionResponse(n)}catch(n){this.handleActionError(`narrowProposal`,n)}finally{this.isNarrowingProposal.set(!1)}}})}selectSwapReplacements(e){return ps$4(this,null,function*(){let t=this.swapReview(),n=this.context();if(!t||!Ne$3(n)||this.isSelectingSwap()||this.aiQuota.exhausted())return;let o=t.targets??[];if(e.length===o.length&&o.every(i=>{let c=e.find(b=>b.workoutExerciseId===i.workoutExerciseId);return c!=null&&(i.candidates??[]).some(b=>b.exerciseId===c.replacementExerciseId)})){this.isSelectingSwap.set(!0),this.error.set(null);try{let i=yield this.planEditorService.selectSwapReplacements({athleteId:n.athleteId,programId:n.programId,actingCoachId:n.actingCoachId,conversationId:this.conversationId(),avoidLoadAttributes:t.avoidLoadAttributes??[],selections:e});if(this.swapReview()!==t||!this.sameContext(this.context(),n))return;this.swapReview.set(null),this.applyCompletionResponse(i)}catch(i){this.swapReview()===t&&this.sameContext(this.context(),n)&&this.handleActionError(`selectSwapReplacements`,i)}finally{this.isSelectingSwap.set(!1)}}})}discardSwapReview(){this.swapReview.set(null)}undoLatestAction(){return ps$4(this,null,function*(){let e=this.context();if(!(!Ne$3(e)||this.isUndoing())){this.isUndoing.set(!0),this.error.set(null);try{let t=yield this.planEditorService.undoLatestAction(e.athleteId,e.programId);this.messages.update(n=>[...n,this.createUiMessage(`assistant`,t.message)]),t.status===`undone`&&(yield this.refreshTrainingData(e.athleteId)),yield this.refreshHistory()}catch(t){this.handleActionError(`undoLatestAction`,t)}finally{this.isUndoing.set(!1)}}})}refreshHistory(){return ps$4(this,null,function*(){let e=this.context();if(!Ne$3(e)){this.history.set([]);return}this.isLoadingHistory.set(!0);try{let t=yield this.planEditorService.getHistory(e.athleteId,e.programId);this.history.set(t)}catch(t){this.handleActionError(`refreshHistory`,t),this.history.set([])}finally{this.isLoadingHistory.set(!1)}})}normalizeContext(e,t){let n=t??{source:`top-navigation`,athleteId:null,athleteName:null,programId:null,programName:null,actingCoachId:this.getDefaultActingCoachId()};return{source:e.source??`top-navigation`,athleteId:this.resolveContextField(e,`athleteId`,n.athleteId),athleteName:this.resolveContextField(e,`athleteName`,n.athleteName),programId:this.resolveContextField(e,`programId`,n.programId),programName:this.resolveContextField(e,`programName`,n.programName),actingCoachId:this.resolveContextField(e,`actingCoachId`,n.actingCoachId)}}getDefaultActingCoachId(){return this.profileService.isAdminOrManager()?null:this.profileService.getProfileId()??null}sameContext(e,t){return!e&&!t?!0:!e||!t?!1:e.athleteId===t.athleteId&&e.programId===t.programId&&e.actingCoachId===t.actingCoachId}resolveContextField(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)?e[t]??null:n}mergeContext(e){let t=this.context()??this.normalizeContext({source:`top-navigation`},null);this.context.set(q$1(q$1({},t),e))}resetConversationState(){this.messages.set([]),this.conversationId.set(null),this.clarification.set(null),this.changeHistory.set(null),this.proposal.set(null),this.swapReview.set(null),this.proposalLifecycle.set(null),this.unsupported.set(null),this.error.set(null)}applyCompletionResponse(e){if(this.conversationId.set(e.metadata.conversationId??this.conversationId()),this.messages.update(t=>[...t,this.createUiMessage(`assistant`,e.message.content)]),Bn$4(e)){this.clarification.set(e.clarification);return}if(jn$3(e)){this.proposal.set(e.planProposal),this.proposalLifecycle.set(this.getLifecycleFromProposal(e.planProposal,e.message.content)),this.mergeContext({athleteId:e.planProposal.athleteId,programId:e.planProposal.w
2orkoutProgramId});return}if(Hn$3(e)){this.changeHistory.set(e.changeHistory);return}if(Un$3(e)){this.swapReview.set(e.swapReview);return}Ln$4(e)&&this.unsupported.set(e.unsupported)}getLifecycleFromProposal(e,t){switch(e.status){case`confirmed`:return{status:`confirmed`,message:t,proposalId:e.id};case`rejected`:return{status:`rejected`,message:t,proposalId:e.id};case`expired`:return{status:`expired`,message:t,proposalId:e.id};default:return null}}createUiMessage(e,t){return{id:crypto.randomUUID(),role:e,content:t,timestamp:new Date}}extractContextFromOption(e){let t=e.metadata;if(!t)return null;let n=this.readMetadataNumber(t,[`athleteId`,`athlete_id`]),o=this.readMetadataNumber(t,[`programId`,`program_id`,`workoutProgramId`,`workout_program_id`]);return n==null&&o==null?null:{athleteId:n,athleteName:n!=null?e.label:void 0,programId:o,programName:o!=null?e.label:void 0}}readMetadataNumber(e,t){for(let n of t){let o=e[n];if(typeof o==`number`)return o}return null}refreshTrainingData(e){return ps$4(this,null,function*(){yield Promise.all([this.trainingService.fetchTrainings(e),this.trainingService.fetchWorkoutPrograms(e)])})}handleActionError(e,t){let n=this.getErrorMessage(t);this.error.set(n),uu$2.error(`[PlanEditorStateService] ${e} failed`,t)}getErrorMessage(e){return this.isApiError(e)?e.detail??e.message:e instanceof Error?e.message:`Request failed`}isApiError(e){if(typeof e!=`object`||e===null)return!1;let t=e;return typeof t.status==`number`&&typeof t.message==`string`}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var he$3=mT(ce$5());var ft$8=class r{http=E(yo$5);configService=E(kR);translate=E(Gr$5);loginService=E(ne$3);apiUrl=this.configService.config()?.apiUrl||``;statistics=ni$3(new Map,{equal:()=>!1});getSingleData(e,t){return $C(()=>this.statistics().get(e)?.get(t))}resetData(){this.statistics.set(new Map),uu$2.log(`Statistics data has been reset`)}fetchStatistics(e,t,n,o){this.fetchStatisticsSeries$(e,t,n,o).subscribe({next:a=>{let i={name:t,data:a};this.processResponse(i,e,t,n,o?.interval)},error:a=>uu$2.error(`Failed to fetch statistics:`,a)})}fetchStatisticsSeries$(e,t,n,o){let a=new pe$4().set(`name`,t).set(`range`,n);o?.start&&(a=a.set(`start`,o.start)),o?.offset!==void 0&&(a=a.set(`offset`,o.offset.toString())),o?.interval&&(a=a.set(`interval`,o.interval));let c=e===parseInt(this.loginService.userId(),10)?`/me`:`/athletes/${e}`;return this.http.get(`${this.apiUrl}/api/v3${c}/statistics`,{params:a}).pipe(Ae$3(b=>Array.isArray(b.data)?b.data:[]))}processResponse(e,t,n,o,a){let i=Br$3(e,t),c={chartOptions:Lr$4(n,o,a),label:n,data:jr$3(n,i,this.translate)},b=i.athlete_id;this.statistics.update(f=>{let k=new Map(f.get(b)||[]);return k.set(n,c),new Map(f).set(b,k)})}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};function Br$3(r,e){return{athlete_id:e,statistics:Array.isArray(r.data)?r.data:[]}}function jr$3(r,e,t){let n=`${J$4(`--logo-color`,`#d6ebfd`)}`,o=`${J$4(`--logo-color`,`#d6ebfd`)}`,a=(e.statistics??[]).filter(i=>i.value!==null||i.bar_value!==null);switch(r){case`workouts_done`:return{labels:a.map(i=>ht$7(i.timestamp_string||i.date_string)).sort((i,c)=>i-c),datasets:[{label:t.instant(`statistics.workouts_done`)+` (%)`,data:a.map(i=>Number((i.bar_value??0).toFixed(1))),backgroundColor:n,borderColor:o,borderWidth:1,type:`bar`},{label:t.instant(`statistics.workouts_done_count`),yAxisID:`y1`,data:a.map(i=>i.value),type:`line`,borderColor:J$4(`--quaternaryBlack`,`#2B2B2B`),backgroundColor:`transparent`,borderWidth:2,pointBorderWidth:0,pointRadius:3,pointBackgroun
2dColor:J$4(`--quaternaryBlack`,`#2B2B2B`)}]};case`total_volume`:return{labels:a.map(i=>ht$7(i.timestamp_string||i.date_string)).sort((i,c)=>i-c),datasets:[{label:t.instant(`statistics.repetitions_pcs`),data:a.map(i=>i.value),backgroundColor:n,borderColor:o,borderWidth:3,pointBorderWidth:0,pointRadius:3,type:`line`},{label:t.instant(`statistics.total_volume`),yAxisID:`y1`,data:a.map(i=>i.bar_value),backgroundColor:n,type:`bar`}]};case`cooper_test`:return{labels:a.map(i=>ht$7(i.timestamp_string||i.date_string)).sort((i,c)=>i-c),datasets:[{label:t.instant(`statistics.cooper_test`),data:a.map(i=>i.value),backgroundColor:n,borderColor:o,borderWidth:3,pointBorderWidth:0,pointRadius:3,type:`line`}]};case`readiness_to_train`:return{labels:a.map(i=>ht$7(i.timestamp_string||i.date_string)).sort((i,c)=>i-c),datasets:[{label:t.instant(`statistics.readiness_to_train`),data:a.map(i=>Math.round(i.value??0)),backgroundColor:n,type:`line`,borderWidth:3,pointBorderWidth:0,pointRadius:3,borderColor:i=>{let c=i.chart.ctx.createLinearGradient(0,0,0,i.chart.height);return c.addColorStop(0,J$4(`--primaryGreen`,`#98D5B0`)+`80`),c.addColorStop(.333,J$4(`--primaryYellow`,`#F3E38A`)+`80`),c.addColorStop(.667,J$4(`--primaryRed`,`#E34D3A`)+`80`),c}
2,pointBackgroundColor:a.map(i=>{let c=i.value??0;return c>=66.7?J$4(`--primaryGreen`,`#98D5B0`):c>=33.4?J$4(`--primaryYellow`,`#F3E38A`):J$4(`--primaryRed`,`#E34D3A`)})}]}}}function ht$7(r){let e=(0,he$3.default)(r);if(e.isValid())return e.valueOf();let t=[`YYYY`,`YYYY-MM-DD`,`YYYY/MM`,`YYYY-MM`];if(r.includes(`-`)){let n=r.split(`-`);if(n.length===2){if(r.includes(`W`)){let o=parseInt(n[0],10),a=parseInt(n[1].replace(`W`,``),10);return(0,he$3.default)().year(o).week(a).startOf(`week`).valueOf()}return(0,he$3.default)(r,t[3]).valueOf()}else if(n.length===3)return(0,he$3.default)(r,t[1]).valueOf()}else if(r.includes(`/`)){let n=r.split(`/`);if(n.length===2){let o=parseInt(n[0],10),a=parseInt(n[1],10);return(0,he$3.default)().year(o).week(a).startOf(`week`).valueOf()}}else if(r.length===4)return(0,he$3.default)(r,t[0]).valueOf();return uu$2.error(`Invalid date format: ${r}`),0}function Lr$4(r,e,t){let n={time_unit:`month`,show_y1:!1,tooltipFormat:``,ymax:void 0};switch(r){case`readiness_to_train`:e===`3_months`&&(n.time_unit=`week`),n.ymax=100;break;case`total_volume`:e===`3_months`&&(n.time_unit=`week`),n.show_y1=!0;break;case`workouts_done`:n.ymax=100,n.show_y1=!0,n.plugins={backgroundZones:{zones:[{yMin:75,yMax:100,color:J$4(`--primaryGreen`,`#98D5B0`)+`0D`}]}};break;case`cooper_test`:break}return t&&(n.time_unit=t.toLowerCase()),n.tooltipFormat=Hr$4(n.time_unit),n}function Hr$4(r){switch(r){case`day`:return`DD.MM`;case`week`:return`DD.MM`;case`month`:return`MMMM`;case`year`:return`YYYY`;default:return`MMMM`}}function Ur$3(r){return{id:r.id,title:r.title,task:r.task??null,deadline:r.due_date??null,duration:r.duration??null,cronString:r.recurring??null,notification:r.notification!=null?r.notification>0:null,notificationId:r.notification_id??null,done:r.done,coachingTrackId:r.coaching_track_id??null,coachingTrackName:r.coaching_track_name??null,coachingTrackEnrollmentId:r.coaching_track_enrollment_id??null}}function Qn$3(r){return r?(r instanceof Date?r.toISOString():String(r)).slice(0,10):null}function Zn$3(r){return{title:r.title??``,task:r.task??null,due_date:Qn$3(r.deadline),duration:r.duration??null,recurring:r.cronString??null,notification:r.notification?0:null,notification_id:r.notificationId||null,done:r.done??!1}}function Kn$3(r){return{title:r.title??``,task:r.task??null,due_date:Qn$3(r.deadline),duration:r.duration??null,recurring:r.cronString??null,notification:r.notification?0:null,notification_id:r.notificationId||null,done:r.done??!1}}var is$4={notification:!1,selected:!1,title:``,task:``,done:!1,deadline:new Date().toISOString().slice(0,10),duration:1200,cronString:``,notificationId:``};var bt$7=class r{api=E(E$1);loginService=E(ne$3);tasks=ni$3([]);loading=this.api.loading;getSingleTask(e){return this.tasks().find(t=>t.id===e)}fetchTasks(e){return ps$4(this,null,function*(){let n=e===parseInt(this.loginService.userId(),10)?yield this.api.get(`/api/v3/me/tasks`):yield this.api.get(`/api/v3/athletes/{athlete_id}/tasks`,{pathParams:{athlete_id:e}});this.tasks.set((n.tasks??[]).map(Ur$3))})}addTask(e,t){return ps$4(this,null,function*(){t===parseInt(this.loginService.userId(),10)?yield this.api.post(`/api/v3/me/tasks`,Zn$3(e)):yield this.api.post(`/api/v3/athletes/{athlete_id}/tasks`,Zn$3(e),{pathParams:{athlete_id:t}}),yield this.fetchTasks(t)})}updateTask(e,t,n){return ps$4(this,null,function*(){n===parseInt(this.loginService.userId(),10)?yield this.api.put(`/api/v3/me/tasks/{task_id}`,Kn$3(t),{pathParams:{task_id:e}}):yield this.api.put(`/api/v3/athletes/{athlete_id}/tasks/{task_id}`,Kn$3(t),{pathParams:{athlete_id:n,task_id:e}}),yield this.fetchTasks(n)})}upsertTask(e=0,t,n){return ps$4(this,null,function*(){let o=this.tasks().find(a=>a.id===e);o?yield this.updateTask(e,q$1(q$1({},o),t),n):yield this.addTask(t,n)})}deleteTask(e,t){return ps$4(this,null,function*(){t===parseInt(this.loginService.userId(),10)?yield this.api.delete(`/api/v3/me/tasks/{task_id}`,{pathParams:{task_id:e}}):yield this.api.delete(`/api/v3/athletes/{athlete_id}/tasks/{task_id}`,{pathParams:{athlete_id:t,task_id:e}}),yield this.fetchTasks(t)})}rescheduleTask(e){return ps$4(this,null,function*(){e==null?yield this.api.post(`/api/v3/me/tasks/reschedule`,{}):yield this.api.post(`/api/v3/athletes/{athlete_id}/tasks/reschedule`,{},{pathParams:{athlete_id:e}})})}resetData(){this.tasks.set([])}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var ne$3=class r{userInfo=ni$3(null);accessToken=ni$3(``);now=ni$3(Date.now());userId=ni$3(``);loading=ni$3(!1);isLoading=this.loading.asReadonly();http=E(yo$5);injector=E(we$4);config=E(kR);localStorage=E(G$1);router=E(G$4);profileService=E(ie$4);dialog=E(pe$5);tokenExpired=$C(()=>{let e=this.userInfo();return e?e.expires_at==null?!1:this.now()>=e.expires_at*1e3:!this.userId()});shouldRefreshToken=$C(()=>{let e=this.userInfo();if(!e?.expires_at)return!1;let t=(e.expires_at*1e3-this.now())/1e3;return t>0&&t<300});
2tokenExpiresIn=$C(()=>{let e=this.userInfo();if(!e?.expires_at)return null;let t=e.expires_at*1e3-this.now();return Math.max(0,Math.floor(t/1e3))});constructor(){let e=this.parseUserInfoCookie();this.userInfo.set(e),this.userId.set(e?.id?.toString()??``);let t=setInterval(()=>this.now.set(Date.now()),3e4);E(Ce$3).onDestroy(()=>clearInterval(t))}refreshPromise=null;get isRefreshing(){return this.refreshPromise!==null}waitForRefresh(){return this.refreshPromise??Promise.resolve(!0)}ensureTokenValid(){return ps$4(this,null,function*(){if(this.tokenExpired()){uu$2.log(`[Auth] Token expired at bootstrap, will redirect to login`);return}uu$2.log(`[Auth] Session valid at bootstrap, expiresIn:`,this.tokenExpiresIn(),`s`)})}getAccessToken(){return this.accessToken()}ensureAccessToken(){return ps$4(this,null,function*(){let e=this.accessToken();return e&&!this.tokenExpired()?e:(yield this.refreshAccessToken())&&this.accessToken()||null})}refreshAccessToken(){return ps$4(this,null,function*(){if(!this.userId())return uu$2.log(`[Auth] refreshAccessToken() skipped â user is not logged in`),!1;if(this.refreshPromise)return uu$2.log(`[Auth] Token refresh already in progress, waiting...`),this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return yield this.refreshPromise}finally{this.refreshPromise=null}})}performTokenRefresh(){return ps$4(this,null,function*(){try{let e=new URLSearchParams;e.append(`grant_type`,`refresh_token`),e.append(`scope`,``);let t=yield fetch(this.config.getConfig()().apiUrl+`/token`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:e.toString()});if(!t.ok)return uu$2.error(`[Auth] Token refresh failed with status:`,t.status),!1;let n=yield t.json();this.accessToken.set(n.access_token||``);let o=this.parseUserInfoCookie();return this.userInfo.set(o),uu$2.log(`[Auth] Token refreshed successfully`),!0}catch(e){return uu$2.error(`[Auth] Token refresh error:`,e),!1}})}fetchToken(e){return ps$4(this,null,function*(){let t=new URLSearchParams;t.append(`username`,e.email),t.append(`password`,e.password),t.append(`grant_type`,`password`);let n={method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t.toString(),credentials:`include`},o=yield fetch(this.config.getConfig()().apiUrl+`/token`,n);if(!o.ok){if((o.headers.get(`content-type`)??``).includes(`application/json`)){let c=yield o.json();throw new Error(c.detail||`Token fetch failed`)}let i=yield o.text();throw new Error(i||`Token fetch failed`)}return o.json()})}fetchUserProfile(e){return ps$4(this,null,function*(){let t=yield fetch(this.config.getConfig()().apiUrl+`/api/v3/me/profile`,{credentials:`include`,headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw new Error(`Failed to fetch user profile`);return t.json()})}login(e){return ps$4(this,null,function*(){this.loading.set(!0);try{let t=yield this.fetchToken(e);this.accessToken.set(t.access_token);let n=yield this.fetchUserProfile(t.access_token),o=this.parseUserInfoCookie();this.userInfo.set(o);let a=n.id??n.user_id;return this.userId.set(o?.id?.toString()??(a!=null?String(a):``)),this.profileService.updateProfileFromUsersMe(n),!0}catch(t){return uu$2.error(`Login failed:`,t),!1}finally{this.loading.set(!1)}})}logout(e){return ps$4(this,null,function*(){this.loading.set(!0),this.dialog.closeAll();try{try{let t=document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]*)/),n=t?decodeURIComponent(t[1]):``,o=n?new ge$3({"X-XSRF-TOKEN":n}):void 0;yield pm(this.http.post(this.config.getConfig()().apiUrl+`/logout`,null,{headers:o,withCredentials:!0}))}catch(t){uu$2.error(`Logout request failed:`,t)}this.resetAllServiceData(),this.userInfo.set(null),this.userId.set(``),this.localStorage.removeItem(`loginData`),this.localStorage.removeItem(`tokenData`),this.localStorage.removeItem(`userProfile`),setTimeout(()=>{e?.skipNavigation||this.router.navigateByUrl(`/login`)},0)}finally{this.loading.set(!1)}})}parseUserInfoCookie(){let e=document.cookie.match(/(?:^|;\s*)user_info=([^;]*)/);if(!e)return null;try{return JSON.parse(decodeURIComponent(e[1]))}catch(t){return null}}resetAllServiceData(){try{this.injector.get(E$2).resetData(),this.injector.get(Se$3).resetData(),this.injector.get(ft$8).resetData(),this.injector.get(bt$7).resetData(),this.injector.get(dt$8).resetData(),this.injector.get(pt$6).resetData(),this.injector.get(v$2).resetData(),this.injector.get(ct$8).resetData(),this.injector.get(O$3).resetData(),this.injector.get(st$6).resetData(),this.injector.get(lt$4).clearHistory(),this.injector.get(Ln$5).closePanel(),this.injector.get(gt$6).resetData(),this.injector.get(ut$5).unlock(),this.injector.get(f$2).clear(),this.profileService.resetData(),uu$2.log(`All service data has been reset`)}catch(e){uu$2.error(`Error resetting service data:`,e)}}register(e){return ps$4(this,null,function*(){this.resetAllServiceData(),this.loading.set(!0);let t=W$4(q$1({},e),{appCode:this.config.getConfig()().websocketCode});try{let n=yield fetch(this.config.getConfig()().apiUrl+`/signup`,{headers:{"Content-Type":`application/json`},method:`POST`,credentials:`include`,body:JSON.stringify(t)}),o=yield n.json();if(!n.ok)throw new Error(o.detail??`Registration failed`);let a=yield this.fetchToken({email:e.email,password:e.password});this.accessToken.set(a.access_token);let i=yield this.fetchUserProfile(a.access_token),c=this.parseUserInfoCookie();this.userInfo.set(c);let b=i.id??i.user_id;return this.userId.set(c?.id?.toString()??(b!=null?String(b):o.id.toString())),this.profileService.updateProfileFromUsersMe(i),!0}catch(n){throw n instanceof Error?n:new Error(`Registration failed`)}finally{this.loading.set(!1)}})}static ɵfac=function(t){return new(t||r)};static ɵprov=ue$3({token:r,factory:r.ɵfac,providedIn:`root`})};var qr$3=[`*`];var Vr$4=[[[``,`mat-card-avatar`,``],[``,`matCardAvatar`,``]],[[`mat-card-title`],[`mat-card-subtitle`],[``,`mat-card-title`,``],[``,`mat-card-subtitle`,``],[``,`matCardTitle`,``],[``,`matCardSubtitle`,``]],`*`];var $r$4=[`[mat-card-avatar], [matCardAvatar]`,`mat-card-title, mat-card-subtitle, 3 [mat-card-title], [mat-card-subtitle], 4 [matCardTitle], [matCardSubtitle]`,`*`];var Gr$4=new N$2(`MAT_CARD_CONFIG`);var yt$6=(()=>{class r{appearance;constructor(){let t=E(Gr$4,{optional:!0});this.appearance=t?.appearance||`raised`}static ɵfac=function(n){return new(n||r)};static ɵcmp=PD({type:r,selectors:[[`mat-card`]],hostAttrs:[1,`mat-mdc-card`,`mdc-card`],hostVars:8,hostBindings:function(n,o){n&2&&Yh$3(`mat-mdc-card-outlined`,o.appearance===`outlined`)(`mdc-card--outlined`,o.appearance===`outlined`)(`mat-mdc-card-filled`,o.appearance===`filled`)(`mdc-card--filled`,o.appearance===`filled`)},inputs:{appearance:`appearance`},exportAs:[`matCard`],ngContentSelectors:qr$3,decls:1,vars:0,template:function(n,o){n&1&&(Rw(),kw(0))},styles:[`.mat-mdc-card { 5 display: flex; 6 flex-direction: column; 7 box-sizing: border-box; 8 position: relative; 9 border-style: solid; 10 border-width: 0; 11 background-color: var(--%NS%mat-card-elevated-container-color, var(--%NS%mat-sys-surface-container-low)); 12 border-color: var(--%NS%mat-card-elevated-container-color, var(--%NS%mat-sys-surface-container-low)); 13 border-radius: var(--%NS%mat-card-elevated-container-shape, var(--%NS%mat-sys-corner-medium)); 14 box-shadow: var(--%NS%mat-card-elevated-container-elevation, var(--%NS%mat-sys-level1)); 15} 16.mat-mdc-card::after { 17 position: absolute; 18 top: 0; 19 left: 0; 20 width: 100%; 21 height: 100%; 22 border: solid 1px transparent; 23 content: ""; 24 display: block; 25 pointer-events: none; 26 box-sizing: border-box; 27 border-radius: var(--%NS%mat-card-elevated-container-shape, var(--%NS%mat-sys-corner-medium)); 28} 29 30.mat-mdc-card-outlined { 31 background-color: var(--%NS%mat-card-outlined-container-color, var(--%NS%mat-sys-surface)); 32 border-radius: var(--%NS%mat-card-outlined-container-shape, var(--%NS%mat-sys-corner-medium)); 33 border-width: var(--%NS%mat-card-outlined-outline-width, 1px); 34 border-color: var(--%NS%mat-card-outlined-outline-color, var(--%NS%mat-sys-outline-variant)); 35 box-shadow: var(--%NS%mat-card-outlined-container-elevation, var(--%NS%mat-sys-level0)); 36} 37.mat-mdc-card-outlined::after { 38 border: none; 39} 40 41.mat-mdc-card-filled { 42 background-color: var(--%NS%mat-card-filled-container-color, var(--%NS%mat-sys-surface-container-highest)); 43 border-radius: var(--%NS%mat-card-filled-container-shape, var(--%NS%mat-sys-corner-medium)); 44 box-shadow: var(--%NS%mat-card-filled-container-elevation, var(--%NS%mat-sys-level0)); 45} 46 47.mdc-card__media { 48 position: relative; 49 box-sizing: border-box; 50 background-repeat: no-repeat; 51 background-position: center; 52 background-size: cover; 53} 54.mdc-card__media::before { 55 display: block; 56 content: ""; 57} 58.mdc-card__media:first-child { 59 border-top-left-radius: inherit; 60 border-top-right-radius: inherit; 61} 62.mdc-card__media:last-child { 63 border-bottom-left-radius: inherit; 64 border-bottom-right-radius: inherit; 65} 66 67.mat-mdc-card-actions { 68 display: flex; 69 flex-direction: row; 70 align-items: center; 71 box-sizing: border-box; 72 min-height: 52px; 73 padding: 8px; 74} 75 76.mat-mdc-card-title { 77 font-family: var(--%NS%mat-card-title-text-font, var(--%NS%mat-sys-title-large-font)); 78 line-height: var(--%NS%mat-card-title-text-line-height, var(--%NS%mat-sys-title-large-line-height)); 79 font-size: var(--%NS%mat-card-title-text-size, var(--%NS%mat-sys-title-large-size)); 80 letter-spacing: var(--%NS%mat-card-title-text-tracking, var(--%NS%mat-sys-title-large-tracking)); 81 font-weight: var(--%NS%mat-card-title-text-weight, var(--%NS%mat-sys-title-large-weight)); 82} 83 84.mat-mdc-card-subtitle { 85 color: var(--%NS%mat-card-subtitle-text-color, var(--%NS%mat-sys-on-surface)); 86 font-family: var(--%NS%mat-card-subtitle-text-font, var(--%NS%mat-sys-title-medium-font)); 87 line-height: var(--%NS%mat-card-subtitle-text-line-height, var(--%NS%mat-sys-title-medium-line-height)); 88 font-size: var(--%NS%mat-card-subtitle-text-size, var(--%NS%mat-sys-title-medium-size)); 89 letter-spacing: var(--%NS%mat-card-subtitle-text-tracking, var(--%NS%mat-sys-title-medium-tracking)); 90 font-weight: var(--%NS%mat-card-subtitle-text-weight, var(--%NS%mat-sys-title-medium-weight)); 91} 92 93.mat-mdc-card-title, 94.mat-mdc-card-subtitle { 95 display: block; 96 margin: 0; 97} 98.mat-mdc-card-avatar ~ .mat-mdc-card-header-text .mat-mdc-card-title, 99.mat-mdc-card-avatar ~ .mat-mdc-card-header-text .mat-mdc-card-subtitle { 100 padding: 16px 16px 0; 101} 102 103.mat-mdc-card-header { 104 display: flex; 105 padding: 16px 16px 0; 106} 107 108.mat-mdc-card-content { 109 display: block; 110 padding: 0 16px; 111} 112.mat-mdc-card-content:first-child { 113 padding-top: 16px; 114} 115.mat-mdc-card-content:last-child { 116 padding-bottom: 16px; 117} 118 119.mat-mdc-card-title-group { 120 display: flex; 121 justify-content: space-between; 122 width: 100%; 123} 124 125.mat-mdc-card-avatar { 126 height: 40px; 127 width: 40px; 128 border-radius: 50%; 129 flex-shrink: 0; 130 margin-bottom: 16px; 131 object-fit: cover; 132} 133.mat-mdc-card-avatar ~ .mat-mdc-card-header-text .mat-mdc-card-subtitle, 134.mat-mdc-card-avatar ~ .mat-mdc-card-header-text .mat-mdc-card-title { 135 line-height: normal; 136} 137 138.mat-mdc-card-sm-image { 139 width: 80px; 140 height: 80px; 141} 142 143.mat-mdc-card-md-image { 144 width: 112px; 145 height: 112px; 146} 147 148.mat-mdc-card-lg-image { 149 width: 152px; 150 height: 152px; 151} 152 153.mat-mdc-card-xl-image { 154 width: 240px; 155 height: 240px; 156} 157 158.mat-mdc-card-subtitle ~ .mat-mdc-card-title, 159.mat-mdc-card-title ~ .mat-mdc-card-subtitle, 160.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-title, 161.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-subtitle, 162.mat-mdc-card-title-group .mat-mdc-card-title, 163.mat-mdc-card-title-group .mat-mdc-card-subtitle { 164 padding-top: 0; 165} 166 167.mat-mdc-card-content > :last-child:not(.mat-mdc-card-footer) { 168 margin-bottom: 0; 169} 170
171.mat-mdc-card-actions-align-end { 172 justify-content: flex-end; 173} 174`],encapsulation:2})}return r})();var Us$3=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵdir=HD({type:r,selectors:[[`mat-card-title`],[``,`mat-card-title`,``],[``,`matCardTitle`,``]],hostAttrs:[1,`mat-mdc-card-title`]})}return r})();var vt$6=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵdir=HD({type:r,selectors:[[`mat-card-content`]],hostAttrs:[1,`mat-mdc-card-content`]})}return r})();var qs$4=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵdir=HD({type:r,selectors:[[`mat-card-subtitle`],[``,`mat-card-subtitle`,``],[``,`matCardSubtitle`,``]],hostAttrs:[1,`mat-mdc-card-subtitle`]})}return r})();var Vs$4=(()=>{class r{align=`start`;static ɵfac=function(n){return new(n||r)};static ɵdir=HD({type:r,selectors:[[`mat-card-actions`]],hostAttrs:[1,`mat-mdc-card-actions`,`mdc-card__actions`],hostVars:2,hostBindings:function(n,o){n&2&&Yh$3(`mat-mdc-card-actions-align-end`,o.align===`end`)},inputs:{align:`align`},exportAs:[`matCardActions`]})}return r})();var $s$3=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵcmp=PD({type:r,selectors:[[`mat-card-header`]],hostAttrs:[1,`mat-mdc-card-header`],ngContentSelectors:$r$4,decls:4,vars:0,consts:[[1,`mat-mdc-card-header-text`]],template:function(n,o){n&1&&(Rw(Vr$4),kw(0),Il$4(1,`div`,0),kw(2,1),El$4(),kw(3,2))},encapsulation:2})}return r})();var Gs$3=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵdir=HD({type:r,selectors:[[``,`mat-card-avatar`,``],[``,`matCardAvatar`,``]],hostAttrs:[1,`mat-mdc-card-avatar`]})}return r})();var _t$8=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵmod=FD({type:r});static ɵinj=ju$1({imports:[xn$4]})}return r})();var Yr$4=[[[`card-header`]],`*`,[[`card-footer`]]];var Zr$4=[`card-header`,`*`,`card-footer`];var Jn$3=class r{static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-dashboard-card`]],ngContentSelectors:Zr$4,decls:8,vars:0,consts:[[1,`dashboard-card-content`],[1,`card-header`],[1,`card-body`],[1,`card-footer`]],template:function(t,n){t&1&&(Rw(Yr$4),Bi$3(0,`div`,0)(1,`div`,1),kw(2),vl$4(),Bi$3(3,`mat-card`,2)(4,`mat-card-content`),kw(5,1),vl$4()(),Bi$3(6,`div`,3),kw(7,2),vl$4()())},dependencies:[_t$8,yt$6,vt$6],styles:[`.dashboard-card-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;page-break-inside:avoid;break-inside:avoid-column;height:100%}.dashboard-card-content[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%]{width:100%;height:100%}.dashboard-card-content[_ngcontent-%COMP%] .card-footer[_ngcontent-%COMP%]{width:100%}`]})};function Kr$4(r,e){if(r&1&&(Bi$3(0,`span`),lC(1),OC(2,`translate`),vl$4()),r&2){let t=xw(2);sE(),sg(` `,t.getSelectedCount(),` `,LC(2,2,t.itemsSelectedText()),` `)}}function Qr$3(r,e){if(r&1&&(Bi$3(0,`mat-select-trigger`),fw(1,Kr$4,3,4,`span`),vl$4()),r&2){let t=xw();sE(),pw(t.getSelectedCount()>0?1:-1)}}function Xr$3(r,e){if(r&1){let t=Cw();Bi$3(0,`button`,9),jh$3(`pointerup`,function(o){return ld$2(t),xw().onSearchChange(``),ud$1(o.stopPropagation())}),Bi$3(1,`mat-icon`),lC(2,`close`),vl$4()()}}function Jr$4(r,e){if(r&1&&(Bi$3(0,`span`,11),lC(1),vl$4()),r&2){let t=xw().$implicit;sE(),Cl$4(` (`,t.sublabel,`) `)}}function eo$3(r,e){if(r&1&&(Bi$3(0,`mat-option`,10),lC(1),fw(2,Jr$4,2,1,`span`,11),vl$4()),r&2){let t=e.$implicit;Zh$2(`display`,xw().doesOptionMatchSearch(t)?``:`none`),Ah$2(`value`,t.id),sE(),Cl$4(` `,t.label,` `),sE(),pw(t.sublabel?2:-1)}}function to$3(r,e){if(r&1&&(Bi$3(0,`mat-option`,8)(1,`span`,12),lC(2),OC(3,`translate`),vl$4()()),r&2){let t=xw();sE(2),ig(LC(3,1,t.noResultsText()))}}var er$4=class r{options=Q1.required();placeholder=Q1(``);searchPlaceholder=Q1(`common.search`);multiple=Q1(!1);disabled=Q1(!1);noResultsText=Q1(`common.noResults`);itemsSelectedText=Q1(`common.itemsSelected`);inputId=Q1(`searchable-select-input`);selectionChange=z1();closed=z1();searchText=ni$3(``);valueSignal=ni$3(null);value=$C(()=>this.valueSignal());filteredOptions=$C(()=>{let e=this.options(),t=this.searchText(),n=this.valueSignal();if(!t)return e;let o=t.toLowerCase();return e.filter(a=>{let i=a.label.toLowerCase().includes(o)||a.sublabel?.toLowerCase().includes(o),c=Array.isArray(n)?n.includes(a.id):n===a.id;return i||c})});doesOptionMatchSearch(e){let t=this.searchText();if(!t)return!0;let n=t.toLowerCase();return e.label.toLowerCase().includes(n)||(e.sublabel?.toLowerCase().includes(n)??!1)}hasVisibleOptions=$C(()=>this.filteredOptions().some(e=>this.doesOptionMatchSearch(e)));onChange=()=>{};onTouched=()=>{};writeValue(e){this.valueSignal.set(e)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}onSearchChange(e){this.searchText.set(e)}
174onSelectClosed(){this.searchText.set(``),this.closed.emit(),this.onTouched()}onValueChange(e){this.valueSignal.set(e),this.onChange(e),this.selectionChange.emit(e)}getSelectedCount(){let e=this.value();return Array.isArray(e)?e.length:0}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-searchable-select`]],inputs:{options:[1,`options`],placeholder:[1,`placeholder`],searchPlaceholder:[1,`searchPlaceholder`],multiple:[1,`multiple`],disabled:[1,`disabled`],noResultsText:[1,`noResultsText`],itemsSelectedText:[1,`itemsSelectedText`],inputId:[1,`inputId`]},outputs:{selectionChange:`selectionChange`,closed:`closed`},features:[CC([{provide:E$3,useExisting:r,multi:!0}])],decls:13,vars:12,consts:[[`appearance`,`outline`,1,`w-full`],[`panelClass`,`searchable-select-panel`,3,`ngModelChange`,`closed`,`id`,`ngModel`,`placeholder`,`multiple`,`disabled`],[`disabled`,``,1,`search-option`],[1,`search-container`,3,`pointerup`],[1,`search-icon`],[`type`,`text`,1,`search-input`,3,`input`,`pointerup`,`placeholder`,`value`],[`type`,`button`,1,`clear-search`],[3,`value`,`display`],[`disabled`,``,1,`no-results-option`],[`type`,`button`,1,`clear-search`,3,`pointerup`],[3,`value`],[1,`option-sublabel`],[1,`no-results-text`]],template:function(t,n){t&1&&(Bi$3(0,`mat-form-field`,0)(1,`mat-select`,1),jh$3(`ngModelChange`,function(a){return n.onValueChange(a)})(`closed`,function(){return n.onSelectClosed()}),fw(2,Qr$3,2,1,`mat-select-trigger`),Bi$3(3,`mat-option`,2)(4,`div`,3),jh$3(`pointerup`,function(a){return a.stopPropagation()}),Bi$3(5,`mat-icon`,4),lC(6,`search`),vl$4(),Bi$3(7,`input`,5),OC(8,`translate`),jh$3(`input`,function(a){return n.onSearchChange(a.target.value)})(`pointerup`,function(a){return a.stopPropagation()}),vl$4(),fw(9,Xr$3,3,0,`button`,6),vl$4()(),mw(10,eo$3,3,5,`mat-option`,7,gw),fw(12,to$3,4,3,`mat-option`,8),vl$4(),WE(),vl$4()),t&2&&(sE(),Ah$2(`id`,n.inputId())(`ngModel`,n.value())(`placeholder`,n.placeholder())(`multiple`,n.multiple())(`disabled`,n.disabled()),zE(),sE(),pw(n.multiple()?2:-1),sE(5),Ah$2(`placeholder`,LC(8,10,n.searchPlaceholder()))(`value`,n.searchText()),sE(2),pw(n.searchText()?9:-1),sE(),yw(n.filteredOptions()),sE(2),pw(n.hasVisibleOptions()?-1:12))},dependencies:[en$4,je$3,Gi$3,Hi$3,ji$3,$$3,yt$7,wt$5,Jn$4,qn$5,fn$5,Xp$1],styles:[`mat-form-field[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper{display:none}mat-form-field[_ngcontent-%COMP%] .mat-mdc-text-field-wrapper{background-color:var(--%NS%background)}mat-form-field[_ngcontent-%COMP%] .mat-mdc-form-field-focus-overlay{background-color:transparent}mat-form-field[_ngcontent-%COMP%] .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading, mat-form-field[_ngcontent-%COMP%] .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__notch, mat-form-field[_ngcontent-%COMP%] .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing{border-color:var(--%NS%border-color)}mat-form-field[_ngcontent-%COMP%] .mat-mdc-form-field.mat-focused .mdc-notched-outline .mdc-notched-outline__leading, mat-form-field[_ngcontent-%COMP%] .mat-mdc-form-field.mat-focused .mdc-notched-outline .mdc-notched-outline__notch, mat-form-field[_ngcontent-%COMP%] .mat-mdc-form-field.mat-focused .mdc-notched-outline .mdc-notched-outline__trailing{border-color:var(--%NS%primary)}mat-form-field[_ngcontent-%COMP%] .mat-mdc-select-value{color:var(--%NS%text-color)}mat-form-field[_ngcontent-%COMP%] .mat-mdc-select-arrow{color:var(--%NS%text-color)}.option-sublabel[_ngcontent-%COMP%]{color:var(--%NS%text-color);opacity:.6;font-size:.875rem;margin-left:.5rem} .searchable-select-panel.mat-mdc-select-panel .search-option.mat-mdc-option{position:relative;z-index:1;flex-shrink:0;background-color:var(--%NS%box-color);border-bottom:1px solid var(--%NS%border-color);pointer-events:auto;opacity:1!important;padding:0;min-height:48px;box-sizing:border-box} .searchable-select-panel.mat-mdc-select-panel .search-option.mat-mdc-option:hover{background-color:var(--%NS%box-color)!important} .searchable-select-panel.mat-mdc-select-panel .search-option.mat-mdc-option .mdc-list-item__primary-text{width:100%;max-width:100%} .searchable-select-panel.mat-mdc-select-panel .search-option.mat-mdc-option .mat-pseudo-checkbox-full{display:none} .searchable-select-panel.mat-mdc-select-panel .search-container{display:flex;align-items:center;padding:8px 12px;width:100%;gap:8px} .searchable-select-panel.mat-mdc-select-panel .search-container .search-icon{color:var(--%NS%text-color);opacity:.6;font-size:1.25rem;width:1.25rem;height:1.25rem} .searchable-select-panel.mat-mdc-select-panel .search-container .search-input{flex:1;background:transparent;border:none;outline:none;color:var(--%NS%text-color);font-size:.875rem;padding:4px 0} .searchable-select-panel.mat-mdc-select-panel .search-container .search-input::placeholder{color:var(--%NS%text-color);opacity:.5} .searchable-select-panel.mat-mdc-select-panel .search-container .clear-search{background:transparent;border:none;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--%NS%text-color);opacity:.6} .searchable-select-panel.mat-mdc-select-panel .search-container .clear-search mat-icon{font-size:1.125rem;width:1.125rem;height:1.125rem} .searchable-select-panel.mat-mdc-select-panel .search-container .clear-search:hover{opacity:1} .searchable-select-panel.mat-mdc-select-panel .no-results-option{opacity:1!important;text-align:center} .searchable-select-panel.mat-mdc-select-panel .no-results-option .no-results-text{color:var(--%NS%text-color);opacity:.6;font-style:italic}`]})};var nr$4=class r{loginService=E(ne$3);logout(){this.loginService.logout()}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-access-locked-dialog`]],decls:12,vars:9,consts:[[1,`access-locked-dialog-container`,`p-6`],[1,`warning-icon`],[1,`secondary-title`],[1,`text-base`],[`mat-button`,``,3,`pointerup`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`mat-icon`,1),lC(2,`error_outline`),vl$4(),Bi$3(3,`h2`,2),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`,3),lC(7),OC(8,`translate`),vl$4(),Bi$3(9,`button`,4),jh$3(`pointerup`,function(){return n.logout()}),lC(10),OC(11,`translate`),vl$4()()),t&2&&(sE(4),ig(LC(5,3,`accessLockedDialog.title`)),sE(3),ig(LC(8,5,`accessLockedDialog.message`)),sE(3),Cl$4(` `,LC(11,7,`common.logout`),` `))},dependencies:[Ap$1,wp$2,yt$7,wt$5,Xp$1],styles:[`[_nghost-%COMP%]{display:block;box-sizing:border-box;background-color:var(--%NS%dialog-dark-background);border-radius:10px;box-shadow:0 12px 40px #0000008c,0 0 0 1px #ffffff0f}.dialog-styling[_nghost-%COMP%], .dialog-styling [_nghost-%COMP%]{background-color:transparent;border-radius:0;box-shadow:none}.access-locked-dialog-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center}.warning-icon[_ngcontent-%COMP%]{width:2.5rem;height:2.5rem;font-size:2.5rem;color:var(--%NS%warn, #e57373)}.secondary-title[_ngcontent-%COMP%]{margin:0}.text-base[_ngcontent-%COMP%]{margin:0;line-height:1.5;color:var(--%NS%text-color, #333)}`]})};var ro$3=()=>[`/dashboard`];function oo$3(r,e){r&1&&Rh$3(0,`img`,2)}
174function ao$3(r,e){r&1&&(Rh$3(0,`img`,3),Bi$3(1,`span`,4),lC(2,`Blokki`),vl$4())}var rr$3=class r{logoOnly;static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-app-logo`]],inputs:{logoOnly:`logoOnly`},decls:4,vars:5,consts:[[1,`logo-link`,3,`routerLink`],[1,`app-logo`],[`src`,`assets/svg/logo-white-horizontal.svg`,`alt`,`Blokki`,1,`logo-icon`],[`src`,`assets/svg/logo-white.svg`,`alt`,`Blokki`,1,`logo-icon`,`logo-icon-mark`],[1,`logo-text`]],template:function(t,n){t&1&&(Bi$3(0,`a`,0)(1,`div`,1),fw(2,oo$3,1,0,`img`,2)(3,ao$3,3,0),vl$4()()),t&2&&(Yh$3(`compact`,!n.logoOnly),Ah$2(`routerLink`,TC(4,ro$3)),sE(2),pw(n.logoOnly?2:3))},dependencies:[Ap$1,yt$7,ea$4,si$3],styles:[`[_nghost-%COMP%]{display:block;height:100%}.app-logo[_ngcontent-%COMP%]{height:3.75rem;display:flex;justify-content:flex-start;align-items:center;font-size:1.875rem;padding:0;gap:15px;font-weight:600;color:var(--%NS%logo-color)}.app-logo[_ngcontent-%COMP%] .logo-icon[_ngcontent-%COMP%]{margin-left:10px;height:40px;width:auto}.logo-link[_ngcontent-%COMP%]{text-decoration:none;cursor:pointer;--%NS%mat-button-filled-hover-state-layer-opacity: 0}.logo-link.compact[_ngcontent-%COMP%]{display:flex;align-items:center;position:absolute;top:0;left:0;height:100%;width:var(--%NS%rail-width, 64px);box-sizing:border-box;padding-left:14px;border-radius:12px;overflow:hidden;transition:width .2s ease,background-color .2s ease,box-shadow .2s ease}.logo-link.compact[_ngcontent-%COMP%] .app-logo[_ngcontent-%COMP%]{height:auto;gap:12px}.logo-link.compact[_ngcontent-%COMP%] .logo-icon-mark[_ngcontent-%COMP%]{height:28px;width:28px;margin-left:0;flex-shrink:0}.logo-link.compact[_ngcontent-%COMP%] .logo-text[_ngcontent-%COMP%]{font-size:1.3rem;font-weight:700;white-space:nowrap;opacity:0;transition:opacity .15s ease 60ms}.logo-link.compact[_ngcontent-%COMP%]:hover, .logo-link.compact[_ngcontent-%COMP%]:focus-within{width:var(--%NS%rail-width-expanded, 236px);background:var(--%NS%dialog-dark-background);box-shadow:0 12px 30px #00000059;overflow:visible}.logo-link.compact[_ngcontent-%COMP%]:hover .logo-text[_ngcontent-%COMP%], .logo-link.compact[_ngcontent-%COMP%]:focus-within .logo-text[_ngcontent-%COMP%]{opacity:1}`]})};function io$3(r,e){r&1&&(Bi$3(0,`mat-icon`),lC(1,`check`),vl$4())}var or$4=class r{selected=!1;static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-check-icon`]],inputs:{selected:`selected`},decls:2,vars:1,consts:[[1,`check-icon`]],template:function(t,n){t&1&&(Bi$3(0,`button`,0),fw(1,io$3,2,0,`mat-icon`),vl$4()),t&2&&(sE(),pw(n.selected?1:-1))},dependencies:[yt$7,wt$5],styles:[`.check-icon[_ngcontent-%COMP%]{width:25px;padding-top:3px;height:25px;display:flex;align-items:center;justify-content:center;background-color:var(--%NS%logo-color);color:#000;border-radius:50%}.check-icon[_ngcontent-%COMP%] .material-symbols-outlined[_ngcontent-%COMP%]{font-size:20px}`]})};var Pt$5=mT(ce$5());var lo$3=r=>({maxDays:r});var co$3=r=>({date:r});function po$3(r,e){if(r&1&&(Bi$3(0,`p`,4),lC(1),OC(2,`translate`),vl$4()),r&2){let t=xw();sE(),Cl$4(` `,FC(2,1,`dialogs.addTraining.dailyCountExceedsProgram`,bC(4,lo$3,t.maxDays())),` `)}}function uo$3(r,e){if(r&1&&(Bi$3(0,`p`,5),lC(1),OC(2,`date`),OC(3,`translate`),vl$4()),r&2){let t=xw();sE(),Cl$4(` `,FC(3,4,`dialogs.addTraining.dailyEndDatePreview`,bC(7,co$3,FC(2,1,t.endDatePreview(),`mediumDate`))),` `)}}var kt$5=class r{startDate=Q1.required();programEndDate=Q1.required();dayCount=Q1(void 0);dayCountChange=z1();maxDays=$C(()=>{let e=(0,Pt$5.default)(this.startDate()).startOf(`day`),n=(0,Pt$5.default)(this.programEndDate()).startOf(`day`).diff(e,`day`);return Math.max(1,n+1)});endDatePreview=$C(()=>{let e=this.dayCount();return!e||e<1?null:(0,Pt$5.default)(this.startDate()).startOf(`day`).add(e-1,`day`).toDate()});isInvalid=$C(()=>{let e=this.dayCount();return e==null?!1:e<1||e>this.maxDays()});onDayCountInput(e){let t=parseInt(e,10);this.dayCountChange.emit(Number.isNaN(t)?0:t)}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-daily-recurrence-input`]],inputs:{startDate:[1,`startDate`],programEndDate:[1,`programEndDate`],dayCount:[1,`dayCount`]},outputs:{dayCountChange:`dayCountChange`},decls:12,vars:8,consts:[[1,`daily-recurrence-input`],[1,`input-container`,`block`,`mb-2`],[`appearance`,`outline`,1,`w-full`],[`matInput`,``,`type`,`number`,`min`,`1`,3,`input`,`value`],[1,`daily-recurrence-message`,`daily-recurrence-error`],[1,`daily-recurrence-message`,`daily-recurrence-end-date`],[1,`daily-recurrence-message`,`daily-recurrence-info`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`span`,1)(2,`mat-label`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`mat-form-field`,2)(6,`input`,3),jh$3(`input`,function(a){return n.onDayCountInput(a.target.value)}),vl$4()()(),fw(7,po$3,3,6,`p`,4)(8,uo$3,4,9,`p`,5),Bi$3(9,`p`,6),lC(10),OC(11,`translate`),vl$4()()),t&2&&(sE(3),ig(LC(4,4,`dialogs.addTraining.dailyCount`)),sE(3),Ah$2(`value`,n.dayCount()??``),sE(),pw(n.isInvalid()?7:n.endDatePreview()?8:-1),sE(3),Cl$4(` `,LC(11,6,`dialogs.addTraining.dailyNoAdaptation`),` `))},dependencies:[Zi$3,en$4,je$3,X$5,Be$2,Pe$4,es$4,Xp$1],styles:[`.daily-recurrence-input[_ngcontent-%COMP%]{width:100%}.daily-recurrence-input[_ngcontent-%COMP%] .daily-recurrence-message[_ngcontent-%COMP%]{margin:0 0 8px;font-size:13px;text-align:right}.daily-recurrence-input[_ngcontent-%COMP%] .daily-recurrence-end-date[_ngcontent-%COMP%]{color:var(--%NS%text-color, inherit);opacity:.8}.daily-recurrence-input[_ngcontent-%COMP%] .daily-recurrence-error[_ngcontent-%COMP%]{color:#d32f2f;font-weight:500}.daily-recurrence-input[_ngcontent-%COMP%] .daily-recurrence-info[_ngcontent-%COMP%]{color:#b58105;opacity:.9}`]})};var mo$3=[`sliderTrack`];var ar$4=(r,e)=>e.zone;var go$3=(r,e)=>e.index;function ho$3(r,e){if(r&1&&(Bi$3(0,`span`,17),lC(1),vl$4()),r&2){let t=xw().$implicit,n=xw();sE(),Cl$4(` `,n.getResolvedZoneInfo(t.zone),` `)}}function fo$3(r,e){if(r&1&&(Bi$3(0,`span`,17),lC(1),vl$4()),r&2){let t=xw().$implicit;sE(),Cl$4(` `,t.percentage,`% `)}}function bo$4(r,e){if(r&1&&(Bi$3(0,`div`,3),Rh$3(1,`div`,15),Bi$3(2,`span`,16),lC(3),OC(4,`translate`),vl$4(),fw(5,ho$3,2,1,`span`,17),fw(6,fo$3,2,1,`span`,17),vl$4()),r&2){let t=e.$implicit,n=xw();sE(),Zh$2(`background-color`,t.color),sE(2),ig(LC(4,5,n.getZoneName(t.zone))),sE(2),pw(n.maxHeartRate?5:-1),sE(),pw(n.maxHeartRate?-1:6)}}function yo$4(r,e){if(r&1&&(Bi$3(0,`div`,18)(1,`span`,19),lC(2),OC(3,`translate`),vl$4()()),r&2){let t=e.$implicit,n=xw();Zh$2(`background-color`,t.color)(`left`,t.start,`%`)(`width`,t.width,`%`),xh$2(`data-zone`,t.zone),sE(2),Cl$4(` `,LC(3,8,n.getZoneName(t.zone)),` `)}}function vo$3(r,e){if(r&1){let t=Cw();Bi$3(0,`div`,20),jh$3(`mousedown`,function(o){let a=ld$2(t).$index;return ud$1(xw().onHandleMouseDown(o,a))}),Rh$3(1,`div`,21),vl$4()}if(r&2){let t=e.$implicit,n=e.$index,o=xw();Zh$2(`left`,t.position,`%`),Yh$3(`dragging`,o.draggingHandleIndex()===n),Ah$2(`matTooltip`,o.getHandleTooltip(n))}}var ir$4=class r{defaultZones=[10,10,10,10,10];set zones(e){if(e?.length===5){let t=[...e],n=t.reduce((o,a)=>o+(a||0),0);if(n===0)t=[...this.defaultZones];else if(n>100){let o=100/n;t=t.map(i=>Math.round((i||0)*o));let a=t.reduce((i,c)=>i+c,0);if(a>100){let i=t.indexOf(Math.max(...t));t[i]-=a-100}}t=t.map(o=>Math.max(0,o)),this.zonesSignal.set(t)}}maxHeartRate=null;zonesChange=new Qe$1;sliderTrack;zonesSignal=ni$3([0,0,0,25,25]);draggingHandleIndex=ni$3(null);isDragging=!1;zoneColors=ne$4;zoneSegments=$C(()=>{let e=this.zonesSignal(),t=[],n=0,a=100-e.reduce((i,c)=>i+c,0);
174t.push({zone:0,percentage:a,color:`rgba(128, 128, 128, 0.3)`,start:n,width:a,isRestZone:!0}),n+=a;for(let i=e.length-1;i>=0;i--){let c=5-i,b=e[i];t.push({zone:c,percentage:b,color:this.zoneColors[c-1],start:n,width:b,isRestZone:!1}),n+=b}return t});handles=$C(()=>{let e=this.zonesSignal(),t=[],a=100-e.reduce((i,c)=>i+c,0);t.push({index:4,position:a,isRestBoundary:!0});for(let i=e.length-1;i>0;i--)a+=e[i],t.push({index:i-1,position:a,isRestBoundary:!1});return t});getZoneName(e){return e===0?`heartRate.restZone`:`heartRate.zone${e}.abr`}onHandleMouseDown(e,t){e.preventDefault(),this.isDragging=!0,this.draggingHandleIndex.set(t),document.addEventListener(`mousemove`,this.onDocumentMouseMove),document.addEventListener(`mouseup`,this.onDocumentMouseUp)}onDocumentMouseMove=e=>{if(!this.isDragging||this.draggingHandleIndex()===null||!this.sliderTrack)return;let n=this.sliderTrack.nativeElement.getBoundingClientRect(),o=e.clientX-n.left,a=Math.max(0,Math.min(100,o/n.width*100));this.updateZoneAtHandle(this.draggingHandleIndex(),a)};onDocumentMouseUp=()=>{this.isDragging=!1,this.draggingHandleIndex.set(null),document.removeEventListener(`mousemove`,this.onDocumentMouseMove),document.removeEventListener(`mouseup`,this.onDocumentMouseUp)};updateZoneAtHandle(e,t){let n=[...this.handles()],o=e>0?n[e-1].position:0,a=e<n.length-1?n[e+1].position:100,i=o+1,c=a-1,b=Math.max(i,Math.min(c,t));n[e]=W$4(q$1({},n[e]),{position:b});let f=[0,...n.map(O=>O.position),100],k=[0,0,0,0,0];k[4]=Math.round(f[2]-f[1]),k[3]=Math.round(f[3]-f[2]),k[2]=Math.round(f[4]-f[3]),k[1]=Math.round(f[5]-f[4]),k[0]=Math.round(f[6]-f[5]);for(let O=0;O<k.length;O++)k[O]=Math.max(0,k[O]);let A=k.reduce((O,Y)=>O+Y,0);if(A>100){let O=A-100,Y=k.indexOf(Math.max(...k));k[Y]=Math.max(0,k[Y]-O)}this.zonesSignal.set(k),this.zonesChange.emit(k)}getResolvedHeartRateZones(){return G$2(this.zonesSignal(),this.maxHeartRate||void 0)}getResolvedZoneInfo(e){if(e===0){let i=100-this.zonesSignal().reduce((c,b)=>c+b,0);if(this.maxHeartRate){let c=this.maxHeartRate;return`0 - ${i}% / 0 - ${Math.round(i/100*c)} bpm`}return`${i}%`}let t=this.getResolvedHeartRateZones();if(!t.length)return``;let n=t.find(o=>o.zone===e);return n?`${n.lowerPercentage} - ${n.upperPercentage}% / ${n.lowerHR} - ${n.upperHR} bpm`:``}getZoneHeartRateRange(e){return this.maxHeartRate?this.getResolvedZoneInfo(e):``}getHandleTooltip(e){let n=this.handles()[e],o=n.position.toFixed(0);if(this.maxHeartRate)return`${o}% 175${Math.round(n.position/100*this.maxHeartRate)} bpm`;return`${o}%`}ngOnDestroy(){document.removeEventListener(`mousemove`,this.onDocumentMouseMove),document.removeEventListener(`mouseup`,this.onDocumentMouseUp)}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-heart-rate-zone-slider`]],viewQuery:function(t,n){if(t&1&&$h$2(mo$3,5),t&2){let o;Pw(o=Lw())&&(n.sliderTrack=o.first)}},inputs:{zones:`zones`,maxHeartRate:`maxHeartRate`},outputs:{zonesChange:`zonesChange`},decls:25,vars:3,consts:[[`sliderTrack`,``],[1,`heart-rate-zone-slider`],[1,`zone-legend`],[1,`zone-legend-item`],[1,`slider-container`],[1,`slider-track`],[1,`zone-segment`,3,`background-color`,`left`,`width`],[`matTooltipClass`,`multiline-tooltip`,1,`zone-handle`,3,`dragging`,`left`,`matTooltip`],[1,`percentage-markers`],[1,`marker`,2,`left`,`0%`],[1,`marker`,2,`left`,`25%`],[1,`marker`,2,`left`,`50%`],[1,`marker`,2,`left`,`75%`],[1,`marker`,2,`left`,`100%`],[1,`instructions`],[1,`zone-color-dot`],[1,`zone-label`],[1,`zone-info`],[1,`zone-segment`],[1,`zone-label-overlay`],[`matTooltipClass`,`multiline-tooltip`,1,`zone-handle`,3,`mousedown`,`matTooltip`],[1,`handle-grip`]],template:function(t,n){t&1&&(Bi$3(0,`div`,1)(1,`div`,2),mw(2,bo$4,7,7,`div`,3,ar$4),vl$4(),Bi$3(4,`div`,4)(5,`div`,5,0),mw(7,yo$4,4,10,`div`,6,ar$4),mw(9,vo$3,2,5,`div`,7,go$3),vl$4(),Bi$3(11,`div`,8)(12,`span`,9),lC(13,`0%`),vl$4(),Bi$3(14,`span`,10),lC(15,`25%`),vl$4(),Bi$3(16,`span`,11),lC(17,`50%`),vl$4(),Bi$3(18,`span`,12),lC(19,`75%`),vl$4(),Bi$3(20,`span`,13),lC(21,`100%`),vl$4()()(),Bi$3(22,`p`,14),lC(23),OC(24,`translate`),vl$4()()),t&2&&(sE(2),yw(n.zoneSegments()),sE(5),yw(n.zoneSegments()),sE(2),yw(n.handles()),sE(14),Cl$4(` `,LC(24,1,`clientProfile.zoneSliderInstructions`),` `))},dependencies:[I$6,Ct$5,Xp$1],styles:[`.heart-rate-zone-slider[_ngcontent-%COMP%]{width:100%;padding:16px 0}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;margin-bottom:24px}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;font-size:14px}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%] .zone-color-dot[_ng
175content-%COMP%]{width:16px;height:16px;border-radius:50%;flex-shrink:0}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%] .zone-label[_ngcontent-%COMP%]{flex:1;min-width:120px;color:var(--%NS%text-color)}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%] .zone-info[_ngcontent-%COMP%]{font-weight:500;color:var(--%NS%text-color);min-width:200px;text-align:right;font-size:13px}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%]{margin-bottom:16px}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%]{position:relative;height:60px;background-color:var(--%NS%box-color);border:1px solid var(--%NS%border-color);border-radius:8px;overflow:hidden;cursor:pointer;-webkit-user-select:none;user-select:none}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-segment[_ngcontent-%COMP%]{position:absolute;top:0;height:100%;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-segment[_ngcontent-%COMP%]:hover{opacity:.9}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-segment[data-zone="0"][_ngcontent-%COMP%]{background:repeating-linear-gradient(45deg,color-mix(in srgb,var(--%NS%text-color) 20%,transparent),color-mix(in srgb,var(--%NS%text-color) 20%,transparent) 10px,color-mix(in srgb,var(--%NS%text-color) 30%,transparent) 10px 20px)}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-segment[data-zone="0"][_ngcontent-%COMP%] .zone-label-overlay[_ngcontent-%COMP%]{color:#ffffffb3;font-style:italic}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-segment[_ngcontent-%COMP%] .zone-label-overlay[_ngcontent-%COMP%]{color:#ffffffe6;font-size:12px;font-weight:600;text-shadow:0 1px 2px rgba(0,0,0,.3);pointer-events:none;white-space:nowrap}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%]{position:absolute;top:0;width:4px;height:100%;margin-left:-2px;cursor:ew-resize;z-index:10;transition:transform .1s ease}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%]:hover, .heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle.dragging[_ngcontent-%COMP%]{transform:scaleX(1.5)}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%]:hover .handle-grip[_ngcontent-%COMP%], .heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle.dragging[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]{background-color:var(--%NS%primary);box-shadow:0 0 8px color-mix(in srgb,var(--%NS%primary) 60%,transparent)}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:24px;height:40px;background-color:#fff;border:2px solid var(--%NS%border-color);border-radius:4px;box-shadow:0 2px 4px #0003;transition:all .2s ease}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]:before, .heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]:after{content:"";position:absolute;
175left:50%;width:2px;height:16px;background-color:var(--%NS%border-color);transform:translate(-50%)}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]:before{top:6px}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]:after{top:14px}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-handle.dragging[_ngcontent-%COMP%] .handle-grip[_ngcontent-%COMP%]{cursor:grabbing}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .percentage-markers[_ngcontent-%COMP%]{position:relative;height:24px;margin-top:8px}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .percentage-markers[_ngcontent-%COMP%] .marker[_ngcontent-%COMP%]{position:absolute;transform:translate(-50%);font-size:11px;color:var(--%NS%gray-link-color)}.heart-rate-zone-slider[_ngcontent-%COMP%] .instructions[_ngcontent-%COMP%]{font-size:12px;color:var(--%NS%gray-link-color);font-style:italic;text-align:center;margin:8px 0 0}@media(max-width:760px){.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%]{flex-wrap:wrap;gap:8px}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%] .zone-label[_ngcontent-%COMP%]{min-width:auto;flex:0 0 100%}.heart-rate-zone-slider[_ngcontent-%COMP%] .zone-legend[_ngcontent-%COMP%] .zone-legend-item[_ngcontent-%COMP%] .zone-info[_ngcontent-%COMP%]{flex:1;min-width:auto}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%]{height:50px}.heart-rate-zone-slider[_ngcontent-%COMP%] .slider-container[_ngcontent-%COMP%] .slider-track[_ngcontent-%COMP%] .zone-label-overlay[_ngcontent-%COMP%]{font-size:10px}} .multiline-tooltip{white-space:pre-line;text-align:center;line-height:1.4}`]})};var _o$3=[`input`];var Po$4=[`formField`];var ko$4=[`*`];var xt$4=class{source;value;constructor(e,t){this.source=e,this.value=t}};var xo$3={provide:E$3,useExisting:Oo$4(()=>Nt$5),multi:!0};var sr$4=new N$2(`MatRadioGroup`);var Co$4=new N$2(`mat-radio-default-options`,{providedIn:`root`,factory:()=>({color:`accent`,disabledInteractive:!1})});var Nt$5=(()=>{class r{_changeDetector=E(ej);_value=null;_name=E(Or$4).getId(`mat-radio-group-`);_selected=null;_isInitialized=!1;_labelPosition=`after`;_disabled=!1;_required=!1;_buttonChanges;_controlValueAccessorChangeFn=()=>{};onTouched=()=>{};change=new Qe$1;_radios;color;get name(){return this._name}set name(t){this._name=t,this._updateRadioButtonNames()}get labelPosition(){return this._labelPosition}set labelPosition(t){this._labelPosition=t===`before`?`before`:`after`,this._markRadiosForCheck()}get value(){return this._value}set value(t){this._value!==t&&(this._value=t,this._updateSelectedRadioFromValue(),this._checkSelectedRadioButton())}_checkSelectedRadioButton(){this._selected&&!this._selected.checked&&(this._selected.checked=!0)}get selected(){return this._selected}set selected(t){this._selected=t,this.value=t?t.value:null,this._checkSelectedRadioButton()}get disabled(){return this._disabled}set disabled(t){this._disabled=t,this._markRadiosForCheck()}get required(){return this._required}set required(t){this._required=t,this._markRadiosForCheck()}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(t){this._disabledInteractive=t,this._markRadiosForCheck()}_disabledInteractive=!1;ngAfterContentInit(){this._isInitialized=!0,this._buttonChanges=this._radios.changes.subscribe(()=>{this.selected&&!this._radios.find(t=>t===this.selected)&&(this._selected=null)})}ngOnDestroy(){this._buttonChanges?.unsubscribe()}_touch(){this.onTouched&&this.onTouched()}_updateRadioButtonNames(){this._radios&&this._radios.forEach(t=>{t.name=this.name,t._markForCheck()})}_updateSelectedRadioFromValue(){let t=this._selected!==null&&this._selected.value===this._value;this._radios&&!t&&(this._selected=null,this._radios.forEach(n=>
175{n.checked=this.value===n.value,n.checked&&(this._selected=n)}))}_emitChangeEvent(){this._isInitialized&&this.change.emit(new xt$4(this._selected,this._value))}_markRadiosForCheck(){this._radios&&this._radios.forEach(t=>t._markForCheck())}writeValue(t){this.value=t,this._changeDetector.markForCheck()}registerOnChange(t){this._controlValueAccessorChangeFn=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t,this._changeDetector.markForCheck()}static ɵfac=function(n){return new(n||r)};static ɵdir=HD({type:r,selectors:[[`mat-radio-group`]],contentQueries:function(n,o,a){if(n&1&&Bh$3(a,Ct$4,5),n&2){let i;Pw(i=Lw())&&(o._radios=i)}},hostAttrs:[`role`,`radiogroup`,1,`mat-mdc-radio-group`],inputs:{color:`color`,name:`name`,labelPosition:`labelPosition`,value:`value`,selected:`selected`,disabled:[2,`disabled`,`disabled`,rj],required:[2,`required`,`required`,rj],disabledInteractive:[2,`disabledInteractive`,`disabledInteractive`,rj]},outputs:{change:`change`},exportAs:[`matRadioGroup`],features:[CC([xo$3,{provide:sr$4,useExisting:r}])]})}return r})();var Ct$4=(()=>{class r{_elementRef=E(Lr$5);_changeDetector=E(ej);_focusMonitor=E(yn$4);_radioDispatcher=E(vt$7);_defaultOptions=E(Co$4,{optional:!0});_ngZone=E(Z$4);_renderer=E(pc$4);_uniqueId=E(Or$4).getId(`mat-radio-`);_cleanupClick;id=this._uniqueId;name;ariaLabel;ariaLabelledby;ariaDescribedby;disableRipple=!1;tabIndex=0;get checked(){return this._checked}set checked(t){this._checked!==t&&(this._checked=t,t&&this.radioGroup&&this.radioGroup.value!==this.value?this.radioGroup.selected=this:!t&&this.radioGroup&&this.radioGroup.value===this.value&&(this.radioGroup.selected=null),t&&this._radioDispatcher.notify(this.id,this.name),this._changeDetector.markForCheck())}get value(){return this._value}set value(t){this._value!==t&&(this._value=t,this.radioGroup!==null&&(this.checked||(this.checked=this.radioGroup.value===t),this.checked&&(this.radioGroup.selected=this)))}get labelPosition(){return this._labelPosition||this.radioGroup&&this.radioGroup.labelPosition||`after`}set labelPosition(t){this._labelPosition=t}_labelPosition;get disabled(){return this._disabled||this.radioGroup!==null&&this.radioGroup.disabled}set disabled(t){this._setDisabled(t)}get required(){return this._required||this.radioGroup&&this.radioGroup.required}set required(t){t!==this._required&&this._changeDetector.markForCheck(),this._required=t}get color(){return this._color||this.radioGroup&&this.radioGroup.color||this._defaultOptions&&this._defaultOptions.color||`accent`}set color(t){this._color=t}_color;get disabledInteractive(){return this._disabledInteractive||this.radioGroup!==null&&this.radioGroup.disabledInteractive}set disabledInteractive(t){this._disabledInteractive=t}_disabledInteractive;change=new Qe$1;radioGroup;get inputId(){return`${this.id||this._uniqueId}-input`}_checked=!1;_disabled=!1;_required=!1;_value=null;_removeUniqueSelectionListener=()=>{};_previousTabIndex;_inputElement;_rippleTrigger;_noopAnimations=nt$5();_injector=E(we$4);constructor(){E(be$3).load(ra$5);let t=E(sr$4,{optional:!0}),n=E(new Tg(`tabindex`),{optional:!0});this.radioGroup=t,this._disabledInteractive=this._defaultOptions?.disabledInteractive??!1,n&&(this.tabIndex=oj(n,0))}focus(t,n){n?this._focusMonitor.focusVia(this._inputElement,n,t):this._inputElement.nativeElement.focus(t)}_markForCheck(){this._changeDetector.markForCheck()}ngOnInit(){this.radioGroup&&(this.checked=this.radioGroup.value===this._value,this.checked&&(this.radioGroup.selected=this),this.name=this.radioGroup.name),this._removeUniqueSelectionListener=this._radioDispatcher.listen((t,n)=>{t!==this.id&&n===this.name&&(this.checked=!1)})}ngDoCheck(){this._updateTabIndex()}ngAfterViewInit(){this._updateTabIndex(),this._focusMonitor.monitor(this._elementRef,!0).subscribe(t=>{!t&&this.radioGroup&&this.radioGroup._touch()}),this._ngZone.runOutsideAngular(()=>{this._cleanupClick=this._renderer.listen(this._inputElement.nativeElement,`click`,this._onInputClick)})}ngOnDestroy(){this._cleanupClick?.(),this._focusMonitor.stopMonitoring(this._elementRef),this._removeUniqueSelectionListener()}_emitChangeEvent(){this.change.emit(new xt$4(this,this._value))}_isRippleDisabled(){return this.disableRipple||this.disabled}_onInputInteraction(t){if(t.stopPropagation(),!this.checked&&!this.disabled){let n=this.radioGroup&&this.value!==this.radioGroup.value;this.checked=!0,this._emitChangeEvent(),this.radioGroup&&(this.radioGroup._c
175ontrolValueAccessorChangeFn(this.value),n&&this.radioGroup._emitChangeEvent())}}_setDisabled(t){this._disabled!==t&&(this._disabled=t,this._changeDetector.markForCheck())}_onInputClick=t=>{this.disabled&&this.disabledInteractive&&t.preventDefault()};_updateTabIndex(){let t=this.radioGroup,n;if(!t||!t.selected||this.disabled?n=this.tabIndex:n=t.selected===this?this.tabIndex:-1,n!==this._previousTabIndex){let o=this._inputElement?.nativeElement;o&&(o.setAttribute(`tabindex`,n+``),this._previousTabIndex=n,wp$1(()=>{queueMicrotask(()=>{t&&t.selected&&t.selected!==this&&document.activeElement===o&&(t.selected?._inputElement.nativeElement.focus(),document.activeElement===o&&this._inputElement.nativeElement.blur())})},{injector:this._injector}))}}static ɵfac=function(n){return new(n||r)};static ɵcmp=PD({type:r,selectors:[[`mat-radio-button`]],viewQuery:function(n,o){if(n&1&&$h$2(_o$3,5)(Po$4,7,Lr$5),n&2){let a;Pw(a=Lw())&&(o._inputElement=a.first),Pw(a=Lw())&&(o._rippleTrigger=a.first)}},hostAttrs:[1,`mat-mdc-radio-button`],hostVars:19,hostBindings:function(n,o){n&1&&jh$3(`focus`,function(){return o._inputElement.nativeElement.focus()}),n&2&&(xh$2(`id`,o.id)(`tabindex`,null)(`aria-label`,null)(`aria-labelledby`,null)(`aria-describedby`,null),Yh$3(`mat-primary`,o.color===`primary`)(`mat-accent`,o.color===`accent`)(`mat-warn`,o.color===`warn`)(`mat-mdc-radio-checked`,o.checked)(`mat-mdc-radio-disabled`,o.disabled)(`mat-mdc-radio-disabled-interactive`,o.disabledInteractive)(`_mat-animation-noopable`,o._noopAnimations))},inputs:{id:`id`,name:`name`,ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`],ariaDescribedby:[0,`aria-describedby`,`ariaDescribedby`],disableRipple:[2,`disableRipple`,`disableRipple`,rj],tabIndex:[2,`tabIndex`,`tabIndex`,t=>t==null?0:oj(t)],checked:[2,`checked`,`checked`,rj],value:`value`,labelPosition:`labelPosition`,disabled:[2,`disabled`,`disabled`,rj],required:[2,`required`,`required`,rj],color:`color`,disabledInteractive:[2,`disabledInteractive`,`disabledInteractive`,rj]},outputs:{change:`change`},exportAs:[`matRadioButton`],ngContentSelectors:ko$4,decls:13,vars:17,consts:[[`formField`,``],[`input`,``],[`mat-internal-form-field`,``,3,`labelPosition`,`for`],[1,`mdc-radio`],[1,`mat-mdc-radio-touch-target`],[`type`,`radio`,`aria-invalid`,`false`,1,`mdc-radio__native-control`,3,`change`,`id`,`checked`,`disabled`,`required`],[`aria-hidden`,`true`,1,`mdc-radio__background`],[1,`mdc-radio__outer-circle`],[1,`mdc-radio__inner-circle`],[`mat-ripple`,``,`aria-hidden`,`true`,1,`mat-radio-ripple`,`mat-focus-indicator`,3,`matRippleTrigger`,`matRippleDisabled`,`matRippleCentered`],[1,`mat-ripple-element`,`mat-radio-persistent-ripple`],[1,`mat-internal-form-field-label`,`mdc-label`]],template:function(n,o){n&1&&(Rw(),Bi$3(0,`label`,2,0)(2,`span`,3),Rh$3(3,`span`,4),Bi$3(4,`input`,5,1),jh$3(`change`,function(i){return o._onInputInteraction(i)}),vl$4(),Bi$3(6,`span`,6),Rh$3(7,`span`,7)(8,`span`,8),vl$4(),Bi$3(9,`span`,9),Rh$3(10,`span`,10),vl$4()(),Bi$3(11,`span`,11),kw(12),vl$4()()),n&2&&(Ah$2(`labelPosition`,o.labelPosition)(`for`,o.inputId),sE(2),Yh$3(`mdc-radio--disabled`,o.disabled),sE(2),Ah$2(`id`,o.inputId)(`checked`,o.checked)(`disabled`,o.disabled&&!o.disabledInteractive)(`required`,o.required),xh$2(`name`,o.name)(`value`,o.value)(`aria-label`,o.ariaLabel)(`aria-labelledby`,o.ariaLabelledby)(`aria-describedby`,o.ariaDescribedby)(`aria-disabled`,o.disabled&&o.disabledInteractive?`true`:null),sE(5),Ah$2(`matRippleTrigger`,o._rippleTrigger.nativeElement)(`matRippleDisabled`,o._isRippleDisabled())(`matRippleCentered`,!0))},dependencies:[$h$3,m$2],styles:[`.mat-mdc-radio-button { 176 -webkit-tap-highlight-color: transparent; 177} 178.mat-mdc-radio-button .mdc-radio { 179 display: inline-block; 180 position: relative; 181 flex: 0 0 auto; 182 box-sizing: content-box; 183 width: 20px; 184 height: 20px; 185 will-change: opacity, transform, border-color, color; 186 padding: calc((var(--%NS%mat-radio-state-layer-size, 40px) - 20px) / 2); 187 cursor: pointer; 188} 189.mat-mdc-radio-button .mdc-radio:hover > .mdc-radio__native-control:not([disabled]):not(:focus) ~ .mdc-radio__background::before { 190 opacity: 0.04; 191 transform: scale(1); 192} 193.mat-mdc-radio-button .mdc-radio:hover > .mdc-radio__native-control:not([disabled]) ~ .mdc-radio__background > .mdc-radio__outer-circle { 194 border-color: var(--%NS%mat-radio-unselected-hover-icon-color, var(--%NS%mat-sys-on-surface)); 195} 196.mat-mdc-radio-button .mdc-radio:hover > .mdc-radio__native-control:enabled:checked + .mdc-radio__background > .mdc-radio__outer-circle { 197 border-color: var(--%NS%mat-radio-selected-hover-icon-color, var(--%NS%mat-sys-primary)); 198} 199.mat-mdc-radio-button .mdc-radio:hover > .mdc-radio__native-control:enabled:checked + .mdc-radio__background >
199 .mdc-radio__inner-circle { 200 background-color: var(--%NS%mat-radio-selected-hover-icon-color, var(--%NS%mat-sys-primary, currentColor)); 201} 202.mat-mdc-radio-button .mdc-radio:active > .mdc-radio__native-control:enabled:not(:checked) + .mdc-radio__background > .mdc-radio__outer-circle { 203 border-color: var(--%NS%mat-radio-unselected-pressed-icon-color, var(--%NS%mat-sys-on-surface)); 204} 205.mat-mdc-radio-button .mdc-radio:active > .mdc-radio__native-control:enabled:checked + .mdc-radio__background > .mdc-radio__outer-circle { 206 border-color: var(--%NS%mat-radio-selected-pressed-icon-color, var(--%NS%mat-sys-primary)); 207} 208.mat-mdc-radio-button .mdc-radio:active > .mdc-radio__native-control:enabled:checked + .mdc-radio__background > .mdc-radio__inner-circle { 209 background-color: var(--%NS%mat-radio-selected-pressed-icon-color, var(--%NS%mat-sys-primary, currentColor)); 210} 211.mat-mdc-radio-button .mdc-radio__background { 212 display: inline-block; 213 position: relative; 214 box-sizing: border-box; 215 width: 20px; 216 height: 20px; 217} 218.mat-mdc-radio-button .mdc-radio__background::before { 219 position: absolute; 220 transform: scale(0, 0); 221 border-radius: 50%; 222 opacity: 0; 223 pointer-events: none; 224 content: ""; 225 transition: opacity 90ms cubic-bezier(0.4, 0, 0.6, 1), transform 90ms cubic-bezier(0.4, 0, 0.6, 1); 226 width: var(--%NS%mat-radio-state-layer-size, 40px); 227 height: var(--%NS%mat-radio-state-layer-size, 40px); 228 top: calc(-1 * (var(--%NS%mat-radio-state-layer-size, 40px) - 20px) / 2); 229 left: calc(-1 * (var(--%NS%mat-radio-state-layer-size, 40px) - 20px) / 2); 230} 231.mat-mdc-radio-button .mdc-radio__outer-circle { 232 position: absolute; 233 top: 0; 234 left: 0; 235 box-sizing: border-box; 236 width: 100%; 237 height: 100%; 238 border-width: 2px; 239 border-style: solid; 240 border-radius: 50%; 241 transition: border-color 90ms cubic-bezier(0.4, 0, 0.6, 1); 242} 243.mat-mdc-radio-button .mdc-radio__inner-circle { 244 position: absolute; 245 top: 0; 246 left: 0; 247 box-sizing: border-box; 248 width: 100%; 249 height: 100%; 250 transform: scale(0); 251 border-radius: 50%; 252 transition: transform 90ms cubic-bezier(0.4, 0, 0.6, 1), background-color 90ms cubic-bezier(0.4, 0, 0.6, 1); 253} 254@media (forced-colors: active) { 255 .mat-mdc-radio-button .mdc-radio__inner-circle { 256 background-color: CanvasText !important; 257 } 258} 259.mat-mdc-radio-button .mdc-radio__native-control { 260 position: absolute; 261 margin: 0; 262 padding: 0; 263 opacity: 0; 264 top: 0; 265 right: 0; 266 left: 0; 267 cursor: inherit; 268 z-index: 1; 269 width: var(--%NS%mat-radio-state-layer-size, 40px); 270 height: var(--%NS%mat-radio-state-layer-size, 40px); 271} 272.mat-mdc-radio-button .mdc-radio__native-control:checked + .mdc-radio__background, .mat-mdc-radio-button .mdc-radio__native-control:disabled + .mdc-radio__background { 273 transition: opacity 90ms cubic-bezier(0, 0, 0.2, 1), transform 90ms cubic-bezier(0, 0, 0.2, 1); 274} 275.mat-mdc-radio-button .mdc-radio__native-control:checked + .mdc-radio__background > .mdc-radio__outer-circle, .mat-mdc-radio-button .mdc-radio__native-control:disabled + .mdc-radio__background > .mdc-radio__outer-circle { 276 transition: border-color 90ms cubic-bezier(0, 0, 0.2, 1); 277} 278.mat-mdc-radio-button .mdc-radio__native-control:checked + .mdc-radio__background > .mdc-radio__inner-circle, .mat-mdc-radio-button .mdc-radio__native-control:disabled + .mdc-radio__background > .mdc-radio__inner-circle { 279 transition: transform 90ms cubic-bezier(0, 0, 0.2, 1), background-color 90ms cubic-bezier(0, 0, 0.2, 1); 280} 281.mat-mdc-radio-button .mdc-radio__native-control:focus + .mdc-radio__background::before { 282 transform: scale(1); 283 opacity: 0.12; 284 transition: opacity 90ms cubic-bezier(0, 0, 0.2, 1), transform 90ms cubic-bezier(0, 0, 0.2, 1); 285} 286.mat-mdc-radio-button .mdc-radio__native-control:disabled:not(:checked) + .mdc-radio__background > .mdc-radio__outer-circle { 287 border-color: var(--%NS%mat-radio-disabled-unselected-icon-color, var(--%NS%mat-sys-on-surface)); 288 opacity: var(--%NS%mat-radio-disabled-unselected-icon-opacity, 0.38); 289} 290.mat-mdc-radio-button .mdc-radio__native-control:disabled + .mdc-radio__background { 291 cursor: default; 292} 293.mat-mdc-radio-button .mdc-radio__native-control:disabled + .mdc-radio__background > .mdc-radio__outer-circle { 294 border-color: var(--%NS%mat-radio-disabled-selected-icon-color, var(--%NS%mat-sys-on-surface)); 295 opacity: var(--%NS%mat-radio-disabled-selected-icon-opacity, 0.38); 296} 297.mat-mdc-radio-button .mdc-radio__native-control:disabled + .mdc-radio__background >
297 .mdc-radio__inner-circle { 298 background-color: var(--%NS%mat-radio-disabled-selected-icon-color, var(--%NS%mat-sys-on-surface, currentColor)); 299 opacity: var(--%NS%mat-radio-disabled-selected-icon-opacity, 0.38); 300} 301.mat-mdc-radio-button .mdc-radio__native-control:enabled:not(:checked) + .mdc-radio__background > .mdc-radio__outer-circle { 302 border-color: var(--%NS%mat-radio-unselected-icon-color, var(--%NS%mat-sys-on-surface-variant)); 303} 304.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked + .mdc-radio__background > .mdc-radio__outer-circle { 305 border-color: var(--%NS%mat-radio-selected-icon-color, var(--%NS%mat-sys-primary)); 306} 307.mat-mdc-radio-button .mdc-radio__native-control:enabled:checked + .mdc-radio__background > .mdc-radio__inner-circle { 308 background-color: var(--%NS%mat-radio-selected-icon-color, var(--%NS%mat-sys-primary, currentColor)); 309} 310.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked + .mdc-radio__background > .mdc-radio__outer-circle { 311 border-color: var(--%NS%mat-radio-selected-focus-icon-color, var(--%NS%mat-sys-primary)); 312} 313.mat-mdc-radio-button .mdc-radio__native-control:enabled:focus:checked + .mdc-radio__background > .mdc-radio__inner-circle { 314 background-color: var(--%NS%mat-radio-selected-focus-icon-color, var(--%NS%mat-sys-primary, currentColor)); 315} 316.mat-mdc-radio-button .mdc-radio__native-control:checked + .mdc-radio__background > .mdc-radio__inner-circle { 317 transform: scale(0.5); 318 transition: transform 90ms cubic-bezier(0, 0, 0.2, 1), background-color 90ms cubic-bezier(0, 0, 0.2, 1); 319} 320.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled { 321 pointer-events: auto; 322} 323.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:not(:checked) + .mdc-radio__background > .mdc-radio__outer-circle { 324 border-color: var(--%NS%mat-radio-disabled-unselected-icon-color, var(--%NS%mat-sys-on-surface)); 325 opacity: var(--%NS%mat-radio-disabled-unselected-icon-opacity, 0.38); 326} 327.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--%NS%disabled:hover .mdc-radio__native-control:checked + .mdc-radio__background > .mdc-radio__outer-circle, 328.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus + .mdc-radio__background > .mdc-radio__outer-circle, 329.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control + .mdc-radio__background > .mdc-radio__outer-circle { 330 border-color: var(--%NS%mat-radio-disabled-selected-icon-color, var(--%NS%mat-sys-on-surface)); 331 opacity: var(--%NS%mat-radio-disabled-selected-icon-opacity, 0.38); 332} 333.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--%NS%disabled:hover .mdc-radio__native-control:checked + .mdc-radio__background > .mdc-radio__inner-circle, 334.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control:checked:focus + .mdc-radio__background > .mdc-radio__inner-circle, 335.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__native-control + .mdc-radio__background > .mdc-radio__inner-circle { 336 background-color: var(--%NS%mat-radio-disabled-selected-icon-color, var(--%NS%mat-sys-on-surface, currentColor)); 337 opacity: var(--%NS%mat-radio-disabled-selected-icon-opacity, 0.38); 338} 339.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__background::before, 340.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__outer-circle, 341.mat-mdc-radio-button._mat-animation-noopable .mdc-radio__inner-circle { 342 transition: none !important; 343} 344.mat-mdc-radio-button .mat-internal-form-field-label:empty { 345 display: none; 346} 347.mat-mdc-radio-button .mdc-radio__background::before { 348 background-color: var(--%NS%mat-radio-ripple-color, var(--%NS%mat-sys-on-surface)); 349} 350.mat-mdc-radio-button.mat-mdc-radio-checked .mat-ripple-element, 351.mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__background::before { 352 background-color: var(--%NS%mat-radio-checked-ripple-color, var(--%NS%mat-sys-primary)); 353} 354.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mat-ripple-element, 355.mat-mdc-radio-button.mat-mdc-radio-disabled-interactive .mdc-radio--disabled .mdc-radio__background::before { 356 background-color: var(--%NS%mat-radio-ripple-color, var(--%NS%mat-sys-on-surface)); 357} 358.mat-mdc-radio-button .mat-internal-form-field { 359 color: var(--%NS%mat-radio-label-text-color, var(--%NS%mat-sys-on-surface)); 360 font-family: var(--%NS%mat-radio-label-text-font, var(--%NS%mat-sys-body-medium-font)); 361 line-height: var(--%NS%mat-radio-label-text-line-height, var(--%NS%mat-sys-body-medium-line-height)); 362 font-size: var(--%NS%mat-radio-label-text-size, var(--%NS%mat-sys-body-medium-size)); 363 letter-spacing: var(--%NS%mat-radio-label-text-tracking, var(--%NS%mat-sys-body-medium-tracking)); 364 font-weight: var(--%NS%mat-radio-label-text-weight, var(--%NS%mat-sys-body-medium-weight)); 365 cursor: pointer; 366} 367.mat-mdc-radio-button .mdc-radio--disabled + .mat-internal-form-field-label { 368 color: var(--%NS%mat-radio-disabled-label-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 369} 370.mat-mdc-radio-button .mat-radio-ripple { 371 top: 0; 372 left: 0; 373 right: 0; 374 bottom: 0; 375 position: absolute; 376 pointer-events: none; 377 border-radius: 50%; 378} 379.mat-mdc-radio-button .mat-radio-ripple > .mat-ripple-element { 380 opacity: 0.14; 381} 382.mat-mdc-radio-button .mat-radio-ripple::before { 383 border-radius: 50%; 384} 385.mat-mdc-radio-button .mdc-radio > .mdc-radio__native-control:focus:enabled:not(:checked) ~ .mdc-radio__background > .mdc-radio__outer-circle { 386 border-color: var(--%NS%mat-radio-unselected-focus-icon-color, var(--%NS%mat-sys-on-surface)); 387} 388.mat-mdc-radio-button.cdk-focused .mat-focus-indicator::before { 389 content: ""; 390} 391 392.mat-mdc-radio-disabled { 393 cursor: default; 394 pointer-events: none; 395} 396.mat-mdc-radio-disabled.mat-mdc-radio-disabled-interactive { 397 pointer-events: auto; 398} 399 400.mat-mdc-radio-touch-target { 401 position: absolute; 402 top: 50%; 403 left: 50%; 404 height: var(--%NS%mat-radio-touch-target-size, 48px); 405 width: var(--%NS%mat-radio-touch-target-size, 48px); 406 transform: translate(-50%, -50%); 407 display: var(--%NS%mat-radio-touch-target-display, block); 408} 409[dir=rtl] .mat-mdc-radio-touch-target { 410 left: auto; 411 right: 50%; 412 transform: translate(50%, -50%); 413} 414`],encapsulation:2})}return r})();var lr$3=(()=>{class r{static ɵfac=function(n){return new(n||r)};static ɵmod=FD({type:r});static ɵinj=ju$1({imports:[aa$4,Ct$4,xn$4]})}return r})();
414function So$4(r,e){r&1&&(Bi$3(0,`p`,1),lC(1),OC(2,`translate`),vl$4()),r&2&&(sE(),Cl$4(` `,LC(2,1,`createTraining.recurrenceDescription`),` `))}function Mo$4(r,e){if(r&1){let t=Cw();Bi$3(0,`app-daily-recurrence-input`,12),jh$3(`dayCountChange`,function(o){ld$2(t);return ud$1(xw().dayCountChange.emit(o))}),vl$4()}if(r&2){let t=xw();Ah$2(`startDate`,t.startDate)(`programEndDate`,t.programEndDate)(`dayCount`,t.dayCount)}}var cr$4=class r{value=`none`;showDescription=!0;valueChange=new Qe$1;startDate;programEndDate;dayCount;dayCountChange=new Qe$1;RecurrenceType=D$5;onRecurrenceTypeChange(e){this.valueChange.emit(e)}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-recurrence-options`]],inputs:{value:`value`,showDescription:`showDescription`,startDate:`startDate`,programEndDate:`programEndDate`,dayCount:`dayCount`},outputs:{valueChange:`valueChange`,dayCountChange:`dayCountChange`},decls:44,vars:31,consts:[[1,`recurrence-options-container`],[1,`text-muted`,`mb-3`],[1,`recurrence-options`,3,`change`,`value`],[1,`recurrence-option`,2,`order`,`1`],[3,`value`],[1,`option-content`],[1,`option-text`],[1,`option-description`],[1,`recurrence-option`,2,`order`,`2`],[1,`recurrence-option`,2,`order`,`4`],[1,`recurrence-option`,2,`order`,`5`],[1,`daily-recurrence-input-slot`,3,`startDate`,`programEndDate`,`dayCount`],[1,`daily-recurrence-input-slot`,3,`dayCountChange`,`startDate`,`programEndDate`,`dayCount`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0),fw(1,So$4,3,3,`p`,1),Bi$3(2,`mat-radio-group`,2),jh$3(`change`,function(a){return n.onRecurrenceTypeChange(a.value)}),Bi$3(3,`div`,3)(4,`mat-radio-button`,4)(5,`div`,5)(6,`div`,6)(7,`strong`),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`p`,7),lC(11),OC(12,`translate`),vl$4()()()()(),Bi$3(13,`div`,8)(14,`mat-radio-button`,4)(15,`div`,5)(16,`div`,6)(17,`strong`),lC(18),OC(19,`translate`),vl$4(),Bi$3(20,`p`,7),lC(21),OC(22,`translate`),vl$4()()()()(),Bi$3(23,`div`,9)(24,`mat-radio-button`,4)(25,`div`,5)(26,`div`,6)(27,`strong`),lC(28),OC(29,`translate`),vl$4(),Bi$3(30,`p`,7),lC(31),OC(32,`translate`),vl$4()()()()(),Bi$3(33,`div`,10)(34,`mat-radio-button`,4)(35,`div`,5)(36,`div`,6)(37,`strong`),lC(38),OC(39,`translate`),vl$4(),Bi$3(40,`p`,7),lC(41),OC(42,`translate`),vl$4()()()()()(),fw(43,Mo$4,1,3,`app-daily-recurrence-input`,11),vl$4()),t&2&&(sE(),pw(n.showDescription?1:-1),sE(),Ah$2(`value`,n.value),sE(2),Ah$2(`value`,n.RecurrenceType.None),sE(4),ig(LC(9,15,`trainingProgram.noRecurrence`)),sE(3),Cl$4(` `,LC(12,17,`trainingProgram.noRecurrenceDescription`),` `),sE(3),Ah$2(`value`,n.RecurrenceType.Daily),sE(4),ig(LC(19,19,`trainingProgram.dailyRecurrence`)),sE(3),Cl$4(` `,LC(22,21,`trainingProgram.dailyRecurrenceDescription`),` `),sE(3),Ah$2(`value`,n.RecurrenceType.Weekly),sE(4),ig(LC(29,23,`trainingProgram.weeklyRecurrence`)),sE(3),Cl$4(` `,LC(32,25,`trainingProgram.weeklyRecurrenceDescription`),` `),sE(3),Ah$2(`value`,n.RecurrenceType.Monthly),sE(4),ig(LC(39,27,`trainingProgram.monthlyRecurrence`)),sE(3),Cl$4(` `,LC(42,29,`trainingProgram.monthlyRecurrenceDescription`),` `),sE(2),pw(n.value===n.RecurrenceType.Daily&&n.startDate&&n.programEndDate?43:-1))},dependencies:[lr$3,Nt$5,Ct$4,kt$5,Xp$1],styles:[`.recurrence-options-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:5px;width:100%}.recurrence-options-container[_ngcontent-%COMP%] .recurrence-options[_ngcontent-%COMP%]{display:contents}.recurrence-options-container[_ngcontent-%COMP%] .daily-recurrence-input-slot[_ngcontent-%COMP%]{order:3}.recurrence-options-container[_ngcontent-%COMP%] .recurrence-option[_ngcontent-%COMP%]{border-radius:8px;padding:0;transition:all .2s ease}.recurrence-options-container[_ngcontent-%COMP%] .recurrence-option[_ngcontent-%COMP%]:hover{border-color:#ccc;box-shadow:0 2px 4px #0000001a}.recurrence-options-container[_ngcontent-%COMP%] .recurrence-option[_ngcontent-%COMP%] mat-radio-button[_ngcontent-%COMP%]{width:100%;display:flex;align-items:flex-start;padding:5px}.recurrence-options-container[_ngcontent-%COMP%] .recurrence-option[_ngcontent-%COMP%] mat-radio-button[_ngcontent-%COMP%] .mdc-radio[_ngcontent-%COMP%]{margin-right:12px;margin-top:2px;flex-shrink:0}.recurrence-options-container[_ngcontent-%COMP%] .recurrence-option[_ngcontent-%COMP%] mat-radio-button[_ngcontent-%COMP%] .mdc-form-field[_ngcontent-%COMP%]{width:100%}.recurrence-options-container[_ngcontent-%COMP%] .option-content[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%}.recurrence-options-container[_ngcontent-%COMP%] .option-text[_ngcontent-%COMP%]{flex:1}.recurrence-options-container[_ngcontent-%COMP%] .option-text[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{display:block;margin-bottom:4px;font-size:16px;color:var(--%NS%primaryWhite)}.recurrence-options-container[_ngcontent-%COMP%] .option-text[_ngcontent-%COMP%] .option-description[_ngcontent-%COMP%]{margin:0;font-size:14px;color:var(--%NS%primaryWhite);line-height:1.4}`]})};var Eo$4=r=>({day:r});var Do$4=r=>({count:r});var Ro$4=(r,e)=>e.value;function Io$4(r,e){if(r&1){let t=Cw();Bi$3(0,`button`,11),jh$3(`click`,function(){let o=ld$2(t).$implicit;return ud$1(xw().setInterval(o.value))}),lC(1),OC(2,`translate`),vl$4()}if(r&2){let t=e.$implicit;Yh$3(`active`,xw().intervalDays()===t.value),sE(),Cl$4(` `,LC(2,3,t.i18nKey),` `)}}function To$3(r,e){if(r&1){let t=Cw();Bi$3(0,`mat-form-field`,5)(1,`mat-label`),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`input`,12),jh$3(`input`,function(o){ld$2(t);return ud$1(xw().onEndDayOffsetInput(o))}),vl$4()()}if(r&2){let t=xw();
414sE(2),ig(LC(3,4,`coachingTracks.repeatEndDayOffset`)),sE(2),Ah$2(`min`,t.dayOffsetDisplay())(`max`,t.maxProgramDay())(`value`,t.endDayOffsetDisplay())}}function Oo$3(r,e){if(r&1){let t=Cw();Bi$3(0,`mat-form-field`,5)(1,`mat-label`),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`input`,6),jh$3(`input`,function(o){ld$2(t);return ud$1(xw().onOccurrenceCountInput(o))}),vl$4()(),Bi$3(5,`span`,13),lC(6),OC(7,`translate`),vl$4()}if(r&2){let t=xw();sE(2),ig(LC(3,3,`coachingTracks.repeatOccurrenceCount`)),sE(2),Ah$2(`value`,t.occurrenceCountDraft()),sE(2),Cl$4(` `,FC(7,5,`coachingTracks.endsOnDayHint`,bC(8,Eo$4,t.endDayOffsetDisplay())),` `)}}function No$4(r,e){if(r&1&&(Bi$3(0,`span`,9),lC(1),OC(2,`translate`),vl$4()),r&2){let t=xw();sE(),Cl$4(` `,FC(2,1,`coachingTracks.occurrenceCount`,bC(4,Do$4,t.occurrenceCount())),` `)}}function Ao$4(r,e){r&1&&(Bi$3(0,`span`,10),lC(1),OC(2,`translate`),vl$4()),r&2&&(sE(),Cl$4(` `,LC(2,1,`coachingTracks.occurrenceCountInvalid`),` `))}var dr$4=class r{dayOffset=Q1.required();intervalDays=Q1.required();endDayOffset=Q1.required();maxOccurrences=Q1(200);maxDayOffset=Q1(void 0);intervalDaysChange=z1();endDayOffsetChange=z1();dayOffsetDisplay=$C(()=>C$2(this.dayOffset()));endDayOffsetDisplay=$C(()=>C$2(this.endDayOffset()));maxProgramDay=$C(()=>{let e=this.maxDayOffset();return e===void 0?null:C$2(e)});intervalPresets=[{value:1,i18nKey:`coachingTracks.intervalPreset.daily`},{value:2,i18nKey:`coachingTracks.intervalPreset.every2`},{value:3,i18nKey:`coachingTracks.intervalPreset.every3`},{value:7,i18nKey:`coachingTracks.intervalPreset.weekly`}];endsMode=ni$3(`day`);occurrenceCountDraft=ni$3(1);occurrenceCount=$C(()=>{let e=this.dayOffset(),t=this.intervalDays(),n=this.endDayOffset();return t<1||n<e?0:Math.floor((n-e)/t)+1});occurrenceCountInvalid=$C(()=>{let e=this.occurrenceCount();return e<1||e>this.maxOccurrences()});constructor(){xd$2(()=>{let e=this.dayOffset(),t=this.intervalDays(),n=this.occurrenceCountDraft();this.endsMode()===`count`&&this.endDayOffsetChange.emit(this.clampDayOffset(e+(n-1)*t))})}clampDayOffset(e){let t=this.maxDayOffset(),n=t===void 0?e:Math.min(t,e);return Math.max(this.dayOffset(),n)}setInterval(e){this.intervalDaysChange.emit(e)}onIntervalInput(e){let t=Math.max(1,Number(e.target.value||1));this.setInterval(t)}onEndDayOffsetInput(e){let t=Number(e.target.value||this.dayOffsetDisplay());this.endDayOffsetChange.emit(this.clampDayOffset(U$3(t)))}setEndsMode(e){e!==this.endsMode()&&(e===`count`&&this.occurrenceCountDraft.set(Math.max(1,this.occurrenceCount())),this.endsMode.set(e))}onOccurrenceCountInput(e){let t=Math.max(1,Number(e.target.value||1));this.occurrenceCountDraft.set(t)}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-repeat-schedule-fields`]],inputs:{dayOffset:[1,`dayOffset`],intervalDays:[1,`intervalDays`],endDayOffset:[1,`endDayOffset`],maxOccurrences:[1,`maxOccurrences`],maxDayOffset:[1,`maxDayOffset`]},outputs:{intervalDaysChange:`intervalDaysChange`,endDayOffsetChange:`endDayOffsetChange`},decls:29,vars:22,consts:[[1,`repeat-fields`],[1,`repeat-row`],[1,`repeat-row-label`],[1,`repeat-presets`],[`type`,`button`,1,`repeat-preset-chip`,3,`active`],[`appearance`,`outline`,1,`repeat-field`],[`matInput`,``,`type`,`number`,`min`,`1`,3,`input`,`value`],[1,`ends-mode-toggle`],[`type`,`button`,1,`ends-mode-button`,3,`click`],[1,`occurrence-count`],[1,`occurrence-count`,`occurrence-count-error`],[`type`,`button`,1,`repeat-preset-chip`,3,`click`],[`matInput`,``,`type`,`number`,3,`input`,`min`,`max`,`value`],[1,`ends-on-hint`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`div`,1)(2,`span`,2),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`div`,3),mw(6,Io$4,3,5,`button`,4,Ro$4),vl$4(),Bi$3(8,`mat-form-field`,5)(9,`mat-label`),lC(10),OC(11,`translate`),vl$4(),Bi$3(12,`input`,6),jh$3(`input`,function(a){return n.onIntervalInput(a)}),vl$4()()(),Bi$3(13,`div`,1)(14,`span`,2),lC(15),OC(16,`translate`),vl$4(),Bi$3(17,`div`,7)(18,`button`,8),jh$3(`click`,function(){return n.setEndsMode(`day`)}
414),lC(19),OC(20,`translate`),vl$4(),Bi$3(21,`button`,8),jh$3(`click`,function(){return n.setEndsMode(`count`)}),lC(22),OC(23,`translate`),vl$4()(),fw(24,To$3,5,6,`mat-form-field`,5)(25,Oo$3,8,10),vl$4(),Bi$3(26,`div`,1),fw(27,No$4,3,6,`span`,9)(28,Ao$4,3,3,`span`,10),vl$4()()),t&2&&(sE(3),ig(LC(4,12,`coachingTracks.repeatEvery`)),sE(3),yw(n.intervalPresets),sE(4),ig(LC(11,14,`coachingTracks.repeatIntervalDays`)),sE(2),Ah$2(`value`,n.intervalDays()),sE(3),ig(LC(16,16,`coachingTracks.repeatEnds`)),sE(3),Yh$3(`active`,n.endsMode()===`day`),sE(),Cl$4(` `,LC(20,18,`coachingTracks.endsOnDay`),` `),sE(2),Yh$3(`active`,n.endsMode()===`count`),sE(),Cl$4(` `,LC(23,20,`coachingTracks.endsAfterCount`),` `),sE(2),pw(n.endsMode()===`day`?24:25),sE(3),pw(n.occurrenceCountInvalid()?28:27))},dependencies:[Zi$3,en$4,je$3,X$5,Be$2,Pe$4,Xp$1],styles:[`.repeat-fields[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;width:100%}.repeat-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}.repeat-row-label[_ngcontent-%COMP%]{flex-shrink:0;font-size:.7rem;letter-spacing:.06em;text-transform:uppercase;color:var(--%NS%gray-link-color);font-weight:600}.repeat-presets[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.repeat-preset-chip[_ngcontent-%COMP%]{padding:.25rem .625rem;border-radius:999px;border:1px solid var(--%NS%border-color);background:transparent;color:var(--%NS%text-color);font-size:.75rem;cursor:pointer}.repeat-preset-chip.active[_ngcontent-%COMP%]{background:var(--%NS%primarylime);color:var(--%NS%primaryBlack);border-color:var(--%NS%primarylime);font-weight:600}.repeat-field[_ngcontent-%COMP%]{width:180px;flex-shrink:0}.ends-mode-toggle[_ngcontent-%COMP%]{display:flex;gap:.25rem;padding:.2rem;border-radius:999px;background:var(--%NS%box-color)}.ends-mode-button[_ngcontent-%COMP%]{padding:.375rem .875rem;border-radius:999px;border:none;background:transparent;color:var(--%NS%text-color);font-size:.8rem;cursor:pointer}.ends-mode-button.active[_ngcontent-%COMP%]{background:var(--%NS%primarylime);color:var(--%NS%primaryBlack);font-weight:600}.ends-on-hint[_ngcontent-%COMP%], .occurrence-count[_ngcontent-%COMP%]{font-size:.8rem;color:var(--%NS%gray-link-color)}.occurrence-count-error[_ngcontent-%COMP%]{color:var(--%NS%primaryRed)}`]})};function Fo$3(r,e){if(r&1&&(Bi$3(0,`p`,5),lC(1),vl$4()),r&2){let t=xw();sE(),Cl$4(` `,t.data.description,` `)}}function Wo$4(r,e){if(r&1&&(Bi$3(0,`mat-icon`,10),lC(1),vl$4()),r&2){let t=xw().$implicit;sE(),Cl$4(` `,t.icon,` `)}}function zo$4(r,e){if(r&1&&(Bi$3(0,`p`,12),lC(1),vl$4()),r&2){let t=xw().$implicit;sE(),Cl$4(` `,t.description,` `)}}function Bo$4(r,e){if(r&1){let t=Cw();Bi$3(0,`mat-card`,8),jh$3(`pointerup`,function(){let o=ld$2(t).$implicit;return ud$1(xw().selectOption(o))}),Bi$3(1,`mat-card-content`,9),fw(2,Wo$4,2,1,`mat-icon`,10),Bi$3(3,`h3`,11),lC(4),vl$4(),fw(5,zo$4,2,1,`p`,12),vl$4()()}if(r&2){let t=e.$implicit;sE(2),pw(t.icon?2:-1),sE(2),Cl$4(` `,t.title,` `),sE(),pw(t.description?5:-1)}}var pr$4=class r{dialogRef=E(f$3);data=E(de$3);selectOption(e){this.dialogRef.close(e.value)}closeDialog(){this.dialogRef.close()}getGridClass(){return`grid-cols-1 md:grid-cols-${this.data.gridColumns??(this.data.options.length<=2?this.data.options.length:2)}`}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-selection-dialog`]],decls:10,vars:4,consts:[[1,`selection-dialog-container`,`p-6`],[1,`close-button`,3,`closed`],[1,`dialog-header`,`flex`,`justify-between`,`items-center`,`mb-6`],[1,`secondary-title`],[1,`dialog-content`,`mb-6`],[1,`text-base`,`mb-6`,`text-gray-400`],[1,`grid`,`gap-4`],[1,`selection-card`,`cursor-pointer`,`hover:shadow-lg`,`transition-shadow`,`duration-200`],[1,`selection-card`,`cursor-pointer`,`hover:shadow-lg`,`transition-shadow`,`duration-200`,3,`pointerup`],[1,`text-center`,`p-6`],[1,`text-6xl`,`mb-4`],[1,`text-xl`,`font-medium`,`mb-2`],[1,`text-gray-600`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`app-dialog-close-button`,1),jh$3(`closed`,function(){return n.closeDialog()}),vl$4(),Bi$3(2,`div`,2)(3,`h2`,3),lC(4),vl$4()(),Bi$3(5,`div`,4),fw(6,Fo$3,2,1,`p`,5),Bi$3(7,`div`,6),mw(8,Bo$4,6,3,`mat-card`,7,gw),vl$4()()()),t&2&&(sE(4),Cl$4(` `,n.data.title,` `),sE(2),pw(n.data.description?6:-1),sE(),Xw(n.getGridClass()),sE(),yw(n.data.options))},dependencies:[Ap$1,yt$7,wt$5,X$4,_t$8,yt$6,vt$6],styles:[`.selection-dialog-container[_ngcontent-%COMP%]{max-width:37.5rem;min-width:25rem}.selection-card[_ngcontent-%COMP%]{transition:all .2s ease-in-out;border:2px solid transparent}.selection-card[_ngcontent-%COMP%]:hover{border-color:#e0e0e0;transform:translateY(-2px)}.selection-card[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{display:block;margin:0 auto 16px}@media(max-width:600px){.selection-dialog-container[_ngcontent-%COMP%]{min-width:300px;padding:16px}.dialog-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:1.5rem}.selection-card[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem}}`]})};function jo$4(r,e){if(r&1){let t=Cw();Bi$3(0,`button`,2),jh$3(`pointerup`,function(){let o=ld$2(t).$implicit;return ud$1(xw().selectRating(o))})(`keydown`,function(o){let a=ld$2(t).$implicit;return ud$1(xw().onKeydown(o,a))})(`mouseenter`,function(){let o=ld$2(t).$implicit;return ud$1(xw().hoverRating.set(o))})(`mouseleave`,function(){ld$2(t);return ud$1(xw().hoverRating.set(0))}),Bi$3(1,`mat-icon`,3),lC(2,` star `),vl$4()()}if(r&2){let t=e.$implicit,n=xw();Ah$2(`tabindex`,t===(n.value()||1)?0:-1),xh$2(`aria-checked`,t===n.value())(`aria-label`,t+`/5`),sE(),Yh$3(`icon-filled`,t<=(n.hoverRating()||n.value(
414)))(`text-yellow-500`,t<=(n.hoverRating()||n.value()))(`text-gray-400`,t>(n.hoverRating()||n.value()))}}var ur$4=class r{value=Z1(0);label=Q1(``);hoverRating=ni$3(0);stars=[1,2,3,4,5];selectRating(e){this.value.set(e)}onKeydown(e,t){let n=null;e.key===`ArrowRight`||e.key===`ArrowUp`?n=t<5?t+1:1:(e.key===`ArrowLeft`||e.key===`ArrowDown`)&&(n=t>1?t-1:5),n!==null&&(e.preventDefault(),this.selectRating(n),e.target.parentElement?.querySelectorAll(`button`)?.[n-1]?.focus())}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-star-rating`]],inputs:{value:[1,`value`],label:[1,`label`]},outputs:{value:`valueChange`},decls:3,vars:1,consts:[[`role`,`radiogroup`,1,`star-rating`,`flex`,`gap-1`],[`type`,`button`,`role`,`radio`,1,`star-btn`,`cursor-pointer`,`border-0`,`bg-transparent`,`p-0`,3,`tabindex`],[`type`,`button`,`role`,`radio`,1,`star-btn`,`cursor-pointer`,`border-0`,`bg-transparent`,`p-0`,3,`pointerup`,`keydown`,`mouseenter`,`mouseleave`,`tabindex`],[1,`text-3xl`,`transition-colors`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0),mw(1,jo$4,3,9,`button`,1,gw),vl$4()),t&2&&(xh$2(`aria-label`,n.label()),sE(),yw(n.stars))},dependencies:[yt$7,wt$5],styles:[`.star-btn[_ngcontent-%COMP%]{outline:none;line-height:1}.star-btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--%NS%primary);outline-offset:2px;border-radius:4px}`]})};var mr$4=class r{dialogRef=E(f$3);router=E(G$4);loginService=E(ne$3);goToBilling(){this.dialogRef.close(),this.router.navigate([`/manager/billing`])}logout(){this.loginService.logout()}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-trial-expired-dialog`]],decls:15,vars:12,consts:[[1,`trial-expired-dialog-container`,`p-6`],[1,`warning-icon`],[1,`secondary-title`],[1,`text-base`],[`mat-flat-button`,``,`color`,`primary`,3,`pointerup`],[`mat-button`,``,3,`pointerup`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`mat-icon`,1),lC(2,`error_outline`),vl$4(),Bi$3(3,`h2`,2),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`,3),lC(7),OC(8,`translate`),vl$4(),Bi$3(9,`button`,4),jh$3(`pointerup`,function(){return n.goToBilling()}),lC(10),OC(11,`translate`),vl$4(),Bi$3(12,`button`,5),jh$3(`pointerup`,function(){return n.logout()}),lC(13),OC(14,`translate`),vl$4()()),t&2&&(sE(4),ig(LC(5,4,`manager.billing.trialExpiredDialog.title`)),sE(3),ig(LC(8,6,`manager.billing.trialExpiredDialog.message`)),sE(3),Cl$4(` `,LC(11,8,`manager.billing.trialExpiredDialog.cta`),` `),sE(3),Cl$4(` `,LC(14,10,`common.logout`),` `))},dependencies:[Ap$1,wp$2,yt$7,wt$5,Xp$1],styles:[`[_nghost-%COMP%]{display:block;box-sizing:border-box;background-color:var(--%NS%dialog-dark-background);border-radius:10px;box-shadow:0 12px 40px #0000008c,0 0 0 1px #ffffff0f}.dialog-styling[_nghost-%COMP%], .dialog-styling [_nghost-%COMP%]{background-color:transparent;border-radius:0;box-shadow:none}.trial-expired-dialog-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center}.warning-icon[_ngcontent-%COMP%]{width:2.5rem;height:2.5rem;font-size:2.5rem;color:var(--%NS%warn, #e57373)}.secondary-title[_ngcontent-%COMP%]{margin:0}.text-base[_ngcontent-%COMP%]{margin:0 0 8px;line-height:1.5;color:var(--%NS%text-color, #333)}`]})};function Lo$4(r,e){if(r&1&&(Il$4(0,`div`,0),lC(1),El$4()),r&2){let t=xw();sE(),ig(t.version())}}var gr$4=class r{configService=E(kR);version=$C(()=>this.configService.config().appVersion);static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-version-watermark`]],decls:1,vars:1,consts:[[1,`version-badge`]],template:function(t,n){t&1&&fw(0,Lo$4,2,1,`div`,0),t&2&&pw(n.version()?0:-1)},styles:[`.version-badge[_ngcontent-%COMP%]{position:fixed;bottom:8px;right:8px;padding:2px 8px;background-color:#0009;color:#ffffffb3;font-size:10px;font-family:monospace;border-radius:4px;z-index:9999;pointer-events:none;-webkit-user-select:none;user-select:none}`]})};var Ho$4=(r,e)=>e.label;var Uo$4=(r,e)=>e.isoWeek;function qo$4(r,e){if(r&1&&lC(0),r&2)Cl$4(` `,xw().selectedLabel(),` `)}function Vo$4(r,e){r&1&&(lC(0),OC(1,`translate`)),r&2&&Cl$4(` `,LC(1,1,`common.weekPicker.selectWeek`),` `)}
414function $o$4(r,e){r&1&&(Bi$3(0,`span`,10),lC(1),OC(2,`translate`),vl$4()),r&2&&(sE(),ig(LC(2,1,`common.weekPicker.currentWeek`)))}function Go$4(r,e){if(r&1){let t=Cw();Bi$3(0,`button`,7),jh$3(`click`,function(){let o=ld$2(t).$implicit;return ud$1(xw(3).selectWeek(o))}),Bi$3(1,`span`,8),lC(2),vl$4(),Bi$3(3,`span`,9),lC(4),vl$4(),fw(5,$o$4,3,3,`span`,10),vl$4()}if(r&2){let t=e.$implicit,n=xw(3);Yh$3(`week-picker__week--selected`,n.isSelected(t))(`week-picker__week--current`,t.isCurrentWeek),sE(2),Cl$4(`W`,t.weekNumber),sE(2),sg(` `,n.formatShortDate(t.monday),` â `,n.formatShortDate(t.sunday),` `),sE(),pw(t.isCurrentWeek?5:-1)}}function Yo$4(r,e){if(r&1&&(Bi$3(0,`div`,4)(1,`div`,5),lC(2),vl$4(),mw(3,Go$4,6,8,`button`,6,Uo$4),vl$4()),r&2){let t=e.$implicit;sE(2),ig(t.label),sE(),yw(t.weeks)}}function Zo$4(r,e){if(r&1&&(Bi$3(0,`div`,3),mw(1,Yo$4,5,1,`div`,4,Ho$4),vl$4()),r&2){let t=xw();sE(),yw(t.weekGroups())}}var hr$4=class r{value=Q1(null);weeksToShow=Q1(12);weekSelected=z1();expanded=ni$3(!1);monthNames=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];weekGroups=$C(()=>{let e=this.weeksToShow(),t=new Date,n=this.getMondayOfWeek(t),o=[];for(let i=0;i<=e;i++){let c=new Date(n);c.setDate(c.getDate()+i*7);let b=new Date(c);b.setDate(b.getDate()+6),o.push({isoWeek:this.toIsoWeek(c),weekNumber:this.getIsoWeekNumber(c),monday:c,sunday:b,isCurrentWeek:i===0})}let a=new Map;for(let i of o){let c=`${i.monday.getFullYear()}-${i.monday.getMonth()}`;a.has(c)||a.set(c,{label:`${this.monthNames[i.monday.getMonth()]} ${i.monday.getFullYear()}`,weeks:[]}),a.get(c).weeks.push(i)}return Array.from(a.values())});selectedLabel=$C(()=>{let e=this.value();if(!e)return null;let n=this.weekGroups().flatMap(o=>o.weeks).find(o=>o.isoWeek===e);return n?`W${n.weekNumber}: ${this.formatShortDate(n.monday)} \u2013 ${this.formatShortDate(n.sunday)}`:e});toggleExpanded(){this.expanded.update(e=>!e)}selectWeek(e){this.value()===e.isoWeek?this.weekSelected.emit(null):this.weekSelected.emit(e.isoWeek),this.expanded.set(!1)}isSelected(e){return this.value()===e.isoWeek}getMondayOfWeek(e){let t=new Date(e),n=t.getDay(),o=t.getDate()-n+(n===0?-6:1);return t.setDate(o),t.setHours(0,0,0,0),t}getIsoWeekNumber(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let n=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-n.getTime())/864e5+1)/7)}toIsoWeek(e){let t=this.getIsoWeekNumber(e),n=new Date(e);return n.setDate(n.getDate()+3),`${n.getFullYear()}-W${String(t).padStart(2,`0`)}`}formatShortDate(e){return`${e.getDate()}.${e.getMonth()+1}.`}static ɵfac=function(t){return new(t||r)};static ɵcmp=PD({type:r,selectors:[[`app-week-picker`]],inputs:{value:[1,`value`],weeksToShow:[1,`weeksToShow`]},outputs:{weekSelected:`weekSelected`},decls:8,vars:3,consts:[[1,`week-picker`],[`type`,`button`,1,`week-picker__toggle`,3,`click`],[1,`week-picker__label`],[1,`week-picker__dropdown`],[1,`week-picker__month`],[1,`week-picker__month-label`],[`type`,`button`,1,`week-picker__week`,3,`week-picker__week--selected`,`week-picker__week--current`],[`type`,`button`,1,`week-picker__week`,3,`click`],[1,`week-picker__week-number`],[1,`week-picker__week-range`],[1,`week-picker__current-badge`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`button`,1),jh$3(`click`,function(){return n.toggleExpanded()}),Bi$3(2,`span`,2),fw(3,qo$4,1,1)(4,Vo$4,2,3),vl$4(),Bi$3(5,`mat-icon`),lC(6),vl$4()(),fw(7,Zo$4,3,0,`div`,3),vl$4()),t&2&&(sE(3),pw(n.selectedLabel()?3:4),sE(3),ig(n.expanded()?`expand_less`:`expand_more`),sE(),pw(n.expanded()?7:-1))},dependencies:[Zi$3,yt$7,wt$5,Xp$1],styles:[`.week-picker[_ngcontent-%COMP%]{position:relative;width:100%}.week-picker__toggle[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px 14px;border:1px solid var(--%NS%border-color, #555);border-radius:8px;background:var(--%NS%quinaryBlack, #1f2b3a);color:var(--%NS%text-color, #fff);cursor:pointer;font-size:14px;transition:border-color .2s}.week-picker__toggle[_ngcontent-%COMP%]:hover{border-color:var(--%NS%primary, #6c63ff)}.week-picker__toggle[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--%NS%text-secondary, #aaa)}.week-picker__label[_ngcontent-%COMP%]{opacity:.8}.week-picker__dropdown[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:20;border:1px solid var(--%NS%border-color, #555);border-radius:8px;background:var(--%NS%quinaryBlack, #1f2b3a);box-shadow:0 8px 24px #00000059;max-height:280px;overflow-y:auto;padding:6px}.week-picker__month[_ngcontent-%COMP%]:not(:last-child){margin-bottom:4px}.week-picker__month-label[_ngcontent-%COMP%]{padding:6px 10px 2px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;color:var(--%NS%text-secondary, #aaa)}.week-picker__week[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:none;border-radius:6px;background:var(--%NS%quinaryBlack, #1f2b3a);color:var(--%NS%text-color, #fff);cursor:pointer;font-size:13px;transition:background-color .15s}.week-picker__week[_ngcontent-%COMP%]:hover{background:var(--%NS%quinaryBlack, #1f2b3a)}.week-picker__week[_ngcontent-%COMP%]:focus-visible, .week-picker__week[_ngcontent-%COMP%]:active{background:var(--%NS%quinaryBlack, #1f2b3a)}.week-picker__week--selected[_ngcontent-%COMP%]{background:var(--%NS%quinaryBlack, #1f2b3a)!important;box-shadow:inset 0 0 0 1px var(--%NS%primary, #6c63ff);color:var(--%NS%text-color, #fff)}.week-picker__week-number[_ngcontent-%COMP%]{font-weight:600;min-width:32px}.week-picker__week-range[_ngcontent-%COMP%]{flex:1}.week-picker__current-badge[_ngcontent-%COMP%]{font-size:10px;padding:2px 6px;border-radius:4px;background:#ffffff1f;color:var(--%NS%text-secondary, #aaa);white-space:nowrap}`]})};var W$3=[`input`];var Y$3=[`*`];var p$1={color:`accent`,clickAction:`check-indeterminate`,disabledInteractive:!1};var ee$4=new N$2(`mat-checkbox-default-options`,{providedIn:`root`,factory:()=>p$1});var a$1=(function(t){return t[t.Init=0]=`Init`,t[t.Checked=1]=`Checked`,t[t.Unchecked=2]=`Unchecked`,t[t.Indeterminate=3]=`Indeterminate`,t})(a$1||{});var v$1=class{source;checked};var ce$4=(()=>{class t{_elementRef=E(Lr$5);_changeDetectorRef=E(ej);_ngZone=E(Z$4);_animationsDisabled=nt$5();_options=E(ee$4,{optional:!0});focus(){this._inputElement.nativeElement.focus()}_createChangeEvent(e){let n=new v$1;return n.source=this,n.checked=e,n}_getAnimationTargetElement(){return this._inputElement?.nativeElement}_animationClasses={uncheckedToChecked:`mdc-checkbox--anim-unchecked-checked`,uncheckedToIndeterminate:`mdc-checkbox--anim-unchecked-indeterminate`,checkedToUnchecked:`mdc-checkbox--anim-checked-unchecked`,checkedToIndeterminate:`mdc-checkbox--anim-checked-indeterminate`,indeterminateToChecked:`mdc-checkbox--anim-indeterminate-checked`,indeterminateToUnchecked:`mdc-checkbox--anim-indeterminate-unchecked`};ariaLabel=``;ariaLabelledby=null;ariaDescribedby;ariaExpanded;
414ariaControls;ariaOwns;_uniqueId;id;get inputId(){return`${this.id||this._uniqueId}-input`}required=!1;labelPosition=`after`;name=null;change=new Qe$1;indeterminateChange=new Qe$1;value;disableRipple=!1;_inputElement;tabIndex;color;disabledInteractive;_onTouched=()=>{};_currentAnimationClass=``;_currentCheckState=a$1.Init;_controlValueAccessorChangeFn=()=>{};_validatorChangeFn=()=>{};constructor(){E(be$3).load(ra$5);let e=E(new Tg(`tabindex`),{optional:!0});this._options=this._options||p$1,this.color=this._options.color||p$1.color,this.tabIndex=e==null?0:parseInt(e)||0,this.id=this._uniqueId=E(Or$4).getId(`mat-mdc-checkbox-`),this.disabledInteractive=this._options?.disabledInteractive??!1}ngOnChanges(e){e.required&&this._validatorChangeFn()}ngAfterViewInit(){this._syncIndeterminate(this.indeterminate)}get checked(){return this._checked}set checked(e){e!=this.checked&&(this._checked=e,this._changeDetectorRef.markForCheck())}_checked=!1;get disabled(){return this._disabled}set disabled(e){e!==this.disabled&&(this._disabled=e,this._changeDetectorRef.markForCheck())}_disabled=!1;get indeterminate(){return this._indeterminate()}set indeterminate(e){let n=e!=this._indeterminate();this._indeterminate.set(e),n&&(e?this._transitionCheckState(a$1.Indeterminate):this._transitionCheckState(this.checked?a$1.Checked:a$1.Unchecked),this.indeterminateChange.emit(e)),this._syncIndeterminate(e)}_indeterminate=ni$3(!1);_isRippleDisabled(){return this.disableRipple||this.disabled}_onLabelTextChange(){this._changeDetectorRef.detectChanges()}writeValue(e){this.checked=!!e}registerOnChange(e){this._controlValueAccessorChangeFn=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this.disabled=e}validate(e){return this.required&&e.value!==!0?{required:!0}:null}registerOnValidatorChange(e){this._validatorChangeFn=e}_transitionCheckState(e){let n=this._currentCheckState,c=this._getAnimationTargetElement();if(!(n===e||!c)&&(this._currentAnimationClass&&c.classList.remove(this._currentAnimationClass),this._currentAnimationClass=this._getAnimationClassForCheckStateTransition(n,e),this._currentCheckState=e,this._currentAnimationClass.length>0)){c.classList.add(this._currentAnimationClass);let o=this._currentAnimationClass;this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{c.classList.remove(o)},1e3)})}}_emitChangeEvent(){this._controlValueAccessorChangeFn(this.checked),this.change.emit(this._createChangeEvent(this.checked)),this._inputElement&&(this._inputElement.nativeElement.checked=this.checked)}toggle(){this.checked=!this.checked,this._controlValueAccessorChangeFn(this.checked)}_handleInputClick(){let e=this._options?.clickAction;!this.disabled&&e!==`noop`?(this.indeterminate&&e!==`check`&&Promise.resolve().then(()=>{this._indeterminate.set(!1),this.indeterminateChange.emit(!1)}),this._checked=!this._checked,this._transitionCheckState(this._checked?a$1.Checked:a$1.Unchecked),this._emitChangeEvent()):(this.disabled&&this.disabledInteractive||!this.disabled&&e===`noop`)&&(this._inputElement.nativeElement.checked=this.checked,this._inputElement.nativeElement.indeterminate=this.indeterminate)}_onInteractionEvent(e){e.stopPropagation()}_onBlur(){Promise.resolve().then(()=>{this._onTouched(),this._changeDetectorRef.markForCheck()})}_getAnimationClassForCheckStateTransition(e,n){if(this._animationsDisabled)return``;switch(e){case a$1.Init:if(n===a$1.Checked)return this._animationClasses.uncheckedToChecked;if(n==a$1.Indeterminate)return this._checked?this._animationClasses.checkedToIndeterminate:this._animationClasses.uncheckedToIndeterminate;break;case a$1.Unchecked:return n===a$1.Checked?this._animationClasses.uncheckedToChecked:this._animationClasses.uncheckedToIndeterminate;case a$1.Checked:return n===a$1.Unchecked?this._animationClasses.checkedToUnchecked:this._animationClasses.checkedToIndeterminate;case a$1.Indeterminate:return n===a$1.Checked?this._animationClasses.indeterminateToChecked:this._animationClasses.indeterminateToUnchecked}return``}_syncIndeterminate(e){let n=this._inputElement;n&&(n.nativeElement.indeterminate=e)}_onInputClick(){this._handleInputClick()}_preventBubblingFromLabel(e){e.target&&this._inputElement&&e.target!==this._inputElement.nativeElement&&e.stopPropagation()}static ɵfac=function(n){return new(n||t)};static ɵcmp=PD({type:t,selectors:[[`mat-checkbox`]],viewQuery:function(n,c){if(n&1&&$h$2(W$3,5),n&2){let o;Pw(o=Lw())&&(c._inputElement=o.first)}},hostAttrs:[1,`mat-mdc-checkbox`],hostVars:16,hostBindings:function(n,c){n&2&&(Lh$3(`id`,c.id),xh$2(`tabindex`,null)(`aria-label`,null)(`aria-labelledby`,null),Xw(c.color?`mat-`+c.color:`mat-accent`),Yh$3(`_mat-animation-noopable`,c._animationsDisabled)(`mdc-checkbox--disabled`,c.disabled)(`mat-mdc-checkbox-disabled`,c.disabled)(`mat-mdc-checkbox-checked`,c.checked)(`mat-mdc-checkbox-disabled-interactive`,c.disabledInteractive))},inputs:{ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`],ariaDescribedby:[0,`aria-describedby`,`ariaDescribedby`],ariaExpanded:[2,`aria-expanded`,`ariaExpanded`,rj],ariaControl
vendor: 15,373 bytes, lines 414-673
414s:[0,`aria-controls`,`ariaControls`],ariaOwns:[0,`aria-owns`,`ariaOwns`],id:`id`,required:[2,`required`,`required`,rj],labelPosition:`labelPosition`,name:`name`,value:`value`,disableRipple:[2,`disableRipple`,`disableRipple`,rj],tabIndex:[2,`tabIndex`,`tabIndex`,e=>e==null?void 0:oj(e)],color:`color`,disabledInteractive:[2,`disabledInteractive`,`disabledInteractive`,rj],checked:[2,`checked`,`checked`,rj],disabled:[2,`disabled`,`disabled`,rj],indeterminate:[2,`indeterminate`,`indeterminate`,rj]},outputs:{change:`change`,indeterminateChange:`indeterminateChange`},exportAs:[`matCheckbox`],features:[CC([{provide:E$3,useExisting:Oo$4(()=>t),multi:!0},{provide:_$2,useExisting:t,multi:!0}]),qy],ngContentSelectors:Y$3,decls:15,vars:23,consts:[[`checkbox`,``],[`input`,``],[`label`,``],[`mat-internal-form-field`,``,3,`click`,`labelPosition`,`for`],[1,`mdc-checkbox`],[`aria-hidden`,`true`,1,`mat-mdc-checkbox-touch-target`],[`type`,`checkbox`,1,`mdc-checkbox__native-control`,3,`blur`,`click`,`change`,`checked`,`indeterminate`,`disabled`,`id`,`required`,`tabIndex`],[`aria-hidden`,`true`,1,`mdc-checkbox__ripple`],[`aria-hidden`,`true`,1,`mdc-checkbox__background`],[`focusable`,`false`,`viewBox`,`0 0 24 24`,1,`mdc-checkbox__checkmark`],[`fill`,`none`,`d`,`M1.73,12.91 8.1,19.28 22.79,4.59`,1,`mdc-checkbox__checkmark-path`],[1,`mdc-checkbox__mixedmark`],[`mat-ripple`,``,`aria-hidden`,`true`,1,`mat-mdc-checkbox-ripple`,`mat-focus-indicator`,3,`matRippleTrigger`,`matRippleDisabled`,`matRippleCentered`],[1,`mat-internal-form-field-label`,`mdc-label`]],template:function(n,c){if(n&1&&(Rw(),Bi$3(0,`label`,3),jh$3(`click`,function(h){return c._preventBubblingFromLabel(h)}),Bi$3(1,`span`,4,0),Rh$3(3,`span`,5),Bi$3(4,`input`,6,1),jh$3(`blur`,function(){return c._onBlur()})(`click`,function(){return c._onInputClick()})(`change`,function(h){return c._onInteractionEvent(h)}),vl$4(),Rh$3(6,`span`,7),Bi$3(7,`span`,8),Dd$1(),Bi$3(8,`svg`,9),Rh$3(9,`path`,10),vl$4(),wd$1(),Rh$3(10,`span`,11),vl$4(),Rh$3(11,`span`,12),vl$4(),Bi$3(12,`span`,13,2),kw(14),vl$4()()),n&2){let o=jw(2);Ah$2(`labelPosition`,c.labelPosition)(`for`,c.inputId),sE(4),Yh$3(`mdc-checkbox--selected`,c.checked),Ah$2(`checked`,c.checked)(`indeterminate`,c.indeterminate)(`disabled`,c.disabled&&!c.disabledInteractive)(`id`,c.inputId)(`required`,c.required)(`tabIndex`,c.disabled&&!c.disabledInteractive?-1:c.tabIndex),xh$2(`aria-label`,c.ariaLabel||null)(`aria-labelledby`,c.ariaLabelledby)(`aria-describedby`,c.ariaDescribedby)(`aria-checked`,c.indeterminate?`mixed`:null)(`aria-controls`,c.ariaControls)(`aria-disabled`,c.disabled&&c.disabledInteractive?!0:null)(`aria-expanded`,c.ariaExpanded)(`aria-owns`,c.ariaOwns)(`name`,c.name)(`value`,c.value),sE(7),Ah$2(`matRippleTrigger`,o)(`matRippleDisabled`,c.disableRipple||c.disabled)(`matRippleCentered`,!0)}},dependencies:[$h$3,m$2],styles:[`.mdc-checkbox { 415 display: inline-block; 416 position: relative; 417 flex: 0 0 18px; 418 box-sizing: content-box; 419 width: 18px; 420 height: 18px; 421 line-height: 0; 422 white-space: nowrap; 423 cursor: pointer; 424 vertical-align: bottom; 425 padding: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - 18px) / 2); 426 margin: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - var(--%NS%mat-checkbox-state-layer-size, 40px)) / 2); 427} 428.mdc-checkbox:hover > .mdc-checkbox__ripple { 429 opacity: var(--%NS%mat-checkbox-unselected-hover-state-layer-opacity, var(--%NS%mat-sys-hover-state-layer-opacity)); 430 background-color: var(--%NS%mat-checkbox-unselected-hover-state-layer-color, var(--%NS%mat-sys-on-surface)); 431} 432.mdc-checkbox:hover > .mat-mdc-checkbox-ripple > .mat-ripple-element { 433 background-color: var(--%NS%mat-checkbox-unselected-hover-state-layer-color, var(--%NS%mat-sys-on-surface)); 434} 435.mdc-checkbox .mdc-checkbox__native-control:focus + .mdc-checkbox__ripple { 436 opacity: var(--%NS%mat-checkbox-unselected-focus-state-layer-opacity, var(--%NS%mat-sys-focus-state-layer-opacity)); 437 background-color: var(--%NS%mat-checkbox-unselected-focus-state-layer-color, var(--%NS%mat-sys-on-surface)); 438} 439.mdc-checkbox .mdc-checkbox__native-control:focus ~ .mat-mdc-checkbox-ripple .mat-ripple-element { 440 background-color: var(--%NS%mat-checkbox-unselected-focus-state-layer-color, var(--%NS%mat-sys-on-surface)); 441} 442.mdc-checkbox:active > .mdc-checkbox__native-control + .mdc-checkbox__ripple { 443 opacity: var(--%NS%mat-checkbox-unselected-pressed-state-layer-opacity, var(--%NS%mat-sys-pressed-state-layer-opacity)); 444 background-color: var(--%NS%mat-checkbox-unselected-pressed-state-layer-color, var(--%NS%mat-sys-primary)); 445} 446.mdc-checkbox:active > .mdc-checkbox__native-control ~ .mat-mdc-checkbox-ripple .mat-ripple-element { 447 background-color: var(--%NS%mat-checkbox-unselected-pressed-state-layer-color, var(--%NS%mat-sys-primary)); 448} 449.mdc-checkbox:hover > .mdc-checkbox__native-control:checked + .mdc-checkbox__ripple { 450 opacity: var(--%NS%mat-checkbox-selected-hover-state-layer-opacity, var(--%NS%mat-sys-hover-state-layer-opacity)); 451 background-color: var(--%NS%mat-checkbox-selected-hover-state-layer-color, var(--%NS%mat-sys-primary)); 452} 453.mdc-checkbox:hover > .mdc-checkbox__native-control:checked ~ .mat-mdc-checkbox-ripple .mat-ripple-element { 454 background-color: var(--%NS%mat-checkbox-selected-hover-state-layer-color, var(--%NS%mat-sys-primary)); 455} 456.mdc-checkbox .mdc-checkbox__native-control:focus:checked + .mdc-checkbox__ripple { 457 opacity: var(--%NS%mat-checkbox-selected-focus-state-layer-opacity, var(--%NS%mat-sys-focus-state-layer-opacity)); 458 background-color: var(--%NS%mat-checkbox-selected-focus-state-layer-color, var(--%NS%mat-sys-primary)); 459} 460.mdc-checkbox .mdc-checkbox__native-control:focus:checked ~ .mat-mdc-checkbox-ripple .mat-ripple-element { 461 background-color: var(--%NS%mat-checkbox-selected-focus-state-layer-color, var(--%NS%mat-sys-primary)); 462} 463.mdc-checkbox:active > .mdc-checkbox__native-control:checked + .mdc-checkbox__ripple { 464 opacity: var(--%NS%mat-checkbox-selected-pressed-state-layer-opacity, var(--%NS%mat-sys-pressed-state-layer-opacity)); 465 background-color: var(--%NS%mat-checkbox-selected-pressed-state-layer-color, var(--%NS%mat-sys-on-surface)); 466} 467.mdc-checkbox:active > .mdc-checkbox__native-control:checked ~ .mat-mdc-checkbox-ripple .mat-ripple-element { 468 background-color: var(--%NS%mat-checkbox-selected-pressed-state-layer-color, var(--%NS%mat-sys-on-surface)); 469} 470.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control ~ .mat-mdc-checkbox-ripple .mat-ripple-element, 471.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control + .mdc-checkbox__ripple { 472 background-color: var(--%NS%mat-checkbox-unselected-hover-state-layer-color, var(--%NS%mat-sys-on-surface)); 473} 474.mdc-checkbox .mdc-checkbox__native-control { 475 position: absolute; 476 margin: 0; 477 padding: 0; 478 opacity: 0; 479 cursor: inherit; 480 z-index: 1; 481 width: var(--%NS%mat-checkbox-state-layer-size, 40px); 482 height: var(--%NS%mat-checkbox-state-layer-size, 40px); 483 top: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - var(--%NS%mat-checkbox-state-layer-size, 40px)) / 2); 484 right: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - var(--%NS%mat-checkbox-state-layer-size, 40px)) / 2); 485 left: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - var(--%NS%mat-checkbox-state-layer-size, 40px)) / 2); 486} 487 488.mdc-checkbox--disabled { 489 cursor: default; 490 pointer-events: none; 491} 492 493.mdc-checkbox__background { 494 display: inline-flex; 495 position: absolute; 496 align-items: center; 497 justify-content: center; 498 box-sizing: border-box; 499 width: 18px; 500 height: 18px; 501 border: 2px solid currentColor; 502 border-radius: 2px; 503 background-color: transparent; 504 pointer-events: none; 505 will-change: background-color, border-color; 506 transition: background-color 90ms cubic-bezier(0.4, 0, 0.6, 1), border-color 90ms cubic-bezier(0.4, 0, 0.6, 1); 507 -webkit-print-color-adjust: exact; 508 color-adjust: exact; 509 border-color: var(--%NS%mat-checkbox-unselected-icon-color, var(--%NS%mat-sys-on-surface-variant)); 510 top: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - 18px) / 2); 511 left: calc((var(--%NS%mat-checkbox-state-layer-size, 40px) - 18px) / 2); 512} 513 514.mdc-checkbox__native-control:enabled:checked ~ .mdc-checkbox__background, 515.mdc-checkbox__native-control:enabled:indeterminate ~ .mdc-checkbox__background { 516 border-color: var(--%NS%mat-checkbox-selected-icon-color, var(--%NS%mat-sys-primary)); 517 background-color: var(--%NS%mat-checkbox-selected-icon-color, var(--%NS%mat-sys-primary)); 518} 519 520.mdc-checkbox--disabled .mdc-checkbox__background { 521 border-color: var(--%NS%mat-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 522} 523@media (forced-colors: active) { 524 .mdc-checkbox--disabled .mdc-checkbox__background { 525 border-color: GrayText; 526 } 527} 528 529.mdc-checkbox__native-control:disabled:checked ~ .mdc-checkbox__background, 530.mdc-checkbox__native-control:disabled:indeterminate ~ .mdc-checkbox__background { 531 background-color: var(--%NS%mat-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 532 border-color: transparent; 533} 534@media (forced-colors: active) { 535 .mdc-checkbox__native-control:disabled:checked ~ .mdc-checkbox__background, 536 .mdc-checkbox__native-control:disabled:indeterminate ~ .mdc-checkbox__background { 537 border-color: GrayText; 538 } 539} 540 541.mdc-checkbox:hover > .mdc-checkbox__native-control:not(:checked) ~ .mdc-checkbox__background, 542.mdc-checkbox:hover > .mdc-checkbox__native-control:not(:indeterminate) ~ .mdc-checkbox__background { 543 border-color: var(--%NS%mat-checkbox-unselected-hover-icon-color, var(--%NS%mat-sys-on-surface)); 544 background-color: transparent; 545} 546 547.mdc-checkbox:hover > .mdc-checkbox__native-control:checked ~ .mdc-checkbox__background, 548.mdc-checkbox:hover > .mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background { 549 border-color: var(--%NS%mat-checkbox-selected-hover-icon-color, var(--%NS%mat-sys-primary)); 550 background-color: var(--%NS%mat-checkbox-selected-hover-icon-color, var(--%NS%mat-sys-primary)); 551} 552 553.mdc-checkbox__native-control:focus:focus:not(:checked) ~ .mdc-checkbox__background, 554.mdc-checkbox__native-control:focus:focus:not(:indeterminate) ~ .mdc-checkbox__background { 555 border-color: var(--%NS%mat-checkbox-unselected-focus-icon-color, var(--%NS%mat-sys-on-surface)); 556} 557 558.mdc-checkbox__native-control:focus:focus:checked ~ .mdc-checkbox__background, 559.mdc-checkbox__native-control:focus:focus:indeterminate ~ .mdc-checkbox__background { 560 border-color: var(--%NS%mat-checkbox-selected-focus-icon-color, var(--%NS%mat-sys-primary)); 561 background-color: var(--%NS%mat-checkbox-selected-focus-icon-color, var(--%NS%mat-sys-primary)); 562} 563 564.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox:hover > .mdc-checkbox__native-control ~ .mdc-checkbox__background, 565.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control:focus ~ .mdc-checkbox__background, 566.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__background { 567 border-color: var(--%NS%mat-checkbox-disabled-unselected-icon-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 568} 569@media (forced-colors: active) { 570 .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox:hover > .mdc-checkbox__native-control ~ .mdc-checkbox__background, 571 .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox .mdc-checkbox__native-control:focus ~ .mdc-checkbox__background, 572 .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__background { 573 border-color: GrayText; 574 } 575} 576.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:checked ~ .mdc-checkbox__background, 577.mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background { 578 background-color: var(--%NS%mat-checkbox-disabled-selected-icon-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 579 border-color: transparent; 580} 581 582.mdc-checkbox__checkmark { 583 position: absolute; 584 top: 0; 585 right: 0; 586 bottom: 0; 587 left: 0; 588 width: 100%; 589 opacity: 0; 590 transition: opacity 180ms cubic-bezier(0.4, 0, 0.6, 1); 591 color: var(--%NS%mat-checkbox-selected-checkmark-color, var(--%NS%mat-sys-on-primary)); 592} 593@media (forced-colors: active) { 594 .mdc-checkbox__checkmark { 595 color: CanvasText; 596 } 597} 598 599.mdc-checkbox--disabled .mdc-checkbox__checkmark, .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark { 600 color: var(--%NS%mat-checkbox-disabled-selected-checkmark-color, var(--%NS%mat-sys-surface)); 601} 602@media (forced-colors: active) { 603 .mdc-checkbox--disabled .mdc-checkbox__checkmark, .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__checkmark { 604 color: GrayText; 605 } 606} 607 608.mdc-checkbox__checkmark-path { 609 transition: stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.6, 1); 610 stroke: currentColor; 611 stroke-width: 3.12px; 612 stroke-dashoffset: 29.7833385; 613 stroke-dasharray: 29.7833385; 614} 615 616.mdc-checkbox__mixedmark { 617 width: 100%; 618 height: 0; 619 transform: scaleX(0) rotate(0deg); 620 border-width: 1px; 621 border-style: solid; 622 opacity: 0; 623 transition: opacity 90ms cubic-bezier(0.4, 0, 0.6, 1), transform 90ms cubic-bezier(0.4, 0, 0.6, 1); 624 border-color: var(--%NS%mat-checkbox-selected-checkmark-color, var(--%NS%mat-sys-on-primary)); 625} 626@media (forced-colors: active) { 627 .mdc-checkbox__mixedmark { 628 margin: 0 1px; 629 } 630} 631 632.mdc-checkbox--disabled .mdc-checkbox__mixedmark, .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__mixedmark { 633 border-color: var(--%NS%mat-checkbox-disabled-selected-checkmark-color, var(--%NS%mat-sys-surface)); 634} 635@media (forced-colors: active) { 636 .mdc-checkbox--disabled .mdc-checkbox__mixedmark, .mdc-checkbox--disabled.mat-mdc-checkbox-disabled-interactive .mdc-checkbox__mixedmark { 637 border-color: GrayText; 638 } 639} 640 641.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__background, 642.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__background, 643.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__background, 644.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__background { 645 animation-duration: 180ms; 646 animation-timing-function: linear; 647} 648 649.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__checkmark-path { 650 animation: mdc-checkbox-unchecked-checked-checkmark-path 180ms linear; 651 transition: none; 652} 653 654.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__mixedmark { 655 animation: mdc-checkbox-unchecked-indeterminate-mixedmark 90ms linear; 656 transition: none; 657} 658 659.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__checkmark-path { 660 animation: mdc-checkbox-checked-unchecked-checkmark-path 90ms linear; 661 transition: none; 662} 663 664.mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__checkmark { 665 animation: mdc-checkbox-checked-indeterminate-checkmark 90ms linear; 666 transition: none; 667} 668.mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__mixedmark { 669 animation: mdc-checkbox-checked-indeterminate-mixedmark 90ms linear; 670 transition: none; 671} 672 673.mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__checkmark {
674 animation: mdc-checkbox-indeterminate-checked-checkmark 500ms linear; 675 transition: none; 676} 677.mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__mixedmark { 678 animation: mdc-checkbox-indeterminate-checked-mixedmark 500ms linear; 679 transition: none; 680} 681 682.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__mixedmark { 683 animation: mdc-checkbox-indeterminate-unchecked-mixedmark 300ms linear; 684 transition: none; 685} 686 687.mdc-checkbox__native-control:checked ~ .mdc-checkbox__background, 688.mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background { 689 transition: border-color 90ms cubic-bezier(0, 0, 0.2, 1), background-color 90ms cubic-bezier(0, 0, 0.2, 1); 690} 691.mdc-checkbox__native-control:checked ~ .mdc-checkbox__background > .mdc-checkbox__checkmark > .mdc-checkbox__checkmark-path, 692.mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background > .mdc-checkbox__checkmark > .mdc-checkbox__checkmark-path { 693 stroke-dashoffset: 0; 694} 695 696.mdc-checkbox__native-control:checked ~ .mdc-checkbox__background > .mdc-checkbox__checkmark { 697 transition: opacity 180ms cubic-bezier(0, 0, 0.2, 1), transform 180ms cubic-bezier(0, 0, 0.2, 1); 698 opacity: 1; 699} 700.mdc-checkbox__native-control:checked ~ .mdc-checkbox__background > .mdc-checkbox__mixedmark { 701 transform: scaleX(1) rotate(-45deg); 702} 703 704.mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background > .mdc-checkbox__checkmark { 705 transform: rotate(45deg); 706 opacity: 0; 707 transition: opacity 90ms cubic-bezier(0.4, 0, 0.6, 1), transform 90ms cubic-bezier(0.4, 0, 0.6, 1); 708} 709.mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background > .mdc-checkbox__mixedmark { 710 transform: scaleX(1) rotate(0deg); 711 opacity: 1; 712} 713 714@keyframes mdc-checkbox-unchecked-checked-checkmark-path { 715 0%, 50% { 716 stroke-dashoffset: 29.7833385; 717 } 718 50% { 719 animation-timing-function: cubic-bezier(0, 0, 0.2, 1); 720 } 721 100% { 722 stroke-dashoffset: 0; 723 } 724} 725@keyframes mdc-checkbox-unchecked-indeterminate-mixedmark { 726 0%, 68.2% { 727 transform: scaleX(0); 728 } 729 68.2% { 730 animation-timing-function: cubic-bezier(0, 0, 0, 1); 731 } 732 100% { 733 transform: scaleX(1); 734 } 735} 736@keyframes mdc-checkbox-checked-unchecked-checkmark-path { 737 from { 738 animation-timing-function: cubic-bezier(0.4, 0, 1, 1); 739 opacity: 1; 740 stroke-dashoffset: 0; 741 } 742 to { 743 opacity: 0; 744 stroke-dashoffset: -29.7833385; 745 } 746} 747@keyframes mdc-checkbox-checked-indeterminate-checkmark { 748 from { 749 animation-timing-function: cubic-bezier(0, 0, 0.2, 1); 750 transform: rotate(0deg); 751 opacity: 1; 752 } 753 to { 754 transform: rotate(45deg); 755 opacity: 0; 756 } 757} 758@keyframes mdc-checkbox-indeterminate-checked-checkmark { 759 from { 760 animation-timing-function: cubic-bezier(0.14, 0, 0, 1); 761 transform: rotate(45deg); 762 opacity: 0; 763 } 764 to { 765 transform: rotate(360deg); 766 opacity: 1; 767 } 768} 769@keyframes mdc-checkbox-checked-indeterminate-mixedmark { 770 from { 771 animation-timing-function: cubic-bezier(0, 0, 0.2, 1); 772 transform: rotate(-45deg); 773 opacity: 0; 774 } 775 to { 776 transform: rotate(0deg); 777 opacity: 1; 778 } 779} 780@keyframes mdc-checkbox-indeterminate-checked-mixedmark { 781 from { 782 animation-timing-function: cubic-bezier(0.14, 0, 0, 1); 783 transform: rotate(0deg); 784 opacity: 1; 785 } 786 to { 787 transform: rotate(315deg); 788 opacity: 0; 789 } 790} 791@keyframes mdc-checkbox-indeterminate-unchecked-mixedmark { 792 0% { 793 animation-timing-function: linear; 794 transform: scaleX(1); 795 opacity: 1; 796 } 797 32.8%, 100% { 798 transform: scaleX(0); 799 opacity: 0; 800 } 801} 802.mat-mdc-checkbox { 803 display: inline-block; 804 position: relative; 805 -webkit-tap-highlight-color: transparent; 806} 807.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mat-mdc-checkbox-touch-target, 808.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mdc-checkbox__native-control, 809.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mdc-checkbox__ripple, 810.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mat-mdc-checkbox-ripple::before, 811.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mdc-checkbox__background, 812.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mdc-checkbox__background > .mdc-checkbox__checkmark, 813.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mdc-checkbox__background > .mdc-checkbox__checkmark > .mdc-checkbox__checkmark-path, 814.mat-mdc-checkbox._mat-animation-noopable > .mat-internal-form-field > .mdc-checkbox > .mdc-checkbox__background > .mdc-checkbox__mixedmark { 815 transition: none !important; 816 animation: none !important; 817} 818.mat-mdc-checkbox label { 819 cursor: pointer; 820} 821.mat-mdc-checkbox .mat-internal-form-field { 822 color: var(--%NS%mat-checkbox-label-text-color, var(--%NS%mat-sys-on-surface)); 823 font-family: var(--%NS%mat-checkbox-label-text-font, var(--%NS%mat-sys-body-medium-font)); 824 line-height: var(--%NS%mat-checkbox-label-text-line-height, var(--%NS%mat-sys-body-medium-line-height)); 825 font-size: var(--%NS%mat-checkbox-label-text-size, var(--%NS%mat-sys-body-medium-size)); 826 letter-spacing: var(--%NS%mat-checkbox-label-text-tracking, var(--%NS%mat-sys-body-medium-tracking)); 827 font-weight: var(--%NS%mat-checkbox-label-text-weight, var(--%NS%mat-sys-body-medium-weight)); 828} 829.mat-mdc-checkbox.mat-mdc-checkbox-disabled.mat-mdc-checkbox-disabled-interactive { 830 pointer-events: auto; 831} 832.mat-mdc-checkbox.mat-mdc-checkbox-disabled.mat-mdc-checkbox-disabled-interactive input { 833 cursor: default; 834} 835.mat-mdc-checkbox.mat-mdc-checkbox-disabled label { 836 cursor: default; 837} 838.mat-mdc-checkbox.mat-mdc-checkbox-disabled .mat-internal-form-field-label { 839 color: var(--%NS%mat-checkbox-disabled-label-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 840} 841@media (forced-colors: active) { 842 .mat-mdc-checkbox.mat-mdc-checkbox-disabled .mat-internal-form-field-label { 843 color: GrayText; 844 } 845} 846.mat-mdc-checkbox .mat-internal-form-field-label:empty { 847 display: none; 848} 849.mat-mdc-checkbox .mdc-checkbox__ripple { 850 opacity: 0; 851} 852 853.mat-mdc-checkbox .mat-mdc-checkbox-ripple, 854.mdc-checkbox__ripple { 855 top: 0; 856 left: 0; 857 right: 0; 858 bottom: 0; 859 position: absolute; 860 border-radius: 50%; 861 pointer-events: none; 862} 863.mat-mdc-checkbox .mat-mdc-checkbox-ripple:not(:empty), 864.mdc-checkbox__ripple:not(:empty) { 865 transform: translateZ(0); 866} 867 868.mat-mdc-checkbox-ripple .mat-ripple-element { 869 opacity: 0.1; 870} 871 872.mat-mdc-checkbox-touch-target { 873 position: absolute; 874 top: 50%; 875 left: 50%; 876 height: var(--%NS%mat-checkbox-touch-target-size, 48px); 877 width: var(--%NS%mat-checkbox-touch-target-size, 48px); 878 transform: translate(-50%, -50%); 879 display: var(--%NS%mat-checkbox-touch-target-display, block); 880} 881 882.mat-mdc-checkbox .mat-mdc-checkbox-ripple::before { 883 border-radius: 50%; 884} 885 886.mdc-checkbox__native-control:focus-visible ~ .mat-focus-indicator::before { 887 content: ""; 888} 889`],encapsulation:2})}return t})();var pe$2=(()=>{class t{static ɵfac=function(n){return new(n||t)};static ɵmod=FD({type:t});static ɵinj=ju$1({imports:[ce$4,xn$4]})}return t})();var Z$3=class v{clientService=E(E$2);dialogRef=E(f$3);data=E(de$3,{optional:!0});form=new P({group_name:new $$1(``,[ye$4.required]),description:new $$1(``),client_ids:new $$1([]),no_invites:new $$1(!1)});isEditMode=!1;initialClientIds=[];clientOptions=$C(()=>{let i=this.clientService.clientsData();return Array.from(i.values()).filter(t=>t.role===`athlete`).sort((t,e)=>t.clientName.localeCompare(e.clientName)).map(t=>({id:t.id,label:t.clientName,sublabel:t.email}))});ngOnInit(){if(this.data?.trainingGroup){this.isEditMode=!0;let i=this.data.trainingGroup,t=i.users.filter(e=>e.role===`athlete`).map(e=>e.user_id);this.initialClientIds=[...t],this.form.patchValue({group_name:i.name,description:i.description||``,client_ids:t,no_invites:!1})}}closeDialog(){this.dialogRef.close()}onSubmit(){return ps$4(this,null,function*(){if(this.form.valid){let i=this.form.value,t=i.client_ids||[];if(this.isEditMode&&this.data?.trainingGroup){let e=this.data.trainingGroup.id;yield this.clientService.updateTrainingGroup({group_id:e,group_name:i.group_name,description:i.description||``,users:[]});let s=t.filter(p=>!this.initialClientIds.includes(p)),M=this.initialClientIds.filter(p=>!t.includes(p));for(let p of M)yield this.clientService.deleteUserFromTrainingGroup({group_id:e,athlete_id:p});for(let p of s)this.clientService.clientsData().get(p)&&(yield this.clientService.j
889oinTrainingGroup({group_id:e,notification_id:0,athlete_id:p,role:`athlete`}))}else{let e=t.map(M=>({user_id:M,role:`athlete`}));(yield this.clientService.createTrainingGroup({name:i.group_name,description:i.description||``,users:e}))&&this.dialogRef.close(`created`);return}this.dialogRef.close()}})}static ɵfac=function(t){return new(t||v)};static ɵcmp=PD({type:v,selectors:[[`app-add-training-group-dialog`]],decls:42,vars:39,consts:[[1,`dialog-container`],[1,`dialog-header`],[1,`dialog-title`],[1,`close-button`,3,`closed`],[3,`ngSubmit`,`formGroup`],[1,`form-content`],[1,`form-fields`],[1,`input-container`,`block`],[`appearance`,`outline`,1,`w-full`],[`matInput`,``,`type`,`text`,`formControlName`,`group_name`,3,`placeholder`],[`matInput`,``,`formControlName`,`description`,`rows`,`3`,3,`placeholder`],[`formControlName`,`client_ids`,1,`w-full`,3,`options`,`placeholder`,`searchPlaceholder`,`multiple`,`itemsSelectedText`],[1,`dialog-actions`],[`mat-flat-button`,``,`type`,`button`,1,`cancel-button`,3,`pointerup`],[`mat-flat-button`,``,`type`,`submit`,1,`save-button`,3,`disabled`]],template:function(t,e){t&1&&(Bi$3(0,`div`,0)(1,`div`,1)(2,`h2`,2),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`app-dialog-close-button`,3),jh$3(`closed`,function(){return e.closeDialog()}),vl$4()(),Bi$3(6,`form`,4),jh$3(`ngSubmit`,function(){return e.onSubmit()}),Bi$3(7,`div`,5)(8,`div`,6)(9,`span`,7)(10,`mat-label`),lC(11),OC(12,`translate`),vl$4(),Bi$3(13,`mat-form-field`,8),Rh$3(14,`input`,9),OC(15,`translate`),WE(),vl$4()(),Bi$3(16,`span`,7)(17,`mat-label`),lC(18),OC(19,`translate`),vl$4(),Bi$3(20,`mat-form-field`,8),Rh$3(21,`textarea`,10),OC(22,`translate`),WE(),vl$4()(),Bi$3(23,`span`,7)(24,`mat-label`),lC(25),OC(26,`translate`),vl$4(),Rh$3(27,`app-searchable-select`,11),OC(28,`translate`),OC(29,`translate`),OC(30,`translate`),WE(),vl$4()(),Bi$3(31,`div`,12)(32,`button`,13),jh$3(`pointerup`,function(){return e.closeDialog()}),Bi$3(33,`mat-icon`),lC(34,`close`),vl$4(),lC(35),OC(36,`translate`),vl$4(),Bi$3(37,`button`,14)(38,`mat-icon`),lC(39),vl$4(),lC(40),OC(41,`translate`),vl$4()()()()()),t&2&&(sE(3),sg(` `,LC(4,17,e.isEditMode?`trainingGroup.editGroup`:`trainingGroup.addGroup`),` `,e.isEditMode&&e.data?.trainingGroup?.name?`: `+e.data.trainingGroup.name:``,` `),sE(3),Ah$2(`formGroup`,e.form),sE(5),Cl$4(``,LC(12,19,`trainingGroup.groupName`),` *`),sE(3),Ah$2(`placeholder`,LC(15,21,`trainingGroup.groupNamePlaceholder`)),zE(),sE(4),ig(LC(19,23,`trainingGroup.description`)),sE(3),Ah$2(`placeholder`,LC(22,25,`trainingGroup.descriptionPlaceholder`)),zE(),sE(4),ig(LC(26,27,`trainingGroup.selectClients`)),sE(2),Ah$2(`options`,e.clientOptions())(`placeholder`,LC(28,29,`trainingGroup.selectClientsPlaceholder`))(`searchPlaceholder`,LC(29,31,`trainingGroup.searchClients`))(`multiple`,!0)(`itemsSelectedText`,LC(30,33,`trainingGroup.clientsSelected`)),zE(),sE(8),Cl$4(` `,LC(36,35,`common.cancel`),` `),sE(2),Ah$2(`disabled`,e.form.invalid),sE(2),ig(e.isEditMode?`save`:`group_add`),sE(),Cl$4(` `,LC(41,37,`common.save`),` `))},dependencies:[en$4,je$3,X$5,Be$2,Pe$4,Qn$4,Zn$4,Qe$2,qn$5,$n$4,bn$4,Vn$4,Ap$1,wp$2,yt$7,wt$5,X$4,Gi$3,pe$2,er$4,Xp$1],styles:[`.dialog-container[_ngcontent-%COMP%]{border-radius:10px;padding:1.5rem;max-width:600px;margin:0 auto}.dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem;border-bottom:1px solid var(--%NS%border-color);padding-bottom:1.5rem}.dialog-header[_ngcontent-%COMP%] .dialog-title[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500;margin:0}.dialog-header[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{position:absolute;top:1.5rem;right:1.5rem}.form-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-fields[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.input-container[_ngcontent-%COMP%] mat-label[_ngcontent-%COMP%]{font-size:.875rem;color:var(--%NS%text-color);opacity:.8}.input-container.checkbox-section[_ngcontent-%COMP%]{margin-top:.5rem}.dialog-actions[_ngcontent-%COMP%]{display:flex;gap:1rem;justify-content:flex-end;margin-top:1rem;padding-top:1rem}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:120px;padding:.625rem 1.5rem;font-weight:500;display:flex;align-items:center;justify-content:center;gap:.5rem}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.dialog-actions[_ngcontent-%COMP%] .cancel-button[_ngcontent-%COMP%]{background:transparent;border:1px solid var(--%NS%border-color);color:var(--%NS%text-color)}.dialog-actions[_ngcontent-%COMP%] .cancel-button[_ngcontent-%COMP%]:hover:not(:disabled){background:#ffffff0d}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]{background:var(--%NS%primary)}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]:hover:not(:disabled){opacity:.9}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]:disabled{color:var(--%NS%primaryBlack);opacity:.5;cursor:not-allowed}@media(max-width:760px){.dialog-container[_ngcontent-%COMP%]{padding:1rem}.dialog-actions[_ngcontent-%COMP%]{flex-direction:column-reverse}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%}} .mat-mdc-form-field-subscript-wrapper{display:none} .mat-mdc-text-field-wrapper{background-color:#ffffff0d} .mat-mdc-select-value, .mat-mdc-input-element{color:var(--%NS%text-color)!important}`]})};var it$4={tasks:[{taskKey:`add_client`,completed:!1,completedAt:null,videoUrl:null},{taskKey:`publish_program`,completed:!1,completedAt:null,videoUrl:null},{taskKey:`add_exercise`,completed:!1,completedAt:null,videoUrl:null},{taskKey:`create_workout_template`,completed:!1,completedAt:null,videoUrl:null},{taskKey:`add_workout_to_program`,completed:!1,completedAt:null,videoUrl:null}],incompleteCount:5};var Je$2=class a{http=E(yo$5);config=E(kR);taskState=ni$3(null);incompleteCount=$C(()=>this.taskState()?.incompleteCount??0);totalCount=$C(()=>this.taskState()?.tasks.length??5);completedCount=$C(()=>this.totalCount()-this.incompleteCount());allComplete=$C(()=>this.taskState()!==null&&this.incompleteCount()===0);isVisible=$C(()=>this.taskState()!==null&&!this.allComplete());isTaskComplete(l){return this.taskState()?.tasks.find(e=>e.taskKey===l)?.completed??!1}videoUrlFor(l){return this.taskState()?.tasks.find(e=>e.taskKey===l)?.videoUrl??null}loadState(){return ps$4(this,null,function*(){let l=`${this.config.config().apiUrl}/api/v3/me/onboarding/checklist`;try{let e=yield pm(this.http.get(l));this.taskState.set(e)}catch(e){this.taskState.set(it$4)}})}markTaskComplete(l){return ps$4(this,null,function*(){if(this.isTaskComplete(l))return;this.taskState.update(t=>
889{if(!t)return t;let n=t.tasks.map(o=>o.taskKey===l?W$4(q$1({},o),{completed:!0}):o);return{tasks:n,incompleteCount:n.filter(o=>!o.completed).length}});let e=`${this.config.config().apiUrl}/api/v3/me/onboarding/checklist/${l}`;try{let t=yield pm(this.http.patch(e,null));this.taskState.update(n=>{if(!n)return n;let i=n.tasks.map(r=>r.taskKey===t.taskKey?t:r);return{tasks:i,incompleteCount:i.filter(r=>!r.completed).length}})}catch(t){this.taskState.update(n=>{if(!n)return n;let i=n.tasks.map(r=>r.taskKey===l?W$4(q$1({},r),{completed:!1}):r);return{tasks:i,incompleteCount:i.filter(r=>!r.completed).length}})}})}static ɵfac=function(e){return new(e||a)};static ɵprov=ue$3({token:a,factory:a.ɵfac,providedIn:`root`})};var mt$6=[[[`mat-icon`],[``,`matMenuItemIcon`,``]],`*`];var ct$7=[`mat-icon, [matMenuItemIcon]`,`*`];function ut$4(a,l){a&1&&(Dd$1(),Bi$3(0,`svg`,2),Rh$3(1,`polygon`,3),vl$4())}var dt$7=[`*`];function pt$5(a,l){if(a&1){let e=Cw();Il$4(0,`div`,0),Vh$3(`click`,function(){ld$2(e);return ud$1(xw().closed.emit(`click`))})(`animationstart`,function(n){ld$2(e);return ud$1(xw()._onAnimationStart(n.animationName))})(`animationend`,function(n){ld$2(e);return ud$1(xw()._onAnimationDone(n.animationName))})(`animationcancel`,function(n){ld$2(e);return ud$1(xw()._onAnimationDone(n.animationName))}),Il$4(1,`div`,1),kw(2),El$4()()}if(a&2){let e=xw();Xw(e._classList),Yh$3(`mat-menu-panel-animations-disabled`,e._animationsDisabled)(`mat-menu-panel-exit-animation`,e._panelAnimationState===`void`)(`mat-menu-panel-animating`,e._isAnimating()),Lh$3(`id`,e.panelId),xh$2(`aria-label`,e.ariaLabel||null)(`aria-labelledby`,e.ariaLabelledby||null)(`aria-describedby`,e.ariaDescribedby||null)}}var se$4=new N$2(`MAT_MENU_PANEL`);var oe$3=(()=>{class a{_elementRef=E(Lr$5);_document=E(ti$3);_focusMonitor=E(yn$4);_parentMenu=E(se$4,{optional:!0});_changeDetectorRef=E(ej);role=`menuitem`;disabled=!1;disableRipple=!1;_hovered=new ee$5;_focused=new ee$5;_highlighted=!1;_triggersSubmenu=!1;constructor(){E(be$3).load(ra$5),this._parentMenu?.addItem?.(this)}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this)}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,!1)}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete()}_getTabIndex(){return this.disabled?`-1`:`0`}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}_handleMouseEnter(){this._hovered.next(this)}getLabel(){let e=this._elementRef.nativeElement.cloneNode(!0),t=e.querySelectorAll(`mat-icon, .material-icons`);for(let n=0;n<t.length;n++)t[n].remove();return e.textContent?.trim()||``}_setHighlighted(e){this._highlighted=e,this._changeDetectorRef.markForCheck()}_setTriggersSubmenu(e){this._triggersSubmenu=e,this._changeDetectorRef.markForCheck()}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static ɵfac=function(t){return new(t||a)};static ɵcmp=PD({type:a,selectors:[[``,`mat-menu-item`,``]],hostAttrs:[1,`mat-mdc-menu-item`,`mat-focus-indicator`],hostVars:8,hostBindings:function(t,n){t&1&&jh$3(`click`,function(o){return n._checkDisabled(o)})(`mouseenter`,function(){return n._handleMouseEnter()}),t&2&&(xh$2(`role`,n.role)(`tabindex`,n._getTabIndex())(`aria-disabled`,n.disabled)(`disabled`,n.disabled||null),Yh$3(`mat-mdc-menu-item-highlighted`,n._highlighted)(`mat-mdc-menu-item-submenu-trigger`,n._triggersSubmenu))},inputs:{role:`role`,disabled:[2,`disabled`,`disabled`,rj],disableRipple:[2,`disableRipple`,`disableRipple`,rj]},exportAs:[`matMenuItem`],ngContentSelectors:ct$7,decls:5,vars:3,consts:[[1,`mat-mdc-menu-item-text`],[`matRipple`,``,1,`mat-mdc-menu-ripple`,3,`matRippleDisabled`,`matRippleTrigger`],[`viewBox`,`0 0 5 10`,`focusable`,`false`,`aria-hidden`,`true`,1,`mat-mdc-menu-submenu-icon`],[`points`,`0,0 5,5 0,10`]],template:function(t,n){t&1&&(Rw(mt$6),kw(0),Bi$3(1,`span`,0),kw(2,1),vl$4(),Rh$3(3,`div`,1),fw(4,ut$4,2,0,`:svg:svg`,2)),t&2&&(sE(3),Ah$2(`matRippleDisabled`,n.disableRipple||n.disabled)(`matRippleTrigger`,n._getHostElement()),sE(),pw(n._triggersSubmenu?4:-1))},dependencies:[$h$3],encapsulation:2})}return a})();var ht$6=new N$2(`MatMenuContent`);var _t$7=new N$2(`mat-menu-default-options`,{providedIn:`root`,factory:()=>({overlapTrigger:!1,xPosition:`after`,yPosition:`below`,backdropClass:`cdk-overlay-transparent-backdrop`})});var ae$6=`_mat-menu-enter`;var B$3=`_mat-menu-exit`;var L$4=(()=>{class a{_elementRef=E(Lr$5);_changeDetectorRef=E(ej);_injector=E(we$4);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled=nt$5();_allItems;_directDescendantItems=new Ci$3;_classList={};_panelAnimationState=`void`;_animationDone=new ee$5;_isAnimating=ni$3(!1);parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(e){this._xPosition=e,this.setPositionClasses()}get yPosition(){return this._yPosition}set yPosition(e){this._yPosition=e,this.setPositionClasses()}templateRef;items;lazyContent;overlapTrigger=!1;hasBackdrop;get panelClass(){return this._previousPanelClass}set panelClass(e){let t=this._previousPanelClass,n=q$1({},this._classList);t&&t.length&&t.split(` `).forEach(i=>
vendor: 7,026 bytes, lines 889-959
889{n[i]=!1}),this._previousPanelClass=e,e&&e.length&&(e.split(` `).forEach(i=>{n[i]=!0}),this._elementRef.nativeElement.className=``),this._classList=n}_previousPanelClass=``;get classList(){return this.panelClass}set classList(e){this.panelClass=e}closed=new Qe$1;close=this.closed;panelId=E(Or$4).getId(`mat-menu-panel-`);constructor(){let e=E(_t$7);this.overlayPanelClass=e.overlayPanelClass||``,this._xPosition=e.xPosition,this._yPosition=e.yPosition,this.backdropClass=e.backdropClass,this.overlapTrigger=e.overlapTrigger,this.hasBackdrop=e.hasBackdrop}ngOnInit(){this.setPositionClasses()}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new Rr$6(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit(`tab`)),this._directDescendantItems.changes.pipe(Vm(this._directDescendantItems),Iu$2(e=>_m(...e.map(t=>t._focused)))).subscribe(e=>this._keyManager.updateActiveItem(e)),this._directDescendantItems.changes.subscribe(e=>{let t=this._keyManager;if(this._panelAnimationState===`enter`&&t.activeItem?._hasFocus()){let n=e.toArray(),i=Math.max(0,Math.min(n.length-1,t.activeItemIndex||0));n[i]&&!n[i].disabled?t.setActiveItem(i):t.setNextItemActive()}})}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout)}_hovered(){return this._directDescendantItems.changes.pipe(Vm(this._directDescendantItems),Iu$2(t=>_m(...t.map(n=>n._hovered))))}addItem(e){}removeItem(e){}_handleKeydown(e){let t=e.keyCode,n=this._keyManager;switch(t){case 27:Ho$5(e)||(e.preventDefault(),this.closed.emit(`keydown`));break;case 37:this.parentMenu&&this.direction===`ltr`&&this.closed.emit(`keydown`);break;case 39:this.parentMenu&&this.direction===`rtl`&&this.closed.emit(`keydown`);break;default:(t===38||t===40)&&n.setFocusOrigin(`keyboard`),n.onKeydown(e);return}}focusFirstItem(e=`program`){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=wp$1(()=>{let t=this._resolvePanel();if(!t||!t.contains(document.activeElement)){let n=this._keyManager;n.setFocusOrigin(e).setFirstItemActive(),!n.activeItem&&t&&t.focus()}},{injector:this._injector})}resetActiveItem(){this._keyManager.setActiveItem(-1)}setElevation(e){}setPositionClasses(e=this.xPosition,t=this.yPosition){this._classList=W$4(q$1({},this._classList),{"mat-menu-before":e===`before`,"mat-menu-after":e===`after`,"mat-menu-above":t===`above`,"mat-menu-below":t===`below`}),this._changeDetectorRef.markForCheck()}_onAnimationDone(e){let t=e===B$3;(t||e===ae$6)&&(t&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(t?`void`:`enter`),this._isAnimating.set(!1))}_onAnimationStart(e){(e===ae$6||e===B$3)&&this._isAnimating.set(!0)}_setIsOpen(e){if(this._panelAnimationState=e?`enter`:`void`,e){if(this._keyManager.activeItemIndex===0){let t=this._resolvePanel();t&&(t.scrollTop=0)}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(B$3),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(e?ae$6:B$3)}),this._changeDetectorRef.markForCheck()}_updateDirectDescendants(){this._allItems.changes.pipe(Vm(this._allItems)).subscribe(e=>{this._directDescendantItems.reset(e.filter(t=>t._parentMenu===this)),this._directDescendantItems.notifyOnChanges()})}_resolvePanel(){let e=null;return this._directDescendantItems.length&&(e=this._directDescendantItems.first._getHostElement().closest(`[role="menu"]`)),e}static ɵfac=function(t){return new(t||a)};static ɵcmp=PD({type:a,selectors:[[`mat-menu`]],contentQueries:function(t,n,i){if(t&1&&Bh$3(i,ht$6,5)(i,oe$3,5)(i,oe$3,4),t&2){let o;Pw(o=Lw())&&(n.lazyContent=o.first),Pw(o=Lw())&&(n._allItems=o),Pw(o=Lw())&&(n.items=o)}},viewQuery:function(t,n){if(t&1&&$h$2(Ar$5,5),t&2){let i;Pw(i=Lw())&&(n.templateRef=i.first)}},hostVars:3,hostBindings:function(t,n){t&2&&xh$2(`aria-label`,null)(`aria-labelledby`,null)(`aria-describedby`,null)},inputs:{backdropClass:`backdropClass`,ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`],ariaDescribedby:[0,`aria-describedby`,`ariaDescribedby`],xPosition:`xPosition`,yPosition:`yPosition`,overlapTrigger:[2,`overlapTrigger`,`overlapTrigger`,rj],hasBackdrop:[2,`hasBackdrop`,`hasBackdrop`,e=>e==null?null:rj(e)],panelClass:[0,`class`,`panelClass`],classList:`classList`},outputs:{closed:`closed`,close:`close`},exportAs:[`matMenu`],features:[CC([{provide:se$4,useExisting:a}])],ngContentSelectors:dt$7,decls:1,vars:0,consts:[[`tabindex`,`-1`,`role`,`menu`,1,`mat-mdc-menu-panel`,3,`click`,`animationstart`,`animationend`,`animationcancel`,`id`],[1,`mat-mdc-menu-content`]],template:function(t,n){t&1&&(Rw(),bh$1(0,pt$5,3,12,`ng-template`))},styles:[`mat-menu { 890 display: none; 891} 892 893.mat-mdc-menu-content { 894 margin: 0; 895 padding: 8px 0; 896 outline: 0; 897} 898.mat-mdc-menu-content, 899.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text { 900 -moz-osx-font-smoothing: grayscale; 901 -webkit-font-smoothing: antialiased; 902 flex: 1; 903 white-space: normal; 904 font-family: var(--%NS%mat-menu-item-label-text-font, var(--%NS%mat-sys-label-large-font)); 905 line-height: var(--%NS%mat-menu-item-label-text-line-height, var(--%NS%mat-sys-label-large-line-height)); 906 font-size: var(--%NS%mat-menu-item-label-text-size, var(--%NS%mat-sys-label-large-size)); 907 letter-spacing: var(--%NS%mat-menu-item-label-text-tracking, var(--%NS%mat-sys-label-large-tracking)); 908 font-weight: var(--%NS%mat-menu-item-label-text-weight, var(--%NS%mat-sys-label-large-weight)); 909} 910 911@keyframes _mat-menu-enter { 912 from { 913 opacity: 0; 914 transform: scale(0.8); 915 } 916 to { 917 opacity: 1; 918 transform: none; 919 } 920} 921@keyframes _mat-menu-exit { 922 from { 923 opacity: 1; 924 } 925 to { 926 opacity: 0; 927 } 928} 929.mat-mdc-menu-panel { 930 min-width: 112px; 931 max-width: 280px; 932 overflow: auto; 933 box-sizing: border-box; 934 outline: 0; 935 animation: _mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1); 936 border-radius: var(--%NS%mat-menu-container-shape, var(--%NS%mat-sys-corner-extra-small)); 937 background-color: var(--%NS%mat-menu-container-color, var(--%NS%mat-sys-surface-container)); 938 box-shadow: var(--%NS%mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)); 939 will-change: transform, opacity; 940} 941.mat-mdc-menu-panel.mat-menu-panel-exit-animation { 942 animation: _mat-menu-exit 100ms 25ms linear forwards; 943} 944.mat-mdc-menu-panel.mat-menu-panel-animations-disabled { 945 animation: none; 946} 947.mat-mdc-menu-panel.mat-menu-panel-animating { 948 pointer-events: none; 949} 950.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty) { 951 display: none; 952} 953@media (forced-colors: active) { 954 .mat-mdc-menu-panel { 955 outline: solid 1px; 956 } 957} 958.mat-mdc-menu-panel .mat-divider { 959 border-top-color: var(--%NS%mat-menu-divider-color, var(--%NS%mat-sys-surface-variant));
960 margin-bottom: var(--%NS%mat-menu-divider-bottom-spacing, 8px); 961 margin-top: var(--%NS%mat-menu-divider-top-spacing, 8px); 962} 963 964.mat-mdc-menu-item { 965 display: flex; 966 position: relative; 967 align-items: center; 968 justify-content: flex-start; 969 overflow: hidden; 970 padding: 0; 971 cursor: pointer; 972 width: 100%; 973 text-align: left; 974 box-sizing: border-box; 975 color: inherit; 976 font-size: inherit; 977 background: none; 978 text-decoration: none; 979 margin: 0; 980 min-height: 48px; 981 padding-left: var(--%NS%mat-menu-item-leading-spacing, 12px); 982 padding-right: var(--%NS%mat-menu-item-trailing-spacing, 12px); 983 -webkit-user-select: none; 984 user-select: none; 985 cursor: pointer; 986 outline: none; 987 border: none; 988 -webkit-tap-highlight-color: transparent; 989} 990.mat-mdc-menu-item::-moz-focus-inner { 991 border: 0; 992} 993[dir=rtl] .mat-mdc-menu-item { 994 padding-left: var(--%NS%mat-menu-item-trailing-spacing, 12px); 995 padding-right: var(--%NS%mat-menu-item-leading-spacing, 12px); 996} 997.mat-mdc-menu-item:has(.material-icons, mat-icon, [matButtonIcon]) { 998 padding-left: var(--%NS%mat-menu-item-with-icon-leading-spacing, 12px); 999 padding-right: var(--%NS%mat-menu-item-with-icon-trailing-spacing, 12px); 1000} 1001[dir=rtl] .mat-mdc-menu-item:has(.material-icons, mat-icon, [matButtonIcon]) { 1002 padding-left: var(--%NS%mat-menu-item-with-icon-trailing-spacing, 12px); 1003 padding-right: var(--%NS%mat-menu-item-with-icon-leading-spacing, 12px); 1004} 1005.mat-mdc-menu-item, .mat-mdc-menu-item:visited, .mat-mdc-menu-item:link { 1006 color: var(--%NS%mat-menu-item-label-text-color, var(--%NS%mat-sys-on-surface)); 1007} 1008.mat-mdc-menu-item .mat-icon-no-color, 1009.mat-mdc-menu-item .mat-mdc-menu-submenu-icon { 1010 color: var(--%NS%mat-menu-item-icon-color, var(--%NS%mat-sys-on-surface-variant)); 1011} 1012.mat-mdc-menu-item[disabled] { 1013 cursor: default; 1014 opacity: 0.38; 1015} 1016.mat-mdc-menu-item[disabled]::after { 1017 display: block; 1018 position: absolute; 1019 content: ""; 1020 top: 0; 1021 left: 0; 1022 bottom: 0; 1023 right: 0; 1024} 1025.mat-mdc-menu-item:focus { 1026 outline: 0; 1027} 1028.mat-mdc-menu-item .mat-icon { 1029 flex-shrink: 0; 1030 margin-right: var(--%NS%mat-menu-item-spacing, 12px); 1031 height: var(--%NS%mat-menu-item-icon-size, 24px); 1032 width: var(--%NS%mat-menu-item-icon-size, 24px); 1033} 1034[dir=rtl] .mat-mdc-menu-item { 1035 text-align: right; 1036} 1037[dir=rtl] .mat-mdc-menu-item .mat-icon { 1038 margin-right: 0; 1039 margin-left: var(--%NS%mat-menu-item-spacing, 12px); 1040} 1041.mat-mdc-menu-item:not([disabled]):hover { 1042 background-color: var(--%NS%mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) calc(var(--%NS%mat-sys-hover-state-layer-opacity) * 100%), transparent)); 1043} 1044.mat-mdc-menu-item:not([disabled]).cdk-program-focused, .mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused, .mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted { 1045 background-color: var(--%NS%mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) calc(var(--%NS%mat-sys-focus-state-layer-opacity) * 100%), transparent)); 1046} 1047@media (forced-colors: active) { 1048 .mat-mdc-menu-item {
1049 margin-top: 1px; 1050 } 1051} 1052 1053.mat-mdc-menu-submenu-icon { 1054 width: var(--%NS%mat-menu-item-icon-size, 24px); 1055 height: 10px; 1056 fill: currentColor; 1057 padding-left: var(--%NS%mat-menu-item-spacing, 12px); 1058} 1059[dir=rtl] .mat-mdc-menu-submenu-icon { 1060 padding-right: var(--%NS%mat-menu-item-spacing, 12px); 1061 padding-left: 0; 1062} 1063[dir=rtl] .mat-mdc-menu-submenu-icon polygon { 1064 transform: scaleX(-1); 1065 transform-origin: center; 1066} 1067@media (forced-colors: active) { 1068 .mat-mdc-menu-submenu-icon { 1069 fill: CanvasText; 1070 } 1071} 1072 1073.mat-mdc-menu-item .mat-mdc-menu-ripple { 1074 top: 0; 1075 left: 0; 1076 right: 0; 1077 bottom: 0; 1078 position: absolute; 1079 pointer-events: none; 1080} 1081`],encapsulation:2})}return a})();var gt$5=new N$2(`mat-menu-scroll-strategy`,{providedIn:`root`,factory:()=>{let a=E(we$4);return()=>It$5(a)}});var h=new WeakMap;var ft$7=(()=>{class a{_canHaveBackdrop;_element=E(Lr$5);_viewContainerRef=E(is$5);_menuItemInstance=E(oe$3,{optional:!0,self:!0});_dir=E(Oc$4,{optional:!0});_focusMonitor=E(yn$4);_ngZone=E(Z$4);_injector=E(we$4);_scrollStrategy=E(gt$5);_changeDetectorRef=E(ej);_animationsDisabled=nt$5();_portal;_overlayRef=null;_menuOpen=!1;_closingActionsSubscription=F$2.EMPTY;_menuCloseSubscription=F$2.EMPTY;_pendingRemoval;_parentMaterialMenu;_parentInnerPadding;_openedBy=void 0;get _menu(){return this._menuInternal}set _menu(e){e!==this._menuInternal&&(this._menuInternal=e,this._menuCloseSubscription.unsubscribe(),e?(this._parentMaterialMenu,this._menuCloseSubscription=e.close.subscribe(t=>{this._destroyMenu(t),(t===`click`||t===`tab`)&&this._parentMaterialMenu&&this._parentMaterialMenu.closed.emit(t)})):this._destroyMenu(),this._menuItemInstance?._setTriggersSubmenu(this._triggersSubmenu()))}_menuInternal=null;constructor(e){this._canHaveBackdrop=e;let t=E(se$4,{optional:!0});this._parentMaterialMenu=t instanceof L$4?t:void 0}ngOnDestroy(){this._menu&&this._ownsMenu(this._menu)&&h.delete(this._menu),this._pendingRemoval?.unsubscribe(),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe(),this._overlayRef&&(this._overlayRef.dispose(),this._overlayRef=null)}get menuOpen(){return this._menuOpen}get dir(){return this._dir&&this._dir.value===`rtl`?`rtl`:`ltr`}_triggersSubmenu(){return!!(this._menuItemInstance&&this._parentMaterialMenu&&this._menu)}_closeMenu(){this._menu?.close.emit()}_openMenu(e){if(this._triggerIsAriaDisabled())return;let t=this._menu;if(this._menuOpen||!t)return;this._pendingRemoval?.unsubscribe();let n=h.get(t);h.set(t,this),n&&n!==this&&n._closeMenu();let i=this._createOverlay(t),o=i.getConfig(),r=o.positionStrategy;this._setPosition(t,r),this._canHaveBackdrop?o.hasBackdrop=t.hasBackdrop==null?!this._triggersSubmenu():t.hasBackdrop:o.hasBackdrop=t.hasBackdrop??!1,i.hasAttached()||(i.attach(this._getPortal(t)),t.lazyContent?.attach(this.menuData)),this._closingActionsSubscription=this._menuClosingActions().subscribe(()=>this._closeMenu()),t.parentMenu=this._triggersSubmenu()?this._parentMaterialMenu:void 0,t.direction=this.dir,e&&t.focusFirstItem(this._openedBy||`program`),this._setIsMenuOpen(!0),t instanceof L$4&&(t._setIsOpen(!0),t._directDescendantItems.changes.pipe(Eu$2(t.close)).subscribe(()=>{r.withLockedPosition(!1).reapplyLastPosition(),r.withLockedPosition(!0)}))}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._element,e,t):this._element.nativeElement.focus(t)}_destroyMenu(e){let t=this._overlayRef,n=this._menu;!t||!this.menuOpen||(this._closingActionsSubscription.unsubscribe(),this._pendingRemoval?.unsubscribe(),n instanceof L$4&&this._ownsMenu(n)?(this._pendingRemoval=n._animationDone.pipe(_t$9(1)).subscribe(()=>{t.detach(),h.has(n)||n.lazyContent?.detach()}),n._setIsOpen(!1)):(t.detach(),n?.lazyContent?.detach()),n&&this._ownsMenu(n)&&h.delete(n),this.restoreFocus&&(e===`keydown`||!this._openedBy||!this._triggersSubmenu())&&this.focus(this._openedBy),this._openedBy=void 0,this._setIsMenuOpen(!1))}
1081_setIsMenuOpen(e){e!==this._menuOpen&&(this._menuOpen=e,this._menuOpen?this.menuOpened.emit():this.menuClosed.emit(),this._triggersSubmenu()&&this._menuItemInstance._setHighlighted(e),this._changeDetectorRef.markForCheck())}_createOverlay(e){if(!this._overlayRef){let t=this._getOverlayConfig(e);this._subscribeToPositions(e,t.positionStrategy),this._overlayRef=Xt$4(this._injector,t),this._overlayRef.keydownEvents().subscribe(n=>{this._menu instanceof L$4&&this._menu._handleKeydown(n)})}return this._overlayRef}_getOverlayConfig(e){return new q$2({positionStrategy:Yt$2(this._injector,this._getOverlayOrigin()).withLockedPosition().withGrowAfterOpen().withTransformOriginOn(`.mat-menu-panel, .mat-mdc-menu-panel`),backdropClass:e.backdropClass||`cdk-overlay-transparent-backdrop`,panelClass:e.overlayPanelClass,scrollStrategy:this._scrollStrategy(),direction:this._dir||`ltr`,disableAnimations:this._animationsDisabled})}_subscribeToPositions(e,t){e.setPositionClasses&&t.positionChanges.subscribe(n=>{this._ngZone.run(()=>{let i=n.connectionPair.overlayX===`start`?`after`:`before`,o=n.connectionPair.overlayY===`top`?`below`:`above`;e.setPositionClasses(i,o)})})}_setPosition(e,t){let[n,i]=e.xPosition===`before`?[`end`,`start`]:[`start`,`end`],[o,r]=e.yPosition===`above`?[`bottom`,`top`]:[`top`,`bottom`],[H,V]=[o,r],[K,Y]=[n,i],_=0;if(this._triggersSubmenu()){if(Y=n=e.xPosition===`before`?`start`:`end`,i=K=n===`end`?`start`:`end`,this._parentMaterialMenu){if(this._parentInnerPadding==null){let re=this._parentMaterialMenu.items.first;this._parentInnerPadding=re?re._getHostElement().offsetTop:0}_=o===`bottom`?this._parentInnerPadding:-this._parentInnerPadding}}else e.overlapTrigger||(H=o===`top`?`bottom`:`top`,V=r===`top`?`bottom`:`top`);t.withPositions([{originX:n,originY:H,overlayX:K,overlayY:o,offsetY:_},{originX:i,originY:H,overlayX:Y,overlayY:o,offsetY:_},{originX:n,originY:V,overlayX:K,overlayY:r,offsetY:-_},{originX:i,originY:V,overlayX:Y,overlayY:r,offsetY:-_}])}_menuClosingActions(){let e=this._getOutsideClickStream(this._overlayRef),t=this._overlayRef.detachments();return _m(e,this._parentMaterialMenu?this._parentMaterialMenu.closed:um(),this._parentMaterialMenu?this._parentMaterialMenu._hovered().pipe(hn$4(o=>this._menuOpen&&o!==this._menuItemInstance)):um(),t)}_getPortal(e){return(!this._portal||this._portal.templateRef!==e.templateRef)&&(this._portal=new I$4(e.templateRef,this._viewContainerRef)),this._portal}_ownsMenu(e){return h.get(e)===this}_triggerIsAriaDisabled(){return rj(this._element.nativeElement.getAttribute(`aria-disabled`))}static ɵfac=function(t){XE()};static ɵdir=HD({type:a})}return a})();var Jt$3=(()=>{class a extends ft$7{_cleanupTouchstart;_hoverSubscription=F$2.EMPTY;get _deprecatedMatMenuTriggerFor(){return this.menu}set _deprecatedMatMenuTriggerFor(e){this.menu=e}get menu(){return this._menu}set menu(e){this._menu=e}menuData;restoreFocus=!0;menuOpened=new Qe$1;onMenuOpen=this.menuOpened;menuClosed=new Qe$1;onMenuClose=this.menuClosed;constructor(){super(!0);let e=E(pc$4);this._cleanupTouchstart=e.listen(this._element.nativeElement,`touchstart`,t=>{Nt$6(t)||(this._openedBy=`touch`)},{passive:!0})}triggersSubmenu(){return super._triggersSubmenu()}toggleMenu(){return this.menuOpen?this.closeMenu():this.openMenu()}openMenu(){this._openMenu(!0)}closeMenu(){this._closeMenu()}updatePosition(){this._overlayRef?.updatePosition()}ngAfterContentInit(){this._handleHover()}ngOnDestroy(){super.ngOnDestroy(),this._cleanupTouchstart(),this._hoverSubscription.unsubscribe()}_getOverlayOrigin(){return this._element}_getOutsideClickStream(e){return e.backdropClick()}_handleMousedown(e){Tt$4(e)||(this._openedBy=e.button===0?`mouse`:void 0,this.triggersSubmenu()&&e.preventDefault())}_handleKeydown(e){let t=e.keyCode;(t===13||t===32)&&(this._openedBy=`keyboard`),this.triggersSubmenu()&&(t===39&&this.dir===`ltr`||t===37&&this.dir===`rtl`)&&(this._openedBy=`keyboard`,this.openMenu())}_handleClick(e){this.triggersSubmenu()?(e.stopPropagation(),this.openMenu()):this.toggleMenu()}_handleHover(){this.triggersSubmenu()&&this._parentMaterialMenu&&(this._hoverSubscription=this._parentMaterialMenu._hovered().subscribe(e=>{e===this._menuItemInstance&&!e.disabled&&this._parentMaterialMenu?._panelAnimationState!==`void`&&(this._openedBy=`mouse`,this._openMenu(!1))}))}static ɵfac=function(t){return new(t||a)};static ɵdir=HD({type:a,selectors:[[``,`mat-menu-trigger-for`,``],[``,`matMenuTriggerFor`,``]],hostAttrs:[1,`mat-mdc-menu-trigger`],hostVars:3,hostBindings:function(t,n){t&1&&jh$3(`click`,function(o){return n._handleClick(o)})(`mousedown`,function(o){return n._handleMousedown(o)})(`keydown`,function(o){return n._handleKeydown(o)}),t&2&&xh$2(`aria-haspopup`,n.menu?`menu`:null)(`aria-expanded`,n.menuOpen)(`aria-controls`,n.menuOpen?n.menu?.panelId:null)},inputs:{_deprecatedMatMenuTriggerFor:[0,`mat-menu-trigger-for`,`_deprecatedMatMenuTriggerFor`],menu:[0,`matMenuTriggerFor`,`menu`],menuData:[0,`matMenuTriggerData`,`menuData`],restoreFocus:[0,`matMenuTriggerRestoreFocus`,`restoreFocus`]},outputs:{menuOpened:`menuOpened`,onMenuOpen:`onMenuOpen`,menuClosed:`menuClosed`,onMenuClose:`onMenuClose`},exportAs:[`matMenuTrigger`],features:[wh$3]})}return a})();var en$3=(()=>{class a{static ɵfac=function(t){return new(t||a)};static ɵmod=FD({type:a});static ɵinj=ju$1({imports:[aa$4,di$3,xn$4,Bt$5]})}return a})();var sn$4=(()=>{class a{get vertical(){return this._vertical}set vertical(e){this._vertical=Th$3(e)}_vertical=!1;get inset(){return this._inset}set inset(e){this._inset=Th$3(e)}_inset=!1;static ɵfac=function(t){return new(t||a)};static ɵcmp=PD({type:a,selectors:[[`mat-divider`]],hostAttrs:[`role`,`separator`,1,`mat-divider`],hostVars:7,hostBindings:function(t,n){t&2&&(xh$2(`aria-orientation`,n.vertical?`vertical`:`horizontal`),Yh$3(`mat-divider-vertical`,n.vertical)(`mat-divider-horizontal`,!n.vertical)(`mat-divider-inset`,n.inset))},inputs:{vertical:`vertical`,inset:`inset`},decls:0,vars:0,template:function(t,n){},styles:[`.mat-divider { 1082 display: block; 1083 margin: 0; 1084 border-top-style: solid; 1085 border-top-color: var(--%NS%mat-divider-color, var(--%NS%mat-sys-outline-variant)); 1086 border-top-width: var(--%NS%mat-divider-width, 1px); 1087} 1088.mat-divider.mat-divider-vertical { 1089 border-top: 0; 1090 border-right-style: solid; 1091 border-right-color: var(--%NS%mat-divider-color, var(--%NS%mat-sys-outline-variant)); 1092 border-right-width: var(--%NS%mat-divider-width, 1px); 1093} 1094.mat-divider.mat-divider-inset { 1095 margin-left: 80px; 1096} 1097[dir=rtl] .mat-divider.mat-divider-inset { 1098 margin-left: auto; 1099 margin-right: 80px; 1100} 1101`],encapsulation:2})}return a})();var rn$4=(()=>{class a{static ɵfac=function(t){return new(t||a)};static ɵmod=FD({type:a});static ɵinj=ju$1({imports:[xn$4]})}return a})();var T$3=class h{api=E(E$1);http=E(yo$5);config=E(kR);profile=E(ie$4);coachingTracks=ni$3([]);athleteEnrollments=ni$3(new Map);loading=this.api.loading;get apiUrl(){return this.config.config().apiUrl}get trackListPath(){return this.profile.isAdminOrManager()?`/api/v3/manager/coaching-tracks`:`/api/v3/coach/coaching-tracks`}get trackDetailPath(){return this.profile.isAdminOrManager()?`/api/v3/manager/coaching-tracks/{track_id}`:`/api/v3/coach/coaching-tracks/{track_id}`}get trackFilePath(){return this.profile.isAdminOrManager()?`/api/v3/manager/coaching-tracks/{track_id}/files/{file_id}`:`/api/v3/coach/coaching-tracks/{track_id}/files/{file_id}`}fetchCoachingTracks(){return ps$4(this,null,function*(){let e=yield this.api.get(this.trackListPath);this.coachingTracks.set(e.tracks??[])})}getCoachingTrack(e){return ps$4(this,null,function*(){return yield this.api.get(this.trackDetailPath,{pathParams:{track_id:e}})})}createCoachingTrack(e){return ps$4(this,null,function*(){let a=yield this.api.post(this.trackListPath,e);return yield this.fetchCoachingTracks(),a})}updateCoachingTrack(e,a){return ps$4(this,null,function*(){let t=yield this.api.put(this.trackDetailPath,a,{pathParams:{track_id:e}});return yield this.fetchCoachingTracks(),t})}deleteCoachingTrack(e){return ps$4(this,null,function*(){yield this.api.delete(this.trackDetailPath,{pathParams:{track_id:e}}),this.coachingTracks.update(a=>a.filter(t=>t.id!==e))})}uploadCoachingTrackFile(e,a){return ps$4(this,null,function*(){let t=new FormData;t.append(`file`,a);let r=this.profile.isAdminOrManager()?`manager`:`coach`;return yield pm(this.http.post(`${this.apiUrl}/api/v3/${r}/coaching-tracks/${e}/files`,t))})}
1101downloadCoachingTrackFile(e,a,t){return ps$4(this,null,function*(){let r=this.profile.isAdminOrManager()?`manager`:`coach`,c=`${this.apiUrl}/api/v3/${r}/coaching-tracks/${e}/files/${a}`,l=yield pm(this.http.get(c,{responseType:`blob`})),o=URL.createObjectURL(l),n=document.createElement(`a`);n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)})}deleteCoachingTrackFile(e,a){return ps$4(this,null,function*(){yield this.api.delete(this.trackFilePath,{pathParams:{track_id:e,file_id:a}})})}fetchEnrollmentsForAthlete(e){return ps$4(this,null,function*(){let[a,t]=yield Promise.all([this.api.get(`/api/v3/athletes/{athlete_id}/coaching-tracks`,{pathParams:{athlete_id:e},queryParams:{status:`active`}}),this.api.get(`/api/v3/athletes/{athlete_id}/coaching-tracks`,{pathParams:{athlete_id:e},queryParams:{status:`completed,cancelled`}})]),r=a.enrollments??[],c=t.enrollments??[];this.athleteEnrollments.update(l=>{let o=new Map(l);return o.set(e,{active:r,past:c}),o})})}enrollAthlete(e,a){return ps$4(this,null,function*(){let t=yield this.api.post(`/api/v3/athletes/{athlete_id}/coaching-tracks`,a,{pathParams:{athlete_id:e}});return yield this.fetchEnrollmentsForAthlete(e),t})}getEnrollment(e,a){return ps$4(this,null,function*(){return yield this.api.get(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}`,{pathParams:{athlete_id:e,enrollment_id:a}})})}cancelEnrollment(e,a){return ps$4(this,null,function*(){yield this.api.delete(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}`,{pathParams:{athlete_id:e,enrollment_id:a}}),yield this.fetchEnrollmentsForAthlete(e)})}updateEnrollment(e,a,t){return ps$4(this,null,function*(){let r=yield this.api.put(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}`,t,{pathParams:{athlete_id:e,enrollment_id:a}});return yield this.fetchEnrollmentsForAthlete(e),r})}addEnrollmentItem(e,a,t){return ps$4(this,null,function*(){return(yield this.api.post(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/items`,t,{pathParams:{athlete_id:e,enrollment_id:a}})).items??[]})}updateEnrollmentItem(e,a,t,r){return ps$4(this,null,function*(){return yield this.api.put(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/items/{item_id}`,r,{pathParams:{athlete_id:e,enrollment_id:a,item_id:t}})})}deleteEnrollmentItem(e,a,t){return ps$4(this,null,function*(){yield this.api.delete(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/items/{item_id}`,{pathParams:{athlete_id:e,enrollment_id:a,item_id:t}})})}updateEnrollmentItemGroup(e,a,t,r){return ps$4(this,null,function*(){return(yield this.api.put(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/items/group/{repeat_group_id}`,r,{pathParams:{athlete_id:e,enrollment_id:a,repeat_group_id:t}})).items??[]})}deleteEnrollmentItemGroup(e,a,t){return ps$4(this,null,function*(){yield this.api.delete(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/items/group/{repeat_group_id}`,{pathParams:{athlete_id:e,enrollment_id:a,repeat_group_id:t}})})}uploadEnrollmentFile(e,a,t){return ps$4(this,null,function*(){let r=new FormData;return r.append(`file`,t),yield pm(this.http.post(`${this.apiUrl}/api/v3/athletes/${e}/coaching-tracks/${a}/files`,r))})}previewEnrollmentFile(e,a,t){return ps$4(this,null,function*(){return yield this.api.get(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/files/{file_id}/preview`,{pathParams:{athlete_id:e,enrollment_id:a,file_id:t}})})}downloadEnrollmentFile(e,a,t,r){return ps$4(this,null,function*(){let c=`${this.apiUrl}/api/v3/athletes/${e}/coaching-tracks/${a}/files/${t}`,l=yield pm(this.http.get(c,{responseType:`blob`})),o=URL.createObjectURL(l),n=document.createElement(`a`);n.href=o,n.download=r,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)})}deleteEnrollmentFile(e,a,t){return ps$4(this,null,function*(){yield this.api.delete(`/api/v3/athletes/{athlete_id}/coaching-tracks/{enrollment_id}/files/{file_id}`,{pathParams:{athlete_id:e,enrollment_id:a,file_id:t}}
1101)})}static ɵfac=function(a){return new(a||h)};static ɵprov=ue$3({token:h,factory:h.ɵfac,providedIn:`root`})};var w$3=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;var y=/^(\d?\d)[:.](\d?\d)(?:[:.](\d?\d))?\s*(AM|PM)?$/i;function l$1(n,a){let e=Array(n);for(let t=0;t<n;t++)e[t]=a(t);return e}var T$2=(()=>{class n extends l$2{_matDateLocale=E(m$3,{optional:!0});constructor(){super();let e=E(m$3,{optional:!0});e!==void 0&&(this._matDateLocale=e),super.setLocale(this._matDateLocale)}getYear(e){return e.getFullYear()}getMonth(e){return e.getMonth()}getDate(e){return e.getDate()}getDayOfWeek(e){return e.getDay()}getMonthNames(e){let t=new Intl.DateTimeFormat(this.locale,{month:e,timeZone:`utc`});return l$1(12,r=>this._format(t,new Date(2017,r,1)))}getDateNames(){let e=new Intl.DateTimeFormat(this.locale,{day:`numeric`,timeZone:`utc`});return l$1(31,t=>this._format(e,new Date(2017,0,t+1)))}getDayOfWeekNames(e){let t=new Intl.DateTimeFormat(this.locale,{weekday:e,timeZone:`utc`});return l$1(7,r=>this._format(t,new Date(2017,0,r+1)))}getYearName(e){let t=new Intl.DateTimeFormat(this.locale,{year:`numeric`,timeZone:`utc`});return this._format(t,e)}getFirstDayOfWeek(){if(typeof Intl<`u`&&Intl.Locale){let e=new Intl.Locale(this.locale),t=(e.getWeekInfo?.()||e.weekInfo)?.firstDay??0;return t===7?0:t}return 0}getNumDaysInMonth(e){return this.getDate(this._createDateWithOverflow(this.getYear(e),this.getMonth(e)+1,0))}clone(e){return new Date(e.getTime())}createDate(e,t,r){let o=this._createDateWithOverflow(e,t,r);return o.getMonth(),o}today(){return new Date}parse(e,t){return typeof e==`number`?new Date(e):e?new Date(Date.parse(e)):null}format(e,t){if(!this.isValid(e))throw Error(`NativeDateAdapter: Cannot format invalid date.`);let r=new Intl.DateTimeFormat(this.locale,W$4(q$1({},t),{timeZone:`utc`}));return this._format(r,e)}addCalendarYears(e,t){return this.addCalendarMonths(e,t*12)}addCalendarMonths(e,t){let r=this._createDateWithOverflow(this.getYear(e),this.getMonth(e)+t,this.getDate(e));return this.getMonth(r)!=((this.getMonth(e)+t)%12+12)%12&&(r=this._createDateWithOverflow(this.getYear(r),this.getMonth(r),0)),r}addCalendarDays(e,t){return this._createDateWithOverflow(this.getYear(e),this.getMonth(e),this.getDate(e)+t)}toIso8601(e){return[e.getUTCFullYear(),this._2digit(e.getUTCMonth()+1),this._2digit(e.getUTCDate())].join(`-`)}deserialize(e){if(typeof e==`string`){if(!e)return null;if(w$3.test(e)){let t=new Date(e);if(this.isValid(t))return t}}return super.deserialize(e)}isDateInstance(e){return e instanceof Date}isValid(e){return!isNaN(e.getTime())}invalid(){return new Date(NaN)}setTime(e,t,r,o){let i=this.clone(e);return i.setHours(t,r,o,0),i}getHours(e){return e.getHours()}getMinutes(e){return e.getMinutes()}getSeconds(e){return e.getSeconds()}parseTime(e,t){if(typeof e!=`string`)return e instanceof Date?new Date(e.getTime()):null;let r=e.trim();if(r.length===0)return null;let o=this._parseTimeString(r);if(o===null){let i=r.replace(/[^0-9:(AM|PM)]/gi,``).trim();i.length>0&&(o=this._parseTimeString(i))}return o||this.invalid()}addSeconds(e,t){return new Date(e.getTime()+t*1e3)}_createDateWithOverflow(e,t,r){let o=new Date;return o.setFullYear(e,t,r),o.setHours(0,0,0,0),o}_2digit(e){return(`00`+e).slice(-2)}_format(e,t){let r=new Date;return r.setUTCFullYear(t.getFullYear(),t.getMonth(),t.getDate()),r.setUTCHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e.format(r)}_parseTimeString(e){let t=e.toUpperCase().match(y);if(t){let r=parseInt(t[1]),o=parseInt(t[2]),i=t[3]==null?void 0:parseInt(t[3]),c=t[4];if(r===12?r=c===`AM`?0:r:c===`PM`&&(r+=12),m$1(r,0,23)&&m$1(o,0,59)&&(i==null||m$1(i,0,59)))return this.setTime(this.today(),r,o,i||0)}return null}static ɵfac=function(t){return new(t||n)};static ɵprov=rn$5({token:n,factory:n.ɵfac,autoProvided:!1})}return n})();function m$1(n,a,e){return!isNaN(n)&&n>=a&&n<=e}var _$1={parse:{dateInput:null,timeInput:null},display:{dateInput:{year:`numeric`,month:`numeric`,day:`numeric`},timeInput:{hour:`numeric`,minute:`numeric`},monthYearLabel:{year:`numeric`,month:`short`},dateA11yLabel:{year:`numeric`,month:`long`,day:`numeric`},monthYearA11yLabel:{year:`numeric`,month:`long`},timeOptionLabel:{hour:`numeric`,minute:`numeric`}}};var L$3=(()=>{class n{static ɵfac=function(t){return new(t||n)};static ɵmod=FD({type:n});static ɵinj=ju$1({providers:[v()]})}return n})();function v(n=_$1){return[{provide:l$2,useClass:T$2},{provide:d$3,useValue:n}]}function ga$3(i,o){return this._trackRow(o)}var ra$3=(i,o)=>o.id;function fa$3(i,o){if(i&1&&(Il$4(0,`tr`,0)(1,`td`,3),lC(2),El$4()()),i&2){let e=xw();sE(),Zh$2(`padding-top`,e._cellPadding)(`padding-bottom`,e._cellPadding),xh$2(`colspan`,e.numCols),sE(),Cl$4(` `,e.label,` `)}}function ba$3(i,o){if(i&1&&(Il$4(0,`td`,3),lC(1),El$4()),i&2){let e=xw(2);Zh$2(`padding-top`,e._cellPadding)(`padding-bottom`,e._cellPadding),xh$2(`colspan`,e._firstRowOffset),sE(),Cl$4(` `,e._firstRowOffset>=e.labelMinRequiredCells?e.label:``,` `)}}function Da$3(i,o){if(i&1){let e=Cw();Il$4(0,`td`,6)(1,`button`,7),Vh$3(`click`,function(t){let n=ld$2(e).$implicit;return ud$1(xw(2)._cellClicked(n,t))})(`focus`,function(t){let n=ld$2(e).$implicit;return ud$1(xw(2)._emitActiveDateChange(n,t))}),Il$4(2,`span`,8),lC(3),El$4(),kh$3(4,`span`,9),El$4()()}if(i&2){let e=o.$implicit,a=o.$index,t=xw().$index,n=xw();Zh$2(`width`,n._cellWidth)(`padding-top`,n._cellPadding)(`padding-bottom`,n._cellPadding),xh$2(`data-mat-row`,t)(`data-mat-col`,a),sE(),Xw(e.cssClasse
1101s),Yh$3(`mat-calendar-body-disabled`,!e.enabled)(`mat-calendar-body-active`,n._isActiveCell(t,a))(`mat-calendar-body-range-start`,n._isRangeStart(e.compareValue))(`mat-calendar-body-range-end`,n._isRangeEnd(e.compareValue))(`mat-calendar-body-in-range`,n._isInRange(e.compareValue))(`mat-calendar-body-comparison-bridge-start`,n._isComparisonBridgeStart(e.compareValue,t,a))(`mat-calendar-body-comparison-bridge-end`,n._isComparisonBridgeEnd(e.compareValue,t,a))(`mat-calendar-body-comparison-start`,n._isComparisonStart(e.compareValue))(`mat-calendar-body-comparison-end`,n._isComparisonEnd(e.compareValue))(`mat-calendar-body-in-comparison-range`,n._isInComparisonRange(e.compareValue))(`mat-calendar-body-preview-start`,n._isPreviewStart(e.compareValue))(`mat-calendar-body-preview-end`,n._isPreviewEnd(e.compareValue))(`mat-calendar-body-in-preview`,n._isInPreview(e.compareValue)),Lh$3(`tabIndex`,n._isActiveCell(t,a)?0:-1),xh$2(`aria-label`,e.ariaLabel)(`aria-disabled`,!e.enabled||null)(`aria-pressed`,n._isSelected(e.compareValue))(`aria-current`,n.todayValue===e.compareValue?`date`:null)(`aria-describedby`,n._getDescribedby(e.compareValue)),sE(),Yh$3(`mat-calendar-body-selected`,n._isSelected(e.compareValue))(`mat-calendar-body-comparison-identical`,n._isComparisonIdentical(e.compareValue))(`mat-calendar-body-today`,n.todayValue===e.compareValue),sE(),Cl$4(` `,e.displayValue,` `)}}function va$3(i,o){if(i&1&&(Il$4(0,`tr`,1),fw(1,ba$3,2,6,`td`,4),mw(2,Da$3,5,49,`td`,5,ra$3),El$4()),i&2){let e=o.$implicit,a=o.$index,t=xw();sE(),pw(a===0&&t._firstRowOffset?1:-1),sE(),yw(e)}}function ya$3(i,o){if(i&1&&(Bi$3(0,`th`,2)(1,`span`,6),lC(2),vl$4(),Bi$3(3,`span`,3),lC(4),vl$4()()),i&2){let e=o.$implicit;sE(2),ig(e.long),sE(2),ig(e.narrow)}}var Ca$3=[`*`];function wa$3(i,o){}function Aa$3(i,o){if(i&1){let e=Cw();Bi$3(0,`mat-month-view`,4),dg(`activeDateChange`,function(t){ld$2(e);let n=xw();return gC(n.activeDate,t)||(n.activeDate=t),ud$1(t)}),jh$3(`_userSelection`,function(t){ld$2(e);return ud$1(xw()._dateSelected(t))})(`dragStarted`,function(t){ld$2(e);return ud$1(xw()._dragStarted(t))})(`dragEnded`,function(t){ld$2(e);return ud$1(xw()._dragEnded(t))}),vl$4()}if(i&2){let e=xw();ug(`activeDate`,e.activeDate),Ah$2(`selected`,e.selected)(`dateFilter`,e.dateFilter)(`maxDate`,e.maxDate)(`minDate`,e.minDate)(`dateClass`,e.dateClass)(`comparisonStart`,e.comparisonStart)(`comparisonEnd`,e.comparisonEnd)(`startDateAccessibleName`,e.startDateAccessibleName)(`endDateAccessibleName`,e.endDateAccessibleName)(`activeDrag`,e._activeDrag)}}function ka$3(i,o){if(i&1){let e=Cw();Bi$3(0,`mat-year-view`,5),dg(`activeDateChange`,function(t){ld$2(e);let n=xw();return gC(n.activeDate,t)||(n.activeDate=t),ud$1(t)}),jh$3(`monthSelected`,function(t){ld$2(e);return ud$1(xw()._monthSelectedInYearView(t))})(`selectedChange`,function(t){ld$2(e);return ud$1(xw()._goToDateInView(t,`month`))}),vl$4()}if(i&2){let e=xw();ug(`activeDate`,e.activeDate),Ah$2(`selected`,e.selected)(`dateFilter`,e.dateFilter)(`maxDate`,e.maxDate)(`minDate`,e.minDate)(`dateClass`,e.dateClass)}}function Sa$3(i,o){if(i&1){let e=Cw();Bi$3(0,`mat-multi-year-view`,6),dg(`activeDateChange`,function(t){ld$2(e);let n=xw();return gC(n.activeDate,t)||(n.activeDate=t),ud$1(t)}),jh$3(`yearSelected`,function(t){ld$2(e);return ud$1(xw()._yearSelectedInMultiYearView(t))})(`selectedChange`,function(t){ld$2(e);return ud$1(xw()._goToDateInView(t,`year`))}),vl$4()}if(i&2){let e=xw();ug(`activeDate`,e.activeDate),Ah$2(`selected`,e.selected)(`dateFilter`,e.dateFilter)(`maxDate`,e.maxDate)(`minDate`,e.minDate)(`dateClass`,e.dateClass)}}function Ma$3(i,o){}var Va$3=[`button`];var Ea$3=[[[``,`matDatepickerToggleIcon`,``]]];var xa$3=[`[matDatepickerToggleIcon]`];function Ia$3(i,o){i&1&&(Dd$1(),Bi$3(0,`svg`,2),Rh$3(1,`path`,3),vl$4())}var Fa$3=[[[`input`,`matStartDate`,``]],[[`input`,`matEndDate`,``]]];var Na$3=[`input[matStartDate]`,`input[matEndDate]`];var ae$5=(()=>{class i{changes=new ee$5;calendarLabel=`Calendar`;openCalendarLabel=`Open calendar`;closeCalendarLabel=`Close calendar`;prevMonthLabel=`Previous month`;nextMonthLabel=`Next month`;prevYearLabel=`Previous year`;nextYearLabel=`Next year`;prevMultiYearLabel=`Previous 24 years`;nextMultiYearLabel=`Next 24 years`;switchToMonthViewLabel=`Choose date`;switchToMultiYearViewLabel=`Choose month and year`;startDateLabel=`Start date`;endDateLabel=`End date`;comparisonDateLabel=`Comparison range`;formatYearRange(e,a){return`${e} \u2013 ${a}`}formatYearRangeLabel(e,a){return`${e} to ${a}`}static ɵfac=function(a){return new(a||i)};static ɵprov=rn$5({token:i,factory:i.ɵfac})}return i})();var Ra$3=0;var fe$3=class{value;displayValue;ariaLabel;enabled;compareValue;rawValue;id=Ra$3++;
1101cssClasses;constructor(o,e,a,t,n,r=o,l){this.value=o,this.displayValue=e,this.ariaLabel=a,this.enabled=t,this.compareValue=r,this.rawValue=l,this.cssClasses=n instanceof Set?Array.from(n):n}};var Ta$3={passive:!1,capture:!0};var Te$4={passive:!0,capture:!0};var Zt$3={passive:!0};var J$3=(()=>{class i{_elementRef=E(Lr$5);_ngZone=E(Z$4);_platform=E(k$2);_intl=E(ae$5);_eventCleanups;_skipNextFocus=!1;_focusActiveCellAfterViewChecked=!1;label;rows;todayValue;startValue;endValue;labelMinRequiredCells;numCols=7;activeCell=0;ngAfterViewChecked(){this._focusActiveCellAfterViewChecked&&(this._focusActiveCell(),this._focusActiveCellAfterViewChecked=!1)}isRange=!1;cellAspectRatio=1;comparisonStart=null;comparisonEnd=null;previewStart=null;previewEnd=null;startDateAccessibleName=null;endDateAccessibleName=null;selectedValueChange=new Qe$1;previewChange=new Qe$1;activeDateChange=new Qe$1;dragStarted=new Qe$1;dragEnded=new Qe$1;_firstRowOffset;_cellPadding;_cellWidth;_startDateLabelId;_endDateLabelId;_comparisonStartDateLabelId;_comparisonEndDateLabelId;_didDragSinceMouseDown=!1;_injector=E(we$4);comparisonDateAccessibleName=this._intl.comparisonDateLabel;_trackRow=e=>e;constructor(){let e=E(pc$4),a=E(Or$4);this._startDateLabelId=a.getId(`mat-calendar-body-start-`),this._endDateLabelId=a.getId(`mat-calendar-body-end-`),this._comparisonStartDateLabelId=a.getId(`mat-calendar-body-comparison-start-`),this._comparisonEndDateLabelId=a.getId(`mat-calendar-body-comparison-end-`),E(be$3).load(ra$5),this._ngZone.runOutsideAngular(()=>{let t=this._elementRef.nativeElement,n=[e.listen(t,`touchmove`,this._touchmoveHandler,Ta$3),e.listen(t,`mouseenter`,this._enterHandler,Te$4),e.listen(t,`focus`,this._enterHandler,Te$4),e.listen(t,`mouseleave`,this._leaveHandler,Te$4),e.listen(t,`blur`,this._leaveHandler,Te$4),e.listen(t,`mousedown`,this._mousedownHandler,Zt$3),e.listen(t,`touchstart`,this._mousedownHandler,Zt$3)];this._platform.isBrowser&&n.push(e.listen(`window`,`mouseup`,this._mouseupHandler),e.listen(`window`,`touchend`,this._touchendHandler)),this._eventCleanups=n})}_cellClicked(e,a){this._didDragSinceMouseDown||e.enabled&&this.selectedValueChange.emit({value:e.value,event:a})}_emitActiveDateChange(e,a){e.enabled&&this.activeDateChange.emit({value:e.value,event:a})}_isSelected(e){return this.startValue===e||this.endValue===e}ngOnChanges(e){let a=e.numCols,{rows:t,numCols:n}=this;(e.rows||a)&&(this._firstRowOffset=t&&t.length&&t[0].length?n-t[0].length:0),(e.cellAspectRatio||a||!this._cellPadding)&&(this._cellPadding=`${50*this.cellAspectRatio/n}%`),(a||!this._cellWidth)&&(this._cellWidth=`${100/n}%`)}ngOnDestroy(){this._eventCleanups.forEach(e=>e())}_isActiveCell(e,a){let t=e*this.numCols+a;return e&&(t-=this._firstRowOffset),t==this.activeCell}_focusActiveCell(e=!0){wp$1(()=>{setTimeout(()=>{let a=this._elementRef.nativeElement.querySelector(`.mat-calendar-body-active`);a&&(e||(this._skipNextFocus=!0),a.focus())})},{injector:this._injector})}_scheduleFocusActiveCellAfterViewChecked(){this._focusActiveCellAfterViewChecked=!0}_isRangeStart(e){return it$3(e,this.startValue,this.endValue)}_isRangeEnd(e){return rt$4(e,this.startValue,this.endValue)}_isInRange(e){return st$5(e,this.startValue,this.endValue,this.isRange)}_isComparisonStart(e){return it$3(e,this.comparisonStart,this.comparisonEnd)}_isComparisonBridgeStart(e,a,t){if(!this._isComparisonStart(e)||this._isRangeStart(e)||!this._isInRange(e))return!1;let n=this.rows[a][t-1];if(!n){let r=this.rows[a-1];n=r&&r[r.length-1]}return n&&!this._isRangeEnd(n.compareValue)}_isComparisonBridgeEnd(e,a,t){if(!this._isComparisonEnd(e)||this._isRangeEnd(e)||!this._isInRange(e))return!1;let n=this.rows[a][t+1];if(!n){let r=this.rows[a+1];n=r&&r[0]}return n&&!this._isRangeStart(n.compareValue)}_isComparisonEnd(e){return rt$4(e,this.comparisonStart,this.comparisonEnd)}_isInComparisonRange(e){return st$5(e,this.comparisonStart,this.comparisonEnd,this.isRange)}_isComparisonIdentical(e){return this.comparisonStart===this.comparisonEnd&&e===this.comparisonStart}_isPreviewStart(e){return it$3(e,this.previewStart,this.previewEnd)}_isPreviewEnd(e){return rt$4(e,this.previewStart,this.previewEnd)}_isInPreview(e){return st$5(e,this.previewStart,this.previewEnd,this.isRange)}_getDescribedby(e){if(!this.isRange)return null;if(this.startValue===e&&this.endValue===e)return`${this._startDateLabelId} ${this._endDateLabelId}`;if(this.startValue===e)return this._startDateLabelId;if(this.endValue===e)return this._endDateLabelId;if(this.comparisonStart!==null&&this.comparisonEnd!==null){if(e===this.comparisonStart&&e===this.comparisonEnd)return`${this._comparisonStartDateLabelId} ${this._comparisonEndDateLabelId}`;if(e===this.comparisonStart)return this._comparisonStartDateLabelId;if(e===this.comparisonEnd)return this._comparisonEndDateLabelId}return null}_enterHandler=e=>{if(this._skipNextFocus&&e.type===`focus`){this._skipNextFocus=!1;return}if(e.target&&this.isRange){let a=this._getCellFromElement(e.target);a&&this._ngZone.run(()=>this.previewChange.emit({value:a.enabled?a:null,event:e}))}};_touchmoveHandler=e=>{if(!this.isRange)return;let a=Jt$2(e),t=a?this._getCellFromElement(a):null;a!==e.target&&(this._didDragSinceMouseDown=!0),nt$4(e.target)&&e.preventDefault(),this._ngZone.run(()=>this.previewChange.emit({value:t?.enabled?t:null,event:e}))};_leaveHandler=e=>{this.previewEnd!==null&&this.isRange&&(e.type!==`blur`&&(this._didDragSinceMouseDown=!0),e.target&&this._getCellFromElement(e.target)&&!(e.relatedTarget&&this._getCellFromElement(e.relatedTarget))&&this._ngZone.run(()=>this.previewChange.emit({value:null,event:e})))};_mousedownHandler=e=>{if(!this.isRange)return;this._didDragSinceMouseDown=!1;let a=e.target&&this._getCellFromElement(e.target);!a||!this._isInRange(a.compareValue)||this._ngZone.run(()=>{this.dragStarted.emit({value:a.rawValue,event:e})})};_mouseupHandler=e=>{if(!this.isRange)return;let a=nt$4(e.target);if(!a){this._ngZone.run(()=>{this.dragEnded.emit({value:null,event:e})});return}a.closest(`.mat-calendar-body`)===this._elementRef.nativeElement&&this._ngZone.run(()=>{let t=this._getCellFromElement(a);this.dragEnded.emit({value:t?.rawValue??null,event:e})})};_touchendHandler=e=>{let a=Jt$2(e);a&&this._mouseupHandler({target:a})};_getCellFromElement(e){let a=nt$4(e);if(a){let t=a.getAttribute(`data-mat-row`),n=a.getAttribute(`data-mat-col`);if(t&&n)return this.rows[parseInt(t)]?.[parseInt(n)]||null}return null}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[``,`mat-calendar-body`,``]],hostAttrs:[1,`mat-calendar-body`],inputs:{label:`label`,rows:`rows`,todayValue:`todayValue`,startValue:`startValue`,endValue:`endValue`,labelMinRequiredCells:`labelMinRequiredCells`,numCols:`numCols`,activeCell:`activeCell`,isRange:`isRange`,cellAspectRatio:`cellAspectRatio`,comparisonStart:`comparisonStart`,comparisonEnd:`comparisonEnd`,previewStart:`previewStart`,previewEnd:`previewEnd`,startDateAccessibleName:`startDateAccessibleName`,endD
1101ateAccessibleName:`endDateAccessibleName`},outputs:{selectedValueChange:`selectedValueChange`,previewChange:`previewChange`,activeDateChange:`activeDateChange`,dragStarted:`dragStarted`,dragEnded:`dragEnded`},exportAs:[`matCalendarBody`],features:[qy],decls:11,vars:11,consts:[[`aria-hidden`,`true`],[`role`,`row`],[1,`mat-calendar-body-hidden-label`,3,`id`],[1,`mat-calendar-body-label`],[1,`mat-calendar-body-label`,3,`paddingTop`,`paddingBottom`],[`role`,`gridcell`,1,`mat-calendar-body-cell-container`,3,`width`,`paddingTop`,`paddingBottom`],[`role`,`gridcell`,1,`mat-calendar-body-cell-container`],[`type`,`button`,1,`mat-calendar-body-cell`,3,`click`,`focus`,`tabindex`],[1,`mat-calendar-body-cell-content`,`mat-focus-indicator`],[`aria-hidden`,`true`,1,`mat-calendar-body-cell-preview`]],template:function(a,t){a&1&&(fw(0,fa$3,3,6,`tr`,0),mw(1,va$3,4,1,`tr`,1,ga$3,!0),Il$4(3,`span`,2),lC(4),El$4(),Il$4(5,`span`,2),lC(6),El$4(),Il$4(7,`span`,2),lC(8),El$4(),Il$4(9,`span`,2),lC(10),El$4()),a&2&&(pw(t._firstRowOffset<t.labelMinRequiredCells?0:-1),sE(),yw(t.rows),sE(2),Lh$3(`id`,t._startDateLabelId),sE(),Cl$4(` `,t.startDateAccessibleName,` 1102`),sE(),Lh$3(`id`,t._endDateLabelId),sE(),Cl$4(` `,t.endDateAccessibleName,` 1103`),sE(),Lh$3(`id`,t._comparisonStartDateLabelId),sE(),sg(` `,t.comparisonDateAccessibleName,` `,t.startDateAccessibleName,` 1104`),sE(),Lh$3(`id`,t._comparisonEndDateLabelId),sE(),sg(` `,t.comparisonDateAccessibleName,` `,t.endDateAccessibleName,` 1105`))},styles:[`.mat-calendar-body { 1106 min-width: 224px; 1107} 1108 1109.mat-calendar-body-today:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { 1110 border-color: var(--%NS%mat-datepicker-calendar-date-today-outline-color, var(--%NS%mat-sys-primary)); 1111} 1112 1113.mat-calendar-body-label { 1114 height: 0; 1115 line-height: 0; 1116 text-align: start; 1117 padding-left: 4.7142857143%; 1118 padding-right: 4.7142857143%; 1119 font-size: var(--%NS%mat-datepicker-calendar-body-label-text-size, var(--%NS%mat-sys-title-small-size)); 1120 font-weight: var(--%NS%mat-datepicker-calendar-body-label-text-weight, var(--%NS%mat-sys-title-small-weight)); 1121 color: var(--%NS%mat-datepicker-calendar-body-label-text-color, var(--%NS%mat-sys-on-surface)); 1122} 1123 1124.mat-calendar-body-hidden-label { 1125 display: none; 1126} 1127 1128.mat-calendar-body-cell-container { 1129 position: relative; 1130 height: 0; 1131 line-height: 0; 1132} 1133 1134.mat-calendar-body-cell { 1135 position: absolute; 1136 top: 0; 1137 left: 0; 1138 width: 100%; 1139 height: 100%; 1140 background: none; 1141 text-align: center; 1142 outline: none; 1143 margin: 0; 1144 font-family: var(--%NS%mat-datepicker-calendar-text-font, var(--%NS%mat-sys-body-medium-font)); 1145 font-size: var(--%NS%mat-datepicker-calendar-text-size, var(--%NS%mat-sys-body-medium-size)); 1146 -webkit-user-select: none; 1147 user-select: none; 1148 cursor: pointer; 1149 outline: none; 1150 border: none; 1151 -webkit-tap-highlight-color: transparent; 1152} 1153.mat-calendar-body-cell::-moz-focus-inner { 1154 border: 0; 1155} 1156 1157.mat-calendar-body-cell::before, 1158.mat-calendar-body-cell::after, 1159.mat-calendar-body-cell-preview { 1160 content: ""; 1161 position: absolute; 1162 top: 5%; 1163 left: 0; 1164 z-index: 0; 1165 box-sizing: border-box; 1166 display: block; 1167 height: 90%; 1168 width: 100%; 1169} 1170 1171.mat-calendar-body-range-start:not(.mat-calendar-body-in-comparison-range)::before, 1172.mat-calendar-body-range-start::after, 1173.mat-calendar-body-comparison-start:not(.mat-calendar-body-comparison-bridge-start)::before, 1174.mat-calendar-body-comparison-start::after, 1175.mat-calendar-body-preview-start .mat-calendar-body-cell-preview { 1176 left: 5%; 1177 width: 95%; 1178 border-top-left-radius: 999px; 1179 border-bottom-left-radius: 999px; 1180} 1181[dir=rtl] .mat-calendar-body-range-start:not(.mat-calendar-body-in-comparison-range)::before, 1182[dir=rtl] .mat-calendar-body-range-start::after, 1183[dir=rtl] .mat-calendar-body-comparison-start:not(.mat-calendar-body-comparison-bridge-start)::before, 1184[dir=rtl] .mat-calendar-body-comparison-start::after, 1185[dir=rtl] .mat-calendar-body-preview-start .mat-calendar-body-cell-preview { 1186 left: 0; 1187 border-radius: 0; 1188 border-top-right-radius: 999px; 1189 border-bottom-right-radius: 999px; 1190} 1191
1192.mat-calendar-body-range-end:not(.mat-calendar-body-in-comparison-range)::before, 1193.mat-calendar-body-range-end::after, 1194.mat-calendar-body-comparison-end:not(.mat-calendar-body-comparison-bridge-end)::before, 1195.mat-calendar-body-comparison-end::after, 1196.mat-calendar-body-preview-end .mat-calendar-body-cell-preview { 1197 width: 95%; 1198 border-top-right-radius: 999px; 1199 border-bottom-right-radius: 999px; 1200} 1201[dir=rtl] .mat-calendar-body-range-end:not(.mat-calendar-body-in-comparison-range)::before, 1202[dir=rtl] .mat-calendar-body-range-end::after, 1203[dir=rtl] .mat-calendar-body-comparison-end:not(.mat-calendar-body-comparison-bridge-end)::before, 1204[dir=rtl] .mat-calendar-body-comparison-end::after, 1205[dir=rtl] .mat-calendar-body-preview-end .mat-calendar-body-cell-preview { 1206 left: 5%; 1207 border-radius: 0; 1208 border-top-left-radius: 999px; 1209 border-bottom-left-radius: 999px; 1210} 1211 1212[dir=rtl] .mat-calendar-body-comparison-bridge-start.mat-calendar-body-range-end::after, 1213[dir=rtl] .mat-calendar-body-comparison-bridge-end.mat-calendar-body-range-start::after { 1214 width: 95%; 1215 border-top-right-radius: 999px; 1216 border-bottom-right-radius: 999px; 1217} 1218 1219.mat-calendar-body-comparison-start.mat-calendar-body-range-end::after, [dir=rtl] .mat-calendar-body-comparison-start.mat-calendar-body-range-end::after, 1220.mat-calendar-body-comparison-end.mat-calendar-body-range-start::after, 1221[dir=rtl] .mat-calendar-body-comparison-end.mat-calendar-body-range-start::after { 1222 width: 90%; 1223} 1224 1225.mat-calendar-body-in-preview { 1226 color: var(--%NS%mat-datepicker-calendar-date-preview-state-outline-color, var(--%NS%mat-sys-primary)); 1227} 1228.mat-calendar-body-in-preview .mat-calendar-body-cell-preview { 1229 border-top: dashed 1px; 1230 border-bottom: dashed 1px; 1231} 1232 1233.mat-calendar-body-preview-start .mat-calendar-body-cell-preview { 1234 border-left: dashed 1px; 1235} 1236[dir=rtl] .mat-calendar-body-preview-start .mat-calendar-body-cell-preview { 1237 border-left: 0; 1238 border-right: dashed 1px; 1239} 1240 1241.mat-calendar-body-preview-end .mat-calendar-body-cell-preview { 1242 border-right: dashed 1px; 1243} 1244[dir=rtl] .mat-calendar-body-preview-end .mat-calendar-body-cell-preview { 1245 border-right: 0; 1246 border-left: dashed 1px; 1247} 1248 1249.mat-calendar-body-disabled { 1250 cursor: default; 1251} 1252.mat-calendar-body-disabled > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { 1253 color: var(--%NS%mat-datepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 1254} 1255.mat-calendar-body-disabled > .mat-calendar-body-today:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { 1256 border-color: var(--%NS%mat-datepicker-calendar-date-today-disabled-state-outline-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 1257} 1258@media (forced-colors: active) { 1259 .mat-calendar-body-disabled { 1260 opacity: 0.5; 1261 } 1262} 1263 1264.mat-calendar-body-cell-content { 1265 top: 5%; 1266 left: 5%; 1267 z-index: 1; 1268 display: flex; 1269 align-items: center; 1270 justify-content: center; 1271 box-sizing: border-box; 1272 width: 90%; 1273 height: 90%; 1274 line-height: 1; 1275 border-width: 1px; 1276 border-style: solid; 1277 border-radius: 999px; 1278 color: var(--%NS%mat-datepicker-calendar-date-text-color, var(--%NS%mat-sys-on-surface)); 1279 border-color: var(--%NS%mat-datepicker-calendar-date-outline-color, transparent); 1280} 1281.mat-calendar-body-cell-content.mat-focus-indicator { 1282 position: absolute; 1283} 1284.mat-calendar-body-cell-content::before { 1285 border-radius: 50%; 1286} 1287@media (forced-colors: active) { 1288 .mat-calendar-body-cell-content { 1289 border: none; 1290 } 1291} 1292 1293.cdk-keyboard-focused .mat-calendar-body-active > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical), .cdk-program-focused .mat-calendar-body-active > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { 1294 background-color: var(--%NS%mat-datepicker-calendar-date-focus-state-background-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) calc(var(--%NS%mat-sys-focus-state-layer-opacity) * 100%), transparent)); 1295} 1296 1297@media (hover: hover) { 1298 .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { 1299 background-color: var(--%NS%mat-datepicker-calendar-date-hover-state-background-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) calc(var(--%NS%mat-sys-hover-state-layer-opacity) * 100%), transparent)); 1300 } 1301} 1302.mat-calendar-body-selected { 1303 background-color: var(--%NS%mat-datepicker-calendar-date-selected-state-background-color, var(--%NS%mat-sys-primary)); 1304 color: var(--%NS%mat-datepicker-calendar-date-selected-state-text-color, var(--%NS%mat-sys-on-primary)); 1305} 1306.mat-calendar-body-disabled > .mat-calendar-body-selected { 1307 background-color: var(--%NS%mat-datepicker-calendar-date-selected-disabled-state-background-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 1308} 1309.mat-calendar-body-selected.mat-calendar-body-today { 1310 box-shadow: inset 0 0 0 1px var(--%NS%mat-datepicker-calendar-date-today-selected-state-outline-color, var(--%NS%mat-sys-primary)); 1311} 1312 1313.mat-calendar-body-in-range::before { 1314 background: var(--%NS%mat-datepicker-calendar-date-in-range-state-background-color, var(--%NS%mat-sys-primary-container)); 1315} 1316 1317.mat-calendar-body-comparison-identical, 1318.mat-calendar-body-in-comparison-range::before { 1319 background: var(--%NS%mat-datepicker-calendar-date-in-comparison-range-state-background-color, var(--%NS%mat-sys-tertiary-container)); 1320} 1321 1322.mat-calendar-body-comparison-identical, 1323.mat-calendar-body-in-comparison-range::before { 1324 background: var(--%NS%mat-datepicker-calendar-date-in-comparison-range-state-background-color, var(--%NS%mat-sys-tertiary-container)); 1325} 1326 1327.mat-calendar-body-comparison-bridge-start::before, 1328[dir=rtl] .mat-calendar-body-comparison-bridge-end::before { 1329 background: linear-gradient(to right, var(--%NS%mat-datepicker-calendar-date-in-range-state-background-color, var(--%NS%mat-sys-primary-container)) 50%, var(--%NS%mat-datepicker-calendar-date-in-comparison-range-state-background-color, var(--%NS%mat-sys-tertiary-container)) 50%); 1330} 1331 1332.mat-calendar-body-comparison-bridge-end::before, 1333[dir=rtl] .mat-calendar-body-comparison-bridge-start::before { 1334 background: linear-gradient(to left, var(--%NS%mat-datepicker-calendar-date-in-range-state-background-color, var(--%NS%mat-sys-primary-container)) 50%, var(--%NS%mat-datepicker-calendar-date-in-comparison-range-state-background-color, var(--%NS%mat-sys-tertiary-container)) 50%); 1335} 1336 1337.mat-calendar-body-in-range > .mat-calendar-body-comparison-identical, 1338.mat-calendar-body-in-comparison-range.mat-calendar-body-in-range::after { 1339 background: var(--%NS%mat-datepicker-calendar-date-in-overlap-range-state-background-color, var(--%NS%mat-sys-secondary-container)); 1340} 1341 1342.mat-calendar-body-comparison-identical.mat-calendar-body-selected, 1343.mat-calendar-body-in-comparison-range > .mat-calendar-body-selected { 1344 background: var(--%NS%mat-datepicker-calendar-date-in-overlap-range-selected-state-background-color, var(--%NS%mat-sys-secondary)); 1345} 1346 1347@media (forced-colors: active) { 1348 .mat-datepicker-popup:not(:empty), 1349 .mat-calendar-body-cell:not(.mat-calendar-body-in-range) .mat-calendar-body-selected { 1350 outline: solid 1px; 1351 } 1352 .mat-calendar-body-today { 1353 outline: dotted 1px; 1354 } 1355 .mat-calendar-body-cell::before, 1356 .mat-calendar-body-cell::after, 1357 .mat-calendar-body-selected { 1358 background: none; 1359 } 1360 .mat-calendar-body-in-range::before, 1361 .mat-calendar-body-comparison-bridge-start::before, 1362 .mat-calendar-body-comparison-bridge-end::before { 1363 border-top: solid 1px; 1364 border-bottom: solid 1px; 1365 } 1366 .mat-calendar-body-range-start::before { 1367 border-left: solid 1px; 1368 } 1369 [dir=rtl] .mat-calendar-body-range-start::before { 1370 border-left: 0; 1371 border-right: solid 1px; 1372 } 1373 .mat-calendar-body-range-end::before { 1374 border-right: solid 1px; 1375 } 1376 [dir=rtl] .mat-calendar-body-range-end::before { 1377 border-right: 0; 1378 border-left: solid 1px; 1379 } 1380 .mat-calendar-body-in-comparison-range::before { 1381 border-top: dashed 1px; 1382 border-bottom: dashed 1px; 1383 } 1384 .mat-calendar-body-comparison-start::before { 1385 border-left: dashed 1px; 1386 } 1387 [dir=rtl] .mat-calendar-body-comparison-start::before { 1388 border-left: 0; 1389 border-right: dashed 1px; 1390 }
1391 .mat-calendar-body-comparison-end::before { 1392 border-right: dashed 1px; 1393 } 1394 [dir=rtl] .mat-calendar-body-comparison-end::before { 1395 border-right: 0; 1396 border-left: dashed 1px; 1397 } 1398} 1399`],encapsulation:2})}return i})();function at$3(i){return i?.nodeName===`TD`}function nt$4(i){let o;return at$3(i)?o=i:at$3(i.parentNode)?o=i.parentNode:at$3(i.parentNode?.parentNode)&&(o=i.parentNode.parentNode),o?.getAttribute(`data-mat-row`)!=null?o:null}function it$3(i,o,e){return e!==null&&o!==e&&i<e&&i===o}function rt$4(i,o,e){return o!==null&&o!==e&&i>=o&&i===e}function st$5(i,o,e,a){return a&&o!==null&&e!==null&&o!==e&&i>=o&&i<=e}function Jt$2(i){let o=i.changedTouches[0];return document.elementFromPoint(o.clientX,o.clientY)}var _=class{start;end;_disableStructuralEquivalency;constructor(o,e){this.start=o,this.end=e}};var B$2=(()=>{class i{selection;_adapter;_selectionChanged=new ee$5;selectionChanged=this._selectionChanged;constructor(e,a){this.selection=e,this._adapter=a,this.selection=e}updateSelection(e,a){let t=this.selection;this.selection=e,this._selectionChanged.next({selection:e,source:a,oldValue:t})}ngOnDestroy(){this._selectionChanged.complete()}_isValidDateInstance(e){return this._adapter.isDateInstance(e)&&this._adapter.isValid(e)}static ɵfac=function(a){XE()};static ɵprov=ue$3({token:i,factory:i.ɵfac})}return i})();var Oa$3=(()=>{class i extends B$2{constructor(e){super(null,e)}add(e){super.updateSelection(e,this)}isValid(){return this.selection!=null&&this._isValidDateInstance(this.selection)}isComplete(){return this.selection!=null}clone(){let e=new i(this._adapter);return e.updateSelection(this.selection,this),e}static ɵfac=function(a){return new(a||i)(Le$3(l$2))};static ɵprov=ue$3({token:i,factory:i.ɵfac})}return i})();var Ya$2=(()=>{class i extends B$2{constructor(e){super(new _(null,null),e)}add(e){let{start:a,end:t}=this.selection;a==null?a=e:t==null?t=e:(a=e,t=null),super.updateSelection(new _(a,t),this)}isValid(){let{start:e,end:a}=this.selection;return e==null&&a==null?!0:e!=null&&a!=null?this._isValidDateInstance(e)&&this._isValidDateInstance(a)&&this._adapter.compareDate(e,a)<=0:(e==null||this._isValidDateInstance(e))&&(a==null||this._isValidDateInstance(a))}isComplete(){return this.selection.start!=null&&this.selection.end!=null}clone(){let e=new i(this._adapter);return e.updateSelection(this.selection,this),e}static ɵfac=function(a){return new(a||i)(Le$3(l$2))};static ɵprov=ue$3({token:i,factory:i.ɵfac})}return i})();var sa$3={provide:B$2,useFactory:()=>E(B$2,{optional:!0,skipSelf:!0})||new Oa$3(E(l$2))};var Pa$3={provide:B$2,useFactory:()=>E(B$2,{optional:!0,skipSelf:!0})||new Ya$2(E(l$2))};var Oe$2=new N$2(`MAT_DATE_RANGE_SELECTION_STRATEGY`);var La$3=(()=>{class i{_dateAdapter;constructor(e){this._dateAdapter=e}selectionFinished(e,a){let{start:t,end:n}=a;return t==null?t=e:n==null&&e&&this._dateAdapter.compareDate(e,t)>=0?n=e:(t=e,n=null),new _(t,n)}createPreview(e,a){let t=null,n=null;return a.start&&!a.end&&e&&(t=a.start,n=e),new _(t,n)}createDrag(e,a,t){let n=a.start,r=a.end;if(!n||!r)return null;let l=this._dateAdapter,De=l.compareDate(n,r)!==0,W=l.getYear(t)-l.getYear(e),q=l.getMonth(t)-l.getMonth(e),ve=l.getDate(t)-l.getDate(e);return De&&l.sameDate(e,a.start)?(n=t,l.compareDate(t,r)>0&&(r=l.addCalendarYears(r,W),r=l.addCalendarMonths(r,q),r=l.addCalendarDays(r,ve))):De&&l.sameDate(e,a.end)?(r=t,l.compareDate(t,n)<0&&(n=l.addCalendarYears(n,W),n=l.addCalendarMonths(n,q),n=l.addCalendarDays(n,ve))):(n=l.addCalendarYears(n,W),n=l.addCalendarMonths(n,q),n=l.addCalendarDays(n,ve),r=l.addCalendarYears(r,W),r=l.addCalendarMonths(r,q),r=l.addCalendarDays(r,ve)),new _(n,r)}static ɵfac=function(a){return new(a||i)(Le$3(l$2))};static ɵprov=ue$3({token:i,factory:i.ɵfac})}return i})();var ot$4=7;var Ba$3=0;var ea$3=(()=>{class i{_changeDetectorRef=E(ej);_dateFormats=E(d$3,{optional:!0});_dateAdapter=E(l$2,{optional:!0});_dir=E(Oc$4,{optional:!0});_rangeStrategy=E(Oe$2,{optional:!0});_rerenderSubscription=F$2.EMPTY;_selectionKeyPressed=!1;get activeDate(){return this._activeDate}set activeDate(e){let a=this._activeDate,t=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))||this._dateAdapter.today();this._activeDate=this._dateAdapter.clampDate(t,this.minDate,this.maxDate),this._hasSameMonthAndYear(a,this._activeDate)||this._init()}_activeDate;get selected(){return this._selected}set selected(e){e instanceof _?this._selected=e:this._selected=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e)),this._setRanges(this._selected)}_selected=null;
1399get minDate(){return this._minDate}set minDate(e){this._minDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_minDate=null;get maxDate(){return this._maxDate}set maxDate(e){this._maxDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_maxDate=null;dateFilter;dateClass;comparisonStart=null;comparisonEnd=null;startDateAccessibleName=null;endDateAccessibleName=null;activeDrag=null;selectedChange=new Qe$1;_userSelection=new Qe$1;dragStarted=new Qe$1;dragEnded=new Qe$1;activeDateChange=new Qe$1;_matCalendarBody;_monthLabel=ni$3(``);_weeks=ni$3([]);_firstWeekOffset=ni$3(0);_rangeStart=ni$3(null);_rangeEnd=ni$3(null);_comparisonRangeStart=ni$3(null);_comparisonRangeEnd=ni$3(null);_previewStart=ni$3(null);_previewEnd=ni$3(null);_isRange=ni$3(!1);_todayDate=ni$3(null);_weekdays=ni$3([]);constructor(){E(be$3).load(En$3),this._activeDate=this._dateAdapter.today()}ngAfterContentInit(){this._rerenderSubscription=this._dateAdapter.localeChanges.pipe(Vm(null)).subscribe(()=>this._init())}ngOnChanges(e){let a=e.comparisonStart||e.comparisonEnd;a&&!a.firstChange&&this._setRanges(this.selected),e.activeDrag&&!this.activeDrag&&this._clearPreview()}ngOnDestroy(){this._rerenderSubscription.unsubscribe()}_dateSelected(e){let a=e.value,t=this._getDateFromDayOfMonth(a),n,r;this._selected instanceof _?(n=this._getDateInCurrentMonth(this._selected.start),r=this._getDateInCurrentMonth(this._selected.end)):n=r=this._getDateInCurrentMonth(this._selected),(n!==a||r!==a)&&this.selectedChange.emit(t),this._userSelection.emit({value:t,event:e.event}),this._clearPreview(),this._changeDetectorRef.markForCheck()}_updateActiveDate(e){let a=e.value,t=this._activeDate;this.activeDate=this._getDateFromDayOfMonth(a),this._dateAdapter.compareDate(t,this.activeDate)&&this.activeDateChange.emit(this._activeDate)}_handleCalendarBodyKeydown(e){let a=this._activeDate,t=this._isRtl();switch(e.keyCode){case 37:this.activeDate=this._dateAdapter.addCalendarDays(this._activeDate,t?1:-1);break;case 39:this.activeDate=this._dateAdapter.addCalendarDays(this._activeDate,t?-1:1);break;case 38:this.activeDate=this._dateAdapter.addCalendarDays(this._activeDate,-7);break;case 40:this.activeDate=this._dateAdapter.addCalendarDays(this._activeDate,7);break;case 36:this.activeDate=this._dateAdapter.addCalendarDays(this._activeDate,1-this._dateAdapter.getDate(this._activeDate));break;case 35:this.activeDate=this._dateAdapter.addCalendarDays(this._activeDate,this._dateAdapter.getNumDaysInMonth(this._activeDate)-this._dateAdapter.getDate(this._activeDate));break;case 33:this.activeDate=e.altKey?this._dateAdapter.addCalendarYears(this._activeDate,-1):this._dateAdapter.addCalendarMonths(this._activeDate,-1);break;case 34:this.activeDate=e.altKey?this._dateAdapter.addCalendarYears(this._activeDate,1):this._dateAdapter.addCalendarMonths(this._activeDate,1);break;case 13:case 32:this._selectionKeyPressed=!0,this._canSelect(this._activeDate)&&e.preventDefault();return;case 27:this._previewEnd()!=null&&!Ho$5(e)&&(this._clearPreview(),this.activeDrag?this.dragEnded.emit({value:null,event:e}):(this.selectedChange.emit(null),this._userSelection.emit({value:null,event:e})),e.preventDefault(),e.stopPropagation());return;default:return}this._dateAdapter.compareDate(a,this.activeDate)&&(this.activeDateChange.emit(this.activeDate),this._focusActiveCellAfterViewChecked()),e.preventDefault()}_handleCalendarBodyKeyup(e){(e.keyCode===32||e.keyCode===13)&&(this._selectionKeyPressed&&this._canSelect(this._activeDate)&&this._dateSelected({value:this._dateAdapter.getDate(this._activeDate),event:e}),this._selectionKeyPressed=!1)}_init(){this._setRanges(this.selected),this._todayDate.set(this._getCellCompareValue(this._dateAdapter.today())),this._monthLabel.set(this._dateFormats.display.monthLabel?this._dateAdapter.format(this.activeDate,this._dateFormats.display.monthLabel):this._dateAdapter.getMonthNames(`short`)[this._dateAdapter.getMonth(this.activeDate)].toLocaleUpperCase());let e=this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),this._dateAdapter.getMonth(this.activeDate),1);this._firstWeekOffset.set((ot$4+this._dateAdapter.getDayOfWeek(e)-this._dateAdapter.getFirstDayOfWeek())%ot$4),this._initWeek
1399days(),this._createWeekCells(),this._changeDetectorRef.markForCheck()}_focusActiveCell(e){this._matCalendarBody._focusActiveCell(e)}_focusActiveCellAfterViewChecked(){this._matCalendarBody._scheduleFocusActiveCellAfterViewChecked()}_previewChanged({event:e,value:a}){if(this._rangeStrategy){let t=a?a.rawValue:null,n=this._rangeStrategy.createPreview(t,this.selected,e);if(this._previewStart.set(this._getCellCompareValue(n.start)),this._previewEnd.set(this._getCellCompareValue(n.end)),this.activeDrag&&t){let r=this._rangeStrategy.createDrag?.(this.activeDrag.value,this.selected,t,e);r&&(this._previewStart.set(this._getCellCompareValue(r.start)),this._previewEnd.set(this._getCellCompareValue(r.end)))}}}_dragEnded(e){if(this.activeDrag)if(e.value){let a=this._rangeStrategy?.createDrag?.(this.activeDrag.value,this.selected,e.value,e.event);this.dragEnded.emit({value:a??null,event:e.event})}else this.dragEnded.emit({value:null,event:e.event})}_getDateFromDayOfMonth(e){return this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),this._dateAdapter.getMonth(this.activeDate),e)}_initWeekdays(){let e=this._dateAdapter.getFirstDayOfWeek(),a=this._dateAdapter.getDayOfWeekNames(`narrow`),n=this._dateAdapter.getDayOfWeekNames(`long`).map((r,l)=>({long:r,narrow:a[l],id:Ba$3++}));this._weekdays.set(n.slice(e).concat(n.slice(0,e)))}_createWeekCells(){let e=this._dateAdapter.getNumDaysInMonth(this.activeDate),a=this._dateAdapter.getDateNames(),t=[[]];for(let n=0,r=this._firstWeekOffset();n<e;n++,r++){r==ot$4&&(t.push([]),r=0);let l=this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),this._dateAdapter.getMonth(this.activeDate),n+1),De=this._shouldEnableDate(l),W=this._dateAdapter.format(l,this._dateFormats.display.dateA11yLabel),q=this.dateClass?this.dateClass(l,`month`):void 0;t[t.length-1].push(new fe$3(n+1,a[n],W,De,q,this._getCellCompareValue(l),l))}this._weeks.set(t)}_shouldEnableDate(e){return!!e&&(!this.minDate||this._dateAdapter.compareDate(e,this.minDate)>=0)&&(!this.maxDate||this._dateAdapter.compareDate(e,this.maxDate)<=0)&&(!this.dateFilter||this.dateFilter(e))}_getDateInCurrentMonth(e){return e&&this._hasSameMonthAndYear(e,this.activeDate)?this._dateAdapter.getDate(e):null}_hasSameMonthAndYear(e,a){return!!(e&&a&&this._dateAdapter.getMonth(e)==this._dateAdapter.getMonth(a)&&this._dateAdapter.getYear(e)==this._dateAdapter.getYear(a))}_getCellCompareValue(e){if(e){let a=this._dateAdapter.getYear(e),t=this._dateAdapter.getMonth(e),n=this._dateAdapter.getDate(e);return new Date(a,t,n).getTime()}return null}_isRtl(){return this._dir&&this._dir.value===`rtl`}_setRanges(e){e instanceof _?(this._rangeStart.set(this._getCellCompareValue(e.start)),this._rangeEnd.set(this._getCellCompareValue(e.end)),this._isRange.set(!0)):(this._rangeStart.set(this._getCellCompareValue(e)),this._rangeEnd.set(this._rangeStart()),this._isRange.set(!1)),this._comparisonRangeStart.set(this._getCellCompareValue(this.comparisonStart)),this._comparisonRangeEnd.set(this._getCellCompareValue(this.comparisonEnd))}_canSelect(e){return!this.dateFilter||this.dateFilter(e)}_clearPreview(){this._previewStart.set(null),this._previewEnd.set(null)}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-month-view`]],viewQuery:function(a,t){if(a&1&&$h$2(J$3,5),a&2){let n;Pw(n=Lw())&&(t._matCalendarBody=n.first)}},inputs:{activeDate:`activeDate`,selected:`selected`,minDate:`minDate`,maxDate:`maxDate`,dateFilter:`dateFilter`,dateClass:`dateClass`,comparisonStart:`comparisonStart`,comparisonEnd:`comparisonEnd`,startDateAccessibleName:`startDateAccessibleName`,endDateAccessibleName:`endDateAccessibleName`,activeDrag:`activeDrag`},outputs:{selectedChange:`selectedChange`,_userSelection:`_userSelection`,dragStarted:`dragStarted`,dragEnded:`dragEnded`,activeDateChange:`activeDateChange`},exportAs:[`matMonthView`],features:[qy],decls:8,vars:14,consts:[[`role`,`grid`,1,`mat-calendar-table`],[1,`mat-calendar-table-header`],[`scope`,`col`],[`aria-hidden`,`true`],[`colspan`,`7`,1,`mat-calendar-table-header-divider`],[`mat-calendar-body`,``,3,`selectedValueChange`,`activeDateChange`,`previewChange`,`dragStarted`,`dragEnded`,`keyup`,`keydown`,`label`,`rows`,`todayValue`,`startValue`,`endValue`,`comparisonStart`,`comparisonEnd`,`previewStart`,`previewEnd`,`isRange`,`labelMinRequiredCells`,`activeCell`,`startDateAccessibleName`,`endDateAccessibleName`],[1,`cdk-visually-hidden`]],template:function(a,t){a&1&&(Bi$3(0,`table`,0)(1,`thead`,1)(2,`tr`),mw(3,ya$3,5,2,`th`,2,ra$3),vl$4(),Bi$3(5,`tr`,3),Rh$3(6,`th`,4),vl$4()(),Bi$3(7,`tbody`,5),jh$3(`selectedValueChange`,function(r){return t._dateSelected(r)})(`activeDateChange`,function(r){return t._updateActiveDate(r)})(`previewChange`,function(r){return t._previewChanged(r)})(`dragStarted`,function(r){return t.dragStarted.emit(r)})(`dragEnded`,function(r){return t._dragEnded(r)})(`keyup`,function(r){return t._handleCalendarBodyKeyup(r)})(`keydown`,function(r){return t._handleCalendarBodyKeydown(r)}),vl$4()()),a&2&&(sE(3),yw(t._weekdays()),sE(4),Ah$2(`label`,t._monthLabel())(`rows`,t._weeks())(`todayValue`,t._todayDate(
1399))(`startValue`,t._rangeStart())(`endValue`,t._rangeEnd())(`comparisonStart`,t._comparisonRangeStart())(`comparisonEnd`,t._comparisonRangeEnd())(`previewStart`,t._previewStart())(`previewEnd`,t._previewEnd())(`isRange`,t._isRange())(`labelMinRequiredCells`,3)(`activeCell`,t._dateAdapter.getDate(t.activeDate)-1)(`startDateAccessibleName`,t.startDateAccessibleName)(`endDateAccessibleName`,t.endDateAccessibleName))},dependencies:[J$3],encapsulation:2})}return i})();var w$2=24;var dt$6=4;var ta$3=(()=>{class i{_changeDetectorRef=E(ej);_dateAdapter=E(l$2,{optional:!0});_dir=E(Oc$4,{optional:!0});_rerenderSubscription=F$2.EMPTY;_selectionKeyPressed=!1;get activeDate(){return this._activeDate}set activeDate(e){let a=this._activeDate,t=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))||this._dateAdapter.today();this._activeDate=this._dateAdapter.clampDate(t,this.minDate,this.maxDate),oa$3(this._dateAdapter,a,this._activeDate,this.minDate,this.maxDate)||this._init()}_activeDate;get selected(){return this._selected}set selected(e){e instanceof _?this._selected=e:this._selected=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e)),this._setSelectedYear(e)}_selected=null;get minDate(){return this._minDate}set minDate(e){this._minDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_minDate=null;get maxDate(){return this._maxDate}set maxDate(e){this._maxDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_maxDate=null;dateFilter;dateClass;selectedChange=new Qe$1;yearSelected=new Qe$1;activeDateChange=new Qe$1;_matCalendarBody;_years=ni$3([]);_todayYear=ni$3(0);_selectedYear=ni$3(null);constructor(){this._dateAdapter,this._activeDate=this._dateAdapter.today()}ngAfterContentInit(){this._rerenderSubscription=this._dateAdapter.localeChanges.pipe(Vm(null)).subscribe(()=>this._init())}ngOnDestroy(){this._rerenderSubscription.unsubscribe()}_init(){this._todayYear.set(this._dateAdapter.getYear(this._dateAdapter.today()));let a=this._dateAdapter.getYear(this._activeDate)-_e$3(this._dateAdapter,this.activeDate,this.minDate,this.maxDate),t=[];for(let n=0,r=[];n<w$2;n++)r.push(a+n),r.length==dt$6&&(t.push(r.map(l=>this._createCellForYear(l))),r=[]);this._years.set(t),this._changeDetectorRef.markForCheck()}_yearSelected(e){let a=e.value,t=this._dateAdapter.createDate(a,0,1),n=this._getDateFromYear(a);this.yearSelected.emit(t),this.selectedChange.emit(n)}_updateActiveDate(e){let a=e.value,t=this._activeDate;this.activeDate=this._getDateFromYear(a),this._dateAdapter.compareDate(t,this.activeDate)&&this.activeDateChange.emit(this.activeDate)}_handleCalendarBodyKeydown(e){let a=this._activeDate,t=this._isRtl();switch(e.keyCode){case 37:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,t?1:-1);break;case 39:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,t?-1:1);break;case 38:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,-dt$6);break;case 40:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,dt$6);break;case 36:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,-_e$3(this._dateAdapter,this.activeDate,this.minDate,this.maxDate));break;case 35:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,w$2-_e$3(this._dateAdapter,this.activeDate,this.minDate,this.maxDate)-1);break;case 33:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,e.altKey?-w$2*10:-w$2);break;case 34:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,e.altKey?w$2*10:w$2);break;case 13:case 32:this._selectionKeyPressed=!0;break;default:return}this._dateAdapter.compareDate(a,this.activeDate)&&this.activeDateChange.emit(this.activeDate),this._focusActiveCellAfterViewChecked(),e.preventDefault()}_handleCalendarBodyKeyup(e){(e.keyCode===32||e.keyCode===13)&&(this._selectionKeyPressed&&this._yearSelected({value:this._dateAdapter.getYear(this._activeDate),event:e}),this._selectionKeyPressed=!1)}_getActiveCell(){return _e$3(this._dateAdapter,this.activeDate,this.minDate,this.maxDate)}_focusActiveCell(){this._matCalendarBody._focusActiveCell()}_focusActiveCellAfterViewChecked(){this._matCalendarBody._scheduleFocusActiveCellAfterViewChecked()}_getDateFromYear(e){let a=this._dateAdapter.getMonth(this.activeDate),t=this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(e,a,1));return this._dateAdapter.createDate(e,a,Math.min(this._dateAdapter.getDate(this.activeDate),t))}
1399_createCellForYear(e){let a=this._dateAdapter.createDate(e,0,1),t=this._dateAdapter.getYearName(a),n=this.dateClass?this.dateClass(a,`multi-year`):void 0;return new fe$3(e,t,t,this._shouldEnableYear(e),n)}_shouldEnableYear(e){if(e==null||this.maxDate&&e>this._dateAdapter.getYear(this.maxDate)||this.minDate&&e<this._dateAdapter.getYear(this.minDate))return!1;if(!this.dateFilter)return!0;let a=this._dateAdapter.createDate(e,0,1);for(let t=a;this._dateAdapter.getYear(t)==e;t=this._dateAdapter.addCalendarDays(t,1))if(this.dateFilter(t))return!0;return!1}_isRtl(){return this._dir&&this._dir.value===`rtl`}_setSelectedYear(e){if(this._selectedYear.set(null),e instanceof _){let a=e.start||e.end;a&&this._selectedYear.set(this._dateAdapter.getYear(a))}else e&&this._selectedYear.set(this._dateAdapter.getYear(e))}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-multi-year-view`]],viewQuery:function(a,t){if(a&1&&$h$2(J$3,5),a&2){let n;Pw(n=Lw())&&(t._matCalendarBody=n.first)}},inputs:{activeDate:`activeDate`,selected:`selected`,minDate:`minDate`,maxDate:`maxDate`,dateFilter:`dateFilter`,dateClass:`dateClass`},outputs:{selectedChange:`selectedChange`,yearSelected:`yearSelected`,activeDateChange:`activeDateChange`},exportAs:[`matMultiYearView`],decls:5,vars:7,consts:[[`role`,`grid`,1,`mat-calendar-table`],[`aria-hidden`,`true`,1,`mat-calendar-table-header`],[`colspan`,`4`,1,`mat-calendar-table-header-divider`],[`mat-calendar-body`,``,3,`selectedValueChange`,`activeDateChange`,`keyup`,`keydown`,`rows`,`todayValue`,`startValue`,`endValue`,`numCols`,`cellAspectRatio`,`activeCell`]],template:function(a,t){a&1&&(Bi$3(0,`table`,0)(1,`thead`,1)(2,`tr`),Rh$3(3,`th`,2),vl$4()(),Bi$3(4,`tbody`,3),jh$3(`selectedValueChange`,function(r){return t._yearSelected(r)})(`activeDateChange`,function(r){return t._updateActiveDate(r)})(`keyup`,function(r){return t._handleCalendarBodyKeyup(r)})(`keydown`,function(r){return t._handleCalendarBodyKeydown(r)}),vl$4()()),a&2&&(sE(4),Ah$2(`rows`,t._years())(`todayValue`,t._todayYear())(`startValue`,t._selectedYear())(`endValue`,t._selectedYear())(`numCols`,4)(`cellAspectRatio`,4/7)(`activeCell`,t._getActiveCell()))},dependencies:[J$3],encapsulation:2})}return i})();function oa$3(i,o,e,a,t){let n=i.getYear(o),r=i.getYear(e),l=da$3(i,a,t);return Math.floor((n-l)/w$2)===Math.floor((r-l)/w$2)}function _e$3(i,o,e,a){return Ha$2(i.getYear(o)-da$3(i,e,a),w$2)}function da$3(i,o,e){let a=0;return e?a=i.getYear(e)-w$2+1:o&&(a=i.getYear(o)),a}function Ha$2(i,o){return(i%o+o)%o}var aa$3=(()=>{class i{_changeDetectorRef=E(ej);_dateFormats=E(d$3,{optional:!0});_dateAdapter=E(l$2,{optional:!0});_dir=E(Oc$4,{optional:!0});_rerenderSubscription=F$2.EMPTY;_selectionKeyPressed=!1;get activeDate(){return this._activeDate}set activeDate(e){let a=this._activeDate,t=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))||this._dateAdapter.today();this._activeDate=this._dateAdapter.clampDate(t,this.minDate,this.maxDate),this._dateAdapter.getYear(a)!==this._dateAdapter.getYear(this._activeDate)&&this._init()}_activeDate;get selected(){return this._selected}set selected(e){e instanceof _?this._selected=e:this._selected=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e)),this._setSelectedMonth(e)}_selected=null;get minDate(){return this._minDate}set minDate(e){this._minDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_minDate=null;get maxDate(){return this._maxDate}set maxDate(e){this._maxDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_maxDate=null;dateFilter;dateClass;selectedChange=new Qe$1;monthSelected=new Qe$1;activeDateChange=new Qe$1;_matCalendarBody;_months=ni$3([]);_yearLabel=ni$3(``);_todayMonth=ni$3(null);_selectedMonth=ni$3(null);constructor(){this._activeDate=this._dateAdapter.today()}ngAfterContentInit(){this._rerenderSubscription=this._dateAdapter.localeChanges.pipe(Vm(null)).subscribe(()=>this._init())}ngOnDestroy(){this._rerenderSubscription.unsubscribe()}_monthSelected(e){let a=e.value,t=this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),a,1);this.monthSelected.emit(t);let n=this._getDateFromMonth(a);this.selectedChange.emit(n)}_updateActiveDate(e){let a=e.value,t=this._activeDate;this.activeDate=this._getDateFromMonth(a),this._dateAdapter.compareDate(t,this.activeDate)&&this.activeDateChange.emit(this.activeDate)}_handleCalendarBodyKeydown(e){let a=this._activeDate,t=this._isRtl();switch(e.keyCode){case 37:this.activeDate=this._dateAdapter.addCalendarMonths(this._activeDate,t?1:-1);break;case 39:this.activeDate=this._dateAdapter.addCalendarMonths(this._activeDate,t?-1:1);break;case 38:this.activeDate=this._dateAdapter.addCalendarMonths(this._activeDate,-4);break;case 40:this.activeDate=this._dateAdapter.addCalendarMonths(this._activeDate,4);break;case 36:this.activeDate=this._dateAdapter.addCalendarMonths(this._activeDate,-this._dateAdapter.getMonth(this._activeDate));break;case 35:this.activeDate=this._dateAdapter.addCalendarMonths(this._activeDate,11-this._dateAdapter.getMonth(this._activeDate));break;case 33:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,e.altKey?-10:-1);break;case 34:this.activeDate=this._dateAdapter.addCalendarYears(this._activeDate,e.altKey?10:1);break;case 13:case 32:this._selectionKeyPressed=!0;break;default:return}this._dateAdapter.compareDate(a,this.activeDate)&&(this.activeDateChange.emit(this.activeDate),this._focusActiveCellAfterViewChecked()),e.preventDefault()}_handleCalendarBodyKeyup(e){(e.keyCode===32||e.keyCode===13)&&(this._selectionKeyPressed&&this._monthSelected({value:this._dateAdapter.getMonth(this._activeDate),event:e}),this._selectionKeyPressed=!1)}_init(){this._setSelectedMonth(this.selected),this._todayMonth.set(this._getMonthInCurrentYear(this._dateAdapter.today())),this._yearLabel.set(this._dateAdapter.getYearName(this.activeDate));let e=this._dateAdapter.getMonthNames(`short`);this._months.set([[0,1,2,3],[4,5,6,7],[8,9,10,11]].map(a=>a.map(t=>this._createCellForMonth(t,e[t])))),this._changeDetectorRef.markForCheck()}_focusActiveCell(){this._matCalendarBody._focusActiveCell()}_focusActiveCellAfterViewChecked(){this._matCalendarBody._scheduleFocusActiveCellAfterViewChecked()}_getMonthInCurrentYear(e){return e&&this._dateAdapter.getYear(e)==this._dateAdapter.getYear(this.activeDate)?this._dateAdapter.getMonth(e):null}_getDateFromMonth(e){let a=this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),e,1),t=this._dateAdapter.getNumDaysInMonth(a);return this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),e,Math.min(this._dateAdapter.getDate(this.activeDate),t))}_createCellForMonth(e,a){let t=this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),e,1),n=this._dateAdapter.format(t,this._dateFormats.display.monthYearA11yLabel),r=this.dateClass?this.dateClass(t,`year`):void 0;return new fe$3(e,a.toLocaleUpperCase(),n,this._shouldEnableMonth(e),r)}_shouldEnableMonth(e){let a=this._dateAdapter.getYear(this.activeDate);if(e==null||this._isYearAndMonthAfterMaxDate(a,e)||this._isYearAndMonthBeforeMinDate(a,e))return!1;if(!this.dateFilter)return!0;let t=this._dateAdapter.createDate(a,e,1);for(let n=t;this._dateAdapter.getMonth(n)==e;n=this._dateAdapter.addCalendarDays(n,1))if(this.dateFilter(n))return!0;return!1}_isYearAndMonthAfterMaxDate(e,a){if(this.maxDate){let t=this._dateAdapter.getYear(this.maxDate),n=this._dateAdapter.getMonth(this.maxDate);return e>t||e===t&&a>n}return!1}_isYearAndMonthBeforeMinDate(e,a){if(this.minDate){let t=this._dateAdapter.getYear(this.minDate),n=this._dateAdapter.getMonth(this.minDate);return e<t||e===t&&a<n}return!1}_isRtl(){return this._dir&&this._dir.value===`rtl`}_setSelectedMonth(e){e instanceof _?this._selectedMonth.set(this._getMonthInCurrentYear(e.start)||this._getMonthInCurrentYear(e.end)):this._selectedMonth.set(this._getMonthInCurrentYear(e))}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-year-view`]],viewQuery:function(a,t){if(a&1&&$h$2(J$3,5),a&2){let n;Pw(n=Lw())&&(t._matCalendarBody=n.first)}},inputs:{activeDate:`activeDate`,selected:`selected`,minDate:`minDate`,maxDate:`maxDate`,dateFilter:`dateFilter`,dateClass:`dateClass`},outputs:{selectedChange:`selectedChange`,monthSelected:`monthSelected`,activeDateChange:`activeDateChange`},exportAs:[`matYearView`],decls:5,vars:9,consts:[[`role`,`grid`,1,`mat-calendar-table`],[`aria-hidden`,`true`,1,`mat-calendar-table-header`],[`colspan`,`4`,1,`mat-calendar-table-header-divider`],[`mat-calendar-body`,``,3,`selectedValueChange`,`activeDateChange`,`keyup`,`keydown`,`label`,`rows`,`todayValue`,`startValue`,`endValue`,`labelMinRequiredCells`,`numCols`,`cellAspectRatio`,`activeCell`]],template:function(a,t){a&1&&(Bi$3(0,`table`,0)(1,`thead`,1)(2,`tr`),Rh$3(3,`th`,2),vl$4()(),Bi$3(4,`tbody`,3),jh$3(`selectedValueChange`,function(r){return t._monthSelected(r)})(`activeDateChange`,function(r){return t._updateActiveDate(r)})(`keyup`,function(r){return t._handleCalendarBodyKeyup(r)})(`keydown`,function(r){return t._handleCalendarBodyKeydown(r)}),vl$4()()),a&2&&(sE(4),Ah$2(`label`,t._yearLabel())(`rows`,t._months())(`todayValue`,t._todayMonth())(`startValue`,t._selectedMonth())(`endValue`,t._selectedMonth())(`labelMinRequiredCells`,2)(`numC
1399ols`,4)(`cellAspectRatio`,4/7)(`activeCell`,t._dateAdapter.getMonth(t.activeDate)))},dependencies:[J$3],encapsulation:2})}return i})();var la$3=(()=>{class i{_intl=E(ae$5);calendar=E(lt$3);_dateAdapter=E(l$2,{optional:!0});_dateFormats=E(d$3,{optional:!0});_periodButtonText;_periodButtonDescription;_periodButtonLabel;_prevButtonLabel;_nextButtonLabel;constructor(){E(be$3).load(En$3);let e=E(ej);this._updateLabels(),this.calendar.stateChanges.subscribe(()=>{this._updateLabels(),e.markForCheck()})}get periodButtonText(){return this._periodButtonText}get periodButtonDescription(){return this._periodButtonDescription}get periodButtonLabel(){return this._periodButtonLabel}get prevButtonLabel(){return this._prevButtonLabel}get nextButtonLabel(){return this._nextButtonLabel}currentPeriodClicked(){this.calendar.currentView=this.calendar.currentView==`month`?`multi-year`:`month`}previousClicked(){this.previousEnabled()&&(this.calendar.activeDate=this.calendar.currentView==`month`?this._dateAdapter.addCalendarMonths(this.calendar.activeDate,-1):this._dateAdapter.addCalendarYears(this.calendar.activeDate,this.calendar.currentView==`year`?-1:-w$2))}nextClicked(){this.nextEnabled()&&(this.calendar.activeDate=this.calendar.currentView==`month`?this._dateAdapter.addCalendarMonths(this.calendar.activeDate,1):this._dateAdapter.addCalendarYears(this.calendar.activeDate,this.calendar.currentView==`year`?1:w$2))}previousEnabled(){return this.calendar.minDate?!this.calendar.minDate||!this._isSameView(this.calendar.activeDate,this.calendar.minDate):!0}nextEnabled(){return!this.calendar.maxDate||!this._isSameView(this.calendar.activeDate,this.calendar.maxDate)}_updateLabels(){let e=this.calendar,a=this._intl,t=this._dateAdapter;e.currentView===`month`?(this._periodButtonText=t.format(e.activeDate,this._dateFormats.display.monthYearLabel).toLocaleUpperCase(),this._periodButtonDescription=t.format(e.activeDate,this._dateFormats.display.monthYearLabel).toLocaleUpperCase(),this._periodButtonLabel=a.switchToMultiYearViewLabel,this._prevButtonLabel=a.prevMonthLabel,this._nextButtonLabel=a.nextMonthLabel):e.currentView===`year`?(this._periodButtonText=t.getYearName(e.activeDate),this._periodButtonDescription=t.getYearName(e.activeDate),this._periodButtonLabel=a.switchToMonthViewLabel,this._prevButtonLabel=a.prevYearLabel,this._nextButtonLabel=a.nextYearLabel):(this._periodButtonText=a.formatYearRange(...this._formatMinAndMaxYearLabels()),this._periodButtonDescription=a.formatYearRangeLabel(...this._formatMinAndMaxYearLabels()),this._periodButtonLabel=a.switchToMonthViewLabel,this._prevButtonLabel=a.prevMultiYearLabel,this._nextButtonLabel=a.nextMultiYearLabel)}_isSameView(e,a){return this.calendar.currentView==`month`?this._dateAdapter.getYear(e)==this._dateAdapter.getYear(a)&&this._dateAdapter.getMonth(e)==this._dateAdapter.getMonth(a):this.calendar.currentView==`year`?this._dateAdapter.getYear(e)==this._dateAdapter.getYear(a):oa$3(this._dateAdapter,e,a,this.calendar.minDate,this.calendar.maxDate)}_formatMinAndMaxYearLabels(){let a=this._dateAdapter.getYear(this.calendar.activeDate)-_e$3(this._dateAdapter,this.calendar.activeDate,this.calendar.minDate,this.calendar.maxDate),t=a+w$2-1;return[this._dateAdapter.getYearName(this._dateAdapter.createDate(a,0,1)),this._dateAdapter.getYearName(this._dateAdapter.createDate(t,0,1))]}_periodButtonLabelId=E(Or$4).getId(`mat-calendar-period-label-`);static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-calendar-header`]],exportAs:[`matCalendarHeader`],ngContentSelectors:Ca$3,decls:17,vars:13,consts:[[1,`mat-calendar-header`],[1,`mat-calendar-controls`],[`aria-live`,`polite`,1,`cdk-visually-hidden`,3,`id`],[`matButton`,``,`type`,`button`,1,`mat-calendar-period-button`,3,`click`],[`aria-hidden`,`true`],[`viewBox`,`0 0 10 5`,`focusable`,`false`,`aria-hidden`,`true`,1,`mat-calendar-arrow`],[`points`,`0,0 5,5 10,0`],[1,`mat-calendar-spacer`],[`matIconButton`,``,`type`,`button`,`disabledInteractive`,``,1,`mat-calendar-previous-button`,3,`click`,`disabled`,`matTooltip`],[`viewBox`,`0 0 24 24`,`focusable`,`false`,`aria-hidden`,`true`],[`d`,`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z`],[`matIconButton`,``,`type`,`button`,`disabledInteractive`,``,1,`mat-calendar-next-button`,3,`click`,`disabled`,`matTooltip`],[`d`,`M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`]],template:function(a,t){a&1&&(Rw(),Bi$3(0,`div`,0)(1,`div`,1)(2,`span`,2),lC(3),vl$4(),Bi$3(4,`button`,3),jh$3(`click`,function(){return t.currentPeriodClicked()}),Bi$3(5,`span`,4),lC(6),vl$4(),Dd$1(),Bi$3(7,`svg`,5),Rh$3(8,`polygon`,6),vl$4()(),wd$1(),Rh$3(9,`div`,7),kw(10),Bi$3(11,`button`,8),jh$3(`click`,function(){return t.previousClicked()}),Dd$1(),Bi$3(12,`svg`,9),Rh$3(13,`path`,10),vl$4()(),wd$1(),Bi$3(14,`button`,11),jh$3(`click`,function(){return t.nextClicked()}),Dd$1(),Bi$3(15,`svg`,9),Rh$3(16,`path`,12),vl$4()()()()),a&2&&(sE(2),Ah$2(`id`,t._periodButtonLabelId),sE(),ig(t.periodButtonDescription),sE(),xh$2(`aria-label`,t.periodButtonLabel)(`aria-describedby`,t._periodButtonLabelId),sE(2),ig(t.periodButtonText),sE(),Yh$3(`mat-calendar-invert`,t.calendar.currentView!==`month`),sE(4),Ah$2(`disabled`,!t.previousEnabled())(`matTooltip`,t.prevButtonLabel),xh$2(`aria-label`,t.prevButtonLabel),sE(3),Ah$2(`disabled`,!t.nextEnabled())(`matTooltip`,t.nextButtonLabel),xh$2(`aria-label`,t.nextButtonLabel))},dependencies:[wp$2,xc$4,Ct$5],encapsulation:2})}return i})();var lt$3=(()=>{class i{_dateAdapter=E(l$2,{optional:!0});_dateFormats=E(d$3,{optional:!0});_changeDetectorRef=E(ej);_elementRef=E(Lr$5);headerComponent;_calendarHeaderPortal;_intlChanges;_moveFocusOnNextTick=!1;get startAt(){return this._startAt}set startAt(e){this._startAt=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_startAt=null;startView=`month`;get selected(){return this._selected}set selected(e){e instanceof _?this._selected=e:this._selected=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_selected=null;
1399get minDate(){return this._minDate}set minDate(e){this._minDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_minDate=null;get maxDate(){return this._maxDate}set maxDate(e){this._maxDate=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_maxDate=null;dateFilter;dateClass;comparisonStart=null;comparisonEnd=null;startDateAccessibleName=null;endDateAccessibleName=null;selectedChange=new Qe$1;yearSelected=new Qe$1;monthSelected=new Qe$1;viewChanged=new Qe$1(!0);_userSelection=new Qe$1;_userDragDrop=new Qe$1;monthView;yearView;multiYearView;get activeDate(){return this._clampedActiveDate}set activeDate(e){this._clampedActiveDate=this._dateAdapter.clampDate(e,this.minDate,this.maxDate),this.stateChanges.next(),this._changeDetectorRef.markForCheck()}_clampedActiveDate;get currentView(){return this._currentView}set currentView(e){let a=this._currentView!==e?e:null;this._currentView=e,this._moveFocusOnNextTick=!0,this._changeDetectorRef.markForCheck(),a&&(this.stateChanges.next(),this.viewChanged.emit(a))}_currentView;_activeDrag=null;stateChanges=new ee$5;constructor(){this._intlChanges=E(ae$5).changes.subscribe(()=>{this._changeDetectorRef.markForCheck(),this.stateChanges.next()})}ngAfterContentInit(){this._calendarHeaderPortal=new Mt$6(this.headerComponent||la$3),this.activeDate=this.startAt||this._dateAdapter.today(),this._currentView=this.startView}ngAfterViewChecked(){this._moveFocusOnNextTick&&(this._moveFocusOnNextTick=!1,this.focusActiveCell())}ngOnDestroy(){this._intlChanges.unsubscribe(),this.stateChanges.complete()}ngOnChanges(e){let a=e.minDate&&!this._dateAdapter.sameDate(e.minDate.previousValue,e.minDate.currentValue)?e.minDate:void 0,t=e.maxDate&&!this._dateAdapter.sameDate(e.maxDate.previousValue,e.maxDate.currentValue)?e.maxDate:void 0,n=a||t||e.dateFilter;if(n&&!n.firstChange){let r=this._getCurrentViewComponent();r&&(this._elementRef.nativeElement.contains(Cr$5())&&(this._moveFocusOnNextTick=!0),this._changeDetectorRef.detectChanges(),r._init())}this.stateChanges.next()}focusActiveCell(){this._getCurrentViewComponent()?._focusActiveCell(!1)}updateTodaysDate(){this._getCurrentViewComponent()?._init()}_dateSelected(e){let a=e.value;(this.selected instanceof _||a&&!this._dateAdapter.sameDate(a,this.selected))&&this.selectedChange.emit(a),this._userSelection.emit(e)}_yearSelectedInMultiYearView(e){this.yearSelected.emit(e)}_monthSelectedInYearView(e){this.monthSelected.emit(e)}_goToDateInView(e,a){this.activeDate=e,this.currentView=a}_dragStarted(e){this._activeDrag=e}_dragEnded(e){this._activeDrag&&(e.value&&this._userDragDrop.emit(e),this._activeDrag=null)}_getCurrentViewComponent(){return this.monthView||this.yearView||this.multiYearView}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-calendar`]],viewQuery:function(a,t){if(a&1&&$h$2(ea$3,5)(aa$3,5)(ta$3,5),a&2){let n;Pw(n=Lw())&&(t.monthView=n.first),Pw(n=Lw())&&(t.yearView=n.first),Pw(n=Lw())&&(t.multiYearView=n.first)}},hostAttrs:[1,`mat-calendar`],inputs:{headerComponent:`headerComponent`,startAt:`startAt`,startView:`startView`,selected:`selected`,minDate:`minDate`,maxDate:`maxDate`,dateFilter:`dateFilter`,dateClass:`dateClass`,comparisonStart:`comparisonStart`,comparisonEnd:`comparisonEnd`,startDateAccessibleName:`startDateAccessibleName`,endDateAccessibleName:`endDateAccessibleName`},outputs:{selectedChange:`selectedChange`,yearSelected:`yearSelected`,monthSelected:`monthSelected`,viewChanged:`viewChanged`,_userSelection:`_userSelection`,_userDragDrop:`_userDragDrop`},exportAs:[`matCalendar`],features:[CC([sa$3]),qy],decls:5,vars:2,consts:[[3,`cdkPortalOutlet`],[`cdkMonitorSubtreeFocus`,``,`tabindex`,`-1`,1,`mat-calendar-content`],[3,`activeDate`,`selected`,`dateFilter`,`maxDate`,`minDate`,`dateClass`,`comparisonStart`,`comparisonEnd`,`startDateAccessibleName`,`endDateAccessibleName`,`activeDrag`],[3,`activeDate`,`selected`,`dateFilter`,`maxDate`,`minDate`,`dateClass`],[3,`activeDateChange`,`_userSelection`,`dragStarted`,`dragEnded`,`activeDate`,`selected`,`dateFilter`,`maxDate`,`minDate`,`dateClass`,`comparisonStart`,`comparisonEnd`,`startDateAccessibleName`,`endDateAccessibleName`,`activeDrag`],[3,`activeDateChange`,`monthSelected`,`selectedChange`,`activeDate`,`selected`,`dateFilter`,`maxDate`,`minDate`,`dateClass`],[3,`activeDateChange`,`yearSelected`,`selectedChange`,`activeDate`,`selected`,`dateFilter`,`maxDate`,`minDate`,`dateClass`]],template:function(a,t){if(a&1&&(Th$2(0,wa$3,0,0,`ng-template`,0),Bi$3(1,`div`,1),fw(2,Aa$3,1,11,`mat-month-view`,2)(3,ka$3,1,6,`mat-year-view`,3)(4,Sa$3,1,6,`mat-multi-year-view`,3),vl$4()),a&2){let n;Ah$2(`cdkPortalOutlet`,t._calendarHeaderPortal),sE(2),pw((n=t.currentView)===`month`?2:n===`year`?3:n===`multi-year`?4:-1)}},dependencies:[vi$4,Js$4,ea$3,aa$3,ta$3],styles:[`.mat-calendar { 1400 display: block; 1401 line-height: normal; 1402 font-family: var(--%NS%mat-datepicker-calendar-text-font, var(--%NS%mat-sys-body-medium-font)); 1403 font-size: var(--%NS%mat-datepicker-calendar-text-size, var(--%NS%mat-sys-body-medium-size)); 1404} 1405 1406.mat-calendar-header { 1407 padding: 8px 8px 0 8px; 1408} 1409 1410.mat-calendar-content { 1411 padding: 0 8px 8px 8px; 1412 outline: none; 1413} 1414
1415.mat-calendar-controls { 1416 display: flex; 1417 align-items: center; 1418 margin: 5% calc(4.7142857143% - 16px); 1419} 1420 1421.mat-calendar-spacer { 1422 flex: 1 1 auto; 1423} 1424 1425.mat-calendar-period-button { 1426 min-width: 0; 1427 margin: 0 8px; 1428 font-size: var(--%NS%mat-datepicker-calendar-period-button-text-size, var(--%NS%mat-sys-title-small-size)); 1429 font-weight: var(--%NS%mat-datepicker-calendar-period-button-text-weight, var(--%NS%mat-sys-title-small-weight)); 1430 --%NS%mat-button-text-label-text-color: var(--%NS%mat-datepicker-calendar-period-button-text-color, var(--%NS%mat-sys-on-surface-variant)); 1431} 1432 1433.mat-calendar-arrow { 1434 display: inline-block; 1435 width: 10px; 1436 height: 5px; 1437 margin: 0 0 0 5px; 1438 vertical-align: middle; 1439 fill: var(--%NS%mat-datepicker-calendar-period-button-icon-color, var(--%NS%mat-sys-on-surface-variant)); 1440} 1441.mat-calendar-arrow.mat-calendar-invert { 1442 transform: rotate(180deg); 1443} 1444[dir=rtl] .mat-calendar-arrow { 1445 margin: 0 5px 0 0; 1446} 1447@media (forced-colors: active) { 1448 .mat-calendar-arrow { 1449 fill: CanvasText; 1450 } 1451} 1452 1453.mat-datepicker-content .mat-calendar-previous-button:not(.mat-mdc-button-disabled), 1454.mat-datepicker-content .mat-calendar-next-button:not(.mat-mdc-button-disabled) { 1455 color: var(--%NS%mat-datepicker-calendar-navigation-button-icon-color, var(--%NS%mat-sys-on-surface-variant)); 1456} 1457[dir=rtl] .mat-calendar-previous-button, 1458[dir=rtl] .mat-calendar-next-button { 1459 transform: rotate(180deg); 1460} 1461 1462.mat-calendar-table { 1463 border-spacing: 0; 1464 border-collapse: collapse; 1465 width: 100%; 1466} 1467 1468.mat-calendar-table-header th { 1469 text-align: center; 1470 padding: 0 0 8px 0; 1471 color: var(--%NS%mat-datepicker-calendar-header-text-color, var(--%NS%mat-sys-on-surface-variant)); 1472 font-size: var(--%NS%mat-datepicker-calendar-header-text-size, var(--%NS%mat-sys-title-small-size)); 1473 font-weight: var(--%NS%mat-datepicker-calendar-header-text-weight, var(--%NS%mat-sys-title-small-weight)); 1474} 1475 1476.mat-calendar-table-header-divider { 1477 position: relative; 1478 height: 1px; 1479} 1480.mat-calendar-table-header-divider::after { 1481 content: ""; 1482 position: absolute; 1483 top: 0; 1484 left: -8px; 1485 right: -8px; 1486 height: 1px; 1487 background: var(--%NS%mat-datepicker-calendar-header-divider-color, transparent); 1488} 1489 1490.mat-calendar-body-cell-content::before { 1491 margin: calc(calc(var(--%NS%mat-focus-indicator-border-width, 3px) + 3px) * -1); 1492} 1493 1494.mat-calendar-body-cell:focus-visible .mat-focus-indicator::before { 1495 content: ""; 1496} 1497`],encapsulation:2})}return i})();var za$3=new N$2(`mat-datepicker-scroll-strategy`,{providedIn:`root`,factory:()=>{let i=E(we$4);return()=>It$5(i)}});var ca$3=(()=>{class i{_elementRef=E(Lr$5);_animationsDisabled=nt$5();_changeDetectorRef=E(ej);_globalModel=E(B$2);_dateAdapter=E(l$2);_ngZone=E(Z$4);_rangeSelectionStrategy=E(Oe$2,{optional:!0});_stateChanges;_model;_eventCleanups;_animationFallback;_calendar;color;datepicker;comparisonStart=null;comparisonEnd=null;startDateAccessibleName=null;endDateAccessibleName=null;_isAbove=!1;_animationDone=new ee$5;_isAnimating=!1;_closeButtonText;_closeButtonFocused=!1;_actionsPortal=null;_dialogLabelId=null;constructor(){if(E(be$3).load(En$3),this._closeButtonText=E(ae$5).closeCalendarLabel,!this._animationsDisabled){let e=this._elementRef.nativeElement,a=E(pc$4);this._eventCleanups=this._ngZone.runOutsideAngular(()=>[a.listen(e,`animationstart`,this._handleAnimationEvent),a.listen(e,`animationend`,this._handleAnimationEvent),a.listen(e,`animationcancel`,this._handleAnimationEvent)])}}ngAfterViewInit(){this._stateChanges=this.datepicker.stateChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()}),this._calendar.focusActiveCell()}ngOnDestroy(){clearTimeout(this._animationFallback),this._eventCleanups?.forEach(e=>e()),this._stateChanges?.unsubscribe(),this._animationDone.complete()}_handleUserSelection(e){let a=this._model.selection,t=e.value,n=a instanceof _;if(n&&this._rangeSelectionStrategy){let r=this._rangeSelectionStrategy.selectionFinished(t,a,e.event);this._model.updateSelection(r,this)}else t&&(n||!this._dateAdapter.sameDate(t,a))&&this._model.add(t);(!this._model||this._model.isComplete())&&!this._actionsPortal&&this.datepicker.close()}_handleUserDragDrop(e){this._model.updateSelection(e.value,this)}_startExitAnimation(){this._elementRef.nativeElement.classList.add(`mat-datepicker-content-exit`),this._animationsDisabled?this._animationDone.next():(clearTimeout(this._animationFallback),this._animationFallback=setTimeout(()=>{this._isAnimating||this._animationDone.next()},200))}_handleAnimationEvent=e=>{let a=this._elementRef.nativeElement;
1497e.target!==a||!e.animationName.startsWith(`_mat-datepicker-content`)||(clearTimeout(this._animationFallback),this._isAnimating=e.type===`animationstart`,a.classList.toggle(`mat-datepicker-content-animating`,this._isAnimating),this._isAnimating||this._animationDone.next())};_getSelected(){return this._model.selection}_applyPendingSelection(){this._model!==this._globalModel&&this._globalModel.updateSelection(this._model.selection,this)}_assignActions(e,a){this._model=e?this._globalModel.clone():this._globalModel,this._actionsPortal=e,a&&this._changeDetectorRef.detectChanges()}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-datepicker-content`]],viewQuery:function(a,t){if(a&1&&$h$2(lt$3,5),a&2){let n;Pw(n=Lw())&&(t._calendar=n.first)}},hostAttrs:[1,`mat-datepicker-content`],hostVars:6,hostBindings:function(a,t){a&2&&(Xw(t.color?`mat-`+t.color:``),Yh$3(`mat-datepicker-content-touch`,t.datepicker.touchUi)(`mat-datepicker-content-animations-enabled`,!t._animationsDisabled))},inputs:{color:`color`},exportAs:[`matDatepickerContent`],decls:5,vars:26,consts:[[`cdkTrapFocus`,``,`role`,`dialog`,1,`mat-datepicker-content-container`],[3,`yearSelected`,`monthSelected`,`viewChanged`,`_userSelection`,`_userDragDrop`,`id`,`startAt`,`startView`,`minDate`,`maxDate`,`dateFilter`,`headerComponent`,`selected`,`dateClass`,`comparisonStart`,`comparisonEnd`,`startDateAccessibleName`,`endDateAccessibleName`],[3,`cdkPortalOutlet`],[`type`,`button`,`matButton`,`elevated`,1,`mat-datepicker-close-button`,3,`focus`,`blur`,`click`,`color`]],template:function(a,t){a&1&&(Bi$3(0,`div`,0)(1,`mat-calendar`,1),jh$3(`yearSelected`,function(r){return t.datepicker._selectYear(r)})(`monthSelected`,function(r){return t.datepicker._selectMonth(r)})(`viewChanged`,function(r){return t.datepicker._viewChanged(r)})(`_userSelection`,function(r){return t._handleUserSelection(r)})(`_userDragDrop`,function(r){return t._handleUserDragDrop(r)}),vl$4(),Th$2(2,Ma$3,0,0,`ng-template`,2),Bi$3(3,`button`,3),jh$3(`focus`,function(){return t._closeButtonFocused=!0})(`blur`,function(){return t._closeButtonFocused=!1})(`click`,function(){return t.datepicker.close()}),lC(4),vl$4()()),a&2&&(Yh$3(`mat-datepicker-content-container-with-custom-header`,t.datepicker.calendarHeaderComponent)(`mat-datepicker-content-container-with-actions`,t._actionsPortal),xh$2(`aria-modal`,!0)(`aria-labelledby`,t._dialogLabelId??void 0),sE(),Xw(t.datepicker.panelClass),Ah$2(`id`,t.datepicker.id)(`startAt`,t.datepicker.startAt)(`startView`,t.datepicker.startView)(`minDate`,t.datepicker._getMinDate())(`maxDate`,t.datepicker._getMaxDate())(`dateFilter`,t.datepicker._getDateFilter())(`headerComponent`,t.datepicker.calendarHeaderComponent)(`selected`,t._getSelected())(`dateClass`,t.datepicker.dateClass)(`comparisonStart`,t.comparisonStart)(`comparisonEnd`,t.comparisonEnd)(`startDateAccessibleName`,t.startDateAccessibleName)(`endDateAccessibleName`,t.endDateAccessibleName),sE(),Ah$2(`cdkPortalOutlet`,t._actionsPortal),sE(),Yh$3(`cdk-visually-hidden`,!t._closeButtonFocused),Ah$2(`color`,t.color||`primary`),sE(),ig(t._closeButtonText))},dependencies:[mc$4,lt$3,vi$4,wp$2],styles:[`@keyframes _mat-datepicker-content-dropdown-enter { 1498 from { 1499 opacity: 0; 1500 transform: scaleY(0.8); 1501 } 1502 to { 1503 opacity: 1; 1504 transform: none; 1505 } 1506} 1507@keyframes _mat-datepicker-content-dialog-enter { 1508 from { 1509 opacity: 0; 1510 transform: scale(0.8); 1511 } 1512 to { 1513 opacity: 1; 1514 transform: none; 1515 } 1516} 1517@keyframes _mat-datepicker-content-exit { 1518 from { 1519 opacity: 1; 1520 } 1521 to { 1522 opacity: 0; 1523 } 1524} 1525.mat-datepicker-content { 1526 display: block; 1527 background-color: var(--%NS%mat-datepicker-calendar-container-background-color, var(--%NS%mat-sys-surface-container-high)); 1528 color: var(--%NS%mat-datepicker-calendar-container-text-color, var(--%NS%mat-sys-on-surface)); 1529 box-shadow: var(--%NS%mat-datepicker-calendar-container-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12)); 1530 border-radius: var(--%NS%mat-datepicker-calendar-container-shape, var(--%NS%mat-sys-corner-large)); 1531} 1532.mat-datepicker-content.mat-datepicker-content-animations-enabled { 1533 animation: _mat-datepicker-content-dropdown-enter 120ms cubic-bezier(0, 0, 0.2, 1); 1534} 1535.mat-datepicker-content .mat-calendar { 1536 width: 296px; 1537 height: 354px; 1538} 1539.mat-datepicker-content .mat-datepicker-content-container-with-custom-header .mat-calendar { 1540 height: auto; 1541} 1542.mat-datepicker-content .mat-datepicker-close-button { 1543 position: absolute; 1544 top: 100%; 1545 left: 0; 1546 margin-top: 8px; 1547} 1548.mat-datepicker-content-animating .mat-datepicker-content .mat-datepicker-close-button { 1549 display: none; 1550} 1551 1552.mat-datepicker-content-container { 1553 display: flex; 1554 flex-direction: column; 1555 justify-content: space-between; 1556} 1557 1558.mat-datepicker-content-touch { 1559 display: block; 1560 max-height: 80vh; 1561 box-shadow: var(--%NS%mat-datepicker-calendar-container-touch-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12)); 1562 border-radius: var(--%NS%mat-datepicker-calendar-container-touch-shape, var(--%NS%mat-sys-corner-extra-large)); 1563 position: relative; 1564 overflow: visible; 1565 min-height: fit-content; 1566} 1567.mat-datepicker-content-touch.mat-datepicker-content-animations-enabled { 1568 animation: _mat-datepicker-content-dialog-enter 150ms cubic-bezier(0, 0, 0.2, 1); 1569} 1570.mat-datepicker-content-touch .mat-datepicker-content-container { 1571 min-height: 312px; 1572 max-height: 788px; 1573 min-width: 250px; 1574 max-width: 750px; 1575} 1576.mat-datepicker-content-touch .mat-calendar { 1577 width: 100%; 1578 height: auto; 1579} 1580 1581.mat-datepicker-content-exit.mat-datepicker-content-animations-enabled { 1582 animation: _mat-datepicker-content-exit 100ms linear; 1583} 1584 1585@media all and (orientation: landscape) { 1586 .mat-datepicker-content-touch .mat-datepicker-content-container { 1587 width: 64vh; 1588 height: 80vh; 1589 } 1590} 1591@media all and (orientation: portrait) { 1592 .mat-datepicker-content-touch .mat-datepicker-content-container { 1593 width: 80vw; 1594 height: 100vw; 1595 } 1596 .mat-datepicker-content-touch .mat-datepicker-content-container-with-actions { 1597 height: 115vw; 1598 } 1599} 1600`],encapsulation:2})}return i})();
1600var Ye$2=(()=>{class i{_injector=E(we$4);_viewContainerRef=E(is$5);_dateAdapter=E(l$2,{optional:!0});_dir=E(Oc$4,{optional:!0});_model=E(B$2);_animationsDisabled=nt$5();_scrollStrategy=E(za$3);_inputStateChanges=F$2.EMPTY;_document=E(ti$3);calendarHeaderComponent;get startAt(){return this._startAt||(this.datepickerInput?this.datepickerInput.getStartValue():null)}set startAt(e){this._startAt=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e))}_startAt=null;startView=`month`;get color(){return this._color||(this.datepickerInput?this.datepickerInput.getThemePalette():void 0)}set color(e){this._color=e}_color;touchUi=!1;get disabled(){return this._disabled===void 0&&this.datepickerInput?this.datepickerInput.disabled:!!this._disabled}set disabled(e){e!==this._disabled&&(this._disabled=e,this.stateChanges.next(void 0))}_disabled;xPosition=`start`;yPosition=`below`;restoreFocus=!0;yearSelected=new Qe$1;monthSelected=new Qe$1;viewChanged=new Qe$1(!0);dateClass;openedStream=new Qe$1;closedStream=new Qe$1;get panelClass(){return this._panelClass}set panelClass(e){this._panelClass=Nh$3(e)}_panelClass;get opened(){return this._opened}set opened(e){e?this.open():this.close()}_opened=!1;id=E(Or$4).getId(`mat-datepicker-`);_getMinDate(){return this.datepickerInput&&this.datepickerInput.min}_getMaxDate(){return this.datepickerInput&&this.datepickerInput.max}_getDateFilter(){return this.datepickerInput&&this.datepickerInput.dateFilter}_overlayRef=null;_componentRef=null;_focusedElementBeforeOpen=null;_backdropHarnessClass=`${this.id}-backdrop`;_actionsPortal=null;datepickerInput;stateChanges=new ee$5;_changeDetectorRef=E(ej);constructor(){this._dateAdapter,this._model.selectionChanged.subscribe(()=>{this._changeDetectorRef.markForCheck()})}ngOnChanges(e){let a=e.xPosition||e.yPosition;if(a&&!a.firstChange&&this._overlayRef){let t=this._overlayRef.getConfig().positionStrategy;t instanceof bt$9&&(this._setConnectedPositions(t),this.opened&&this._overlayRef.updatePosition())}this.stateChanges.next(void 0)}ngOnDestroy(){this._destroyOverlay(),this.close(),this._inputStateChanges.unsubscribe(),this.stateChanges.complete()}select(e){this._model.add(e)}_selectYear(e){this.yearSelected.emit(e)}_selectMonth(e){this.monthSelected.emit(e)}_viewChanged(e){this.viewChanged.emit(e)}registerInput(e){return this.datepickerInput,this._inputStateChanges.unsubscribe(),this.datepickerInput=e,this._inputStateChanges=e.stateChanges.subscribe(()=>this.stateChanges.next(void 0)),this._model}registerActions(e){this._actionsPortal,this._actionsPortal=e,this._componentRef?.instance._assignActions(e,!0)}removeActions(e){e===this._actionsPortal&&(this._actionsPortal=null,this._componentRef?.instance._assignActions(null,!0))}open(){this._opened||this.disabled||this._componentRef?.instance._isAnimating||(this.datepickerInput,this._focusedElementBeforeOpen=Cr$5(),this._openOverlay(),this._opened=!0,this.openedStream.emit())}close(){if(!this._opened||this._componentRef?.instance._isAnimating)return;let e=this.restoreFocus&&this._focusedElementBeforeOpen&&typeof this._focusedElementBeforeOpen.focus==`function`,a=()=>{this._opened&&(this._opened=!1,this.closedStream.emit())};if(this._componentRef){let{instance:t,location:n}=this._componentRef;t._animationDone.pipe(_t$9(1)).subscribe(()=>{let r=this._document.activeElement;e&&(!r||r===this._document.activeElement||n.nativeElement.contains(r))&&this._focusedElementBeforeOpen.focus(),this._focusedElementBeforeOpen=null,this._destroyOverlay()}),t._startExitAnimation()}e?setTimeout(a):a()}_applyPendingSelection(){this._componentRef?.instance?._applyPendingSelection()}_forwardContentValues(e){e.datepicker=this,e.color=this.color,e._dialogLabelId=this.datepickerInput.getOverlayLabelId(),e._assignActions(this._actionsPortal,!1)}_openOverlay(){this._destroyOverlay();let e=this.touchUi,a=new Mt$6(ca$3,this._viewContainerRef),t=this._overlayRef=Xt$4(this._injector,new q$2({positionStrategy:e?this._getDialogStrategy():this._getDropdownStrategy(),hasBackdrop:!0,backdropClass:[e?`cdk-overlay-dark-backdrop`:`mat-overlay-transparent-backdrop`,this._backdropHarnessClass],direction:this._dir||`ltr`,scrollStrategy:e?Le$4(this._injector):this._scrollStrategy(),panelClass:`mat-datepicker-${e?`dialog`:`popup`}`,disableAnimations:this._animationsDisabled}));this._getCloseStream(t).subscribe(n=>{n&&n.preventDefault(),this.close()}),t.keydownEvents().subscribe(n=>{let r=n.keyCode;(r===38||r===40||r===37||r===39||r===33||r===34)&&n.preventDefault()}),this._componentRef=t.attach(a),this._forwardContentValues(this._componentRef.instance),e||wp$1(()=>{t.updatePosition()},{injector:this._injector})}_destroyOverlay(){this._overlayRef&&(this._overlayRef.dispose(),this._overlayRef=this._componentRef=null)}_getDialogStrategy(){return je$2(this._injector).centerHorizontally().centerVertically()}_getDropdownStrategy(){let e=Yt$2(this._injector,this.datepickerInput.getConnectedOverlayOrigin()).withTransformOriginOn(`.mat-datepicker-content`).withFlexibleDimensions(!1).withViewportMargin(8).withLockedPosition();return this._setConnectedPositions(e)}_setConnectedPositions(e){let a=this.xPosition===`end`?`end`:`start`,t=a===`start`?`end`:`start`,n=this.yPosition===`above`?`bottom`:`top`,r=n===`top`?`bottom`:`top`;return e.withPositions([{originX:a,originY:r,overlayX:a,overlayY:n},{originX:a,originY:n,overlayX:a,overlayY:r},{originX:t,originY:r,overlayX:t,overlayY:n},{originX:t,originY:n,overlayX:t,overlayY:r}])}_getCloseStream(e){let a=[`ctrlKey`,`shiftKey`,`metaKey`];return _m(e.backdropClick(),e.detachments(),e.keydownEvents().pipe(hn$4(t=>t.keyCode===27&&!Ho$5(t)||this.datepickerInput&&Ho$5(t,`altKey`)&&t.keyCode===38&&a.every(n=>!Ho$5(t,n)))))}static ɵfac=function(a){return new(a||i)};static ɵdir=HD({type:i,inputs:{calendarHeaderComponent:`calendarHeaderComponent`,startAt:`startAt`,startView:`startView`,color:`color`,touchUi:[2,`touchUi`,`touchUi`,rj],disabled:[2,`disabled`,`disabled`,rj],xPosition:`xPosition`,yPosition:`yPosition`,restoreFocus:[2,`restoreFocus`,`restoreFocus`,rj],dateClass:`dateClass`,panelClass:`panelClass`,opened:[2,`opened`,`opened`,rj]},outputs:{yearSelected:`yearSelected`,monthSelected:`monthSelected`,viewChanged:`viewChanged`,openedStream:`opened`,closedStream:`closed`},features:[qy]})}return i})();var On$4=(()=>{class i extends Ye$2{static ɵfac=(()=>{let e;return function(t){return(e||(e=lv(i)))(t||i)}})();static ɵcmp=PD({type:i,selectors:[[`mat-datepicker`]],exportAs:[`matDatepicker`],features:[CC([sa$3,{provide:Ye$2,useExisting:i}]),wh$3],decls:0,vars:0,template:function(a,t){},encapsulation:2})}return i})();var U$2=class{target;targetElement;value=null;constructor(o,e){this.target=o,this.targetElement=e,this.value=this.target.value}};var ha$3=(()=>{class i{_elementRef=E(Lr$5);_dateAdapter=E(l$2,{optional:!0});_dateFormats=E(d$3,{optional:!0});_isInitialized=!1;get value(){return this._model?this._getValueFromModel(this._model.selection):this._pe
1600ndingValue}set value(e){this._assignValueProgrammatically(e,!0)}_model;get disabled(){return!!this._disabled||this._parentDisabled()}set disabled(e){let a=e,t=this._elementRef.nativeElement;this._disabled!==a&&(this._disabled=a,this.stateChanges.next(void 0)),a&&this._isInitialized&&t.blur&&t.blur()}_disabled;dateChange=new Qe$1;dateInput=new Qe$1;stateChanges=new ee$5;_onTouched=()=>{};_validatorOnChange=()=>{};_cvaOnChange=()=>{};_valueChangesSubscription=F$2.EMPTY;_localeSubscription=F$2.EMPTY;_pendingValue=null;_parseValidator=()=>this._lastValueValid?null:{matDatepickerParse:{text:this._elementRef.nativeElement.value}};_filterValidator=e=>{let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e.value));return!a||this._matchesFilter(a)?null:{matDatepickerFilter:!0}};_minValidator=e=>{let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e.value)),t=this._getMinDate();return!t||!a||this._dateAdapter.compareDate(t,a)<=0?null:{matDatepickerMin:{min:t,actual:a}}};_maxValidator=e=>{let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e.value)),t=this._getMaxDate();return!t||!a||this._dateAdapter.compareDate(t,a)>=0?null:{matDatepickerMax:{max:t,actual:a}}};_getValidators(){return[this._parseValidator,this._minValidator,this._maxValidator,this._filterValidator]}_registerModel(e){this._model=e,this._valueChangesSubscription.unsubscribe(),this._pendingValue&&this._assignValue(this._pendingValue),this._valueChangesSubscription=this._model.selectionChanged.subscribe(a=>{if(this._shouldHandleChangeEvent(a)){let t=this._getValueFromModel(a.selection);this._lastValueValid=this._isValidValue(t),this._cvaOnChange(t),this._onTouched(),this._formatValue(t),this.dateInput.emit(new U$2(this,this._elementRef.nativeElement)),this.dateChange.emit(new U$2(this,this._elementRef.nativeElement))}})}_lastValueValid=!1;constructor(){this._localeSubscription=this._dateAdapter.localeChanges.subscribe(()=>{this._assignValueProgrammatically(this.value,!0)})}ngAfterViewInit(){this._isInitialized=!0}ngOnChanges(e){pa$3(e,this._dateAdapter)&&this.stateChanges.next(void 0)}ngOnDestroy(){this._valueChangesSubscription.unsubscribe(),this._localeSubscription.unsubscribe(),this.stateChanges.complete()}registerOnValidatorChange(e){this._validatorOnChange=e}validate(e){return this._validator?this._validator(e):null}writeValue(e){this._assignValueProgrammatically(e,e!==this.value)}registerOnChange(e){this._cvaOnChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this.disabled=e}_onKeydown(e){Ho$5(e,`altKey`)&&e.keyCode===40&&[`ctrlKey`,`shiftKey`,`metaKey`].every(n=>!Ho$5(e,n))&&!this._elementRef.nativeElement.readOnly&&(this._openPopup(),e.preventDefault())}_onInput(e){let a=e.target.value,t=this._lastValueValid,n=this._dateAdapter.parse(a,this._dateFormats.parse.dateInput);this._lastValueValid=this._isValidValue(n),n=this._dateAdapter.getValidDateOrNull(n);let r=!this._dateAdapter.sameDate(n,this.value);!n||r?this._cvaOnChange(n):(a&&!this.value&&this._cvaOnChange(n),t!==this._lastValueValid&&this._validatorOnChange()),r&&(this._assignValue(n),this.dateInput.emit(new U$2(this,this._elementRef.nativeElement)))}_onChange(){this.dateChange.emit(new U$2(this,this._elementRef.nativeElement))}_onBlur(){this.value&&this._formatValue(this.value),this._onTouched()}_formatValue(e){this._elementRef.nativeElement.value=e!=null?this._dateAdapter.format(e,this._dateFormats.display.dateInput):``}_assignValue(e){this._model?(this._assignValueToModel(e),this._pendingValue=null):this._pendingValue=e}_isValidValue(e){return!e||this._dateAdapter.isValid(e)}_parentDisabled(){return!1}_assignValueProgrammatically(e,a){e=this._dateAdapter.deserialize(e),this._lastValueValid=this._isValidValue(e),e=this._dateAdapter.getValidDateOrNull(e),this._assignValue(e),a&&this._formatValue(e)}_matchesFilter(e){let a=this._getDateFilter();return!a||a(e)}static ɵfac=function(a){return new(a||i)};static ɵdir=HD({type:i,inputs:{value:`value`,disabled:[2,`disabled`,`disabled`,rj]},outputs:{dateChange:`dateChange`,dateInput:`dateInput`},features:[qy]})}return i})();function pa$3(i,o){let e=Object.keys(i);for(let a of e){let{previousValue:t,currentValue:n}=i[a];if(o.isDateInstance(t)&&o.isDateInstance(n)){if(!o.sameDate(t,n))return!0}else return!0}return!1}var Ka$2={provide:E$3,useExisting:Oo$4(()=>ua$3),multi:!0};var ja$3={provide:_$2,useExisting:Oo$4(()=>ua$3),multi:!0};var ua$3=(()=>{class i extends ha$3{_formField=E(St$5,{optional:!0});_closedSubscription=F$2.EMPTY;_openedSubscription=F$2.EMPTY;set matDatepicker(e){e&&(this._datepicker=e,this._ariaOwns.set(e.opened?e.id:null),this._closedSubscription=e.closedStream.subscribe(()=>{this._onTouched(),this._ariaOwns.set(null)}),this._openedSubscription=e.openedStream.subscribe(()=>{this._ariaOwns.set(e.id)}),this._registerModel(e.registerInput(this)))}_datepicker;_ariaOwns=ni$3(null);get min(){return this._min}set min(e){let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));
1600this._dateAdapter.sameDate(a,this._min)||(this._min=a,this._validatorOnChange())}_min=null;get max(){return this._max}set max(e){let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));this._dateAdapter.sameDate(a,this._max)||(this._max=a,this._validatorOnChange())}_max=null;get dateFilter(){return this._dateFilter}set dateFilter(e){let a=this._matchesFilter(this.value);this._dateFilter=e,this._matchesFilter(this.value)!==a&&this._validatorOnChange()}_dateFilter;_validator=null;constructor(){super(),this._validator=ye$4.compose(super._getValidators())}getConnectedOverlayOrigin(){return this._formField?this._formField.getConnectedOverlayOrigin():this._elementRef}getOverlayLabelId(){return this._formField?this._formField.getLabelId():this._elementRef.nativeElement.getAttribute(`aria-labelledby`)}getThemePalette(){return this._formField?this._formField.color:void 0}getStartValue(){return this.value}ngOnDestroy(){super.ngOnDestroy(),this._closedSubscription.unsubscribe(),this._openedSubscription.unsubscribe()}_openPopup(){this._datepicker&&this._datepicker.open()}_getValueFromModel(e){return e}_assignValueToModel(e){this._model&&this._model.updateSelection(e,this)}_getMinDate(){return this._min}_getMaxDate(){return this._max}_getDateFilter(){return this._dateFilter}_shouldHandleChangeEvent(e){return e.source!==this}static ɵfac=function(a){return new(a||i)};static ɵdir=HD({type:i,selectors:[[`input`,`matDatepicker`,``]],hostAttrs:[1,`mat-datepicker-input`],hostVars:6,hostBindings:function(a,t){a&1&&jh$3(`input`,function(r){return t._onInput(r)})(`change`,function(){return t._onChange()})(`blur`,function(){return t._onBlur()})(`keydown`,function(r){return t._onKeydown(r)}),a&2&&(Lh$3(`disabled`,t.disabled),xh$2(`aria-haspopup`,t._datepicker?`dialog`:null)(`aria-owns`,t._ariaOwns())(`min`,t.min?t._dateAdapter.toIso8601(t.min):null)(`max`,t.max?t._dateAdapter.toIso8601(t.max):null)(`data-mat-calendar`,t._datepicker?t._datepicker.id:null))},inputs:{matDatepicker:`matDatepicker`,min:`min`,max:`max`,dateFilter:[0,`matDatepickerFilter`,`dateFilter`]},exportAs:[`matDatepickerInput`],features:[CC([Ka$2,ja$3,{provide:Y$4,useExisting:i}]),wh$3]})}return i})();var Wa$2=(()=>{class i{static ɵfac=function(a){return new(a||i)};static ɵdir=HD({type:i,selectors:[[``,`matDatepickerToggleIcon`,``]]})}return i})();var qa$1=(()=>{class i{_intl=E(ae$5);_changeDetectorRef=E(ej);_stateChanges=F$2.EMPTY;datepicker;tabIndex=null;ariaLabel;get disabled(){return this._disabled===void 0&&this.datepicker?this.datepicker.disabled:!!this._disabled}set disabled(e){this._disabled=e}_disabled;disableRipple=!1;_customIcon;_button;constructor(){let e=E(new Tg(`tabindex`),{optional:!0}),a=Number(e);this.tabIndex=a||a===0?a:null}ngOnChanges(e){e.datepicker&&this._watchStateChanges()}ngOnDestroy(){this._stateChanges.unsubscribe()}ngAfterContentInit(){this._watchStateChanges()}_open(e){this.datepicker&&!this.disabled&&(this.datepicker.open(),e.stopPropagation())}_watchStateChanges(){let e=this.datepicker?this.datepicker.stateChanges:um(),a=this.datepicker&&this.datepicker.datepickerInput?this.datepicker.datepickerInput.stateChanges:um(),t=this.datepicker?_m(this.datepicker.openedStream,this.datepicker.closedStream):um();this._stateChanges.unsubscribe(),this._stateChanges=_m(this._intl.changes,e,a,t).subscribe(()=>this._changeDetectorRef.markForCheck())}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-datepicker-toggle`]],contentQueries:function(a,t,n){if(a&1&&Bh$3(n,Wa$2,5),a&2){let r;Pw(r=Lw())&&(t._customIcon=r.first)}},viewQuery:function(a,t){if(a&1&&$h$2(Va$3,5),a&2){let n;Pw(n=Lw())&&(t._button=n.first)}},hostAttrs:[1,`mat-datepicker-toggle`],hostVars:8,hostBindings:function(a,t){a&1&&jh$3(`click`,function(r){return t._open(r)}),a&2&&(xh$2(`tabindex`,null)(`data-mat-calendar`,t.datepicker?t.datepicker.id:null),Yh$3(`mat-datepicker-toggle-active`,t.datepicker&&t.datepicker.opened)(`mat-accent`,t.datepicker&&t.datepicker.color===`accent`)(`mat-warn`,t.datepicker&&t.datepicker.color===`warn`))},inputs:{datepicker:[0,`for`,`datepicker`],tabIndex:`tabIndex`,ariaLabel:[0,`aria-label`,`ariaLabel`],disabled:[2,`disabled`,`disabled`,rj],disableRipple:`disableRipple`},exportAs:[`matDatepickerToggle`],features:[qy],ngContentSelectors:xa$3,decls:4,vars:7,consts:[[`button`,``],[`matIconButton`,``,`type`,`button`,3,`tabIndex`,`disabled`,`disableRipple`],[`viewBox`,`0 0 24 24`,`width`,`24px`,`height`,`24px`,`fill`,`currentColor`,`focusable`,`false`,`aria-hidden`,`true`,1,`mat-datepicker-toggle-default-icon`],[`d`,`M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z`]],template:function(a,t){a&1&&(Rw(Ea$3),Bi$3(0,`button`,1,0),fw(2,Ia$3,2,0,`:svg:svg`,2),kw(3),vl$4()),a&2&&(Ah$2(`tabIndex`,t.disabled?-1:t.tabIndex)(`disabled`,t.disabled)(`disableRipple`,t.disableRipple),xh$2(`aria-haspopup`,t.datepicker?`dialog`:null)(`aria-label`,t.ariaLabel||t._intl.openCalendarLabel)(`aria-expanded`,t.datepicker?t.datepicker.opened:null),sE(2),pw(t._customIcon?-1:2))},dependencies:[xc$4],styles:[`.mat-datepicker-toggle { 1601 pointer-events: auto; 1602 color: var(--%NS%mat-datepicker-toggle-icon-color, var(--%NS%mat-sys-on-surface-variant)); 1603} 1604.mat-datepicker-toggle button { 1605 color: inherit; 1606} 1607 1608.mat-datepicker-toggle-active { 1609 color: var(--%NS%mat-datepicker-toggle-active-state-icon-color, var(--%NS%mat-sys-primary)); 1610} 1611 1612@media (forced-colors: active) { 1613 .mat-datepicker-toggle-default-icon { 1614 color: CanvasText; 1615 } 1616} 1617`],encapsulation:2})}return i})();var Qa$3=(()=>{class i{_changeDetectorRef=E(ej);_elementRef=E(Lr$5);_dateAdapter=E(l$2,{optional:!0});_formField=E(St$5,{optional:!0});_closedSubscription=F$2.EMPTY;_openedSubscription=F$2.EMPTY;_startInput;_endInput;get value(){return this._model?this._model.selection:null}id=E(Or$4).getId(`mat-date-range-input-`);focused=!1;get shouldLabelFloat(){return this.focused||!this.empty}controlType=`mat-date-range-input`;get placeholder(){let e=this._startInput?._getPlaceholder()||``,a=this._endInput?._getPlaceholder()||``;return e||a?`${e} ${this.separator} ${a}`:``}get rangePicker(){return this._rangePicker}set rangePicker(e){e&&(this._model=e.registerInput(this),this._rangePicker=e,this._closedSubscription.unsubscribe(),this._openedSubscription.unsubscribe(),this._ariaOwns.set(this.rangePicker.opened?e.id:null),this._closedSubscription=e.closedStream.subscribe(()=>{this._startInput?._onTouched(),this._endInput?._onTouched(),this._ariaOwns.set(null)}),this._openedSubscription=e.openedStream.subscribe(()=>{this._ariaOwns.set(e.id)}),this._registerModel(this._model))}_rangePicker;_ariaOwns=ni$3(null);get required(){return this._required??(this._isTargetRequired(this)||this._isTargetRequired(this._startInput)||this._isTargetRequired(this._endInput))??!1}set required(e){this._required=e}_required;get dateFilter(){return this._dateFilter}set dateFilter(e){let a=this._startInput,t=this._endInput,n=a&&a._matchesFilter(a.value),r=t&&t._matchesFilter(a.value);this._dateFilter=e,a&&a._matchesFilter(a.value)!==n&&a._validatorOnChange(),t&&t._matchesFilter(t.value)!==r&&t._validatorOnChange()}_dateFilter;get min(){return this._min}set min(e){let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));this._dateAdapter.sameDate(a,this._min)||(this._min=a,this._revalidate())}_min=null;get max(){return this._max}set max(e){let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));this._dateAdapter.sameDate(a,this._max)||(this._max=a,this._revalidate())}_max=null;get disabled(){return this._startInput&&this._endInput?this._startInput.disabled&&this._endInput.disabled:this._groupDisabled}set disabled(e){e!==this._groupDisabled&&(this._groupDisabled=e,this.stateChanges.next(void 0))}_groupDisabled=!1;get errorState(){return this._startInput&&this._endInput?this._startInput.errorState||this._endInput.errorState:!1}get empty(){let e=this._startInput?this._startInput.isEmpty():!1,a=this._endInput?this._endInput.isEmpty():!1;return e&&a}_ariaDescribedBy=null;_model;separator=`â`;comparisonStart=null;comparisonEnd=null;ngControl;stateChanges=new ee$5;disableAutomaticLabeling=!0;constructor(){this._dateAdapter,this._formField?._elementRef.nativeElement.classList.contains(`mat-mdc-form-field`)&&this._elementRef.nativeElement.classList.add(`mat-mdc-input-element`,`mat-mdc-form-field-input-control`,`mdc-text-field__input`),this.ngControl=E(h$1,{optional:!0,self:!0})}get describedByIds(){return this._elementRef.nativeElement.getAttribute(`aria-describedby`)?.split(` `)||[]}setDescribedByIds(e){this._ariaDescribedBy=e.length?e.join(` `):null}onContainerClick(){!this.focused&&!this.disabled&&(!this._model||!this._model.selection.start?this._startInput.focus():this._endInput.focus())}ngAfterContentInit(){this._model&&this._registerModel(this._model),_m(this._startInput.stateChanges,this._endInput.stateChanges).subscribe(()=>{this.stateChanges.next(void 0)})}ngOnChanges(e){pa$3(e,this._dateAdapter)&&this.stateChanges.next(void 0)}ngOnDestroy(){this._closedSubscription.unsubscribe(),this._openedSubscription.unsubscribe(),this.stateChanges.complete()}getStartValue(){return this.value?this.value.start:null}
1617getThemePalette(){return this._formField?this._formField.color:void 0}getConnectedOverlayOrigin(){return this._formField?this._formField.getConnectedOverlayOrigin():this._elementRef}getOverlayLabelId(){return this._formField?this._formField.getLabelId():null}_getInputMirrorValue(e){let a=e===`start`?this._startInput:this._endInput;return a?a.getMirrorValue():``}_shouldHidePlaceholders(){return this._startInput?!this._startInput.isEmpty():!1}_handleChildValueChange(){this.stateChanges.next(void 0),this._changeDetectorRef.markForCheck()}_openDatepicker(){this._rangePicker&&this._rangePicker.open()}_shouldHideSeparator(){return(!this._formField||this._formField.getLabelId()&&!this._formField._shouldLabelFloat())&&this.empty}_getAriaLabelledby(){let e=this._formField;return e&&e._hasFloatingLabel()?e._labelId:null}_getStartDateAccessibleName(){return this._startInput._getAccessibleName()}_getEndDateAccessibleName(){return this._endInput._getAccessibleName()}_updateFocus(e){this.focused=e!==null,this.stateChanges.next()}_revalidate(){this._startInput&&this._startInput._validatorOnChange(),this._endInput&&this._endInput._validatorOnChange()}_registerModel(e){this._startInput&&this._startInput._registerModel(e),this._endInput&&this._endInput._registerModel(e)}_isTargetRequired(e){return e?.ngControl?.control?.hasValidator(ye$4.required)}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-date-range-input`]],hostAttrs:[`role`,`group`,1,`mat-date-range-input`],hostVars:8,hostBindings:function(a,t){a&2&&(xh$2(`id`,t.id)(`aria-labelledby`,t._getAriaLabelledby())(`aria-describedby`,t._ariaDescribedBy)(`data-mat-calendar`,t.rangePicker?t.rangePicker.id:null),Yh$3(`mat-date-range-input-hide-placeholders`,t._shouldHidePlaceholders())(`mat-date-range-input-required`,t.required))},inputs:{rangePicker:`rangePicker`,required:[2,`required`,`required`,rj],dateFilter:`dateFilter`,min:`min`,max:`max`,disabled:[2,`disabled`,`disabled`,rj],separator:`separator`,comparisonStart:`comparisonStart`,comparisonEnd:`comparisonEnd`},exportAs:[`matDateRangeInput`],features:[CC([{provide:yt$8,useExisting:i}]),qy],ngContentSelectors:Na$3,decls:11,vars:5,consts:[[`cdkMonitorSubtreeFocus`,``,1,`mat-date-range-input-container`,3,`cdkFocusChange`],[1,`mat-date-range-input-wrapper`],[`aria-hidden`,`true`,1,`mat-date-range-input-mirror`],[1,`mat-date-range-input-separator`],[1,`mat-date-range-input-wrapper`,`mat-date-range-input-end-wrapper`]],template:function(a,t){a&1&&(Rw(Fa$3),Bi$3(0,`div`,0),jh$3(`cdkFocusChange`,function(r){return t._updateFocus(r)}),Bi$3(1,`div`,1),kw(2),Bi$3(3,`span`,2),lC(4),vl$4()(),Bi$3(5,`span`,3),lC(6),vl$4(),Bi$3(7,`div`,4),kw(8,1),Bi$3(9,`span`,2),lC(10),vl$4()()()),a&2&&(sE(4),ig(t._getInputMirrorValue(`start`)),sE(),Yh$3(`mat-date-range-input-separator-hidden`,t._shouldHideSeparator()),sE(),ig(t.separator),sE(4),ig(t._getInputMirrorValue(`end`)))},dependencies:[Js$4],styles:[`.mat-date-range-input { 1618 display: block; 1619 width: 100%; 1620} 1621 1622.mat-date-range-input-container { 1623 display: flex; 1624 align-items: center; 1625} 1626 1627.mat-date-range-input-separator { 1628 transition: opacity 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1); 1629 margin: 0 4px; 1630 color: var(--%NS%mat-datepicker-range-input-separator-color, var(--%NS%mat-sys-on-surface)); 1631} 1632.mat-form-field-disabled .mat-date-range-input-separator { 1633 color: var(--%NS%mat-datepicker-range-input-disabled-state-separator-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 1634} 1635._mat-animation-noopable .mat-date-range-input-separator { 1636 transition: none; 1637} 1638 1639.mat-date-range-input-separator-hidden { 1640 -webkit-user-select: none; 1641 user-select: none; 1642 opacity: 0; 1643 transition: none; 1644} 1645 1646.mat-date-range-input-wrapper { 1647 position: relative; 1648 overflow: hidden; 1649 max-width: calc(50% - 4px); 1650} 1651 1652.mat-date-range-input-end-wrapper { 1653 flex-grow: 1; 1654} 1655 1656.mat-date-range-input-inner { 1657 position: absolute; 1658 top: 0; 1659 left: 0; 1660 font: inherit; 1661 background: transparent; 1662 color: currentColor; 1663 border: none; 1664 outline: none; 1665 padding: 0; 1666 margin: 0; 1667 vertical-align: bottom; 1668 text-align: inherit; 1669 -webkit-appearance: none; 1670 width: 100%; 1671 height: 100%; 1672} 1673.mat-date-range-input-inner:-moz-ui-invalid { 1674 box-shadow: none; 1675} 1676.mat-date-range-input-inner::placeholder { 1677 transition: color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1); 1678} 1679.mat-date-range-input-inner::-moz-placeholder { 1680 transition: color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1); 1681} 1682.mat-date-range-input-inner::-webkit-input-placeholder { 1683 transition: color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1); 1684} 1685.mat-date-range-input-inner:-ms-input-placeholder { 1686 transition: color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1); 1687} 1688.mat-date-range-input-inner[disabled] { 1689 color: var(--%NS%mat-datepicker-range-input-disabled-state-text-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 1690} 1691.mat-form-field-hide-placeholder .mat-date-range-input-inner::placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner::placeholder { 1692 -webkit-user-select: none; 1693 user-select: none; 1694 color: transparent !important; 1695 -webkit-text-fill-color: transparent; 1696 transition: none; 1697} 1698@media (forced-colors: active) { 1699 .mat-form-field-hide-placeholder .mat-date-range-input-inner::placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner::placeholder { 1700 opacity: 0; 1701 } 1702} 1703.mat-form-field-hide-placeholder .mat-date-range-input-inner::-moz-placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-moz-placeholder { 1704 -webkit-user-select: none; 1705 user-select: none; 1706 color: transparent !important; 1707 -webkit-text-fill-color: transparent; 1708 transition: none; 1709} 1710@media (forced-colors: active) { 1711 .mat-form-field-hide-placeholder .mat-date-range-input-inner::-moz-placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-moz-placeholder { 1712 opacity: 0; 1713 } 1714} 1715.mat-form-field-hide-placeholder .mat-date-range-input-inner::-webkit-input-placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-webkit-input-placeholder { 1716 -webkit-user-select: none; 1717 user-select: none; 1718 color: transparent !important; 1719 -webkit-text-fill-color: transparent; 1720 transition: none; 1721} 1722@media (forced-colors: active) { 1723 .mat-form-field-hide-placeholder .mat-date-range-input-inner::-webkit-input-placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-webkit-input-placeholder { 1724 opacity: 0; 1725 } 1726} 1727.mat-form-field-hide-placeholder .mat-date-range-input-inner:-ms-input-placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner:-ms-input-placeholder { 1728 -webkit-user-select: none; 1729 user-select: none; 1730 color: transparent !important; 1731 -webkit-text-fill-color: transparent; 1732 transition: none; 1733} 1734@media (forced-colors: active) { 1735 .mat-form-field-hide-placeholder .mat-date-range-input-inner:-ms-input-placeholder, .mat-date-range-input-hide-placeholders .mat-date-range-input-inner:-ms-input-placeholder { 1736 opacity: 0; 1737 } 1738} 1739._mat-animation-noopable .mat-date-range-input-inner::placeholder { 1740 transition: none; 1741} 1742._mat-animation-noopable .mat-date-range-input-inner::-moz-placeholder { 1743 transition: none; 1744} 1745._mat-animation-noopable .mat-date-range-input-inner::-webkit-input-placeholder { 1746 transition: none; 1747} 1748._mat-animation-noopable .mat-date-range-input-inner:-ms-input-placeholder { 1749 transition: none; 1750} 1751 1752.mat-date-range-input-mirror { 1753 -webkit-user-select: none; 1754 user-select: none; 1755 visibility: hidden; 1756 white-space: nowrap; 1757 display: inline-block; 1758 min-width: 2px; 1759} 1760 1761.mat-mdc-form-field-type-mat-date-range-input .mat-mdc-form-field-infix { 1762 width: 200px; 1763} 1764`],encapsulation:2})}return i})();function $a$3(i){return ct$6(i,!0)}function na$3(i){return i.nodeType===Node.ELEMENT_NODE}function Ga$2(i){return i.nodeName===`INPUT`}function Ua$3(i){return i.nodeName===`TEXTAREA`}function ct$6(i,o){if(na$3(i)&&o){let a=(i.getAttribute?.(`aria-labelledby`)?.split(/\s+/g)||[]).reduce((t,n)=>{let r=document.getElementById(n);return r&&t.push(r),t},[]);if(a.length)return a.map(t=>ct$6(t,!1)).join(` `)}if(na$3(i)){let e=i.getAttribute(`aria-label`)?.trim();if(e)return e}
1764if(Ga$2(i)||Ua$3(i)){if(i.labels?.length)return Array.from(i.labels).map(t=>ct$6(t,!1)).join(` `);let e=i.getAttribute(`placeholder`)?.trim();if(e)return e;let a=i.getAttribute(`title`)?.trim();if(a)return a}return(i.textContent||``).replace(/\s+/g,` `).trim()}var ma$3=(()=>{class i extends ha$3{_rangeInput=E(Qa$3);_elementRef=E(Lr$5);_defaultErrorStateMatcher=E(En$4);_injector=E(we$4);_rawValue=ni$3(``);_parentForm=E(un$5,{optional:!0});_parentFormGroup=E(bn$4,{optional:!0});ngControl;_dir=E(Oc$4,{optional:!0});_errorStateTracker;get errorStateMatcher(){return this._errorStateTracker.matcher}set errorStateMatcher(e){this._errorStateTracker.matcher=e}get errorState(){return this._errorStateTracker.errorState}set errorState(e){this._errorStateTracker.errorState=e}constructor(){super(),this._errorStateTracker=new qe$2(this._defaultErrorStateMatcher,null,this._parentFormGroup,this._parentForm,this.stateChanges)}ngOnInit(){let e=this._injector.get(C$1,null,{optional:!0,self:!0});this._errorStateTracker.formField=this._injector.get(Fn$4,null,{optional:!0,self:!0}),e&&(this.ngControl=e,this._errorStateTracker.ngControl=e)}ngAfterContentInit(){this._register()}ngDoCheck(){this.ngControl&&this.updateErrorState(),this._rawValue.set(this._elementRef.nativeElement.value)}isEmpty(){return this._rawValue().length===0}_getPlaceholder(){return this._elementRef.nativeElement.placeholder}focus(){this._elementRef.nativeElement.focus()}getMirrorValue(){let e=this._rawValue();return e.length>0?e:this._getPlaceholder()}updateErrorState(){this._errorStateTracker.updateErrorState()}_onInput(e){super._onInput(e),this._rangeInput._handleChildValueChange()}_openPopup(){this._rangeInput._openDatepicker()}_getMinDate(){return this._rangeInput.min}_getMaxDate(){return this._rangeInput.max}_getDateFilter(){return this._rangeInput.dateFilter}_parentDisabled(){return this._rangeInput._groupDisabled}_shouldHandleChangeEvent({source:e}){return e!==this._rangeInput._startInput&&e!==this._rangeInput._endInput}_assignValueProgrammatically(e,a){super._assignValueProgrammatically(e,a),(this===this._rangeInput._startInput?this._rangeInput._endInput:this._rangeInput._startInput)?._validatorOnChange(),this._rawValue.set(this._elementRef.nativeElement.value)}_formatValue(e){super._formatValue(e),this._rangeInput._handleChildValueChange()}_getAccessibleName(){return $a$3(this._elementRef.nativeElement)}static ɵfac=function(a){return new(a||i)};static ɵdir=HD({type:i,inputs:{errorStateMatcher:`errorStateMatcher`},features:[wh$3]})}return i})();var Yn$3=(()=>{class i extends ma$3{_startValidator=e=>{let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e.value)),t=this._model?this._model.selection.end:null;return!a||!t||this._dateAdapter.compareDate(a,t)<=0?null:{matStartDateInvalid:{end:t,actual:a}}};_validator=ye$4.compose([...super._getValidators(),this._startValidator]);_register(){this._rangeInput._startInput=this}_getValueFromModel(e){return e.start}_shouldHandleChangeEvent(e){return super._shouldHandleChangeEvent(e)?e.oldValue?.start?!e.selection.start||!!this._dateAdapter.compareDate(e.oldValue.start,e.selection.start):!!e.selection.start:!1}_assignValueToModel(e){if(this._model){let a=new _(e,this._model.selection.end);this._model.updateSelection(a,this),this._rangeInput._handleChildValueChange()}}_onKeydown(e){let a=this._rangeInput._endInput,t=this._elementRef.nativeElement,n=this._dir?.value!==`rtl`;(e.keyCode===39&&n||e.keyCode===37&&!n)&&t.selectionStart===t.value.length&&t.selectionEnd===t.value.length?(e.preventDefault(),a._elementRef.nativeElement.setSelectionRange(0,0),a.focus()):super._onKeydown(e)}static ɵfac=(()=>{let e;return function(t){return(e||(e=lv(i)))(t||i)}})();static ɵdir=HD({type:i,selectors:[[`input`,`matStartDate`,``]],hostAttrs:[`type`,`text`,1,`mat-start-date`,`mat-date-range-input-inner`],hostVars:5,hostBindings:function(a,t){a&1&&jh$3(`input`,function(r){return t._onInput(r)})(`change`,function(){return t._onChange()})(`keydown`,function(r){return t._onKeydown(r)})(`blur`,function(){return t._onBlur()}),a&2&&(Lh$3(`disabled`,t.disabled),xh$2(`aria-haspopup`,t._rangeInput.rangePicker?`dialog`:null)(`aria-owns`,t._rangeInput._ariaOwns()||null)(`min`,t._getMinDate()?t._dateAdapter.toIso8601(t._getMinDate()):null)(`max`,t._getMaxDate()?t._dateAdapter.toIso8601(t._getMaxDate()):null))},outputs:{dateChange:`dateChange`,dateInput:`dateInput`},features:[CC([{provide:E$3,useExisting:i,multi:!0},{provide:_$2,useExisting:i,multi:!0}]),wh$3]})}return i})();var Pn$4=(()=>{class i extends ma$3{_endValidator=e=>{let a=this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e.value)),t=this._model?this._model.selection.start:null;return!a||!t||this._dateAdapter.compareDate(a,t)>=0?null:{matEndDateInvalid:{start:t,actual:a}}};_register(){this._rangeInput._endInput=this}_validator=ye$4.compose([...super._getValidators(),this._endValidator]);_getValueFromModel(e){return e.end}_shouldHandleChangeEvent(e){return super._shouldHandleChangeEvent(e)?e.oldValue?.end?!e.selection.end||!!this._dateAdapter.compareDate(e.oldValue.end,e.selection.end):!!e.selection.end:!1}_assignValueToModel(e){if(this._model){let a=new _(this._model.selection.start,e);this._model.updateSelection(a,this)}}_moveCaretToEndOfStartInput(){let e=this._rangeInput._startInput._elementRef.nativeElement,a=e.value;a.length>0&&e.setSelectionRange(a.length,a.length),e.focus()}_onKeydown(e){let a=this._elementRef.nativeElement,t=this._dir?.value!==`rtl`;e.keyCode===8&&!a.value?this._moveCaretToEndOfStartInput():(e.keyCode===37&&t||e.keyCode===39&&!t)&&a.selectionStart===0&&a.selectionEnd===0?(e.preventDefault(),this._moveCaretToEndOfStartInput()):super._onKeydown(e)}static ɵfac=(()=>{let e;return function(t){return(e||(e=lv(i)))(t||i)}})();static ɵdir=HD({type:i,selectors:[[`input`,`matEndDate`,``]],hostAttrs:[`type`,`text`,1,`mat-end-date`,`mat-date-range-input-inner`],hostVars:5,hostBindings:function(a,t){a&1&&jh$3(`input`,function(r){return t._onInput(r)})(`change`,function(){return t._onChange()})(`keydown`,function(r){return t._onKeydown(r)})(`blur`,function(){return t._onBlur()}),a&2&&(Lh$3(`disabled`,t.disabled),xh$2(`aria-haspopup`,t._rangeInput.rangePicker?`dialog`:null)(`aria-owns`,t._rangeInput._ariaOwns()||null)(`min`,t._getMinDate()?t._dateAdapter.toIso8601(t._getMinDate()):null)(`max`,t._getMaxDate()?t._dateAdapter.toIso8601(t._getMaxDate()):null))},outputs:{dateChange:`dateChange`,dateInput:`dateInput`},features:[CC([{provide:E$3,useExisting:i,multi:!0},{provide:_$2,useExisting:i,multi:!0}]),wh$3]})}return i})();var Ln$3=(()=>{class i extends Ye$2{_forwardContentValues(e){super._forwardContentValues(e);let a=this.datepickerInput;a&&(e.comparisonStart=a.comparisonStart,e.comparisonEnd=a.comparisonEnd,e.startDateAccessibleName=a._getStartDateAccessibleName(),e.endDateAccessibleName=a._getEndDateAccessibleName())}static ɵfac=(()=>{let e;return function(t){return(e||(e=lv(i)))(t||i)}})();static ɵcmp=PD({type:i,selectors:[[`mat-date-range-picker`]],exportAs:[`matDateRangePicker`],features:[CC([Pa$3,{provide:Oe$2,useFactory:()=>E(Oe$2,{optional:!0,skipSelf:!0})||new La$3(E(l$2))},{provide:Ye$2,useExisting:i}]),wh$3],decls:0,vars:0,template:function(a,t){},encapsulation:2})}return i})();var Bn$3=(()=>
vendor: 9,065 bytes, lines 1764-1840
1764{class i{static ɵfac=function(a){return new(a||i)};static ɵmod=FD({type:i});static ɵinj=ju$1({providers:[ae$5],imports:[Ap$1,di$3,gc$4,Re$3,ca$3,qa$1,la$3,xn$4,Bt$5]})}return i})();var Y$2=[`switch`];var J$2=[`*`];function K$2(i,p){i&1&&(Bi$3(0,`span`,11),Dd$1(),Bi$3(1,`svg`,13),Rh$3(2,`path`,14),vl$4(),Bi$3(3,`svg`,15),Rh$3(4,`path`,16),vl$4()())}var ee$3=new N$2(`mat-slide-toggle-default-options`,{providedIn:`root`,factory:()=>({disableToggleValue:!1,hideIcon:!1,disabledInteractive:!1})});var g=class{source;checked;constructor(p,t){this.source=p,this.checked=t}};var te$2=(()=>{class i{_elementRef=E(Lr$5);_focusMonitor=E(yn$4);_changeDetectorRef=E(ej);defaults=E(ee$3);_onChange=t=>{};_onTouched=()=>{};_validatorOnChange=()=>{};_uniqueId;_checked=!1;_createChangeEvent(t){return new g(this,t)}_labelId;get buttonId(){return`${this.id||this._uniqueId}-button`}_switchElement;focus(){this._switchElement.nativeElement.focus()}_noopAnimations=nt$5();_focused=!1;name=null;id;labelPosition=`after`;ariaLabel=null;ariaLabelledby=null;ariaDescribedby;required=!1;color;disabled=!1;fullWidth=!1;disableRipple=!1;tabIndex=0;get checked(){return this._checked}set checked(t){this._checked=t,this._changeDetectorRef.markForCheck()}hideIcon;disabledInteractive;change=new Qe$1;toggleChange=new Qe$1;get inputId(){return`${this.id||this._uniqueId}-input`}constructor(){E(be$3).load(ra$5);let t=E(new Tg(`tabindex`),{optional:!0}),a=this.defaults;this.tabIndex=t==null?0:parseInt(t)||0,this.color=a.color||`accent`,this.id=this._uniqueId=E(Or$4).getId(`mat-mdc-slide-toggle-`),this.hideIcon=a.hideIcon??!1,this.disabledInteractive=a.disabledInteractive??!1,this._labelId=this._uniqueId+`-label`}ngAfterContentInit(){this._focusMonitor.monitor(this._elementRef,!0).subscribe(t=>{t===`keyboard`||t===`program`?(this._focused=!0,this._changeDetectorRef.markForCheck()):t||Promise.resolve().then(()=>{this._focused=!1,this._onTouched(),this._changeDetectorRef.markForCheck()})})}ngOnChanges(t){t.required&&this._validatorOnChange()}ngOnDestroy(){this._focusMonitor.stopMonitoring(this._elementRef)}writeValue(t){this.checked=!!t}registerOnChange(t){this._onChange=t}registerOnTouched(t){this._onTouched=t}validate(t){return this.required&&t.value!==!0?{required:!0}:null}registerOnValidatorChange(t){this._validatorOnChange=t}setDisabledState(t){this.disabled=t,this._changeDetectorRef.markForCheck()}toggle(){this.checked=!this.checked,this._onChange(this.checked)}_emitChangeEvent(){this._onChange(this.checked),this.change.emit(this._createChangeEvent(this.checked))}_handleClick(){this.disabled||(this.toggleChange.emit(),this.defaults.disableToggleValue||(this.checked=!this.checked,this._onChange(this.checked),this.change.emit(new g(this,this.checked))))}_getAriaLabelledBy(){return this.ariaLabelledby?this.ariaLabelledby:this.ariaLabel?null:this._labelId}static ɵfac=function(a){return new(a||i)};static ɵcmp=PD({type:i,selectors:[[`mat-slide-toggle`]],viewQuery:function(a,e){if(a&1&&$h$2(Y$2,5),a&2){let l;Pw(l=Lw())&&(e._switchElement=l.first)}},hostAttrs:[1,`mat-mdc-slide-toggle`],hostVars:15,hostBindings:function(a,e){a&2&&(Lh$3(`id`,e.id),xh$2(`tabindex`,null)(`aria-label`,null)(`name`,null)(`aria-labelledby`,null),Xw(e.color?`mat-`+e.color:``),Yh$3(`mat-mdc-slide-toggle-focused`,e._focused)(`mat-mdc-slide-toggle-checked`,e.checked)(`mat-slide-toggle-full-width`,e.fullWidth)(`_mat-animation-noopable`,e._noopAnimations))},inputs:{name:`name`,id:`id`,labelPosition:`labelPosition`,ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`],ariaDescribedby:[0,`aria-describedby`,`ariaDescribedby`],required:[2,`required`,`required`,rj],color:`color`,disabled:[2,`disabled`,`disabled`,rj],fullWidth:[2,`fullWidth`,`fullWidth`,rj],disableRipple:[2,`disableRipple`,`disableRipple`,rj],tabIndex:[2,`tabIndex`,`tabIndex`,t=>t==null?0:oj(t)],checked:[2,`checked`,`checked`,rj],hideIcon:[2,`hideIcon`,`hideIcon`,rj],disabledInteractive:[2,`disabledInteractive`,`disabledInteractive`,rj]},outputs:{change:`change`,toggleChange:`toggleChange`},exportAs:[`matSlideToggle`],features:[CC([{provide:E$3,useExisting:Oo$4(()=>i),multi:!0},{provide:_$2,useExisting:i,multi:!0}]),qy],ngContentSelectors:J$2,decls:14,vars:27,consts:[[`switch`,``],[`mat-internal-form-field`,``,3,`labelPosition`],[`role`,`switch`,`type`,`button`,1,`mdc-switch`,3,`click`,`tabIndex`,`disabled`],[1,`mat-mdc-slide-toggle-touch-target`],[1,`mdc-switch__track`],[1,`mdc-switch__handle-track`],[1,`mdc-switch__handle`],[1,`mdc-switch__shadow`],[1,`mdc-elevation-overlay`],[1,`mdc-switch__ripple`],[`mat-ripple`,``,1,`mat-mdc-slide-toggle-ripple`,`mat-focus-indicator`,3,`matRippleTrigger`,`matRippleDisabled`,`matRippleCentered`],[1,`mdc-switch__icons`],[1,`mdc-label`,3,`click`,`for`],[`viewBox`,`0 0 24 24`,`aria-hidden`,`true`,1,`mdc-switch__icon`,`mdc-switch__icon--on`],[`d`,`M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z`],[`viewBox`,`0 0 24 24`,`aria-hidden`,`true`,1,`mdc-switch__icon`,`mdc-switch__icon--off`],[`d`,`M20 13H4v-2h16v2z`]],template:function(a,e){if(a&1&&(Rw(),Bi$3(0,`div`,1)(1,`button`,2,0),jh$3(`click`,function(){return e._handleClick()}),Rh$3(3,`div`,3)(4,`span`,4),Bi$3(5,`span`,5)(6,`span`,6)(7,`span`,7),Rh$3(8,`span`,8),vl$4(),Bi$3(9,`span`,9),Rh$3(10,`span`,10),vl$4(),fw(11,K$2,5,0,`span`,11),vl$4()()(),Bi$3(12,`label`,12),jh$3(`click`,function($){return $.stopPropagation()}),kw(13),vl$4()()),a&2){let l=jw(2);Ah$2(`labelPosition`,e.labelPosition),sE(),Yh$3(`mdc-switch--selected`,e.checked)(`mdc-switch--unselected`,!e.checked)(`mdc-switch--checked`,e.checked)(`mdc-switch--disabled`,e.disabled)(`mat-mdc-slide-toggle-disabled-interactive`,e.disabledInteractive),Ah$2(`tabIndex`,e.disabled&&!e.disabledInteractive?-1:e.tabIndex)(`disabled`,e.disabled&&!e.disabledInteractive),xh$2(`id`,e.buttonId)(`name`,e.name)(`aria-label`,e.ariaLabel)(`aria-labelledby`,e._getAriaLabelledBy())(`aria-describedby`,e.ariaDescribedby)(`aria-required`,e.required||null)(`aria-checked`,e.checked)(`aria-disabled`,e.disabled&&e.disabledInteractive?`true`:null),sE(9),Ah$2(`matRippleTrigger`,l)(`matRippleDisabled`,e.disableRipple||e.disabled)(`matRippleCentered`,!0),sE(),pw(e.hideIcon?-1:11),sE(),Ah$2(`for`,e.buttonId),xh$2(`id`,e._labelId)}},dependencies:[$h$3,m$2],styles:[`.mdc-switch { 1765 align-items: center; 1766 background: none; 1767 border: none; 1768 cursor: pointer; 1769 display: inline-flex; 1770 flex-shrink: 0; 1771 margin: 0; 1772 outline: none; 1773 overflow: visible; 1774 padding: 0; 1775 position: relative; 1776 width: var(--%NS%mat-slide-toggle-track-width, 52px); 1777} 1778.mdc-switch.mdc-switch--disabled { 1779 cursor: default; 1780 pointer-events: none; 1781} 1782.mdc-switch.mat-mdc-slide-toggle-disabled-interactive { 1783 pointer-events: auto; 1784} 1785 1786.mdc-switch__track { 1787 overflow: hidden; 1788 position: relative; 1789 width: 100%; 1790 height: var(--%NS%mat-slide-toggle-track-height, 32px); 1791 border-radius: var(--%NS%mat-slide-toggle-track-shape, var(--%NS%mat-sys-corner-full)); 1792} 1793.mdc-switch--disabled.mdc-switch .mdc-switch__track { 1794 opacity: var(--%NS%mat-slide-toggle-disabled-track-opacity, 0.12); 1795} 1796.mdc-switch__track::before, .mdc-switch__track::after { 1797 border: 1px solid transparent; 1798 border-radius: inherit; 1799 box-sizing: border-box; 1800 content: ""; 1801 height: 100%; 1802 left: 0; 1803 position: absolute; 1804 width: 100%; 1805 border-width: var(--%NS%mat-slide-toggle-track-outline-width, 2px); 1806 border-color: var(--%NS%mat-slide-toggle-track-outline-color, var(--%NS%mat-sys-outline)); 1807} 1808.mdc-switch--selected .mdc-switch__track::before, .mdc-switch--selected .mdc-switch__track::after { 1809 border-width: var(--%NS%mat-slide-toggle-selected-track-outline-width, 2px); 1810 border-color: var(--%NS%mat-slide-toggle-selected-track-outline-color, transparent); 1811} 1812.mdc-switch--disabled .mdc-switch__track::before, .mdc-switch--disabled .mdc-switch__track::after { 1813 border-width: var(--%NS%mat-slide-toggle-disabled-unselected-track-outline-width, 2px); 1814 border-color: var(--%NS%mat-slide-toggle-disabled-unselected-track-outline-color, var(--%NS%mat-sys-on-surface)); 1815} 1816@media (forced-colors: active) { 1817 .mdc-switch__track { 1818 border-color: currentColor; 1819 } 1820} 1821.mdc-switch__track::before { 1822 transition: transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1); 1823 transform: translateX(0); 1824 background: var(--%NS%mat-slide-toggle-unselected-track-color, var(--%NS%mat-sys-surface-variant)); 1825} 1826.mdc-switch--selected .mdc-switch__track::before { 1827 transition: transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1); 1828 transform: translateX(100%); 1829} 1830[dir=rtl] .mdc-switch--selected .mdc-switch--selected .mdc-switch__track::before { 1831 transform: translateX(-100%); 1832} 1833.mdc-switch--selected .mdc-switch__track::before { 1834 opacity: var(--%NS%mat-slide-toggle-hidden-track-opacity, 0); 1835 transition: var(--%NS%mat-slide-toggle-hidden-track-transition, opacity 75ms); 1836} 1837.mdc-switch--unselected .mdc-switch__track::before { 1838 opacity: var(--%NS%mat-slide-toggle-visible-track-opacity, 1); 1839 transition: var(--%NS%mat-slide-toggle-visible-track-transition, opacity 75ms); 1840}
1841.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::before { 1842 background: var(--%NS%mat-slide-toggle-unselected-hover-track-color, var(--%NS%mat-sys-surface-variant)); 1843} 1844.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::before { 1845 background: var(--%NS%mat-slide-toggle-unselected-focus-track-color, var(--%NS%mat-sys-surface-variant)); 1846} 1847.mdc-switch:enabled:active .mdc-switch__track::before { 1848 background: var(--%NS%mat-slide-toggle-unselected-pressed-track-color, var(--%NS%mat-sys-surface-variant)); 1849} 1850.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:hover:not(:focus):not(:active) .mdc-switch__track::before, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:focus:not(:active) .mdc-switch__track::before, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:active .mdc-switch__track::before, .mdc-switch.mdc-switch--disabled .mdc-switch__track::before { 1851 background: var(--%NS%mat-slide-toggle-disabled-unselected-track-color, var(--%NS%mat-sys-surface-variant)); 1852} 1853.mdc-switch__track::after { 1854 transform: translateX(-100%); 1855 background: var(--%NS%mat-slide-toggle-selected-track-color, var(--%NS%mat-sys-primary)); 1856} 1857[dir=rtl] .mdc-switch__track::after { 1858 transform: translateX(100%); 1859} 1860.mdc-switch--selected .mdc-switch__track::after { 1861 transform: translateX(0); 1862} 1863.mdc-switch--selected .mdc-switch__track::after { 1864 opacity: var(--%NS%mat-slide-toggle-visible-track-opacity, 1); 1865 transition: var(--%NS%mat-slide-toggle-visible-track-transition, opacity 75ms); 1866} 1867.mdc-switch--unselected .mdc-switch__track::after { 1868 opacity: var(--%NS%mat-slide-toggle-hidden-track-opacity, 0); 1869 transition: var(--%NS%mat-slide-toggle-hidden-track-transition, opacity 75ms); 1870} 1871.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::after { 1872 background: var(--%NS%mat-slide-toggle-selected-hover-track-color, var(--%NS%mat-sys-primary)); 1873} 1874.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::after { 1875 background: var(--%NS%mat-slide-toggle-selected-focus-track-color, var(--%NS%mat-sys-primary)); 1876} 1877.mdc-switch:enabled:active .mdc-switch__track::after { 1878 background: var(--%NS%mat-slide-toggle-selected-pressed-track-color, var(--%NS%mat-sys-primary)); 1879} 1880.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:hover:not(:focus):not(:active) .mdc-switch__track::after, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:focus:not(:active) .mdc-switch__track::after, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:active .mdc-switch__track::after, .mdc-switch.mdc-switch--disabled .mdc-switch__track::after { 1881 background: var(--%NS%mat-slide-toggle-disabled-selected-track-color, var(--%NS%mat-sys-on-surface)); 1882} 1883 1884.mdc-switch__handle-track { 1885 height: 100%; 1886 pointer-events: none; 1887 position: absolute; 1888 top: 0; 1889 transition: transform 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1); 1890 left: 0; 1891 right: auto; 1892 transform: translateX(0); 1893 width: calc(100% - var(--%NS%mat-slide-toggle-handle-width)); 1894} 1895[dir=rtl] .mdc-switch__handle-track { 1896 left: auto; 1897 right: 0; 1898} 1899.mdc-switch--selected .mdc-switch__handle-track { 1900 transform: translateX(100%); 1901} 1902[dir=rtl] .mdc-switch--selected .mdc-switch__handle-track { 1903 transform: translateX(-100%); 1904} 1905 1906.mdc-switch__handle { 1907 display: flex; 1908 pointer-events: auto; 1909 position: absolute; 1910 top: 50%; 1911 transform: translateY(-50%); 1912 left: 0; 1913 right: auto; 1914 transition: width 75ms cubic-bezier(0.4, 0, 0.2, 1), height 75ms cubic-bezier(0.4, 0, 0.2, 1), margin 75ms cubic-bezier(0.4, 0, 0.2, 1); 1915 width: var(--%NS%mat-slide-toggle-handle-width); 1916 height: var(--%NS%mat-slide-toggle-handle-height); 1917 border-radius: var(--%NS%mat-slide-toggle-handle-shape, var(--%NS%mat-sys-corner-full)); 1918} 1919[dir=rtl] .mdc-switch__handle { 1920 left: auto; 1921 right: 0; 1922} 1923.mat-mdc-slide-toggle .mdc-switch--unselected .mdc-switch__handle { 1924 width: var(--%NS%mat-slide-toggle-unselected-handle-size, 16px); 1925 height: var(--%NS%mat-slide-toggle-unselected-handle-size, 16px); 1926 margin: var(--%NS%mat-slide-toggle-unselected-handle-horizontal-margin, 0 8px); 1927} 1928.mat-mdc-slide-toggle .mdc-switch--unselected .mdc-switch__handle:has(.mdc-switch__icons) { 1929 margin: var(--%NS%mat-slide-toggle-unselected-with-icon-handle-horizontal-margin, 0 4px); 1930} 1931.mat-mdc-slide-toggle .mdc-switch--selected .mdc-switch__handle { 1932 width: var(--%NS%mat-slide-toggle-selected-handle-size, 24px); 1933 height: var(--%NS%mat-slide-toggle-selected-handle-size, 24px); 1934 margin: var(--%NS%mat-slide-toggle-selected-handle-horizontal-margin, 0 24px); 1935} 1936.mat-mdc-slide-toggle .mdc-switch--selected .mdc-switch__handle:has(.mdc-switch__icons) { 1937 margin: var(--%NS%mat-slide-toggle-selected-with-icon-handle-horizontal-margin, 0 24px); 1938} 1939.mat-mdc-slide-toggle .mdc-switch__handle:has(.mdc-switch__icons) { 1940 width: var(--%NS%mat-slide-toggle-with-icon-handle-size, 24px); 1941 height: var(--%NS%mat-slide-toggle-with-icon-handle-size, 24px); 1942} 1943.mat-mdc-slide-toggle .mdc-switch:active:not(.mdc-switch--disabled) .mdc-switch__handle { 1944 width: var(--%NS%mat-slide-toggle-pressed-handle-size, 28px); 1945 height: var(--%NS%mat-slide-toggle-pressed-handle-size, 28px); 1946} 1947.mat-mdc-slide-toggle .mdc-switch--%NS%selected:active:not(.mdc-switch--disabled) .mdc-switch__handle { 1948 margin: var(--%NS%mat-slide-toggle-selected-pressed-handle-horizontal-margin, 0 22px); 1949} 1950.mat-mdc-slide-toggle .mdc-switch--%NS%unselected:active:not(.mdc-switch--disabled) .mdc-switch__handle { 1951 margin: var(--%NS%mat-slide-toggle-unselected-pressed-handle-horizontal-margin, 0 2px); 1952} 1953.mdc-switch--disabled.mdc-switch--selected .mdc-switch__handle::after { 1954 opacity: var(--%NS%mat-slide-toggle-disabled-selected-handle-opacity, 1); 1955} 1956.mdc-switch--disabled.mdc-switch--unselected .mdc-switch__handle::after { 1957 opacity: var(--%NS%mat-slide-toggle-disabled-unselected-handle-opacity, 0.38); 1958} 1959.mdc-switch__handle::before, .mdc-switch__handle::after { 1960 border: 1px solid transparent; 1961 border-radius: inherit; 1962 box-sizing: border-box; 1963 content: ""; 1964 width: 100%; 1965 height: 100%; 1966 left: 0; 1967 position: absolute; 1968 top: 0; 1969 transition: background-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1), border-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1); 1970 z-index: -1; 1971} 1972@media (forced-colors: active) { 1973 .mdc-switch__handle::before, .mdc-switch__handle::after { 1974 border-color: currentColor; 1975 } 1976} 1977.mdc-switch--%NS%selected:enabled .mdc-switch__handle::after { 1978 background: var(--%NS%mat-slide-toggle-selected-handle-color, var(--%NS%mat-sys-on-primary)); 1979}
1980.mdc-switch--%NS%selected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after { 1981 background: var(--%NS%mat-slide-toggle-selected-hover-handle-color, var(--%NS%mat-sys-primary-container)); 1982} 1983.mdc-switch--%NS%selected:enabled:focus:not(:active) .mdc-switch__handle::after { 1984 background: var(--%NS%mat-slide-toggle-selected-focus-handle-color, var(--%NS%mat-sys-primary-container)); 1985} 1986.mdc-switch--%NS%selected:enabled:active .mdc-switch__handle::after { 1987 background: var(--%NS%mat-slide-toggle-selected-pressed-handle-color, var(--%NS%mat-sys-primary-container)); 1988} 1989.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled.mdc-switch--%NS%selected:hover:not(:focus):not(:active) .mdc-switch__handle::after, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled.mdc-switch--%NS%selected:focus:not(:active) .mdc-switch__handle::after, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--disabled.mdc-switch--%NS%selected:active .mdc-switch__handle::after, .mdc-switch--selected.mdc-switch--disabled .mdc-switch__handle::after { 1990 background: var(--%NS%mat-slide-toggle-disabled-selected-handle-color, var(--%NS%mat-sys-surface)); 1991} 1992.mdc-switch--%NS%unselected:enabled .mdc-switch__handle::after { 1993 background: var(--%NS%mat-slide-toggle-unselected-handle-color, var(--%NS%mat-sys-outline)); 1994} 1995.mdc-switch--%NS%unselected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after { 1996 background: var(--%NS%mat-slide-toggle-unselected-hover-handle-color, var(--%NS%mat-sys-on-surface-variant)); 1997} 1998.mdc-switch--%NS%unselected:enabled:focus:not(:active) .mdc-switch__handle::after { 1999 background: var(--%NS%mat-slide-toggle-unselected-focus-handle-color, var(--%NS%mat-sys-on-surface-variant)); 2000} 2001.mdc-switch--%NS%unselected:enabled:active .mdc-switch__handle::after { 2002 background: var(--%NS%mat-slide-toggle-unselected-pressed-handle-color, var(--%NS%mat-sys-on-surface-variant)); 2003} 2004.mdc-switch--unselected.mdc-switch--disabled .mdc-switch__handle::after { 2005 background: var(--%NS%mat-slide-toggle-disabled-unselected-handle-color, var(--%NS%mat-sys-on-surface)); 2006} 2007.mdc-switch__handle::before { 2008 background: var(--%NS%mat-slide-toggle-handle-surface-color); 2009} 2010 2011.mdc-switch__shadow { 2012 border-radius: inherit; 2013 bottom: 0; 2014 left: 0; 2015 position: absolute; 2016 right: 0; 2017 top: 0; 2018} 2019.mdc-switch:enabled .mdc-switch__shadow { 2020 box-shadow: var(--%NS%mat-slide-toggle-handle-elevation-shadow); 2021} 2022.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:hover:not(:focus):not(:active) .mdc-switch__shadow, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:focus:not(:active) .mdc-switch__shadow, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:active .mdc-switch__shadow, .mdc-switch.mdc-switch--disabled .mdc-switch__shadow { 2023 box-shadow: var(--%NS%mat-slide-toggle-disabled-handle-elevation-shadow); 2024} 2025 2026.mdc-switch__ripple { 2027 left: 50%; 2028 position: absolute; 2029 top: 50%; 2030 transform: translate(-50%, -50%); 2031 z-index: -1; 2032 width: var(--%NS%mat-slide-toggle-state-layer-size, 40px); 2033 height: var(--%NS%mat-slide-toggle-state-layer-size, 40px); 2034} 2035.mdc-switch__ripple::after { 2036 content: ""; 2037 opacity: 0; 2038} 2039.mdc-switch--disabled .mdc-switch__ripple::after { 2040 display: none; 2041} 2042.mat-mdc-slide-toggle-disabled-interactive .mdc-switch__ripple::after { 2043 display: block; 2044} 2045.mdc-switch:hover .mdc-switch__ripple::after { 2046 transition: 75ms opacity cubic-bezier(0, 0, 0.2, 1); 2047} 2048.mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:enabled:focus .mdc-switch__ripple::after, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:enabled:active .mdc-switch__ripple::after, .mat-mdc-slide-toggle-disabled-interactive.mdc-switch--%NS%disabled:enabled:hover:not(:focus) .mdc-switch__ripple::after, .mdc-switch--%NS%unselected:enabled:hover:not(:focus) .mdc-switch__ripple::after { 2049 background: var(--%NS%mat-slide-toggle-unselected-hover-state-layer-color, var(--%NS%mat-sys-on-surface)); 2050 opacity: var(--%NS%mat-slide-toggle-unselected-hover-state-layer-opacity, var(--%NS%mat-sys-hover-state-layer-opacity)); 2051} 2052.mdc-switch--%NS%unselected:enabled:focus .mdc-switch__ripple::after { 2053 background: var(--%NS%mat-slide-toggle-unselected-focus-state-layer-color, var(--%NS%mat-sys-on-surface)); 2054 opacity: var(--%NS%mat-slide-toggle-unselected-focus-state-layer-opacity, var(--%NS%mat-sys-focus-state-layer-opacity)); 2055} 2056.mdc-switch--%NS%unselected:enabled:active .mdc-switch__ripple::after { 2057 background: var(--%NS%mat-slide-toggle-unselected-pressed-state-layer-color, var(--%NS%mat-sys-on-surface)); 2058 opacity: var(--%NS%mat-slide-toggle-unselected-pressed-state-layer-opacity, var(--%NS%mat-sys-pressed-state-layer-opacity)); 2059 transition: opacity 75ms linear; 2060} 2061.mdc-switch--%NS%selected:enabled:hover:not(:focus) .mdc-switch__ripple::after { 2062 background: var(--%NS%mat-slide-toggle-selected-hover-state-layer-color, var(--%NS%mat-sys-primary)); 2063 opacity: var(--%NS%mat-slide-toggle-selected-hover-state-layer-opacity, var(--%NS%mat-sys-hover-state-layer-opacity)); 2064} 2065.mdc-switch--%NS%selected:enabled:focus .mdc-switch__ripple::after { 2066 background: var(--%NS%mat-slide-toggle-selected-focus-state-layer-color, var(--%NS%mat-sys-primary)); 2067 opacity: var(--%NS%mat-slide-toggle-selected-focus-state-layer-opacity, var(--%NS%mat-sys-focus-state-layer-opacity)); 2068} 2069.mdc-switch--%NS%selected:enabled:active .mdc-switch__ripple::after { 2070 background: var(--%NS%mat-slide-toggle-selected-pressed-state-layer-color, var(--%NS%mat-sys-primary)); 2071 opacity: var(--%NS%mat-slide-toggle-selected-pressed-state-layer-opacity, var(--%NS%mat-sys-pressed-state-layer-opacity)); 2072 transition: opacity 75ms linear; 2073} 2074 2075.mdc-switch__icons { 2076 position: relative; 2077 height: 100%; 2078 width: 100%; 2079 z-index: 1; 2080 transform: translateZ(0); 2081} 2082.mdc-switch--disabled.mdc-switch--unselected .mdc-switch__icons { 2083 opacity: var(--%NS%mat-slide-toggle-disabled-unselected-icon-opacity, 0.38); 2084} 2085.mdc-switch--disabled.mdc-switch--selected .mdc-switch__icons { 2086 opacity: var(--%NS%mat-slide-toggle-disabled-selected-icon-opacity, 0.38); 2087} 2088 2089.mdc-switch__icon { 2090 bottom: 0; 2091 left: 0; 2092 margin: auto; 2093 position: absolute; 2094 right: 0; 2095 top: 0; 2096 opacity: 0; 2097 transition: opacity 30ms 0ms cubic-bezier(0.4, 0, 1, 1); 2098} 2099.mdc-switch--unselected .mdc-switch__icon { 2100 width: var(--%NS%mat-slide-toggle-unselected-icon-size, 16px); 2101 height: var(--%NS%mat-slide-toggle-unselected-icon-size, 16px); 2102 fill: var(--%NS%mat-slide-toggle-unselected-icon-color, var(--%NS%mat-sys-surface-variant)); 2103} 2104.mdc-switch--unselected.mdc-switch--disabled .mdc-switch__icon { 2105 fill: var(--%NS%mat-slide-toggle-disabled-unselected-icon-color, var(--%NS%mat-sys-surface-variant)); 2106} 2107.mdc-switch--selected .mdc-switch__icon { 2108 width: var(--%NS%mat-slide-toggle-selected-icon-size, 16px); 2109 height: var(--%NS%mat-slide-toggle-selected-icon-size, 16px); 2110 fill: var(--%NS%mat-slide-toggle-selected-icon-color, var(--%NS%mat-sys-on-primary-container)); 2111} 2112.mdc-switch--selected.mdc-switch--disabled .mdc-switch__icon { 2113 fill: var(--%NS%mat-slide-toggle-disabled-selected-icon-color, var(--%NS%mat-sys-on-surface)); 2114} 2115 2116.mdc-switch--selected .mdc-switch__icon--on, 2117.mdc-switch--unselected .mdc-switch__icon--off { 2118 opacity: 1; 2119 transition: opacity 45ms 30ms cubic-bezier(0, 0, 0.2, 1); 2120} 2121 2122.mat-mdc-slide-toggle { 2123 -webkit-user-select: none; 2124 user-select: none; 2125 display: inline-block; 2126 -webkit-tap-highlight-color: transparent; 2127 outline: 0; 2128} 2129.mat-mdc-slide-toggle .mat-icon { 2130 min-height: fit-content; 2131 flex-shrink: 0; 2132} 2133.mat-mdc-slide-toggle .mat-mdc-slide-toggle-ripple, 2134.mat-mdc-slide-toggle .mdc-switch__ripple::after { 2135 top: 0; 2136 left: 0; 2137 right: 0; 2138 bottom: 0; 2139 position: absolute; 2140 border-radius: 50%; 2141 pointer-events: none; 2142} 2143.mat-mdc-slide-toggle .mat-mdc-slide-toggle-ripple:not(:empty), 2144.mat-mdc-slide-toggle .mdc-switch__ripple::after:not(:empty) { 2145 transform: translateZ(0); 2146} 2147.mat-mdc-slide-toggle.mat-mdc-slide-toggle-focused .mat-focus-indicator::before { 2148 content: ""; 2149} 2150.mat-mdc-slide-toggle .mat-internal-form-field { 2151 color: var(--%NS%mat-slide-toggle-label-text-color, var(--%NS%mat-sys-on-surface)); 2152 font-family: var(--%NS%mat-slide-toggle-label-text-font, var(--%NS%mat-sys-body-medium-font)); 2153 line-height: var(--%NS%mat-slide-toggle-label-text-line-height, var(--%NS%mat-sys-body-medium-line-height)); 2154 font-size: var(--%NS%mat-slide-toggle-label-text-size, var(--%NS%mat-sys-body-medium-size)); 2155 letter-spacing: var(--%NS%mat-slide-toggle-label-text-tracking, var(--%NS%mat-sys-body-medium-tracking)); 2156 font-weight: var(--%NS%mat-slide-toggle-label-text-weight, var(--%NS%mat-sys-body-medium-weight)); 2157} 2158.mat-mdc-slide-toggle .mat-ripple-element { 2159 opacity: 0.12; 2160} 2161.mat-mdc-slide-toggle .mat-focus-indicator::before { 2162 border-radius: 50%; 2163} 2164.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__handle-track, 2165.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__icon, 2166.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__handle::before, 2167.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__handle::after, 2168.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__track::before, 2169.mat-mdc-slide-toggle._mat-animation-noopable .mdc-switch__track::after { 2170 transition: none; 2171} 2172.mat-mdc-slide-toggle .mdc-switch:enabled + .mdc-label { 2173 cursor: pointer; 2174} 2175.mat-mdc-slide-toggle .mdc-switch--disabled + label { 2176 color: var(--%NS%mat-slide-toggle-disabled-label-text-color, var(--%NS%mat-sys-on-surface)); 2177} 2178.mat-mdc-slide-toggle label:empty { 2179 display: none; 2180} 2181 2182.mat-slide-toggle-full-width { 2183 width: 100%; 2184} 2185.mat-slide-toggle-full-width .mat-internal-form-field { 2186 width: 100%; 2187 justify-content: space-between; 2188} 2189.mat-slide-toggle-full-width .mat-internal-form-field label { 2190 margin: 0; 2191 flex-grow: 1; 2192 text-align: end; 2193}
2194.mat-slide-toggle-full-width .mdc-form-field--align-end label { 2195 text-align: start; 2196} 2197 2198.mat-mdc-slide-toggle-touch-target { 2199 position: absolute; 2200 top: 50%; 2201 left: 50%; 2202 height: var(--%NS%mat-slide-toggle-touch-target-size, 48px); 2203 width: 100%; 2204 transform: translate(-50%, -50%); 2205 display: var(--%NS%mat-slide-toggle-touch-target-display, block); 2206} 2207[dir=rtl] .mat-mdc-slide-toggle-touch-target { 2208 left: auto; 2209 right: 50%; 2210 transform: translate(50%, -50%); 2211} 2212`],encapsulation:2})}return i})();var we$3=(()=>{class i{static ɵfac=function(a){return new(a||i)};static ɵmod=FD({type:i});static ɵinj=ju$1({imports:[te$2,xn$4]})}return i})();var O$2=[`determinateSpinner`];function I$3(i,V){if(i&1&&(Dd$1(),Bi$3(0,`svg`,11),Rh$3(1,`circle`,12),vl$4()),i&2){let e=xw();xh$2(`viewBox`,e._viewBox()),sE(),Zh$2(`stroke-dasharray`,e._strokeCircumference(),`px`)(`stroke-dashoffset`,e._strokeCircumference()/2,`px`)(`stroke-width`,e._circleStrokeWidth(),`%`),xh$2(`r`,e._circleRadius())}}var z$3=new N$2(`mat-progress-spinner-default-options`,{providedIn:`root`,factory:()=>({diameter:B$1})});var B$1=100;var D$4=10;var Z$2=(()=>{class i{_elementRef=E(Lr$5);_noopAnimations;get color(){return this._color||this._defaultColor}set color(e){this._color=e}_color;_defaultColor=`primary`;_determinateCircle;constructor(){let e=E(z$3),n=Dc$4(),r=this._elementRef.nativeElement;this._noopAnimations=n===`di-disabled`&&!!e&&!e._forceAnimations,this.mode=r.nodeName.toLowerCase()===`mat-spinner`?`indeterminate`:`determinate`,!this._noopAnimations&&n===`reduced-motion`&&r.classList.add(`mat-progress-spinner-reduced-motion`),e&&(e.color&&(this.color=this._defaultColor=e.color),e.diameter&&(this.diameter=e.diameter),e.strokeWidth&&(this.strokeWidth=e.strokeWidth))}mode;get value(){return this.mode===`determinate`?this._value:0}set value(e){this._value=Math.max(0,Math.min(100,e||0))}_value=0;get diameter(){return this._diameter}set diameter(e){this._diameter=e||0}_diameter=B$1;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(e){this._strokeWidth=e||0}_strokeWidth;_circleRadius(){return(this.diameter-D$4)/2}_viewBox(){let e=this._circleRadius()*2+this.strokeWidth;return`0 0 ${e} ${e}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode===`determinate`?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static ɵfac=function(n){return new(n||i)};static ɵcmp=PD({type:i,selectors:[[`mat-progress-spinner`],[`mat-spinner`]],viewQuery:function(n,r){if(n&1&&$h$2(O$2,5),n&2){let s;Pw(s=Lw())&&(r._determinateCircle=s.first)}},hostAttrs:[`role`,`progressbar`,`tabindex`,`-1`,1,`mat-mdc-progress-spinner`,`mdc-circular-progress`],hostVars:18,hostBindings:function(n,r){n&2&&(xh$2(`aria-valuemin`,0)(`aria-valuemax`,100)(`aria-valuenow`,r.mode===`determinate`?r.value:null)(`mode`,r.mode),Xw(`mat-`+r.color),Zh$2(`width`,r.diameter,`px`)(`height`,r.diameter,`px`)(`--%NS%mat-progress-spinner-size`,r.diameter+`px`)(`--%NS%mat-progress-spinner-active-indicator-width`,r.diameter+`px`),Yh$3(`_mat-animation-noopable`,r._noopAnimations)(`mdc-circular-progress--indeterminate`,r.mode===`indeterminate`))},inputs:{color:`color`,mode:`mode`,value:[2,`value`,`value`,oj],diameter:[2,`diameter`,`diameter`,oj],strokeWidth:[2,`strokeWidth`,`strokeWidth`,oj]},exportAs:[`matProgressSpinner`],decls:14,vars:11,consts:[[`circle`,``],[`determinateSpinner`,``],[`aria-hidden`,`true`,1,`mdc-circular-progress__determinate-container`],[`xmlns`,`http://www.w3.org/2000/svg`,`focusable`,`false`,1,`mdc-circular-progress__determinate-circle-graphic`],[`cx`,`50%`,`cy`,`50%`,1,`mdc-circular-progress__determinate-circle`],[`aria-hidden`,`true`,1,`mdc-circular-progress__indeterminate-container`],[1,`mdc-circular-progress__spinner-layer`],[1,`mdc-circular-progress__circle-clipper`,`mdc-circular-progress__circle-left`],[3,`ngTemplateOutlet`],[1,`mdc-circular-progress__gap-patch`],[1,`mdc-circular-progress__circle-clipper`,`mdc-circular-progress__circle-right`],[`xmlns`,`http://www.w3.org/2000/svg`,`focusable`,`false`,1,`mdc-circular-progress__indeterminate-circle-graphic`],[`cx`,`50%`,`cy`,`50%`]],template:function(n,r){if(n&1&&(Th$2(0,I$3,2,8,`ng-template`,null,0,jC),Bi$3(2,`div`,2,1),Dd$1(),Bi$3(4,`svg`,3),Rh$3(5,`circle`,4),vl$4()(),wd$1(),Bi$3(6,`div`,5)(7,`div`,6)(8,`div`,7),Ph$3(9,8),vl$4(),Bi$3(10,`div`,9),Ph$3(11,8),vl$4(),Bi$3(12,`div`,10),Ph$3(13,8),vl$4()()()),n&2){let s=jw(1);sE(4),xh$2(`viewBox`,r._viewBox()),sE(),Zh$2(`stroke-dasharray`,r._strokeCircumference(),`px`)(`stroke-dashoffset`,r._strokeDashOffset(),`px`)(`stroke-width`,r._circleStrokeWidth(),`%`),xh$2(`r`,r._circleRadius()),sE(4),Ah$2(`ngTemplateOutlet`,s),sE(2),Ah$2(`ngTemplateOutlet`,s),sE(2),Ah$2(`ngTemplateOutlet`,s)}},dependencies:[Za$2],styles:[`.mat-mdc-progress-spinner { 2213 --%NS%mat-progress-spinner-animation-multiplier: 1; 2214 display: block; 2215 overflow: hidden; 2216 line-height: 0; 2217 position: relative; 2218 direction: ltr; 2219 transition: opacity 250ms cubic-bezier(0.4, 0, 0.6, 1); 2220} 2221.mat-mdc-progress-spinner circle { 2222 stroke-width: var(--%NS%mat-progress-spinner-active-indicator-width, 4px); 2223} 2224.mat-mdc-progress-spinner._mat-animation-noopable, .mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle { 2225 transition: none !important; 2226} 2227.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic, 2228.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer, 2229.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container { 2230 animation: none !important; 2231} 2232.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle { 2233 stroke-dasharray: 0 !important; 2234} 2235@media (forced-colors: active) { 2236 .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic, 2237 .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle { 2238 stroke: currentColor; 2239 stroke: CanvasText; 2240 } 2241} 2242 2243.mat-progress-spinner-reduced-motion { 2244 --%NS%mat-progress-spinner-animation-multiplier: 1.25; 2245} 2246 2247.mdc-circular-progress__determinate-container, 2248.mdc-circular-progress__indeterminate-circle-graphic, 2249.mdc-circular-progress__indeterminate-container, 2250.mdc-circular-progress__spinner-layer { 2251 position: absolute; 2252 width: 100%; 2253 height: 100%; 2254} 2255 2256.mdc-circular-progress__determinate-container { 2257 transform: rotate(-90deg); 2258} 2259.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container { 2260 opacity: 0; 2261} 2262 2263.mdc-circular-progress__indeterminate-container { 2264 font-size: 0; 2265 letter-spacing: 0; 2266 white-space: nowrap; 2267 opacity: 0; 2268} 2269.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container { 2270 opacity: 1; 2271 animation: mdc-circular-progress-container-rotate calc(1568.2352941176ms * var(--%NS%mat-progress-spinner-animation-multiplier)) linear infinite; 2272} 2273 2274.mdc-circular-progress__determinate-circle-graphic, 2275.mdc-circular-progress__indeterminate-circle-graphic { 2276 fill: transparent; 2277} 2278 2279.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle, 2280.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic { 2281 stroke: var(--%NS%mat-progress-spinner-active-indicator-color, var(--%NS%mat-sys-primary)); 2282} 2283@media (forced-colors: active) { 2284 .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle, 2285 .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic { 2286 stroke: CanvasText; 2287 } 2288} 2289 2290.mdc-circular-progress__determinate-circle { 2291 transition: stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1); 2292} 2293 2294.mdc-circular-progress__gap-patch { 2295 position: absolute; 2296 top: 0; 2297 left: 47.5%; 2298 box-sizing: border-box; 2299 width: 5%; 2300 height: 100%; 2301 overflow: hidden; 2302} 2303 2304.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic { 2305 left: -900%; 2306 width: 2000%; 2307 transform: rotate(180deg); 2308} 2309.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic { 2310 width: 200%; 2311} 2312.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic { 2313 left: -100%; 2314} 2315.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic { 2316 animation: mdc-circular-progress-left-spin calc(1333ms * var(--%NS%mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both; 2317} 2318.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic { 2319 animation: mdc-circular-progress-right-spin calc(1333ms * var(--%NS%mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both; 2320} 2321 2322.mdc-circular-progress__circle-clipper { 2323 display: inline-flex; 2324 position: relative; 2325 width: 50%; 2326 height: 100%; 2327 overflow: hidden; 2328} 2329 2330.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer { 2331 animation: mdc-circular-progress-spinner-layer-rotate calc(5332ms * var(--%NS%mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both; 2332} 2333 2334@keyframes mdc-circular-progress-container-rotate { 2335 to { 2336 transform: rotate(360deg); 2337 } 2338} 2339@keyframes mdc-circular-progress-spinner-layer-rotate { 2340 12.5% { 2341 transform: rotate(135deg); 2342 } 2343 25% { 2344 transform: rotate(270deg); 2345 } 2346 37.5% { 2347 transform: rotate(405deg); 2348 } 2349 50% { 2350 transform: rotate(540deg); 2351 } 2352 62.5% { 2353 transform: rotate(675deg); 2354 } 2355 75% { 2356 transform: rotate(810deg); 2357 } 2358 87.5% { 2359 transform: rotate(945deg); 2360 } 2361 100% { 2362 transform: rotate(1080deg); 2363 } 2364} 2365@keyframes mdc-circular-progress-left-spin { 2366 from { 2367 transform: rotate(265deg); 2368 } 2369 50% { 2370 transform: rotate(130deg); 2371 } 2372 to { 2373 transform: rotate(265deg); 2374 } 2375} 2376@keyframes mdc-circular-progress-right-spin { 2377 from { 2378 transform: rotate(-265deg); 2379 } 2380 50% { 2381 transform: rotate(-130deg); 2382 } 2383 to { 2384 transform: rotate(-265deg); 2385 } 2386} 2387`],encapsulation:2})}return i})();var J$1=(()=>
2387{class i{static ɵfac=function(n){return new(n||i)};static ɵmod=FD({type:i});static ɵinj=ju$1({imports:[xn$4]})}return i})();var ie$3=class n{isPanelOpen=ni$3(!1);notifications=ni$3([]);unreadCount=$C(()=>this.notifications().filter(t=>!t.seen).length);add(t){let e=crypto.randomUUID();return this.notifications.update(r=>[{id:e,message:t,seen:!1,createdAt:new Date},...r]),e}update(t,e){this.notifications.update(r=>r.map(s=>s.id===t?W$4(q$1({},s),{message:e,seen:!1}):s))}openPanel(){this.isPanelOpen.set(!0)}closePanel(){this.isPanelOpen.set(!1)}togglePanel(){this.isPanelOpen.update(t=>!t)}markAllSeen(){this.notifications.update(t=>t.map(e=>W$4(q$1({},e),{seen:!0})))}markSeen(t){this.notifications.update(e=>e.map(r=>r.id===t?W$4(q$1({},r),{seen:!0}):r))}delete(t){this.notifications.update(e=>e.filter(r=>r.id!==t))}deleteAll(){this.notifications.set([])}static ɵfac=function(e){return new(e||n)};static ɵprov=ue$3({token:n,factory:n.ɵfac,providedIn:`root`})};function dt$5(n){if(n.domain===`strength`)return`strength`;if(n.domain===`endurance`)return`endurance`;let t=n.title?.trim()??``;return/^V\d+-/i.test(t)?`strength`:/^E\d+-/i.test(t)?`endurance`:`other`}function $t$3(n,t){let e=n.title?.trim();if(!e)return t.instant(`trainingProgram.untitledProgram`);let r=dt$5(n);return r===`strength`?t.instant(`trainingProgram.displayName.strengthProgram`):r===`endurance`?t.instant(`trainingProgram.displayName.enduranceProgram`):e}var ae$4=mT(ce$5());var gt$4=(n,t)=>t.email;function ft$6(n,t){if(n&1){let e=Cw();Bi$3(0,`app-icon-button`,6),OC(1,`translate`),jh$3(`click`,function(){ld$2(e);return ud$1(xw().dismissToBackground())}),vl$4()}n&2&&Ah$2(`matTooltip`,LC(1,1,`addClientResult.moveToBackground`))}function Ct$3(n,t){if(n&1){let e=Cw();Bi$3(0,`app-dialog-close-button`,7),jh$3(`closed`,function(){ld$2(e);return ud$1(xw().close())}),vl$4()}}function _t$6(n,t){if(n&1&&(Bi$3(0,`div`,4),Rh$3(1,`mat-spinner`,8),Bi$3(2,`p`,9),lC(3),OC(4,`translate`),vl$4()()),n&2){let e=xw();sE(3),ig(LC(4,1,e.data.addingKey||`addClientResult.adding`))}}function ht$5(n,t){if(n&1&&(Bi$3(0,`div`,11)(1,`mat-icon`),lC(2,`check_circle`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()),n&2){let e=xw(2);sE(4),sg(``,e.succeeded.length,` `,LC(5,2,`addClientResult.succeeded`))}}function vt$5(n,t){if(n&1&&(Bi$3(0,`div`,12)(1,`mat-icon`),lC(2,`error`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()),n&2){let e=xw(2);sE(4),sg(``,e.failed.length,` `,LC(5,2,`addClientResult.failed`))}}function bt$6(n,t){if(n&1&&(Bi$3(0,`span`,22),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw().$implicit;sE(),ig(LC(2,1,e.error))}}function xt$3(n,t){if(n&1&&(Bi$3(0,`li`,20)(1,`span`,21),lC(2),vl$4(),fw(3,bt$6,3,3,`span`,22),vl$4()),n&2){let e=t.$implicit;sE(2),ig(e.email),sE(),pw(e.error?3:-1)}}function yt$5(n,t){if(n&1&&(Bi$3(0,`div`,13)(1,`p`,18),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`ul`,19),mw(5,xt$3,4,2,`li`,20,gt$4),vl$4()()),n&2){let e=xw(2);sE(2),ig(LC(3,1,`addClientResult.failedDetails`)),sE(3),yw(e.failed)}}function Mt$5(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,23),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw(2).retryFailed())}),Bi$3(1,`mat-icon`),lC(2,`refresh`),vl$4(),lC(3),OC(4,`translate`),vl$4()}n&2&&(sE(3),Cl$4(` `,LC(4,1,`addClientResult.retryFailed`),` `))}function Et$4(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,5)(1,`div`,10),fw(2,ht$5,6,4,`div`,11),fw(3,vt$5,6,4,`div`,12),vl$4(),fw(4,yt$5,7,3,`div`,13),Bi$3(5,`div`,14),fw(6,Mt$5,5,3,`button`,15),Bi$3(7,`button`,16),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().addAnother())}),Bi$3(8,`mat-icon`),lC(9,`person_add`),vl$4(),lC(10),OC(11,`translate`),vl$4(),Bi$3(12,`button`,17),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().close())}),Bi$3(13,`mat-icon`),lC(14,`check`),vl$4(),lC(15),OC(16,`translate`),vl$4()()()}if(n&2){let e=xw();sE(2),pw(e.succeeded.length>0?2:-1),sE(),pw(e.failed.length>0?3:-1),sE(),pw(e.failed.length>0?4:-1),sE(2),pw(e.failed.length>0?6:-1),sE(4),Cl$4(` `,LC(11,6,`addClientResult.addAnother`),` `),sE(5),Cl$4(` `,LC(16,8,`common.ok`),` `)}}var oe$2=class n{dialogRef=E(f$3);notifications=E(ie$3);translate=E(Gr$5);coachChecklistService=E(Je$2);data=E(de$3);loading=ni$3(!0);results=ni$3([]);get succeeded(){return this.results().filter(t=>t.success)}get failed(){return this.results().filter(t=>!t.success)}ngOnInit(){this.data.results$.then(t=>{this.results.set(t),this.loading.set(!1),t.some(e=>e.success)&&this.coachChecklistService.markTaskComplete(`add_client`)})}
2387dismissToBackground(){let t=this.data.notifKeys?.adding??`addClientResult.notif.adding`,e=this.data.notifKeys?.allSucceeded??`addClientResult.notif.allSucceeded`,r=this.data.notifKeys?.result??`addClientResult.notif.result`,s=this.translate.instant(t),g=this.notifications.add(s);this.dialogRef.close(),this.data.results$.then(R=>{let B=R.filter(w=>w.success).length,V=R.filter(w=>!w.success).length,F=V>0?this.translate.instant(r,{succeeded:B,failed:V}):this.translate.instant(e,{count:B});this.notifications.update(g,F)})}retryFailed(){let t=this.failed.map(e=>e.email);this.dialogRef.close(),this.data.onRetry(t)}addAnother(){this.dialogRef.close(),this.data.onAddAnother()}close(){this.dialogRef.close()}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-add-client-result-dialog`]],decls:9,vars:6,consts:[[1,`dialog-container`],[1,`dialog-header`],[1,`dialog-title`],[`icon`,`close`,1,`close-button`,3,`matTooltip`],[1,`loading-state`],[1,`result-content`],[`icon`,`close`,1,`close-button`,3,`click`,`matTooltip`],[3,`closed`],[`diameter`,`48`],[1,`loading-text`],[1,`summary-row`],[1,`summary-chip`,`success`],[1,`summary-chip`,`error`],[1,`failed-section`],[1,`dialog-actions`],[`mat-stroked-button`,``,`type`,`button`,1,`retry-button`],[`mat-stroked-button`,``,`type`,`button`,1,`add-another-button`,3,`pointerup`],[`mat-flat-button`,``,`type`,`button`,1,`save-button`,3,`pointerup`],[1,`section-label`],[1,`failed-list`],[1,`failed-item`],[1,`failed-email`],[1,`failed-reason`],[`mat-stroked-button`,``,`type`,`button`,1,`retry-button`,3,`pointerup`]],template:function(e,r){e&1&&(Bi$3(0,`div`,0)(1,`div`,1)(2,`h2`,2),lC(3),OC(4,`translate`),vl$4(),fw(5,ft$6,2,3,`app-icon-button`,3)(6,Ct$3,1,0,`app-dialog-close-button`),vl$4(),fw(7,_t$6,5,3,`div`,4),fw(8,Et$4,17,10,`div`,5),vl$4()),e&2&&(sE(3),ig(LC(4,4,r.data.titleKey||`dashboard.addClient`)),sE(2),pw(r.loading()?5:6),sE(2),pw(r.loading()?7:-1),sE(),pw(r.loading()?-1:8))},dependencies:[Ap$1,wp$2,yt$7,wt$5,J$1,Z$2,I$6,Ct$5,b$3,X$4,Xp$1],styles:[`.dialog-container[_ngcontent-%COMP%]{border-radius:10px;padding:1.5rem;max-width:520px;margin:0 auto;min-width:360px}.dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem;border-bottom:1px solid var(--%NS%border-color);padding-bottom:1.5rem}.dialog-header[_ngcontent-%COMP%] .dialog-title[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500;margin:0}.dialog-header[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{position:absolute;top:1.5rem;right:1.5rem}.loading-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:1.25rem;padding:2rem 0}.loading-state[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{color:var(--%NS%text-color);opacity:.7;margin:0;font-size:.95rem}.result-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.summary-row[_ngcontent-%COMP%]{display:flex;gap:.75rem;flex-wrap:wrap}.summary-chip[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.4rem;padding:.4rem .85rem;border-radius:999px;font-size:.875rem;font-weight:500}.summary-chip[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}.summary-chip.success[_ngcontent-%COMP%]{background-color:color-mix(in srgb,var(--%NS%primaryGreen) 15%,transparent);color:var(--%NS%primaryGreen)}.summary-chip.error[_ngcontent-%COMP%]{background-color:color-mix(in srgb,var(--%NS%danger) 20%,transparent);color:var(--%NS%primaryRed)}.section-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--%NS%text-color);opacity:.8;margin:0 0 .5rem}.failed-section[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--%NS%danger) 10%,transparent);border:1px solid color-mix(in srgb,var(--%NS%danger) 40%,transparent);border-radius:8px;padding:.875rem 1rem}.failed-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.5rem}.failed-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.15rem}.failed-item[_ngcontent-%COMP%] .failed-email[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--%NS%text-color)}.failed-item[_ngcontent-%COMP%] .failed-reason[_ngcontent-%COMP%]{font-size:.8rem;color:var(--%NS%primaryRed);word-break:break-word}.dialog-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;justify-content:flex-end;flex-wrap:wrap;margin-top:.25rem}.dialog-actions[_ngcontent-%COMP%] .retry-button[_ngcontent-%COMP%]{color:var(--%NS%primaryRed);border-color:var(--%NS%primaryRed)}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]{background:var(--%NS%primary)}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]:hover:not(:disabled){opacity:.9}`]})};var it$2=n=>({role:n});var Pt$4=(n,t)=>t.id;function St$4(n,t){n&1&&Rh$3(0,`mat-spinner`,11)}function kt$4(n,t){n&1&&(Bi$3(0,`mat-icon`),lC(1,`add`),vl$4())}function wt$4(n,t){if(n&1&&(Bi$3(0,`span`,18),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw();
2387sE(),sg(`(`,e.invalidEmailCount,` `,LC(2,2,`validation.invalid`),`)`)}}function Ot$5(n,t){if(n&1&&(Bi$3(0,`mat-icon`,53),OC(1,`translate`),OC(2,`translate`),OC(3,`translate`),lC(4,` error `),vl$4()),n&2){let e=xw().$implicit,r=xw();Ah$2(`matTooltip`,e.hasError(`ownEmail`)?FC(2,3,`validation.ownEmail`,bC(8,it$2,LC(1,1,r.ownEmailRoleKey))):LC(3,6,`login.emailInvalid`))}}function At$3(n,t){if(n&1&&(Bi$3(0,`mat-error`,54),lC(1),OC(2,`translate`),OC(3,`translate`),vl$4()),n&2){let e=xw(2);sE(),ig(FC(3,3,`validation.ownEmail`,bC(6,it$2,LC(2,1,e.ownEmailRoleKey))))}}function Dt$4(n,t){if(n&1){let e=Cw();Bi$3(0,`app-icon-button`,56),jh$3(`pointerup`,function(){ld$2(e);let s=xw().$index;return ud$1(xw().removeEmailField(s))}),vl$4()}}function Tt$3(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,49)(1,`div`,50)(2,`mat-form-field`,51)(3,`input`,52),OC(4,`translate`),jh$3(`paste`,function(s){ld$2(e);return ud$1(xw().onEmailPaste(s))})(`input`,function(s){ld$2(e);return ud$1(xw().onEmailInput(s))}),vl$4(),WE(),vl$4(),fw(5,Ot$5,5,10,`mat-icon`,53),vl$4(),fw(6,At$3,4,8,`mat-error`,54),fw(7,Dt$4,1,0,`app-icon-button`,55),vl$4()}if(n&2){let e=t.$implicit,r=t.$index,s=xw();Yh$3(`has-error`,!s.isValidEmail(e.value)||e.hasError(`ownEmail`)),sE(3),Ah$2(`formControlName`,r)(`placeholder`,LC(4,7,`dashboard.clients.email.placeholder`)),zE(),sE(2),pw(!s.isValidEmail(e.value)||e.hasError(`ownEmail`)?5:-1),sE(),pw(e.hasError(`ownEmail`)?6:-1),sE(),pw(s.emailControls.length>1?7:-1)}}function Nt$4(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,57),jh$3(`click`,function(){ld$2(e);return ud$1(xw().toggleEmailsVisibility())}),Bi$3(1,`mat-icon`),lC(2),vl$4(),Bi$3(3,`span`),lC(4),vl$4()()}if(n&2){let e=xw();sE(2),ig(e.showAllEmails?`expand_less`:`expand_more`),sE(2),ig(e.showAllEmails?`Näytä vähemmän`:`Näytä lisää (`+(e.emailControls.length-1)+`)`)}}function It$4(n,t){if(n&1&&(Bi$3(0,`mat-option`,32),lC(1),vl$4()),n&2){let e=t.$implicit;Ah$2(`value`,e.id),sE(),Cl$4(` `,e.name,` `)}}function Rt$2(n,t){n&1&&(Bi$3(0,`div`,34)(1,`span`,15)(2,`mat-label`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`mat-form-field`,27),Rh$3(6,`input`,58),OC(7,`translate`),WE(),vl$4()(),Bi$3(8,`span`,15)(9,`mat-label`),lC(10),OC(11,`translate`),vl$4(),Bi$3(12,`mat-form-field`,27),Rh$3(13,`textarea`,59),OC(14,`translate`),WE(),vl$4()()()),n&2&&(sE(3),Cl$4(``,LC(4,4,`trainingGroup.groupName`),` *`),sE(3),Ah$2(`placeholder`,LC(7,6,`trainingGroup.groupNamePlaceholder`)),zE(),sE(4),ig(LC(11,8,`trainingGroup.description`)),sE(3),Ah$2(`placeholder`,LC(14,10,`trainingGroup.descriptionPlaceholder`)),zE())}function Bt$4(n,t){if(n&1&&(Bi$3(0,`mat-option`,32),lC(1),OC(2,`translate`),vl$4()),n&2){let e=t.$implicit;Ah$2(`value`,e.id),sE(),ag(` `,e.name,` · `,e.duration_weeks,` `,LC(2,4,`coachingTracks.weeks`),` `)}}function Vt$3(n,t){if(n&1&&(Bi$3(0,`span`,15)(1,`mat-label`),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`mat-form-field`,27),Rh$3(5,`input`,60),WE(),Rh$3(6,`mat-datepicker-toggle`,61)(7,`mat-datepicker`,null,2),vl$4()()),n&2){let e=jw(8);sE(2),ig(LC(3,3,`clientProfile.coachingTracks.startDateLabel`)),sE(3),Ah$2(`matDatepicker`,e),zE(),sE(),Ah$2(`for`,e)}}var nt$3=class n{clientService=E(E$2);dialog=E(pe$5);profileService=E(ie$4);coachChecklistService=E(Je$2);toast=E(ut$6);router=E(G$4);coachingTrackService=E(T$3);dialogRef=E(f$3);data=E(de$3);showAllEmails=!1;isCreatingNewGroup=ni$3(!1);mockClientLoading=ni$3(!1);get ownEmailRoleKey(){return`clientProfile.role.${this.profileService.profile()?.role??`coach`}`}form=new P({emails:new be$4([this.createEmailControl()]),subsEnd:new $$1((0,ae$4.default)().add(1,`year`).set(`hour`,12).toDate(),[ye$4.required]),group_id:new $$1(null),coaching_track_id:new $$1(null),coaching_track_start_date:new $$1((0,ae$4.default)().toDate()),draftWorkout:new $$1(!0),draftReport:new $$1(!0),adaptStrength:new $$1(!0),adaptEndurance:new $$1(!0),groupName:new $$1(``),groupDescription:new $$1(``)});trainingGroupOptions=$C(()=>{let t=this.clientService.trainingGroups(),e=new Map;return t.forEach(r=>{e.set(r.id,r)}),Array.from(e.values()).sort((r,s)=>r.name.localeCompare(s.name))});ngOnInit(){this.coachingTrackService.coachingTracks().length===0&&this.coachingTrackService.fetchCoachingTracks();let t=this.data?.initialEmails;if(t&&t.length>0){let e=this.form.get(`emails`);e.clear(),t.forEach(r=>{e.push(this.createEmailControl(r))}),t.length>1&&(this.showAllEmails=!0)}}get emailControls(){return this.form.get(`emails`).controls}get visibleEmailControls(){let t=this.emailControls;return this.showAllEmails?t:t.slice(0,1)}get hasHiddenEmails(){return this.emailControls.length>1}get validEmailCount(){return this.emailControls.filter(t=>t.value&&t.value.trim()!==``&&this.isValidEmail(t.value)).length}get invalidEmailCount(){return this.emailControls.filter(t=>t.value&&t.value.trim()!==``&&!this.isValidEmail(t.value)).length}toggleEmailsVisibility(){this.showAllEmails=!this.showAllEmails}onGroupSelectionChange(t){t===`CREATE_NEW`?(this.isCreatingNewGroup.set(!0),this.form.get(`groupName`)?.setValidators([ye$4.required]),this.form.get(`groupName`)?.updateValueAndValidity()):(this.isCreatingNewGroup.set(!1),this.form.get(`groupName`)?.clearValidators(),this.form.get(`groupName`)?.updateValueAndValidity())}addEmailField(){this.form.get(`emails`).push(this.createEmailControl()),this.showAllEmails=!0}onEmailInput(t){let e=t.target,r=e.value;
2387r&&!this.isValidEmail(r)?e.setCustomValidity(`Invalid email`):e.setCustomValidity(``)}isValidEmail(t){let e=ye$4.email;return e({value:t})===null}onEmailPaste(t){let e=this.form.get(`emails`),r=nt$6(t);e.removeAt(-1),r?.forEach(s=>{e.push(this.createEmailControl(s))}),r&&r.length>1&&(this.showAllEmails=!0)}removeEmailField(t){let e=this.form.get(`emails`);e.length>1&&e.removeAt(t)}createEmailControl(t=``){return new $$1(t,[ye$4.required,ye$4.email,this.notOwnEmailValidator()])}notOwnEmailValidator(){return t=>{let e=t.value?.trim()?.toLowerCase(),r=this.profileService.profile()?.email?.toLowerCase();return e&&r&&e===r?{ownEmail:!0}:null}}closeDialog(){this.dialogRef.close()}addMockClient(){return ps$4(this,null,function*(){if(!this.mockClientLoading()){this.mockClientLoading.set(!0);try{let t=yield this.clientService.createMockClient();this.coachChecklistService.markTaskComplete(`add_client`),this.toast.show(`dashboard.mockClient.created`,`success`,4e3,void 0,{name:`${t.firstName} ${t.lastName}`}),this.dialogRef.close(),this.router.navigate([`/clients/profile`,t.athleteId])}catch(t){uu$2.error(`Failed to create mock client:`,t)}finally{this.mockClientLoading.set(!1)}}})}onSubmit(){let t=this.form.get(`emails`),e=this.form.get(`subsEnd`)?.value;if(et$2(t),!t.valid||!e)return;let r=t.controls.map(O=>O.value?.trim()).filter(O=>O&&this.isValidEmail(O));if(r.length===0)return;let s=this.form.get(`group_id`)?.value,g=s===`CREATE_NEW`,R=g?void 0:s??void 0,B=this.form.get(`groupName`)?.value||void 0,V=this.form.get(`groupDescription`)?.value||void 0;if(g&&!this.form.get(`groupName`)?.value){uu$2.error(`Group name is required when creating a new group.`);return}let F=this.form.get(`coaching_track_id`)?.value??void 0,w=this.form.get(`coaching_track_start_date`)?.value,ot={expiration:e,role:`athlete`,group_id:R,group_name:g?B:void 0,group_description:g?V:void 0,coaching_track_id:F,coaching_track_start_date:F&&w?(0,ae$4.default)(w).format(`YYYY-MM-DD`):void 0,draft_workout:this.form.get(`draftWorkout`)?.value||!1,draft_report:this.form.get(`draftReport`)?.value||!1,adapt_strength:this.form.get(`adaptStrength`)?.value??!0,adapt_endurance:this.form.get(`adaptEndurance`)?.value??!0},at=this.clientService.addClients(q$1({emails:r},ot));this.dialogRef.close(),this.dialog.open(oe$2,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,maxWidth:`520px`,width:`520px`,minWidth:`auto`,disableClose:!0,data:{results$:at,onAddAnother:()=>this.openAddClientDialog(),onRetry:O=>this.openAddClientDialog(O)}})}openAddClientDialog(t){this.dialog.open(n,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,maxWidth:`600px`,width:`600px`,minWidth:`auto`,disableClose:!1,data:{initialEmails:t}})}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-add-client-dialog`]],decls:123,vars:84,consts:[[`subsEndPicker`,``],[`draftInfoMenu`,`matMenu`],[`coachingTrackStartDatePicker`,``],[1,`dialog-container`],[1,`dialog-header`],[1,`dialog-title`],[1,`close-button`,3,`closed`],[1,`mock-client-section`],[1,`mock-client-info`],[1,`mock-client-icon`],[`type`,`button`,`mat-stroked-button`,``,1,`mock-client-button`,3,`click`,`disabled`],[`diameter`,`16`],[3,`ngSubmit`,`formGroup`],[1,`form-content`],[1,`form-fields`],[1,`input-container`,`block`],[1,`email-header`],[1,`email-count`],[1,`invalid-count`],[`formArrayName`,`emails`],[1,`email-row`,3,`has-error`],[`type`,`button`,1,`toggle-emails-button`],[`type`,`button`,`mat-stroked-button`,``,1,`add-email-button`,3,`click`],[1,`membership-section`],[1,`section-label`],[1,`membership-fields`],[1,`input-container`,`block`,`date-field`],[`appearance`,`outline`,1,`w-full`],[`matInput`,``,`formControlName`,`subsEnd`,`readonly`,``,3,`matDatepicker`],[`matSuffix`,``,3,`for`],[1,`input-container`,`block`,`group-section`],[`formControlName`,`group_id`,3,`selectionChange`,`placeholder`],[3,`value`],[`value`,`CREATE_NEW`],[1,`new-group-fields`],[`formControlName`,`coaching_track_id`,3,`placeholder`],[1,`draft-section`],[1,`draft-section-header`],[1,`draft-section-title`],[`mat-icon-button`,``,`type`,`button`,1,`draft-info-icon`,3,`matMenuTriggerFor`],[1,`draft-info-menu`],[1,`draft-info-menu-content`,3,`pointerup`],[`formControlName`,`draftWorkout`,1,`draft-toggle`],[`formControlName`,`draftReport`,1,`draft-toggle`],[`formControlName`,`adaptStrength`,1,`draft-toggle`],[`formControlName`,`adaptEndurance`,1,`draft-toggle`],[1,`dialog-actions`],[`mat-flat-button`,``,`type`,`button`,1,`cancel-button`,3,`pointerup`],[`mat-flat-button`,``,`type`,`submit`,1,`save-button`,3,`disabled`],[1,`email-row`],[1,`email-field-wrapper`],[`appearance`,`outline`,1,`email-field`],[`matInput`,``,`type`,`email`,3,`paste`,`input`,`formControlName`,`placeholder`],[1,`email-error-icon`,3,`matTooltip`],[1,`own-email-error`],[`icon`,`remove`,1,`remove-email-button`],[`icon`,`remove`,1,`remove-email-button`,3,`pointerup`],[`type`,`button`,1,`toggle-emails-button`,3,`click`],[`matInput`,``,`type`,`text`,`formControlName`,`groupName`,3,`placeholder`],[`matInput`,``,`formControlName`,`groupDescription`,`rows`,`3`,3,`placeholder`],[`matInput`,``,`formControlName`,`coaching_track_start_date`,3,`matDatepicker`],[`matIconSuffix`,``,3,`for`]],template:function(e,r){if(e&1&&(Bi$3(0,`div`,3)(1,`div`,4)(2,`h2`,5),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`app-dialog-close-button`,6),jh$3(`closed`,function(){return r.closeDialog()}),vl$4()(),Bi$3(6,`div`,7)(7,`div`,8)(8,`mat-icon`,9),lC(9,`smart_toy`),vl$4(),Bi$3(10,`span`),lC(11),OC(12,`translate`),vl$4()(),Bi$3(13,`button`,10),jh$3(`click`,function(){return r.addMockClient()}),fw(14,St$4,1,0,`mat-spinner`,11)(15,kt$4,2,0,`mat-icon`),lC(16),OC(17,`translate`),vl$4()(),Bi$3(18,`form`,12),jh$3(`ngSubmit`,function(){return r.onSubmit()}),Bi$3(19,`div`,13)(20,`div`,14)(21,`span`,15)(22,`div`,16)(23,`mat-label`),lC(24),OC(25,`translate`),vl$4(),Bi$3(26,`span`,17),lC(27),fw(28,wt$4,3,4,`span`,18),vl$4()(),Bi$3(29,`div`,19),mw(30,Tt$3,8,9,`div`,20,gw),fw(32,Nt$4,5,2,`button`,21),vl$4(),Bi$3(33,`button`,22),jh$3(`click`,function(){return r.addEmailField()}),Bi$3(34,`mat-icon`),lC(35,`add`),vl$4(),lC(36),OC(37,`translate`),vl$4()(),Bi$3(38,`div`,23)(39,`mat-label`,24),lC(40),OC(41,`translate`),vl$4(),Bi$3(42,`div`,25)(43,`span`,26)(44,`mat-label`),lC(45),OC(46,`translate`),vl$4(),Bi$3(47,`mat-form-field`,27),Rh$3(48,`input`,28),WE(),Rh$3(49,`mat-datepicker-toggle`,29)(50,`mat-datepicker`,null,0),vl$4()()()(),Bi$3(52,`span`,30)(53,`mat-label`,24),lC(54,`Lisää ryhmään`),vl$4(),Bi$3(55,`mat-form-field`,27)(56,`mat-select`,31),OC(57,`translate`),jh$3(`selectionChange`,function(g){return r.onGroupSelectionChange(g.value)}),Bi$3(58,`mat-option`,32),lC(59),OC(60,`translate`),vl$4(),Bi$3(61,`mat-option`,33)(62,`strong`),lC(63),OC(64,`translate`),vl$4()(),mw(65,It$4,2,2,`mat-option`,32,gw),vl$4(),WE(),vl$4()(),fw(67,Rt$2,15,12,`div`,34),Bi$3(68,`span`,30)(69,`mat-label`,24),lC(
238770),OC(71,`translate`),vl$4(),Bi$3(72,`mat-form-field`,27)(73,`mat-select`,35),OC(74,`translate`),Bi$3(75,`mat-option`,32),lC(76),OC(77,`translate`),vl$4(),mw(78,Bt$4,3,6,`mat-option`,32,Pt$4),vl$4(),WE(),vl$4()(),fw(80,Vt$3,9,5,`span`,15),Bi$3(81,`div`,36)(82,`div`,37)(83,`span`,38),lC(84),OC(85,`translate`),vl$4(),Bi$3(86,`button`,39),OC(87,`translate`),Bi$3(88,`mat-icon`),lC(89,`info`),vl$4()(),Bi$3(90,`mat-menu`,40,1)(92,`div`,41),jh$3(`pointerup`,function(g){return g.stopPropagation()}),lC(93),OC(94,`translate`),vl$4()()(),Bi$3(95,`mat-slide-toggle`,42),lC(96),OC(97,`translate`),vl$4(),WE(),Bi$3(98,`mat-slide-toggle`,43),lC(99),OC(100,`translate`),vl$4(),WE(),vl$4(),Bi$3(101,`div`,36)(102,`div`,37)(103,`span`,38),lC(104),OC(105,`translate`),vl$4()(),Bi$3(106,`mat-slide-toggle`,44),lC(107),OC(108,`translate`),vl$4(),WE(),Bi$3(109,`mat-slide-toggle`,45),lC(110),OC(111,`translate`),vl$4(),WE(),vl$4()(),Bi$3(112,`div`,46)(113,`button`,47),jh$3(`pointerup`,function(){return r.closeDialog()}),Bi$3(114,`mat-icon`),lC(115,`close`),vl$4(),lC(116),OC(117,`translate`),vl$4(),Bi$3(118,`button`,48)(119,`mat-icon`),lC(120,`person_add`),vl$4(),lC(121),OC(122,`translate`),vl$4()()()()()),e&2){let s=jw(51),g=jw(91);sE(3),ig(LC(4,38,`dashboard.addClient`)),sE(8),ig(LC(12,40,`dashboard.mockClient.description`)),sE(2),Ah$2(`disabled`,r.mockClientLoading()),sE(),pw(r.mockClientLoading()?14:15),sE(2),Cl$4(` `,LC(17,42,`dashboard.mockClient.button`),` `),sE(2),Ah$2(`formGroup`,r.form),sE(6),Cl$4(``,LC(25,44,`person.email`),` *`),sE(3),sg(` `,r.validEmailCount,`/`,r.emailControls.length,` `),sE(),pw(r.invalidEmailCount>0?28:-1),sE(2),yw(r.visibleEmailControls),sE(2),pw(r.hasHiddenEmails?32:-1),sE(4),Cl$4(` `,LC(37,46,`common.addMore`),` `),sE(4),ig(LC(41,48,`person.subsEnd`)),sE(5),ig(LC(46,50,`person.subsEnd`)),sE(3),Ah$2(`matDatepicker`,s),zE(),sE(),Ah$2(`for`,s),sE(7),Ah$2(`placeholder`,LC(57,52,`dashboard.clients.groupName.placeholder`)),zE(),sE(2),Ah$2(`value`,null),sE(),ig(LC(60,54,`dashboard.clients.groupName.placeholder`)),sE(4),ig(LC(64,56,`trainingGroup.createNewGroup`)),sE(2),yw(r.trainingGroupOptions()),sE(2),pw(r.isCreatingNewGroup()?67:-1),sE(3),ig(LC(71,58,`clientProfile.coachingTracks.pickerLabel`)),sE(3),Ah$2(`placeholder`,LC(74,60,`clientProfile.coachingTracks.pickerPlaceholder`)),zE(),sE(2),Ah$2(`value`,null),sE(),ig(LC(77,62,`clientProfile.coachingTracks.pickerPlaceholder`)),sE(2),yw(r.coachingTrackService.coachingTracks()),sE(2),pw(r.form.get(`coaching_track_id`)?.value?80:-1),sE(4),ig(LC(85,64,`person.draftSectionHeading`)),sE(2),Ah$2(`matMenuTriggerFor`,g),xh$2(`aria-label`,LC(87,66,`person.draftSectionHeading`)),sE(7),Cl$4(` `,LC(94,68,`person.draftSectionTooltip`),` `),sE(2),zE(),sE(),Cl$4(` `,LC(97,70,`person.draftWorkoutLabel`),` `),sE(2),zE(),sE(),Cl$4(` `,LC(100,72,`person.draftReportLabel`),` `),sE(5),ig(LC(105,74,`settings.title.adaptation`)),sE(2),zE(),sE(),Cl$4(` `,LC(108,76,`settings.adaptStrengthTraining`),` `),sE(2),zE(),sE(),Cl$4(` `,LC(111,78,`settings.adaptEnduranceTraining`),` `),sE(6),Cl$4(` `,LC(117,80,`common.cancel`),` `),sE(2),Ah$2(`disabled`,r.form.invalid),sE(3),Cl$4(` `,LC(122,82,`common.save`),` `)}},dependencies:[en$4,je$3,X$5,gt$7,xt$5,Be$2,Pe$4,Qn$4,Zn$4,Qe$2,qn$5,$n$4,bn$4,Vn$4,bt$10,Ap$1,wp$2,xc$4,yt$7,wt$5,b$3,X$4,Bn$3,On$4,ua$3,qa$1,L$3,Gi$3,Hi$3,$$3,we$3,te$2,en$3,L$4,Jt$3,I$6,Ct$5,J$1,Z$2,Xp$1],styles:[`.dialog-container[_ngcontent-%COMP%]{border-radius:10px;padding:1.5rem;max-width:600px;margin:0 auto;display:flex;flex-direction:column}.dialog-container[_ngcontent-%COMP%] form[_ngcontent-%COMP%]{display:flex;flex-direction:column}.dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem;border-bottom:1px solid var(--%NS%border-color);padding-bottom:1.5rem}.dialog-header[_ngcontent-%COMP%] .dialog-title[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500;margin:0}.dialog-header[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{position:absolute;top:1.5rem;right:1.5rem}.mock-client-section[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.875rem 1rem;margin-bottom:1.5rem;background:#ffffff05;border:1px solid var(--%NS%border-color);border-radius:8px}.mock-client-section[_ngcontent-%COMP%] .mock-client-info[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--%NS%text-color);opacity:.8}.mock-client-section[_ngcontent-%COMP%] .mock-client-icon[_ngcontent-%COMP%]{flex-shrink:0;font-size:1.25rem;width:1.25rem;height:1.25rem}.mock-client-section[_ngcontent-%COMP%] .mock-client-button[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.5rem;white-space:nowrap}.mock-client-section[_ngcontent-%COMP%] .mock-client-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}@media(max-width:760px){.mock-client-section[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch}.mock-client-section[_ngcontent-%COMP%] .mock-client-button[_ngcontent-%COMP%]{width:100%;justify-content:center}}.form-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.form-fields[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.input-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.input-container[_ngcontent-%COMP%] mat-label[_ngcontent-%COMP%]{font-size:.875rem;color:var(--%NS%text-color);opacity:.8}.input-container.group-section[_ngcontent-%COMP%]{margin-top:.5rem}.section-label[_ngcontent-%COMP%]{font-size:1rem;font-weight:500;color:var(--%NS%text-color);margin-bottom:.5rem}.membership-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.membership-section[_ngcontent-%COMP%] .membership-fields[_ngcontent-%COMP%]{display:flex;gap:1rem}.membership-section[_ngcontent-%COMP%] .membership-fields[_ngcontent-%COMP%] .date-field[_ngcontent-%COMP%]{flex:2}.membership-section[_ngcontent-%COMP%] .membership-fields[_ngcontent-%COMP%] .period-field[_ngcontent-%COMP%]{flex:1}.email-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.email-header[_ngcontent-%COMP%] .email-count[_ngcontent-%COMP%]{font-size:.75rem;color:var(--%NS%gray-link-color)}.email-header[_ngcontent-%COMP%] .email-count[_ngcontent-%COMP%] .invali
2387d-count[_ngcontent-%COMP%]{color:var(--%NS%danger);font-weight:500}.email-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr auto;align-items:flex-start;gap:.5rem;margin-bottom:.75rem}.email-row[_ngcontent-%COMP%] .email-field-wrapper[_ngcontent-%COMP%]{position:relative;width:100%}.email-row[_ngcontent-%COMP%] .email-field-wrapper[_ngcontent-%COMP%] .email-field[_ngcontent-%COMP%]{width:100%}.email-row[_ngcontent-%COMP%] .email-field-wrapper[_ngcontent-%COMP%] .email-error-icon[_ngcontent-%COMP%]{position:absolute;top:-6px;right:-6px;color:var(--%NS%danger);font-size:1.25rem;width:1.2rem;height:1.2rem;cursor:help;background:var(--%NS%box-color);border-radius:50%}.email-row[_ngcontent-%COMP%] .remove-email-button[_ngcontent-%COMP%]{margin-top:.25rem}.email-row[_ngcontent-%COMP%] .own-email-error[_ngcontent-%COMP%]{grid-column:1/-1;font-size:.75rem;margin-top:-.5rem;margin-bottom:.25rem}.email-row.has-error[_ngcontent-%COMP%] .mat-mdc-text-field-wrapper{border:1px solid var(--%NS%danger)!important;border-radius:4px}.toggle-emails-button[_ngcontent-%COMP%]{background:transparent;border:none;color:var(--%NS%primary);display:flex;align-items:center;gap:.25rem;padding:.5rem 0;cursor:pointer;font-size:.875rem;transition:opacity .2s ease;margin-bottom:.5rem}.toggle-emails-button[_ngcontent-%COMP%]:hover{opacity:.8}.toggle-emails-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.toggle-emails-button[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-weight:500}.add-email-button[_ngcontent-%COMP%]{width:fit-content;padding:.5rem 1rem;border:1px solid var(--%NS%border-color);border-radius:8px;background:transparent;color:var(--%NS%text-color);display:flex;align-items:center;gap:.5rem;font-size:.875rem;transition:all .2s ease}.add-email-button[_ngcontent-%COMP%]:hover{background:#ffffff0d;border-color:var(--%NS%primary)}.add-email-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:0}.draft-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.draft-section-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.draft-section-header[_ngcontent-%COMP%] .draft-section-title[_ngcontent-%COMP%]{font-size:.875rem;color:var(--%NS%text-color);opacity:.8;font-weight:500}.draft-section-header[_ngcontent-%COMP%] .draft-info-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem;color:var(--%NS%text-color);opacity:.6;cursor:pointer}.dialog-actions[_ngcontent-%COMP%]{display:flex;gap:1rem;justify-content:flex-end;margin-top:1rem;padding-top:1rem}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:120px;padding:.625rem 1.5rem;font-weight:500;display:flex;align-items:center;justify-content:center;gap:.5rem}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.dialog-actions[_ngcontent-%COMP%] .cancel-button[_ngcontent-%COMP%]{background:transparent;border:1px solid var(--%NS%border-color);color:var(--%NS%text-color)}.dialog-actions[_ngcontent-%COMP%] .cancel-button[_ngcontent-%COMP%]:hover:not(:disabled){background:#ffffff0d}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]{background:var(--%NS%primary)}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]:hover:not(:disabled){opacity:.9}.dialog-actions[_ngcontent-%COMP%] .save-button[_ngcontent-%COMP%]:disabled{color:var(--%NS%primaryBlack);opacity:.5;cursor:not-allowed}.new-group-fields[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:1rem;background:#ffffff05;border-radius:8px;border:1px solid var(--%NS%border-color);margin-top:.5rem}@media(max-width:760px){.dialog-container[_ngcontent-%COMP%]{padding:1rem}.membership-section[_ngcontent-%COMP%] .membership-fields[_ngcontent-%COMP%]{flex-direction:column}.dialog-actions[_ngcontent-%COMP%]{flex-direction:column-reverse}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%}} .mat-mdc-form-field-subscript-wrapper{display:none} .mat-mdc-text-field-wrapper{background-color:#ffffff0d} .mat-mdc-select-value, .mat-mdc-input-element{color:var(--%NS%text-color)!important}`]})};
2387var F$1=Number.isFinite||function(n){return typeof n==`number`&&isFinite(n)};var Mo$3=Number.isSafeInteger||function(n){return typeof n==`number`&&Math.abs(n)<=No$3};var No$3=Number.MAX_SAFE_INTEGER||9007199254740991;var V$1=(function(n){return n.NETWORK_ERROR=`networkError`,n.MEDIA_ERROR=`mediaError`,n.KEY_SYSTEM_ERROR=`keySystemError`,n.MUX_ERROR=`muxError`,n.OTHER_ERROR=`otherError`,n})({});var L$2=(function(n){return n.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,n.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,n.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,n.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,n.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,n.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,n.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,n.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR=`keySystemDestroyMediaKeysError`,n.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR=`keySystemDestroyCloseSessionError`,n.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR=`keySystemDestroyRemoveSessionError`,n.MANIFEST_LOAD_ERROR=`manifestLoadError`,n.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,n.MANIFEST_PARSING_ERROR=`manifestParsingError`,n.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,n.LEVEL_EMPTY_ERROR=`levelEmptyError`,n.LEVEL_LOAD_ERROR=`levelLoadError`,n.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,n.LEVEL_PARSING_ERROR=`levelParsingError`,n.LEVEL_SWITCH_ERROR=`levelSwitchError`,n.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,n.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,n.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,n.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,n.FRAG_LOAD_ERROR=`fragLoadError`,n.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,n.FRAG_DECRYPT_ERROR=`fragDecryptError`,n.FRAG_PARSING_ERROR=`fragParsingError`,n.FRAG_GAP=`fragGap`,n.REMUX_ALLOC_ERROR=`remuxAllocError`,n.KEY_LOAD_ERROR=`keyLoadError`,n.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,n.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,n.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,n.BUFFER_APPEND_ERROR=`bufferAppendError`,n.BUFFER_APPENDING_ERROR=`bufferAppendingError`,n.BUFFER_STALLED_ERROR=`bufferStalledError`,n.BUFFER_FULL_ERROR=`bufferFullError`,n.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,n.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,n.ASSET_LIST_LOAD_ERROR=`assetListLoadError`,n.ASSET_LIST_LOAD_TIMEOUT=`assetListLoadTimeout`,n.ASSET_LIST_PARSING_ERROR=`assetListParsingError`,n.INTERSTITIAL_ASSET_ITEM_ERROR=`interstitialAssetItemError`,n.INTERNAL_EXCEPTION=`internalException`,n.INTERNAL_ABORTED=`aborted`,n.ATTACH_MEDIA_ERROR=`attachMediaError`,n.UNKNOWN=`unknown`,n})({});var m=(function(n){return n.MEDIA_ATTACHING=`hlsMediaAttaching`,n.MEDIA_ATTACHED=`hlsMediaAttached`,n.MEDIA_DETACHING=`hlsMediaDetaching`,n.MEDIA_DETACHED=`hlsMediaDetached`,n.MEDIA_ENDED=`hlsMediaEnded`,n.STALL_RESOLVED=`hlsStallResolved`,n.BUFFER_RESET=`hlsBufferReset`,n.BUFFER_CODECS=`hlsBufferCodecs`,n.BUFFER_CREATED=`hlsBufferCreated`,n.BUFFER_APPENDING=`hlsBufferAppending`,n.BUFFER_APPENDED=`hlsBufferAppended`,n.BUFFER_EOS=`hlsBufferEos`,n.BUFFERED_TO_END=`hlsBufferedToEnd`,n.BUFFER_FLUSHING=`hlsBufferFlushing`,n.BUFFER_FLUSHED=`hlsBufferFlushed`,n.MANIFEST_LOADING=`hlsManifestLoading`,n.MANIFEST_LOADED=`hlsManifestLoaded`,n.MANIFEST_PARSED=`hlsManifestParsed`,n.LEVEL_SWITCHING=`hlsLevelSwitching`,n.LEVEL_SWITCHED=`hlsLevelSwitched`,n.LEVEL_LOADING=`hlsLevelLoading`,n.LEVEL_LOADED=`hlsLevelLoaded`,n.LEVEL_UPDATED=`hlsLevelUpdated`,n.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,n.LEVELS_UPDATED=`hlsLevelsUpdated`,n.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,n.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,n.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,n.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,n.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,n.AUDIO_TRACK_UPDATED=`hlsAudioTrackUpdated`,n.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUp
2387dated`,n.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,n.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,n.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,n.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,n.SUBTITLE_TRACK_UPDATED=`hlsSubtitleTrackUpdated`,n.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,n.CUES_PARSED=`hlsCuesParsed`,n.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,n.INIT_PTS_FOUND=`hlsInitPtsFound`,n.FRAG_LOADING=`hlsFragLoading`,n.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,n.FRAG_LOADED=`hlsFragLoaded`,n.FRAG_DECRYPTED=`hlsFragDecrypted`,n.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,n.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,n.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,n.FRAG_PARSED=`hlsFragParsed`,n.FRAG_BUFFERED=`hlsFragBuffered`,n.FRAG_CHANGED=`hlsFragChanged`,n.FPS_DROP=`hlsFpsDrop`,n.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,n.MAX_AUTO_LEVEL_UPDATED=`hlsMaxAutoLevelUpdated`,n.ERROR=`hlsError`,n.DESTROYING=`hlsDestroying`,n.KEY_LOADING=`hlsKeyLoading`,n.KEY_LOADED=`hlsKeyLoaded`,n.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,n.BACK_BUFFER_REACHED=`hlsBackBufferReached`,n.STEERING_MANIFEST_LOADED=`hlsSteeringManifestLoaded`,n.ASSET_LIST_LOADING=`hlsAssetListLoading`,n.ASSET_LIST_LOADED=`hlsAssetListLoaded`,n.INTERSTITIALS_UPDATED=`hlsInterstitialsUpdated`,n.INTERSTITIALS_BUFFERED_TO_BOUNDARY=`hlsInterstitialsBufferedToBoundary`,n.INTERSTITIAL_ASSET_PLAYER_CREATED=`hlsInterstitialAssetPlayerCreated`,n.INTERSTITIAL_STARTED=`hlsInterstitialStarted`,n.INTERSTITIAL_ASSET_STARTED=`hlsInterstitialAssetStarted`,n.INTERSTITIAL_ASSET_ENDED=`hlsInterstitialAssetEnded`,n.INTERSTITIAL_ASSET_ERROR=`hlsInterstitialAssetError`,n.INTERSTITIAL_ENDED=`hlsInterstitialEnded`,n.INTERSTITIALS_PRIMARY_RESUMED=`hlsInterstitialsPrimaryResumed`,n.PLAYOUT_LIMIT_REACHED=`hlsPlayoutLimitReached`,n.EVENT_CUE_ENTER=`hlsEventCueEnter`,n})({});var z$2={MANIFEST:`manifest`,LEVEL:`level`,AUDIO_TRACK:`audioTrack`,SUBTITLE_TRACK:`subtitleTrack`};var N$1={MAIN:`main`,AUDIO:`audio`,SUBTITLE:`subtitle`};var qe$1=class{constructor(e,t=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=s}sample(e,t){let s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}};var hi$2=class{constructor(e,t,s,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
vendor: 3,752 bytes, line 2387
2387=new qe$1(e),this.fast_=new qe$1(t),this.defaultTTFB_=i,this.ttfb_=new qe$1(e)}update(e,t){let{slow_:s,fast_:i,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new qe$1(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new qe$1(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new qe$1(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);let s=8*t,i=e/1e3,r=s/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){let t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function Bo$3(n,e,t){return(e=$o$3(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function se$3(){return se$3=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(n[s]=t[s])}return n},se$3.apply(null,arguments)}function Zr$3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,s)}return t}function ee$2(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zr$3(Object(t),!0).forEach(function(s){Bo$3(n,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zr$3(Object(t)).forEach(function(s){Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(t,s))})}return n}function Uo$3(n,e){if(typeof n!=`object`||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var s=t.call(n,e);if(typeof s!=`object`)return s;throw new TypeError(`@@toPrimitive must return a primitive value.`)}return(e===`string`?String:Number)(n)}function $o$3(n){var e=Uo$3(n,`string`);return typeof e==`symbol`?e:e+``}var xe$2=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let s=`[${e}]:`;this.trace=je$1,this.debug=t.debug.bind(null,s),this.log=t.log.bind(null,s),this.warn=t.warn.bind(null,s),this.info=t.info.bind(null,s),this.error=t.error.bind(null,s)}};var je$1=function(){};var Go$3={trace:je$1,debug:je$1,log:je$1,warn:je$1,info:je$1,error:je$1};function ui$2(){return se$3({},Go$3)}function Ko$3(n,e){let t=self.console[n];return t?t.bind(self.console,`${e?`[`+e+`] `:``}[${n}] >`):je$1}function Jr$3(n,e,t){return e[n]?e[n].bind(e):Ko$3(n,t)}var di$2=ui$2();function Vo$3(n,e,t){let s=ui$2();if(typeof console==`object`&&n===!0||typeof n==`object`){let i=[`debug`,`log`,`info`,`warn`,`error`];i.forEach(r=>{s[r]=Jr$3(r,n,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.17`)}catch(r){return ui$2()}i.forEach(r=>{di$2[r]=Jr$3(r,n)})}else se$3(di$2,s);return s}var te$1=di$2;function Xe$1(n=!0){return typeof self>`u`?void 0:(n||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ho$3(n){return typeof self<`u`&&n===self.ManagedMediaSource}function ua$2(n,e){let t=Object.keys(n),s=Object.keys(e),i=t.length,r=s.length;return!i||!r||i===r&&!t.some(a=>s.indexOf(a)===-1)}function Re$1(n,e=!1){if(typeof TextDecoder<`u`){let l=new TextDecoder(`utf-8`).decode(n);if(e){let h=l.indexOf(`\0`);return h!==-1?l.substring(0,h):l}return l.replace(/\0/g,``)}let t=n.length,s,i,r,a=``,o=0;for(;o<t;){if(s=n[o++],s===0&&e)return a;
2387if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:i=n[o++],a+=String.fromCharCode((s&31)<<6|i&63);break;case 14:i=n[o++],r=n[o++],a+=String.fromCharCode((s&15)<<12|(i&63)<<6|(r&63)<<0);break}}return a}function ge$2(n){let e=``;for(let t=0;t<n.length;t++){let s=n[t].toString(16);s.length<2&&(s=`0`+s),e+=s}return e}function da$2(n){return Uint8Array.from(n.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function Yo$3(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,`default`)?n.default:n}var Ks$3={exports:{}};var en$2;function Wo$3(){return en$2||(en$2=1,(function(n,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,l,h){if(h=h||{},c=c.trim(),l=l.trim(),!l){if(!h.alwaysNormalize)return c;var u=o.parseURL(c);if(!u)throw new Error(`Error trying to parse base URL.`);return u.path=o.normalizePath(u.path),o.buildURLFromParts(u)}var d=o.parseURL(l);if(!d)throw new Error(`Error trying to parse relative URL.`);if(d.scheme)return h.alwaysNormalize?(d.path=o.normalizePath(d.path),o.buildURLFromParts(d)):l;var f=o.parseURL(c);if(!f)throw new Error(`Error trying to parse base URL.`);if(!f.netLoc&&f.path&&f.path[0]!==`/`){var g=i.exec(f.path);f.netLoc=g[1],f.path=g[2]}f.netLoc&&!f.path&&(f.path=`/`);var p={scheme:f.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(p.netLoc=f.netLoc,d.path[0]!==`/`))if(!d.path)p.path=f.path,d.params||(p.params=f.params,d.query||(p.query=f.query));else{var y=f.path,E=y.substring(0,y.lastIndexOf(`/`)+1)+d.path;p.path=o.normalizePath(E)}return p.path===null&&(p.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(p)},parseURL:function(c){var l=s.exec(c);return l?{scheme:l[1]||``,netLoc:l[2]||``,path:l[3]||``,params:l[4]||``,query:l[5]||``,fragment:l[6]||``}:null},normalizePath:function(c){for(c=c.split(``).reverse().join(``).replace(r,``);c.length!==(c=c.replace(a,``)).length;);return c.split(``).reverse().join(``)},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};n.exports=o})()})(Ks$3)),Ks$3.exports}var Cr$3=Wo$3();var wt$3=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}};var ie$2={AUDIO:`audio`,VIDEO:`video`,AUDIOVIDEO:`audiovideo`};var ds$3=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e==`string`&&(e={url:e}),this.base=e,qo$3(this,`stats`)}setByteRange(e,t){let s=e.split(`@`,2),i;s.length===1?i=t?.byteRangeEndOffset||0:i=parseInt(s[1]),this._byteRange=[i,parseInt(s[0])+i]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[ie$2.AUDIO]:null,[ie$2.VIDEO]:null,[ie$2.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new wt$3),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Cr$3.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[ie$2.AUDIO]=null,e[ie$2.VIDEO]=null,e[ie$2.AUDIOVIDEO]=null}};function le$4(n){return n.sn!==`initSegment`}var Dt$3=class extends ds$3{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(F$1(e)&&F$1(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){let s=Object.keys(t);if(s.length===1){let i=this._decryptdata=t[s[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=F$1(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;
2387if(this.levelkeys){var t;let s=Object.keys(this.levelkeys),i=s.length;if(i>1||i===1&&(t=this.levelkeys[s[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!F$1(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return le$4(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var s;let i=t[e];i&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,i,r,a=!1){let{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:r,partial:a};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,s),c.startDTS=Math.min(c.startDTS,i),c.endDTS=Math.max(c.endDTS,r)}};var fi$2=class extends ds$3{constructor(e,t,s,i,r){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint(`DURATION`),this.gap=e.bool(`GAP`),this.independent=e.bool(`INDEPENDENT`),this.relurl=e.enumeratedString(`URI`),this.fragment=t,this.index=i;let a=e.enumeratedString(`BYTERANGE`);a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function fa$2(n,e){let t=Object.getPrototypeOf(n);if(t)return Object.getOwnPropertyDescriptor(t,e)||fa$2(t,e)}function qo$3(n,e){let t=fa$2(n,e);t&&(t.enumerable=!0,Object.defineProperty(n,e,t))}var tn$2=Math.pow(2,32)-1;var jo$3=[].push;var ga$2={video:1,audio:2,id3:3,text:4};function ce$3(n){return String.fromCharCode.apply(null,n)}function ma$2(n,e){let t=n[e]<<8|n[e+1];return t<0?65536+t:t}function Y$1(n,e){let t=pa$2(n,e);return t<0?4294967296+t:t}function sn$3(n,e){let t=Y$1(n,e);return t*=Math.pow(2,32),t+=Y$1(n,e+4),t}function pa$2(n,e){return n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}function Xo$3(n){let e=n.byteLength;for(let t=0;t<e;){let s=Y$1(n,t);if(s>8&&n[t+4]===109&&n[t+5]===111&&n[t+6]===111&&n[t+7]===102)return!0;t=s>1?t+s:e}return!1}function X$2(n,e){let t=[];if(!e.length)return t;let s=n.byteLength;for(let i=0;i<s;){let r=Y$1(n,i),a=ce$3(n.subarray(i+4,i+8)),o=r>1?i+r:s;if(a===e[0])if(e.length===1)t.push(n.subarray(i+8,o));else{let c=X$2(n.subarray(i+8,o),e.slice(1));c.length&&jo$3.apply(t,c)}i=o}return t}function zo$3(n){let e=[],t=n[0],s=8,i=Y$1(n,s);s+=4;let r=0,a=0;t===0?(r=Y$1(n,s),a=Y$1(n,s+4),s+=8):(r=sn$3(n,s),a=sn$3(n,s+8),s+=16),s+=2;let o=n.length+a,c=ma$2(n,s);s+=2;for(let l=0;l<c;l++){let h=s,u=Y$1(n,h);h+=4;let d=u&2147483647;if((u&2147483648)>>>31===1)return te$1.warn(`SIDX has hierarchical references (not supported)`),null;let g=Y$1(n,h);h+=4,e.push({referenceSize:d,subsegmentDuration:g,info:{duration:g/i,start:o,end:o+d-1}}),o+=d,h+=4,s=h}return{earliestPresentationTime:r,timescale:i,version:t,referencesCount:c,references:e}}function ya$2(n){let e=[],t=X$2(n,[`moov`,`trak`]);for(let i=0;i<t.length;i++){let r=t[i],a=X$2(r,[`tkhd`])[0];if(a){let o=a[0],c=Y$1(a,o===0?12:20),l=X$2(r,[`mdia`,`mdhd`])[0];if(l){o=l[0];let h=Y$1(l,o===0?12:20),u=X$2(r,[`mdia`,`hdlr`])[0];if(u){let d=ce$3(u.subarray(8,12)),f={soun:ie$2.AUDIO,vide:ie$2.VIDEO}[d],g=X$2(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],p=Qo$3(g);f?(e[c]={timescale:h,type:f,stsd:p},e[f]=ee$2({timescale:h,id:c},p)):e[c]={timescale:h,type:d,stsd:p}}}}}return X$2(n,[`moov`,`mvex`,`trex`]).forEach(i=>{let r=Y$1(i,4),a=e[r];a&&(a.default={duration:Y$1(i,12),flags:Y$1(i,20)})}),e}function Qo$3(n){let e=n.subarray(8),t=e.subarray(86),s=ce$3(e.subarray(4,8)),i=s,r,a=s===`enca`||s===`encv`;if(a)X$2(X$2(e,[s])[0].subarray(s===`enca`?28:78),[`sinf`]).forEac
vendor: 4,199 bytes, line 2387
2387h(u=>{let d=X$2(u,[`schm`])[0];if(d){let f=ce$3(d.subarray(4,8));if(f===`cbcs`||f===`cenc`){let g=X$2(u,[`frma`])[0];g&&(i=ce$3(g))}}});let o=i;switch(i){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let c=X$2(t,[`avcC`])[0];c&&c.length>3&&(i+=`.`+qt$5(c[1])+qt$5(c[2])+qt$5(c[3]),r=Wt$3(o===`avc1`?`dva1`:`dvav`,t));break}case`mp4a`:{let c=X$2(e,[s])[0],l=X$2(c.subarray(28),[`esds`])[0];if(l&&l.length>7){let h=4;if(l[h++]!==3)break;h=Vs$3(l,h),h+=2;let u=l[h++];if(u&128&&(h+=2),u&64&&(h+=l[h++]),l[h++]!==4)break;h=Vs$3(l,h);let d=l[h++];if(d===64)i+=`.`+qt$5(d);else break;if(h+=12,l[h++]!==5)break;h=Vs$3(l,h);let f=l[h++],g=(f&248)>>3;g===31&&(g+=1+((f&7)<<3)+((l[h]&224)>>5)),i+=`.`+g}break}case`hvc1`:case`hev1`:{let c=X$2(t,[`hvcC`])[0];if(c&&c.length>12){let l=c[1],h=[``,`A`,`B`,`C`][l>>6],u=l&31,d=Y$1(c,2),f=(l&32)>>5?`H`:`L`,g=c[12],p=c.subarray(6,12);i+=`.`+h+u,i+=`.`+Zo$3(d).toString(16).toUpperCase(),i+=`.`+f+g;let y=``;for(let E=p.length;E--;){let T=p[E];(T||y)&&(y=`.`+T.toString(16).toUpperCase()+y)}i+=y}r=Wt$3(o==`hev1`?`dvhe`:`dvh1`,t);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:i=Wt$3(i,t)||i;break;case`vp09`:{let c=X$2(t,[`vpcC`])[0];if(c&&c.length>6){let l=c[4],h=c[5],u=c[6]>>4&15;i+=`.`+Ne$2(l)+`.`+Ne$2(h)+`.`+Ne$2(u)}break}case`av01`:{let c=X$2(t,[`av1C`])[0];if(c&&c.length>2){let l=c[1]>>>5,h=c[1]&31,u=c[2]>>>7?`H`:`M`,d=(c[2]&64)>>6,f=(c[2]&32)>>5,g=l===2&&d?f?12:10:d?10:8,p=(c[2]&16)>>4,y=(c[2]&8)>>3,E=(c[2]&4)>>2,T=c[2]&3;i+=`.`+l+`.`+Ne$2(h)+u+`.`+Ne$2(g)+`.`+p+`.`+y+E+T+`.`+Ne$2(1)+`.`+Ne$2(1)+`.`+Ne$2(1)+`.0`,r=Wt$3(`dav1`,t)}break}}return{codec:i,encrypted:a,supplemental:r}}function Wt$3(n,e){let t=X$2(e,[`dvvC`]),s=t.length?t[0]:X$2(e,[`dvcC`])[0];if(s){let i=s[2]>>1&127,r=s[2]<<5&32|s[3]>>3&31;return n+`.`+Ne$2(i)+`.`+Ne$2(r)}}function Zo$3(n){let e=0;for(let t=0;t<32;t++)e|=(n>>t&1)<<31-t;return e>>>0}function Vs$3(n,e){let t=e+5;for(;n[e++]&128&&e<t;);return e}function qt$5(n){return(`0`+n.toString(16).toUpperCase()).slice(-2)}function Ne$2(n){return(n<10?`0`:``)+n}function Jo$3(n,e){if(!n||!e)return;let t=e.keyId;t&&e.isCommonEncryption&&Ea$2(n,(s,i)=>{let r=s.subarray(8,24);r.some(a=>a!==0)||(te$1.log(`[eme] Patching keyId in 'enc${i?`a`:`v`}>sinf>>tenc' box: ${ge$2(r)} -> ${ge$2(t)}`),s.set(t,8))})}function el$3(n){let e=[];return Ea$2(n,t=>e.push(t.subarray(8,24))),e}function Ea$2(n,e){X$2(n,[`moov`,`trak`]).forEach(s=>{let i=X$2(s,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!i)return;let r=i.subarray(8),a=X$2(r,[`enca`]),o=a.length>0;o||(a=X$2(r,[`encv`])),a.forEach(c=>{X$2(o?c.subarray(28):c.subarray(78),[`sinf`]).forEach(u=>{let d=Ta$2(u);d&&e(d,o)})})})}function Ta$2(n){let e=X$2(n,[`schm`])[0];if(e){let t=ce$3(e.subarray(4,8));if(t===`cbcs`||t===`cenc`){let s=X$2(n,[`schi`,`tenc`])[0];if(s)return s}}}function tl$3(n,e,t){let s={},i=X$2(n,[`moof`,`traf`]);for(let r=0;r<i.length;r++){let a=i[r],o=X$2(a,[`tfhd`])[0],c=Y$1(o,4),l=e[c];if(!l)continue;s[c]||(s[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});let h=s[c],u=X$2(a,[`tfdt`])[0];if(u){let S=u[0],v=Y$1(u,4);S===1&&(v===tn$2?t.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(v*=tn$2+1,v+=Y$1(u,8))),F$1(v)&&(!F$1(h.start)||v<h.start)&&(h.start=v)}let d=l.default,f=Y$1(o,0)|d?.flags,g=d?.duration||0;f&8&&(f&2?g=Y$1(o,12):g=Y$1(o,8));let p=X$2(a,[`trun`]),y=h.start||0,E=0,T=g;for(let S=0;S<p.length;S++){let v=p[S],x=Y$1(v,4),_=h.sampleCount;h.sampleCount+=x;let A=v[3]&1,R=v[3]&4,b=v[2]&1,I=v[2]&2,C=v[2]&4,O=v[2]&8,B=8,G=x;for(A&&(B+=4),R&&x&&(!(v[B+1]&1)&&h.keyFrameIndex===void 0&&(h.keyFrameIndex=_),B+=4,b?(T=Y$1(v,B),B+=4):T=g,I&&(B+=4),O&&(B+=4),y+=T,E+=T,G--);G--;)b?(T=Y$1(v,B),B+=4):T=g,I&&(B+=4),C&&(v[B+1]&1||h.keyFrameIndex===void 0&&(h.keyFrameIndex=h.sampleCount-(G+1),h.keyFrameStart=y),B+=4),O&&(B+=4),y+=T,E+=T;!E&&g&&(E+=g*x)}h.duration+=E}if(!Object.keys(s).some(r=>s[r].duration)){let r=Infinity,a=0,o=X$2(n,[`sidx`]);for(let c=0;c<o.length;c++){let l=zo$3(o[c]);if(l!=null&&l.references){r=Math.min(r,l.earliestPresentationTime/l.timescale);let h=l.references.reduce((u,d)=>u+d.info.duration||0,0);a=Math.max(a,h+l.earliestPresentationTime/l.timescale)}}
vendor: 4,317 bytes, line 2387
2387a&&F$1(a)&&Object.keys(s).forEach(c=>{s[c].duration||(s[c].duration=a*s[c].timescale-s[c].start)})}return s}function sl$3(n){let e={valid:null,remainder:null},t=X$2(n,[`moof`]);if(t.length<2)return e.remainder=n,e;let s=t[t.length-1];return e.valid=n.slice(0,s.byteOffset-8),e.remainder=n.slice(s.byteOffset-8),e}function De$1(n,e){let t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function rn$3(n,e){let t=[],s=e.samples,i=e.timescale,r=e.id,a=!1;return X$2(s,[`moof`]).map(c=>{let l=c.byteOffset-8;X$2(c,[`traf`]).map(u=>{let d=X$2(u,[`tfdt`]).map(f=>{let g=f[0],p=Y$1(f,4);return g===1&&(p*=Math.pow(2,32),p+=Y$1(f,8)),p/i})[0];return d!==void 0&&(n=d),X$2(u,[`tfhd`]).map(f=>{let g=Y$1(f,4),p=Y$1(f,0)&16777215,y=(p&1)!==0,E=(p&2)!==0,T=(p&8)!==0,S=0,v=(p&16)!==0,x=0,_=(p&32)!==0,A=8;g===r&&(y&&(A+=8),E&&(A+=4),T&&(S=Y$1(f,A),A+=4),v&&(x=Y$1(f,A),A+=4),_&&(A+=4),e.type===`video`&&(a=Ns$3(e.codec)),X$2(u,[`trun`]).map(R=>{let b=R[0],I=Y$1(R,0)&16777215,C=(I&1)!==0,O=0,B=(I&4)!==0,G=(I&256)!==0,U=0,P=(I&512)!==0,$=0,M=(I&1024)!==0,K=(I&2048)!==0,H=0,k=Y$1(R,4),w=8;C&&(O=Y$1(R,w),w+=4),B&&(w+=4);let q=O+l;for(let J=0;J<k;J++){if(G?(U=Y$1(R,w),w+=4):U=S,P?($=Y$1(R,w),w+=4):$=x,M&&(w+=4),K&&(b===0?H=Y$1(R,w):H=pa$2(R,w),w+=4),e.type===ie$2.VIDEO){let j=0;for(;j<$;){let Q=Y$1(s,q);if(q+=4,il$3(a,s[q]))Pr$3(s.subarray(q,q+Q),a?2:1,n+H/i,t);q+=Q,j+=Q+4}}n+=U/i}}))})})}),t}function Ns$3(n){if(!n)return!1;let e=n.substring(0,4);return e===`hvc1`||e===`hev1`||e===`dvh1`||e===`dvhe`}function il$3(n,e){if(n){let t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Pr$3(n,e,t,s){let i=Sa$2(n),r=0;r+=e;let a=0,o=0,c=0;for(;r<i.length;){a=0;do{if(r>=i.length)break;c=i[r++],a+=c}while(c===255);o=0;do{if(r>=i.length)break;c=i[r++],o+=c}while(c===255);let l=i.length-r,h=r;if(o<l)r+=o;else if(o>l){te$1.error(`Malformed SEI payload. ${o} is too small, only ${l} bytes left to parse.`);break}if(a===4){if(i[h++]===181){let d=ma$2(i,h);if(h+=2,d===49){let f=Y$1(i,h);if(h+=4,f===1195456820){let g=i[h++];if(g===3){let p=i[h++],y=31&p,E=64&p,T=E?2+y*3:0,S=new Uint8Array(T);if(E){S[0]=p;for(let v=1;v<T;v++)S[v]=i[h++]}s.push({type:g,payloadType:a,pts:t,bytes:S})}}}}}else if(a===5&&o>16){let u=[];for(let g=0;g<16;g++){let p=i[h++].toString(16);u.push(p.length==1?`0`+p:p),(g===3||g===5||g===7||g===9)&&u.push(`-`)}let d=o-16,f=new Uint8Array(d);for(let g=0;g<d;g++)f[g]=i[h++];s.push({payloadType:a,pts:t,uuid:u.join(``),userData:Re$1(f),userDataBytes:f})}}}function Sa$2(n){let e=n.byteLength,t=[],s=1;for(;s<e-2;)n[s]===0&&n[s+1]===0&&n[s+2]===3?(t.push(s+2),s+=2):s++;if(t.length===0)return n;let i=e-t.length,r=new Uint8Array(i),a=0;for(s=0;s<i;a++,s++)a===t[0]&&(a++,t.shift()),r[s]=n[a];return r}function rl$3(n){let e=n[0],t=``,s=``,i=0,r=0,a=0,o=0,c=0,l=0;if(e===0){for(;ce$3(n.subarray(l,l+1))!==`\0`;)t+=ce$3(n.subarray(l,l+1)),l+=1;for(t+=ce$3(n.subarray(l,l+1)),l+=1;ce$3(n.subarray(l,l+1))!==`\0`;)s+=ce$3(n.subarray(l,l+1)),l+=1;s+=ce$3(n.subarray(l,l+1)),l+=1,i=Y$1(n,12),r=Y$1(n,16),o=Y$1(n,20),c=Y$1(n,24),l=28}else if(e===1){l+=4,i=Y$1(n,l),l+=4;let u=Y$1(n,l);l+=4;let d=Y$1(n,l);for(l+=4,a=2**32*u+d,Mo$3(a)||(a=Number.MAX_SAFE_INTEGER,te$1.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),o=Y$1(n,l),l+=4,c=Y$1(n,l),l+=4;ce$3(n.subarray(l,l+1))!==`\0`;)t+=ce$3(n.subarray(l,l+1)),l+=1;for(t+=ce$3(n.subarray(l,l+1)),l+=1;ce$3(n.subarray(l,l+1))!==`\0`;)s+=ce$3(n.subarray(l,l+1)),l+=1;s+=ce$3(n.subarray(l,l+1)),l+=1}let h=n.subarray(l,n.byteLength);return{schemeIdUri:t,value:s,timeScale:i,presentationTime:a,presentationTimeDelta:r,eventDuration:o,id:c,payload:h}}function nl$3(n,...e){let t=e.length,s=8,i=t;for(;i--;)s+=e[i].byteLength;let r=new Uint8Array(s);for(r[0]=s>>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(n,4),i=0,s=8;i<t;i++)r.set(e[i],s),s+=e[i].byteLength;return r}function al$3(n,e,t){if(n.byteLength!==16)throw new RangeError(`Invalid system id`);let s,i;s=0,i=new Uint8Array;let r;s>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;let a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),nl$3([112,115,115,104],new Uint8Array([s,0,0,0]),n,r,i,a,t)}function ol$3(n){let e=[];
vendor: 9,497 bytes, line 2387
2387if(n instanceof ArrayBuffer){let t=n.byteLength,s=0;for(;s+32<t;){let r=ll$3(new DataView(n,s));e.push(r),s+=r.size}}return e}function ll$3(n){let e=n.getUint32(0),t=n.byteOffset,s=n.byteLength;if(s<e)return{offset:t,size:s};if(n.getUint32(4)!==1886614376)return{offset:t,size:e};let r=n.getUint32(8)>>>24;if(r!==0&&r!==1)return{offset:t,size:e};let a=n.buffer,o=ge$2(new Uint8Array(a,t+12,16)),c=null,l=null,h=0;if(r===0)h=28;else{let d=n.getUint32(28);if(!d||s<32+d*16)return{offset:t,size:e};c=[];for(let f=0;f<d;f++)c.push(new Uint8Array(a,t+32+f*16,16));h=32+d*16}if(!h)return{offset:t,size:e};let u=n.getUint32(h);return e-32<u?{offset:t,size:e}:(l=new Uint8Array(a,t+h+4,u),{version:r,systemId:o,kids:c,data:l,offset:t,size:e})}var va$2=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent);var xt$2={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function kr$2(n,e){let t=xt$2[e];return!!t&&!!t[n.slice(0,4)]}function Ot$4(n,e,t=!0){return!n.split(`,`).some(s=>!wr$3(s,e,t))}function wr$3(n,e,t=!0){var s;return(s=Xe$1(t)?.isTypeSupported(Ft$3(n,e)))!=null?s:!1}function Ft$3(n,e){return`${e}/mp4;codecs=${n}`}function nn$2(n){if(n){let e=n.substring(0,4);return xt$2.video[e]}return 2}function fs$2(n){let e=va$2();return n.split(`,`).reduce((t,s)=>{let r=e&&Ns$3(s)?9:xt$2.video[s];return r?(r*2+t)/(t?3:2):(xt$2.audio[s]+t)/(t?2:1)},0)}var Hs$3={};function cl$3(n,e=!0){if(Hs$3[n])return Hs$3[n];let t={flac:[`flac`,`fLaC`,`FLAC`],opus:[`opus`,`Opus`],"mp4a.40.34":[`mp3`]}[n];for(let i=0;i<t.length;i++){var s;if(wr$3(t[i],`audio`,e))return Hs$3[n]=t[i],t[i];if(t[i]===`mp3`&&(s=Xe$1(e))!=null&&s.isTypeSupported(`audio/mpeg`))return``}return n}var hl$3=/flac|opus|mp4a\.40\.34/i;function gs$3(n,e=!0){return n.replace(hl$3,t=>cl$3(t.toLowerCase(),e))}function ul$3(n,e){let t=[];if(n){let s=n.split(`,`);for(let i=0;i<s.length;i++)kr$2(s[i],`video`)||t.push(s[i])}return e&&t.push(e),t.join(`,`)}function ns$3(n,e){if(n&&(n.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(n)!==-1)&&(an$2(n,`audio`)||an$2(n,`video`)))return n;if(e){let t=e.split(`,`);if(t.length>1){if(n){for(let s=t.length;s--;)if(t[s].substring(0,4)===n.substring(0,4))return t[s]}return t[0]}}return e||n}function an$2(n,e){return kr$2(n,e)&&wr$3(n,e)}function dl$3(n){let e=n.split(`,`);for(let t=0;t<e.length;t++){let s=e[t].split(`.`);s.length>2&&s[0]===`avc1`&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${(`000`+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(`,`)}function fl$3(n){if(n.startsWith(`av01.`)){let e=n.split(`.`),t=[`0`,`111`,`01`,`01`,`01`,`0`];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(`.`)}return n}function on$3(n){let e=Xe$1(n)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported(`audio/mpeg`),mp3:e.isTypeSupported(`audio/mp4; codecs="mp3"`),ac3:e.isTypeSupported(`audio/mp4; codecs="ac-3"`)}}function gi$2(n){return n.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}var gl$3={supported:!0,powerEfficient:!0,smooth:!0};var ml$3={supported:!1,smooth:!1,powerEfficient:!1};var xa$2={supported:!0,configurations:[],decodingInfoResults:[gl$3]};function Aa$2(n,e){return{supported:!1,configurations:e,decodingInfoResults:[ml$3],error:n}}function pl$3(n,e,t,s,i,r){let a=n.videoCodec,o=n.audioCodec?n.audioGroups:null,c=r?.audioCodec,l=r?.channels,h=l?parseInt(l):c?Infinity:2,u=null;if(o!=null&&o.length)try{o.length===1&&o[0]?u=e.groups[o[0]].channels:u=o.reduce((d,f)=>{if(f){let g=e.groups[f];if(!g)throw new Error(`Audio track group ${f} not found`);Object.keys(g.channels).forEach(p=>{d[p]=(d[p]||0)+g.channels[p]})}return d},{2:0})}catch(d){return!0}return a!==void 0&&(a.split(`,`).some(d=>Ns$3(d))||n.width>1920&&n.height>1088||n.height>1920&&n.width>1088||n.frameRate>Math.max(s,30)||n.videoRange!==`SDR`&&n.videoRange!==t||n.bitrate>Math.max(i,8e6))||!!u&&F$1(h)&&Object.keys(u).some(d=>parseInt(d)>h)}function Ia$2(n,e,t,s={}){let i=n.videoCodec;if(!i&&!n.audioCodec||!t)return Promise.resolve(xa$2);let r=[],a=yl$3(n),o=a.length,c=El$3(n,e,o>0),l=c.length;for(let h=o||1*l||1;h--;){let u={type:`media-source`};if(o&&(u.video=a[h%o]),l){u.audio=c[h%l];let d=u.audio.bitrate;u.video&&d&&(u.video.bitrate-=d)}r.push(u)}if(i){let h=navigator.userAgent;if(i.split(`,`).some(u=>Ns$3(u))&&va$2())return Promise.resolve(Aa$2(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),r))}return Promise.all(r.map(h=>{let u=Sl$3(h);return s[u]||(s[u]=t.decodingInfo(h))})).then(h=>({supported:!h.some(u=>!u.supported),configurations:r,decodingInfoResults:h})).catch(h=>({supported:!1,configurations:r,decodingInfoResults:[],error:h}))}function yl$3(n){var e;let t=(e=n.videoCodec)==null?void 0:e.split(`,`),s=La$2(n),i=n.width||640,r=n.height||480,a=n.frameRate||30,o=n.videoRange.toLowerCase();return t?t.map(c=>{let l={contentType:Ft$3(fl$3(c),`video`),width:i,height:r,bitrate:s,framerate:a};return o!==`sdr`&&(l.transferFunction=o),l}):[]}function El$3(n,e,t){var s;let i=(s=n.audioCodec)==null?void 0:s.split(`,`),r=La$2(n);return i&&n.audioGroups?n.audioGroups.reduce((a,o)=>{var c;let l=o?(c=e.groups[o])==null?void 0:c.tracks:null;return l?l.reduce((h,u)=>{if(u.groupId===o){let d=parseFloat(u.channels||``);i.forEach(f=>{let g={contentType:Ft$3(f,`audio`),bitrate:t?Tl$3(f,r):r};d&&(g.channels=``+d),h.push(g)})}return h},a):a},[]):[]}function Tl$3(n,e){if(e<=1)return 1;let t=128e3;return n===`ec-3`?t=768e3:n===`ac-3`&&(t=64e4),Math.min(e/2,t)}function La$2(n){return Math.ceil(Math.max(n.bitrate*.9,n.averageBitrate)/1e3)*1e3||1}function Sl$3(n){let e=``,{audio:t,video:s}=n;if(s){let i=gi$2(s.contentType);e+=`${i}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||`sd`}_${Math.ceil(s.bitrate/1e5)}`}if(t){let i=gi$2(t.contentType);e+=`${s?`_`:``}${i}_c${t.channels}`}return e}var mi$1=[`NONE`,`TYPE-0`,`TYPE-1`,null];function vl$3(n){return mi$1.indexOf(n)>-1}var ms$3=[`SDR`,`PQ`,`HLG`];function xl$3(n){return!!n&&ms$3.indexOf(n)>-1}var as$3={No:``,Yes:`YES`,v2:`v2`};function ln$2(n){let{canSkipUntil:e,canSkipDateRanges:t,age:s}=n,i=s<e/2;return e&&i?t?as$3.v2:as$3.Yes:as$3.No}var ps$3=class{constructor(e,t,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=s}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set(`_HLS_msn`,this.msn.toString()),this.part!==void 0&&t.searchParams.set(`_HLS_part`,this.part.toString()),this.skip&&t.searchParams.set(`_HLS_skip`,this.skip),t.href}};var at$2=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat(`FRAME-RATE`,0),this._avgBitrate=e.attrs.decimalInteger(`AVERAGE-BANDWIDTH`),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(`,`),`supplemental`in e){var t;this.supplemental=e.supplemental;let s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId(`audio`,e.attrs.AUDIO),this.addGroupId(`text`,e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||``}get pathwayId(){return this.attrs[`PATHWAY-ID`]||`.`}get videoRange(){return this.attrs[`VIDEO-RANGE`]||`SDR`}get score(){return this.attrs.optionalFloat(`SCORE`,0)}get uri(){return this.url[0]||``}hasAudioGroup(e){return cn$4(this._audioGroups,e)}hasSubtitleGroup(e){return cn$4(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e===`audio`){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e===`text`){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}};function cn$4(n,e){return!e||!n?!1:n.indexOf(e)!==-1}function Al$3(){if(typeof matchMedia==`function`){let n=matchMedia(`(dynamic-range: high)`),e=matchMedia(`bad query`);
vendor: 13,697 bytes, lines 2387-2397
2387if(n.media!==e.media)return n.matches===!0}return!1}function Il$3(n,e){let t=!1,s=[];if(n&&(t=n!==`SDR`,s=[n]),e){s=e.allowedVideoRanges||ms$3.slice(0);let i=s.join(``)!==`SDR`&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&Al$3(),t||(s=[`SDR`])}return{preferHDR:t,allowedVideoRanges:s}}var Ll$3=n=>{let e=new WeakSet;return(t,s)=>{if(n&&(s=n(t,s)),typeof s==`object`&&s!==null){if(e.has(s))return;e.add(s)}return s}};var re$1=(n,e)=>JSON.stringify(n,Ll$3(e));function Rl$3(n,e,t,s,i){let r=Object.keys(n),a=s?.channels,o=s?.audioCodec,c=i?.videoCodec,l=a&&parseInt(a)===2,h=!1,u=!1,d=Infinity,f=Infinity,g=Infinity,p=Infinity,y=0,E=[],{preferHDR:T,allowedVideoRanges:S}=Il$3(e,i);for(let R=r.length;R--;){let b=n[r[R]];h||(h=b.channels[2]>0),d=Math.min(d,b.minHeight),f=Math.min(f,b.minFramerate),g=Math.min(g,b.minBitrate),S.filter(C=>b.videoRanges[C]>0).length>0&&(u=!0)}d=F$1(d)?d:0,f=F$1(f)?f:0;let v=Math.max(1080,d),x=Math.max(30,f);g=F$1(g)?g:t,t=Math.max(g,t),u||(e=void 0);let _=r.length>1;return{codecSet:r.reduce((R,b)=>{let I=n[b];if(b===R)return R;if(E=u?S.filter(C=>I.videoRanges[C]>0):[],_){if(I.minBitrate>t)return Fe$3(b,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),R;if(!I.hasDefaultAudio)return Fe$3(b,`no renditions with default or auto-select sound found`),R;if(o&&b.indexOf(o.substring(0,4))%5!==0)return Fe$3(b,`audio codec preference "${o}" not found`),R;if(a&&!l){if(!I.channels[a])return Fe$3(b,`no renditions with ${a} channel sound found (channels options: ${Object.keys(I.channels)})`),R}else if((!o||l)&&h&&I.channels[2]===0)return Fe$3(b,`no renditions with stereo sound found`),R;if(I.minHeight>v)return Fe$3(b,`min resolution of ${I.minHeight} > maximum of ${v}`),R;if(I.minFramerate>x)return Fe$3(b,`min framerate of ${I.minFramerate} > maximum of ${x}`),R;if(!E.some(C=>I.videoRanges[C]>0))return Fe$3(b,`no variants with VIDEO-RANGE of ${re$1(E)} found`),R;if(c&&b.indexOf(c.substring(0,4))%5!==0)return Fe$3(b,`video codec preference "${c}" not found`),R;if(I.maxScore<y)return Fe$3(b,`max score of ${I.maxScore} < selected max of ${y}`),R}return R&&(fs$2(b)>=fs$2(R)||I.fragmentError>n[R].fragmentError)?R:(p=I.minIndex,y=I.maxScore,b)},void 0),videoRanges:E,preferHDR:T,minFramerate:f,minBitrate:g,minIndex:p}}function Fe$3(n,e){te$1.log(`[abr] start candidates with "${n}" ignored because ${e}`)}function Ra$2(n){return n.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);let i=t.channels||`2`;return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function bl$3(n,e,t,s){return n.slice(t,s+1).reduce((i,r,a)=>{if(!r.codecSet)return i;let o=r.audioGroups,c=i[r.codecSet];c||(i[r.codecSet]=c={minBitrate:Infinity,minHeight:Infinity,minFramerate:Infinity,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);let l=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,l),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,a),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;let u=e.groups[h];u&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?u.hasDefault:u.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(u.channels).forEach(d=>{c.channels[d]=(c.channels[d]||0)+u.channels[d]}))}),i},{})}function hn$3(n){if(!n)return n;let{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}=n;return{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}}function Ue$1(n,e,t){if(`attrs`in n){let s=e.indexOf(n);if(s!==-1)return s}for(let s=0;s<e.length;s++){let i=e[s];if(rt$3(n,i,t))return s}return-1}function rt$3(n,e,t){let{groupId:s,name:i,lang:r,assocLang:a,default:o}=n,c=n.forced;return(s===void 0||e.groupId===s)&&(i===void 0||e.name===i)&&(r===void 0||_l$3(r,e.lang))&&(r===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!(`characteristics`in n)||Dl$3(n.characteristics||``,e.characteristics))&&(t===void 0||t(n,e))}function _l$3(n,e=`--`){return n.length===e.length?n===e:n.startsWith(e)||e.startsWith(n)}function Dl$3(n,e=``){let t=n.split(`,`),s=e.split(`,`);return t.length===s.length&&!t.some(i=>s.indexOf(i)===-1)}function st$4(n,e){let{audioCodec:t,channels:s}=n;return(t===void 0||(e.audioCodec||``).substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||`2`))}function Cl$3(n,e,t,s,i){let r=e[s],o=e.reduce((d,f,g)=>{let p=f.uri;return(d[p]||(d[p]=[])).push(g),d},{})[r.uri];o.length>1&&(s=Math.max.apply(Math,o));let c=r.videoRange,l=r.frameRate,h=r.codecSet.substring(0,4),u=un$4(e,s,d=>{if(d.videoRange!==c||d.frameRate!==l||d.codecSet.substring(0,4)!==h)return!1;let f=d.audioGroups;return Ue$1(n,t.filter(p=>!f||f.indexOf(p.groupId)!==-1),i)>-1});return u>-1?u:un$4(e,s,d=>{let f=d.audioGroups;return Ue$1(n,t.filter(p=>!f||f.indexOf(p.groupId)!==-1),i)>-1})}function un$4(n,e,t){for(let s=e;s>-1;s--)if(t(n[s]))return s;for(let s=e+1;s<n.length;s++)if(t(n[s]))return s;return-1}function ys$3(n,e){var t;return!!n&&n!==((t=e.loadLevelObj)==null?void 0:t.uri)}var pi$3=class extends xe$2{constructor(e){super(`abr`,e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey=``,this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var s;let{fragCurrent:i,partCurrent:r,hls:a}=this,{autoLevelEnabled:o,media:c}=a;if(!i||!c)return;let l=performance.now(),h=r?r.stats:i.stats,u=r?r.duration:i.duration,d=l-h.loading.start,f=a.minAutoLevel,g=i.level,p=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||g<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;let y=p>-1&&p!==g,E=!!t||y;if(!E&&(c.paused||!c.playbackRate||!c.readyState))return;let T=a.mainForwardBufferInfo;if(!E&&T===null)return;let S=this.bwEstimator.getEstimateTTFB(),v=Math.abs(c.playbackRate);if(d<=Math.max(S,1e3*(u/(v*2))))return;let x=T?T.len/v:0,_=h.loading.first?h.loading.first-h.loading.start:-1,A=h.loaded&&_>-1,R=this.getBwEstimate(),b=a.levels,I=b[g],C=Math.max(h.loaded,Math.round(u*(i.bitrate||I.averageBitrate)/8)),O=A?d-_:d;O<1&&A&&(O=Math.min(d,h.loaded*8/R));let B=A?h.loaded*1e3/O:0,G=S/1e3,U=B?(C-h.loaded)/B:C*8/R+G;if(U<=x)return;let P=B?B*8:R,$=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,M=this.hls.config.abrBandWidthUpFactor,K=Number.POSITIVE_INFINITY,H;for(H=g-1;H>f;H--){let J=b[H].maxBitrate,j=!b[H].details||$;if(K=this.getTimeToLoadFrag(G,P,u*J,j),K<Math.min(x,u+G))break}if(K>=U||K>u*10)return;A?this.bwEstimator.sample(d-Math.min(S,_),h.loaded):this.bwEstimator.sampleTTFB(d);let k=b[H].maxBitrate;this.getBwEstimate()*M>k&&this.resetEstimator(k);let w=this.findBestLevel(k,f,H,0,x,1,1);w>-1&&(H=w),this.warn(`Fragment ${i.sn}${r?` part `+r.index:``} of level ${g} is loading too slowly; 2388 Fragment duration: ${i.duration.toFixed(3)} 2389 Time to underbuffer: ${x.toFixed(3)} s 2390 Estimated load time for current fragment: ${U.toFixed(3)} s 2391 Estimated load time for down switch fragment: ${K.toFixed(3)} s 2392 TTFB estimate: ${_|0} ms 2393 Current BW estimate: ${F$1(R)?R|0:`Unknown`} bps 2394 New BW estimate: ${this.getBwEstimate()|0} bps 2395 Switching to level ${H} @ ${k|0} bps`),a.nextLoadLevel=a.nextAutoLevel=H,this.clearTimer();let q=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===H&&H>0){let J=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${H>0?`and switching down`:``} 2396 Fragment duration: ${i.duration.toFixed(3)} s 2397 Time to underbuffer: ${J.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,H>f){let j=this.findBestLevel(this.hls.levels[f].bitrate,f,H,0,J,1,1);j===-1&&(j=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=j,this.resetEstimator(this.hls.levels[j].bitrate)}}};y||U>K*2?q():this.timer=self.setInterval(q,K*1e3),a.trigger(m.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:h})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){let e=this.hls.config;return new hi$2(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){let{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_LOADED,this.onFragLoaded,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(m.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=``}onFragLoading(e,t){let s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var i;this.fragCurrent=s,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case L$2.BUFFER_ADD_CODEC_ERROR:case L$2.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case L$2.FRAG_LOAD_TIMEOUT:{let s=t.frag,{fragCurrent:i,partCurrent:r}=this;if(s&&i&&s.sn===i.sn&&s.level===i.level){let a=performance.now(),o=r?r.stats:s.stats,c=a-o.loading.start,l=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&l>-1){let u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(u,l),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,s,i){return e+s/t+(i?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){let s=this.hls.config,{loading:i}=t.stats,r=i.end-i.first;F$1(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:s}){let i=s?s.stats:t.stats;if(t.type===N$1.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){let r=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+i.loaded,c=(a.loaded?a.loaded.duration:0)+r;a.loaded={bytes:o,duration:c},a.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){let r={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(m.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){let{frag:s,part:i}=t,r=i!=null&&i.stats.loaded?i.stats:s.stats;if(r.aborted||this.ignoreFragment(s))return;let a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==N$1.MAIN||e.sn===`initSegment`}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){let{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(s,t,e,0,i,1,1);if(r>-1)return r;let a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){let e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;let r=s&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){let a=this.hls.levels;if(a.length>Math.max(e,r)&&a[e].loadError<=a[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}
2397_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){let{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;let{maxAutoLevel:i,config:r,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),l=this.getStarvationDelay(),h=r.abrBandWidthFactor,u=r.abrBandWidthUpFactor;if(l){let y=this.findBestLevel(c,a,i,l,0,h,u);if(y>=0)return this.rebufferNotice=-1,y}let d=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){let y=this.bitrateTestDelay;y&&(d=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-y,this.info(`bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=u=1)}let f=this.findBestLevel(c,a,i,l,d,h,u);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${l?`rebuffering expected`:`buffer is empty`}, optimal quality level ${f}`)),f>-1)return f;let g=s.levels[a],p=s.loadLevelObj;return p&&g?.bitrate<p.bitrate?a:s.loadLevel}getStarvationDelay(){let e=this.hls,t=e.media;if(!t)return Infinity;let s=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,s,i,r,a,o){var c;let l=i+r,h=this.lastLoadedFragLevel,u=h===-1?this.hls.firstLevel:h,{fragCurrent:d,partCurrent:f}=this,{levels:g,allAudioTracks:p,loadLevel:y,config:E}=this.hls;if(g.length===1)return 0;let T=g[u],S=!!((c=this.hls.latestLevelDetails)!=null&&c.live),v=y===-1||h===-1,x,_=`SDR`,A=T?.frameRate||0,{audioPreference:R,videoPreference:b}=E,I=this.audioTracksByGroup||(this.audioTracksByGroup=Ra$2(p)),C=-1;if(v){if(this.firstSelection!==-1)return this.firstSelection;let $=Rl$3(this.codecTiers||(this.codecTiers=bl$3(g,I,t,s)),_,e,R,b),{codecSet:M,videoRanges:K,minFramerate:H,minBitrate:k,minIndex:w,preferHDR:q}=$;C=w,x=M,_=q?K[K.length-1]:K[0],A=H,e=Math.max(e,k),this.log(`picked start tier ${re$1($)}`)}else x=T?.codecSet,_=T?.videoRange;let O=f?f.duration:d?d.duration:0,B=this.bwEstimator.getEstimateTTFB()/1e3,G=[];for(let P=s;P>=t;P--){var U;let $=g[P],M=P>u;if(!$)continue;
vendor: 7,690 bytes, line 2397
2397if(E.useMediaCapabilities&&!$.supportedResult&&!$.supportedPromise){let j=navigator.mediaCapabilities;typeof j?.decodingInfo==`function`&&pl$3($,I,_,A,e,R)?($.supportedPromise=Ia$2($,I,j,this.supportedCache),$.supportedPromise.then(Q=>{if(!this.hls)return;$.supportedResult=Q;let pe=this.hls.levels,fe=pe.indexOf($);Q.error?this.warn(`MediaCapabilities decodingInfo error: "${Q.error}" for level ${fe} ${re$1(Q)}`):Q.supported?Q.decodingInfoResults.some(be=>be.smooth===!1||be.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${fe} not smooth or powerEfficient: ${re$1(Q)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${fe} ${re$1(Q)}`),fe>-1&&pe.length>1&&(this.log(`Removing unsupported level ${fe}`),this.hls.removeLevel(fe),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Q=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Q}`)})):$.supportedResult=xa$2}if((x&&$.codecSet!==x||_&&$.videoRange!==_||M&&A>$.frameRate||!M&&A>0&&A<$.frameRate||(U=$.supportedResult)!=null&&(U=U.decodingInfoResults)!=null&&U.some(j=>j.smooth===!1))&&(!v||P!==C)){G.push(P);continue}let K=$.details,H=(f?K?.partTarget:K?.averagetargetduration)||O,k;M?k=o*e:k=a*e;let w=O&&i>=O*2&&r===0?$.averageBitrate:$.maxBitrate,q=this.getTimeToLoadFrag(B,k,w*H,K===void 0);if(k>=w&&(P===h||$.loadError===0&&$.fragmentError===0)&&(q<=B||!F$1(q)||S&&!this.bitrateTestDelay||q<l)){let j=this.forcedAutoLevel;return P!==y&&(j===-1||j!==y)&&(G.length&&this.trace(`Skipped level(s) ${G.join(`,`)} of ${s} max with CODECS and VIDEO-RANGE:"${g[G[0]].codecs}" ${g[G[0]].videoRange}; not compatible with "${x}" ${_}`),this.info(`switch candidate:${u}->${P} adjustedbw(${Math.round(k)})-bitrate=${Math.round(k-w)} ttfb:${B.toFixed(1)} avgDuration:${H.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${q.toFixed(1)} firstSelection:${v} codecSet:${$.codecSet} videoRange:${$.videoRange} hls.loadLevel:${y}`)),v&&(this.firstSelection=P),P}}return-1}set nextAutoLevel(e){let t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey=``,this._nextAutoLevel=t)}deriveNextAutoLevel(e){let{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}};var ba$2={search:function(n,e){let t=0,s=n.length-1,i=null,r=null;for(;t<=s;){i=(t+s)/2|0,r=n[i];let a=e(r);if(a>0)t=i+1;else if(a<0)s=i-1;else return r}return null}};function Pl$3(n,e,t){if(e===null||!Array.isArray(n)||!n.length||!F$1(e))return null;if(e<(n[0].programDateTime||0))return null;if(e>=(n[n.length-1].endProgramDateTime||0))return null;for(let r=0;r<n.length;++r){let a=n[r];if(wl$3(e,t,a))return a}return null}function ot$3(n,e,t=0,s=0,i=.005){let r=null;if(n){r=e[1+n.sn-e[0].sn]||null;let o=n.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),r&&n.level!==r.level&&r.end<=n.end&&(r=e[2+n.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!n||n.level===r.level)&&dn$4(t,s,r)===0||kl$3(r,n,Math.min(i,s))))return r;let a=ba$2.search(e,dn$4.bind(null,t,s));return a&&(a!==n||!r)?a:r}function kl$3(n,e,t){if(e&&e.start===0&&e.level<n.level&&(e.endPTS||0)>0){let s=e.tagList.reduce((i,r)=>(r[0]===`INF`&&(i+=parseFloat(r[1])),i),t);return n.start<=s}return!1}function dn$4(n=0,e=0,t){if(t.start<=n&&t.start+t.duration>n)return 0;let s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=n?1:t.start-s>n&&t.start?-1:0}function wl$3(n,e,t){let s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>n}function _a$2(n,e,t){if(n&&n.startCC<=e&&n.endCC>=e){let s=n.fragments,{fragmentHint:i}=n;i&&(s=s.concat(i));let r;return ba$2.search(s,a=>a.cc<e?1:a.cc>e?-1:(r=a,a.end<=t?1:a.start>t?-1:0)),r||null}return null}function Es$2(n){switch(n.details){case L$2.FRAG_LOAD_TIMEOUT:case L$2.KEY_LOAD_TIMEOUT:case L$2.LEVEL_LOAD_TIMEOUT:case L$2.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Da$2(n){return n.details.startsWith(`key`)}function Ca$2(n){return Da$2(n)&&!!n.frag&&!n.frag.decryptdata}function fn$4(n,e){let t=Es$2(e);return n.default[`${t?`timeout`:`error`}Retry`]}function Or$2(n,e){let t=n.backoff===`linear`?1:Math.pow(2,e);return Math.min(t*n.retryDelayMs,n.maxRetryDelayMs)}function gn$4(n){return ee$2(ee$2({},n),{errorRetry:null,timeoutRetry:null})}function Ts$2(n,e,t,s){if(!n)return!1;let i=s?.code,r=e<n.maxNumRetry&&(Ol$3(i)||!!t);return n.shouldRetry?n.shouldRetry(n,e,t,s,r):r}function Ol$3(n){return yi$2(n)||!!n&&(n<400||n>499)}function yi$2(n){return n===0&&navigator.onLine===!1}var de$2={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5};var Ae$2={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};var Ei$2=class extends xe$2{constructor(e){super(`error-controller`,e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(m.ERROR,this.onError,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){let e=this.hls;e&&(e.off(m.ERROR,this.onError,this),e.off(m.ERROR,this.onErrorOut,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===N$1.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;let t=this.hls,s=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return!0;let i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(a=>i.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;let i=this.hls,r=t.context;switch(t.details){case L$2.FRAG_LOAD_ERROR:case L$2.FRAG_LOAD_TIMEOUT:case L$2.KEY_LOAD_ERROR:case L$2.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case L$2.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=Et$3();return}case L$2.FRAG_GAP:case L$2.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=de$2.SendAlternateToPenaltyBox;return;case L$2.LEVEL_EMPTY_ERROR:case L$2.LEVEL_PARSING_ERROR:{var a;let c=t.parent===N$1.MAIN?t.level:i.loadLevel;t.details===L$2.LEVEL_EMPTY_ERROR&&(a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case L$2.LEVEL_LOAD_ERROR:case L$2.LEVEL_LOAD_TIMEOUT:typeof r?.level==`number`&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case L$2.AUDIO_TRACK_LOAD_ERROR:case L$2.AUDIO_TRACK_LOAD_TIMEOUT:case L$2.SUBTITLE_LOAD_ERROR:case L$2.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){let c=i.loadLevelObj;if(c&&(r.type===z$2.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===z$2.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=de$2.SendAlternateToPenaltyBox,t.errorAction.flags=Ae$2.MoveAllAlternatesMatchingHost;return}}return;case L$2.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:de$2.SendAlternateToPenaltyBox,flags:Ae$2.MoveAllAlternatesMatchingHDCP};return;case L$2.KEY_SYSTEM_SESSION_UPDATE_FAILED:case L$2.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case L$2.KEY_SYSTEM_NO_SESSION:t.errorAction={action:de$2.SendAlternateToPenaltyBox,flags:Ae$2.MoveAllAlternatesMatchingKey};return;
2397case L$2.BUFFER_ADD_CODEC_ERROR:case L$2.REMUX_ALLOC_ERROR:case L$2.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:i.loadLevel)}return;case L$2.INTERNAL_EXCEPTION:case L$2.BUFFER_APPENDING_ERROR:case L$2.BUFFER_FULL_ERROR:case L$2.LEVEL_SWITCH_ERROR:case L$2.BUFFER_STALLED_ERROR:case L$2.BUFFER_SEEK_OVER_HOLE:case L$2.BUFFER_NUDGE_ON_STALL:t.errorAction=Et$3();return}t.type===V$1.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Et$3())}getPlaylistRetryOrSwitchAction(e,t){let s=this.hls,i=fn$4(s.config.playlistLoadPolicy,e),r=this.playlistError++;if(Ts$2(i,r,Es$2(e),e.response))return{action:de$2.RetryRequest,flags:Ae$2.None,retryConfig:i,retryCount:r};let o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=r),o}getFragRetryOrSwitchAction(e){let t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:r,keyLoadPolicy:a}=t.config,o=fn$4(Da$2(e)?a:r,e),c=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(i&&(e.details!==L$2.FRAG_GAP&&i.fragmentError++,!Ca$2(e)&&Ts$2(o,c,Es$2(e),e.response)))return{action:de$2.RetryRequest,flags:Ae$2.None,retryConfig:o,retryCount:c};let l=this.getLevelSwitchAction(e,s);return o&&(l.retryConfig=o,l.retryCount=c),l}getLevelSwitchAction(e,t){let s=this.hls;t??=s.loadLevel;let i=this.hls.levels[t];if(i){var r,a;let l=e.details;i.loadError++,l===L$2.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1,{levels:u,loadLevel:d,minAutoLevel:f,maxAutoLevel:g}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);let p=(r=e.frag)==null?void 0:r.type,E=(p===N$1.AUDIO&&l===L$2.FRAG_PARSING_ERROR||e.sourceBufferName===`audio`&&(l===L$2.BUFFER_ADD_CODEC_ERROR||l===L$2.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:_})=>i.audioCodec!==_),S=e.sourceBufferName===`video`&&(l===L$2.BUFFER_ADD_CODEC_ERROR||l===L$2.BUFFER_APPEND_ERROR)&&u.some(({codecSet:_,audioCodec:A})=>i.codecSet!==_&&i.audioCodec===A),{type:v,groupId:x}=(a=e.context)!=null?a:{};for(let _=u.length;_--;){let A=(_+d)%u.length;if(A!==d&&A>=f&&A<=g&&u[A].loadError===0){var o,c;let R=u[A];if(l===L$2.FRAG_GAP&&p===N$1.MAIN&&e.frag){let b=u[A].details;if(b){let I=ot$3(e.frag,b.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(v===z$2.AUDIO_TRACK&&R.hasAudioGroup(x)||v===z$2.SUBTITLE_TRACK&&R.hasSubtitleGroup(x))continue;if(p===N$1.AUDIO&&(o=i.audioGroups)!=null&&o.some(b=>R.hasAudioGroup(b))||p===N$1.SUBTITLE&&(c=i.subtitleGroups)!=null&&c.some(b=>R.hasSubtitleGroup(b))||E&&i.audioCodec===R.audioCodec||S&&i.codecSet===R.codecSet||!E&&i.codecSet!==R.codecSet)continue}h=A;break}}if(h>-1&&s.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:de$2.SendAlternateToPenaltyBox,flags:Ae$2.None,nextAutoLevel:h}}return{action:de$2.SendAlternateToPenaltyBox,flags:Ae$2.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case de$2.DoNothing:break;case de$2.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==L$2.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case de$2.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){let t=this.hls,s=e.errorAction;if(!s)return;let{flags:i}=s,r=s.nextAutoLevel;switch(i){case Ae$2.None:this.switchLevel(e,r);break;case Ae$2.MoveAllAlternatesMatchingHDCP:{let c=this.getVariantLevelIndex(e.frag),h=t.levels[c]?.attrs[`HDCP-LEVEL`];if(s.hdcpLevel=h,h===`NONE`)this.warn(`HDCP policy resticted output with HDCP-LEVEL=NONE`);else if(h){t.maxHdcpLevel=mi$1[mi$1.indexOf(h)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Ae$2.MoveAllAlternatesMatchingKey:{let c=e.decryptdata;if(c){let l=this.hls.levels,h=l.length;for(let d=h;d--;)if(this.variantHasKey(l[d],c)){var a,o;this.log(`Banned key found in level ${d} (${l[d].bitrate}bps) or audio group "${(a=l[d].audioGroups)==null?void 0:a.join(`,`)}" (${(o=e.frag)==null?void 0:o.type} fragment) ${ge$2(c.keyId||[])}`),l[d].fragmentError++,l[d].loadError++,this.log(`Removing level ${d} with key error (${e.error})`),this.hls.removeLevel(d)}let u=e.frag;if(this.hls.levels.length<h)s.resolved=!0;else if(u&&u.type!==N$1.MAIN){let d=u.decryptdata;d&&!c.matches(d)&&(s.resolved=!0)}}break}}s.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===L$2.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!==`audiovideo`)){let s=gi$2(e.mimeType),i=this.hls.levels;for(let r=i.length;r--;)i[r][`${e.sourceBufferName}Codec`]===s&&(this.log(`Removing level ${r} for ${e.details} ("${s}" not supported)`),this.hls.removeLevel(r))}}};function Et$3(n){let e={action:de$2.DoNothing,flags:Ae$2.None};return n&&(e.resolved=!0),e}var he$2={NOT_LOADED:`NOT_LOADED`,APPENDING:`APPENDING`,PARTIAL:`PARTIAL`,OK:`OK`};var Ti$1=class{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){let{hls:e}=this;e&&(e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.BUFFER_APPENDED,this.onBufferAppended,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.BUFFER_APPENDED,this.onBufferAppended,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this),e.off(m.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){let s=this.activePartLists[t];if(s)for(let i=s.length;i--;){let r=s[i];if(!r)break;
vendor: 24,533 bytes, line 2397
2397if(r.start<=e&&e<=r.end&&r.loaded)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,s){let{fragments:i}=this,r=Object.keys(i);for(let a=r.length;a--;){let o=i[r[a]];if(o?.body.type===t&&(!s||o.buffered)){let c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,s,i,r){this.timeRanges&&(this.timeRanges[e]=t);let a=i?.fragment.sn||-1;Object.keys(this.fragments).forEach(o=>{let c=this.fragments[o];if(!c||a>=c.body.sn)return;if(!c.buffered&&(!c.loaded||r)){c.body.type===s&&this.removeFragment(c.body);return}let l=c.range[e];if(l){if(l.time.length===0){this.removeFragment(c.body);return}l.time.some(h=>{let u=!this.isTimeBuffered(h.startPTS,h.endPTS,t);return u&&this.removeFragment(c.body),u})}})}detectPartialFragments(e){let t=this.timeRanges;if(!t||e.frag.sn===`initSegment`)return;let s=e.frag,i=ct$5(s),r=this.fragments[i];if(!r||r.buffered&&s.gap)return;let a=!s.relurl;Object.keys(t).forEach(o=>{let c=s.elementaryStreams[o];if(!c)return;let l=t[o],h=a||c.partial===!0;r.range[o]=this.getBufferedTimes(s,e.part,h,l)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,s),jt$1(r)||this.removeParts(s.sn-1,s.type)):this.removeFragment(r.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){let s=this.activePartLists[t];s&&(this.activePartLists[t]=mn$3(s,i=>i.fragment.sn>=e))}fragBuffered(e,t){let s=ct$5(e),i=this.fragments[s];!i&&t&&(i=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e))}getBufferedTimes(e,t,s,i){let r={time:[],partial:s},a=e.start,o=e.end,c=e.minEndPTS||o,l=e.maxStartPTS||a;for(let h=0;h<i.length;h++){let u=i.start(h)-this.bufferPadding,d=i.end(h)+this.bufferPadding;if(l>=u&&c<=d){r.time.push({startPTS:Math.max(a,i.start(h)),endPTS:Math.min(o,i.end(h))});break}else if(a<d&&o>u){let f=Math.max(a,i.start(h)),g=Math.min(o,i.end(h));g>f&&(r.partial=!0,r.time.push({startPTS:f,endPTS:g}))}else if(o<=u)break}return r}getPartialFragment(e){let t=null,s,i,r,a=0,{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(l=>{let h=c[l];h&&jt$1(h)&&(i=h.body.start-o,r=h.body.end+o,e>=i&&e<=r&&(s=Math.min(e-i,r-e),a<=s&&(t=h.body,a=s)))}),t}isEndListAppended(e){let t=this.endListFragments[e];return t!==void 0&&(t.buffered||jt$1(t))}getState(e){let t=ct$5(e),s=this.fragments[t];return s?s.buffered?jt$1(s)?he$2.PARTIAL:he$2.OK:he$2.APPENDING:he$2.NOT_LOADED}isTimeBuffered(e,t,s){let i,r;for(let a=0;a<s.length;a++){if(i=s.start(a)-this.bufferPadding,r=s.end(a)+this.bufferPadding,e>=i&&t<=r)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn===`initSegment`||t.frag.bitrateTest)return;let s=t.frag,i=t.part?null:t,r=ct$5(s);this.fragments[r]={body:s,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){let{frag:s,part:i,timeRanges:r,type:a}=t;if(s.sn===`initSegment`)return;let o=s.type;if(i){let l=this.activePartLists[o];l||(this.activePartLists[o]=l=[]),l.push(i)}this.timeRanges=r;let c=r[a];this.detectEvictedFragments(a,c,o,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){let t=ct$5(e);return!!this.fragments[t]}hasFragments(e){let{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let i=s.length;i--;)if(t[s[i]]?.body.type===e)return!0;return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,i,r){i&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{let o=this.fragments[a];if(!o)return;let c=o.body;c.type!==s||i&&!c.gap||c.start<t&&c.end>e&&(o.buffered||r)&&this.removeFragment(c)})}removeFragment(e){let t=ct$5(e);e.clearElementaryStreamInfo();let s=this.activePartLists[e.type];if(s){let i=e.sn;this.activePartLists[e.type]=mn$3(s,r=>r.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;let t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(s=>s.clearElementaryStreamInfo())}};function jt$1(n){var e,t,s;return n.buffered&&!!(n.body.gap||(e=n.range.video)!=null&&e.partial||(t=n.range.audio)!=null&&t.partial||(s=n.range.audiovideo)!=null&&s.partial)}function ct$5(n){return`${n.type}_${n.level}_${n.sn}`}function mn$3(n,e){return n.filter(t=>{let s=e(t);return s||t.clearElementaryStreamInfo(),s})}var ze$2={cbc:0,ctr:1};var Si$1=class{constructor(e,t,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=s}decrypt(e,t){switch(this.aesMode){case ze$2.cbc:return this.subtle.decrypt({name:`AES-CBC`,iv:this.aesIV},t,e);case ze$2.ctr:return this.subtle.decrypt({name:`AES-CTR`,counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}};function Fl$3(n){let e=n.byteLength,t=e&&new DataView(n.buffer).getUint8(e-1);return t?n.slice(0,e-t):n}var vi$2=class{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){let t=new DataView(e),s=new Uint32Array(4);for(let i=0;i<4;i++)s[i]=t.getUint32(i*4);return s}initTable(){let e=this.sBox,t=this.invSBox,s=this.subMix,i=s[0],r=s[1],a=s[2],o=s[3],c=this.invSubMix,l=c[0],h=c[1],u=c[2],d=c[3],f=new Uint32Array(256),g=0,p=0,y=0;for(y=0;y<256;y++)y<128?f[y]=y<<1:f[y]=y<<1^283;for(y=0;y<256;y++){let E=p^p<<1^p<<2^p<<3^p<<4;E=E>>>8^E&255^99,e[g]=E,t[E]=g;let T=f[g],S=f[T],v=f[S],x=f[E]*257^E*16843008;i[g]=x<<24|x>>>8,r[g]=x<<16|x>>>16,a[g]=x<<8|x>>>24,o[g]=x,x=v*16843009^S*65537^T*257^g*16843008,l[E]=x<<24|x>>>8,h[E]=x<<16|x>>>16,u[E]=x<<8|x>>>24,d[E]=x,g?(g=T^f[f[f[v^T]]],p^=f[f[p]]):g=p=1}}expandKey(e){let t=this.uint8ArrayToUint32Array_(e),s=!0,i=0;for(;i<t.length&&s;)s=t[i]===this.key[i],i++;if(s)return;this.key=t;let r=this.keySize=t.length;if(r!==4&&r!==6&&r!==8)throw new Error(`Invalid aes key size=`+r);let a=this.ksRows=(r+6+1)*4,o,c,l=this.keySchedule=new Uint32Array(a),h=this.invKeySchedule=new Uint32Array(a),u=this.sBox,d=this.rcon,f=this.invSubMix,g=f[0],p=f[1],y=f[2],E=f[3],T,S;for(o=0;o<a;o++){if(o<r){T=l[o]=t[o];continue}S=T,o%r===0?(S=S<<8|S>>>24,S=u[S>>>24]<<24|u[S>>>16&255]<<16|u[S>>>8&255]<<8|u[S&255],S^=d[o/r|0]<<24):r>6&&o%r===4&&(S=u[S>>>24]<<24|u[S>>>16&255]<<16|u[S>>>8&255]<<8|u[S&255]),l[o]=T=(l[o-r]^S)>>>0}for(c=0;c<a;c++)o=a-c,c&3?S=l[o]:S=l[o-4],c<4||o<=4?h[c]=S:h[c]=g[u[S>>>24]]^p[u[S>>>16&255]]^y[u[S>>>8&255]]^E[u[S&255]],h[c]=h[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,s){let i=this.keySize+6,r=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,c=o[0],l=o[1],h=o[2],u=o[3],d=this.uint8ArrayToUint32Array_(s),f=d[0],g=d[1],p=d[2],y=d[3],E=new Int32Array(e),T=new Int32Array(E.length),S,v,x,_,A,R,b,I,C,O,B,G,U,P,$=this.networkToHostOrderSwap;for(;t<E.length;){for(C=$(E[t]),O=$(E[t+1]),B=$(E[t+2]),G=$(E[t+3]),A=C^r[0],R=G^r[1],b=B^r[2],I=O^r[3],U=4,P=1;P<i;P++)S=c[A>>>24]^l[R>>16&255]^h[b>>8&255]^u[I&255]^r[U],v=c[R>>>24]^l[b>>16&255]^h[I>>8&255]^u[A&255]^r[U+1],x=c[b>>>24]^l[I>>16&255]^h[A>>8&255]^u[R&255]^r[U+2],_=c[I>>>24]^l[A>>16&255]^h[R>>8&255]^u[b&255]^r[U+3],A=S,R=v,b=x,I=_,U=U+4;S=a[A>>>24]<<24^a[R>>16&255]<<16^a[b>>8&255]<<8^a[I&255]^r[U],v=a[R>>>24]<<24^a[b>>16&255]<<16^a[I>>8&255]<<8^a[A&255]^r[U+1],x=a[b>>>24]<<24^a[I>>16&255]<<16^a[A>>8&255]<<8^a[R&255]^r[U+2],_=a[I>>>24]<<24^a[A>>16&255]<<16^a[R>>8&255]<<8^a[b&255]^r[U+3],T[t]=$(S^f),T[t+1]=$(_^g),T[t+2]=$(x^p),T[t+3]=$(v^y),f=C,g=O,p=B,y=G,t=t+4}return T.buffer}};var xi$2=class{constructor(e,t,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=s}expandKey(){let e=Ml$3(this.aesMode);return this.subtle.importKey(`raw`,this.key,{name:e},!1,[`encrypt`,`decrypt`])}};function Ml$3(n){switch(n){case ze$2.cbc:return`AES-CBC`;case ze$2.ctr:return`AES-CTR`;default:throw new Error(`[FastAESKey] invalid aes mode ${n}`)}}var Nl$3=16;var Mt$4=class{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{let s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(s){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){let{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;let s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Fl$3(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,s,i){return this.useSoftware?new Promise((r,a)=>{let o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,s,i);let c=this.flush();c?r(c.buffer):a(new Error(`[softwareDecrypt] Failed to decrypt data`))}):this.webCryptoDecrypt(new Uint8Array(e),t,s,i)}softwareDecrypt(e,t,s,i){let{currentIV:r,currentResult:a,remainderData:o}=this;if(i!==ze$2.cbc||t.byteLength!==16)return te$1.warn(`SoftwareDecrypt: can only handle AES-128-CBC`),null;this.logOnce(`JS AES decrypt`),o&&(e=De$1(o,e),this.remainderData=null);let c=this.getValidChunk(e);if(!c.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new vi$2),l.expandKey(t);let h=a;return this.currentResult=l.decrypt(c.buffer,0,s),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,s,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,i));this.key=t,this.fastAesKey=new xi$2(this.subtle,t,i)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce(`WebCrypto AES decrypt`),new Si$1(this.subtle,new Uint8Array(s),i).decrypt(e.buffer,r)):Promise.reject(new Error(`web crypto not initialized`))).catch(r=>(te$1.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,s,i)))}onWebCryptoError(e,t,s,i){let r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s,i);let a=this.flush();if(a)return a.buffer}throw new Error(`WebCrypto`+(r?` and softwareDecrypt`:``)+`: failed to decrypt data`)}getValidChunk(e){let t=e,s=e.length-e.length%Nl$3;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(te$1.log(`[decrypter]: ${e}`),this.logEnabled=!1)}};var pn$3=Math.pow(2,17);var Ai$2=class{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){let s=e.url;if(!s)return Promise.reject(new we$2({type:V$1.NETWORK_ERROR,details:L$2.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?`part list`:`url`}`),networkDetails:null}));this.abort();let i=this.config,r=i.fLoader,a=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(g=>g[0]===`GAP`)){c(En$2(e));return}else e.gap=!1;let l=this.loader=r?new r(i):new a(i),h=yn$3(e);e.loader=l;let u=gn$4(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn===`initSegment`?Infinity:pn$3};e.stats=l.stats;let f={onSuccess:(g,p,y,E)=>{this.resetLoader(e,l);let T=g.data;y.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(T.slice(0,16)),T=T.slice(16)),o({frag:e,part:null,payload:T,networkDetails:E})},onError:(g,p,y,E)=>{this.resetLoader(e,l),c(new we$2({type:V$1.NETWORK_ERROR,details:L$2.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ee$2({url:s,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:y,stats:E}))},onAbort:(g,p,y)=>{this.resetLoader(e,l),c(new we$2({type:V$1.NETWORK_ERROR,details:L$2.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error(`Aborted`),networkDetails:y,stats:g}))},onTimeout:(g,p,y)=>{this.resetLoader(e,l),c(new we$2({type:V$1.NETWORK_ERROR,details:L$2.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:y,stats:g}))}};t&&(f.onProgress=(g,p,y,E)=>t({frag:e,part:null,payload:y,networkDetails:E})),l.load(h,d,f)})}loadPart(e,t,s){this.abort();let i=this.config,r=i.fLoader,a=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(En$2(e,t));return}let l=this.loader=r?new r(i):new a(i),h=yn$3(e,t);e.loader=l;let u=gn$4(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:pn$3};t.stats=l.stats,l.load(h,d,{onSuccess:(f,g,p,y)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);let E={frag:e,part:t,payload:f.data,networkDetails:y};s(E),o(E)},onError:(f,g,p,y)=>{this.resetLoader(e,l),c(new we$2({type:V$1.NETWORK_ERROR,details:L$2.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ee$2({url:h.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:p,stats:y}))},onAbort:(f,g,p)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),c(new we$2({type:V$1.NETWORK_ERROR,details:L$2.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error(`Aborted`),networkDetails:p,stats:f}))},onTimeout:(f,g,p)=>{this.resetLoader(e,l),c(new we$2({type:V$1.NETWORK_ERROR,details:L$2.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:p,stats:f}))}})})}updateStatsFromPart(e,t){let s=e.stats,i=t.stats,r=i.total;if(s.loaded+=i.loaded,r){let c=Math.round(e.duration/t.duration),l=Math.min(Math.round(s.loaded/r),c),u=(c-l)*Math.round(s.loaded/l);s.total=s.loaded+u}else s.total=Math.max(s.loaded,s.total);let a=s.loading,o=i.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}};function yn$3(n,e=null){let t=e||n,s={frag:n,part:e,responseType:`arraybuffer`,url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(F$1(i)&&F$1(r)){var a;let o=i,c=r;if(n.sn===`initSegment`&&Bl$3((a=n.decryptdata)==null?void 0:a.method)){let l=r-i;l%16&&(c=r+(16-l%16)),i!==0&&(s.resetIV=!0,o=i-16)}s.rangeStart=o,s.rangeEnd=c}return s}function En$2(n,e){let t=new Error(`GAP ${n.gap?`tag`:`attribute`} found`),s={type:V$1.MEDIA_ERROR,details:L$2.FRAG_GAP,fatal:!1,frag:n,error:t,networkDetails:null};return e&&(s.part=e),(e||n).stats.aborted=!0,new we$2(s)}function Bl$3(n){return n===`AES-128`||n===`AES-256`}var we$2=class extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}};var Ss$3=class extends xe$2{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}};var Nt$3=class{constructor(e,t,s,i=0,r=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Xt$3(),this.buffering={audio:Xt$3(),video:Xt$3(),audiovideo:Xt$3()},this.level=e,this.sn=t,this.id=s,this.size=i,this.part=r,this.partial=a}};function Xt$3(){return{start:0,executeStart:0,executeEnd:0,end:0}}var Tn$2={length:0,start:()=>0,end:()=>0};var W$2=class n{static isBuffered(e,t){if(e){let s=n.getBuffered(e);for(let i=s.length;i--;)if(t>=s.start(i)&&t<=s.end(i))return!0}return!1}static bufferedRanges(e){if(e){let t=n.getBuffered(e);return n.timeRangesToArray(t)}return[]}static timeRangesToArray(e){let t=[];for(let s=0;s<e.length;s++)t.push({start:e.start(s),end:e.end(s)});return t}static bufferInfo(e,t,s){if(e){let i=n.bufferedRanges(e);if(i.length)return n.bufferedInfo(i,t,s)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,s){t=Math.max(0,t),e.length>1&&e.sort((h,u)=>h.start-u.start||u.end-h.end);let i=-1,r=[];if(s)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(i=h);let u=r.length;if(u){let d=r[u-1].end;e[h].start-d<s?e[h].end>d&&(r[u-1].end=e[h].end):r.push(e[h])}else r.push(e[h])}else r=e;let a=0,o,c=t,l=t;for(let h=0;h<r.length;h++){let u=r[h].start,d=r[h].end;if(i===-1&&t>=u&&t<=d&&(i=h),t+s>=u&&t<d)c=u,l=d,a=l-t;else if(t+s<u){o=u;break}}return{len:a,start:c||0,end:l||0,nextStart:o,buffered:e,bufferedIndex:i}}static getBuffered(e){try{return e.buffered||Tn$2}catch(t){return te$1.log(`failed to get media.buffered`,t),Tn$2}}};var Pa$2=/\{\$([a-zA-Z0-9-_]+)\}/g;function Sn$3(n){return Pa$2.test(n)}function Ii$2(n,e){if(n.variableList!==null||n.hasVariableRefs){let t=n.variableList;return e.replace(Pa$2,s=>{let i=s.substring(2,s.length-1),r=t?.[i];return r===void 0?(n.playlistParsingError||(n.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),s):r})}return e}function vn$2(n,e,t){let s=n.variableList;s||(n.variableList=s={});let i,r;if(`QUERYPARAM`in e){i=e.QUERYPARAM;try{let a=new self.URL(t).searchParams;if(a.has(i))r=a.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(a){n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else i=e.NAME,r=e.VALUE;i in s?n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=r||``}function Ul$2(n,e,t){let s=e.IMPORT;if(t&&s in t){let i=n.variableList;i||(n.variableList=i={}),i[s]=t[s]}else n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}var $l$3=/^(\d+)x(\d+)$/;var xn$3=/(.+?)=(".*?"|.*?)(?:,|$)/g;var ne$2=class n{constructor(e,t){typeof e==`string`&&(e=n.parseAttrList(e,t)),se$3(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)===`X-`)}decimalInteger(e){let t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?Infinity:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||`0x`).slice(2);t=(t.length&1?`0`:``)+t;let s=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)s[i]=parseInt(t.slice(i*2,i*2+2),16);return s}return null}hexadecimalIntegerAsNumber(e){let t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?Infinity:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){let s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){let s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((i,r)=>(i[r.toLowerCase()]=!0,i),t)}bool(e){return this[e]===`YES`}decimalResolution(e){let t=$l$3.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s,i={};for(xn$3.lastIndex=0;(s=xn$3.exec(e))!==null;){let a=s[1].trim(),o=s[2],c=o.indexOf(`"`)===0&&o.lastIndexOf(`"`)===o.length-1,l=!1;if(c)o=o.slice(1,-1);else switch(a){case`IV`:case`SCTE35-CMD`:case`SCTE35-IN`:case`SCTE35-OUT`:l=!0}if(t&&(c||l))o=Ii$2(t,o);else if(!l&&!c)switch(a){case`CLOSED-CAPTIONS`:if(o===`NONE`)break;case`ALLOWED-CPC`:case`CLASS`:case`ASSOC-LANGUAGE`:case`AUDIO`:case`BYTERANGE`:case`CHANNELS`:case`CHARACTERISTICS`:case`CODECS`:case`DATA-ID`:case`END-DATE`:case`GROUP-ID`:case`ID`:case`IMPORT`:case`INSTREAM-ID`:case`KEYFORMAT`:case`KEYFORMATVERSIONS`:case`LANGUAGE`:case`NAME`:case`PATHWAY-ID`:case`QUERYPARAM`:case`RECENTLY-REMOVED-DATERANGES`:case`SERVER-URI`:case`STABLE-RENDITION-ID`:case`STABLE-VARIANT-ID`:case`START-DATE`:case`SUBTITLES`:case`SUPPLEMENTAL-CODECS`:case`URI`:case`VALUE`:case`VIDEO`:case`X-ASSET-LIST`:case`X-ASSET-URI`:te$1.warn(`${e}: attribute ${a} is missing quotes`)}i[a]=o}return i}};var Gl$3=`com.apple.hls.interstitial`;function Kl$3(n){return n!==`ID`&&n!==`CLASS`&&n!==`CUE`&&n!==`START-DATE`&&n!==`DURATION`&&n!==`END-DATE`&&n!==`END-ON-NEXT`}function Vl$3(n){return n===`SCTE35-OUT`||n===`SCTE35-IN`||n===`SCTE35-CMD`}var vs$3=class{constructor(e,t,s=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(i=t?.tagOrder)!=null?i:s,t){let r=t.attr;for(let a in r)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==r[a]){te$1.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=se$3(new ne$2({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e[`START-DATE`]),`END-DATE`in this.attr){let r=t?.endDate||new Date(this.attr[`END-DATE`]);F$1(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){let e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?`CUE`:`X-CUE`,{pre:!1,post:!1,once:!1}):e}get startTime(){let{tagAnchor:e}=this;return e===null||e.programDateTime===null?(te$1.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){let e=this._endDate||this._dateAtEnd;if(e)return e;let t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if(`DURATION`in this.attr){let e=this.attr.decimalFloatingPoint(`DURATION`);if(F$1(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return`PLANNED-DURATION`in this.attr?this.attr.decimalFloatingPoint(`PLANNED-DURATION`):null}get endOnNext(){return this.attr.bool(`END-ON-NEXT`)}get isInterstitial(){return this.class===Gl$3}get isValid(){return!!this.id&&!this._badValueForSameId&&F$1(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||`X-ASSET-URI`in this.attr||`X-ASSET-LIST`in this.attr)}};var Hl$3=10;var Li$2=class{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8=``,this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 4,620 bytes, line 2397
2397StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}let t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let s=t.decryptdata;return s||(t.setKeyFormat(e.keyFormat),s=t.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?F$1(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Hl$3}get drift(){let e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){let e=this.partList;if(e){let t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){let e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}};function xs$3(n,e){return n.length===e.length?!n.some((t,s)=>t!==e[s]):!1}function An$1(n,e){return!n&&!e?!0:!n||!e?!1:xs$3(n,e)}function Tt$2(n){return n===`AES-128`||n===`AES-256`||n===`AES-256-CTR`}function Fr$2(n){switch(n){case`AES-128`:case`AES-256`:return ze$2.cbc;case`AES-256-CTR`:return ze$2.ctr;default:throw new Error(`invalid full segment method ${n}`)}}function Mr$3(n){return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function Ri$2(n){return Uint8Array.from(unescape(encodeURIComponent(n)),e=>e.charCodeAt(0))}function Yl$3(n){let e=Ri$2(n).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function ka$2(n){let e=function(s,i,r){let a=s[i];s[i]=s[r],s[r]=a};e(n,0,3),e(n,1,2),e(n,4,5),e(n,6,7)}function wa$2(n){let e=n.split(`:`),t=null;if(e[0]===`data`&&e.length===2){let s=e[1].split(`;`),i=s[s.length-1].split(`,`);if(i.length===2){let r=i[0]===`base64`,a=i[1];r?(s.splice(-1,1),t=Mr$3(a)):t=Yl$3(a)}}return t}var As$2=typeof self<`u`?self:void 0;var ae$3={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.fps`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`com.widevine.alpha`};var me$2={CLEARKEY:`org.w3.clearkey`,FAIRPLAY:`com.apple.streamingkeydelivery`,PLAYREADY:`com.microsoft.playready`,WIDEVINE:`urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed`};function os$3(n){switch(n){case me$2.FAIRPLAY:return ae$3.FAIRPLAY;case me$2.PLAYREADY:return ae$3.PLAYREADY;case me$2.WIDEVINE:return ae$3.WIDEVINE;case me$2.CLEARKEY:return ae$3.CLEARKEY}}function Ys$3(n){switch(n){case ae$3.FAIRPLAY:return me$2.FAIRPLAY;case ae$3.PLAYREADY:return me$2.PLAYREADY;case ae$3.WIDEVINE:return me$2.WIDEVINE;case ae$3.CLEARKEY:return me$2.CLEARKEY}}function _t$5(n){let{drmSystems:e,widevineLicenseUrl:t}=n,s=e?[ae$3.FAIRPLAY,ae$3.WIDEVINE,ae$3.PLAYREADY,ae$3.CLEARKEY].filter(i=>!!e[i]):[];return!s[ae$3.WIDEVINE]&&t&&s.push(ae$3.WIDEVINE),s}var Oa$2=(function(n){return As$2!=null&&(n=As$2.navigator)!=null&&n.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function Wl$3(n,e,t,s){let i;switch(n){case ae$3.FAIRPLAY:i=[`cenc`,`sinf`];break;case ae$3.WIDEVINE:case ae$3.PLAYREADY:i=[`cenc`];break;case ae$3.CLEARKEY:i=[`cenc`,`keyids`];break;default:throw new Error(`Unknown key-system: ${n}`)}return ql$3(i,e,t,s)}function ql$3(n,e,t,s){return[{initDataTypes:n,persistentState:s.persistentState||`optional`,distinctiveIdentifier:s.distinctiveIdentifier||`optional`,sessionTypes:s.sessionTypes||[s.sessionType||`temporary`],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}
2397`,robustness:s.audioRobustness||``,encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:s.videoRobustness||``,encryptionScheme:s.videoEncryptionScheme||null}))}]}function jl$3(n){var e;return!!n&&(n.sessionType===`persistent-license`||!!((e=n.sessionTypes)!=null&&e.some(t=>t===`persistent-license`)))}function Fa$2(n){let e=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),s=t.substring(t.indexOf(`<`),t.length),a=new DOMParser().parseFromString(s,`text/xml`).getElementsByTagName(`KID`)[0];if(a){let o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute(`VALUE`);if(o){let c=Mr$3(o).subarray(0,16);return ka$2(c),c}}return null}var ht$4={};var At$2=class n{static clearKeyUriToKeyIdMap(){ht$4={}}static setKeyIdForUri(e,t){ht$4[e]=t}static addKeyIdForUri(e){let t=Object.keys(ht$4).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,t),ht$4[e]=s,s}constructor(e,t,s,i=[1],r=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=i,this.iv=r,this.encrypted=e?e!==`NONE`:!1,this.isCommonEncryption=this.encrypted&&!Tt$2(e),a!=null&&a.startsWith(`0x`)&&(this.keyId=new Uint8Array(da$2(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&xs$3(e.keyFormatVersions,this.keyFormatVersions)&&An$1(e.iv,this.iv)&&An$1(e.keyId,this.keyId)}isSupported(){if(this.method){if(Tt$2(this.method)||this.method===`NONE`)return!0;if(this.keyFormat===`identity`)return this.method===`SAMPLE-AES`;switch(this.keyFormat){case me$2.FAIRPLAY:case me$2.WIDEVINE:case me$2.PLAYREADY:case me$2.CLEARKEY:return[`SAMPLE-AES`,`SAMPLE-AES-CENC`,`SAMPLE-AES-CTR`].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Tt$2(this.method)){let r=this.iv;return r||(typeof e!=`number`&&(te$1.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),r=zl$3(e)),new n(this.method,this.uri,`identity`,this.keyFormatVersions,r)}if(this.keyId){let r=ht$4[this.uri];if(r&&!xs$3(this.keyId,r)&&n.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}let s=wa$2(this.uri);if(s)switch(this.keyFormat){case me$2.WIDEVINE:if(this.pssh=s,!this.keyId){let r=ol$3(s.buffer);if(r.length){var i;let a=r[0];this.keyId=(i=a.kids)!=null&&i.length?a.kids[0]:null}}this.keyId||(this.keyId=In$3(t));break;case me$2.PLAYREADY:{let r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=al$3(r,null,s),this.keyId=Fa$2(s);break}default:{let r=s.subarray(0,16);if(r.length!==16){let a=new Uint8Array(16);a.set(r,16-r.length),r=a}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r;r=Xl$3(t),r||(r=In$3(t),r||(r=ht$4[this.uri])),r&&(this.keyId=r,n.setKeyIdForUri(this.uri,r))}return this}};function Xl$3(n){let e=n?.[me$2.WIDEVINE];return e?e.keyId:null}function In$3(n){let e=n?.[me$2.PLAYREADY];if(e){let t=wa$2(e.uri);if(t)return Fa$2(t)}return null}function zl$3(n){let e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=n>>8*(15-t)&255;return e}var Ln$2=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g;var Rn$3=/#EXT-X-MEDIA:(.*)/g;var Ql$3=/^#EXT(?:INF|-X-TARGETDURATION):/m;var Ws$3=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join(`|`),`g`);var Zl$3=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join(`|`));var it$1=class n{static findGroup(e,t){for(let s=0;s<e.length;s++){let i=e[s];if(i.id===t)return i}}static resolve(e,t){return Cr$3.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Ql$3.test(e)}static parseMasterPlaylist(e,t){let i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Sn$3(e)},r=[];if(Ln$2.lastIndex=0,!e.startsWith(`#EXTM3U`))return i.playlistParsingError=new Error(`no EXTM3U delimiter`),i;let a;for(;(a=Ln$2.exec(e))!=null;)if(a[1]){var o;let l=new ne$2(a[1],i),h=Ii$2(i,a[2]),u={attrs:l,bitrate:l.decimalInteger(`BANDWIDTH`)||l.decimalInteger(`AVERAGE-BANDWIDTH`),name:l.NAME,url:n.resolve(h,t)},d=l.decimalResolution(`RESOLUTION`);d&&(u.width=d.width,u.height=d.height),Dn$2(l.CODECS,u);let f=l[`SUPPLEMENTAL-CODECS`];f&&(u.supplemental={},Dn$2(f,u.supplemental)),(o=u.unknownCodecs)!=null&&o.length||r.push(u),i.levels.push(u)}else if(a[3]){let l=a[3],h=a[4];switch(l){case`SESSION-DATA`:{let u=new ne$2(h,i),d=u[`DATA-ID`];d&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[d]=u);break}case`SESSION-KEY`:{let u=bn$3(h,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):te$1.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case`DEFINE`:vn$2(i,new ne$2(h,i),t);break;case`CONTENT-STEERING`:{let u=new ne$2(h,i);i.contentSteering={uri:n.resolve(u[`SERVER-URI`],t),pathwayId:u[`PATHWAY-ID`]||`.`};break}case`START`:i.startTimeOffset=_n$3(h);break}}return i.levels=r.length>0&&r.length<i.levels.length?r:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error(`no levels found in manifest`)),i}static parseMasterPlaylistMedia(e,t,s){let i,r={},a=s.levels,o={AUDIO:a.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec}
vendor: 8,187 bytes, line 2397
2397)),SUBTITLES:a.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]},c=0;for(Rn$3.lastIndex=0;(i=Rn$3.exec(e))!==null;){let l=new ne$2(i[1],s),h=l.TYPE;if(h){let u=o[h],d=r[h]||[];r[h]=d;let f=l.LANGUAGE,g=l[`ASSOC-LANGUAGE`],p=l.CHANNELS,y=l.CHARACTERISTICS,E=l[`INSTREAM-ID`],T={attrs:l,bitrate:0,id:c++,groupId:l[`GROUP-ID`]||``,name:l.NAME||f||``,type:h,default:l.bool(`DEFAULT`),autoselect:l.bool(`AUTOSELECT`),forced:l.bool(`FORCED`),lang:f,url:l.URI?n.resolve(l.URI,t):``};if(g&&(T.assocLang=g),p&&(T.channels=p),y&&(T.characteristics=y),E&&(T.instreamId=E),u!=null&&u.length){let S=n.findGroup(u,T.groupId)||u[0];Cn$2(T,S,`audioCodec`),Cn$2(T,S,`textCodec`)}d.push(T)}}return r}static parseLevelPlaylist(e,t,s,i,r,a){var o;let c={url:t},l=new Li$2(t),h=l.fragments,u=[],d=null,f=0,g=0,p=0,y=0,E=0,T=null,S=new Dt$3(i,c),v,x,_,A=-1,R=!1,b=null,I;if(Ws$3.lastIndex=0,l.m3u8=e,l.hasVariableRefs=Sn$3(e),((o=Ws$3.exec(e))==null?void 0:o[0])!==`#EXTM3U`)return l.playlistParsingError=new Error(`Missing format identifier #EXTM3U`),l;for(;(v=Ws$3.exec(e))!==null;){R&&(R=!1,S=new Dt$3(i,c),S.playlistOffset=p,S.setStart(p),S.sn=f,S.cc=y,E&&(S.bitrate=E),S.level=s,d&&(S.initSegment=d,d.rawProgramDateTime&&(S.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null),b&&(S.setByteRange(b),b=null)));let G=v[1];if(G){S.duration=parseFloat(G);let U=(` `+v[2]).slice(1);S.title=U||null,S.tagList.push(U?[`INF`,G,U]:[`INF`,G])}else if(v[3]){if(F$1(S.duration)){S.playlistOffset=p,S.setStart(p),_&&kn$3(S,_,l),S.sn=f,S.level=s,S.cc=y,h.push(S);let U=(` `+v[3]).slice(1);S.relurl=Ii$2(l,U),bi$1(S,T,u),T=S,p+=S.duration,f++,g=0,R=!0}}else{if(v=v[0].match(Zl$3),!v){te$1.warn(`No matches on slow regex match for level playlist!`);continue}for(x=1;x<v.length&&v[x]===void 0;x++);let U=(` `+v[x]).slice(1),P=(` `+v[x+1]).slice(1),$=v[x+2]?(` `+v[x+2]).slice(1):null;switch(U){case`BYTERANGE`:T?S.setByteRange(P,T):S.setByteRange(P);break;case`PROGRAM-DATE-TIME`:S.rawProgramDateTime=P,S.tagList.push([`PROGRAM-DATE-TIME`,P]),A===-1&&(A=h.length);break;case`PLAYLIST-TYPE`:l.type&&Ge$1(l,U,v),l.type=P.toUpperCase();break;case`MEDIA-SEQUENCE`:l.startSN!==0?Ge$1(l,U,v):h.length>0&&wn$3(l,U,v),f=l.startSN=parseInt(P);break;case`SKIP`:{l.skippedSegments&&Ge$1(l,U,v);let M=new ne$2(P,l),K=M.decimalInteger(`SKIPPED-SEGMENTS`);if(F$1(K)){l.skippedSegments+=K;for(let k=K;k--;)h.push(null);f+=K}let H=M.enumeratedString(`RECENTLY-REMOVED-DATERANGES`);H&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(H.split(` `)));break}case`TARGETDURATION`:l.targetduration!==0&&Ge$1(l,U,v),l.targetduration=Math.max(parseInt(P),1);break;case`VERSION`:l.version!==null&&Ge$1(l,U,v),l.version=parseInt(P);break;case`INDEPENDENT-SEGMENTS`:break;case`ENDLIST`:l.live||Ge$1(l,U,v),l.live=!1;break;case`#`:(P||$)&&S.tagList.push($?[P,$]:[P]);break;case`DISCONTINUITY`:y++,S.tagList.push([`DIS`]);break;case`GAP`:S.gap=!0,S.tagList.push([U]);break;case`BITRATE`:S.tagList.push([U,P]),E=parseInt(P)*1e3,F$1(E)?S.bitrate=E:E=0;break;case`DATERANGE`:{let M=new ne$2(P,l),K=new vs$3(M,l.dateRanges[M.ID],l.dateRangeTagCount);l.dateRangeTagCount++,K.isValid||l.skippedSegments?l.dateRanges[K.id]=K:te$1.warn(`Ignoring invalid DATERANGE tag: "${P}"`),S.tagList.push([`EXT-X-DATERANGE`,P]);break}case`DEFINE`:{let M=new ne$2(P,l);`IMPORT`in M?Ul$2(l,M,a):vn$2(l,M,t)}break;case`DISCONTINUITY-SEQUENCE`:l.startCC!==0?Ge$1(l,U,v):h.length>0&&wn$3(l,U,v),l.startCC=y=parseInt(P);break;case`KEY`:{let M=bn$3(P,t,l);if(M.isSupported()){if(M.method===`NONE`){_=void 0;break}_||(_={});let K=_[M.keyFormat];K!=null&&K.matches(M)||(K&&(_=se$3({},_)),_[M.keyFormat]=M)}else te$1.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${P}"`);break}case`START`:l.startTimeOffset=_n$3(P);break;case`MAP`:{let M=new ne$2(P,l);if(S.duration){let K=new Dt$3(i,c);Pn$3(K,M,s,_),d=K,S.initSegment=d,d.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=d.rawProgramDateTime)}else{let K=S.byteRangeEndOffset;if(K){let H=S.byteRangeStartOffset;b=`${K-H}@${H}`}else b=null;Pn$3(S,M,s,_),d=S,R=!0}d.cc=y;break}case`SERVER-CONTROL`:I&&Ge$1(l,U,v),I=new ne$2(P),l.canBlockReload=I.bool(`CAN-BLOCK-RELOAD`),l.canSkipUntil=I.optionalFloat(`CAN-SKIP-UNTIL`,0),l.canSkipDateRanges=l.canSkipUntil>0&&I.bool(`CAN-SKIP-DATERANGES`),l.partHoldBack=I.optionalFloat(`PART-HOLD-BACK`,0),l.holdBack=I.optionalFloat(`HOLD-BACK`,0);break;case`PART-INF`:l.partTarget&&Ge$1(l,U,v);l.partTarget=new ne$2(P).decimalFloatingPoint(`PART-TARGET`);break;case`PART`:{let M=l.partList;M||(M=l.partList=[]);let K=g>0?M[M.length-1]:void 0,H=g++,w=new fi$2(new ne$2(P,l),S,c,H,K);M.push(w),S.duration+=w.duration;break}case`PRELOAD-HINT`:l.preloadHint=new ne$2(P,l);break;case`RENDITION-REPORT`:{let M=new ne$2(P,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(M);break}default:te$1.warn(`line parsed but not handled: ${v}`);break}}}T&&!T.relurl?(h.pop(),p-=T.duration,l.partList&&(l.fragmentHint=T)):l.partList&&(bi$1(S,T,u),S.cc=y,l.fragmentHint=S,_&&kn$3(S,_,l)),l.targetduration||(l.playlistParsingError=new Error(`Missing Target Duration`));let C=h.length,O=h[0],B=h[C-1];if(p+=l.skippedSegments*l.targetduration,p>0&&C&&B){l.averagetargetduration=p/C;let G=B.sn;l.endSN=G!==`initSegment`?G:0,l.live||(B.endList=!0),A>0&&(ec$3(h,A),O&&u.unshift(O))}return l.fragmentHint&&(p+=l.fragmentHint.duration),l.totalduration=p,u.length&&l.dateRangeTagCount&&O&&Ma$2(u,l),l.endCC=y,l}};function Ma$2(n,e){let t=n.length;if(!t)if(e.hasProgramDateTime){let o=e.fragments[e.fragments.length-1];n.push(o),t++}else return;let s=n[t-1],i=e.live?Infinity:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){let c=e.dateRanges[r[o]],l=c.startDate.getTime();c.tagAnchor=s.ref;for(let h=t;h--;){var a;if(((a=n[h])==null?void 0:a.sn)<e.startSN)break;let u=Jl$3(e,l,n,h,i);if(u!==-1){c.tagAnchor=e.fragments[u].ref;break}}}}function Jl$3(n,e,t,s,i){let r=t[s];if(r){let o=r.programDateTime;if(e>=o||s===0){var a;if(e<=o+((((a=t[s+1])==null?void 0:a.start)||i)-r.start)*1e3){let l=t[s].sn-n.startSN;if(l<0)return-1;let h=n.fragments;if(h.length>t.length){let d=(t[s+1]||h[h.length-1]).sn-n.startSN;for(let f=d;f>l;f--){let g=h[f].programDateTime;if(e>=g&&e<g+h[f].duration*1e3)return f}}return l}}}return-1}function bn$3(n,e,t){var s,i;let r=new ne$2(n,t),a=(s=r.METHOD)!=null?s:``,o=r.URI,c=r.hexadecimalInteger(`IV`),l=r.KEYFORMATVERSIONS,h=(i=r.KEYFORMAT)!=null?i:`identity`;o&&r.IV&&!c&&te$1.error(`Invalid IV: ${r.IV}`);return new At$2(a,o?it$1.resolve(o,e):``,h,(l||`1`).split(`/`).map(Number).filter(Number.isFinite),c,r.KEYID)}function _n$3(n){let t=new ne$2(n).decimalFloatingPoint(`TIME-OFFSET`);return F$1(t)?t:null}function Dn$2(n,e){let t=(n||``).split(/[ ,]+/).filter(s=>s);[`video`,`audio`,`text`].forEach(s=>{let i=t.filter(r=>kr$2(r,s));i.length&&(e[`${s}Codec`]=i.map(r=>r.split(`/`)[0]).join(`,`),t=t.filter(r=>i.indexOf(r)===-1))}),e.unknownCodecs=t}function Cn$2(n,e,t){let s=e[t];s&&(n[t]=s)}function ec$3(n,e){let t=n[e];for(let s=e;s--;){let i=n[s];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function bi$1(n,e,t){n.rawProgramDateTime?t.push(n):e!=null&&e.programDateTime&&(n.programDateTime=e.endProgramDateTime)}function Pn$3(n,e,t,s){n.relurl=e.URI,e.BYTERANGE&&n.setByteRange(e.BYTERANGE),n.level=t,n.sn=`initSegment`,s&&(n.levelkeys=s),n.initSegment=null}function kn$3(n,e,t){n.levelkeys=e;let{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&s.push(n)}function Ge$1(n,e,t){n.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function wn$3(n,e,t){n.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function qs$3(n,e){let t=e.startPTS;if(F$1(t)){let s=0,i;e.sn>n.sn?(s=t-n.start,i=n):(s=n.start-t,i=e),i.duration!==s&&i.setDuration(s)}else e.sn>n.sn?n.cc===e.cc&&n.minEndPTS?e.setStart(n.start+(n.minEndPTS-n.start)):e.setStart(n.start+n.duration):e.setStart(Math.max(n.start-e.duration,0))}function Na$2(n,e,t,s,i,r,a){s-t<=0&&(a.warn(`Fragment should have a positive duration`,e),s=t
vendor: 1,913 bytes, line 2397
2397+e.duration,r=i+e.duration);let c=t,l=s,h=e.startPTS,u=e.endPTS;if(F$1(h)){let E=Math.abs(h-t);n&&E>n.totalduration?a.warn(`media timestamps and playlist times differ by ${E}s for level ${e.level} ${n.url}`):F$1(e.deltaPTS)?e.deltaPTS=Math.max(E,e.deltaPTS):e.deltaPTS=E,c=Math.max(t,h),t=Math.min(t,h),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,l=Math.min(s,u),s=Math.max(s,u),r=e.endDTS!==void 0?Math.max(r,e.endDTS):r}let d=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=i,e.endPTS=s,e.minEndPTS=l,e.endDTS=r;let f=e.sn;if(!n||f<n.startSN||f>n.endSN)return 0;let g,p=f-n.startSN,y=n.fragments;for(y[p]=e,g=p;g>0;g--)qs$3(y[g],y[g-1]);for(g=p;g<y.length-1;g++)qs$3(y[g],y[g+1]);return n.fragmentHint&&qs$3(y[y.length-1],n.fragmentHint),n.PTSKnown=n.alignedSliding=!0,d}function tc$3(n,e,t){if(n===e)return;let s=null,i=n.fragments;for(let h=i.length-1;h>=0;h--){let u=i[h].initSegment;if(u){s=u;break}}n.fragmentHint&&delete n.fragmentHint.endPTS;let r;rc$3(n,e,(h,u,d,f)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==h.cc){let g=h.cc-u.cc;for(let p=d;p<f.length;p++)f[p].cc+=g;e.endCC=f[f.length-1].cc}F$1(h.startPTS)&&F$1(h.endPTS)&&(u.setStart(u.startPTS=h.startPTS),u.startDTS=h.startDTS,u.maxStartPTS=h.maxStartPTS,u.endPTS=h.endPTS,u.endDTS=h.endDTS,u.minEndPTS=h.minEndPTS,u.setDuration(h.endPTS-h.startPTS),u.duration&&(r=u),e.PTSKnown=e.alignedSliding=!0),h.hasStreams&&(u.elementaryStreams=h.elementaryStreams),u.loader=h.loader,h.hasStats&&(u.stats=h.stats),h.initSegment&&(u.initSegment=h.initSegment,s=h.initSegment)});let a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(s&&o.forEach(h=>{var u;h&&(!h.initSegment||h.initSegment.relurl===((u=s)==null?void 0:u.relurl))&&(h.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(h=>!h),e.deltaUpdateFailed){t.warn(`[level-helper] Previous playlist missing segments ski
2397pped in delta playlist`);for(let h=e.skippedSegments;h--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=sc$3(n.dateRanges,e,t));let h=n.fragments.filter(u=>u.rawProgramDateTime);if(n.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u<o.length;u++)o[u].programDateTime===null&&bi$1(o[u],o[u-1],h);Ma$2(h,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var c;e.startCC=(c=$a$2(n,e.startSN-1)?.cc)!=null?c:a[0].cc}ic$3(n.partList,e.partList,(h,u)=>{u.elementaryStreams=h.elementaryStreams,u.stats=h.stats}),r?Na$2(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,t):Ba$2(n,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=n.driftStartTime,e.driftStart=n.driftStart;let l=e.advancedDateTime;if(e.advanced&&l){let h=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=h),e.driftEndTime=l,e.driftEnd=h}else e.driftEndTime=n.driftEndTime,e.driftEnd=n.driftEnd,e.advancedDateTime=n.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=n.requestScheduled)}function sc$3(n,e,t){let{dateRanges:s,recentlyRemovedDateranges:i}=e,r=se$3({},n);i&&i.forEach(c=>{delete r[c]});let o=Object.keys(r).length;return o?(Object.keys(s).forEach(c=>{let l=r[c],h=new vs$3(s[c].attr,l);h.isValid?(r[c]=h,l||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${re$1(s[c].attr)}"`)}),r):s}function ic$3(n,e,t){if(n&&e){let s=0;for(let i=0,r=n.length;i<r;i++){let a=n[i],o=e[i+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--}}}function rc$3(n,e,t){var s;let i=e.skippedSegments,r=Math.max(n.startSN,e.startSN)-e.startSN,a=(n.fragmentHint?1:0)+(i?e.endSN:Math.min(n.endSN,e.endSN))-e.startSN,o=e.startSN-n.startSN,c=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=(s=n.fragmentHint)!=null&&s.duration?n.fragments.concat(n.fragmentHint):n.fragments;for(let h=r;h<=a;h++){let u=l[o+h],d=c[h];if(i&&!d&&u&&(d=e.fragments[h]=u),u&&d){t(u,d,h,c);let f=u.relurl,g=d.relurl;if(f&&nc$3(f,g)){e.playlistParsingError=On$3(`media sequence mismatch ${d.sn}:`,n,e,u,d);return}else if(u.cc!==d.cc){e.playlistParsingError=On$3(`discontinuity sequence mismatch (${u.cc}!=${d.cc})`,n,e,u,d);return}}}}function On$3(n,e,t,s,i){return new Error(`${n} ${i.url} 2398Playlist starting @${e.startSN} 2399${e.m3u8} 2400 2401Playlist starting @${t.startSN} 2402${t.m3u8}`)}function Ba$2(n,e,t=!0){let s=e.startSN+e.skippedSegments-n.startSN,i=n.fragments,r=s>=0,a=0;if(r&&s<i.length)a=i[s].start;else if(r&&e.startSN===n.endSN+1)a=n.fragmentEnd;else if(r&&t)a=n.fragmentStart+s*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=n.fragmentStart;else return;_i$2(e,a)}function _i$2(n,e){if(e){let t=n.fragments;for(let s=n.skippedSegments;s<t.length;s++)t[s].addStart(e);n.fragmentHint&&n.fragmentHint.addStart(e)}}function Ua$2(n,e=Infinity){let t=1e3*n.targetduration;if(n.updated){let s=n.fragments;if(s.length&&t*4>e){let r=s[s.length-1].duration*1e3;r<t&&(t=r)}}else t/=2;return Math.round(t)}function $a$2(n,e,t){if(!n)return null;let s=n.fragments[e-n.startSN];return s||(s=n.fragmentHint,s&&s.sn===e)?s:e<n.startSN&&t&&t.sn===e?t:null}function Fn$2(n,e,t){return n?Ga$1(n.partList,e,t):null}function Ga$1(n,e,t){if(n)for(let s=n.length;s--;){let i=n[s];if(i.index===t&&i.fragment.sn===e)return i}return null}function Ka$1(n){n.forEach((e,t)=>{var s;(s=e.details)==null||s.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function nc$3(n,e){return n!==e&&e?Mn$3(n)!==Mn$3(e):!1}function Mn$3(n){return n.replace(/\?[^?]*$/,``)}function Ct$2(n,e){for(let s=0,i=n.length;s<i;s++){var t;if(((t=n[s])==null?void 0:t.cc)===e)return n[s]}return null}function ac$3(n,e){return!!(n&&e.startCC<n.endCC&&e.endCC>n.startCC)}function Nn$3(n,e){let t=n.start+e;n.startPTS=t,n.setStart(t),n.endPTS=t+n.duration}function Va$2(n,e){let t=e.fragments;for(let s=0,i=t.length;s<i;s++)Nn$3(t[s],n);e.fragmentHint&&Nn$3(e.fragmentHint,n),e.alignedSliding=!0}function oc$3(n,e){n&&(Ha$1(e,n),e.alignedSliding||Is$2(e,n),!e.alignedSliding&&!e.skippedSegments&&Ba$2(n,e,!1))}function Ha$1(n,e){if(!ac$3(e,n))return;let t=Math.min(e.endCC,n.endCC),s=Ct$2(e.fragments,t),i=Ct$2(n.fragments,t);
2402if(!s||!i)return;te$1.log(`Aligning playlist at start of dicontinuity sequence ${t}`);Va$2(s.start-i.start,n)}function Is$2(n,e){if(!n.hasProgramDateTime||!e.hasProgramDateTime)return;let t=n.fragments,s=e.fragments;if(!t.length||!s.length)return;let i,r,a=Math.min(e.endCC,n.endCC);e.startCC<a&&n.startCC<a&&(i=Ct$2(s,a),r=Ct$2(t,a)),(!i||!r)&&(i=s[Math.floor(s.length/2)],r=Ct$2(t,i.cc)||t[Math.floor(t.length/2)]);let o=i.programDateTime,c=r.programDateTime;if(!o||!c)return;Va$2((c-o)/1e3-(r.start-i.start),n)}function Te$3(n,e,t){ve$3(n,e,t),n.addEventListener(e,t)}function ve$3(n,e,t){n.removeEventListener(e,t)}var lc$3={toString:function(n){let e=``,t=n.length;for(let s=0;s<t;s++)e+=`[${n.start(s).toFixed(3)}-${n.end(s).toFixed(3)}]`;return e}};var D$3={STOPPED:`STOPPED`,IDLE:`IDLE`,KEY_LOADING:`KEY_LOADING`,FRAG_LOADING:`FRAG_LOADING`,FRAG_LOADING_WAITING_RETRY:`FRAG_LOADING_WAITING_RETRY`,WAITING_TRACK:`WAITING_TRACK`,PARSING:`PARSING`,PARSED:`PARSED`,ENDED:`ENDED`,ERROR:`ERROR`,WAITING_INIT_PTS:`WAITING_INIT_PTS`,WAITING_LEVEL:`WAITING_LEVEL`};var Bt$3=class extends Ss$3{constructor(e,t,s,i,r){super(i,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=D$3.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{let{config:a,fragCurrent:o,media:c,mediaBuffer:l,state:h}=this,u=c?c.currentTime:0,d=W$2.bufferInfo(l||c,u,a.maxBufferHole),f=!d.len;if(this.log(`Media seeking to ${F$1(u)?u.toFixed(3):u}, state: ${h}, ${f?`out of`:`in`} buffer`),this.state===D$3.ENDED)this.resetLoadingState();else if(o){let g=a.maxFragLookUpTolerance,p=o.start-g,y=o.start+o.duration+g;if(f||y<d.start||p>d.end){let E=u>y;(u<p||E)&&(E&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(u,Infinity,this.playlistType,!0);if(u>this.lastCurrentTime&&(this.lastCurrentTime=u),!this.loadingParts){let p=Math.max(d.end,u),y=this.shouldLoadParts(this.getLevelDetails(),p);y&&(this.log(`LL-Part loading ON after seeking to ${u.toFixed(2)} with buffer @${p.toFixed(2)}`),this.loadingParts=y)}}this.hls.hasEnoughToStart||(this.log(`Setting ${f?`startPosition`:`nextLoadPosition`} to ${u} for seek without enough to start`),this.nextLoadPosition=u,f&&(this.startPosition=u)),f&&this.state===D$3.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log(`setting startPosition to 0 because media ended`),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new Ai$2(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Mt$4(e.config)}registerListeners(){let{hls:e}=this;
vendor: 4,194 bytes, line 2402
2402e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===D$3.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);let e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=D$3.STOPPED}get startPositionValue(){let{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;let s=e.end||0,i=this.config.timelineOffset||0;if(s<=i)return!1;let r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=W$2.bufferedInfo(r,e.start,0));let a=e.nextStart;if(a&&a>i&&a<t.edge||this.media.currentTime<e.start)return!1;let c=t.partList;if(c!=null&&c.length){let h=c[c.length-1];return W$2.isBuffered(this.media,h.start+h.duration/2)}let l=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(l)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){let e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){let s=this.media=this.mediaBuffer=t.media;Te$3(s,`seeking`,this.onMediaSeeking),Te$3(s,`ended`,this.onMediaEnded);let i=this.config;this.levels&&i.autoStartLoad&&this.state===D$3.STOPPED&&this.startLoad(i.startPosition)}onMediaDetaching(e,t){let s=!!t.transferMedia,i=this.media;if(i!==null){if(i.ended&&(this.log(`MSE detaching and video ended, reset startPosition`),this.startPosition=this.lastCurrentTime=0),ve$3(i,`seeking`,this.onMediaSeeking),ve$3(i,`ended`,this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=D$3.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,s){this.startFragRequested=!0,this._loadFragForPlayback(e,t,s)}_loadFragForPlayback(e,t,s){let i=r=>{let a=r.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${r.part?` part: `+r.part.index:``} of ${this.fragInfo(a,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,s,i).then(r=>{if(!r)return;let a=this.state,o=r.frag;if(this.fragContextChanged(o)){(a===D$3.FRAG_LOADING||!this.fragCurrent&&a===D$3.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=D$3.IDLE);return}`payload`in r&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(m.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}
vendor: 5,641 bytes, line 2402
2402).catch(r=>{this.state===D$3.STOPPED||this.state===D$3.ERROR||(this.warn(`Frag error: ${r?.message||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;let{fragmentTracker:s}=this;if(s.getState(e)===he$2.APPENDING){let r=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,r),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===he$2.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){let t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){let t=e.details;return t?.live&&t.type!==`EVENT`&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;let i={startOffset:e,endOffset:t,type:s};this.hls.trigger(m.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{let i=s?.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error(`init load aborted`);return s}).then(s=>{let{hls:i}=this,{frag:r,payload:a}=s,o=r.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&Tt$2(o.method)){let c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,Fr$2(o.method)).catch(l=>{throw i.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:r}),l}).then(l=>{let h=self.performance.now();return i.trigger(m.FRAG_DECRYPTED,{frag:r,payload:l,stats:{tstart:c,tdecrypt:h}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===D$3.STOPPED||this.state===D$3.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){let{levels:t}=this;if(!t)throw new Error(`init load aborted, missing levels`);let s=e.frag.stats;this.state!==D$3.STOPPED&&(this.state=D$3.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var s,i;let r=e.tracks;if(r&&!t.encrypted&&((s=r.audio)!=null&&s.encrypted||(i=r.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){let a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?`attached mediaKeys: `+a.mediaKeys:`detached`})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(m.ERROR,{type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){let{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){let s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?` part: `+t.index:``} of ${this.fragInfo(e,!1,t)} > buffer:${s?lc$3.toString(W$2.getBuffered(s)):`(detached)`})`),le$4(e)){var i;if(e.type!==N$1.SUBTITLE){let a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=D$3.IDLE;return}}let r=(i=this.levels)==null?void 0:i[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=D$3.IDLE}_handleFragmentLoadComplete(e){let{transmuxer:t}=this;if(!t)return;let{frag:s,part:i,partsLoaded:r}=e,a=!r||r.length===0||r.some(c=>!c),o=new Nt$3(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,i){var r;this.fragCurrent=e;let a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?``:` detail`}s`);let o=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=D$3.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(m.KEY_LOADED,d),this.state===D$3.KEY_LOADING&&(this.state=D$3.IDLE),d}),this.hls.trigger(m.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log(`context changed in KEY_LOADING`),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log(`[eme] blocking frag load until media-keys acquired`));let c=this.fragPrevious;if(le$4(e)&&(!c||e.sn!==c.sn)){let d=this.shouldLoadParts(t.details,e.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?`ON`:`OFF`} loading sn ${c?.sn}->${e.sn}`),this.loadingParts=d)}if(s=Math.max(e.start,s||0),this.loadingParts&&le$4(e)){let d=a.partList;if(d&&i){s>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);let f=this.getNextPart(d,e,s);if(f>-1){let g=d[f];e=this.fragCurrent=g.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${g.index} (${f}/${d.length-1}) of ${this.fragInfo(e,!1,g)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=g.start+g.duration,this.state=D$3.FRAG_LOADING;let p;return o?p=o.then(y=>!y||this.fragContextChanged(y.frag)?null:this.doFragPartsLoad(e,g,t,i)).catch(y=>this.handleFragLoadError(y)):p=this.doFragPartsLoad(e,g,t,i).catch(y=>this.handleFragLoadError(y)),this.hls.trigger(m.FRAG_LOADING,{frag:e,part:g,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error(`frag load aborted, context changed in FRAG_LOADING parts`)):p}
2402else if(!e.url||this.loadedEndOfParts(d,s))return Promise.resolve(null)}}if(le$4(e)&&this.loadingParts){var l;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(l=a.partList)==null?void 0:l.filter(d=>d.loaded).map(d=>`[${d.start}-${d.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${`[`+a.startSN+`-`+a.endSN+`]`}, target: ${parseFloat(s.toFixed(3))}`),F$1(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=D$3.FRAG_LOADING;let h=this.config.progressive&&e.type!==N$1.SUBTITLE,u;return h&&o?u=o.then(d=>!d||this.fragContextChanged(d.frag)?null:this.fragmentLoader.load(e,i)).catch(d=>this.handleFragLoadError(d)):u=Promise.all([this.fragmentLoader.load(e,h?i:void 0),o]).then(([d])=>(!h&&i&&i(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(m.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error(`frag load aborted, context changed in FRAG_LOADING`)):u}doFragPartsLoad(e,t,s,i){return new Promise((r,a)=>{var o;let c=[],l=(o=s.details)==null?void 0:o.partList,h=u=>{this.fragmentLoader.loadPart(e,u,i).then(d=>{c[u.index]=d;let f=d.part;this.hls.trigger(m.FRAG_LOADED,d);let g=Fn$2(s.details,e.sn,u.index+1)||Ga$1(l,e.sn,u.index+1);if(g)h(g);else return r({frag:e,part:f,partsLoaded:c})}).catch(a)};h(t)})}handleFragLoadError(e){if(`data`in e){let t=e.data;t.frag&&t.details===L$2.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===V$1.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(m.ERROR,t)}else this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){let t=this.getCurrentContext(e);if(!t||this.state!==D$3.PARSING){!this.fragCurrent&&this.state!==D$3.STOPPED&&this.state!==D$3.ERROR&&(this.state=D$3.IDLE);return}let{frag:s,part:i,level:r}=t,a=self.performance.now();s.stats.parsing.end=a,i&&(i.stats.parsing.end=a);let o=this.getLevelDetails(),l=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);l!==this.loadingParts&&(this.log(`LL-Part loading ${l?`ON`:`OFF`} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=l),this.updateLevelTiming(s,i,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var s;let r=e.partList[0];if(r.fragment.type===N$1.SUBTITLE)return!1;if(t>=r.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0)){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){let{levels:t,fragCurrent:s}=this,{level:i,sn:r,part:a}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;let o=t[i],c=o.details,l=a>-1?Fn$2(c,r,a):null,h=l?l.fragment:$a$2(c,r,s);return h?(s&&s!==h&&(h.stats=s.stats),{frag:h,part:l,level:o}):null}bufferFragmentData(e,t,s,i,r){if(this.state!==D$3.PARSING)return;let{data1:a,data2:o}=e,c=a;if(o&&(c=De$1(a,o)),!c.length)return;let l=this.initPTS[t.cc],h=l?-l.baseTime/l.timescale:void 0,u={type:e.type,frag:t,part:s,chunkMeta:i,offset:h,parent:t.type,data:c};if(this.hls.trigger(m.BUFFER_APPENDING,u),e.dropped&&e.independent&&!s){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){let t=this.media;if(!t)return;if(!W$2.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}let s=t.currentTime,i=W$2.bufferInfo(t,s,0),r=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),o=Math.max(Math.min(e.start-a,i.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var s;let i=this.getLoadPosition();if(!F$1(i))return null;let a=this.lastCurrentTime>i||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,a)}getFwdBufferInfoAtPos(e,t,s,i){let r=W$2.bufferInfo(e,t,i);if(r.len===0&&r.nextStart!==void 0){let a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&(r.nextStart<=a.end||a.gap)){let o=Math.max(Math.min(r.nextStart,a.end)-t,i);return W$2.bufferInfo(e,t,o)}}return r}
2402getMaxBufferLength(e){let{config:t}=this,s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}exceedsMaxBuffer(e,t,s){let i=e.nextStart;if(i&&s.start>i){let r=e.buffered;if(r){let a=e.len,o=e.bufferedIndex;for(let c=r.length-1;c>o;c--)r[c].start<s.start&&(a+=r[c].end-r[c].start);return a>=t}}return!1}reduceMaxBufferLength(e,t){let s=this.config,i=Math.max(Math.min(e-t,s.maxBufferLength),t),r=Math.max(e-t*3,s.maxMaxBufferLength/2,i);return r>=i?(s.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=N$1.MAIN){let s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return s&&`fragment`in s?s.fragment:s}getNextFragment(e,t){let s=t.fragments,i=s.length;if(!i)return null;let{config:r}=this,a=t.fragmentStart,o=r.lowLatencyMode&&!!t.partList,c=null;if(t.live){let u=r.initialLiveManifestSize;if(i<u)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${u})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var l;o&&!this.loadingParts&&(this.log(`LL-Part loading ON for initial live fragment`),this.loadingParts=!0),c=this.getInitialLiveFragment(t);let d=this.config.startPosition,f=this.hls.startPosition,g=this.hls.liveSyncPosition,p=((l=c)==null?void 0:l.start)||0,y,E;f!==-1&&f>=a?(y=f,E=f===d?`config`:`next load start`):g!==null?(y=g,E=`live edge`):(y=e,E=`buffer pos`),y<p&&(y=p,E=`live frag start`),y<a&&(y=a,E=`playlist start`),(this.startPosition!=y||this.nextLoadPosition!=y)&&(this.log(`Setting startPosition to ${y.toFixed(3)} ${f===-1?``:`(from ${d}) `}based on ${E}. live edge: ${g} live frag start: ${p.toFixed(3)} playlist start: ${a.toFixed(3)} buffer pos: ${e}`),this.startPosition=this.nextLoadPosition=y)}}else e<=a&&(c=s[0]);if(!c){let u=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,u,t)}let h=this.filterReplacedPrimary(c,t);if(!h&&c){let u=c.sn-t.startSN;h=this.filterReplacedPrimary(s[u+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){if(this.nextLoadPosition<=t)return!1;let s=this.fragmentTracker.getState(e);return s===he$2.OK||s===he$2.PARTIAL&&!!e.gap}getNextFragmentLoopLoading(e,t,s,i,r){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&s.nextStart)){let o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i,0);if(o!==null&&s.len+o.len>=r){let c=a.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(Bn$2(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Bn$2(this.config)&&e.type!==N$1.SUBTITLE){let s=this.hls.interstitialsManager,i=s?.bufferingItem;if(i){let a=i.event;if(a){if(a.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&t?.live===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}let r=s?.playerQueue;if(r)for(let a=r.length;a--;){let o=r[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let i=-1,r=!1,a=!0;for(let o=0,c=e.length;o<c;o++){let l=e[o];if(a=a&&!l.independent,i>-1&&s<l.start)break;let h=l.loaded;h?i=-1:(r||(l.independent||a)&&l.fragment===t)&&(l.fragment!==t&&this.warn(`Need buffer at ${s} but next unloaded part starts at ${l.start}`),i=o),r=h}return i}loadedEndOfParts(e,t){let s;for(let i=e.length;i--;){if(s=e[i],!s.loaded)return!1;if(t>s.start)return!0}return!1}getInitialLiveFragment(e){let t=e.fragments,s=this.fragPrevious,i=null;if(s){if(e.hasProgramDateTime&&(i=Pl$3(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance),i&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`)),!i){let r=s.sn+1;if(r>=e.startSN&&r<=e.endSN){let a=t[r-e.startSN];s.cc===a.cc&&(i=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=_a$2(e,s.cc,s.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{let r=this.hls.liveSyncPosition;r!==null&&(i=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,s){let{config:i}=this,{fragPrevious:r}=this,{fragments:a,endSN:o}=s,{fragmentHint:c}=s,{maxFragLookUpTolerance:l}=i,h=s.partList,u=!!(this.loadingParts&&h!=null&&h.length&&c);u&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(a=a.concat(c),o=c.sn);let d;if(e<t){var f;let p=e<this.lastCurrentTime||e>t-l||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:l;d=ot$3(r,a,e,p)}else d=a[a.length-1];if(d){let g=d.sn-s.startSN,p=this.fragmentTracker.getState(d);
2402if((p===he$2.OK||p===he$2.PARTIAL&&d.gap)&&(r=d),r&&d.sn===r.sn&&(!u||h[0].fragment.sn>d.sn||!s.live)&&d.level===r.level){let E=a[g+1];d.sn<o&&this.fragmentTracker.getState(E)!==he$2.OK?d=E:d=null}}return d}alignPlaylists(e,t,s){let i=e.fragments.length;if(!i)return this.warn(`No fragments in live playlist`),0;let r=e.fragmentStart,a=!t,o=e.alignedSliding&&F$1(r);if(a||!o&&!r){oc$3(s,e);let c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:`na`}->${e.startSN} fragments: ${i}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;s<t&&(s=-1);let i=this.timelineOffset;if(s===-1){let r=this.startTimeOffset!==null,a=r?this.startTimeOffset:e.startTimeOffset;a!==null&&F$1(a)?(s=t+a,a<0&&(s+=e.edge),s=Math.min(Math.max(t,s),t+e.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${a} found in ${r?`multivariant`:`media`} playlist`),this.startPosition=s):e.live?(s=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log(`setting startPosition to 0 by default`),this.startPosition=s=0),this.lastCurrentTime=s+i}this.nextLoadPosition=s+i}getLoadPosition(){var e;let{media:t}=this,s=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?s=t.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&le$4(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?` part `+t.index:``} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==D$3.FRAG_LOADING_WAITING_RETRY)&&(this.state=D$3.IDLE)}onFragmentOrKeyLoadError(e,t){var s;if(t.chunkMeta&&!t.frag){let E=this.getCurrentContext(t.chunkMeta);E&&(t.frag=E.frag)}let i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}let a=t.details===L$2.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(i,!0);let o=t.errorAction;if(!o){this.state=D$3.ERROR;return}let{action:c,flags:l,retryCount:h=0,retryConfig:u}=o,d=!!u,f=d&&c===de$2.RetryRequest,g=d&&!o.resolved&&l===Ae$2.MoveAllAlternatesMatchingHost,p=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!f&&g&&le$4(i)&&!i.endList&&p&&!Ca$2(t))this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((f||g)&&h<u.maxNumRetry){var y;let E=yi$2((y=t.response)==null?void 0:y.code),T=Or$2(u,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+T,this.state=D$3.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,E){this.log(`Waiting for connection (offline)`),this.retryDate=Infinity,t.reason=`offline`;return}this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${h+1}/${u.maxNumRetry} in ${T}ms`)}else if(u)if(this.resetFragmentErrors(e),h<u.maxNumRetry)!a&&c!==de$2.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${h})`);return}else c===de$2.SendAlternateToPenaltyBox?this.state=D$3.WAITING_LEVEL:this.state=D$3.ERROR;this.tickImmediate()}checkRetryDate(){let e=self.performance.now(),t=this.retryDate,s=t===Infinity;(!t||e>=t||s&&!yi$2(0))&&(s&&this.log(`Connection restored (online)`),this.resetStartWhenNotLoaded(),this.state=D$3.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===D$3.PARSING||this.state===D$3.PARSED){let t=e.frag,s=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,s),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len,t?.duration||10);let a=!r;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===N$1.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==D$3.STOPPED&&(this.state=D$3.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;let i=W$2.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,s),this.state===D$3.ENDED&&this.resetLoadingState()}
vendor: 14,909 bytes, line 2402
2402resetLoadingState(){this.log(`Reset loading state`),this.fragCurrent=null,this.fragPrevious=null,this.state!==D$3.STOPPED&&(this.state=D$3.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;let e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log(`resetting startPosition for live start`),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?`<removed>`:e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,Infinity,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,i){let r=s.details;if(!r){this.warn(`level.details undefined`);return}if(!Object.keys(e.elementaryStreams).reduce((c,l)=>{let h=e.elementaryStreams[l];if(h){let u=h.endPTS-h.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${u})`),c||!1;let d=i?0:Na$2(r,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(m.LEVEL_PTS_UPDATED,{details:r,level:s,drift:d,type:l,frag:e,start:h.startPTS,end:h.endPTS}),!0}return c},!1)){var o;let c=((o=this.transmuxer)==null?void 0:o.error)===null;if((s.fragmentError===0||c&&(s.fragmentError<2||e.endList))&&this.treatAsGap(e,s),c){let l=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(l.message),this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=D$3.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?` part: `+t.index:``} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(m.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===N$1.MAIN?`level`:`track`}fragInfo(e,t=!0,s){var i,r;return`${this.playlistLabel()} ${e.level} (${s?`part`:`frag`}:[${((i=t&&!s?e.startPTS:(s||e).start)!=null?i:NaN).toFixed(3)}-${((r=t&&!s?e.endPTS:(s||e).end)!=null?r:NaN).toFixed(3)}]${s&&e.type===`main`?`INDEPENDENT=`+(s.independent?`YES`:`NO`):``}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event===`demuxerWorker`&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){let t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}};function Bn$2(n){return!!n.interstitialsController&&n.enableInterstitialPlayback!==!1}var Ls$2=class{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){let{chunks:e,dataLength:t}=this,s;if(e.length)e.length===1?s=e[0]:s=cc$3(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}};function cc$3(n,e){let t=new Uint8Array(e),s=0;for(let i=0;i<n.length;i++){let r=n[i];t.set(r,s),s+=r.length}return t}var js$3={exports:{}};var Un$2;function hc$3(){return Un$2||(Un$2=1,(function(n){var e=Object.prototype.hasOwnProperty,t=`~`;function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function i(c,l,h){this.fn=c,this.context=l,this.once=h||!1}function r(c,l,h,u,d){if(typeof h!=`function`)throw new TypeError(`The listener must be a function`);var f=new i(h,u||c,d),g=t?t+l:l;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],f]:c._events[g].push(f):(c._events[g]=f,c._eventsCount++),c}function a(c,l){--c._eventsCount===0?c._events=new s:delete c._events[l]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],h,u;if(this._eventsCount===0)return l;for(u in h=this._events)e.call(h,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(h)):l},o.prototype.listeners=function(l){var h=t?t+l:l,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,g=new Array(f);d<f;d++)g[d]=u[d].fn;return g},o.prototype.listenerCount=function(l){var h=t?t+l:l,u=this._events[h];return u?u.fn?1:u.length:0},o.prototype.emit=function(l,h,u,d,f,g){var p=t?t+l:l;if(!this._events[p])return!1;var y=this._events[p],E=arguments.length,T,S;if(y.fn){switch(y.once&&this.removeListener(l,y.fn,void 0,!0),E){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,h),!0;case 3:return y.fn.call(y.context,h,u),!0;case 4:return y.fn.call(y.context,h,u,d),!0;case 5:return y.fn.call(y.context,h,u,d,f),!0;case 6:return y.fn.call(y.context,h,u,d,f,g),!0}for(S=1,T=new Array(E-1);S<E;S++)T[S-1]=arguments[S];y.fn.apply(y.context,T)}else{var v=y.length,x;for(S=0;S<v;S++)switch(y[S].once&&this.removeListener(l,y[S].fn,void 0,!0),E){case 1:y[S].fn.call(y[S].context);break;case 2:y[S].fn.call(y[S].context,h);break;case 3:y[S].fn.call(y[S].context,h,u);break;case 4:y[S].fn.call(y[S].context,h,u,d);break;default:if(!T)for(x=1,T=new Array(E-1);x<E;x++)T[x-1]=arguments[x];y[S].fn.apply(y[S].context,T)}}return!0},o.prototype.on=function(l,h,u){return r(this,l,h,u,!1)},o.prototype.once=function(l,h,u){return r(this,l,h,u,!0)},o.prototype.removeListener=function(l,h,u,d){var f=t?t+l:l;if(!this._events[f])return this;if(!h)return a(this,f),this;var g=this._events[f];if(g.fn)g.fn===h&&(!d||g.once)&&(!u||g.context===u)&&a(this,f);else{for(var p=0,y=[],E=g.length;p<E;p++)(g[p].fn!==h||d&&!g[p].once||u&&g[p].context!==u)&&y.push(g[p]);y.length?this._events[f]=y.length===1?y[0]:y:a(this,f)}return this},o.prototype.removeAllListeners=function(l){var h;return l?(h=t?t+l:l,this._events[h]&&a(this,h)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,n.exports=o})(js$3)),js$3.exports}var Nr$3=Yo$3(hc$3());var Ut$4=`1.6.17`;var It$3={};function dc$3(){return typeof __HLS_WORKER_BUNDLE__==`function`}function fc$3(){let n=It$3[Ut$4];if(n)return n.clientCount++,n;let e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:`text/javascript`}),t=self.URL.createObjectURL(e),i={worker:new self.Worker(t),objectURL:t,clientCount:1};return It$3[Ut$4]=i,i}function gc$3(n){let e=It$3[n];if(e)return e.clientCount++,e;let t=new self.URL(n,self.location.href).href,i={worker:new self.Worker(t),scriptURL:t,clientCount:1};return It$3[n]=i,i}function mc$3(n){let e=It$3[n||Ut$4];if(e&&e.clientCount--===1){let{worker:s,objectURL:i}=e;delete It$3[n||Ut$4],i&&self.URL.revokeObjectURL(i),s.terminate()}}function Ya$1(n,e){return e+10<=n.length&&n[e]===51&&n[e+1]===68&&n[e+2]===73&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function Br$2(n,e){return e+10<=n.length&&n[e]===73&&n[e+1]===68&&n[e+2]===51&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function Bs$2(n,e){let t=0;return t=(n[e]&127)<<21,t|=(n[e+1]&127)<<14,t|=(n[e+2]&127)<<7,t|=n[e+3]&127,t}function $t$2(n,e){let t=e,s=0;for(;Br$2(n,e);){s+=10;let i=Bs$2(n,e+6);s+=i,Ya$1(n,e+10)&&(s+=10),e+=s}if(s>0)return n.subarray(t,t+s)}function pc$3(n,e,t,s){let i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[t+2],a=r>>2&15;if(a>12){let f=new Error(`invalid ADTS sampling index:${a}`);n.emit(m.ERROR,m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}let o=(r>>6&3)+1,c=e[t+3]>>6&3|(r&1)<<2,l=`mp4a.40.`+o,h=i[a],u=a;(o===5||o===29)&&(u-=3);let d=[o<<3|(u&14)>>1,(u&1)<<7|c<<3];return te$1.log(`manifest codec:${s}, parsed codec:${l}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${a})`),{config:d,samplerate:h,channelCount:c,codec:l,parsedCodec:l,manifestCodec:s}}function Wa$1(n,e){return n[e]===255&&(n[e+1]&246)===240}function qa(n,e){return n[e+1]&1?7:9}function Ur$2(n,e){return(n[e+3]&3)<<11|n[e+4]<<3|(n[e+5]&224)>>>5}function yc$3(n,e){return e+5<n.length}function Rs$2(n,e){return e+1<n.length&&Wa$1(n,e)}function Ec$3(n,e){return yc$3(n,e)&&Wa$1(n,e)&&Ur$2(n,e)<=n.length-e}function Tc$3(n,e){if(Rs$2(n,e)){let t=qa(n,e);if(e+t>=n.length)return!1;let s=Ur$2(n,e);if(s<=t)return!1;let i=e+s;return i===n.length||Rs$2(n,i)}return!1}function ja$2(n,e,t,s,i){if(!n.samplerate){let r=pc$3(e,t,s,i);if(!r)return;se$3(n,r)}}function Xa(n){return 1024*9e4/n}function Sc$3(n,e){let t=qa(n,e);if(e+t<=n.length){let s=Ur$2(n,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function za$2(n,e,t,s,i){let a=s+i*Xa(n.samplerate),o=Sc$3(e,t),c;if(o){let{frameLength:u,headerLength:d}=o,f=d+u,g=Math.max(0,t+f-e.length);g?(c=new Uint8Array(f-d),c.set(e.subarray(t+d,e.length),0)):c=e.subarray(t+d,t+f);let p={unit:c,pts:a};return g||n.samples.push(p),{sample:p,length:f,missing:g}}let l=e.length-t;return c=new Uint8Array(l),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:a},length:l,missing:-1}}function vc$3(n,e){return Br$2(n,e)&&Bs$2(n,e+6)+10<=n.length-e}function xc$3(n){return n instanceof ArrayBuffer?n:n.byteOffset==0&&n.byteLength==n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function Xs$3(n,e=0,t=Infinity){return Ac$3(n,e,t,Uint8Array)}function Ac$3(n,e,t,s){let i=Ic$3(n),r=1;`BYTES_PER_ELEMENT`in s&&(r=s.BYTES_PER_ELEMENT);let a=Lc$3(n)?n.byteOffset:0,o=(a+n.byteLength)/r,c=(a+e)/r,l=Math.floor(Math.max(0,Math.min(c,o)));return new s(i,l,Math.floor(Math.min(l+Math.max(t,0),o))-l)}function Ic$3(n){return n instanceof ArrayBuffer?n:n.buffer}function Lc$3(n){return n&&n.buffer instanceof ArrayBuffer&&n.byteLength!==void 0&&n.byteOffset!==void 0}function Rc$3(n){let e={key:n.type,description:``,data:``,mimeType:null,pictureType:null},t=3;if(n.size<2)return;if(n.data[0]!==t){console.log(`Ignore frame with unrecognized character encoding`);return}let s=n.data.subarray(1).indexOf(0);if(s===-1)return;let i=Re$1(Xs$3(n.data,1,s)),r=n.data[2+s],a=n.data.subarray(3+s).indexOf(0);if(a===-1)return;let o=Re$1(Xs$3(n.data,3+s,a)),c;return i===`-->`?c=Re$1(Xs$3(n.data,4+s+a)):c=xc$3(n.data.subarray(4+s+a)),e.mimeType=i,e.pictureType=r,e.description=o,e.data=c,e}function bc$3(n){if(n.size<2)return;let e=Re$1(n.data,!0),t=new Uint8Array(n.data.subarray(e.length+1));return{key:n.type,info:e,data:t.buffer}}function _c$3(n){if(n.size<2)return;if(n.type===`TXXX`){let t=1,s=Re$1(n.data.subarray(t),!0);t+=s.length+1;let i=Re$1(n.data.subarray(t));return{key:n.type,info:s,data:i}}let e=Re$1(n.data.subarray(1));return{key:n.type,info:``,data:e}}function Dc$3(n){if(n.type===`WXXX`){if(n.size<2)return;let t=1,s=Re$1(n.data.subarray(t),!0);t+=s.length+1;let i=Re$1(n.data.subarray(t));return{key:n.type,info:s,data:i}}let e=Re$1(n.data);return{key:n.type,info:``,data:e}}function Cc$3(n){return n.type===`PRIV`?bc$3(n):n.type[0]===`W`?Dc$3(n):n.type===`APIC`?Rc$3(n):_c$3(n)}function Pc$3(n){let e=String.fromCharCode(n[0],n[1],n[2],n[3]),t=Bs$2(n,4),s=10;return{type:e,size:t,data:n.subarray(s,s+t)}}var zt$3=10;var kc$3=10;function Qa$2(n){let e=0,t=[];for(;Br$2(n,e);){let s=Bs$2(n,e+6);n[e+5]>>6&1&&(e+=zt$3),e+=zt$3;let i=e+s;for(;e+kc$3<i;){let r=Pc$3(n.subarray(e)),a=Cc$3(r);a&&t.push(a),e+=r.size+zt$3}Ya$1(n,e)&&(e+=zt$3)}return t}function Za$1(n){return n&&n.key===`PRIV`&&n.info===`com.apple.streaming.transportStreamTimestamp`}function wc$3(n){if(n.data.byteLength===8){let e=new Uint8Array(n.data),t=e[3]&1,s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=47721858.84),Math.round(s)}}function $r$3(n){let e=Qa$2(n);for(let t=0;t<e.length;t++){let s=e[t];if(Za$1(s))return wc$3(s)}}var Le$2=(function(n){return n.audioId3=`org.id3`,n.dateRange=`com.apple.quicktime.HLS`,n.emsg=`https://aomedia.org/emsg/ID3`,n.misbklv=`urn:misb:KLV:bin:1910.1`,n})({});function Be$1(n=``,e=9e4){return{type:n,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}var Gt$3=class{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,s,i){this._id3Track={type:`id3`,id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,s){}demux(e,t){this.cachedData&&(e=De$1(this.cachedData,e),this.cachedData=null);let s=$t$2(e,0),i=s?s.length:0,r,a=this._audioTrack,o=this._id3Track,c=s?$r$3(s):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&F$1(c))&&(this.basePTS=Oc$3(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Le$2.audioId3,duration:Number.POSITIVE_INFINITY});i<l;){if(this.canParse(e,i)){let h=this.appendFrame(a,e,i);h?(this.frameIndex++,this.lastPTS=h.sample.pts,i+=h.length,r=i):i=l}else vc$3(e,i)?(s=$t$2(e,i),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Le$2.audioId3,duration:Number.POSITIVE_INFINITY}),i+=s.length,r=i):i++;if(i===l&&r!==l){let h=e.slice(r);this.cachedData?this.cachedData=De$1(this.cachedData,h):this.cachedData=h}}return{audioTrack:a,videoTrack:Be$1(),id3Track:o,textTrack:Be$1()}}demuxSampleAes(e,t,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){let t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Be$1(),id3Track:this._id3Track,textTrack:Be$1()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}};var Oc$3=(n,e,t)=>{if(F$1(n))return n*90;let s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};var Qt$2=null;var Fc$3=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160];var Mc$2=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3];var Nc$3=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]];var Bc$3=[0,1,1,4];function Ja$2(n,e,t,s,i){if(t+24>e.length)return;let r=eo$2(e,t);if(r&&t+r.frameLength<=e.length){let o=s+i*(r.samplesPerFrame*9e4/r.sampleRate),c={unit:e.subarray(t,t+r.frameLength),pts:o,dts:o};return n.config=[],n.channelCount=r.channelCount,n.samplerate=r.sampleRate,n.samples.push(c),{sample:c,length:r.frameLength,missing:0}}}function eo$2(n,e){let t=n[e+1]>>
vendor: 5,044 bytes, line 2402
24023&3,s=n[e+1]>>1&3,i=n[e+2]>>4&15,r=n[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&r!==3){let a=n[e+2]>>1&1,o=n[e+3]>>6,l=Fc$3[(t===3?3-s:s===3?3:4)*14+i-1]*1e3,u=Mc$2[(t===3?0:t===2?1:2)*3+r],d=o===3?1:2,f=Nc$3[t][s],g=Bc$3[s],p=f*8*g,y=Math.floor(f*l/u+a)*g;if(Qt$2===null){let S=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);Qt$2=S?parseInt(S[1]):0}return Qt$2&&Qt$2<=87&&s===2&&l>=224e3&&o===0&&(n[e+3]=n[e+3]|128),{sampleRate:u,channelCount:d,frameLength:y,samplesPerFrame:p}}}function Gr$3(n,e){return n[e]===255&&(n[e+1]&224)===224&&(n[e+1]&6)!==0}function to$2(n,e){return e+1<n.length&&Gr$3(n,e)}function Uc$3(n,e){return Gr$3(n,e)&&4<=n.length-e}function so$2(n,e){if(e+1<n.length&&Gr$3(n,e)){let s=eo$2(n,e),i=4;s!=null&&s.frameLength&&(i=s.frameLength);let r=e+i;return r===n.length||to$2(n,r)}return!1}var Di$2=class extends Gt$3{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:`audio/adts`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`aac`,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;let i=$t$2(e,0)?.length||0;if(so$2(e,i))return!1;for(let r=e.length;i<r;i++)if(Tc$3(e,i))return t.log(`ADTS sync word found !`),!0;return!1}canParse(e,t){return Ec$3(e,t)}appendFrame(e,t,s){ja$2(e,this.observer,t,s,e.manifestCodec);let i=za$2(e,t,s,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}};var io$2=(n,e)=>{let t=0,s=5;e+=s;let i=new Uint32Array(1),r=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=n[e];let o=Math.min(s,8),c=8-o;r[0]=4278190080>>>24+c<<c,i[0]=(a[0]&r[0])>>c,t=t?t<<o|i[0]:i[0],e+=1,s-=o}return t};var Ci$2=class extends Gt$3{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:`audio/ac-3`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`ac3`,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,s){let i=ro$2(e,t,s,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;let t=$t$2(e,0);if(!t)return!1;let s=t.length;return e[s]===11&&e[s+1]===119&&$r$3(t)!==void 0&&io$2(e,s)<16}};function ro$2(n,e,t,s,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;let r=e[t+4]>>6;if(r>=3)return-1;let o=[48e3,44100,32e3][r],c=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+r]*2;if(t+h>e.length)return-1;let u=e[t+6]>>5,d=0;u===2?d+=2:(u&1&&u!==1&&(d+=2),u&4&&(d+=2));let f=(e[t+6]<<8|e[t+7])>>12-d&1,p=[2,1,2,3,3,4,4,5][u]+f,y=e[t+5]>>3,E=e[t+5]&7,T=new Uint8Array([r<<6|y<<1|E>>2,(E&3)<<6|u<<3|f<<2|c>>4,c<<4&224]),v=s+i*(1536/o*9e4),x=e.subarray(t,t+h);return n.config=T,n.channelCount=p,n.samplerate=o,n.samples.push({unit:x,pts:v}),h}var Pi$2=class extends Gt$3{resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:`audio/mpeg`,type:`audio`,id:2,pid:-1,sequenceNumber:0,segmentCodec:`mp3`,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=$t$2(e,0),s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&$r$3(t)!==void 0&&io$2(e,s)<=16)return!1;for(let i=e.length;s<i;s++)if(so$2(e,s))return te$1.log(`MPEG Audio sync word found !`),!0;return!1}canParse(e,t){return Uc$3(e,t)}appendFrame(e,t,s){if(this.basePTS!==null)return Ja$2(e,t,s,this.basePTS,this.frameIndex)}};var $c$3=/\/emsg[-/]ID3/i;var ki$2=class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,s,i){let r=this.videoTrack=Be$1(`video`,1),a=this.audioTrack=Be$1(`audio`,1),o=this.txtTrack=Be$1(`text`,1);if(this.id3Track=Be$1(`id3`,1),this.timeOffset=0,!(e!=null&&e.byteLength))return;let c=ya$2(e);if(c.video){let{id:l,timescale:h,codec:u,supplemental:d}=c.video;r.id=l,r.timescale=o.timescale=h,r.codec=u,r.supplemental=d}if(c.audio){let{id:l,timescale:h,codec:u}=c.audio;a.id=l,a.timescale=h,a.codec=u}o.id=ga$2.text,r.sampleDuration=0,r.duration=a.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return Xo$3(e)}demux(e,t){this.timeOffset=t;let s=e,i=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=De$1(this.remainderData,e));let o=sl$3(s);this.remainderData=o.remainder,i.samples=o.valid||new Uint8Array}else i.samples=s;let a=this.extractID3Track(i,t);
vendor: 23,711 bytes, line 2402
2402return r.samples=rn$3(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){let e=this.timeOffset,t=this.videoTrack,s=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;let i=this.extractID3Track(t,this.timeOffset);return s.samples=rn$3(e,t),{videoTrack:t,audioTrack:Be$1(),id3Track:i,textTrack:Be$1()}}extractID3Track(e,t){let s=this.id3Track;if(e.samples.length){let i=X$2(e.samples,[`emsg`]);i&&i.forEach(r=>{let a=rl$3(r);if($c$3.test(a.schemeIdUri)){let o=$n$2(a,t),c=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);let l=a.payload;s.samples.push({data:l,len:l.byteLength,dts:o,pts:o,type:Le$2.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith(`urn:misb:KLV:bin:1910.1`)){let o=$n$2(a,t);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:Le$2.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error(`The MP4 demuxer does not support SAMPLE-AES decryption`))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}};function $n$2(n,e){return F$1(n.presentationTime)?n.presentationTime/n.timeScale:e+n.presentationTimeDelta/n.timeScale}var wi$2=class{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new Mt$4(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,ze$2.cbc)}decryptAacSample(e,t,s){let i=e[t].unit;if(i.length<=16)return;let r=i.subarray(16,i.length-i.length%16),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(a).then(o=>{let c=new Uint8Array(o);i.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)}).catch(s)}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){let t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t),i=0;for(let r=32;r<e.length-16;r+=160,i+=16)s.set(e.subarray(r,r+16),i);return s}getAvcDecryptedUnit(e,t){let s=new Uint8Array(t),i=0;for(let r=32;r<e.length-16;r+=160,i+=16)e.set(s.subarray(i,i+16),r);return e}decryptAvcSample(e,t,s,i,r){let a=Sa$2(r.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(c=>{r.data=this.getAvcDecryptedUnit(a,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,i)}).catch(i)}decryptAvcSamples(e,t,s,i){if(e instanceof Uint8Array)throw new Error(`Cannot decrypt samples of type Uint8Array`);for(;;t++,s=0){if(t>=e.length){i();return}let r=e[t].units;for(;!(s>=r.length);s++){let a=r[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,i,a),!this.decrypter.isSync()))return}}}};var bs$3=class{constructor(){this.VideoSample=null}createVideoSample(e,t,s){return{key:e,frame:!1,pts:t,dts:s,units:[],length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,i;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){let r=s.units;i=r[r.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){let s=t.samples,i=s.length;if(i){let r=s[i-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,s){let i=t.byteLength,r=e.naluState||0,a=r,o=[],c=0,l,h,u,d=-1,f=0;for(r===-1&&(d=0,f=this.getNALuType(t,0),r=0,c=1);c<i;){if(l=t[c++],!r){r=l?0:1;continue}if(r===1){r=l?0:2;continue}if(!l)r=3;else if(l===1){if(h=c-r-1,d>=0){let g={data:t.subarray(d,h),type:f};o.push(g)}else{let g=this.getLastNalUnit(e.samples);g&&(a&&c<=4-a&&g.state&&(g.data=g.data.subarray(0,g.data.byteLength-a)),h>0&&(g.data=De$1(g.data,t.subarray(0,h)),g.state=0))}c<i?(u=this.getNALuType(t,c),d=c,f=u,r=0):r=-1}else r=0}if(d>=0&&r>=0){let g={data:t.subarray(d,i),type:f,state:r};o.push(g)}if(o.length===0){let g=this.getLastNalUnit(e.samples);g&&(g.data=De$1(g.data,t))}return e.naluState=r,o}};var nt$2=class{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){let e=this.data,t=this.bytesAvailable,s=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error(`no bytes available`);i.set(e.subarray(s,s+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e),s=this.word>>>32-t;if(e>32&&te$1.error(`Cannot read more than 32 bits at a time`),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error(`no bits available`);return t=e-t,t>0&&this.bitsAvailable?s<<t|this.readBits(t):s}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){let e=this.skipLZ();return this.readBits(e+1)-1}readEG(){let e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}};var Oi$2=class extends bs$3{parsePES(e,t,s,i){let r=this.parseNALu(e,s.data,i),a=this.VideoSample,o,c=!1;s.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(l=>{var h,u;switch(l.type){case 1:{let p=!1;o=!0;let y=l.data;if(c&&y.length>4){let E=this.readSliceType(y);(E===2||E===4||E===7||E===9)&&(p=!0)}if(p){var d;(d=a)!=null&&d.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.frame=!0,a.key=p;break}case 5:o=!0,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 6:o=!0,Pr$3(l.data,1,s.pts,t.samples);break;case 7:{var f,g;o=!0,c=!0;let p=l.data,y=this.readSPS(p);if(!e.sps||e.width!==y.width||e.height!==y.height||((f=e.pixelRatio)==null?void 0:f[0])!==y.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[p];let E=p.subarray(1,4),T=`avc1.`;for(let S=0;S<3;S++){let v=E[S].toString(16);v.length<2&&(v=`0`+v),T+=v}e.codec=T}break}case 8:o=!0,e.pps=[l.data];break;case 9:o=!0,e.audFound=!0,(u=a)!=null&&u.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(l)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){let t=new nt$2(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let s=8,i=8,r;for(let a=0;a<e;a++)i!==0&&(r=t.readEG(),i=(s+r+256)%256),s=i===0?s:i}readSPS(e){let t=new nt$2(e),s=0,i=0,r=0,a=0,o,c,l,h=t.readUByte.bind(t),u=t.readBits.bind(t),d=t.readUEG.bind(t),f=t.readBoolean.bind(t),g=t.skipBits.bind(t),p=t.skipEG.bind(t),y=t.skipUEG.bind(t),E=this.skipScalingList.bind(this);h();let T=h();if(u(5),g(3),h(),y(),T===100||T===110||T===122||T===244||T===44||T===83||T===86||T===118||T===128){let R=d();if(R===3&&g(1),y(),y(),g(1),f())for(c=R!==3?8:12,l=0;l<c;l++)f()&&(l<6?E(16,t):E(64,t))}y();let S=d();if(S===0)d();else if(S===1)for(g(1),p(),p(),o=d(),l=0;l<o;l++)p();y(),g(1);let v=d(),x=d(),_=u(1);_===0&&g(1),g(1),f()&&(s=d(),i=d(),r=d(),a=d());let A=[1,1];if(f()&&f())switch(h()){case 1:A=[1,1];break;case 2:A=[12,11];break;case 3:A=[10,11];break;case 4:A=[16,11];break;case 5:A=[40,33];break;case 6:A=[24,11];break;case 7:A=[20,11];break;case 8:A=[32,11];break;case 9:A=[80,33];break;case 10:A=[18,11];break;case 11:A=[15,11];break;case 12:A=[64,33];break;case 13:A=[160,99];break;case 14:A=[4,3];break;case 15:A=[3,2];break;case 16:A=[2,1];break;case 255:A=[h()<<8|h(),h()<<8|h()];break}return{width:Math.ceil((v+1)*16-s*2-i*2),height:(2-_)*(x+1)*16-(_?2:4)*(r+a),pixelRatio:A}}};var Fi$2=class extends bs$3{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,s,i){let r=this.parseNALu(e,s.data,i),a=this.VideoSample,o,c=!1;s.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(l=>{var h,u;switch(l.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var d;(d=a)!=null&&d.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 39:o=!0,Pr$3(l.data,2,s.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!=`object`&&(e.params={}),e.params=se$3(e.params,this.readVPS(l.data)),this.initVPS=l.data),e.vps=[l.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],l.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){let f=this.readSPS(l.data);e.width=f.width,e.height=f.height,e.pixelRatio=f.pixelRatio,e.codec=f.codecString,e.sps=[],typeof e.params!=`object`&&(e.params={});for(let g in f.params)e.params[g]=f.params[g]}this.pushParameterSet(e.sps,l.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0;break;case 34:if(o=!0,typeof e.params==`object`){if(!e.pps){e.pps=[];let f=this.readPPS(l.data);for(let g in f)e.params[g]=f[g]}this.pushParameterSet(e.pps,l.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(u=a)!=null&&u.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:o=!1;break}a&&o&&a.units.push(l)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){let t=new Uint8Array(e.byteLength),s=0;for(let i=0;i<e.byteLength;i++)i>=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[s]=e[i],s++);return new Uint8Array(t.buffer,0,s)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){let t=new nt$2(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);let s=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:i}}readSPS(e){let t=new nt$2(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);let s=t.readBits(3);t.readBoolean();let i=t.readBits(2),r=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),c=t.readUByte(),l=t.readUByte(),h=t.readUByte(),u=t.readUByte(),d=t.readUByte(),f=t.readUByte(),g=t.readUByte(),p=t.readUByte(),y=t.readUByte(),E=t.readUByte(),T=[],S=[];for(let Z=0;Z<s;Z++)T.push(t.readBoolean()),S.push(t.readBoolean());if(s>0)for(let Z=s;Z<8;Z++)t.readBits(2);for(let Z=0;Z<s;Z++)T[Z]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),S[Z]&&t.readUByte();t.readUEG();let v=t.readUEG();v==3&&t.skipBits(1);let x=t.readUEG(),_=t.readUEG(),A=t.readBoolean(),R=0,b=0,I=0,C=0;A&&(R+=t.readUEG(),b+=t.readUEG(),I+=t.readUEG(),C+=t.readUEG());let O=t.readUEG(),B=t.readUEG(),G=t.readUEG(),U=t.readBoolean();for(let Z=U?0:s;Z<=s;Z++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let ye=0;ye<4;ye++)for(let _e=0;_e<(ye===3?2:6);_e++)if(!t.readBoolean())t.readUEG();else{let Ce=Math.min(64,1<<4+(ye<<1));ye>1&&t.readEG();for(let lt=0;lt<Ce;lt++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());let M=t.readUEG(),K=0;for(let Z=0;Z<M;Z++){let ye=!1;if(Z!==0&&(ye=t.readBoolean()),ye){Z===M&&t.readUEG(),t.readBoolean(),t.readUEG();let _e=0;for(let Ze=0;Ze<=K;Ze++){let Ce=t.readBoolean(),lt=!1;Ce||(lt=t.readBoolean()),(Ce||lt)&&_e++}K=_e}else{let _e=t.readUEG(),Ze=t.readUEG();K=_e+Ze;for(let Ce=0;Ce<_e;Ce++)t.readUEG(),t.readBoolean();for(let Ce=0;Ce<Ze;Ce++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){let Z=t.readUEG();for(let ye=0;ye<Z;ye++){for(let _e=0;_e<G+4;_e++)t.readBits(1);t.readBits(1)}}let k=0,w=1,q=1,J=!0,j=1,Q=0;t.readBoolean(),t.readBoolean();let pe=!1;if(t.readBoolean()){if(t.readBoolean()){let Je=t.readUByte();Je>0&&Je<16?(w=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][Je-1],q=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][Je-1]):Je===255&&(w=t.readBits(16),q=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),pe=t.readBoolean(),pe&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(j=t.readBits(32),Q=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){let Yt=t.readBoolean(),jr=t.readBoolean(),Lt=!1;(Yt||jr)&&(Lt=t.readBoolean(),Lt&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Lt&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Xr=0;Xr<=s;Xr++){J=t.readBoolean();let Fo=J||t.readBoolean(),zr=!1;Fo?t.readEG():zr=t.readBoolean();let Qr=zr?1:t.readUEG()+1;if(Yt)for(let Rt=0;Rt<Qr;Rt++)t.readUEG(),t.readUEG(),Lt&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(jr)for(let Rt=0;Rt<Qr;Rt++)t.readUEG(),t.readUEG(),Lt&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),k=t.readUEG())}let be=x,Oe=_;if(A){let Z=1,ye=1;v===1?Z=ye=2:v==2&&(Z=2),be=x-Z*b-Z*R,Oe=_-ye*C-ye*I}let Qe=i?[`A`,`B`,`C`][i]:``,Oo=o<<24|c<<16|l<<8|h,$s=0;for(let Z=0;Z<32;Z++)$s=($s|(Oo>>Z&1)<<31-Z)>>>0;let Gs=$s.toString(16);return a===1&&Gs===`2`&&(Gs=`6`),{codecString:`hvc1.${Qe}${a}.${Gs}.${r?`H`:`L`}${E}.B0`,params:{general_tier_flag:r,general_profile_idc:a,general_profile_space:i,general_profile_compatibility_flags:[o,c,l,h],general_constraint_indicator_flags:[u,d,f,g,p,y],general_level_idc:E,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:B,min_spatial_segmentation_idc:k,chroma_format_idc:v,frame_rate:{fixed:J,fps:Q/j}},width:be,height:Oe,pixelRatio:[w,q]}}readPPS(e){let t=new nt$2(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);let i=t.readBoolean(),r=t.readBoolean(),a=1;return r&&i?a=0:r?a=3:i&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}};var ue$2=188;var Mi$1=class n{constructor(e,t,s,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.logger=i,this.videoParser=null}static probe(e,t){let s=n.syncOffset(e);return s>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){let t=e.length,s=Math.min(ue$2*5,t-ue$2)+1,i=0;for(;i<s;){let r=!1,a=-1,o=0;for(let c=i;c<t;c+=ue$2)if(e[c]===71&&(t-c===ue$2||e[c+ue$2]===71)){if(o++,a===-1&&(a=c,a!==0&&(s=Math.min(a+ue$2*99,e.length-ue$2)+1)),r||(r=Ni$2(e,c)===0),r&&o>1&&(a===0&&o>2||c+ue$2>s))return a}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e===`video`||e===`audio`?`video/mp2t`:void 0,type:e,id:ga$2[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e===`audio`?t:void 0}}resetInitSegment(e,t,s,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=n.createTrack(`video`),this._videoTrack.duration=i,this._audioTrack=n.createTrack(`audio`,i),this._id3Track=n.createTrack(`id3`),this._txtTrack=n.createTrack(`text`),this._audioTrack.segmentCodec=`aac`,this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){let{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,i=!1){s||(this.sampleAes=null);let r,a=this._videoTrack,o=this._audioTrack,c=this._id3Track,l=this._txtTrack,h=a.pid,u=a.pesData,d=o.pid,f=c.pid,g=o.pesData,p=c.pesData,y=null,E=this.pmtParsed,T=this._pmtId,S=e.length;if(this.remainderData&&(e=De$1(this.remainderData,e),S=e.length,this.remainderData=null),S<ue$2&&!i)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:c,textTrack:l};let v=Math.max(0,n.syncOffset(e));S-=(S-v)%ue$2,S<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,S,e.buffer.byteLength-S));let x=0;for(let A=v;A<S;A+=ue$2)if(e[A]===71){let R=!!(e[A+1]&64),b=Ni$2(e,A),I=(e[A+3]&48)>>4,C;if(I>1){if(C=A+5+e[A+4],C===A+ue$2)continue}else C=A+4;switch(b){case h:R&&(u&&(r=ut$3(u,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,l,r,!1)),u={data:[],size:0}),u&&(u.data.push(e.subarray(C,A+ue$2)),u.size+=A+ue$2-C);break;case d:if(R){if(g&&(r=ut$3(g,this.logger)))switch(o.segmentCodec){case`aac`:this.parseAACPES(o,r);break;case`mp3`:this.parseMPEGPES(o,r);break;case`ac3`:this.parseAC3PES(o,r);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(C,A+ue$2)),g.size+=A+ue$2-C);break;case f:R&&(p&&(r=ut$3(p,this.logger))&&this.parseID3PES(c,r),p={data:[],size:0}),p&&(p.data.push(e.subarray(C,A+ue$2)),p.size+=A+ue$2-C);break;case 0:R&&(C+=e[C]+1),T=this._pmtId=Gc$3(e,C);break;case T:{R&&(C+=e[C]+1);let O=Kc$3(e,C,this.typeSupported,s,this.observer,this.logger);h=O.videoPid,h>0&&(a.pid=h,a.segmentCodec=O.segmentVideoCodec),d=O.audioPid,d>0&&(o.pid=d,o.segmentCodec=O.segmentAudioCodec),f=O.id3Pid,f>0&&(c.pid=f),y!==null&&!E&&(this.logger.warn(`MPEG-TS PMT found at ${A} after unknown PID '${y}'. Backtracking to sync byte @${v} to parse all TS packets.`),y=null,A=v-188),E=this.pmtParsed=!0;break}case 17:case 8191:break;default:y=b;break}}else x++;x>0&&Bi$2(this.observer,new Error(`Found ${x} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=u,o.pesData=g,c.pesData=p;let _={audioTrack:o,videoTrack:a,id3Track:c,textTrack:l};return i&&this.extractRemainingSamples(_),_}flush(){let{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){let{audioTrack:t,videoTrack:s,id3Track:i,textTrack:r}=e,a=s.pesData,o=t.pesData,c=i.pesData,l;if(a&&(l=ut$3(a,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,r,l,!0),s.pesData=null)):s.pesData=a,o&&(l=ut$3(o,this.logger))){switch(t.segmentCodec){case`aac`:this.parseAACPES(t,l);break;case`mp3`:this.parseMPEGPES(t,l);break;case`ac3`:this.parseAC3PES(t,l);break}t.pesData=null}else o!=null&&o.size&&this.logger.log(`last AAC PES packet truncated,might overlap between fragments`),t.pesData=o;c&&(l=ut$3(c,this.logger))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=c}demuxSampleAes(e,t,s){let i=this.demux(e,s,!0,!this.config.progressive),r=this.sampleAes=new wi$2(this.observer,this.config,t);return this.decrypt(i,r)}readyVideoParser(e){this.videoParser===null&&(e===`avc`?this.videoParser=new Oi$2:e===`hevc`&&(this.videoParser=new Fi$2))}decrypt(e,t){return new Promise(s=>{let{audioTrack:i,videoTrack:r}=e;i.samples&&i.segmentCodec===`aac`?t.decryptAacSamples(i.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{s(e)}):s(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{s(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let s=0,i=this.aacOverFlow,r=t.data;if(i){this.aacOverFlow=null;let u=i.missing,d=i.sample.unit.byteLength;if(u===-1)r=De$1(i.sample.unit,r);else{let f=d-u;i.sample.unit.set(r.subarray(0,u),f),e.samples.push(i.sample),s=i.missing}}let a,o;for(a=s,o=r.length;a<o-1&&!Rs$2(r,a);a++);if(a!==s){let u,d=a<o-1;if(d?u=`AAC PES did not start with ADTS header,offset:${a}`:u=`No ADTS header found in AAC PES`,Bi$2(this.observer,new Error(u),d,this.logger),!d)return}ja$2(e,this.observer,r,a,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(i){let u=Xa(e.samplerate);c=i.sample.pts+u}else{this.logger.warn(`[tsdemuxer]: AAC PES unknown PTS`);return}let l=0,h;for(;a<o;)if(h=za$2(e,r,a,c,l),a+=h.length,h.missing){this.aacOverFlow=h;break}else for(l++;a<o-1&&!Rs$2(r,a);a++);}parseMPEGPES(e,t){let s=t.data,i=s.length,r=0,a=0,o=t.pts;if(o===void 0){this.logger.warn(`[tsdemuxer]: MPEG PES unknown PTS`);return}for(;a<i;)if(to$2(s,a)){let c=Ja$2(e,s,a,o,r);if(c)a+=c.length,r++;else break}else a++}parseAC3PES(e,t){{let s=t.data,i=t.pts;if(i===void 0){this.logger.warn(`[tsdemuxer]: AC3 PES unknown PTS`);return}let r=s.length,a=0,o=0,c;for(;o<r&&(c=ro$2(e,s,o,i,a++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn(`[tsdemuxer]: ID3 PES unknown PTS`);return}let s=se$3({},t,{type:this._videoTrack?Le$2.emsg:Le$2.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}};function Ni$2(n,e){return((n[e+1]&31)<<8)+n[e+2]}function Gc$3(n,e){return(n[e+10]&31)<<8|n[e+11]}function Kc$3(n,e,t,s,i,r){let a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:`avc`,segmentAudioCodec:`aac`},o=(n[e+1]&15)<<8|n[e+2],c=e+3+o-4,l=(n[e+10]&15)<<8|n[e+11];for(e+=12+l;e<c;){let h=Ni$2(n,e),u=(n[e+3]&15)<<8|n[e+4];switch(n[e]){case 207:if(!s){zs$1(`ADTS AAC`,r);break}case 15:a.audioPid===-1&&(a.audioPid=h);break;case 21:a.id3Pid===-1&&(a.id3Pid=h);break;case 219:if(!s){zs$1(`H.264`,r);break}case 27:a.videoPid===-1&&(a.videoPid=h);break;case 3:case 4:!t.mpeg&&!t.mp3?r.log(`MPEG audio found, not supported in this browser`):a.audioPid===-1&&(a.audioPid=h,a.segmentAudioCodec=`mp3`);break;case 193:if(!s){zs$1(`AC-3`,r);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=h,a.segmentAudioCodec=`ac3`):r.log(`AC-3 audio found, not supported in this browser`);break;case 6:if(a.audioPid===-1&&u>0){let d=e+5,f=u;for(;f>2;){n[d]===106&&(t.ac3!==!0?r.log(`AC-3 audio found, not supported in this browser for now`):(a.audioPid=h,a.segmentAudioCodec=`ac3`));let p=n[d+1]+2;d+=p,f-=p}}break;case 194:case 135:return Bi$2(i,new Error(`Unsupported EC-3 in M2TS found`),void 0,r),a;case 36:a.videoPid===-1&&(a.videoPid=h,a.segmentVideoCodec=`hevc`,r.log(`HEVC in M2TS found`));break}e+=u+5}return a}function Bi$2(n,e,t,s){s.warn(`parsing error: ${e.message}
2402`),n.emit(m.ERROR,m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function zs$1(n,e){e.log(`${n} with AES-128-CBC encryption found in unencrypted stream`)}function ut$3(n,e){let t=0,s,i,r,a,o,c=n.data;if(!n||n.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=De$1(c[0],c[1]),c.splice(1,1);if(s=c[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(i=(s[4]<<8)+s[5],i&&i>n.size-6)return null;let h=s[7];h&192&&(a=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,h&64?(o=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),r=s[8];let u=r+9;if(n.size<=u)return null;n.size-=u;let d=new Uint8Array(n.size);for(let f=0,g=c.length;f<g;f++){s=c[f];let p=s.byteLength;if(u)if(u>p){u-=p;continue}else s=s.subarray(u),p-=u,u=0;d.set(s,t),t+=p}return i&&(i-=r+3),{data:d,pts:a,dts:o,len:i}}return null}var Ui$2=class{static getSilentFrame(e,t){switch(e){case`mp4a.40.2`:if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}};var Ye$1=Math.pow(2,32)-1;var dt$4=(()=>{class n{static init(){n.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let t;for(t in n.types)n.types.hasOwnProperty(t)&&(n.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);let s=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);n.HDLR_TYPES={video:s,audio:i};let r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);n.STTS=n.STSC=n.STCO=a,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);let o=new Uint8Array([105,115,111,109]),c=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);n.FTYP=n.box(n.types.ftyp,o,l,o,c),n.DINF=n.box(n.types.dinf,n.box(n.types.dref,r))}static box(t,...s){let i=8,r=s.length,a=r;for(;r--;)i+=s[r].byteLength;let o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(t,4),r=0,i=8;r<a;r++)o.set(s[r],i),i+=s[r].byteLength;return o}static hdlr(t){return n.box(n.types.hdlr,n.HDLR_TYPES[t])}static mdat(t){return n.box(n.types.mdat,t)}static mdhd(t,s){s*=t;let i=Math.floor(s/(Ye$1+1)),r=Math.floor(s%(Ye$1+1));return n.box(n.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(t){return n.box(n.types.mdia,n.mdhd(t.timescale||0,t.duration||0),n.hdlr(t.type),n.minf(t))}static mfhd(t){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]))}static minf(t){return t.type===`audio`?n.box(n.types.minf,n.box(n.types.smhd,n.SMH
vendor: 6,747 bytes, line 2402
2402D),n.DINF,n.stbl(t)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(t))}static moof(t,s,i){return n.box(n.types.moof,n.mfhd(t),n.traf(i,s))}static moov(t){let s=t.length,i=[];for(;s--;)i[s]=n.trak(t[s]);return n.box.apply(null,[n.types.moov,n.mvhd(t[0].timescale||0,t[0].duration||0)].concat(i).concat(n.mvex(t)))}static mvex(t){let s=t.length,i=[];for(;s--;)i[s]=n.trex(t[s]);return n.box.apply(null,[n.types.mvex,...i])}static mvhd(t,s){s*=t;let i=Math.floor(s/(Ye$1+1)),r=Math.floor(s%(Ye$1+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n.box(n.types.mvhd,a)}static sdtp(t){let s=t.samples||[],i=new Uint8Array(4+s.length),r,a;for(r=0;r<s.length;r++)a=s[r].flags,i[r+4]=a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy;return n.box(n.types.sdtp,i)}static stbl(t){return n.box(n.types.stbl,n.stsd(t),n.box(n.types.stts,n.STTS),n.box(n.types.stsc,n.STSC),n.box(n.types.stsz,n.STSZ),n.box(n.types.stco,n.STCO))}static avc1(t){let s=[],i=[],r,a,o;for(r=0;r<t.sps.length;r++)a=t.sps[r],o=a.byteLength,s.push(o>>>8&255),s.push(o&255),s=s.concat(Array.prototype.slice.call(a));for(r=0;r<t.pps.length;r++)a=t.pps[r],o=a.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(a));let c=n.box(n.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|t.sps.length].concat(s).concat([t.pps.length]).concat(i))),l=t.width,h=t.height,u=t.pixelRatio[0],d=t.pixelRatio[1];return n.box(n.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,h>>8&255,h&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(t){let s=t.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...s,6,1,2])}static audioStsd(t){let s=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,s>>8&255,s&255,0,0])}static mp4a(t){return n.box(n.types.mp4a,n.audioStsd(t),n.box(n.types.esds,n.esds(t)))}static mp3(t){return n.box(n.types[`.mp3`],n.audioStsd(t))}static ac3(t){return n.box(n.types[`ac-3`],n.audioStsd(t),n.box(n.types.dac3,t.config))}static stsd(t){let{segmentCodec:s}=t;if(t.type===`audio`){if(s===`aac`)return n.box(n.types.stsd,n.STSD,n.mp4a(t));if(s===`ac3`&&t.config)return n.box(n.types.stsd,n.STSD,n.ac3(t));if(s===`mp3`&&t.codec===`mp3`)return n.box(n.types.stsd,n.STSD,n.mp3(t))}else if(t.pps&&t.sps){if(s===`avc`)return n.box(n.types.stsd,n.STSD,n.avc1(t));if(s===`hevc`&&t.vps)return n.box(n.types.stsd,n.STSD,n.hvc1(t))}else throw new Error(`video track missing pps or sps`);throw new Error(`unsupported ${t.type} segment codec (${s}/${t.codec})`)}static tkhd(t){let s=t.id,i=(t.duration||0)*(t.timescale||0),r=t.width||0,a=t.height||0,o=Math.floor(i/(Ye$1+1)),c=Math.floor(i%(Ye$1+1));return n.box(n.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,s>>24&255,s>>16&255,s>>8&255,s&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,c>>24,c>>16&255,c>>8&255,c&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,a>>8&255,a&255,0,0]))}static traf(t,s){let i=n.sdtp(t),r=t.id,a=Math.floor(s/(Ye$1+1)),o=Math.floor(s%(Ye$1+1));return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),n.box(n.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255])),n.trun(t,i.length+16+20+8+16+8+8),i)}static trak(t){return t.duration=t.duration||4294967295,n.box(n.types.trak,n.tkhd(t),n.mdia(t))}static trex(t){let s=t.id;return n.box(n.types.trex,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,s){let i=t.samples||[],r=i.length,a=12+16*r,o=new Uint8Array(a),c,l,h,u,d,f;for(s+=8+a,o.set([t.type===`video`?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255],0),c=0;c<r;c++)l=i[c],h=l.duration,u=l.size,d=l.flags,f=l.cts,o.set([h>>>24&255,h>>>16&255,h>>>8&255,h&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*c);return n.box(n.types.trun,o)}static initSegment(t){n.types||n.init();let s=n.moov(t);return De$1(n.FTYP,s)}static hvc1(t){let s=t.params,i=[t.vps,t.sps,t.pps],a=new Uint8Array([1,s.general_profile_space<<6|(s.general_tier_flag?32:0)|s.general_profile_idc,s.general_profile_compatibility_flags[0],s.general_profile_compatibility_flags[1],s.general_profile_compatibility_flags[2],s.general_profile_compatibility_flags[3],s.general_constraint_indicator_flags[0],s.general_constraint_indicator_flags[1],s.general_constraint_indicator_flags[2],s.general_constraint_indicator_flags[3],s.general_constraint_indicator_flags[4],s.general_constraint_indicator_flags[5],s.general_level_idc,240|s.min_spatial_segmentation_idc>>8,255&s.min_spatial_segmentation_idc,252|s.parallelismType,252|s.chroma_format_idc,248|s.bit_depth_luma_minus8,248|s.bit_depth_chroma_minus8,0,parseInt(s.frame_rate.fps),3|s.temporal_id_nested<<2|s.num_temporal_layers<<3|(s.frame_rate.fixed?64:0),i.length]),o=a.length;for(let p=0;p<i.length;p+=1){o+=3;for(let y=0;y<i[p].length;y+=1)o+=2+i[p][y].length}let c=new Uint8Array(o);c.set(a,0),o=a.length;let l=i.length-1;for(let p=0;p<i.length;p+=1){c.set(new Uint8Array([32+p|(p===l?128:0),0,i[p].length]),o),o+=3;for(let y=0;y<i[p].length;y+=1)c.set(new Uint8Array([i[p][y].length>>8,i[p][y].length&255]),o),o+=2,c.set(i[p][y],o),o+=i[p][y].length}let h=n.box(n.types.hvcC,c),u=t.width,d=t.height,f=t.pixelRatio[0],g=t.pixelRatio[1];return n.box(n.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),h,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,g>>24,g>>16&255,g>>8&255,g&255])))}}return n.types=void 0,n.HDLR_TYPES=void 0,n.STTS=void 0,n.STSC=void 0,n.STCO=void 0,n.STSZ=void 0,n.VMHD=void 0,n.SMH
2402D=void 0,n.STSD=void 0,n.FTYP=void 0,n.DINF=void 0,n})();var no$2=9e4;function Kr$3(n,e,t=1,s=!1){let i=n*e*t;return s?Math.round(i):i}function Vc$3(n,e,t=1,s=!1){return Kr$3(n,e,1/t,s)}function bt$5(n,e=!1){return Kr$3(n,1e3,1/no$2,e)}function Hc$3(n,e=1){return Kr$3(n,no$2,1/e)}function Gn$2(n){let{baseTime:e,timescale:t,trackId:s}=n;return`${e/t} (${e}/${t}) trackId: ${s}`}var Yc$3=10*1e3;var Wc$3=1024;var qc$3=1152;var jc$2=1536;var $i$2=8589934592;var ft$5=null;var Qs$3=null;function Kn$2(n,e,t,s){return{duration:e,size:t,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:n?2:1,isNonSync:n?0:1}}}var St$3=class extends xe$2{constructor(e,t,s,i){if(super(`mp4-remuxer`,i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,ft$5===null){let a=(navigator.userAgent||``).match(/Chrome\/(\d+)/i);ft$5=a?parseInt(a[1]):0}if(Qs$3===null){let r=navigator.userAgent.match(/Safari\/(\d+)/i);Qs$3=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){let t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Gn$2(t)} > ${e&&Gn$2(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log(`reset next timestamp`),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log(`ISGenerated flag reset`),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1,s=e[0].pts,i=e.reduce((r,a)=>{let o=a.pts,c=o-r;return c<-4294967296&&(t=!0,o=Ie$3(o,s),c=o-r),c>0?r:o},s);return t&&this.debug(`PTS rollover detected`),i}remux(e,t,s,i,r,a,o,c){let l,h,u,d,f,g,p=r,y=r,E=e.pid>-1,T=t.pid>-1,S=t.samples.length,v=e.samples.length>0,x=o&&S>0||S>1;if((!E||v)&&(!T||x)||this.ISGenerated||o){if(this.ISGenerated){var A,R,b,I;let G=this.videoTrackConfig;(G&&(t.width!==G.width||t.height!==G.height||((A=t.pixelRatio)==null?void 0:A[0])!==((R=G.pixelRatio)==null?void 0:R[0])||((b=t.pixelRatio)==null?void 0:b[1])!==((I=G.pixelRatio)==null?void 0:I[1]))||!G&&x||this.nextAudioTs===null&&v)&&this.resetInitSegment()}this.ISGenerated||(u=this.generateIS(e,t,r,a));let C=this.isVideoContiguous,O=-1,B;if(x&&(O=Xc$3(t.samples),!C&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,O>0){this.warn(`Dropped ${O} out of ${S} video samples due to a missing keyframe`);let G=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(O),t.dropped+=O,y+=(t.samples[0].pts-G)/t.inputTimeScale,B=y}else O===-1&&(this.warn(`No keyframe found out of ${S} video samples`),g=!1);if(this.ISGenerated){if(v&&x){let G=this.getVideoStartPts(t.samples),P=(Ie$3(e.samples[0].pts,G)-G)/t.inputTimeScale;p+=Math.max(0,P),y+=Math.max(0,-P)}if(v){if(e.samplerate||(this.warn(`regenerate InitSegment as audio detected`),u=this.generateIS(e,t,r,a)),h=this.remuxAudio(e,p,this.isAudioContiguous,a,T||x||c===N$1.AUDIO?y:void 0),x){let G=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.warn(`regenerate InitSegment as video detected`),u=this.generateIS(e,t,r,a)),l=this.remuxVideo(t,y,C,G)}}else x&&(l=this.remuxVideo(t,y,C,0));l&&(l.firstKeyFrame=O,l.independent=O!==-1,l.firstKeyFramePTS=B)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(f=ao$2(s,r,this._initPTS,this._initDTS)),i.samples.length&&(d=oo$2(i,r,this._initPTS))),{audio:h,video:l,initSegment:u,independent:g,text:d,id3:f}}computeInitPts(e,t,s,i){let r=Math.round(s*t),a=Ie$3(e,r);if(a<r)for(this.log(`Adjusting PTS for rollover in timeline near ${(r-a)/t} ${i}`);a<r;)a+=$i$2;return a-r}generateIS(e,t,s,i){let r=e.samples,a=t.samples,o=this.typeSupported,c={},l=this._initPTS,h=!l||i,u=`audio/mp4`,d,f,g,p=-1;if(h&&(d=f=Infinity),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case`mp3`:o.mpeg?(u=`audio/mpeg`,e.codec=``):o.mp3&&(e.codec=`mp3`);break;case`ac3`:e.codec=`ac-3`;break}c.audio={id:`audio`,container:u,codec:e.codec,initSegment:e.segmentCodec===`mp3`&&o.mpeg?new Uint8Array(0):dt$4.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(p=e.id,g=e.inputTimeScale,!l||g!==l.timescale?d=f=this.computeInitPts(r[0].pts,g,s,`audio`):h=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,c.video={id:`main`,container:`video/mp4`,codec:t.codec,initSegment:dt$4.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(p=t.id,g=t.inputTimeScale,!l||g!==l.timescale){let y=this.getVideoStartPts(a),E=Ie$3(a[0].dts,y),T=this.computeInitPts(E,g,s,`video`),S=this.computeInitPts(y,g,s,`video`);f=Math.min(f,T),d=Math.min(d,S)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,h?(l&&this.warn(`Timestamps at playlist time: ${i?``:`~`}${s} ${d/g} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${d/g} (${d}/${g}) trackId: ${p}`),this._initPTS={baseTime:d,timescale:g,trackId:p},this._initDTS={baseTime:f,timescale:g,trackId:p}):d=g=void 0,{tracks:c,initPTS:d,timescale:g,trackId:p}}remuxVideo(e,t,s,i){let r=e.inputTimeScale,a=e.samples,o=[],c=a.length,l=this._initPTS,h=l.baseTime*r/l.timescale,u=this.nextVideoTs,d=8,f=this.videoSampleDuration,g,p,y=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,T=!1;if(!s||u===null){let k=h+t*r,w=a[0].pts-Ie$3(a[0].dts,a[0].pts);ft$5&&u!==null&&Math.abs(k-w-(u+h))<15e3?s=!0:u=k-w-h}let S=u+h;for(let k=0;k<c;k++){let w=a[k];w.pts=Ie$3(w.pts,S),w.dts=Ie$3(w.dts,S),w.dts<a[k>0?k-1:k].dts&&(T=!0)}T&&a.sort(function(k,w){let q=k.dts-w.dts,J=k.pts-w.pts;return q||J}),g=a[0].dts,p=a[a.length-1].dts;let v=p-g,x=v?Math.round(v/(c-1)):f||e.inputTimeScale/30;if(s){let k=g-S,w=k>x,q=k<-1;
vendor: 4,516 bytes, line 2402
2402if((w||q)&&(w?this.warn(`${(e.segmentCodec||``).toUpperCase()}: ${bt$5(k,!0)} ms (${k}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||``).toUpperCase()}: ${bt$5(-k,!0)} ms (${k}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!q||S>=a[0].pts||ft$5)){g=S;let J=a[0].pts-k;if(w)a[0].dts=g,a[0].pts=J;else{let j=!0;for(let Q=0;Q<a.length&&!(a[Q].dts>J&&j);Q++){let pe=a[Q].pts;if(a[Q].dts-=k,a[Q].pts-=k,Q<a.length-1){let fe=a[Q+1].pts;j=fe<=a[Q].pts==fe<=pe}}}this.log(`Video: Initial PTS/DTS adjusted: ${bt$5(J,!0)}/${bt$5(g,!0)}, delta: ${bt$5(k,!0)} ms`)}}g=Math.max(0,g);let _=0,A=0,R=g;for(let k=0;k<c;k++){let w=a[k],q=w.units,J=q.length,j=0;for(let Q=0;Q<J;Q++)j+=q[Q].data.length;A+=j,_+=J,w.length=j,w.dts<R?(w.dts=R,R+=x/4|0||1):R=w.dts,y=Math.min(w.pts,y),E=Math.max(w.pts,E)}p=a[c-1].dts;let b=A+4*_+8,I;try{I=new Uint8Array(b)}catch(k){this.observer.emit(m.ERROR,m.ERROR,{type:V$1.MUX_ERROR,details:L$2.REMUX_ALLOC_ERROR,fatal:!1,error:k,bytes:b,reason:`fail allocating video mdat ${b}`});return}let C=new DataView(I.buffer);C.setUint32(0,b),I.set(dt$4.types.mdat,4);let O=!1,B=Number.POSITIVE_INFINITY,G=Number.POSITIVE_INFINITY,U=Number.NEGATIVE_INFINITY,P=Number.NEGATIVE_INFINITY;for(let k=0;k<c;k++){let w=a[k],q=w.units,J=0;for(let pe=0,fe=q.length;pe<fe;pe++){let be=q[pe],Oe=be.data,Qe=be.data.byteLength;C.setUint32(d,Qe),d+=4,I.set(Oe,d),d+=Qe,J+=4+Qe}let j;if(k<c-1)f=a[k+1].dts-w.dts,j=a[k+1].pts-w.pts;else{let pe=this.config,fe=k>0?w.dts-a[k-1].dts:x;if(j=k>0?w.pts-a[k-1].pts:x,pe.stretchShortVideoTrack&&this.nextAudioTs!==null){let be=Math.floor(pe.maxBufferHole*r),Oe=(i?y+i*r:this.nextAudioTs+h)-w.pts;Oe>be?(f=Oe-fe,f<0?f=fe:O=!0,this.log(`It is approximately ${Oe/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=fe}else f=fe}let Q=Math.round(w.pts-w.dts);B=Math.min(B,f),U=Math.max(U,f),G=Math.min(G,j),P=Math.max(P,j),o.push(Kn$2(w.key,f,J,Q))}if(o.length){if(ft$5){if(ft$5<70){let k=o[0].flags;k.dependsOn=2,k.isNonSync=0}}else if(Qs$3&&P-G<U-B&&x/U<.025&&o[0].cts===0){this.warn(`Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.`);let k=g;for(let w=0,q=o.length;w<q;w++){let J=k+o[w].duration,j=k+o[w].cts;if(w<q-1){let Q=J+o[w+1].cts;o[w].duration=Q-j}else o[w].duration=w?o[w-1].duration:x;o[w].cts=0,k=J}}}f=O||!f?x:f;let $=p+f;this.nextVideoTs=u=$-h,this.videoSampleDuration=f,this.isVideoContiguous=!0;let H={data1:dt$4.moof(e.sequenceNumber++,g,se$3(e,{samples:o})),data2:I,startPTS:(y-h)/r,endPTS:(E+f-h)/r,startDTS:(g-h)/r,endDTS:u/r,type:`video`,hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,H}getSamplesPerFrame(e){switch(e.segmentCodec){case`mp3`:return qc$3;case`ac3`:return jc$2;default:return Wc$3}}remuxAudio(e,t,s,i,r){let a=e.inputTimeScale,c=a/(e.samplerate?e.samplerate:a),l=this.getSamplesPerFrame(e),h=l*c,u=this._initPTS,d=e.segmentCodec===`mp3`&&this.typeSupported.mpeg,f=[],g=r!==void 0,p=e.samples,y=d?0:8,E=this.nextAudioTs||-1,T=u.baseTime*a/u.timescale,S=T+t*a;if(this.isAudioContiguous=s=s||p.length&&E>0&&(i&&Math.abs(S-(E+T))<9e3||Math.abs(Ie$3(p[0].pts,S)-(E+T))<20*h),p.forEach(function(P){P.pts=Ie$3(P.pts,S)}),!s||E<0){let P=p.length;if(p=p.filter($=>$.pts>=0),P!==p.length&&this.warn(`Removed ${p.length-P} of ${P} samples (initPTS ${T} / ${a})`),!p.length)return;r===0?E=0:i&&!g?E=Math.max(0,S-T):E=p[0].pts-T}if(e.segmentCodec===`aac`){let P=this.config.maxAudioFramesDrift;for(let $=0,M=E+T;$<p.length;$++){let K=p[$],H=K.pts,k=H-M,w=Math.abs(1e3*k/a);if(k<=-P*h&&g)$===0&&(this.warn(`Audio frame @ ${(H/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*k/a)} ms.`),this.nextAudioTs=E=H-T,M=H);else if(k>=P*h&&w<Yc$3&&g){let q=Math.round(k/h);for(M=H-q*h;M<0&&q&&h;)q--,M+=h;$===0&&(this.nextAudioTs=E=M-T),this.warn(`Injecting ${q} audio frames @ ${((M-T)/a).toFixed(3)}s due to ${Math.round(1e3*k/a)} ms gap.`);for(let J=0;J<q;J++){let j=Ui$2.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);j||(this.log(`Unable to get silent frame for given audio codec; duplicating last frame instead.`),j=K.unit.subarray()),p.splice($,0,{unit:j,pts:M}),M+=h,$++}}K.pts=M,M+=h}}let v=null,x=null,_,A=0,R=p.length;for(;R--;)A+=p[R].unit.byteLength;for(let P=0,$=p.length;P<$;P++){let M=p[P],K=M.unit,H=M.pts;if(x!==null){let w=f[P-1];w.duration=Math.round((H-x)/c)}else if(s&&e.segmentCodec===`aac`&&(H=E+T),v=H,A>0){A+=y;try{_=new Uint8Array(A)}
2402catch(w){this.observer.emit(m.ERROR,m.ERROR,{type:V$1.MUX_ERROR,details:L$2.REMUX_ALLOC_ERROR,fatal:!1,error:w,bytes:A,reason:`fail allocating audio mdat ${A}`});return}d||(new DataView(_.buffer).setUint32(0,A),_.set(dt$4.types.mdat,4))}else return;_.set(K,y);let k=K.byteLength;y+=k,f.push(Kn$2(!0,l,k,0)),x=H}let b=f.length;if(!b)return;let I=f[f.length-1];E=x-T,this.nextAudioTs=E+c*I.duration;let C=d?new Uint8Array(0):dt$4.moof(e.sequenceNumber++,v/c,se$3({},e,{samples:f}));e.samples=[];let O=(v-T)/a,B=this.nextAudioTs/a,U={data1:C,data2:_,startPTS:O,endPTS:B,startDTS:O,endDTS:B,type:`audio`,hasAudio:!0,hasVideo:!1,nb:b};return this.isAudioContiguous=!0,U}};function Ie$3(n,e){let t;if(e===null)return n;for(e<n?t=-$i$2:t=$i$2;Math.abs(n-e)>4294967296;)n+=t;return n}function Xc$3(n){for(let e=0;e<n.length;e++)if(n[e].key)return e;return-1}function ao$2(n,e,t,s){let i=n.samples.length;if(!i)return;let r=n.inputTimeScale;for(let o=0;o<i;o++){let c=n.samples[o];c.pts=Ie$3(c.pts-t.baseTime*r/t.timescale,e*r)/r,c.dts=Ie$3(c.dts-s.baseTime*r/s.timescale,e*r)/r}let a=n.samples;return n.samples=[],{samples:a}}function oo$2(n,e,t){let s=n.samples.length;if(!s)return;let i=n.inputTimeScale;for(let a=0;a<s;a++){let o=n.samples[a];o.pts=Ie$3(o.pts-t.baseTime*i/t.timescale,e*i)/i}n.samples.sort((a,o)=>a.pts-o.pts);let r=n.samples;return n.samples=[],{samples:r}}var Gi$2=class extends xe$2{constructor(e,t,s,i){super(`passthrough-remuxer`,i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;let t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,s,i){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:s,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}let{audio:r,video:a}=this.initData=ya$2(e);if(t)Jo$3(e,t);else{let c=r||a;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}r&&(s=Vn$2(r,ie$2.AUDIO,this)),a&&(i=Vn$2(a,ie$2.VIDEO,this));let o={};r&&a?o.audiovideo={container:`video/mp4`,codec:s+`,`+i,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:`main`}:r?o.audio={container:`audio/mp4`,codec:s,encrypted:r.encrypted,initSegment:e,id:`audio`}:a?o.video={container:`video/mp4`,codec:i,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:`main`}:this.warn(`initSegment does not contain moov or trak boxes.`),this.initTracks=o}remux(e,t,s,i,r,a){var o,c;let{initPTS:l,lastEndTime:h}=this,u={audio:void 0,video:void 0,text:i,id3:s,initSegment:void 0};F$1(h)||(h=this.lastEndTime=r||0);let d=t.samples;if(!d.length)return u;let f={initPTS:void 0,timescale:void 0,trackId:void 0},g=this.initData;if((o=g)!=null&&o.length||(this.generateInitSegment(d),g=this.initData),!((c=g)!=null&&c.length))return this.warn(`Failed to generate initSegment.`),u;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);let p=tl$3(d,g,this),y=g.audio?p[g.audio.id]:null,E=g.video?p[g.video.id]:null,T=Zt$2(E,Infinity),S=Zt$2(y,Infinity),v=Zt$2(E,0,!0),x=Zt$2(y,0,!0),_=r,A=0,R=y&&(!E||!l&&S<T||l&&l.trackId===g.audio.id),b=R?y:E;if(b){let M=b.timescale,K=b.start-r*M,H=R?g.audio.id:g.video.id;_=b.start/M,A=R?x-S:v-T,(a||!l)&&(zc$3(l,_,r,A)||M!==l.timescale)&&(l&&this.warn(`Timestamps at playlist time: ${a?``:`~`}${r} ${K/M} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${_-r} (${K}/${M}) trackId: ${H}`),l=null,f.initPTS=K,f.timescale=M,f.trackId=H)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${r}`);l?(f.initPTS=l.baseTime,f.timescale=l.timescale,f.trackId=l.trackId):((!f.timescale||f.trackId===void 0||f.initPTS===void 0)&&(this.warn(`Could not set initPTS`),f.initPTS=_,f.timescale=1,f.trackId=-1),this.initPTS=l={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});let I=_-l.baseTime/l.timescale,C=I+A;A>0?this.lastEndTime=C:(this.warn(`Duration parsed from mp4 should be greater than zero`),this.resetNextTimestamp());let O=!!g.audio,B=!!g.video,G=``;O&&(G+=`audio`),B&&(G+=`video`);let U=(g.audio?g.audio.encrypted:!1)||(g.video?g.video.encrypted:!1),P={data1:d,startPTS:I,startDTS:I,endPTS:C,endDTS:C,type:G,hasAudio:O,hasVideo:B,nb:1,dropped:0,encrypted:U};u.audio=O&&!B?P:void 0,u.video=B?P:void 0;
2402let $=E?.sampleCount;if($){let M=E.keyFrameIndex,K=M!==-1;P.nb=$,P.dropped=M===0||this.isVideoContiguous?0:K?M:$,P.independent=K,P.firstKeyFrame=M,K&&E.keyFrameStart&&(P.firstKeyFramePTS=(E.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(u.independent=K),this.isVideoContiguous||(this.isVideoContiguous=K),P.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${M}/${$} dropped: ${P.dropped} start: ${P.firstKeyFramePTS||`NA`}`)}return u.initSegment=f,u.id3=ao$2(s,r,l,l),i.samples.length&&(u.text=oo$2(i,r,l)),u}};function Zt$2(n,e,t=!1){return n?.start!==void 0?(n.start+(t?n.duration:0))/n.timescale:e}function zc$3(n,e,t,s){if(n===null)return!0;let i=Math.max(s,1),r=e-n.baseTime/n.timescale;return Math.abs(r-t)>i}function Vn$2(n,e,t){let s=n.codec;return s&&s.length>4?s:e===ie$2.AUDIO?s===`ec-3`||s===`ac-3`||s===`alac`?s:s===`fLaC`||s===`Opus`?gs$3(s,!1):(t.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||`mp4a`):(t.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||`avc1`)}var Ve$2;try{Ve$2=self.performance.now.bind(self.performance)}catch(n){Ve$2=Date.now}var ls$3=[{demux:ki$2,remux:Gi$2},{demux:Mi$1,remux:St$3},{demux:Di$2,remux:St$3},{demux:Pi$2,remux:St$3}];ls$3.splice(2,0,{demux:Ci$2,remux:St$3});var _s$3=class{constructor(e,t,s,i,r,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.id=r,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,i){let r=s.transmuxing;r.executeStart=Ve$2();let a=new Uint8Array(e),{currentTransmuxState:o,transmuxConfig:c}=this;i&&(this.currentTransmuxState=i);let{contiguous:l,discontinuity:h,trackSwitch:u,accurateTimeOffset:d,timeOffset:f,initSegmentChange:g}=i||o,{audioCodec:p,videoCodec:y,defaultInitPts:E,duration:T,initSegmentData:S}=c,v=Qc$2(a,t);if(v&&Tt$2(v.method)){let R=this.getDecrypter(),b=Fr$2(v.method);if(R.isSync()){let I=R.softwareDecrypt(a,v.key.buffer,v.iv.buffer,b);if(s.part>-1){let O=R.flush();I=O&&O.buffer}if(!I)return r.executeEnd=Ve$2(),Zs$3(s);a=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=R.webCryptoDecrypt(a,v.key.buffer,v.iv.buffer,b).then(I=>{let C=this.push(I,null,s);return this.decryptionPromise=null,C}),this.decryptionPromise}let x=this.needsProbing(h,u);if(x){let R=this.configureTransmuxer(a);if(R)return this.logger.warn(`[transmuxer] ${R.message}`),this.observer.emit(m.ERROR,m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),r.executeEnd=Ve$2(),Zs$3(s)}(h||u||g||x)&&this.resetInitSegment(S,p,y,T,t),(h||g||x)&&this.resetInitialTimestamp(E),l||this.resetContiguity();let _=this.transmux(a,v,f,d,s);this.asyncResult=Kt$3(_);let A=this.currentTransmuxState;return A.contiguous=!0,A.discontinuity=!1,A.trackSwitch=!1,r.executeEnd=Ve$2(),_}flush(e){let t=e.transmuxing;t.executeStart=Ve$2();let{decrypter:s,currentTransmuxState:i,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));let a=[],{timeOffset:o}=i;if(s){let u=s.flush();u&&a.push(this.push(u.buffer,null,e))}let{demuxer:c,remuxer:l}=this;if(!c||!l){t.executeEnd=Ve$2();let u=[Zs$3(e)];return this.asyncResult?Promise.resolve(u):u}let h=c.flush(o);return Kt$3(h)?(this.asyncResult=!0,h.then(u=>(this.flushRemux(a,u,e),a))):(this.flushRemux(a,h,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,s){let{audioTrack:i,videoTrack:r,id3Track:a,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?` part: `+s.part:``} of ${this.id===N$1.MAIN?`level`:`track`} ${s.level}`);let h=this.remuxer.remux(i,r,a,o,l,c,!0,this.id);e.push({remuxResult:h,chunkMeta:s}),s.transmuxing.executeEnd=Ve$2()}resetInitialTimestamp(e){let{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){let{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,i,r){let{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,i),o.resetInitSegment(e,t,s,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,i,r){let a;return t&&t.method===`SAMPLE-AES`?a=this.transmuxSampleAes(e,t,s,i,r):a=this.transmuxUnencrypted(e,s,i,r),a}transmuxUnencrypted(e,t,s,i){let{audioTrack:r,videoTrack:a,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,a,o,c,t,s,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,s,i,r){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,i,!1,this.id),chunkMeta:r}))}
vendor: 3,962 bytes, line 2402
2402configureTransmuxer(e){let{config:t,observer:s,typeSupported:i}=this,r;for(let u=0,d=ls$3.length;u<d;u++){var a;if((a=ls$3[u].demux)!=null&&a.probe(e,this.logger)){r=ls$3[u];break}}if(!r)return new Error(`Failed to find demuxer by probing fragment data`);let o=this.demuxer,c=this.remuxer,l=r.remux,h=r.demux;(!c||!(c instanceof l))&&(this.remuxer=new l(s,t,i,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(s,t,i,this.logger),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Mt$4(this.config)),e}};function Qc$2(n,e){let t=null;return n.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}var Zs$3=n=>({remuxResult:{},chunkMeta:n});function Kt$3(n){return`then`in n&&n.then instanceof Function}var Ki$2=class{constructor(e,t,s,i,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=i,this.defaultInitPts=r||null}};var Vi$2=class{constructor(e,t,s,i,r,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=i,this.timeOffset=r,this.initSegmentChange=a}};var Hn$2=0;var Ds$2=class{constructor(e,t,s,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Hn$2++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{let l=c.data,h=this.hls;if(!(!h||!(l!=null&&l.event)||l.instanceNo!==this.instanceNo))switch(l.event){case`init`:{var u;let d=(u=this.workerContext)==null?void 0:u.objectURL;d&&self.URL.revokeObjectURL(d);break}case`transmuxComplete`:this.handleTransmuxComplete(l.data);break;case`flush`:this.onFlush(l.data);break;case`workerLog`:h.logger[l.data.logType]&&h.logger[l.data.logType](l.data.message);break;default:l.data=l.data||{},l.data.frag=this.frag,l.data.part=this.part,l.data.id=this.id,h.trigger(l.event,l.data);break}},this.onWorkerError=c=>{if(!this.hls)return;let l=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.INTERNAL_EXCEPTION,fatal:!1,event:`demuxerWorker`,error:l})};let r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=s,this.onFlush=i;let a=(c,l)=>{l=l||{},l.frag=this.frag||void 0,c===m.ERROR&&(l=l,l.parent=this.id,l.part=this.part,this.error=l.error),this.hls.trigger(c,l)};this.observer=new Nr$3,this.observer.on(m.FRAG_DECRYPTED,a),this.observer.on(m.ERROR,a);let o=on$3(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<`u`){let c=this.hls.logger;if(r.workerPath||dc$3()){try{r.workerPath?(c.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=gc$3(r.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=fc$3());let{worker:h}=this.workerContext;h.addEventListener(`message`,this.onWorkerMessage),h.addEventListener(`error`,this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:`init`,typeSupported:o,id:t,config:re$1(r)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new _s$3(this.observer,o,r,``,t,e.logger)}return}}this.transmuxer=new _s$3(this.observer,o,r,``,t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){let e=this.instanceNo;this.instanceNo=Hn$2++;let t=this.hls.config,s=on$3(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:`reset`,resetNo:e,typeSupported:s,id:this.id,c
vendor: 5,772 bytes, lines 2402-2408
2402onfig:re$1(t)})}}terminateWorker(){if(this.workerContext){let{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener(`message`,this.onWorkerMessage),e.removeEventListener(`error`,this.onWorkerError),mc$3(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{let t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}let e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,s,i,r,a,o,c,l,h){var u,d;l.transmuxing.start=self.performance.now();let{instanceNo:f,transmuxer:g}=this,p=a?a.start:r.start,y=r.decryptdata,E=this.frag,T=!(E&&r.cc===E.cc),S=!(E&&l.level===E.level),v=E?l.sn-E.sn:-1,x=this.part?l.part-this.part.index:-1,_=v===0&&l.id>1&&l.id===E?.stats.chunkCount,A=!S&&(v===1||v===0&&(x===1||_&&x<=0)),R=self.performance.now();(S||v||r.stats.parsing.start===0)&&(r.stats.parsing.start=R),a&&(x||!A)&&(a.stats.parsing.start=R);let b=!(E&&((u=r.initSegment)==null?void 0:u.url)===((d=E.initSegment)==null?void 0:d.url)),I=new Vi$2(T,A,c,S,p,b);if(!A||T||b){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${l.sn}${l.part>-1?` part: `+l.part:``} ${this.id===N$1.MAIN?`level`:`track`}: ${l.level} id: ${l.id} 2403 discontinuity: ${T} 2404 trackSwitch: ${S} 2405 contiguous: ${A} 2406 accurateTimeOffset: ${c} 2407 timeOffset: ${p} 2408 initSegmentChange: ${b}`);let C=new Ki$2(s,i,t,o,h);this.configureTransmuxer(C)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:`demux`,data:e,decryptdata:y,chunkMeta:l,state:I},e instanceof ArrayBuffer?[e]:[]);else if(g){let C=g.push(e,y,l,I);Kt$3(C)?C.then(O=>{this.handleTransmuxComplete(O)}).catch(O=>{this.transmuxerError(O,l,`transmuxer-interface push error`)}):this.handleTransmuxComplete(C)}}flush(e){e.transmuxing.start=self.performance.now();let{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:`flush`,chunkMeta:e});else if(s){let i=s.flush(e);Kt$3(i)?i.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,`transmuxer-interface flush error`)}):this.handleFlushResult(i,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}configureTransmuxer(e){let{instanceNo:t,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:`configure`,config:e}):s&&s.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}};var Yn$2=100;var Hi$2=class extends Bt$3{constructor(e,t,s){super(e,t,s,`audio-stream-controller`,N$1.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(m.BUFFER_RESET,this.onBufferReset,this),e.on(m.BUFFER_CREATED,this.onBufferCreated,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){let{hls:e}=this;e&&(super.unregisterListeners(),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(m.BUFFER_RESET,this.onBufferReset,this),e.off(m.BUFFER_CREATED,this.onBufferCreated,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:r,trackId:a}){if(s===N$1.MAIN){let o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:r,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${i/r} (${i}/${r}) trackId: ${a}`),this.mainAnchor=t,this.state===D$3.WAITING_INIT_PTS){let l=this.waitingData;(!l&&!this.loadingParts||l&&l.frag.cc!==o)&&this.syncWithAnchor(t,l?.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==o?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===D$3.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;let i=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&i?.cc===t.cc)return;let r=(i||e).cc,c=_a$2(this.getLevelDetails(),r,this.getLoadPosition());c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===D$3.IDLE&&this.doTickIdle())}
vendor: 26,562 bytes, lines 2408-2411
2408startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=D$3.STOPPED;return}let s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Yn$2),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=D$3.IDLE):this.state=D$3.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case D$3.IDLE:this.doTickIdle();break;case D$3.WAITING_TRACK:{let{levels:e,trackId:t}=this,s=e?.[t],i=s?.details;if(i&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(i))break;this.state=D$3.WAITING_INIT_PTS}break}case D$3.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break;case D$3.WAITING_INIT_PTS:{let e=this.waitingData;if(e){let{frag:t,part:s,cache:i,complete:r}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=D$3.FRAG_LOADING;let c={frag:t,part:s,payload:i.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(c),r&&super._handleFragmentLoadComplete(c)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=D$3.IDLE}}this.onTickEnd()}resetLoadingState(){let e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){let{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;let{hls:t,levels:s,media:i,trackId:r}=this,a=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(s!=null&&s[r]))return;let o=s[r],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=D$3.WAITING_TRACK,this.startFragRequested=!1;return}let l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ie$2.AUDIO,N$1.AUDIO));let h=this.getFwdBufferInfo(l,N$1.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(m.BUFFER_EOS,{type:`audio`}),this.state=D$3.ENDED;return}let u=h.len,d=t.maxBufferLength,f=c.fragments,g=f[0].start,p=this.getLoadPosition(),y=this.flushing?p:h.end;if(this.switchingTrack&&i){let S=p;c.PTSKnown&&S<g&&(h.end>g||h.nextStart)&&(this.log(`Alt audio track ahead of main track, seek to start of alt audio track`),i.currentTime=g+.05)}if(u>=d&&!this.switchingTrack&&y<f[f.length-1].start)return;let E=this.getNextFragment(y,c);if(E&&this.isLoopLoading(E,y)&&(E=this.getNextFragmentLoopLoading(E,c,h,N$1.MAIN,d)),!E){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(h,d,E))return;let T=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&T&&le$4(E)&&!E.endList&&(!c.live||!this.loadingParts&&y<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(T)===he$2.OK&&(this.mainFragLoading=T=null),T&&le$4(T))){if(E.start>T.end){let v=this.fragmentTracker.getFragAtPos(y,N$1.MAIN);v&&v.end>T.end&&(T=v,this.mainFragLoading={frag:v,targetBufferTime:null})}if(E.start>T.end)return}this.loadFragment(E,o,y)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new at$2(s))}onAudioTrackSwitching(e,t){let s=!!t.url;this.trackId=t.id;let{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==D$3.STOPPED&&(this.setInterval(Yn$2),this.state=D$3.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;let s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(m.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(e,t){var s;let{levels:i}=this,{details:r,id:a,groupId:o,track:c}=t;if(!i){this.warn(`Audio tracks reset while loading track ${a} "${c.name}" of "${o}"`);return}let l=this.mainDetails;if(!l||r.endCC>l.endCC||l.expired){this.cachedTrackLoadedData=t,this.state!==D$3.STOPPED&&(this.state=D$3.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${c.name}" of "${o}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:``},duration:${r.totalduration}`);let h=i[a],u=0;if(r.live||(s=h.details)!=null&&s.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(h.details){var d;u=this.alignPlaylists(r,h.details,(d=this.levelLastLoaded)==null?void 0:d.details)}r.alignedSliding||(Ha$1(r,l),r.alignedSliding||Is$2(r,l),u=r.fragmentStart)}h.details=r,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(l,u),this.hls.trigger(m.AUDIO_TRACK_UPDATED,{details:r,id:a,groupId:t.groupId}),this.state===D$3.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=D$3.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;let s=e.frag,{part:i,payload:r}=e,{config:a,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}let l=c[o];if(!l){this.warn(`Audio track is undefined on fragment load progress`);return}let h=l.details;if(!h){this.warn(`Audio track details undefined on fragment load progress`),this.removeUnbufferedFrags(s.start);return}let u=a.defaultAudioCodec||l.audioCodec||`mp4a.40.2`,d=this.transmuxer;d||(d=this.transmuxer=new Ds$2(this.hls,N$1.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));let f=this.initPTS[s.cc],g=(t=s.initSegment)==null?void 0:t.data;if(f!==void 0){let y=i?i.index:-1,E=y!==-1,T=new Nt$3(s.level,s.sn,s.stats.chunkCount,r.byteLength,y,E);d.push(r,g,u,``,s,i,h.totalduration,!1,T,f)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);let{cache:p}=this.waitingData=this.waitingData||{frag:s,part:i,cache:new Ls$2,complete:!1};p.push(new Uint8Array(r)),this.state!==D$3.STOPPED&&(this.state=D$3.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;let s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===N$1.MAIN&&le$4(t.frag)&&(this.mainFragLoading=t,this.state===D$3.IDLE&&this.tick())}onFragBuffered(e,t){let{frag:s,part:i}=t;if(s.type!==N$1.AUDIO){!this.audioOnly&&s.type===N$1.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?` p: `+i.index:``} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:`false`}`);return}if(le$4(s)){this.fragPrevious=s;let r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(m.AUDIO_TRACK_SWITCHED,ee$2({},r)))}this.fragBufferedComplete(s,i),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=D$3.ERROR;return}switch(t.details){case L$2.FRAG_GAP:case L$2.FRAG_PARSING_ERROR:case L$2.FRAG_DECRYPT_ERROR:case L$2.FRAG_LOAD_ERROR:case L$2.FRAG_LOAD_TIMEOUT:case L$2.KEY_LOAD_ERROR:case L$2.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(N$1.AUDIO,t);break;case L$2.AUDIO_TRACK_LOAD_ERROR:case L$2.AUDIO_TRACK_LOAD_TIMEOUT:case L$2.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===D$3.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===z$2.AUDIO_TRACK&&(this.state=D$3.IDLE);break;case L$2.BUFFER_ADD_CODEC_ERROR:case L$2.BUFFER_APPEND_ERROR:if(t.parent!==`audio`)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case L$2.BUFFER_FULL_ERROR:if(t.parent!==`audio`)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,`audio`));break;case L$2.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ie$2.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ie$2.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===D$3.ENDED&&(this.state=D$3.IDLE);let s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,N$1.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;let s=`audio`,{hls:i}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:c,part:l,level:h}=o,{details:u}=h,{audio:d,text:f,id3:g,initSegment:p}=r;if(this.fragContextChanged(c)||!u){this.fragmentTracker.removeFragment(c);return}if(this.state=D$3.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),p!=null&&p.tracks){let y=c.initSegment||c;if(this.unhandledEncryptionError(p,c))return;this._bufferInitSegment(h,p.tracks,y,a),i.trigger(m.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:s,tracks:p.tracks})}if(d){let{startPTS:y,endPTS:E,startDTS:T,endDTS:S}=d;l&&(l.elementaryStreams[ie$2.AUDIO]={startPTS:y,endPTS:E,startDTS:T,endDTS:S}),c.setElementaryStreamInfo(ie$2.AUDIO,y,E,T,S),this.bufferFragmentData(d,c,l,a)}if(g!=null&&(t=g.samples)!=null&&t.length){let y=se$3({id:s,frag:c,details:u},g);i.trigger(m.FRAG_PARSING_METADATA,y)}if(f){let y=se$3({id:s,frag:c,details:u},f);i.trigger(m.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,s,i){if(this.state!==D$3.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;let r=t.audio;r.id=N$1.AUDIO;let a=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`),a&&a.split(`,`).length===1&&(r.levelCodec=a),this.hls.trigger(m.BUFFER_CODECS,t);let o=r.initSegment;if(o!=null&&o.byteLength){let c={type:`audio`,frag:s,part:null,chunkMeta:i,parent:s.type,data:o};this.hls.trigger(m.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,s){let i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===he$2.NOT_LOADED||i===he$2.PARTIAL){var r;if(!le$4(e))this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=D$3.WAITING_INIT_PTS;let a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Is$2(t.details,a)}else super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){let{name:t,lang:s,assocLang:i,characteristics:r,audioCodec:a,channels:o}=this.bufferedTrack;rt$3({name:t,lang:s,assocLang:i,characteristics:r,audioCodec:a,channels:o},e,st$4)||(ys$3(e.url,this.hls)?(this.log(`Switching audio track : flushing all audio`),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,`audio`),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){let{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(m.AUDIO_TRACK_SWITCHED,ee$2({},e))}};var Vt$2=class extends xe$2{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){let i=t?.renditionReports;if(i){let r=-1;for(let a=0;a<i.length;a++){let o=i[a],c;try{c=new self.URL(o.URI,t.url).href}catch(l){this.warn(`Could not construct new URL for Rendition Report: ${l}`),c=o.URI||``}if(c===e){r=a;break}else c===e.substring(0,c.length)&&(r=a)}if(r!==-1){let a=i[r],o=parseInt(a[`LAST-MSN`])||t.lastPartSn,c=parseInt(a[`LAST-PART`])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){let h=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&h>t.partTarget&&(c+=1)}let l=s&&ln$2(s);return new ps$3(o,c>=0?c:void 0,l)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,t,s){let{details:i,stats:r}=t,a=self.performance.now(),o=r.loading.first?Math.max(0,a-r.loading.first):0;i.advancedDateTime=Date.now()-o;let c=this.hls.config.timelineOffset;if(c!==i.appliedTimelineOffset){let h=Math.max(c||0,0);i.appliedTimelineOffset=h,i.fragments.forEach(u=>{u.setStart(u.playlistOffset+h)})}if(i.live||s!=null&&s.live){let h=`levelInfo`in t?t.levelInfo:t.track;if(i.reloaded(s),s&&i.fragments.length>0){tc$3(s,i,this);let T=i.playlistParsingError;if(T){this.warn(T);let S=this.hls;if(!S.config.ignorePlaylistParsingErrors){var l;let{networkDetails:v}=t;S.trigger(m.ERROR,{type:V$1.NETWORK_ERROR,details:L$2.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:T,reason:T.message,level:t.level||void 0,parent:(l=i.fragments[0])==null?void 0:l.type,networkDetails:v,stats:r});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=r.loading.start);let u=this.hls.mainForwardBufferInfo,d=u?u.end-u.len:0,g=Ua$2(i,(i.edge-d)*1e3);if(i.requestScheduled+g<a?i.requestScheduled=a:i.requestScheduled<=a&&(i.requestScheduled+=g),this.log(`live playlist ${e} ${i.advanced?`REFRESHED `+i.lastPartSn+`-`+i.lastPartIndex:i.updated?`UPDATED`:`MISSED`}`),!this.canLoad||!i.live)return;let p,y,E;if(i.canBlockReload&&i.endSN&&i.advanced){let T=this.hls.config.lowLatencyMode,S=i.lastPartSn,v=i.endSN,x=i.lastPartIndex,_=x!==-1,A=S===v;_?A?(y=v+1,E=T?0:x):(y=S,E=T?x+1:i.maxPartIndex):y=v+1;let R=i.age,b=R+i.ageHeader,I=Math.min(b-i.partTarget,i.targetduration*1.5);if(I>0){if(b>i.targetduration*3)this.log(`Playlist last advanced ${R.toFixed(2)}s ago. Omitting segment and part directives.`),y=void 0,E=void 0;else if(s!=null&&s.tuneInGoal&&b-i.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${I} with playlist age: ${i.age}`),I=0;else{let C=Math.floor(I/i.targetduration);if(y+=C,E!==void 0){let O=Math.round(I%i.targetduration/i.partTarget);E+=O}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${R.toFixed(2)}s goal: ${I} skip sn ${C} to part ${E}`)}i.tuneInGoal=I}if(p=this.getDeliveryDirectives(i,t.deliveryDirectives,y,E),T||!A){i.requestScheduled=a,this.loadingPlaylist(h,p);return}}else(i.canBlockReload||i.canSkipUntil)&&(p=this.getDeliveryDirectives(i,t.deliveryDirectives,y,E));p&&y!==void 0&&i.canBlockReload&&(i.requestScheduled=r.loading.first+Math.max(g-o*2,g/2)),this.scheduleLoading(h,p,i)}else this.clearTimer()}scheduleLoading(e,t,s){let i=s||e.details;if(!i){this.loadingPlaylist(e,t);return}let r=self.performance.now(),a=i.requestScheduled;if(r>=a){this.loadingPlaylist(e,t);return}let o=a-r;this.log(`reload live playlist ${e.name||e.bitrate+`bps`} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,s,i){let r=ln$2(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,i=t.part,r=as$3.No),new ps$3(s,i,r)}checkRetry(e){let t=e.details,s=Es$2(e),i=e.errorAction,{action:r,retryCount:a=0,retryConfig:o}=i||{},c=!!i&&!!o&&(r===de$2.RetryRequest||!i.resolved&&r===de$2.SendAlternateToPenaltyBox);if(c){var l;if(a>=o.maxNumRetry)return!1;if(s&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{let h=Or$2(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,i.resolved=!0}return c}};function lo$2(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!Ht$2(n[t].attrs,e[t].attrs))return!1;return!0}function Ht$2(n,e,t){let s=n[`STABLE-RENDITION-ID`];return s&&!t?s===e[`STABLE-RENDITION-ID`]:!(t||[`LANGUAGE`,`NAME`,`CHARACTERISTICS`,`AUTOSELECT`,`DEFAULT`,`FORCED`,`ASSOC-LANGUAGE`]).some(i=>n[i]!==e[i])}function Yi$1(n,e){return e.label.toLowerCase()===n.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(n.lang||``).toLowerCase())}var Wi$2=class extends Vt$2{constructor(e){super(e,`audio-track-controller`),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){let{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVEL_LOADING,this.onLevelLoading,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(m.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){let{id:s,groupId:i,details:r}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==i){this.warn(`Audio track with id:${s} and group:${i} not found in active group ${a?.groupId}`);return}let o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let s=t.audioGroups||null,i=this.groupIds,r=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(o=>i?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;let o=this.tracks.filter(d=>!s||s.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=!1),o.forEach((d,f)=>{d.id=f});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;let c=this.hls.config.audioPreference;if(!r&&c){let d=Ue$1(c,o,st$4);if(d>-1)r=o[d];else{let f=Ue$1(c,this.tracks);r=this.tracks[f]}}let l=this.findTrackId(r);l===-1&&r&&(l=this.findTrackId(null));let h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(`,`)}`),this.hls.trigger(m.AUDIO_TRACKS_UPDATED,h);let u=this.trackId;if(l!==-1&&u===-1)this.setAudioTrack(l);else if(o.length&&u===-1){var a;let d=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(`,`)} track count: ${o.length}`);this.warn(d.message),this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}}onError(e,t){t.fatal||!t.context||t.context.type===z$2.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){let t=this.hls;if(t.config.audioPreference=e,e){let s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){let i=this.currentTrack;if(i&&rt$3(e,i,st$4))return i;let r=Ue$1(e,this.tracksInGroup,st$4);if(r>-1){let a=this.tracksInGroup[r];return this.setAudioTrack(r),a}else if(i){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);let o=Cl$3(e,t.levels,s,a,st$4);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){let a=Ue$1(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){let t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;let s=this.currentTrack,i=t[e],r=i.details&&!i.details.live;if(e===this.trackId&&i===s&&r||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(m.AUDIO_TRACK_SWITCHING,ee$2({},i)),r))return;let a=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(a)}findTrackId(e){let t=this.tracksInGroup;for(let s=0;s<t.length;s++){let i=t[s];if(!(this.selectDefaultTrack&&!i.default)&&(!e||rt$3(e,i,st$4)))return s}if(e){let{name:s,lang:i,assocLang:r,characteristics:a,audioCodec:o,channels:c}=e;for(let l=0;l<t.length;l++){let h=t[l];if(rt$3({name:s,lang:i,assocLang:r,characteristics:a,audioCodec:o,channels:c},h,st$4))return l}for(let l=0;l<t.length;l++){let h=t[l];if(Ht$2(e.attrs,h.attrs,[`LANGUAGE`,`ASSOC-LANGUAGE`,`CHARACTERISTICS`]))return l}for(let l=0;l<t.length;l++){let h=t[l];if(Ht$2(e.attrs,h.attrs,[`LANGUAGE`]))return l}}return-1}loadPlaylist(e){super.loadPlaylist();let t=this.currentTrack;this.shouldLoadPlaylist(t)&&ys$3(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let s=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading audio-track ${s} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?` at sn `+t.msn+` part `+t.part:``}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${r}`),this.hls.trigger(m.AUDIO_TRACK_LOADING,{url:r,id:s,groupId:i,deliveryDirectives:t||null,track:e})}};var qi$1=class{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,s){if(this.queues===null||this.tracks===null)return;let i=this.queues[t];i.push(e),i.length===1&&!s&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{let s={label:`async-blocker`,execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){let s={label:`async-blocker-prepend`,execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;let s=(t=e[0])==null?void 0:t.label;(s===`async-blocker`||s===`async-blocker-prepend`)&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext(`audio`)}executeNext(e){if(this.queues===null||this.tracks===null)return;let t=this.queues[e];if(t.length){let i=t[0];try{i.execute()}catch(r){var s;if(i.onError(r),this.queues===null||this.tracks===null)return;let a=(s=this.tracks[e])==null?void 0:s.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){let{queues:e,tracks:t}=this;return e===null||t===null?`<destroyed>`:` 2409${this.list(`video`)} 2410${this.list(`audio`)} 2411${this.list(`audiovideo`)}}`}list(e){var t,s;return(t=this.queues)!=null&&t[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:``}listSbInfo(e){var t;let s=(t=this.tracks)==null?void 0:t[e],i=s?.buffer;return i?`SourceBuffer${i.updating?` updating`:``}${s.ended?` ended`:``}${s.ending?` ending`:``}`:`none`}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(s=>s.label).join(`, `))||``}};var Wn$2=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;var co$2=`HlsJsTrackRemovedError`;var ji$2=class extends Error{constructor(e){super(e),this.name=co$2}};var Xi$1=class extends xe$2{constructor(e,t){super(`buffer-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)===`open`&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{let{media:i,mediaSource:r}=this;s&&this.log(`Media source opened`),!(!i||!r)&&(r.removeEventListener(`sourceopen`,this._onMediaSourceOpen),i.removeEventListener(`emptied`,this._onMediaEmptied),this.updateDuration(),this.hls.trigger(m.MEDIA_ATTACHED,{media:i,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log(`Media source closed`)},this._onMediaSourceEnded=()=>{this.log(`Media source ended`)},this._onMediaEmptied=()=>{let{mediaSrc:s,_objectUrl:i}=this;s!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${s})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=Ho$3(Xe$1(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){let{hls:e}=this;e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.BUFFER_RESET,this.onBufferReset,this),e.on(m.BUFFER_APPENDING,this.onBufferAppending,this),e.on(m.BUFFER_CODECS,this.onBufferCodecs,this),e.on(m.BUFFER_EOS,this.onBufferEos,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.FRAG_PARSED,this.onFragParsed,this),e.on(m.FRAG_CHANGED,this.onFragChanged,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;
2411e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.BUFFER_RESET,this.onBufferReset,this),e.off(m.BUFFER_APPENDING,this.onBufferAppending,this),e.off(m.BUFFER_CODECS,this.onBufferCodecs,this),e.off(m.BUFFER_EOS,this.onBufferEos,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.FRAG_PARSED,this.onFragParsed,this),e.off(m.FRAG_CHANGED,this.onFragChanged,this),e.off(m.ERROR,this.onError,this)}transferMedia(){let{media:e,mediaSource:t}=this;if(!e)return null;let s={};if(this.operationQueue){let r=this.isUpdating();r||this.operationQueue.removeBlockers();let a=this.isQueued();(r||a)&&this.warn(`Transfering MediaSource with${a?` operations in queue`:``}${r?` updating SourceBuffer(s)`:``} ${this.operationQueue}`),this.operationQueue.destroy()}let i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?se$3(s,i.tracks):this.sourceBuffers.forEach(r=>{let[a]=r;a&&(s[a]=se$3({},this.tracks[a]),this.removeBuffer(a)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:s}}initTracks(){let e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var s;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){let s=this.media=t.media;this.transferData=this.overrides=void 0;let i=Xe$1(this.appendSource);if(i){let r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);let a=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(a),r)this._objectUrl=s.src,this.attachTransferred();else{let o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute(`src`);let c=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||c&&a instanceof c,qn$2(s),Zc$3(s,o),s.load()}catch(c){s.src=o}else s.src=o}s.addEventListener(`emptied`,this._onMediaEmptied)}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?`transferred`:`created`} media source: ${(s=e.constructor)==null?void 0:s.name}`),e.addEventListener(`sourceopen`,this._onMediaSourceOpen),e.addEventListener(`sourceended`,this._onMediaSourceEnded),e.addEventListener(`sourceclose`,this._onMediaSourceClose),this.appendSource&&(e.addEventListener(`startstreaming`,this._onStartStreaming),e.addEventListener(`endstreaming`,this._onEndStreaming))}attachTransferred(){let e=this.media,t=this.transferData;if(!t||!e)return;let s=this.tracks,i=t.tracks,r=i?Object.keys(i):null,a=r?r.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&r&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log(`attachTransferred: waiting for SourceBuffer track info`);return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) 2412required tracks: ${re$1(s,(c,l)=>c===`initSegment`?void 0:l)}; 2413transfer tracks: ${re$1(i,(c,l)=>c===`initSegment`?void 0:l)}}`),!ua$2(i,s)){t.mediaSource=null,t.tracks=void 0;let c=e.currentTime,l=this.details,h=Math.max(c,l?.fragments[0].start||0);if(h-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(s)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(m.MEDIA_DETACHING,{}
vendor: 23,744 bytes, line 2413
2413),this.onMediaAttaching(m.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,r.forEach(c=>{let l=c,h=i[l];if(h){let u=h.buffer;if(u){let d=this.fragmentTracker,f=h.id;if(d.hasFragments(f)||d.hasParts(f)){let y=W$2.getBuffered(u);d.detectEvictedFragments(l,y,f,null,!0)}let g=Js$3(l),p=[l,u];this.sourceBuffers[g]=p,u.updating&&this.operationQueue&&this.operationQueue.prependBlocker(l),this.trackSourceBuffer(l,h)}}}),o(),this.bufferCreated()}else this.log(`attachTransferred: MediaSource w/o SourceBuffers`),o()}get mediaSourceOpenOrEnded(){var e;let t=(e=this.mediaSource)==null?void 0:e.readyState;return t===`open`||t===`ended`}onMediaDetaching(e,t){let s=!!t.transferMedia;this.transferData=this.overrides=void 0;let{media:i,mediaSource:r,_objectUrl:a}=this;if(r){if(this.log(`media source ${s?`transferring`:`detaching`}`),s)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){let o=r.readyState===`open`;try{let c=r.sourceBuffers;for(let l=c.length;l--;)o&&c[l].abort(),r.removeSourceBuffer(c[l]);o&&r.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener(`sourceopen`,this._onMediaSourceOpen),r.removeEventListener(`sourceended`,this._onMediaSourceEnded),r.removeEventListener(`sourceclose`,this._onMediaSourceClose),this.appendSource&&(r.removeEventListener(`startstreaming`,this._onStartStreaming),r.removeEventListener(`endstreaming`,this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener(`emptied`,this._onMediaEmptied),s||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(i.removeAttribute(`src`),this.appendSource&&qn$2(i),i.load()):this.warn(`media|source.src was changed by a third party - skip cleanup`)),this.media=null),this.hls.trigger(m.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;let s=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),s)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Js$3(e)]=[null,null];let t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new qi$1(this.tracks)}onBufferCodecs(e,t){var s;let i=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);let a=`audiovideo`in t&&(i.audio||i.video)||i.audiovideo&&(`audio`in t||`video`in t),o=!a&&this.sourceBufferCount&&this.media&&r.some(c=>!i[c]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${r}" SourceBuffers`);return}r.forEach(c=>{var l,h;let{id:d,codec:f,levelCodec:g,container:p,metadata:y,supplemental:E}=t[c],T=i[c],S=(l=this.transferData)==null||(l=l.tracks)==null?void 0:l[c],v=S!=null&&S.buffer?S:T,x=v?.pendingCodec||v?.codec,_=v?.levelCodec;T||(T=i[c]={buffer:void 0,listeners:[],codec:f,supplemental:E,container:p,levelCodec:g,metadata:y,id:d});let A=ns$3(x,_),R=A?.replace(Wn$2,`$1`),b=ns$3(f,g),I=(h=b)==null?void 0:h.replace(Wn$2,`$1`);b&&A&&R!==I&&(c.slice(0,5)===`audio`&&(b=gs$3(b,this.appendSource)),this.log(`switching codec ${x} to ${b}`),b!==(T.pendingCodec||T.codec)&&(T.pendingCodec=b),T.container=p,this.appendChangeType(c,p,b))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((s=t.audio)==null?void 0:s.id)===`main`&&(this.log(`Main audio-only`),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{let s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){let i=`${t};codecs=${s}`,r={label:`change-type=${i}`,execute:()=>{let a=this.tracks[e];if(a){let o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),a.codec=s,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;let s=e.start,i=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,N$1.MAIN))==null?void 0:t.gap)===!0)return;let a={label:`block-audio`,execute:()=>{var o;let c=this.tracks.video;(this.lastVideoAppendEnd>i||c!=null&&c.buffer&&W$2.isBuffered(c.buffer,i)||((o=this.fragmentTracker.getAppendedFrag(i,N$1.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext(`audio`))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Error executing block-audio operation`,o)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,`audio`,!0)}unblockAudio(){let{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){let{tracks:s}=this,{data:i,type:r,parent:a,frag:o,part:c,chunkMeta:l,offset:h}=t,u=l.buffering[r],{sn:d,cc:f}=o,g=self.performance.now();u.start=g;let p=o.stats.buffering,y=c?c.stats.buffering:null;p.start===0&&(p.start=g),y&&y.start===0&&(y.start=g);let E=s.audio,T=!1;r===`audio`&&E?.container===`audio/mpeg`&&(T=!this.lastMpegAudioChunk||l.id===1||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);let S=s.video,v=S?.buffer;if(v&&d!==`initSegment`){let A=c||o,R=this.blockedAudioAppend;if(r===`audio`&&a!==`main`&&!this.blockedAudioAppend&&!(S.ending||S.ended)){let I=A.start+A.duration*.05,C=v.buffered,O=this.currentOp(`video`);!C.length&&!O?this.blockAudio(A):!O&&!W$2.isBuffered(v,I)&&this.lastVideoAppendEnd<I&&this.blockAudio(A)}else if(r===`video`){let b=A.end;if(R){let I=R.frag.start;(b>I||b<this.lastVideoAppendEnd||W$2.isBuffered(v,I))&&this.unblockAudio()}this.lastVideoAppendEnd=b}}let x=(c||o).start,_={label:`append-${r}`,execute:()=>{var A;u.executeStart=self.performance.now();let R=(A=this.tracks[r])==null?void 0:A.buffer;R&&(T?this.updateTimestampOffset(R,x,.1,r,d,f):h!==void 0&&F$1(h)&&this.updateTimestampOffset(R,h,1e-6,r,d,f)),this.appendExecutor(i,r)},onStart:()=>{},onComplete:()=>{let A=self.performance.now();u.executeEnd=u.end=A,p.first===0&&(p.first=A),y&&y.first===0&&(y.first=A);let R={};this.sourceBuffers.forEach(([b,I])=>{b&&(R[b]=W$2.getBuffered(I))}),this.appendErrors[r]=0,r===`audio`||r===`video`?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(m.BUFFER_APPENDED,{type:r,frag:o,part:c,chunkMeta:l,parent:o.type,timeRanges:R})},onError:A=>{var R;let b={type:V$1.MEDIA_ERROR,parent:o.type,details:L$2.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:o,part:c,chunkMeta:l,error:A,err:A,fatal:!1},I=(R=this.media)==null?void 0:R.error;if(A.code===DOMException.QUOTA_EXCEEDED_ERR||A.name==`QuotaExceededError`||`quota`in A)b.details=L$2.BUFFER_FULL_ERROR;else if(A.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)b.errorAction=Et$3(!0);else if(A.name===co$2&&this.sourceBufferCount===0)b.errorAction=Et$3(!0);else{let C=++this.appendErrors[r];this.warn(`Failed ${C}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${I||`no media error`})`),(C>=this.hls.config.appendErrorMaxRetry||I)&&(b.fatal=!0)}this.hls.trigger(m.ERROR,b)}};this.log(`queuing "${r}" append sn: ${d}${c?` p: `+c.index:``} of ${o.type===N$1.MAIN?`level`:`track`} ${o.level} cc: ${f}`),this.append(_,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:`remove`,execute:()=>{this.removeExecutor(e,t,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(m.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${s} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){let{type:s,startOffset:i,endOffset:r}=t;s?this.append(this.getFlushOp(s,i,r),s):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,i,r),a)})}onFragParsed(e,t){let{frag:s,part:i}=t,r=[],a=i?i.elementaryStreams:s.elementaryStreams;a[ie$2.AUDIOVIDEO]?r.push(`audiovideo`):(a[ie$2.AUDIO]&&r.push(`audio`),a[ie$2.VIDEO]&&r.push(`video`));let o=()=>{let c=self.performance.now();s.stats.buffering.end=c,i&&(i.stats.buffering.end=c);let l=i?i.stats:s.stats;this.hls.trigger(m.FRAG_BUFFERED,{frag:s,part:i,stats:l,id:s.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,r).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){let t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([a])=>{if(a){let o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});let i=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?i?(this.log(`Queueing EOS`),this.blockUntilOpen(()=>{this.tracksEnded();let{mediaSource:a}=this;if(!a||a.readyState!==`open`){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log(`Calling mediaSource.endOfStream()`),a.endOfStream(),this.hls.trigger(m.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(m.BUFFERED_TO_END,void 0)):t.type===`video`&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){let t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{let e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===L$2.BUFFER_APPEND_ERROR&&t.frag){var s;let i=(s=t.errorAction)==null?void 0:s.nextAutoLevel;F$1(i)&&i!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){let{hls:e,details:t,media:s}=this;if(!s||t===null||!this.sourceBufferCount)return;let i=e.config,r=s.currentTime,a=t.levelTargetDuration,o=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(F$1(o)&&o>=0){let l=Math.max(o,a),h=Math.floor(r/a)*a-l;this.flushBackBuffer(r,a,h)}let c=i.frontBufferFlushThreshold;if(F$1(c)&&c>0){let l=Math.max(i.maxBufferLength,c),h=Math.max(l,a),u=Math.floor(r/a)*a+h;this.flushFrontBuffer(r,a,u)}}flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([i,r])=>{if(r){let o=W$2.getBuffered(r);if(o.length>0&&s>o.start(0)){var a;this.hls.trigger(m.BACK_BUFFER_REACHED,{bufferEnd:s});let c=this.tracks[i];if((a=this.details)!=null&&a.live)this.hls.trigger(m.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(c!=null&&c.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:i})}}})}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([i,r])=>{if(r){let a=W$2.getBuffered(r),o=a.length;if(o<2)return;let c=a.start(o-1),l=a.end(o-1);if(s>c||e>=c&&e<=l)return;this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:c,endOffset:Infinity,type:i})}})}getDurationAndRange(){var e;let{details:t,mediaSource:s}=this;if(!t||!this.media||s?.readyState!==`open`)return null;let i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&s.setLiveSeekableRange){let l=Math.max(0,t.fragmentStart);return{duration:Infinity,start:l,end:Math.max(l,i)}}return{duration:Infinity}}let r=(e=this.overrides)==null?void 0:e.duration;if(r)return F$1(r)?{duration:r}:null;let a=this.media.duration;return i>(F$1(s.duration)?s.duration:0)&&i>a||!F$1(a)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:s}){let i=this.mediaSource;!this.media||!i||i.readyState!==`open`||(i.duration!==e&&(F$1(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${s}.`),i.setLiveSeekableRange(t,s)))}get tracksReady(){let e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){let{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${re$1(s)}`),this.tracksReady){var i;let r=(i=this.transferData)==null?void 0:i.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){let e={};this.sourceBuffers.forEach(([t,s])=>{if(t){let i=this.tracks[t];e[t]={buffer:s,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(m.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{let e=new Error(`could not create source buffer for media codec(s)`);this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){let{tracks:e,sourceBuffers:t,mediaSource:s}=this;if(!s)throw new Error(`createSourceBuffers called when mediaSource was null`);for(let r in e){let a=r,o=e[a];if(this.isPending(o)){let c=this.getTrackCodec(o,a),l=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${l})${this.currentOp(a)?` Queued`:``} ${re$1(o)}`);try{let h=s.addSourceBuffer(l),u=Js$3(a);t[u]=[a,h],o.buffer=h}catch(h){var i;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(a),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[a],this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,sourceBufferName:a,mimeType:l,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){let s=e.supplemental,i=e.codec;s&&(t===`video`||t===`audiovideo`)&&Ot$4(s,`video`)&&(i=ul$3(i,s));let r=ns$3(i,e.levelCodec);return r?t.slice(0,5)===`audio`?gs$3(r,this.appendSource):r:``}trackSourceBuffer(e,t){let s=t.buffer;if(!s)return;let i=this.getTrackCodec(t,e);this.tracks[e]={buffer:s,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,`updatestart`,this.onSBUpdateStart),this.addBufferListener(e,`updateend`,this.onSBUpdateEnd),this.addBufferListener(e,`error`,this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,`bufferedchange`,(r,a)=>{let o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(m.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;return(((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,`source`))||this.media)?.src}onSBUpdateStart(e){let t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)===`closed`){this.resetBuffer(e);return}let s=this.currentOp(e);s&&(s.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var s;let i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${i}`,t),this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});let r=this.currentOp(e);r&&r.onError(i)}updateTimestampOffset(e,t,s,i,r,a){let o=t-e.timestampOffset;Math.abs(o)>=s&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,s){let{media:i,mediaSource:r}=this,a=this.tracks[e],o=a?.buffer;if(!i||!r||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}let c=F$1(i.duration)?i.duration:Infinity,l=F$1(r.duration)?r.duration:Infinity,h=Math.max(0,t),u=Math.min(s,c,l);u>h&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),o.remove(h,u)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){let s=this.tracks[t],i=s?.buffer;if(!i)throw new ji$2(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log(`Blocking operation requested, but no SourceBuffers exist`),Promise.resolve().then(e);let{operationQueue:s}=this,i=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(a=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var s;let i=(s=this.tracks[t])==null?void 0:s.buffer;!i||i.updating||this.shiftAndExecuteNext(t)})}append(e,t,s){this.operationQueue&&this.operationQueue.append(e,t,s)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,s){let i=this.tracks[e];if(!i)return;let r=i.buffer;if(!r)return;let a=s.bind(this,e);i.listeners.push({event:t,listener:a}),r.addEventListener(t,a)}removeBufferListeners(e){let t=this.tracks[e];if(!t)return;let s=t.buffer;s&&(t.listeners.forEach(i=>{s.removeEventListener(i.event,i.listener)}),t.listeners.length=0)}};function qn$2(n){let e=n.querySelectorAll(`source`);[].slice.call(e).forEach(t=>{n.removeChild(t)})}function Zc$3(n,e){let t=self.document.createElement(`source`);t.type=`video/mp4`,t.src=e,n.appendChild(t)}function Js$3(n){return n===`audio`?1:0}var zi$2=class n{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){let{hls:e}=this;e.on(m.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.BUFFER_CODECS,this.onBufferCodecs,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(m.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.BUFFER_CODECS,this.onBufferCodecs,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){let s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&F$1(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}let e=this.hls.levels;if(e.length){let t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){let t=this.hls.levels;if(!t.length)return-1;let s=t.filter((i,r)=>this.isLevelAllowed(i)&&r<=e);return this.clientRect=null,n.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;let i=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0,r=e.length-1,a=Math.max(t,s);for(let o=0;o<e.length;o+=1){let c=e[o];if((c.width>=a||c.height>=a)&&i(c,e[o+1])){r=o;break}}return r}};var Se$2={MANIFEST:`m`,AUDIO:`a`,VIDEO:`v`,MUXED:`av`,INIT:`i`,CAPTION:`c`,TIMED_TEXT:`tt`,KEY:`k`,OTHER:`o`};var th$1={HLS:`h`};var He$2=class n{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof n?s:new n(s))),this.value=e,this.params=t}};var sh$1=`Dict`;function ih$1(n){return Array.isArray(n)?JSON.stringify(n):n instanceof Map?`Map{}`:n instanceof Set?`Set{}`:typeof n==`object`?JSON.stringify(n):String(n)}function rh$1(n,e,t,s){return new Error(`failed to ${n} "${ih$1(e)}" as ${t}`,{cause:s})}function $e$2(n,e,t){return rh$1(`serialize`,n,e,t)}var Cs$3=class{constructor(e){this.description=e}};var jn$2=`Bare Item`;var nh$1=`Boolean`;function ah$1(n){if(typeof n!=`boolean`)throw $e$2(n,nh$1);return n?`?1`:`?0`}
2413function oh$1(n){return btoa(String.fromCharCode(...n))}var lh$1=`Byte Sequence`;function ch$1(n){if(ArrayBuffer.isView(n)===!1)throw $e$2(n,lh$1);return`:${oh$1(n)}:`}var hh$1=`Integer`;function uh$1(n){return n<-999999999999999||999999999999999<n}function ho$2(n){if(uh$1(n))throw $e$2(n,hh$1);return n.toString()}function dh$1(n){return`@${ho$2(n.getTime()/1e3)}`}function uo$2(n,e){if(n<0)return-uo$2(-n,e);let t=Math.pow(10,e);if(Math.abs(n*t%1-.5)<Number.EPSILON){let i=Math.floor(n*t);return(i%2===0?i:i+1)/t}else return Math.round(n*t)/t}var fh$1=`Decimal`;function gh$1(n){let e=uo$2(n,3);if(Math.floor(Math.abs(e)).toString().length>12)throw $e$2(n,fh$1);let t=e.toString();return t.includes(`.`)?t:`${t}.0`}var mh$1=`String`;var ph$1=/[\x00-\x1f\x7f]+/;function yh$1(n){if(ph$1.test(n))throw $e$2(n,mh$1);return`"${n.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Eh$2(n){return n.description||n.toString().slice(7,-1)}var Th$1=`Token`;function Xn$3(n){let e=Eh$2(n);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw $e$2(e,Th$1);return e}function Qi$2(n){switch(typeof n){case`number`:if(!F$1(n))throw $e$2(n,jn$2);return Number.isInteger(n)?ho$2(n):gh$1(n);case`string`:return yh$1(n);case`symbol`:return Xn$3(n);case`boolean`:return ah$1(n);case`object`:if(n instanceof Date)return dh$1(n);if(n instanceof Uint8Array)return ch$1(n);if(n instanceof Cs$3)return Xn$3(n);default:throw $e$2(n,jn$2)}}var Sh$1=`Key`;function Zi$2(n){if(/^[a-z*][a-z0-9\-_.*]*$/.test(n)===!1)throw $e$2(n,Sh$1);return n}function Vr$3(n){return n==null?``:Object.entries(n).map(([e,t])=>t===!0?`;${Zi$2(e)}`:`;${Zi$2(e)}=${Qi$2(t)}`).join(``)}function fo$2(n){return n instanceof He$2?`${Qi$2(n.value)}${Vr$3(n.params)}`:Qi$2(n)}function vh$1(n){return`(${n.value.map(fo$2).join(` `)})${Vr$3(n.params)}`}function xh$1(n,e={whitespace:!0}){if(typeof n!=`object`||n==null)throw $e$2(n,sh$1);let t=n instanceof Map?n.entries():Object.entries(n),s=e?.whitespace?` `:``;return Array.from(t).map(([i,r])=>{r instanceof He$2||(r=new He$2(r));let a=Zi$2(i);return r.value===!0?a+=Vr$3(r.params):(a+=`=`,Array.isArray(r.value)?a+=vh$1(r):a+=fo$2(r)),a}).join(`,${s}`)}function go$2(n,e){return xh$1(n,e)}var Me$2=`CMCD-Object`;var oe$1=`CMCD-Request`;var et$1=`CMCD-Session`;var We$1=`CMCD-Status`;var Ah$1={br:Me$2,ab:Me$2,d:Me$2,ot:Me$2,tb:Me$2,tpb:Me$2,lb:Me$2,tab:Me$2,lab:Me$2,url:Me$2,pb:oe$1,bl:oe$1,tbl:oe$1,dl:oe$1,ltc:oe$1,mtp:oe$1,nor:oe$1,nrr:oe$1,rc:oe$1,sn:oe$1,sta:oe$1,su:oe$1,ttfb:oe$1,ttfbb:oe$1,ttlb:oe$1,cmsdd:oe$1,cmsds:oe$1,smrt:oe$1,df:oe$1,cs:oe$1,ts:oe$1,cid:et$1,pr:et$1,sf:et$1,sid:et$1,st:et$1,v:et$1,msd:et$1,bs:We$1,bsd:We$1,cdn:We$1,rtp:We$1,bg:We$1,pt:We$1,ec:We$1,e:We$1};var Ih$2={REQUEST:oe$1};function Lh$2(n){return Object.keys(n).reduce((e,t)=>{var s;return(s=n[t])===null||s===void 0||s.forEach(i=>e[i]=t),e},{})}function Rh$2(n,e){let t={};if(!n)return t;let s=Object.keys(n),i=e?Lh$2(e):{};return s.reduce((r,a)=>{var o;let c=Ah$1[a]||i[a]||Ih$2.REQUEST,l=(o=r[c])!==null&&o!==void 0?o:r[c]={};return l[a]=n[a],r},t)}function bh(n){return[`ot`,`sf`,`st`,`e`,`sta`].includes(n)}
2413function _h$1(n){return typeof n==`number`?F$1(n):n!=null&&n!==``&&n!==!1}var mo$2=`event`;function Dh$2(n,e){let t=new URL(n),s=new URL(e);if(t.origin!==s.origin)return n;let i=t.pathname.split(`/`).slice(1),r=s.pathname.split(`/`).slice(1,-1);for(;i[0]===r[0];)i.shift(),r.shift();for(;r.length;)r.shift(),i.unshift(`..`);return i.join(`/`)+t.search+t.hash}var cs$3=n=>Math.round(n);var Ji$2=(n,e)=>Array.isArray(n)?n.map(t=>Ji$2(t,e)):n instanceof He$2&&typeof n.value==`string`?new He$2(Ji$2(n.value,e),n.params):(e.baseUrl&&(n=Dh$2(n,e.baseUrl)),e.version===1?encodeURIComponent(n):n);var Jt$1=n=>cs$3(n/100)*100;var Ch$2=(n,e)=>{let t=n;return e.version>=2&&(n instanceof He$2&&typeof n.value==`string`?t=new He$2([n]):typeof n==`string`&&(t=[n])),Ji$2(t,e)};var Ph$2={br:cs$3,d:cs$3,bl:Jt$1,dl:Jt$1,mtp:Jt$1,nor:Ch$2,rtp:Jt$1,tb:cs$3};var po$2=`request`;var yo$3=`response`;var Hr$3=[`ab`,`bg`,`bl`,`br`,`bs`,`bsd`,`cdn`,`cid`,`cs`,`df`,`ec`,`lab`,`lb`,`ltc`,`msd`,`mtp`,`pb`,`pr`,`pt`,`sf`,`sid`,`sn`,`st`,`sta`,`tab`,`tb`,`tbl`,`tpb`,`ts`,`v`];var kh$2=[`e`];var wh$2=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Us$2(n){return wh$2.test(n)}function Oh$2(n){return Hr$3.includes(n)||kh$2.includes(n)||Us$2(n)}var Eo$3=[`d`,`dl`,`nor`,`ot`,`rtp`,`su`];function Fh$2(n){return Hr$3.includes(n)||Eo$3.includes(n)||Us$2(n)}var Mh$1=[`cmsdd`,`cmsds`,`rc`,`smrt`,`ttfb`,`ttfbb`,`ttlb`,`url`];function Nh$2(n){return Hr$3.includes(n)||Eo$3.includes(n)||Mh$1.includes(n)||Us$2(n)}var Bh$2=[`bl`,`br`,`bs`,`cid`,`d`,`dl`,`mtp`,`nor`,`nrr`,`ot`,`pr`,`rtp`,`sf`,`sid`,`st`,`su`,`tb`,`v`];function Uh$2(n){return Bh$2.includes(n)||Us$2(n)}var $h$1={[yo$3]:Nh$2,[mo$2]:Oh$2,[po$2]:Fh$2};function To$2(n,e={}){let t={};if(n==null||typeof n!=`object`)return t;let s=e.version||n.v||1,i=e.reportingMode||po$2,r=s===1?Uh$2:$h$1[i],a=Object.keys(n).filter(r),o=e.filter;typeof o==`function`&&(a=a.filter(o));let c=i===yo$3||i===mo$2;c&&!a.includes(`ts`)&&a.push(`ts`),s>1&&!a.includes(`v`)&&a.push(`v`);let l=se$3({},Ph$2,e.formatters),h={version:s,reportingMode:i,baseUrl:e.baseUrl};return a.sort().forEach(u=>{let d=n[u],f=l[u];if(typeof f==`function`&&(d=f(d,h)),u===`v`){if(s===1)return;d=s}u==`pr`&&d===1||(c&&u===`ts`&&!F$1(d)&&(d=Date.now()),_h$1(d)&&(bh(u)&&typeof d==`string`&&(d=new Cs$3(d)),t[u]=d))}),t}function Gh$1(n,e={}){let t={};if(!n)return t;let i=Rh$2(To$2(n,e),e?.customHeaderMap);return Object.entries(i).reduce((r,[a,o])=>{let c=go$2(o,{whitespace:!1});return c&&(r[a]=c),r},t)}function Kh$1(n,e,t){return se$3(n,Gh$1(e,t))}var Vh$2=`CMCD`;function Hh$2(n,e={}){return n?go$2(To$2(n,e),{whitespace:!1}):``}function Yh$2(n,e={}){if(!n)return``;let t=Hh$2(n,e);return encodeURIComponent(t)}function Wh$2(n,e={}){if(!n)return``;return`${Vh$2}=${Yh$2(n,e)}`}var zn$2=/CMCD=[^&#]+/;function qh$1(n,e,t){let s=Wh$2(e,t);if(!s)return n;if(zn$2.test(n))return n.replace(zn$2,s);return`${n}${n.includes(`?`)?`&`:`?`}${s}`}var er$3=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:Se$2.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn(`Could not generate manifest CMCD data.`,r)}},this.applyFragmentData=i=>{try{let{frag:r,part:a}=i,o=this.hls.levels[r.level],c=this.getObjectType(r),l={d:(a||r).duration*1e3,ot:c};(c===Se$2.VIDEO||c===Se$2.AUDIO||c==Se$2.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(c)/1e3,l.bl=this.getBufferLength(c));let h=a?this.getNextPart(a):this.getNextFrag(r);h!=null&&h.url&&h.url!==r.url&&(l.nor=h.url),this.apply(i,l)}catch(r){this.hls.logger.warn(`Could not generate segment CMCD data.`,r)}},this.hls=e;let t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||e.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;
2413e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHED,this.onMediaDetached,this),e.on(m.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHED,this.onMediaDetached,this),e.off(m.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`waiting`,this.onWaiting),this.media.addEventListener(`playing`,this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener(`waiting`,this.onWaiting),this.media.removeEventListener(`playing`,this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,i;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:th$1.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){se$3(t,this.createData());let s=t.ot===Se$2.INIT||t.ot===Se$2.VIDEO||t.ot===Se$2.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su??(t.su=this.buffering);let{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((a,o)=>(i.includes(o)&&(a[o]=t[o]),a),{}));let r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Kh$1(e.headers,t,r)):e.url=qh$1(e.url,t,r)}getNextFrag(e){var t;let s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){let i=e.sn-s.startSN;return s.fragments[i+1]}}getNextPart(e){var t;let{index:s,fragment:i}=e,r=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(r){let{sn:a}=i;for(let o=r.length-1;o>=0;o--){let c=r[o];if(c.index===s&&c.fragment.sn===a)return r[o+1]}}}getObjectType(e){let{type:t}=e;if(t===`subtitle`)return Se$2.TIMED_TEXT;if(e.sn===`initSegment`)return Se$2.INIT;if(t===`audio`)return Se$2.AUDIO;if(t===`main`)return this.hls.audioTracks.length?Se$2.VIDEO:Se$2.MUXED}getTopBandwidth(e){let t=0,s,i=this.hls;if(e===Se$2.AUDIO)s=i.audioTracks;else{let r=i.maxAutoLevel,a=r>-1?r+1:i.levels.length;s=i.levels.slice(0,a)}return s.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){let t=this.media,s=e===Se$2.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:W$2.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,o){t(r),this.loader.load(r,a,o)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,o){t(r),this.loader.load(r,a,o)}}}};var jh$2=3e5;var tr$3=class extends xe$2{constructor(e){super(`content-steering`,e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=`.`,this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){let e=this.hls;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}
vendor: 6,275 bytes, line 2413
2413startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){let t=this.levels;t&&(this.levels=t.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=`.`,this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){let{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:s}=t;if(s?.action===de$2.SendAlternateToPenaltyBox&&s.flags===Ae$2.MoveAllAlternatesMatchingHost){let i=this.levels,r=this._pathwayPriority,a=this.pathwayId;if(t.context){let{groupId:o,pathwayId:c,type:l}=t.context;o&&i?a=this.getPathwayForGroupId(o,l,a):c&&(a=c)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&i&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),s.resolved=this.pathwayId!==a),t.details===L$2.BUFFER_APPEND_ERROR&&!t.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${i&&i.length} priorities: ${re$1(r)} penalized: ${re$1(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t,s=this.penalizedPathways,i=performance.now();Object.keys(s).forEach(r=>{i-s[r]>jh$2&&delete s[r]});for(let r=0;r<e.length;r++){let a=e[r];if(a in s)continue;if(a===this.pathwayId)return;let o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Ka$1(t),this.hls.trigger(m.LEVELS_UPDATED,{levels:t});let l=this.hls.levels[o];c&&l&&this.levels&&(l.attrs[`STABLE-VARIANT-ID`]!==c.attrs[`STABLE-VARIANT-ID`]&&l.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){let i=this.getLevelsForPathway(s).concat(this.levels||[]);for(let r=0;r<i.length;r++)if(t===z$2.AUDIO_TRACK&&i[r].hasAudioGroup(e)||t===z$2.SUBTITLE_TRACK&&i[r].hasSubtitleGroup(e))return i[r].pathwayId;return s}clonePathways(e){let t=this.levels;if(!t)return;let s={},i={};e.forEach(r=>{let{ID:a,"BASE-ID":o,"URI-REPLACEMENT":c}=r;if(t.some(h=>h.pathwayId===a))return;let l=this.getLevelsForPathway(o).map(h=>{let u=new ne$2(h.attrs);u[`PATHWAY-ID`]=a;let d=u.AUDIO&&`${u.AUDIO}_clone_${a}`,f=u.SUBTITLES&&`${u.SUBTITLES}_clone_${a}`;d&&(s[u.AUDIO]=d,u.AUDIO=d),f&&(i[u.SUBTITLES]=f,u.SUBTITLES=f);let g=So$3(h.uri,u[`STABLE-VARIANT-ID`],`PER-VARIANT-URIS`,c),p=new at$2({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:g,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let y=1;y<h.audioGroups.length;y++)p.addGroupId(`audio`,`${h.audioGroups[y]}_clone_${a}`);if(h.subtitleGroups)for(let y=1;y<h.subtitleGroups.length;y++)p.addGroupId(`text`,`${h.subtitleGroups[y]}_clone_${a}`);return p});t.push(...l),Qn$2(this.audioTracks,s,c,a),Qn$2(this.subtitleTracks,i,c,a)})}loadSteeringManifest(e){let t=this.hls.config,s=t.loader;this.loader&&this.loader.destroy(),this.loader=new s(t);let i;try{i=new self.URL(e)}catch(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!==`data:`){let h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set(`_HLS_pathway`,this.pathwayId),i.searchParams.set(`_HLS_throughput`,``+h)}let r={responseType:`json`,url:i.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},c={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${i}`),this.loader.load(r,c,{onSuccess:(h,u,d,f)=>{this.log(`Loaded steering manifest: "${i}"`);let g=h.data;if(g?.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;let{"RELOAD-URI":p,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":E}=g;if(p)try{this.uri=new self.URL(p,i).href}catch(S){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||d.url),y&&this.clonePathways(y);let T={steeringManifest:g,url:i.toString()};this.hls.trigger(m.STEERING_MANIFEST_LOADED,T),E&&this.updatePathwayPriority(E)},onError:(h,u,d,f)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let g=this.timeToLoad*1e3;if(h.code===429){let p=this.loader;if(typeof p?.getResponseHeader==`function`){let y=p.getResponseHeader(`Retry-After`);y&&(g=parseFloat(y)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,g)},onTimeout:(h,u,d)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}})}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;let i=(s=this.hls)==null?void 0:s.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function Qn$2(n,e,t,s){n&&Object.keys(e).forEach(i=>
2413{let r=n.filter(a=>a.groupId===i).map(a=>{let o=se$3({},a);return o.details=void 0,o.attrs=new ne$2(o.attrs),o.url=o.attrs.URI=So$3(a.url,a.attrs[`STABLE-RENDITION-ID`],`PER-RENDITION-URIS`,t),o.groupId=o.attrs[`GROUP-ID`]=e[i],o.attrs[`PATHWAY-ID`]=s,o});n.push(...r)})}function So$3(n,e,t,s){let{HOST:i,PARAMS:r,[t]:a}=s,o;e&&(o=a?.[e],o&&(n=o));let c=new self.URL(n);return i&&!o&&(c.host=i),r&&Object.keys(r).sort().forEach(l=>{l&&c.searchParams.set(l,r[l])}),c.href}var Xh$1=(()=>{class n extends xe$2{constructor(t){super(`eme`,t.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=n.CDMCleanupPromise?[n.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=s=>{let{initDataType:i,initData:r}=s,a=`"${s.type}" event: init data type: "${i}"`;if(this.debug(a),r!==null){if(!this.keyFormatPromise){let o=Object.keys(this.keySystemAccessPromises);o.length||(o=_t$5(this.config));let c=o.map(Ys$3).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(c)}this.keyFormatPromise.then(o=>{let c=os$3(o);if(i!==`sinf`||c!==ae$3.FAIRPLAY){this.log(`Ignoring "${s.type}" event with init data type: "${i}" for selected key-system ${c}`);return}let l;try{let g=ce$3(new Uint8Array(r)),y=Ta$2(Mr$3(JSON.parse(g).sinf));if(!y)throw new Error(`'schm' box missing or not cbcs/cenc with schi > tenc`);l=new Uint8Array(y.subarray(8,24))}catch(g){this.warn(`${a} Failed to parse sinf: ${g}`);return}let h=ge$2(l),{keyIdToKeySessionPromise:u,mediaKeySessions:d}=this,f=u[h];for(let g=0;g<d.length;g++){let p=d[g],y=p.decryptdata;if(!y.keyId)continue;let E=ge$2(y.keyId);if(xs$3(l,y.keyId)||y.uri.replace(/-/g,``).indexOf(h)!==-1){if(f=u[E],!f)continue;if(y.pssh)break;delete u[E],y.pssh=new Uint8Array(r),y.keyId=l,f=u[h]=f.then(()=>this.generateRequestWithPreferredKeySession(p,i,r,`encrypted-event-key-match`)),f.catch(T=>this.handleError(T));break}}f||this.handleError(new Error(`Key ID ${h} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(o=>this.handleError(o))}},this.onWaitingForKey=s=>{this.log(`"${s.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();let t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}
2413registerListeners(){this.hls.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(m.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(m.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(m.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(m.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(t){let{drmSystems:s,widevineLicenseUrl:i}=this.config,r=s?.[t];if(r)return r.licenseUrl;if(t===ae$3.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(t){let s=this.getLicenseServerUrl(t);if(s===void 0)throw new Error(`no license server URL configured for key-system "${t}"`);return s}getServerCertificateUrl(t){let{drmSystems:s}=this.config,i=s?.[t];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){let s=this.hls.levels,i=(o,c,l)=>!!o&&l.indexOf(o)===c,r=s.map(o=>o.audioCodec).filter(i),a=s.map(o=>o.videoCodec).filter(i);return r.length+a.length===0&&a.push(`avc1.42e01e`),new Promise((o,c)=>{let l=h=>{let u=h.shift();this.getMediaKeysPromise(u,r,a).then(d=>o({keySystem:u,mediaKeys:d})).catch(d=>{h.length?l(h):d instanceof Ee$1?c(d):c(new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};l(t)})}requestMediaKeySystemAccess(t,s){let{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!=`function`){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return Oa$2===null&&self.location.protocol===`http:`&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(t,s)}getMediaKeysPromise(t,s,i){var r;let a=Wl$3(t,s,i,this.config.drmSystemOptions||{}),o=this.keySystemAccessPromises[t],c=(r=o)==null?void 0:r.keySystemAccess;if(!c){this.log(`Requesting encrypted media "${t}" key-system access with config: ${re$1(a)}`),c=this.requestMediaKeySystemAccess(t,a);let l=o=this.keySystemAccessPromises[t]={keySystemAccess:c};return c.catch(h=>{this.log(`Failed to obtain access to key-system "${t}": ${h}`)}),c.then(h=>{this.log(`Access for key-system "${h.keySystem}" obtained`);let u=this.fetchServerCertificate(t);this.log(`Create media-keys for "${t}"`);let d=l.mediaKeys=h.createMediaKeys().then(f=>(this.log(`Media-keys created for "${t}"`),l.hasMediaKeys=!0,u.then(g=>g?this.setMediaKeysServerCertificate(f,t,g):f)));return d.catch(f=>{this.error(`Failed to create media-keys for "${t}"}: ${f}`)}),d})}return c.then(()=>o.mediaKeys)}createMediaKeySessionContext({decryptdata:t,keySystem:s,mediaKeys:i}){this.log(`Creating key-system session "${s}" keyId: ${ge$2(t.keyId||[])} keyUri: ${t.uri}`);let a={decryptdata:t,keySystem:s,mediaKeys:i,mediaKeysSession:i.createSession(),keyStatus:`status-pending`};return this.mediaKeySessions.push(a),a}renewKeySession(t){let s=t.decryptdata;if(s.pssh){let i=this.createMediaKeySessionContext(t),r=es$3(s),a=`cenc`;this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,a,s.pssh.buffer,`expired`)}else this.warn(`Could not renew expired session. Missing pssh initData.`);this.removeSession(t)}updateKeySession(t,s){let i=t.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${ge$2(t.decryptdata.keyId||[])} 2414 } (data length: ${s.byteLength})`),i.update(s)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(t=>({keySystem:t,hasMediaKeys:this.keySystemAccessPromises[t].hasMediaKeys})).filter(({hasMediaKeys:t})=>!!t).map(({keySystem:t})=>Ys$3(t)).filter(t=>!!t)}getKeySystemAccess(t){return this.getKeySystemSelectionPromise(t).then(({keySystem:s,mediaKeys:i})=>this.attemptSetMediaKeys(s,i))}selectKeySystem(t){return new Promise((s,i)=>{this.getKeySystemSelectionPromise(t).then(({keySystem:r})=>{let a=Ys$3(r);
2414a?s(a):i(new Error(`Unable to find format for key-system "${r}"`))}).catch(i)})}selectKeySystemFormat(t){let s=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${s.join(`, `)}`),this.keyFormatPromise=this.getKeyFormatPromise(s)),this.keyFormatPromise}getKeyFormatPromise(t){let s=_t$5(this.config),i=t.map(os$3).filter(r=>!!r&&s.indexOf(r)!==-1);return this.selectKeySystem(i)}getKeyStatus(t){let{mediaKeySessions:s}=this;for(let i=0;i<s.length;i++){let r=zh$2(t,s[i]);if(r)return r}}loadKey(t){let s=t.keyInfo.decryptdata,i=es$3(s),r=this.bannedKeyIds[i];if(r||this.getKeyStatus(s)===`internal-error`){let c=Zn$2(r||`internal-error`,s);return this.handleError(c,t.frag),Promise.reject(c)}let a=`(keyId: ${i} format: "${s.keyFormat}" method: ${s.method} uri: ${s.uri})`;this.log(`Starting session for key ${a}`);let o=this.keyIdToKeySessionPromise[i];if(!o){let c=this.getKeySystemForKeyPromise(s).then(({keySystem:l,mediaKeys:h})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${a}`),this.attemptSetMediaKeys(l,h).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:h,decryptdata:s}))))).then(l=>{let h=`cenc`,u=s.pssh?s.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,h,u,`playlist-key`)});return c.catch(l=>this.handleError(l,t.frag)),this.keyIdToKeySessionPromise[i]=c,c}return o.catch(c=>{if(c instanceof Ee$1){let l=ee$2({},c.data);this.getKeyStatus(s)===`internal-error`&&(l.decryptdata=s);let h=new Ee$1(l,c.message);this.handleError(h,t.frag)}}),o}throwIfDestroyed(t=`Invalid state`){if(!this.hls)throw new Error(`invalid state`)}handleError(t,s){if(this.hls)if(t instanceof Ee$1){s&&(t.data.frag=s);let i=t.data.decryptdata;this.error(`${t.message}${i?` (${ge$2(i.keyId||[])})`:``}`),this.hls.trigger(m.ERROR,t.data)}else this.error(t.message),this.hls.trigger(m.ERROR,{type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0})}getKeySystemForKeyPromise(t){let s=es$3(t),i=this.keyIdToKeySessionPromise[s];if(!i){let r=os$3(t.keyFormat),a=r?[r]:_t$5(this.config);return this.attemptKeySystemAccess(a)}return i}getKeySystemSelectionPromise(t){if(t.length||(t=_t$5(this.config)),t.length===0)throw new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${re$1({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}attemptSetMediaKeys(t,s){if(this.mediaResolved=void 0,this.mediaKeys===s)return Promise.resolve();let i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);let r=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(s):new Promise((a,o)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return o(new Error(`Attempted to set mediaKeys without media element attached`));this.mediaKeys=s,this.media.setMediaKeys(s).then(a).catch(o)}}));return this.mediaKeys=s,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${t}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(a=>i.indexOf(a)===-1)})}generateRequestWithPreferredKeySession(t,s,i,r){var a;let o=(a=this.config.drmSystems)==null||(a=a[t.keySystem])==null?void 0:a.generateRequest;if(o)try{let p=o.call(this.hls,s,i,t);if(!p)throw new Error(`Invalid response from configured generateRequest filter`);s=p.initDataType,i=p.initData?p.initData:null,t.decryptdata.pssh=i?new Uint8Array(i):null}catch(p){if(this.warn(p.message),this.hls&&this.hls.config.debug)throw p}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(t);let c=es$3(t.decryptdata),l=t.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${c} URI: ${l} (init data type: ${s} length: ${i.byteLength})`);let h=new Nr$3,u=t._onmessage=p=>{let y=t.mediaKeysSession;
2414if(!y){h.emit(`error`,new Error(`invalid state`));return}let{messageType:E,message:T}=p;this.log(`"${E}" message event for session "${y.sessionId}" message size: ${T.byteLength}`),E===`license-request`||E===`license-renewal`?this.renewLicense(t,T).catch(S=>{h.eventNames().length?h.emit(`error`,S):this.handleError(S)}):E===`license-release`?t.keySystem===ae$3.FAIRPLAY&&this.updateKeySession(t,Ri$2(`acknowledged`)).then(()=>this.removeSession(t)).catch(S=>this.handleError(S)):this.warn(`unhandled media key message type "${E}"`)},d=(p,y)=>{y.keyStatus=p;let E;p.startsWith(`usable`)?h.emit(`resolved`):p===`internal-error`||p===`output-restricted`||p===`output-downscaled`?E=Zn$2(p,y.decryptdata):p===`expired`?E=new Error(`key expired (keyId: ${c})`):p===`released`?E=new Error(`key released`):p===`status-pending`||this.warn(`unhandled key status change "${p}" (keyId: ${c})`),E&&(h.eventNames().length?h.emit(`error`,E):this.handleError(E))},f=t._onkeystatuseschange=p=>{if(!t.mediaKeysSession){h.emit(`error`,new Error(`invalid state`));return}let E=this.getKeyStatuses(t);if(!Object.keys(E).some(x=>E[x]!==`status-pending`))return;if(E[c]===`expired`){this.log(`Expired key ${re$1(E)} in key-session "${t.mediaKeysSession.sessionId}"`),this.renewKeySession(t);return}let S=E[c];if(S)d(S,t);else{var v;t.keyStatusTimeouts||(t.keyStatusTimeouts={}),(v=t.keyStatusTimeouts)[c]||(v[c]=self.setTimeout(()=>{if(!t.mediaKeysSession||!this.mediaKeys)return;let _=this.getKeyStatus(t.decryptdata);if(_&&_!==`status-pending`)return this.log(`No status for keyId ${c} in key-session "${t.mediaKeysSession.sessionId}". Using session key-status ${_} from other session.`),d(_,t);this.log(`key status for ${c} in key-session "${t.mediaKeysSession.sessionId}" timed out after 1000ms`),S=`internal-error`,d(S,t)},1e3)),this.log(`No status for keyId ${c} (${re$1(E)}).`)}};Te$3(t.mediaKeysSession,`message`,u),Te$3(t.mediaKeysSession,`keystatuseschange`,f);let g=new Promise((p,y)=>{h.on(`error`,y),h.on(`resolved`,p)});return t.mediaKeysSession.generateRequest(s,i).then(()=>{this.log(`Request generated for key-session "${t.mediaKeysSession.sessionId}" keyId: ${c} URI: ${l}`)}).catch(p=>{throw new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_NO_SESSION,error:p,decryptdata:t.decryptdata,fatal:!1},`Error generating key-session request: ${p}`)}).then(()=>g).catch(p=>(h.removeAllListeners(),this.removeSession(t).then(()=>{throw p}))).then(()=>(h.removeAllListeners(),t))}getKeyStatuses(t){let s={};return t.mediaKeysSession.keyStatuses.forEach((i,r)=>{if(typeof r==`string`&&typeof i==`object`){let c=r;r=i,i=c}let a=`buffer`in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(t.keySystem===ae$3.PLAYREADY&&a.length===16){let c=ge$2(a);s[c]=i,ka$2(a)}let o=ge$2(a);i===`internal-error`&&(this.bannedKeyIds[o]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${o} key-session "${t.mediaKeysSession.sessionId}"`),s[o]=i}),s}fetchServerCertificate(t){let s=this.config,i=s.loader,r=new i(s),a=this.getServerCertificateUrl(t);return a?(this.log(`Fetching server certificate for "${t}"`),new Promise((o,c)=>{let l={responseType:`arraybuffer`,url:a},h=s.certLoadPolicy.default,u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(l,u,{onSuccess:(f,g,p,y)=>{o(f.data)},onError:(f,g,p,y)=>{c(new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:ee$2({url:l.url,data:void 0},f)},`"${t}" certificate request failed (${a}). Status: ${f.code} (${f.text})`))},onTimeout:(f,g,p)=>{c(new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:l.url,data:void 0}},`"${t}" certificate request timed out (${a})`))},onAbort:(f,g,p)=>{c(new Error(`aborted`))}})})):Promise.resolve()}setMediaKeysServerCertificate(t,s,i){return new Promise((r,a)=>{t.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?`success`:`not supported by CDM`} (${i.byteLength}) on "${s}"`),r(t)}).catch(o=>{a(new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(t,s){return this.requestLicense(t,new Uint8Array(s)).then(i=>this.updateKeySession(t,new Uint8Array(i)).catch(r=>{throw new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(t,s){let i=String.fromCharCode.apply(null,new Uint16Array(s.buffer));if(!i.includes(`PlayReadyKeyMessage`))return t.setRequestHeader(`Content-Type`,`text/xml; charset=utf-8`),s;let r=new DOMParser().parseFromString(i,`application/xml`),a=r.querySelectorAll(`HttpHeader`);if(a.length>0){let u;for(let d=0,f=a.length;d<f;d++){var o,c;u=a[d];let g=(o=u.querySelector(`name`))==null?void 0:o.textContent,p=(c=u.querySelector(`value`))==null?void 0:c.textContent;g&&p&&t.setRequestHeader(g,p)}}let h=r.querySelector(`Challenge`)?.textContent;
2414if(!h)throw new Error(`Cannot find <Challenge> in key message`);return Ri$2(atob(h))}setupLicenseXHR(t,s,i,r){let a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error(`Key removed`);return a.call(this.hls,t,s,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return t.open(`POST`,s,!0),a.call(this.hls,t,s,i,r)}).then(o=>(t.readyState||t.open(`POST`,s,!0),{xhr:t,licenseChallenge:o||r})):(t.open(`POST`,s,!0),Promise.resolve({xhr:t,licenseChallenge:r}))}requestLicense(t,s){let i=this.config.keyLoadPolicy.default;return new Promise((r,a)=>{let o=this.getLicenseServerUrlOrThrow(t.keySystem);this.log(`Sending license request to URL: ${o}`);let c=new XMLHttpRequest;c.responseType=`arraybuffer`,c.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return a(new Error(`invalid state`));if(c.readyState===4)if(c.status===200){this._requestLicenseFailureCount=0;let l=c.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);let h=this.config.licenseResponseCallback;if(h)try{l=h.call(this.hls,c,o,t)}catch(u){this.error(u)}r(l)}else{let l=i.errorRetry,h=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>h||c.status>=400&&c.status<500)a(new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:L$2.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t.decryptdata,fatal:!0,networkDetails:c,response:{url:o,data:void 0,code:c.status,text:c.statusText}},`License Request XHR failed (${o}). Status: ${c.status} (${c.statusText})`));else{let u=h-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(t,s).then(r,a)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=c,this.setupLicenseXHR(c,o,t,s).then(({xhr:l,licenseChallenge:h})=>{t.keySystem==ae$3.PLAYREADY&&(h=this.unpackPlayReadyKeyMessage(l,h)),l.send(h)}).catch(a)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(t,s){if(!this.config.emeEnabled)return;let i=s.media;this.media=i,Te$3(i,`encrypted`,this.onMediaEncrypted),Te$3(i,`waitingforkey`,this.onWaitingForKey);let r=this.mediaResolved;r?r():this.mediaKeys=i.mediaKeys}onMediaDetached(){let t=this.media;t&&(ve$3(t,`encrypted`,this.onMediaEncrypted),ve$3(t,`waitingforkey`,this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};let s=this.mediaResolved;if(s&&s(),!this.mediaKeys&&!this.mediaKeySessions.length)return;let i=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,At$2.clearKeyUriToKeyIdMap();let a=r.length;n.CDMCleanupPromise=Promise.all(r.map(o=>this.removeSession(o)).concat((i==null||(t=i.setMediaKeys(null))==null?void 0:t.catch(o=>{this.log(`Could not clear media keys: ${o}`),this.hls&&this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${o}`)})}))||Promise.resolve())).catch(o=>{this.log(`Could not close sessions and clear media keys: ${o}`),this.hls&&this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${o}`)})}).then(()=>{a&&this.log(`finished closing key sessions and clearing media keys`)})}onManifestLoading(){this._clear()}onManifestLoaded(t,{sessionKeys:s}){if(!(!s||!this.config.emeEnabled)&&!this.keyFormatPromise){let i=s.reduce((r,a)=>(r.indexOf(a.keyFormat)===-1&&r.push(a.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(`, `)}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(t){let{mediaKeysSession:s,licenseXhr:i,decryptdata:r}=t;if(s){this.log(`Remove licenses and keys and close session "${s.sessionId}" keyId: ${ge$2(r?.keyId||[])}`),t._onmessage&&(s.removeEventListener(`message`,t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(s.removeEventListener(`keystatuseschange`,t._onkeystatuseschange),t._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;let a=this.mediaKeySessions.indexOf(t);a>-1&&this.mediaKeySessions.splice(a,1);let{keyStatusTimeouts:o}=t;
2414o&&Object.keys(o).forEach(h=>self.clearTimeout(o[h]));let{drmSystemOptions:c}=this.config;return(jl$3(c)?new Promise((h,u)=>{self.setTimeout(()=>u(new Error(`MediaKeySession.remove() timeout`)),8e3),s.remove().then(h).catch(u)}):Promise.resolve()).catch(h=>{this.log(`Could not remove session: ${h}`),this.hls&&this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${h}`)})}).then(()=>s.close()).catch(h=>{this.log(`Could not close session: ${h}`),this.hls&&this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${h}`)})})}return Promise.resolve()}}return n.CDMCleanupPromise=void 0,n})();function es$3(n){if(!n)throw new Error(`Could not read keyId of undefined decryptdata`);if(n.keyId===null)throw new Error(`keyId is null`);return ge$2(n.keyId)}function zh$2(n,e){if(n.keyId&&e.mediaKeysSession.keyStatuses.has(n.keyId))return e.mediaKeysSession.keyStatuses.get(n.keyId);if(n.matches(e.decryptdata))return e.keyStatus}var Ee$1=class extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}};function Zn$2(n,e){let t=n===`output-restricted`,s=t?L$2.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:L$2.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ee$1({type:V$1.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},t?`HDCP level output restricted`:`key status changed to "${n}"`)}var sr$3=class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}
vendor: 11,141 bytes, line 2414
2414registerListeners(){this.hls.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(m.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(m.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let s=this.hls.config;if(s.capLevelOnFPSDrop){let i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality==`function`&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,s){let i=performance.now();if(t){if(this.lastTime){let r=i-this.lastTime,a=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*a/r,l=this.hls;if(l.trigger(m.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),c>0&&a>l.config.fpsDroppedMonitoringThreshold*o){let h=l.currentLevel;l.logger.warn(`drop FPS ratio greater than max allowed value for currentLevel: `+h),h>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=h)&&(h=h-1,l.trigger(m.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:l.currentLevel}),l.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}};function vo$2(n,e){let t;try{t=new Event(`addtrack`)}catch(s){t=document.createEvent(`Event`),t.initEvent(`addtrack`,!1,!1)}t.track=n,e.dispatchEvent(t)}function xo$2(n,e){let t=n.mode;if(t===`disabled`&&(n.mode=`hidden`),n.cues&&!n.cues.getCueById(e.id))try{if(n.addCue(e),!n.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){te$1.debug(`[texttrack-utils]: ${s}`);try{let i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,n.addCue(i)}catch(i){te$1.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t===`disabled`&&(n.mode=t)}function pt$4(n,e){let t=n.mode;if(t===`disabled`&&(n.mode=`hidden`),n.cues)for(let s=n.cues.length;s--;)e&&n.cues[s].removeEventListener(`enter`,e),n.removeCue(n.cues[s]);t===`disabled`&&(n.mode=t)}function ir$3(n,e,t,s){let i=n.mode;if(i===`disabled`&&(n.mode=`hidden`),n.cues&&n.cues.length>0){let r=Zh$1(n.cues,e,t);for(let a=0;a<r.length;a++)(!s||s(r[a]))&&n.removeCue(r[a])}i===`disabled`&&(n.mode=i)}function Qh$1(n,e){if(e<=n[0].startTime)return 0;let t=n.length-1;if(e>n[t].endTime)return-1;let s=0,i=t,r;for(;s<=i;)if(r=Math.floor((i+s)/2),e<n[r].startTime)i=r-1;else if(e>n[r].startTime&&s<t)s=r+1;else return r;return n[s].startTime-e<e-n[i].startTime?s:i}function Zh$1(n,e,t){let s=[],i=Qh$1(n,e);if(i>-1)for(let r=i,a=n.length;r<a;r++){let o=n[r];if(o.startTime>=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function hs$3(n){let e=[];for(let t=0;t<n.length;t++){let s=n[t];(s.kind===`subtitles`||s.kind===`captions`)&&s.label&&e.push(n[t])}return e}var rr$2=class extends Vt$2{constructor(e){super(e,`subtitle-track-controller`),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null,s=hs$3(this.media.textTracks);for(let r=0;r<s.length;r++)if(s[r].mode===`hidden`)t=s[r];else if(s[r].mode===`showing`){t=s[r];break}let i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){let{hls:e}=this;e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVEL_LOADING,this.onLevelLoading,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(m.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&`onchange`in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener(`change`,this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){let s=this.media;if(!s)return;let i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener(`change`,this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;hs$3(s.textTracks).forEach(a=>{pt$4(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){let{id:s,groupId:i,details:r}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==i){this.warn(`Subtitle track with id:${s} and group:${i} not found in active group ${a?.groupId}`);return}let o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let s=t.subtitleGroups||null,i=this.groupIds,r=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(a=>i?.indexOf(a)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;let a=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=!1),a.forEach((h,u)=>{h.id=u});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=a;let o=this.hls.config.subtitlePreference;if(!r&&o){this.selectDefaultTrack=!1;let h=Ue$1(o,a);if(h>-1)r=a[h];else{let u=Ue$1(o,this.tracks);r=this.tracks[u]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));let l={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s?.join(`,`)}" group-id`),this.hls.trigger(m.SUBTITLE_TRACKS_UPDATED,l),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){let t=this.tracksInGroup,s=this.selectDefaultTrack;for(let i=0;i<t.length;i++){let r=t[i];if(!(s&&!r.default||!s&&!e)&&(!e||rt$3(r,e)))return i}if(e){for(let i=0;i<t.length;i++){let r=t[i];if(Ht$2(e.attrs,r.attrs,[`LANGUAGE`,`ASSOC-LANGUAGE`,`CHARACTERISTICS`]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(Ht$2(e.attrs,r.attrs,[`LANGUAGE`]))return i}}return-1}findTrackForTextTrack(e){if(e){let t=this.tracksInGroup;for(let s=0;s<t.length;s++){let i=t[s];if(Yi$1(i,e))return s}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===z$2.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;let t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){let s=this.currentTrack;if(s&&rt$3(e,s))return s;let i=Ue$1(e,this.tracksInGroup);if(i>-1){let r=this.tracksInGroup[i];return this.setSubtitleTrack(i),r}else{if(s)return null;{let r=Ue$1(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let s=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?` at sn `+t.msn+` part `+t.part:``}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${r}`),this.hls.trigger(m.SUBTITLE_TRACK_LOADING,{url:r,id:s,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){let{media:e}=this;if(!e)return;let t=hs$3(e.textTracks),s=this.currentTrack,i;if(s&&(i=t.filter(r=>Yi$1(s,r))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!==`disabled`&&r!==i&&(r.mode=`disabled`)}),i){let r=this.subtitleDisplay?`showing`:`hidden`;i.mode!==r&&(i.mode=r)}}setSubtitleTrack(e){let t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!F$1(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;let s=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(m.SUBTITLE_TRACK_SWITCH,{id:e});return}let r=!!i.details&&!i.details.live;if(e===this.trackId&&i===s&&r)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:``));let{id:a,groupId:o=``,name:c,type:l,url:h}=i;this.hls.trigger(m.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:c,type:l,url:h});let u=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(u)}};function Jh$1(){try{return crypto.randomUUID()}catch(n){try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf(`/`)+1)}catch(e){let t=new Date().getTime();return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,i=>{let r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i==`x`?r:r&3|8).toString(16)})}}}function Pt$3(n){let e=5381,t=n.length;for(;t;
vendor: 8,466 bytes, line 2414
2414)e=e*33^n.charCodeAt(--t);return(e>>>0).toString()}var vt$4=.025;var Ps$3=(function(n){return n[n.Point=0]=`Point`,n[n.Range=1]=`Range`,n})({});function eu$1(n,e,t){return`${n.identifier}-${t+1}-${Pt$3(e)}`}var nr$3=class{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat(`X-RESUME-OFFSET`,this.resumeOffset),this.playoutLimit=e.attr.optionalFloat(`X-PLAYOUT-LIMIT`,this.playoutLimit),this.restrictions=e.attr.enumeratedStringList(`X-RESTRICT`,this.restrictions),this.snapOptions=e.attr.enumeratedStringList(`X-SNAP`,this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;let s=this.playoutLimit;return e<=0||isNaN(s)?!1:s===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){let e=this.dateRange.startTime;if(this.snapOptions.out){let t=this.dateRange.tagAnchor;if(t)return ei$2(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;let e=this.dateRange.tagAnchor;if(e){let t=this.dateRange.startTime;return t-ei$2(t,e)<.1}return!1}get resumptionOffset(){let e=this.resumeOffset,t=F$1(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){let e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){let t=this.resumeAnchor;if(t)return ei$2(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<vt$4))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){let e=this.playoutLimit,t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr[`X-TIMELINE-OCCUPIES`]===`RANGE`?Ps$3.Range:Ps$3.Point}get supplementsPrimary(){return this.dateRange.attr[`X-TIMELINE-STYLE`]===`PRIMARY`}get contentMayVary(){return this.dateRange.attr[`X-CONTENT-MAY-VARY`]!==`NO`}get assetUrl(){return this.dateRange.attr[`X-ASSET-URI`]}get assetListUrl(){return this.dateRange.attr[`X-ASSET-LIST`]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return tu$1(this)}};function ei$2(n,e){return n-e.start<e.duration/2&&!(Math.abs(n-(e.start+e.duration))<vt$4)?e.start:e.start+e.duration}function Ao$3(n,e,t){let s=new self.URL(n,t);return s.protocol!==`data:`&&s.searchParams.set(`_HLS_primary_id`,e),s}function ti$2(n,e){for(;(t=n.assetList[++e])!=null&&t.error;)var t;return e}function tu$1(n){return`["${n.identifier}" ${n.cue.pre?`<pre>`:n.cue.post?`<post>`:``}${n.timelineStart.toFixed(2)}-${n.resumeTime.toFixed(2)}]`}function mt$5(n){let e=n.timelineStart,t=n.duration||0;return`["${n.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}var ar$3=class{constructor(e,t,s,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(m.PLAYOUT_LIMIT_REACHED,{})};let r=this.hls=new e(t);this.interstitial=s,this.assetItem=i;let a=()=>{this.hasDetails=!0};r.once(m.LEVEL_LOADED,a),r.once(m.AUDIO_TRACK_LOADED,a),r.once(m.SUBTITLE_TRACK_LOADED,a),r.on(m.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener(`timeupdate`,this.checkPlayout),this.appendInPlace&&r.on(m.BUFFER_APPENDED,()=>{let h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,r.trigger(m.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){let e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Ao$3(t,e.config.primarySessionId||``).href}catch(s){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;let s=Math.min(this._bufferedEosTime||Infinity,this.duration),i=this.timelineOffset,r=W$2.bufferInfo(e,i,0);return this.getAssetTime(r.end)>=s-.02}reachedPlayout(e){let s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){let e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;let t=W$2.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){let e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){let e=this.assetItem.duration;if(!e)return 0;let t=this.interstitial.playoutLimit;if(t){let s=t-this.startOffset;if(s>0&&s<e)return s}return e}get remaining(){let e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){let t=this.timelineOffset;if(e!==t){let s=e-t;if(Math.abs(s)>1/9e4&&this.hls){if(this.hasDetails)throw new Error(`Cannot set timelineOffset after playlists are loaded`);this.hls.config.timelineOffset=e}}}getAssetTime(e){let t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){let e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener(`timeupdate`,this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){let e=this.hls;if(e&&this.hasDetails){e.stopLoad();let t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,s){var i;(i=this.hls)==null||i.on(e,t)}once(e,t,s){var i;(i=this.hls)==null||i.once(e,t)}off(e,t,s){var i;(i=this.hls)==null||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${mt$5(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?`append-in-place`:``}`}};var Jn$2=.033;var or$3=class extends xe$2{constructor(e,t){super(`interstitials-sched`,t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={}
vendor: 7,459 bytes, line 2414
2414,this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,s+1):s,0):0}get duration(){let e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);let i=this.items;if(i)for(i[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(r=i[s])!=null&&r.event;){var r;s--}return s}findItemIndexAtTime(e,t){let s=this.items;if(s)for(let i=0;i<s.length;i++){let r=s[i];if(t&&t!==`primary`&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return i}return-1}findJumpRestrictedIndex(e,t){let s=this.items;if(s)for(let i=e;i<=t&&s[i];i++){let r=s[i].event;if(r!=null&&r.restrictions.jump&&!r.appendInPlace)return i}return-1}findEventIndex(e){let t=this.items;if(t)for(let i=t.length;i--;){var s;if(((s=t[i].event)==null?void 0:s.identifier)===e)return i}return-1}findAssetIndex(e,t){let s=e.assetList,i=s.length;if(i>1)for(let r=0;r<i;r++){let a=s[r];if(!a.error){let o=a.timelineStart;if(t===o||t>o&&(t<o+(a.duration||0)||r===i-1))return r}}return 0}get assetIdAtEnd(){var e;let t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){let s=t.assetList,i=s[s.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){let s=e.main.details,{dateRanges:i}=s,r=this.events,a=this.parseDateRanges(i,{url:s.url},t),o=Object.keys(i),c=r?r.filter(l=>!o.includes(l.identifier)):[];a.length&&a.sort((l,h)=>{let u=l.cue.pre,d=l.cue.post,f=h.cue.pre,g=h.cue.post;if(u&&!f)return-1;if(f&&!u||d&&!g)return 1;if(g&&!d)return-1;if(!u&&!f&&!d&&!g){let p=l.startTime,y=h.startTime;if(p!==y)return p-y}return l.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=a,c.forEach(l=>{this.removeEvent(l)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],s=!1){let i=this.events||[];if(i.length||t.length||this.length<2){let r=this.items,a=this.parseSchedule(i,e);(s||t.length||r?.length!==a.length||a.some((c,l)=>Math.abs(c.playout.start-r[l].playout.start)>.005||Math.abs(c.playout.end-r[l].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,s){let i=[],r=Object.keys(e);for(let a=0;a<r.length;a++){let o=r[a],c=e[o];if(c.isInterstitial){let l=this.eventMap[o];l?l.setDateRange(c):(l=new nr$3(c,t),this.eventMap[o]=l,s===!1&&(l.appendInPlace=s)),i.push(l)}}return i}parseSchedule(e,t){let s=[],i=t.main.details,r=i.live?Infinity:i.edge,a=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,l=0;if(e.forEach((h,u)=>{let d=h.cue.pre,f=h.cue.post,g=e[u-1]||null,p=h.appendInPlace,y=f?r:h.startOffset,E=h.duration,T=h.timelineOccupancy===Ps$3.Range?E:0,S=h.resumptionOffset,v=g?.startTime===y,x=y+h.cumulativeDuration,_=p?x+E:y+S;if(d||!f&&y<=0){let R=l;l+=T,h.timelineStart=x;let b=a;a+=E,s.push({event:h,start:x,end:_,playout:{start:b,end:a},integrated:{start:R,end:l}})}else if(y<=r){if(!v){let I=y-c;if(I>Jn$2){let C=c,O=l;l+=I;let B=a;a+=I;let G={previousEvent:e[u-1]||null,nextEvent:h,start:C,end:C+I,playout:{start:B,end:a},integrated:{start:O,end:l}};s.push(G)}else I>0&&g&&(g.cumulativeDuration+=I,s[s.length-1].end=y)}f&&(_=x),h.timelineStart=x;let R=l;l+=T;let b=a;a+=E,s.push({event:h,start:x,end:_,playout:{start:b,end:a},integrated:{start:R,end:l}})}else return;let A=h.resumeTime;f||A>r?c=r:c=A}),c<r){var o;let h=c,u=l,d=r-c;l+=d;let f=a;a+=d,s.push({previousEvent:((o=s[s.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:h+d,playout:{start:f,end:a},integrated:{start:u,end:l}})}this.setDurations(r,a,l)}else s.push({previousEvent:null,nextEvent:null,start:0,end:r,playout:{start:0,end:r},integrated:{start:0,end:r}}),this.setDurations(r,r,r);return s}setDurations(e,t,s){this.durations={primary:e,playout:t,integrated:s}}resolveOffsets(e,t){let s=t.main.details,i=s.live?Infinity:s.edge,r=0,a=-1;e.forEach((o,c)=>{let l=o.cue.pre,h=o.cue.post,u=l?0:h?i:o.startTime;this.updateAssetDurations(o),a===u?o.cumulativeDuration=r:(r=0,a=u),!h&&o.snapOptions.in&&(o.resumeAnchor=ot$3(null,s.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<Jn$2&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));let f=F$1(o.resumeOffset)?o.resumeOffset:o.duration;r+=f})}primaryCanResumeInPlaceAt(e,t){let s=e.resumeTime,i=e.startTime+e.resumptionOffset;return Math.abs(s-i)>vt$4?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${i}`),!1):!Object.keys(t).some(a=>{let o=t[a].details,c=o.edge;if(s>=c)return this.log(`"${e.identifier}" resumption ${s} past ${a} playlist end ${c}`),!1;let l=ot$3(null,o.fragments,s);if(!l)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;let h=a===`audio`?.175:0;return Math.abs(l.start-s)<vt$4+h||Math.abs(l.end-s)<vt$4+h?!1:(this.log(`"${e.identifier}" resumption ${s} not aligned with ${a} fragment bounds (${l.start}-${l.end} sn: ${l.sn} cc: ${l.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;let t=e.timelineStart,s=0,i=!1,r=!1;for(let a=0;a<e.assetList.length;a++){let o=e.assetList[a],c=t+s;o.startOffset=s,o.timelineStart=c,i||(i=o.duration===null),r||(r=!!o.error);let l=o.error?0:o.duration||0;s+=l}i&&!r?e.duration=Math.max(s,e.duration):e.duration=s}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}};function Pe$3(n){return`[${n.event?`"`+n.event.identifier+`"`:`primary`}: ${n.start.toFixed(2)}-${n.end.toFixed(2)}]`}var lr$2=class{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){let s=e.assetListUrl,i;try{i=Ao$3(s,this.hls.sessionId,e.baseUrl)}catch(d){let f=this.assignAssetListError(e,L$2.ASSET_LIST_LOAD_ERROR,d,s);this.hls.trigger(m.ERROR,f);return}t&&i.protocol!==`data:`&&i.searchParams.set(`_HLS_start_offset`,``+t);let r=this.hls.config,a=r.loader,o=new a(r),c={responseType:`json`,url:i.href},l=r.interstitialAssetListLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};return o.load(c,h,{onSuccess:(d,f,g,p)=>{let y=d.data,E=y?.ASSETS;if(!Array.isArray(E)){let T=this.assignAssetListError(e,L$2.ASSET_LIST_PARSING_ERROR,new Error(`Invalid interstitial asset list`),g.url,f,p);this.hls.trigger(m.ERROR,T);return}e.assetListResponse=y,this.hls.trigger(m.ASSET_LIST_LOADED,{event:e,assetListResponse:y,networkDetails:p})},onError:(d,f,g,p)=>{let y=this.assignAssetListError(e,L$2.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${f.url})`),f.url,p,g);this.hls.trigger(m.ERROR,y)},onTimeout:(d,f,g)=>{let p=this.assignAssetListError(e,L$2.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,d,g);this.hls.trigger(m.ERROR,p)}}),this.hls.trigger(m.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,s,i,r,a){return e.error=s,{type:V$1.NETWORK_E
vendor: 14,018 bytes, lines 2414-2415
2414RROR,details:t,fatal:!1,interstitial:e,url:i,error:s,networkDetails:a,stats:r}}};function ea$2(n){var e;n==null||(e=n.play())==null||e.catch(()=>{})}function gt$3(n,e){return`[${n}] Advancing timeline position to ${e}`}var cr$3=class extends xe$2{constructor(e,t){super(`interstitials`,e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{let s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;let i=s-this.timelinePos;if(Math.abs(i)<1/7056e5)return;let a=i<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=s,this.bufferedPos=s;let o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(s,s-i)&&this.updateSchedule(!0),this.checkBuffer(),a&&s<o.start||s>=o.end){var c;let f=this.findItemIndex(o),g=this.schedule.findItemIndexAtTime(s);if(g===-1&&(g=f+(a?-1:1),this.log(`seeked ${a?`back `:``}to position not covered by schedule ${s} (resolving from ${f} to ${g})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!a&&g>f){let p=this.schedule.findJumpRestrictedIndex(f+1,g);if(p>f){this.setSchedulePosition(p);return}}this.setSchedulePosition(g);return}let l=this.playingAsset;if(!l){if(this.playingLastItem&&this.isInterstitial(o)){let f=o.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,f))}return}let h=l.timelineStart,u=l.duration||0;if(a&&s<h||s>=h+u){var d;(d=o.event)!=null&&d.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,l)}},this.onTimeupdate=()=>{let s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;let i=this.playingItem;if(!i||this.playingLastItem)return;if(s>=i.end){this.timelinePos=i.end;let o=this.findItemIndex(i);this.setSchedulePosition(o+1)}let r=this.playingAsset;if(!r)return;s>=r.timelineStart+(r.duration||0)&&this.setScheduleToAssetAtTime(s,r)},this.onScheduleUpdate=(s,i)=>{let r=this.schedule;if(!r)return;let a=this.playingItem,o=r.events||[],c=r.items||[],l=r.durations,h=s.map(p=>p.identifier),u=!!(o.length||h.length);(u||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o} 2415Schedule: ${c.map(p=>Pe$3(p))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let d=null,f=null;a&&(d=this.updateItem(a,this.timelinePos),this.itemsMatch(a,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);let g=this.bufferingItem;if(g&&(f=this.updateItem(g,this.bufferedPos),this.itemsMatch(g,f)?this.bufferingItem=f:g.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(g.event,null))),s.forEach(p=>{p.assetList.forEach(y=>{this.clearAssetPlayer(y.identifier,null)})}),this.playerQueue.forEach(p=>{if(p.interstitial.appendInPlace){let y=p.assetItem.timelineStart,E=p.timelineOffset-y;if(E)try{p.timelineOffset=y}catch(T){Math.abs(E)>vt$4&&this.warn(`${T} ("${p.assetId}" ${p.timelineOffset}->${y})`)}}}),u||i){if(this.hls.trigger(m.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:l,removedIds:h}),this.isInterstitial(a)&&h.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(d,a),g&&f!==d&&this.trimInPlace(f,g),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new lr$2(e),this.schedule=new or$3(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){let e=this.hls;e&&(e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(m.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(m.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(m.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(m.BUFFER_APPENDED,this.onBufferAppended,this),e.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(m.MEDIA_ENDED,this.onMediaEnded,this),e.on(m.ERROR,this.onError,this),e.on(m.DESTROYING,this.onDestroying,this))}unregisterListeners(){let e=this.hls;e&&(e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(m.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(m.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(m.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(m.BUFFER_CODECS,this.onBufferCodecs,this),e.off(m.BUFFER_APPENDED,this.onBufferAppended,this),e.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(m.MEDIA_ENDED,this.onMediaEnded,this),e.off(m.ERROR,this.onError,this),e.off(m.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){let e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){ve$3(e,`play`,this.onPlay),ve$3(e,`pause`,this.onPause),ve$3(e,`seeking`,this.onSeeking),ve$3(e,`timeupdate`,this.onTimeupdate)}onMediaAttaching(e,t){let s=this.media=t.media;Te$3(s,`seeking`,this.onSeeking),Te$3(s,`timeupdate`,this.onTimeupdate),Te$3(s,`play`,this.onPlay),Te$3(s,`pause`,this.onPause)}onMediaAttached(e,t){let s=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!i){this.clearScheduleState();let r=this.findItemIndex(s);this.setSchedulePosition(r)}}clearScheduleState(){this.log(`clear schedule state`),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){let s=!!t.transferMedia,i=this.media;if(this.media=null,!s&&(i&&this.removeMediaListeners(i),this.detachedData)){let r=this.getBufferingPlayer();r&&(this.log(`Removing schedule state for detachedData and ${r}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;let e=this,t=()=>e.bufferingItem||e.waitingItem,s=u=>u&&e.getAssetPlayer(u.identifier),i=(u,d,f,g,p)=>{if(u){let y=u[d].start,E=u.event;if(E){if(d===`playout`||E.timelineOccupancy!==Ps$3.Point){let T=s(f);T?.interstitial===E&&(y+=T.assetItem.startOffset+T[p])}}else{let T=g===`bufferedPos`?a():e[g];y+=T-u.start}return y}return 0},r=(u,d)=>{var f;if(u!==0&&d!==`primary`&&(f=e.schedule)!=null&&f.length){var g;let p=e.schedule.findItemIndexAtTime(u),y=(g=e.schedule.items)==null?void 0:g[p];if(y)return u+(y[d].start-y.start)}return u},a=()=>{let u=e.bufferedPos;return u===Number.MAX_VALUE?o(`primary`):Math.max(u,0)},o=u=>{var d,f;return(d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[u])||0},c=(u,d)=>{var f,g;let p=e.effectivePlayingItem;if(p!=null&&(f=p.event)!=null&&f.restrictions.skip||!e.schedule)return;e.log(`seek to ${u} "${d}"`);let y=e.effectivePlayingItem,E=e.schedule.findItemIndexAtTime(u,d),T=(g=e.schedule.items)==null?void 0:g[E],S=e.getBufferingPlayer(),x=(S?.interstitial)?.appendInPlace,_=y&&e.itemsMatch(y,T);if(y&&(x||_)){let A=s(e.playingAsset),R=A?.media||e.primaryMedia;if(R){let b=d===`primary`?R.currentTime:i(y,d,e.playingAsset,`timelinePos`,`currentTime`),I=u-b,C=(x?b:R.currentTime)+I;if(C>=0&&(!A||x||C<=A.duration)){R.currentTime=C;return}}}if(T){let A=u;if(d!==`primary`){let I=u-T[d].start;A=T.start+I}let R=!e.isInterstitial(T);if((!e.isInterstitial(y)||y.event.appendInPlace)&&(R||T.event.appendInPlace)){let b=e.media||(x?S?.media:null);b&&(b.currentTime=A)}else if(y){let b=e.findItemIndex(y);if(E>b){let C=e.schedule.findJumpRestrictedIndex(b+1,E);if(C>b){e.setSchedulePosition(C);return}}let I=0;if(R)e.timelinePos=A,e.checkBuffer();else{let C=T.event.assetList,O=u-(T[d]||T).start;for(let B=C.length;B--;){let G=C[B];if(G.duration&&O>=G.startOffset&&O<G.startOffset+G.duration){I=B;break}}}e.setSchedulePosition(E,I)}}},l=()=>{let u=e.effectivePlayingItem;if(e.isInterstitial(u))return u;let d=t();return e.isInterstitial(d)?d:null},h={get bufferedEnd(){let u=t(),d=e.bufferingItem;if(d&&d===u){var f;return i(d,`playout`,e.bufferingAsset,`bufferedPos`,`bufferedEnd`)-d.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){let u=l(),d=e.effectivePlayingItem;return d&&d===u?i(d,`playout`,e.effectivePlayingAsset,`timelinePos`,`currentTime`)-d.playout.start:0},set currentTime(u){let d=l(),f=e.effectivePlayingItem;f&&f===d&&c(u+f.playout.start,`playout`)},get duration(){let u=l();return u?u.playout.end-u.playout.start:0},get assetPlayers(){var u;let d=(u=l())==null?void 0:u.event.assetList;return d?d.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var u;let d=(u=l())==null?void 0:u.event;return d&&e.effectivePlayingAsset?d.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return l()}};return this.manager={get events(){var u;return((u=e.schedule)==null||(u=u.events)==null?void 0:u.slice(0))||[]},get schedule(){var u;return((u=e.schedule)==null||(u=u.items)==null?void 0:u.slice(0))||[]},get interstitialPlayer(){return l()?h:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){let u=t();return e.findItemIndex(u)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){let u=e.effectivePlayingItem;return e.findItemIndex(u)},primary:{get bufferedEnd(){return a()},get currentTime(){let u=e.timelinePos;return u>0?u:0},set currentTime(u){c(u,`primary`)},get duration(){return o(`primary`)},get seekableStart(){var u;return((u=e.primaryDetails)==null?void 0:u.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),`integrated`,e.bufferingAsset,`bufferedPos`,`bufferedEnd`)},get currentTime(){return i(e.effectivePlayingItem,`integrated`,e.effectivePlayingAsset,`timelinePos`,`currentTime`)},set currentTime(u){c(u,`integrated`)},get duration(){return o(`integrated`)},get seekableStart(){var u;return r(((u=e.primaryDetails)==null?void 0:u.fragmentStart)||0,`integrated`)}},skip:()=>{let u=e.effectivePlayingItem,d=u?.event;if(d&&!d.restrictions.skip){let f=e.findItemIndex(u);if(d.appendInPlace){let g=u.playout.start+u.event.duration;c(g+.001,`playout`)}else e.advanceAfterAssetEnded(d,f,Infinity)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;let t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!s?!1:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;let s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);let r=(t=i)==null?void 0:t.currentTime;if(!(r===void 0||!F$1(r)))return r}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){let s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t)}transferMediaFromPlayer(e,t){let s=e.interstitial.appendInPlace,i=e.media;if(s&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}let r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${re$1(r)}`),this.detachedData=r}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var s,i;if(e.media===t)return;let r=null,a=this.hls,o=e!==a,c=o&&e.interstitial.appendInPlace,l=(s=this.detachedData)==null?void 0:s.mediaSource,h;if(a.media)c&&(r=a.transferMedia(),this.detachedData=r),h=`Primary`;
2415else if(l){let g=this.getBufferingPlayer();g?(r=g.transferMedia(),h=`${g}`):h=`detached MediaSource`}else h=`detached media`;if(!r){if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${re$1(r)}`);else if(!this.detachedData||a.media===t){let g=this.playerQueue;g.length>1&&g.forEach(p=>{if(o&&p.interstitial.appendInPlace!==c){let y=p.interstitial;this.clearInterstitial(p.interstitial,null),y.appendInPlace=!1,y.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${y}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}let u=r&&`mediaSource`in r&&((i=r.mediaSource)==null?void 0:i.readyState)!==`closed`,d=u&&r?r:t;this.log(`${u?`transfering MediaSource`:`attaching media`} to ${o?e:`Primary`} from ${h} (media.currentTime: ${t.currentTime})`);let f=this.schedule;if(d===r&&f){let g=o&&e.assetId===f.assetIdAtEnd;d.overrides={duration:f.duration,endOfStream:!o||g,cueRemoval:!o}}e.attachMedia(d)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){let e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);let s=this.timelinePos,i=this.effectivePlayingItem;if(s===-1){let r=this.hls.startPosition;if(this.timelinePos=r,t.length===0)this.setSchedulePosition(0);
vendor: 5,220 bytes, line 2415
2415else if(t[0].cue.pre){this.log(gt$3(`checkStart (preroll)`,r));let a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(r>=0||!this.primaryLive){this.log(gt$3(`checkStart`,r));let a=this.timelinePos=r>0?r:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}else this.hls.liveSyncPosition===0?this.setSchedulePosition(0):this.log(`[checkStart] waiting for live start`)}else if(i&&!this.playingItem){this.log(gt$3(`checkStart (playing item)`,i.start));let r=e.findItemIndex(i);this.setSchedulePosition(r)}}advanceAssetBuffering(e,t){let s=e.event,r=ti$2(s,s.findAssetIndex(t));if(!s.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){var a;let o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,s){let i=ti$2(e,s);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){let r=this.schedule.items;if(r){let a=t+1;if(a>=r.length){this.setSchedulePosition(-1);return}let c=e.resumeTime;this.timelinePos<c&&(this.log(gt$3(`advanceAfterAssetEnded`,c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){let r=e.assetList[i];r&&this.advanceInPlace(r.timelineStart)}this.setSchedulePosition(t,i)}}setScheduleToAssetAtTime(e,t){let s=this.schedule;if(!s)return;let i=t.parentIdentifier,r=s.getEvent(i);if(r){let a=s.findEventIndex(i),o=s.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,a,o-1)}}setSchedulePosition(e,t){var s;let i=(s=this.schedule)==null?void 0:s.items;if(!i||this.playbackDisabled)return;let r=e>=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&Pe$3(r)}) pos: ${this.timelinePos}`);let a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){let h=a.event,u=this.playingAsset,d=u?.identifier,f=d?this.getAssetPlayer(d):null;if(f&&d&&(!this.eventItemsMatch(a,r)||t!==void 0&&d!==h.assetList[t].identifier)){var c;let g=h.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${g+1}/${h.assetList.length} ${mt$5(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(m.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:g,event:h,schedule:i.slice(0),scheduleIndex:e,player:f}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),g);return}this.retreiveMediaSource(d,r),f.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&f.detachMedia()}if(!this.eventItemsMatch(a,r)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${Pe$3(a)}`),h.hasPlayed=!0,this.hls.trigger(m.INTERSTITIAL_ENDED,{event:h,schedule:i.slice(0),scheduleIndex:e}),h.cue.once)){var l;this.updateSchedule();let g=(l=this.schedule)==null?void 0:l.items;if(r&&g){let p=this.findItemIndex(r);this.advanceSchedule(p,g,t,a,o)}return}}this.advanceSchedule(e,i,t,a,o)}advanceSchedule(e,t,s,i,r){let a=this.schedule;if(!a)return;let o=t[e]||null,c=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(h=>{let u=h.interstitial,d=a.findEventIndex(u.identifier);(d<e||d>e+1)&&this.clearInterstitial(u,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);let h=o.event;if(s===void 0){s=a.findAssetIndex(h,this.timelinePos);let g=ti$2(h,s-1);if(h.isAssetPastPlayoutLimit(g)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,s);return}s=g}let u=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let d=this.preloadAssets(h,s);if(this.eventItemsMatch(o,u||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Pe$3(o)} ${h.appendInPlace?`append in place`:``}`),this.hls.trigger(m.INTERSTITIAL_STARTED,{event:h,schedule:t.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${h}`);return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${h}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;let f=h.assetList[s];if(!f){this.advanceAfterAssetEnded(h,e,s||0);return}if(d||(d=this.getAssetPlayer(f.identifier)),d===null||d.destroyed){let g=h.assetList.length;this.warn(`asset ${s+1}/${g} player destroyed ${h}`),d=this.createAssetPlayer(h,f,s),d.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(d,s,t,e,c),this.shouldPlay&&ea$2(d.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&ea$2(this.hls.media)):r&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var i,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Pe$3(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o<e.start||o>
2415=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(gt$3(`resumePrimary`,o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!s)return;let a=(r=this.schedule)==null?void 0:r.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Pe$3(e)}`),this.hls.trigger(m.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){let s=e.start;if(this.primaryLive){let i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(s<i.fragmentStart||s>i.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){let t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:W$2.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;let i=this.primaryMedia;if(!i)return;let r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,i),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(gt$3(`attachPrimary`,e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,s))}startLoadingPrimaryAt(e,t){var s;let i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((s=i.mainForwardBufferInfo)==null?void 0:s.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(m.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(m.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;let s=this.hls.levels[t.level];if(!s.details)return;let i=ee$2(ee$2({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){let s=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=ee$2(ee$2({},this.altSelection),{},{audio:s});return}let r=ee$2(ee$2({},i),{},{audio:s});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){let s=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=ee$2(ee$2({},this.altSelection),{},{subtitles:s});return}let r=ee$2(ee$2({},i),{},{subtitles:s});this.mediaSelection=r}onAudioTrackSwitching(e,t){let s=hn$3(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(s)))}onSubtitleTrackSwitch(e,t){let s=hn$3(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(s)))}onBufferCodecs(e,t){let s=t.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){let s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){let i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;let t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let i=0;i<t.length;i++){let r=t[i];if(r.cue.post){var s;let a=this.schedule.findEventIndex(r.identifier),o=(s=this.schedule.items)==null?void 0:s[a];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){let t=this.playingItem;if(!this.playingLastItem&&t){let s=this.findItemIndex(t);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(e,t){var s;let i=(s=this.schedule)==null?void 0:s.items;if(e&&i)return i[this.findItemIndex(e,t)]||null;return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((r,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(r.identifier,null)});let s=e.end+.25,i=W$2.bufferInfo(this.primaryMedia,s,0);(i.end>s||(i.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${Pe$3(e)} (was ${Pe$3(t)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;
2415return!!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;let s=this.mediaSelection;s&&((t=this.schedule)==null||t.updateSchedule(s,[],e))}checkBuffer(e){var t;let s=(t=this.schedule)==null?void 0:t.items;if(!s)return;let i=W$2.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,s,e)}updateBufferedPos(e,t,s){let i=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],r)){this.bufferedPos=e;return}let a=this.playingItem,o=this.findItemIndex(a),c=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;let h=this.findItemIndex(r),u=Math.min(h+1,t.length-1),d=t[u];if((c===-1&&r&&e>=r.end||(l=d.event)!=null&&l.appendInPlace&&e+.01>=d.start)&&(c=u),this.isInterstitial(r)){let f=r.event;if(u-o>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,c>h&&c>o)this.bufferedToItem(d);else{let f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&d.start<f.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(d)&&this.preloadAssets(d.event,0)}}else s&&a&&!this.itemsMatch(a,r)&&(c===o?this.bufferedToItem(a):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(i=>{let r=this.getAssetPlayer(i.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){let t=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,t)&&s){let{items:i,events:r}=s;if(!i||!r)return t;let a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));let c=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Pe$3(e)}`+(t?` (${c.toFixed(2)} remaining)`:``)),!this.playbackDisabled)if(a){let l=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((h,u)=>{let d=this.getAssetPlayer(h.identifier);d&&(u===l&&d.loadSource(),d.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(l=>l.pauseBuffering());this.hls.trigger(m.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){let s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;let i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){let t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s)}bufferedToEvent(e,t){let s=e.event,i=s.assetList.length===0&&!s.assetListLoader,r=s.cue.once;if(i||!r){let a=this.preloadAssets(s,t);if(a!=null&&a.interstitial.appendInPlace){let o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){let s=e.assetUrl,i=e.assetList.length,r=i===0&&!e.assetListLoader,a=e.cue.once;if(r){let c=e.timelineStart;if(e.appendInPlace){var o;let d=this.playingItem;!this.isInterstitial(d)&&(d==null||(o=d.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let l,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){let d=h-c;d>0&&(l=Math.round(d*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${s?1:i} ${e}${l?` live-start: ${h} start-offset: ${l}`:``}`),s)return this.createAsset(e,0,0,c,e.duration,s);let u=this.assetListLoader.loadAssetList(e,l);u&&(e.assetListLoader=u)}else if(!a&&i){for(let l=t;l<i;l++){let h=e.assetList[l],u=this.getAssetPlayerQueueIndex(h.identifier);(u===-1||this.playerQueue[u].destroyed)&&!h.error&&this.createAssetPlayer(e,h,l)}let c=e.assetList[t];if(c){let l=this.getAssetPlayer(c.identifier);return l&&l.loadSource(),l}}return null}flushFrontBuffer(e){let t=this.requiredTracks;
vendor: 4,732 bytes, line 2415
2415if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(i=>{this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:e,endOffset:Infinity,type:i})})}getAssetPlayerQueueIndex(e){let t=this.playerQueue;for(let s=0;s<t.length;s++)if(e===t[s].assetId)return s;return-1}getAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){let{playerQueue:e,primaryMedia:t}=this;if(t){for(let s=0;s<e.length;s++)if(e[s].media===t)return e[s]}return null}createAsset(e,t,s,i,r,a){let o={parentIdentifier:e.identifier,identifier:eu$1(e,a,t),duration:r,startOffset:s,timelineStart:i,uri:a};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,s){let i=this.hls,r=i.userConfig,a=r.videoPreference,o=i.loadLevelObj||i.levels[i.currentLevel];(a||o)&&(a=se$3({},a),o.videoCodec&&(a.videoCodec=o.videoCodec),o.videoRange&&(a.allowedVideoRanges=[o.videoRange]));let c=i.audioTracks[i.audioTrack],l=i.subtitleTracks[i.subtitleTrack],h=0;if(this.primaryLive||e.appendInPlace){let v=this.timelinePos-t.timelineStart;if(v>1){let x=t.duration;x&&v<x&&(h=v)}}let u=t.identifier,d=ee$2(ee$2({},r),{},{maxMaxBufferLength:Math.min(180,i.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:i.sessionId,assetPlayerId:u,abrEwmaDefaultEstimate:i.bandwidthEstimate,interstitialsController:void 0,startPosition:h,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:c||r.audioPreference,subtitlePreference:l||r.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));let f=d.cmcd;f!=null&&f.sessionId&&f.contentId&&(d.cmcd=se$3({},f,{contentId:Pt$3(t.uri)})),this.getAssetPlayer(u)&&this.warn(`Duplicate date range identifier ${e} and asset ${u}`);let g=new ar$3(this.HlsPlayerClass,d,e,t);this.playerQueue.push(g),e.assetList[s]=t;let p=!0,y=v=>{if(v.live){var x;let R=new Error(`Interstitials MUST be VOD assets ${e}`),b={fatal:!0,type:V$1.OTHER_ERROR,details:L$2.INTERSTITIAL_ASSET_ITEM_ERROR,error:R},I=((x=this.schedule)==null?void 0:x.findEventIndex(e.identifier))||-1;this.handleAssetItemError(b,e,I,s,R.message);return}let _=v.edge-v.fragmentStart,A=t.duration;(p||A===null||_>A)&&(p=!1,this.log(`Interstitial asset "${u}" duration change ${A} > ${_}`),t.duration=_,this.updateSchedule())};g.on(m.LEVEL_UPDATED,(v,{details:x})=>y(x)),g.on(m.LEVEL_PTS_UPDATED,(v,{details:x})=>y(x)),g.on(m.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());let E=(v,x)=>{let _=this.getAssetPlayer(u);if(_&&x.tracks){_.off(m.BUFFER_CODECS,E),_.tracks=x.tracks;let A=this.primaryMedia;this.bufferingAsset===_.assetItem&&A&&!_.media&&this.bufferAssetPlayer(_,A)}};g.on(m.BUFFER_CODECS,E);let T=()=>{var v;let x=this.getAssetPlayer(u);if(this.log(`buffered to end of asset ${x}`),!x||!this.schedule)return;let _=this.schedule.findEventIndex(e.identifier),A=(v=this.schedule.items)==null?void 0:v[_];this.isInterstitial(A)&&this.advanceAssetBuffering(A,t)};g.on(m.BUFFERED_TO_END,T);let S=v=>()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;this.shouldPlay=!0;let _=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,_,v)};return g.once(m.MEDIA_ENDED,S(s)),g.once(m.PLAYOUT_LIMIT_REACHED,S(Infinity)),g.on(m.ERROR,(v,x)=>{if(!this.schedule)return;let _=this.getAssetPlayer(u);if(x.details===L$2.BUFFER_STALLED_ERROR){if(_!=null&&_.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(x,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${x.error} ${e}`)}),g.on(m.DESTROYING,()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;let x=new Error(`Asset player destroyed unexpectedly ${u}`),_={fatal:!0,type:V$1.OTHER_ERROR,details:L$2.INTERSTITIAL_ASSET_ITEM_ERROR,error:x};this.handleAssetItemError(_,e,this.schedule.findEventIndex(e.identifier),s,x.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${mt$5(t)}`),this.hls.trigger(m.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:g}),g}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)})}resetAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);let s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,t){let s=this.getAssetPlayerQueueIndex(e);if(s!==-1){let i=this.playerQueue[s];this.log(`clear ${i} toSegment: ${t&&Pe$3(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(s,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}
2415startAssetPlayer(e,t,s,i,r){let{interstitial:a,assetItem:o,assetId:c}=e,l=a.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==c)&&(h&&(this.clearAssetPlayer(h.identifier,s[i]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${mt$5(o)}`),this.hls.trigger(m.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:s.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var s,i;if(!this.schedule)return;let{interstitial:r,assetItem:a}=e,o=this.schedule.findEventIndex(r.identifier),c=(s=this.schedule.items)==null?void 0:s[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=a;let l=this.getBufferingPlayer();if(l===e)return;let h=r.appendInPlace;if(h&&l?.interstitial.appendInPlace===!1)return;let u=l?.tracks||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(h&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(u&&!ua$2(u,e.tracks)){let d=new Error(`Asset ${mt$5(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`),f={fatal:!0,type:V$1.OTHER_ERROR,details:L$2.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},g=r.findAssetIndex(a);this.handleAssetItemError(f,r,o,g,d.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){let t=this.schedule,s=this.primaryMedia;if(!t||!s)return;let i=s.currentTime,r=t.findAssetIndex(e,i),a=e.assetList[r];if(a){let o=this.getAssetPlayer(a.identifier);if(o){let c=o.currentTime||i-a.timelineStart,l=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+l} in ${o} ${e} (media.currentTime: ${i})`),c&&(l/s.playbackRate<.5||o.bufferedInPlaceToEnd(s))&&o.hls){let h=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,h,r)}}}}advanceInPlace(e){let t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,s,i,r){if(e.details===L$2.BUFFER_STALLED_ERROR)return;let a=t.assetList[i]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&mt$5(a)} ${e.error}`),!this.schedule)return;let o=a?.identifier||``,c=this.getAssetPlayerQueueIndex(o),l=this.playerQueue[c]||null,h=this.schedule.items,u=se$3({},e,{fatal:!1,errorAction:Et$3(!0),asset:a,assetListIndex:i,event:t,schedule:h,scheduleIndex:s,player:l});if(this.hls.trigger(m.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;let d=this.playingAsset,f=this.bufferingAsset,g=new Error(r);if(a&&(this.clearAssetPlayer(o,null),a.error=g),!t.assetList.some(p=>!p.error))t.error=g;else for(let p=i;p<t.assetList.length;p++)this.resetAssetPlayer(t.assetList[p].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===o?this.advanceAfterAssetEnded(t,s,i):f&&f.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}primaryFallback(e){let t=e.timelineStart,s=this.effectivePlayingItem,i=this.timelinePos;if(s){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${i} playing: ${Pe$3(s)} error: ${e.error}`),i===-1&&(i=this.hls.startPosition);let a=this.updateItem(s,i);this.itemsMatch(s,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(i===-1){this.checkStart();return}if(!this.schedule)return;let r=this.schedule.findItemIndexAtTime(i);this.setSchedulePosition(r)}onAssetListLoaded(e,t){var s,i;let r=t.event,a=r.identifier,o=t.assetListResponse.ASSETS;if(!((s=this.schedule)!=null&&s.hasEvent(a)))return;let c=r.timelineStart,l=r.duration,h=0;o.forEach((p,y)=>{let E=parseFloat(p.DURATION);this.createAsset(r,y,h,c+h,E,p.URI),h+=E}),r.duration=h,this.log(`Loaded asset-list with duration: ${h} (was: ${l}) ${r}`);let d=this.waitingItem?.event.identifier===a;this.updateSchedule();let f=(i=this.bufferingItem)==null?void 0:i.event;if(d){var g;let p=this.schedule.findEventIndex(a),y=(g=this.schedule.items)==null?void 0:g[p];if(y){if(!this.playingItem&&this.timelinePos>y.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==p){r.error=new Error(`Interstitial ${o.length?`no longer within playback range`:`asset-list is empty`} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(y)}this.setSchedulePosition(p)}else if(f?.identifier===a){let p=r.assetList[0];if(p){let y=this.getAssetPlayer(p.identifier);if(f.appendInPlace){let E=this.primaryMedia;y&&E&&this.bufferAssetPlayer(y,E)}else y&&y.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case L$2.ASSET_LIST_PARSING_ERROR:case L$2.ASSET_LIST_LOAD_ERROR:case L$2.ASSET_LIST_LOAD_TIMEOUT:{let s=t.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case L$2.BUFFER_STALLED_ERROR:{let s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}};var ta$2=500;var hr$3=class extends Bt$3{constructor(e,t,s){super(e,t,s,`subtitle-stream-controller`,N$1.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUp
vendor: 4,136 bytes, line 2415
2415dated,this),e.on(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(m.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(m.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=D$3.IDLE,this.setInterval(ta$2),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){let{frag:s,success:i}=t;if(this.fragContextChanged(s)||(le$4(s)&&(this.fragPrevious=s),this.state=D$3.IDLE),!i)return;let r=this.tracksBuffered[this.currentTrackId];if(!r)return;let a,o=s.start;for(let l=0;l<r.length;l++)if(o>=r[l].start&&o<=r[l].end){a=r[l];break}let c=s.start+s.duration;a?a.end=c:(a={start:o,end:c},r.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(e,t){let{startOffset:s,endOffset:i}=t;if(s===0&&i!==Number.POSITIVE_INFINITY){let r=i-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=r){a.shift();continue}else if(a[o].start<r)a[o].start=r;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(s,r,N$1.SUBTITLE)}}onError(e,t){let s=t.frag;s?.type===N$1.SUBTITLE&&(t.details===L$2.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==D$3.STOPPED&&(this.state=D$3.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&lo$2(this.levels,t)){this.levels=t.map(s=>new at$2(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{let i=new at$2(s);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,N$1.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}let i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==D$3.STOPPED&&this.setInterval(ta$2)}onSubtitleTrackLoaded(e,t){var s;let{currentTrackId:i,levels:r}=this,{details:a,id:o}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}let c=r[o];if(o>=r.length||!c)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:``},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(a.live||(s=c.details)!=null&&s.live){if(a.deltaUpdateFailed)return;let u=this.mainDetails;if(!u){this.startFragRequested=!1;return}let d=u.fragments[0];if(!c.details)a.hasProgramDateTime&&u.hasProgramDateTime?(Is$2(a,u),l=a.fragmentStart):d&&(l=d.start,_i$2(a,l));else{var h;l=this.alignPlaylists(a,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),l===0&&d&&(l=d.start,_i$2(a,l))}u&&!this.startFragRequested&&this.setStartPosition(u,l)}c.details=a,this.levelLastLoaded=c,o===i&&(this.hls.trigger(m.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===D$3.IDLE&&(ot$3(null,a.fragments,this.media.currentTime,0)||(this.warn(`Subtitle playlist not aligned with playback`),c.details=void 0)))}_handleFragmentLoadComplete(e){let{frag:t,payload:s}=e,i=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&i!=null&&i.key&&i.iv&&Tt$2(i.method)){let a=performance.now();
2415this.decrypter.decrypt(new Uint8Array(s),i.key.buffer,i.iv.buffer,Fr$2(i.method)).catch(o=>{throw r.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{let c=performance.now();r.trigger(m.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=D$3.IDLE})}}doTick(){if(!this.media){this.state=D$3.IDLE;return}if(this.state===D$3.IDLE){let{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;let{config:i}=this,r=this.getLoadPosition(),{end:o,len:c}=W$2.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,i.maxBufferHole),l=s.details;if(c>this.hls.maxBufferLength+l.levelTargetDuration)return;let u=l.fragments,d=u.length,f=l.edge,g=null,p=this.fragPrevious;if(o<f){let T=i.maxFragLookUpTolerance,S=o>f-T?0:T;g=ot$3(p,u,Math.max(u[0].start,o),S),!g&&p&&p.start<u[0].start&&(g=u[0])}else g=u[d-1];if(g=this.filterReplacedPrimary(g,s.details),!g)return;let E=u[g.sn-l.startSN-1];if(E&&E.cc===g.cc&&this.fragmentTracker.getState(E)===he$2.NOT_LOADED&&(g=E),this.fragmentTracker.getState(g)===he$2.NOT_LOADED){let T=this.mapToInitFragWhenRequired(g);T&&this.loadFragment(T,s,o)}}}loadFragment(e,t,s){le$4(e)?super.loadFragment(e,t,s):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new ur$3(this.tracksBuffered[this.currentTrackId]||[])}};var ur$3=class{constructor(e){this.buffered=void 0;let t=(s,i,r)=>{if(i=i>>>0,i>r-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${r})`);return e[i][s]};this.buffered={get length(){return e.length},end(s){return t(`end`,s,e.length)},start(s){return t(`start`,s,e.length)}}}};var su$1={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499};var Io$3=n=>String.fromCharCode(su$1[n]||n);var ke$4=15;var Ke$1=100;var iu$1={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14};var ru$1={17:2,18:4,21:6,22:8,23:10,19:13,20:15};var nu$1={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14};var au$1={25:2,26:4,29:6,30:8,31:10,27:13,28:15};var ou$1=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`black`,`transparent`];var dr$3=class{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){let s=typeof t==`function`?t():t;te$1.log(`${this.time} [${e}] ${s}`)}}};var tt=function(e){let t=[];for(let s=0;s<e.length;s++)t.push(e[s].toString(16));return t};var ks$2=class{constructor(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}reset(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}setStyles(e){let t=[`foreground`,`underline`,`italics`,`background`,`flash`];for(let s=0;s<t.length;s++){let i=t[s];e.hasOwnProperty(i)&&(this[i]=e[i])}}isDefault(){return this.foreground===`white`&&!this.underline&&!this.italics&&this.background===`black`&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return`color=`+this.foreground+`, underline=`+this.underline+`, italics=`+this.italics+`, background=`+this.background+`, flash=`+this.flash}};var fr$3=class{constructor(){this.uchar=` `,this.penState=new ks$2}reset(){this.uchar=` `,this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===` `&&this.penState.isDefault()}};var gr$3=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new ks$2,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ke$1;t++)this.chars.push(new fr$3);this.logger=e}equals(e){for(let t=0;t<Ke$1;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Ke$1;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ke$1;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}
vendor: 24,236 bytes, lines 2415-2426
2415setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,`Negative cursor position `+this.pos),this.pos=0):this.pos>Ke$1&&(this.logger.log(3,`Too large cursor position `+this.pos),this.pos=Ke$1)}moveCursor(e){let t=this.pos+e;if(e>1)for(let s=this.pos+1;s<t+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(` `,this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=Io$3(e);if(this.pos>=Ke$1){this.logger.log(0,()=>`Cannot insert `+e.toString(16)+` (`+t+`) at position `+this.pos+`. Skipping it!`);return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Ke$1;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let s=0;s<Ke$1;s++){let i=this.chars[s].uchar;i!==` `&&(t=!1),e.push(i)}return t?``:e.join(``)}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var kt$3=class{constructor(e){this.rows=[],this.currRow=ke$4-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ke$4;t++)this.rows.push(new gr$3(e));this.logger=e}reset(){for(let e=0;e<ke$4;e++)this.rows[e].clear();this.currRow=ke$4-1}equals(e){let t=!0;for(let s=0;s<ke$4;s++)if(!this.rows[s].equals(e.rows[s])){t=!1;break}return t}copy(e){for(let t=0;t<ke$4;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ke$4;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,`setCursor: `+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>`pacData = `+re$1(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<ke$4;o++)this.rows[o].clear();let r=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){let o=a.rows[r].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(a.rows[r+l])}}this.currRow=t;let s=this.rows[this.currRow];if(e.indent!==null){let r=e.indent,a=Math.max(r-1,0);s.setCursor(e.indent),e.color=s.chars[a].penState.foreground}let i={foreground:e.color,underline:e.underline,italics:e.italics,background:`black`,flash:!1};this.setPen(i)}setBkgData(e){this.logger.log(2,()=>`bkgData = `+re$1(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,`roll_up but nrRollUpRows not set yet`);return}this.logger.log(1,()=>this.getDisplayText());let e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,`Rolling up`)}getDisplayText(e){e=e||!1;let t=[],s=``,i=-1;for(let r=0;r<ke$4;r++){let a=this.rows[r].getTextString();a&&(i=r+1,e?t.push(`Row `+i+`: '`+a+`'`):t.push(a.trim()))}return t.length>0&&(e?s=`[`+t.join(` | `)+`]`:s=t.join(` 2416`)),s}getTextAndFormat(){return this.rows}};var ws$3=class{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new kt$3(s),this.nonDisplayedMemory=new kt$3(s),this.lastOutputScreen=new kt$3(s),this.currRollUpRow=this.displayedMemory.rows[ke$4-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[ke$4-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>`MODE=`+e),this.mode===`MODE_POP-ON`?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!==`MODE_ROLL-UP`&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;s<e.length;s++)this.writeScreen.insertChar(e[s]);let t=this.writeScreen===this.displayedMemory?`DISP`:`NON_DISP`;this.logger.log(2,()=>t+`: `+this.writeScreen.getDisplayText(!0)),(this.mode===`MODE_PAINT-ON`||this.mode===`MODE_ROLL-UP`)&&(this.logger.log(1,()=>`DISPLAYED: `+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,`RCL - Resume Caption Loading`),this.setMode(`MODE_POP-ON`)}ccBS(){this.logger.log(2,`BS - BackSpace`),this.mode!==`MODE_TEXT`&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,`DER- Delete to End of Row`),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,`RU(`+e+`) - Roll Up`),this.writeScreen=this.displayedMemory,this.setMode(`MODE_ROLL-UP`),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,`FON - Flash On`),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,`RDC - Resume Direct Captioning`),this.setMode(`MODE_PAINT-ON`)}ccTR(){this.logger.log(2,`TR`),this.setMode(`MODE_TEXT`)}ccRTD(){this.logger.log(2,`RTD`),this.setMode(`MODE_TEXT`)}ccEDM(){this.logger.log(2,`EDM - Erase Displayed Memory`),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,`CR - Carriage Return`),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,`ENM - Erase Non-displayed Memory`),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,`EOC - End Of Caption`),this.mode===`MODE_POP-ON`){let e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>`DISP: `+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,`TO(`+e+`) - Tab Offset`),this.writeScreen.moveCursor(e)}ccMIDROW(e){let t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground=`white`;else t.foreground=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`][Math.floor(e/2)-16];this.logger.log(2,`MIDROW: `+re$1(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){let t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var Os$1=class{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=cu$1(),this.logger=void 0;let i=this.logger=new dr$3;this.channels=[null,new ws$3(e,t,i),new ws$3(e+1,s,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let s=0;s<t.length;s+=2){let i=t[s]&127,r=t[s+1]&127,a=!1,o=null;if(i===0&&r===0)continue;this.logger.log(3,()=>`[`+tt([t[s],t[s+1]])+`] -> (`+tt([i,r])+`)`);let c=this.cmdHistory;if(i>=16&&i<=31){if(lu$1(i,r,c)){ts$3(null,null,c),this.logger.log(3,()=>`Repeated command (`+tt([i,r])+`) is dropped`);continue}ts$3(i,r,this.cmdHistory),a=this.parseCmd(i,r),a||(a=this.parseMidrow(i,r)),a||(a=this.parsePAC(i,r)),a||(a=this.parseBackgroundAttributes(i,r))}else ts$3(null,null,c);if(!a&&(o=this.parseChars(i,r),o)){let h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,`No channel found yet. TEXT-MODE?`)}!a&&!o&&this.logger.log(2,()=>`Couldn't parse cleaned data `+tt([i,r])+` orig: `+tt([t[s],t[s+1]]))}}parseCmd(e,t){if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;let r=e===20||e===21||e===23?1:2,a=this.channels[r];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,`Mismatch channel in midrow parsing`),!1;let i=this.channels[s];return i?(i.ccMIDROW(t),this.logger.log(3,()=>`MIDROW (`+tt([e,t])+`)`),!0):!1}return!1}parsePAC(e,t){let s;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;let a=e<=23?1:2;t>=64&&t<=95?s=a===1?iu$1[e]:nu$1[e]:s=a===1?ru$1[e]:au$1[e];let o=this.channels[a];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let s,i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,i.underline=(s&1)===1,s<=13?i.color=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`white`][Math.floor(s/2)]:s<=15?(i.italics=!0,i.color=`white`):i.indent=Math.floor((s-16)/2)*4,i}parseChars(e,t){let s,i=null,r=null;if(e>=25?(s=2,r=e-8):(s=1,r=e),r>=17&&r<=19){let a;r===17?a=t+80:r===18?a=t+112:a=t+144,this.logger.log(2,()=>`Special char '`+Io$3(a)+`' in channel `+s),i=[a]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>`Char codes = `+tt(i).join(`,`)),i}parseBackgroundAttributes(e,t){if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;let r,a={};e===16||e===24?(r=Math.floor((t-32)/2),a.background=ou$1[r],t%2===1&&(a.background=a.background+`_semi`)):t===45?a.background=`transparent`:(a.foreground=`black`,t===47&&(a.underline=!0));let o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}ts$3(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){let s=this.channels[t];s&&s.cueSplitAtTime(e)}}};function ts$3(n,e,t){t.a=n,t.b=e}function lu$1(n,e,t){return t.a===n&&t.b===e}function cu$1(){return{a:null,b:null}}var Yr$3=(function(){if(As$2!=null&&As$2.VTTCue)return self.VTTCue;let n=[``,`lr`,`rl`],e=[`start`,`middle`,`end`,`left`,`right`];function t(o,c){if(typeof c!=`string`||!Array.isArray(o))return!1;let l=c.toLowerCase();return~o.indexOf(l)?l:!1}function s(o){return t(n,o)}function i(o){return t(e,o)}function r(o,...c){let l=1;for(;l<arguments.length;l++){let h=arguments[l];for(let u in h)o[u]=h[u]}return o}function a(o,c,l){let h=this,u={enumerable:!0};h.hasBeenReset=!1;let d=``,f=!1,g=o,p=c,y=l,E=null,T=``,S=!0,v=`auto`,x=`start`,_=50,A=`middle`,R=50,b=`middle`;Object.defineProperty(h,"id",r({},u,{get:function(){return d},set:function(I){d=``+I}})),Object.defineProperty(h,"pauseOnExit",r({},u,{get:function(){return f},set:function(I){f=!!I}})),Object.defineProperty(h,"startTime",r({},u,{get:function(){return g},set:function(I){if(typeof I!=`number`)throw new TypeError(`Start time must be set to a number.`);g=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",r({},u,{get:function(){return p},set:function(I){if(typeof I!=`number`)throw new TypeError(`End time must be set to a number.`);p=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",r({},u,{get:function(){return y},set:function(I){y=``+I,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",r({},u,{get:function(){return E},set:function(I){E=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",r({},u,{get:function(){return T},set:function(I){let C=s(I);if(C===!1)throw new SyntaxError(`An invalid or illegal string was specified.`);T=C,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",r({},u,{get:function(){return S},set:function(I){S=!!I,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",r({},u,{get:function(){return v},set:function(I){if(typeof I!=`number`&&I!==`auto`)throw new SyntaxError(`An invalid number or illegal string was specified.`);v=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",r({},u,{get:function(){return x},set:function(I){let C=i(I);if(!C)throw new SyntaxError(`An invalid or illegal string was specified.`);x=C,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",r({},u,{get:function(){return _},set:function(I){if(I<0||I>100)throw new Error(`Position must be between 0 and 100.`);_=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",r({},u,{get:function(){return A},set:function(I){let C=i(I);if(!C)throw new SyntaxError(`An invalid or illegal string was specified.`);A=C,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",r({},u,{get:function(){return R},set:function(I){if(I<0||I>100)throw new Error(`Size must be between 0 and 100.`);R=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",r({},u,{get:function(){return b},set:function(I){let C=i(I);if(!C)throw new SyntaxError(`An invalid or illegal string was specified.`);b=C,this.hasBeenReset=!0}})),h.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();var mr$3=class{decode(e,t){if(!e)return``;if(typeof e!=`string`)throw new Error(`Error - expected string data.`);return decodeURIComponent(encodeURIComponent(e))}};function Lo$3(n){function e(s,i,r,a){return(s|0)*3600+(i|0)*60+(r|0)+parseFloat(a||0)}let t=n.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}var pr$3=class{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==``&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let i=0;i<s.length;++i)if(t===s[i]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){let s=parseFloat(t);if(s>=0&&s<=100)return this.set(e,s),!0}return!1}};function Ro$3(n,e,t,s){let i=s?n.split(s):[n];for(let r in i){if(typeof i[r]!=`string`)continue;let a=i[r].split(t);if(a.length!==2)continue;let o=a[0],c=a[1];e(o,c)}}var yr$3=new Yr$3(0,0,``);var ss$3=yr$3.align===`middle`?`middle`:`center`;function hu$1(n,e,t){let s=n;function i(){let o=Lo$3(n);if(o===null)throw new Error(`Malformed timestamp: `+s);return n=n.replace(/^[^\sa-zA-Z-]+/,``),o}function r(o,c){let l=new pr$3;Ro$3(o,function(d,f){let g;switch(d){case`region`:for(let p=t.length-1;p>=0;p--)if(t[p].id===f){l.set(d,t[p].region);break}break;case`vertical`:l.alt(d,f,[`rl`,`lr`]);break;case`line`:g=f.split(`,`),l.integer(d,g[0]),l.percent(d,g[0])&&l.set(`snapToLines`,!1),l.alt(d,g[0],[`auto`]),g.length===2&&l.alt(`lineAlign`,g[1],[`start`,ss$3,`end`]);break;case`position`:g=f.split(`,`),l.percent(d,g[0]),g.length===2&&l.alt(`positionAlign`,g[1],[`start`,ss$3,`end`,`line-left`,`line-right`,`auto`]);break;case`size`:l.percent(d,f);break;case`align`:l.alt(d,f,[`start`,ss$3,`end`,`left`,`right`]);break}},/:/,/\s/),c.region=l.get(`region`,null),c.vertical=l.get(`vertical`,``);let h=l.get(`line`,`auto`);h===`auto`&&yr$3.line===-1&&(h=-1),c.line=h,c.lineAlign=l.get(`lineAlign`,`start`),c.snapToLines=l.get(`snapToLines`,!0),c.size=l.get(`size`,100),c.align=l.get(`align`,ss$3);let u=l.get(`position`,`auto`);u===`auto`&&yr$3.position===50&&(u=c.align===`start`||c.align===`left`?0:c.align===`end`||c.align===`right`?100:50),c.position=u}function a(){n=n.replace(/^\s+/,``)}if(a(),e.startTime=i(),a(),n.slice(0,3)!==`-->`)throw new Error(`Malformed time stamp (time stamps must be separated by '-->'): `+s);n=n.slice(3),a(),e.endTime=i(),a(),r(n,e)}function bo$3(n){return n.replace(/<br(?: \/)?>/gi,` 2417`)}var Er$3=class{constructor(){this.state=`INITIAL`,this.buffer=``,this.decoder=new mr$3,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){let t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let r=t.buffer,a=0;for(r=bo$3(r);a<r.length&&r[a]!==`\r`&&r[a]!==` 2418`;)++a;let o=r.slice(0,a);return r[a]===`\r`&&++a,r[a]===` 2419`&&++a,t.buffer=r.slice(a),o}function i(r){Ro$3(r,function(a,o){},/:/)}try{let r=``;if(t.state===`INITIAL`){if(!/\r\n|\n/.test(t.buffer))return this;r=s();let o=r.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error(`Malformed WebVTT signature.`);t.state=`HEADER`}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=s(),t.state){case`HEADER`:/:/.test(r)?i(r):r||(t.state=`ID`);continue;case`NOTE`:r||(t.state=`ID`);continue;case`ID`:if(/^NOTE($|[ \t])/.test(r)){t.state=`NOTE`;break}if(!r)continue;if(t.cue=new Yr$3(0,0,``),t.state=`CUE`,r.indexOf(`-->`)===-1){t.cue.id=r;continue}case`CUE`:if(!t.cue){t.state=`BADCUE`;continue}try{hu$1(r,t.cue,t.regionList)}catch(o){t.cue=null,t.state=`BADCUE`;continue}t.state=`CUETEXT`;continue;case`CUETEXT`:{let o=r.indexOf(`-->`)!==-1;if(!r||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state=`ID`;continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` 2420`),t.cue.text+=r}continue;case`BADCUE`:r||(t.state=`ID`)}}}catch(r){t.state===`CUETEXT`&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state===`INITIAL`?`BADWEBVTT`:`BADCUE`}return this}flush(){let e=this;try{if((e.cue||e.state===`HEADER`)&&(e.buffer+=` 2421 2422`,e.parse()),e.state===`INITIAL`||e.state===`BADWEBVTT`)throw new Error(`Malformed WebVTT signature.`)}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}};var uu$1=/\r\n|\n\r|\n|\r/g;var si$2=function(e,t,s=0){return e.slice(s,s+t.length)===t};var du$1=function(e){let t=parseInt(e.slice(-3)),s=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(`:`))):0;if(!F$1(t)||!F$1(s)||!F$1(i)||!F$1(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*i,t+=3600*1e3*r,t};function Wr$3(n,e,t){return Pt$3(n.toString())+Pt$3(e.toString())+Pt$3(t)}var fu$1=function(e,t,s){let i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(a=r)!=null&&a.new;){var a;e.ccOffset+=i.start-r.start,i.new=!1,i=r,r=e[i.prevCC]}e.presentationOffset=s};function gu$1(n,e,t,s,i,r,a){let o=new Er$3,c=Re$1(new Uint8Array(n)).trim().replace(uu$1,` 2423`).split(` 2424`),l=[],h=e?Hc$3(e.baseTime,e.timescale):0,u=`00:00.000`,d=0,f=0,g,p=!0;o.oncue=function(y){let E=t[s],T=t.ccOffset,S=(d-h)/9e4;if(E!=null&&E.new&&(f!==void 0?T=t.ccOffset=E.start:fu$1(t,s,S)),S){if(!e){g=new Error(`Missing initPTS for VTT MPEGTS`);return}T=S-t.presentationOffset}let v=y.endTime-y.startTime,x=Ie$3((y.startTime+T-f)*9e4,i*9e4)/9e4;y.startTime=Math.max(x,0),y.endTime=Math.max(x+v,0);let _=y.text.trim();y.text=decodeURIComponent(encodeURIComponent(_)),y.id||(y.id=Wr$3(y.startTime,y.endTime,_)),y.endTime>0&&l.push(y)},o.onparsingerror=function(y){g=y},o.onflush=function(){if(g){a(g);return}r(l)},c.forEach(y=>{if(p)if(si$2(y,`X-TIMESTAMP-MAP=`)){p=!1,y.slice(16).split(`,`).forEach(E=>{si$2(E,`LOCAL:`)?u=E.slice(6):si$2(E,`MPEGTS:`)&&(d=parseInt(E.slice(7)))});try{f=du$1(u)/1e3}catch(E){g=E}return}else y===``&&(p=!1);o.parse(y+` 2425`)}),o.flush()}var ii$3=`stpp.ttml.im1t`;var _o$2=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/;var Do$3=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/;var mu$1={left:`start`,center:`center`,right:`end`,start:`start`,end:`end`};function sa$2(n,e,t,s){let i=X$2(new Uint8Array(n),[`mdat`]);if(i.length===0){s(new Error(`Could not parse IMSC1 mdat`));return}let r=i.map(o=>Re$1(o)),a=Vc$3(e.baseTime,1,e.timescale);try{r.forEach(o=>t(pu$1(o,a)))}catch(o){s(o)}}function pu$1(n,e){let i=new DOMParser().parseFromString(n,`text/xml`).getElementsByTagName(`tt`)[0];if(!i)throw new Error(`Invalid ttml`);let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((u,d)=>(u[d]=i.getAttribute(`ttp:${d}`)||r[d],u),{}),o=i.getAttribute(`xml:space`)!==`preserve`,c=ia$2(ri$3(i,`styling`,`style`)),l=ia$2(ri$3(i,`layout`,`region`)),h=ri$3(i,`body`,`[begin]`);return[].map.call(h,u=>{let d=Co$3(u,o);if(!d||!u.hasAttribute(`begin`))return null;let f=ai$3(u.getAttribute(`begin`),a),g=ai$3(u.getAttribute(`dur`),a),p=ai$3(u.getAttribute(`end`),a);if(f===null)throw ra$2(u);if(p===null){if(g===null)throw ra$2(u);p=f+g}let y=new Yr$3(f-e,p-e,d);y.id=Wr$3(y.startTime,y.endTime,y.text);let E=l[u.getAttribute(`region`)],T=c[u.getAttribute(`style`)],S=yu$1(E,T,c),{textAlign:v}=S;if(v){let x=mu$1[v];x&&(y.lineAlign=x),y.align=v}return se$3(y,S),y}).filter(u=>u!==null)}function ri$3(n,e,t){let s=n.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function ia$2(n){return n.reduce((e,t)=>{let s=t.getAttribute(`xml:id`);return s&&(e[s]=t),e},{})}function Co$3(n,e){return[].slice.call(n.childNodes).reduce((t,s,i)=>{var r;return s.nodeName===`br`&&i?t+` 2426`:(r=s.childNodes)!=null&&r.length?Co$3(s,e):e?t+s.textContent.trim().replace(/\s+/g,` `):t+s.textContent},``)}function yu$1(n,e,t){let s=`http://www.w3.org/ns/ttml#styling`,i=null,r=[`displayAlign`,`textAlign`,`color`,`backgroundColor`,`fontSize`,`fontFamily`],a=n!=null&&n.hasAttribute(`style`)?n.getAttribute(`style`):null;return a&&t.hasOwnProperty(a)&&(i=t[a]),r.reduce((o,c)=>{let l=ni$2(e,s,c)||ni$2(n,s,c)||ni$2(i,s,c);return l&&(o[c]=l),o},{})}function ni$2(n,e,t){return n&&n.hasAttributeNS(e,t)?n.getAttributeNS(e,t):null}function ra$2(n){return new Error(`Could not parse ttml timestamp ${n}`)}function ai$3(n,e){if(!n)return null;let t=Lo$3(n);return t===null&&(_o$2.test(n)?t=Eu$1(n,e):Do$3.test(n)&&(t=Tu$1(n,e))),t}function Eu$1(n,e){let t=_o$2.exec(n),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function Tu$1(n,e){let t=Do$3.exec(n),s=Number(t[1]);switch(t[2]){case`h`:return s*3600;case`m`:return s*60;case`ms`:return s*1e3;case`f`:return s/e.frameRate;case`t`:return s/e.tickRate}return s}var yt$4=class{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}};var Tr$3=class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=aa$2(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}}
vendor: 3,579 bytes, line 2426
2426,e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this),e.on(m.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(m.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(m.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_LOADED,this.onFragLoaded,this),e.off(m.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(m.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(m.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){let e=new yt$4(this,`textTrack1`),t=new yt$4(this,`textTrack2`),s=new yt$4(this,`textTrack3`),i=new yt$4(this,`textTrack4`);this.cea608Parser1=new Os$1(1,e,t),this.cea608Parser2=new Os$1(3,s,i)}addCues(e,t,s,i,r){let a=!1;for(let o=r.length;o--;){let c=r[o],l=Su$1(c[0],c[1],t,s);if(l>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],s),a=!0,l/(s-t)>.5))return}if(a||r.push([t,s]),this.config.renderTextTracksNatively){let o=this.captionsTracks[e];this.Cues.newCue(o,t,s,i)}else{let o=this.Cues.newCue(null,t,s,i);this.hls.trigger(m.CUES_PARSED,{type:`captions`,cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:r,trackId:a}){let{unparsedVttFrags:o}=this;s===N$1.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:r,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(m.FRAG_LOADED,c):this.hls.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error(`Subtitle discontinuity domain does not match main`)})}))}getExistingTrack(e,t){let{media:s}=this;if(s)for(let i=0;i<s.textTracks.length;i++){let r=s.textTracks[i];if(na$2(r,{name:e,lang:t,characteristics:`transcribes-spoken-dialog,describes-music-and-sound`}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:s,media:i}=this,{label:r,languageCode:a}=t[e],o=this.getExistingTrack(r,a);if(o)s[e]=o,pt$4(s[e]),vo$2(s[e],i);else{let c=this.createTextTrack(`captions`,r,a);c&&(c[e]=!0,s[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let i={_id:e,label:t.label,kind:`captions`,default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(m.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,s){let i=this.media;if(i)return i.addTextTrack(e,t,s)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){let s=!!t.transferMedia;if(this.media=null,s)return;let{captionsTracks:i}=this;
vendor: 15,308 bytes, line 2426
2426Object.keys(i).forEach(r=>{pt$4(i[r]),delete i[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=aa$2(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let s=0;s<t.length;s++)pt$4(t[s])}onSubtitleTracksUpdated(e,t){let s=t.subtitleTracks||[],i=s.some(r=>r.textCodec===ii$3);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(lo$2(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){let a=this.media,o=a?hs$3(a.textTracks):null;if(this.tracks.forEach((c,l)=>{let h;if(o){let u=null;for(let d=0;d<o.length;d++)if(o[d]&&na$2(o[d],c)){u=o[d],o[d]=null;break}u&&(h=u)}if(h)pt$4(h);else{let u=Po$3(c);h=this.createTextTrack(u,c.name,c.lang),h&&(h.mode=`disabled`)}h&&this.textTracks.push(h)}),o!=null&&o.length){let c=o.filter(l=>l!==null).map(l=>l.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(`, `)}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(m.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{let i=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!i)return;let r=`textTrack${i[1]}`,a=this.captionsProperties[r];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s)})}closedCaptionsForLevel(e){return this.hls.levels[e.level]?.attrs[`CLOSED-CAPTIONS`]}onFragLoading(e,t){if(this.enabled&&t.frag.type===N$1.MAIN){var s,i;let{cea608Parser1:r,cea608Parser2:a,lastSn:o}=this,{cc:c,sn:l}=t.frag,h=(s=(i=t.part)==null?void 0:i.index)!=null?s:-1;r&&a&&(l!==o+1||l===o&&h!==this.lastPartIndex+1||c!==this.lastCc)&&(r.reset(),a.reset()),this.lastCc=c,this.lastSn=l,this.lastPartIndex=h}}onFragLoaded(e,t){let{frag:s,payload:i}=t;if(s.type===N$1.SUBTITLE)if(i.byteLength){let r=s.decryptdata,a=`stats`in t;if(r==null||!r.encrypted||a){let o=this.tracks[s.level],c=this.vttCCs;c[s.cc]||(c[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===ii$3?this._parseIMSC1(s,i):this._parseVTTs(t)}}else this.hls.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error(`Empty subtitle payload`)})}_parseIMSC1(e,t){let s=this.hls;sa$2(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),s.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{s.logger.log(`Failed to parse IMSC1: ${i}`),s.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;let{frag:s,payload:i}=e,{initPTS:r,unparsedVttFrags:a}=this,o=r.length-1;if(!r[s.cc]&&o===-1){a.push(e);return}let c=this.hls;gu$1((t=s.initSegment)!=null&&t.data?De$1(s.initSegment.data,new Uint8Array(i)).buffer:i,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,h=>{this._appendCues(h,s.level),c.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},h=>{let u=h.message===`Missing initPTS for VTT MPEGTS`;u?a.push(e):this._fallbackToIMSC1(s,i),c.logger.log(`Failed to parse VTT cue: ${h}`),!(u&&o>s.cc)&&c.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:h})})}_fallbackToIMSC1(e,t){let s=this.tracks[e.level];s.textCodec||sa$2(t,this.initPTS[e.cc],()=>{s.textCodec=ii$3,this._parseIMSC1(e,t)},()=>{s.textCodec=`wvtt`})}_appendCues(e,t){let s=this.hls;if(this.config.renderTextTracksNatively){let i=this.textTracks[t];if(!i||i.mode===`disabled`)return;e.forEach(r=>xo$2(i,r))}else{let i=this.tracks[t];if(!i)return;let r=i.default?`default`:`subtitles`+t;s.trigger(m.CUES_PARSED,{type:`subtitles`,cues:e,track:r})}}onFragDecrypted(e,t){let{frag:s}=t;s.type===N$1.SUBTITLE&&this.onFragLoaded(m.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;let{frag:s,samples:i}=t;if(!(s.type===N$1.MAIN&&this.closedCaptionsForLevel(s)===`NONE`))for(let r=0;r<i.length;r++){let a=i[r].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();let o=this.extractCea608Data(a);this.cea608Parser1.addData(i[r].pts,o[0]),this.cea608Parser2.addData(i[r].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:s,endOffsetSubtitles:i,type:r}){let{media:a}=this;if(!(!a||a.currentTime<s)){if(!r||r===`video`){let{captionsTracks:o}=this;Object.keys(o).forEach(c=>ir$3(o[c],t,s))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){let{textTracks:o}=this;Object.keys(o).forEach(c=>ir$3(o[c],t,i))}}}extractCea608Data(e){let t=[[],[]],s=e[0]&31,i=2;for(let r=0;r<s;r++){let a=e[i++],o=127&e[i++],c=127&e[i++];if(o===0&&c===0)continue;if((4&a)!==0){let h=3&a;(h===0||h===1)&&(t[h].push(o),t[h].push(c))}}return t}};function Po$3(n){return n.characteristics&&/transcribes-spoken-dialog/gi.test(n.characteristics)&&/describes-music-and-sound/gi.test(n.characteristics)?`captions`:`subtitles`}function na$2(n,e){return!!n&&n.kind===Po$3(e)&&Yi$1(e,n)}function Su$1(n,e,t,s){return Math.min(e,s)-Math.max(n,t)}function aa$2(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}var vu$1=/\s/;var xu$1={newCue(n,e,t,s){let i=[],r,a,o,c,l,h=self.VTTCue||self.TextTrackCue;for(let d=0;d<s.rows.length;d++)if(r=s.rows[d],o=!0,c=0,l=``,!r.isEmpty()){var u;for(let p=0;p<r.chars.length;p++)vu$1.test(r.chars[p].uchar)&&o?c++:(l+=r.chars[p].uchar,o=!1);r.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;let f=bo$3(l.trim()),g=Wr$3(e,t,f);n!=null&&(u=n.cues)!=null&&u.getCueById(g)||(a=new h(e,t,f),a.id=g,a.line=d+1,a.align=`left`,a.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(a))}return n&&i.length&&(i.sort((d,f)=>d.line===`auto`||f.line===`auto`?0:d.line>8&&f.line>8?f.line-d.line:d.line-f.line),i.forEach(d=>xo$2(n,d))),i}};function Au$1(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}var Iu$1=/(\d+)-(\d+)\/(\d+)/;var Fs$1=class{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||_u$1,this.controller=new self.AbortController,this.stats=new wt$3}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){let i=this.stats;if(i.loading.start)throw new Error(`Loader can only be used once.`);i.loading.start=self.performance.now();let r=Lu$1(e,this.controller.signal),a=e.responseType===`arraybuffer`,o=a?`byteLength`:`length`,{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&F$1(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},t.timeout),(Kt$3(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(u=>{var d;this.response=this.loader=u;let f=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},l-(f-i.loading.start)),!u.ok){let{status:p,statusText:y}=u;throw new Sr$3(y||`fetch, bad network response`,p,u)}i.loading.first=f,i.total=bu$1(u.headers)||i.total;let g=(d=this.callbacks)==null?void 0:d.onProgress;return g&&F$1(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,g):a?u.arrayBuffer():e.responseType===`json`?u.json():u.text()}).then(u=>{var d,f;let g=this.response;if(!g)throw new Error(`loader destroyed`);self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);let p=u[o];p&&(i.loaded=i.total=p);let y={url:g.url,data:u,code:g.status},E=(d=this.callbacks)==null?void 0:d.onProgress;E&&!F$1(t.highWaterMark)&&E(i,e,u,g),(f=this.callbacks)==null||f.onSuccess(y,i,e,g)}).catch(u=>{var d;if(self.clearTimeout(this.requestTimeout),i.aborted)return;let f=u&&u.code||0,g=u?u.message:null;(d=this.callbacks)==null||d.onError({code:f,text:g},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,i=0,r){let a=new Ls$2,o=e.body.getReader(),c=()=>o.read().then(l=>{if(l.done)return a.dataLength&&r(t,s,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));let h=l.value,u=h.length;return t.loaded+=u,u<i||a.dataLength?(a.push(h),a.dataLength>=i&&r(t,s,a.flush().buffer,e)):r(t,s,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}};function Lu$1(n,e){let t={method:`GET`,mode:`cors`,credentials:`same-origin`,signal:e,headers:new self.Headers(se$3({},n.headers))};return n.rangeEnd&&t.headers.set(`Range`,`bytes=`+n.rangeStart+`-`+String(n.rangeEnd-1)),t}function Ru$1(n){let e=Iu$1.exec(n);if(e)return parseInt(e[2])-parseInt(e[1])+1}function bu$1(n){let e=n.get(`Content-Range`);if(e){let s=Ru$1(e);if(F$1(s))return s}let t=n.get(`Content-Length`);if(t)return parseInt(t)}function _u$1(n,e){return new self.Request(n.url,e)}var Sr$3=class extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}};var Du$1=/^age:\s*[\d.]+\s*$/im;var Ms$3=class{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new wt$3,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error(`Loader can only be used once.`);this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let s=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;let r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return r(s,t.url)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open(`GET`,t.url,!0),r(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:a.message},t,s,i)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open(`GET`,t.url,!0);let i=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:a}=s.loadPolicy;if(i)for(let o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader(`Range`,`bytes=`+t.rangeStart+`-`+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=r&&F$1(r)?r:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:s}=this;if(!e||!t)return;let i=t.readyState,r=this.config;if(!s.aborted&&i>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let l=t.status,h=t.responseType===`text`?t.responseText:null;if(l>=200&&l<300){let g=h??t.response;if(g!=null){var a,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);s.loaded=s.total=t.responseType===`arraybuffer`?g.byteLength:g.length,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);let y=(a=this.callbacks)==null?void 0:a.onProgress;y&&y(s,e,g,t);let E={url:t.responseURL,data:g,code:l};(o=this.callbacks)==null||o.onSuccess(E,s,e,t);return}}let u=r.loadPolicy.errorRetry,d=s.retry;if(Ts$2(u,d,!1,{url:e.url,data:void 0,code:l}))this.retry(u);else{var c;te$1.error(`${l} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:l,text:t.statusText},e,t,s)}}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ts$2(e,t,!0))this.retry(e);else{var s;te$1.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);let i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:s}=this;this.retryDelay=Or$2(e,s.retry),s.retry++,te$1.warn(`${status?`HTTP Status `+status:`Timeout`} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Du$1.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,`im`).test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}};var Pu$1=ee$2(ee$2({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,frontBufferFlushThreshold:Infinity,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:`edge`,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftw
2426areAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Ms$3,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:pi$3,bufferController:Xi$1,capLevelController:zi$2,errorController:Ei$2,fpsController:sr$3,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Oa$2,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:Infinity,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},ku$1()),{},{subtitleStreamController:hr$3,subtitleTrackController:rr$2,timelineController:Tr$3,audioStreamController:Hi$2,audioTrackController:Wi$2,emeController:Xh$1,cmcdController:er$3,contentSteeringController:tr$3,interstitialsController:cr$3});function ku$1(){return{cueHandler:xu$1,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:`English`,captionsTextTrack1LanguageCode:`en`,captionsTextTrack2Label:`Spanish`,captionsTextTrack2LanguageCode:`es`,captionsTextTrack3Label:`Unknown CC`,captionsTextTrack3LanguageCode:``,captionsTextTrack4Label:`Unknown CC`,captionsTextTrack4LanguageCode:``,renderTextTracksNatively:!0}}function wu$1(n,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error(`Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration`);if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error(`Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"`);if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error(`Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"`);let s=vr$3(n),i=[`manifest`,`level`,`frag`],r=[`TimeOut`,`MaxRetry`,`RetryDelay`,`MaxRetryTimeout`];
vendor: 1,844 bytes, line 2426
2426return i.forEach(a=>{let o=`${a===`level`?`playlist`:a}LoadPolicy`,c=e[o]===void 0,l=[];r.forEach(h=>{let u=`${a}Loading${h}`,d=e[u];if(d!==void 0&&c){l.push(u);let f=s[o].default;switch(e[o]={default:f},h){case`TimeOut`:f.maxLoadTimeMs=d,f.maxTimeToFirstByteMs=d;break;case`MaxRetry`:f.errorRetry.maxNumRetry=d,f.timeoutRetry.maxNumRetry=d;break;case`RetryDelay`:f.errorRetry.retryDelayMs=d,f.timeoutRetry.retryDelayMs=d;break;case`MaxRetryTimeout`:f.errorRetry.maxRetryDelayMs=d,f.timeoutRetry.maxRetryDelayMs=d;break}}}),l.length&&t.warn(`hls.js config: "${l.join(`", "`)}" setting(s) are deprecated, use "${o}": ${re$1(e[o])}`)}),ee$2(ee$2({},s),e)}function vr$3(n){return n&&typeof n==`object`?Array.isArray(n)?n.map(vr$3):Object.keys(n).reduce((e,t)=>(e[t]=vr$3(n[t]),e),{}):n}function Ou$1(n,e){let t=n.loader;t!==Fs$1&&t!==Ms$3?(e.log(`[config]: Custom loader detected, cannot enable progressive streaming`),n.progressive=!1):Au$1()&&(n.loader=Fs$1,n.progressive=!0,n.enableSoftwareAES=!0,e.log(`[config]: Progressive streaming enabled, using FetchLoader`))}var us$3=2;var Fu$1=.1;var Mu$1=.05;var Nu$1=100;var xr$3=class extends Ss$3{constructor(e,t){super(`gap-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(m.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){let{hls:e}=this;
vendor: 6,232 bytes, line 2426
2426e&&(e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Nu$1),this.mediaSource=t.mediaSource;let s=this.media=t.media;Te$3(s,`playing`,this.onMediaPlaying),Te$3(s,`waiting`,this.onMediaWaiting),Te$3(s,`ended`,this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();let{media:s}=this;s&&(ve$3(s,`playing`,this.onMediaPlaying),ve$3(s,`waiting`,this.onMediaWaiting),ve$3(s,`ended`,this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;let t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var s,i;let r=(s=this.hls)==null?void 0:s.config;if(!r)return;let a=this.media;if(!a)return;let{seeking:o}=a,c=this.seeking&&!o,l=!this.seeking&&o,h=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!h&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(l||c){c&&this.stallResolved(e);return}if(h){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(m.MEDIA_ENDED,{stalled:!1}));return}if(!W$2.getBuffered(a).length){this.nudgeRetry=0;return}let u=W$2.bufferInfo(a,e,0),d=u.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){let _=oa$2(this.hls.inFlightFragments,e),A=u.len>us$3,R=!d||_||d-e>us$3&&!f.getPartialFragment(e);if(A||R)return;this.moved=!1}let g=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(u.len>0)&&!d)return;let A=Math.max(d,u.start||0)-e,b=!!(g!=null&&g.live)?g.targetduration*2:us$3,I=is$3(e,f);if(A>0&&(A<=b||I)){a.paused||this._trySkipBufferHole(I);return}}let p=r.detectStallWithCurrentTimeMs,y=self.performance.now(),E=this.waiting,T=this.stalled;if(T===null)if(E>0&&y-E<p)T=this.stalled=E;else{this.stalled=y;return}let S=y-T;if(!o&&(S>=p||E)&&this.hls){var v;if(((v=this.mediaSource)==null?void 0:v.readyState)===`ended`&&!(g!=null&&g.live)&&Math.abs(e-(g?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(m.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(u),!this.media||!this.hls)return}let x=W$2.bufferInfo(a,e,r.maxBufferHole);this._tryFixBufferStall(x,S,e)}stallResolved(e){let t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){let s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(m.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;let i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&i&&i.length>1&&e>i.end(0)){let r=W$2.bufferedInfo(W$2.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){let a=W$2.timeRangesToArray(i),o=W$2.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){let c=W$2.bufferedInfo(a,e,0).bufferedIndex,l=a[o].end,h=a[o+1].start;if((c===-1||c>o)&&h-l<1&&e-l<2){let u=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${l} -> ${h} buffered index: ${c}`);this.warn(u.message),this.media.currentTime+=1e-6;let d=is$3(e,this.fragmentTracker);d&&`fragment`in d?d=d.fragment:d||(d=void 0);let f=W$2.bufferInfo(this.media,e,0);this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:u,reason:u.message,frag:d,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,t,s){var i,r;let{fragmentTracker:a,media:o}=this,c=(i=this.hls)==null?void 0:i.config;if(!o||!a||!c)return;let l=(r=this.hls)==null?void 0:r.latestLevelDetails,h=is$3(s,a);if((h||l!=null&&l.live&&s<l.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;let u=e.buffered,d=this.adjacentTraversal(e,s);(u&&u.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-s<c.maxBufferHole||d))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn(`Trying to nudge playhead over buffer-hole`),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){let s=this.fragmentTracker,i=e.nextStart;if(s&&i){let r=s.getFragAtPos(t,N$1.MAIN),a=s.getFragAtPos(i,N$1.MAIN);if(r&&a)return a.sn-r.sn<2}return!1}_reportStall(e){let{hls:t,media:s,stallReported:i,stalled:r}=this;if(!i&&r!==null&&s&&t){this.stallReported=!0;let a=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${re$1(e)})`);this.warn(a.message),t.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;let{fragmentTracker:s,media:i}=this,r=(t=this.hls)==null?void 0:t.config;if(!i||!s||!r)return 0;let a=i.currentTime,o=W$2.bufferInfo(i,a,0),c=a<o.start?o.start:o.nextStart;if(c&&this.hls){let h=o.len<=r.maxBufferHole,u=o.len>0&&o.len<1&&i.readyState<3,d=c-a;if(d>0&&(h||u)){if(d>r.maxBufferHole){let g=!1;if(a===0){let p=s.getAppendedFrag(0,N$1.MAIN);p&&c<p.end&&(g=!0)}if(!g&&e){var l;if(!((l=this.hls.loadLevelObj)!=null&&l.details)||oa$2(this.hls.inFlightFragments,c))return 0;let y=!1,E=e.end;for(;E<c;){let T=is$3(E,s);if(T)E+=T.duration;else{y=!0;break}}if(y)return 0}}let f=Math.max(c+Mu$1,a+Fu$1);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${f}`),this.moved=!0,i.currentTime=f,!(e!=null&&e.gap)){let g=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${f}`),p={type:V$1.MEDIA_ERROR,details:L$2.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:g,reason:g.message,buffer:o.len,bufferInfo:o};e&&(`fragment`in e?p.part=e:p.frag=e),this.hls.trigger(m.ERROR,p)}return f}}return 0}_tryNudgeBuffer(e){let{hls:t,media:s,nudgeRetry:i}=this,r=t?.config;if(!s||!r)return 0;let a=s.currentTime;
2426if(this.nudgeRetry++,i<r.nudgeMaxRetry){let o=a+(i+1)*r.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(c.message),s.currentTime=o,t.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{let o=new Error(`Playhead still not moving while enough data buffered @${a} after ${r.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}};function oa$2(n,e){let t=la$2(n.main);if(t&&t.start<=e)return t;let s=la$2(n.audio);return s&&s.start<=e?s:null}function la$2(n){if(!n)return null;switch(n.state){case D$3.IDLE:case D$3.STOPPED:case D$3.ENDED:case D$3.ERROR:return null}return n.frag}function is$3(n,e){return e.getAppendedFrag(n,N$1.MAIN)||e.getPartialFragment(n)}var Bu$1=.25;function Ar$3(){if(!(typeof self>`u`))return self.VTTCue||self.TextTrackCue}function oi$3(n,e,t,s,i){let r=new n(e,t,``);try{r.value=s,i&&(r.type=i)}catch(a){r=new n(e,t,re$1(i?ee$2({type:i},s):s))}return r}var rs$3=(()=>{let n=Ar$3();try{n&&new n(0,Number.POSITIVE_INFINITY,``)}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();var Ir$3=class{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(m.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){let{hls:e}=this;
2426e&&(e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var s;this.media=t.media,((s=t.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;let t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&pt$4(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){let t=this.getID3Track(e.textTracks);return t.mode=`hidden`,t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){let s=e[t];if(s.kind===`metadata`&&s.label===`id3`)return vo$2(s,this.media),s}return this.media.addTextTrack(`metadata`,`id3`)}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;let{enableEmsgMetadataCues:s,enableID3MetadataCues:i}=this.hls.config;if(!s&&!i)return;let{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));let a=Ar$3();if(a)for(let o=0;o<r.length;o++){let c=r[o].type;if(c===Le$2.emsg&&!s||!i)continue;let l=Qa$2(r[o].data),h=r[o].pts,u=h+r[o].duration;u>rs$3&&(u=rs$3),u-h<=0&&(u=h+Bu$1);for(let f=0;f<l.length;f++){let g=l[f];if(!Za$1(g)){this.updateId3CueEnds(h,c);let p=oi$3(a,h,u,g,c);p&&this.id3Track.addCue(p)}}}}updateId3CueEnds(e,t){var s;let i=(s=this.id3Track)==null?void 0:s.cues;if(i)for(let r=i.length;r--;){let a=i[r];a.type===t&&a.startTime<e&&a.endTime===rs$3&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:s,type:i}){let{id3Track:r,hls:a}=this;if(!a)return;let{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=a;if(r&&(o||c)){let l;i===`audio`?l=h=>h.type===Le$2.audioId3&&c:i===`video`?l=h=>h.type===Le$2.emsg&&o:l=h=>h.type===Le$2.audioId3&&c||h.type===Le$2.emsg&&o,ir$3(r,t,s,l)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;let{assetPlayerId:s,timelineOffset:i,enableDateRangeMetadataCues:r,interstitialsController:a}=this.hls.config;if(!r)return;let o=Ar$3();if(s&&i&&!a){let{fragmentStart:p,fragmentEnd:y}=e,E=this.assetCue;E?(E.startTime=p,E.endTime=y):o&&(E=this.assetCue=oi$3(o,p,y,{assetPlayerId:this.hls.config.assetPlayerId},`hlsjs.interstitial.asset`),E&&(E.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(E),E.addEventListener(`enter`,this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;let{id3Track:c}=this,{dateRanges:l}=e,h=Object.keys(l),u=this.dateRangeCuesAppended;if(c&&t){var d;if((d=c.cues)!=null&&d.length){let p=Object.keys(u).filter(y=>!h.includes(y));for(let y=p.length;y--;){var f;let E=p[y],T=(f=u[E])==null?void 0:f.cues;delete u[E],T&&Object.keys(T).forEach(S=>{let v=T[S];if(v){v.removeEventListener(`enter`,this.onEventCueEnter);try{c.removeCue(v)}catch(x){}}})}}else u=this.dateRangeCuesAppended={}}let g=e.fragments[e.fragments.length-1];if(!(h.length===0||!F$1(g?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let p=0;p<h.length;p++){let y=h[p],E=l[y],T=E.startTime,S=u[y],v=S?.cues||{},x=S?.durationKnown||!1,_=rs$3,{duration:A,endDate:R}=E;if(R&&A!==null)_=T+A,x=!0;else if(E.endOnNext&&!x){let I=h.reduce((C,O)=>
vendor: 24,579 bytes, line 2426
2426{if(O!==E.id){let B=l[O];if(B.class===E.class&&B.startDate>E.startDate&&(!C||E.startDate<C.startDate))return B}return C},null);I&&(_=I.startTime,x=!0)}let b=Object.keys(E.attr);for(let I=0;I<b.length;I++){let C=b[I];if(!Kl$3(C))continue;let O=v[C];if(O)x&&!(S!=null&&S.durationKnown)?O.endTime=_:Math.abs(O.startTime-T)>.01&&(O.startTime=T,O.endTime=_);else if(o){let B=E.attr[C];Vl$3(C)&&(B=da$2(B));let U=oi$3(o,T,_,{key:C,data:B},Le$2.dateRange);U&&(U.id=y,this.id3Track.addCue(U),v[C]=U,a&&(C===`X-ASSET-LIST`||C===`X-ASSET-URL`)&&U.addEventListener(`enter`,this.onEventCueEnter))}}u[y]={cues:v,dateRange:E,durationKnown:x}}}}};var Lr$3=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{let{media:t}=this,s=this.levelDetails;if(!t||!s)return;this.currentTime=t.currentTime;let i=this.computeLatency();if(i===null)return;this._latency=i;let{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||a===1||!s.live)return;let o=this.targetLatency;if(o===null)return;let c=i-o;if(c<Math.min(this.maxLatency,o+s.targetduration)&&c>.05&&this.forwardBufferLength>1){let u=Math.min(2,Math.max(1,a)),d=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,f=Math.min(u,Math.max(1,d));this.changeMediaPlaybackRate(t,f)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){let{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;let t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){let e=this.levelDetails;if(e===null||this.hls===null)return null;let{holdBack:t,partHoldBack:s,targetduration:i}=e,{liveSyncDuration:r,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,c=this.hls.userConfig,l=o&&s||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=r!==void 0?r:a*i);let h=i;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,h)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;let s=this.levelDetails;if(s===null)return null;let i=s.edge,r=e-t-this.edgeStalled,a=i-s.totalduration,o=i-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,r),o)}get drift(){let e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){let e=this.levelDetails;if(e===null)return 0;let t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;let s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){let{hls:e}=this;e&&(e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.ERROR,this.onError,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`timeupdate`,this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener(`timeupdate`,this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener(`timeupdate`,this.onTimeupdate)}onError(e,t){var s;t.details===L$2.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn(`[latency-controller]: Stall detected, adjusting target latency`))}changeMediaPlaybackRate(e,t){var s,i;e.playbackRate!==t&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){let e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}};var Rr$3=class extends Vt$2{constructor(e,t){super(e,`level-controller`),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this),e.off(m.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let s=this.hls.config.preferManagedMediaSource,i=[],r={},a={},o=!1,c=!1,l=!1;t.levels.forEach(h=>{let u=h.attrs,{audioCodec:d,videoCodec:f}=h;d&&(h.audioCodec=d=gs$3(d,s)||void 0),f&&(f=h.videoCodec=dl$3(f));let{width:g,height:p,unknownCodecs:y}=h,E=y?.length||0;if(o||(o=!!(g&&p)),c||(c=!!f),l||(l=!!d),E||d&&!this.isAudioSupported(d)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${u.CODECS}"`);return}let{CODECS:T,"FRAME-RATE":S,"HDCP-LEVEL":v,"PATHWAY-ID":x,RESOLUTION:_,"VIDEO-RANGE":A}=u,b=`${`${x||`.`}-`}${h.bitrate}-${_}-${S}-${T}-${A}-${v}`;if(r[b])if(r[b].uri!==h.url&&!h.attrs[`PATHWAY-ID`]){let I=a[b]+=1;h.attrs[`PATHWAY-ID`]=new Array(I+1).join(`.`);let C=this.createLevel(h);r[b]=C,i.push(C)}else r[b].addGroupId(`audio`,u.AUDIO),r[b].addGroupId(`text`,u.SUBTITLES);else{let I=this.createLevel(h);r[b]=I,a[b]=1,i.push(I)}}),this.filterAndSortMediaOptions(i,t,o,c,l)}createLevel(e){let t=new at$2(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){let i=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(i.message),t.supportedResult=Aa$2(i,[])}return t}isAudioSupported(e){return Ot$4(e,`audio`,this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Ot$4(e,`video`,this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,i,r){var a;let o=[],c=[],l=e,h=((a=t.stats)==null?void 0:a.parsing)||{};if((s||i)&&r&&(l=l.filter(({videoCodec:T,videoRange:S,width:v,height:x})=>(!!T||!!(v&&x))&&xl$3(S))),l.length===0){Promise.resolve().then(()=>{if(this.hls){let T=`no level with compatible codecs found in manifest`,S=T;t.levels.length&&(S=`one or more CODECS in variant not supported: ${re$1(t.levels.map(x=>x.attrs.CODECS).filter((x,_,A)=>A.indexOf(x)===_))}`,this.warn(S),T+=` (${S})`);let v=new Error(T);this.hls.trigger(m.ERROR,{type:V$1.MEDIA_ERROR,details:L$2.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:v,reason:S})}}),h.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),ca$2(o)),t.subtitles&&(c=t.subtitles,ca$2(c));let u=l.slice(0);l.sort((T,S)=>{if(T.attrs[`HDCP-LEVEL`]!==S.attrs[`HDCP-LEVEL`])return(T.attrs[`HDCP-LEVEL`]||``)>(S.attrs[`HDCP-LEVEL`]||``)?1:-1;if(s&&T.height!==S.height)return T.height-S.height;if(T.frameRate!==S.frameRate)return T.frameRate-S.frameRate;if(T.videoRange!==S.videoRange)return ms$3.indexOf(T.videoRange)-ms$3.indexOf(S.videoRange);if(T.videoCodec!==S.videoCodec){let v=nn$2(T.videoCodec),x=nn$2(S.videoCodec);if(v!==x)return x-v}if(T.uri===S.uri&&T.codecSet!==S.codecSet){let v=fs$2(T.codecSet),x=fs$2(S.codecSet);if(v!==x)return x-v}return T.averageBitrate!==S.averageBitrate?T.averageBitrate-S.averageBitrate:0});let d=u[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==u.length)){for(let T=0;T<u.length;T++)if(u[T].pathwayId===l[0].pathwayId){d=u[T];break}}this._levels=l;for(let T=0;T<l.length;T++)if(l[T]===d){var f;this._firstLevel=T;let S=d.bitrate,v=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${S}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){let x=Math.min(S,this.hls.config.abrEwmaDefaultEstimateMax);x>v&&v===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=x)}break}let g=r&&!i,p=this.hls.config,y=!!(p.audioStreamController&&p.audioTrackController),E={levels:l,audioTracks:o,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:i,altAudio:y&&!g&&o.some(T=>!!T.url)};h.end=performance.now(),this.hls.trigger(m.MANIFEST_PARSED,E)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let h=new Error(`invalid level idx`),u=e<0;if(this.hls.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:h,reason:h.message}),u)return;e=Math.min(e,t.length-1)}let s=this.currentLevelIndex,i=this.currentLevel,r=i?i.attrs[`PATHWAY-ID`]:void 0,a=t[e],o=a.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&i&&r===o)return;this.log(`Switching to level ${e} (${a.height?a.height+`p `:``}${a.videoRange?a.videoRange+` `:``}${a.codecSet?a.codecSet+` `:``}@${a.bitrate})${o?` with Pathway `+o:``} from level ${s}${r?` with Pathway `+r:``}`);let c={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(m.LEVEL_SWITCHING,c);let l=a.details;if(!l||l.live){let h=this.switchParams(a.uri,i?.details,l);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){let e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){let t=this.steering.pathways(),s=e.filter(i=>t.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=s}}onError(e,t){t.fatal||!t.context||t.context.type===z$2.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===N$1.MAIN){let s=t.elementaryStreams;if(!Object.keys(s).some(r=>!!s[r]))return;let i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var s;let{level:i,details:r}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${i}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let c=a.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(i,t,c)}else(s=t.deliveryDirectives)!=null&&s.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let s=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,r=e.attrs[`PATHWAY-ID`],a=e.details,o=a?.age;this.log(`Loading level index ${i}${t?.msn!==void 0?` at sn `+t.msn+` part `+t.part:``}${r?` Pathway `+r:``}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${s}`),this.hls.trigger(m.LEVEL_LOADING,{url:s,level:i,levelInfo:e,pathwayId:e.attrs[`PATHWAY-ID`],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;let s=this._levels.filter((r,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));Ka$1(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);let i=s.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(m.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(m.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}};function ca$2(n){let e={};n.forEach(t=>{let s=t.groupId||``;t.id=e[s]=e[s]||0,e[s]++})}function ko$3(){return self.SourceBuffer||self.WebKitSourceBuffer}function wo$3(){if(!Xe$1())return!1;let e=ko$3();return!e||e.prototype&&typeof e.prototype.appendBuffer==`function`&&typeof e.prototype.remove==`function`}function Uu$1(){if(!wo$3())return!1;let n=Xe$1();return typeof n?.isTypeSupported==`function`&&([`avc1.42E01E,mp4a.40.2`,`av01.0.01M.08`,`vp09.00.50.08`].some(e=>n.isTypeSupported(Ft$3(e,`video`)))||[`mp4a.40.2`,`fLaC`].some(e=>n.isTypeSupported(Ft$3(e,`audio`))))}function $u$1(){var n;let e=ko$3();return typeof(e==null||(n=e.prototype)==null?void 0:n.changeType)==`function`}var Gu$1=100;var br$3=class extends Bt$3{constructor(e,t,s){super(e,t,s,`stream-controller`,N$1.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{let i=this.media,r=i?i.currentTime:null;if(r===null||!F$1(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;let a=this.getFwdBufferInfoAtPos(i,r,N$1.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${a?a.len:`empty`})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(m.BUFFER_CREATED,this.onBufferCreated,this),e.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(m.BUFFER_CREATED,this.onBufferCreated,this),e.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){let{lastCurrentTime:s,hls:i}=this;if(this.stopLoad(),this.setInterval(Gu$1),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=D$3.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=D$3.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case D$3.WAITING_LEVEL:{let{levels:e,level:t}=this,s=e?.[t],i=s?.details;if(i&&(!i.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(i))break;this.state=D$3.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=D$3.IDLE;break}break}case D$3.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===D$3.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:s,media:i}=this;if(t===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[r]))return;let a=s[r],o=this.getMainFwdBufferInfo();if(o===null)return;let c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){let p={};this.altAudio===2&&(p.type=`video`),this.hls.trigger(m.BUFFER_EOS,p),this.state=D$3.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;let l=a.details;if(!l||this.state===D$3.WAITING_LEVEL||this.waitForLive(a)){this.level=r,this.state=D$3.WAITING_LEVEL,this.startFragRequested=!1;return}let h=o.len,u=this.getMaxBufferLength(a.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let d=this.backtrackFragment?this.backtrackFragment.start:o.end,f=this.getNextFragment(d,l);if(this.couldBacktrack&&!this.fragPrevious&&f&&le$4(f)&&this.fragmentTracker.getState(f)!==he$2.OK){var g;let y=((g=this.backtrackFragment)!=null?g:f).sn-l.startSN,E=l.fragments[y-1];E&&f.cc===E.cc&&(f=E,this.fragmentTracker.removeFragment(E))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,d)){if(!f.gap){let y=this.audioOnly&&!this.altAudio?ie$2.AUDIO:ie$2.VIDEO,E=(y===ie$2.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;E&&this.afterBufferFlushed(E,y,N$1.MAIN)}f=this.getNextFragmentLoopLoading(f,l,o,N$1.MAIN,u)}f&&(this.exceedsMaxBuffer(o,u,f)||(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,d)))}loadFragment(e,t,s){let i=this.fragmentTracker.getState(e);i===he$2.NOT_LOADED||i===he$2.PARTIAL?le$4(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,s):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,N$1.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==0){var e;(((e=this.getLevelDetails())==null?void 0:e.fragmentStart)||0)>this.lastCurrentTime&&super.flushMainBuffer(0,Number.POSITIVE_INFINITY,`audio`)}}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let s,i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);let r=this.getLevelDetails();if(r!=null&&r.live){let o=this.getMainFwdBufferInfo();if(!o||o.len<r.targetduration*2)return}if(!t.paused&&e){let c=e[this.hls.nextLoadLevel],l=this.fragLastKbps;l&&this.fragCurrent?s=this.fragCurrent.duration*c.maxBitrate/(1e3*l)+1:s=0}else s=0;let a=this.getBufferedFrag(t.currentTime+s);if(a){let o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();let c=o.maxStartPTS?o.maxStartPTS:o.start,l=o.duration,h=Math.max(a.end,c+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case D$3.KEY_LOADING:case D$3.FRAG_LOADING:case D$3.FRAG_LOADING_WAITING_RETRY:case D$3.PARSING:case D$3.PARSED:this.state=D$3.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?`video`:null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let s=t.media;Te$3(s,`playing`,this.onMediaPlaying),Te$3(s,`seeked`,this.onMediaSeeked)}onMediaDetaching(e,t){let{media:s}=this;s&&(ve$3(s,`playing`,this.onMediaPlaying),ve$3(s,`seeked`,this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log(`Trigger BUFFER_RESET`),this.hls.trigger(m.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let s=!1,i=!1;for(let r=0;r<t.levels.length;r++){let a=t.levels[r].audioCodec;a&&(s=s||a.indexOf(`mp4a.40.2`)!==-1,i=i||a.indexOf(`mp4a.40.5`)!==-1)}this.audioCodecSwitch=s&&i&&!$u$1(),this.audioCodecSwitch&&this.log(`Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC`),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){let{levels:s}=this;if(!s||this.state!==D$3.IDLE)return;let i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=D$3.WAITING_LEVEL)}onLevelLoaded(e,t){var s;let{levels:i,startFragRequested:r}=this,a=t.level,o=t.details,c=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:``}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);let l=t.levelInfo,h=this.fragCurrent;h&&(this.state===D$3.FRAG_LOADING||this.state===D$3.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let u=0;if(o.live||(s=l.details)!=null&&s.live){var d;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;u=this.alignPlaylists(o,l.details,(d=this.levelLastLoaded)==null?void 0:d.details)}if(l.details=o,this.levelLastLoaded=l,r||this.setStartPosition(o,u),this.hls.trigger(m.LEVEL_UPDATED,{details:o,level:a}),this.state===D$3.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=D$3.IDLE}r&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}
vendor: 6,483 bytes, line 2426
2426synchronizeToLiveEdge(e){let{config:t,media:s}=this;if(!s)return;let i=this.hls.liveSyncPosition,r=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,c=r>=a-t.maxFragLookUpTolerance&&r<=o;if(i!==null&&s.duration>i&&(r<i||!c)){let h=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&s.readyState<4||r<o-h)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),s.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${i.toFixed(3)}`),this.config.liveSyncMode===`buffered`){var l;let u=W$2.bufferInfo(s,i,0);if(!((l=u.buffered)!=null&&l.length)){s.currentTime=i;return}if(u.start<=r){s.currentTime=i;return}let{nextStart:f}=W$2.bufferedInfo(u.buffered,r,0);f&&(s.currentTime=f)}else s.currentTime=i}}_handleFragmentLoadProgress(e){var t;let s=e.frag,{part:i,payload:r}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}let o=a[s.level];if(!o){this.warn(`Level ${s.level} not found on progress`);return}let c=o.details;if(!c){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}let l=o.videoCodec,h=c.PTSKnown||!c.live,u=(t=s.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new Ds$2(this.hls,N$1.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=i?i.index:-1,p=g!==-1,y=new Nt$3(s.level,s.sn,s.stats.chunkCount,r.byteLength,g,p),E=this.initPTS[s.cc];f.push(r,u,d,l,s,i,c.totalduration,h,y,E)}onAudioTrackSwitching(e,t){let s=this.hls,i=this.altAudio!==0;if(ys$3(t.url,s))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log(`Switching on main audio, use media.buffered to schedule main fragment loading`),this.mediaBuffer=this.media;let a=this.fragCurrent;a&&(this.log(`Switching to main audio track, cancel main fragment load`),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(i){this.altAudio=0,this.fragmentTracker.removeAllFragments(),s.once(m.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(m.AUDIO_TRACK_SWITCHED,t)}),s.trigger(m.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(m.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let s=ys$3(t.url,this.hls);if(s){let i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log(`Switching on alternate audio, use video.buffered to schedule main fragment loading`),this.mediaBuffer=i)}this.altAudio=s?2:0,this.tick()}onBufferCreated(e,t){let s=t.tracks,i,r,a=!1;for(let o in s){let c=s[o];if(c.id===`main`){if(r=o,i=c,o===`video`){let l=s[o];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&i?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:s,part:i}=t,r=s.type===N$1.MAIN;if(r){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?` p: `+i.index:``} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===D$3.PARSED&&(this.state=D$3.IDLE);return}let o=i?i.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),le$4(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,i)}let a=this.media;a&&(!this._hasEnoughToStart&&W$2.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=D$3.ERROR;return}switch(t.details){case L$2.FRAG_GAP:case L$2.FRAG_PARSING_ERROR:case L$2.FRAG_DECRYPT_ERROR:case L$2.FRAG_LOAD_ERROR:case L$2.FRAG_LOAD_TIMEOUT:case L$2.KEY_LOAD_ERROR:case L$2.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(N$1.MAIN,t);break;case L$2.LEVEL_LOAD_ERROR:case L$2.LEVEL_LOAD_TIMEOUT:case L$2.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===D$3.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===z$2.LEVEL&&(this.state=D$3.IDLE);break;case L$2.BUFFER_ADD_CODEC_ERROR:case L$2.BUFFER_APPEND_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case L$2.BUFFER_FULL_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case L$2.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=D$3.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ie$2.AUDIO||!this.altAudio){let s=(t===ie$2.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,N$1.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,s=this.startPosition;if(s>=0&&t<s){if(e.seeking){this.log(`could not seek to ${s}, already seeking at ${t}`);return}let i=this.timelineOffset;i&&s&&(s+=i);let r=this.getLevelDetails(),a=W$2.getBuffered(e),o=a.length?a.start(0):0,c=o-s,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<l||this.loadingParts&&c<2*(r?.partTarget||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),s+=c,this.startPosition=s),t<s&&(this.log(`seek to target start position ${s} from current time ${t} buffer start ${o}`),e.currentTime=s)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log(`Swapping audio codec`),t.indexOf(`mp4a.40.5`)!==-1?t=`mp4a.40.2`:t=`mp4a.40.5`),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(s=>{let{hls:i}=this,r=s?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=D$3.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(m.FRAG_LOADED,s),r.bitrateTest=!1}
2426).catch(s=>{this.state===D$3.STOPPED||this.state===D$3.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){let t=this.playlistType,{hls:s}=this,{remuxResult:i,chunkMeta:r}=e,a=this.getCurrentContext(r);if(!a){this.resetWhenMissingContext(r);return}let{frag:o,part:c,level:l}=a,{video:h,text:u,id3:d,initSegment:f}=i,{details:g}=l,p=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=D$3.PARSING,f){let y=f.tracks;if(y){let v=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(l,y,v,r),s.trigger(m.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:t,tracks:y})}let E=f.initPTS,T=f.timescale,S=this.initPTS[o.cc];if(F$1(E)&&(!S||S.baseTime!==E||S.timescale!==T)){let v=f.trackId;this.initPTS[o.cc]={baseTime:E,timescale:T,trackId:v},s.trigger(m.INIT_PTS_FOUND,{frag:o,id:t,initPTS:E,timescale:T,trackId:v})}}if(h&&g){p&&h.type===`audiovideo`&&this.logMuxedErr(o);let y=g.fragments[o.sn-1-g.startSN],E=o.sn===g.startSN,T=!y||o.cc>y.cc;if(i.independent!==!1){let{startPTS:S,endPTS:v,startDTS:x,endDTS:_}=h;if(c)c.elementaryStreams[h.type]={startPTS:S,endPTS:v,startDTS:x,endDTS:_};else if(h.firstKeyFrame&&h.independent&&r.id===1&&!T&&(this.couldBacktrack=!0),h.dropped&&h.independent){let A=this.getMainFwdBufferInfo(),R=(A?A.end:this.getLoadPosition())+this.config.maxBufferHole,b=h.firstKeyFramePTS?h.firstKeyFramePTS:S;if(!E&&R<b-this.config.maxBufferHole&&!T){this.backtrack(o);return}else T&&(o.gap=!0);o.setElementaryStreamInfo(h.type,o.start,v,o.start,_,!0)}else E&&S-(g.appliedTimelineOffset||0)>us$3&&(o.gap=!0);o.setElementaryStreamInfo(h.type,S,v,x,_),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,c,r,E||T)}else if(E||T)o.gap=!0;else{this.backtrack(o);return}}if(p){let{startPTS:y,endPTS:E,startDTS:T,endDTS:S}=p;c&&(c.elementaryStreams[ie$2.AUDIO]={startPTS:y,endPTS:E,startDTS:T,endDTS:S}),o.setElementaryStreamInfo(ie$2.AUDIO,y,E,T,S),this.bufferFragmentData(p,o,c,r)}if(g&&d!=null&&d.samples.length){let y={id:t,frag:o,details:g,samples:d.samples};s.trigger(m.FRAG_PARSING_METADATA,y)}if(g&&u){let y={id:t,frag:o,details:g,samples:u.samples};s.trigger(m.FRAG_PARSING_USERDATA,y)}}logMuxedErr(e){this.warn(`${le$4(e)?`Media`:`Init`} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,i){if(this.state!==D$3.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));let{audio:r,video:a,audiovideo:o}=t;if(r){let l=e.audioCodec,h=ns$3(r.codec,l);h===`mp4a`&&(h=`mp4a.40.5`);let u=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){h&&(h.indexOf(`mp4a.40.5`)!==-1?h=`mp4a.40.2`:h=`mp4a.40.5`);let d=r.metadata;d&&`channelCount`in d&&(d.channelCount||1)!==1&&u.indexOf(`firefox`)===-1&&(h=`mp4a.40.5`)}h&&h.indexOf(`mp4a.40.5`)!==-1&&u.indexOf(`android`)!==-1&&r.container!==`audio/mpeg`&&(h=`mp4a.40.2`,this.log(`Android: force audio codec to ${h}`)),l&&l!==h&&this.log(`Swapping manifest audio codec "${l}" for "${h}"`),r.levelCodec=h,r.id=N$1.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${h||``}/${l||``}/${r.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=N$1.MAIN;let l=a.codec;if(l?.length===4)switch(l){case`hvc1`:case`hev1`:a.codec=`hvc1.1.6.L120.90`;break;case`av01`:a.codec=`av01.0.04M.08`;break;case`avc1`:a.codec=`avc1.42e01e`;break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||``}/${l}]${a.codec!==l?` parsed-corrected=`+a.codec:``}${a.supplemental?` supplemental=`+a.supplemental:``}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);let c=Object.keys(t);if(c.length){if(this.hls.trigger(m.BUFFER_CODECS,t),!this.hls)return;c.forEach(l=>{let u=t[l].initSegment;u!=null&&u.byteLength&&this.hls.trigger(m.BUFFER_APPENDING,{type:l,data:u,frag:s,part:null,chunkMeta:i,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){let e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,N$1.MAIN)}get maxBufferLength(){let{levels:e,level:t}=this,s=e?.[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=D$3.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let s=e.currentTime;if(W$2.isBuffered(e,s)?t=this.getAppendedFrag(s):W$2.isBuffered(e,s+.1)&&
vendor: 4,486 bytes, line 2426
2426(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;let i=this.fragPlaying,r=t.level;(!i||t.sn!==i.sn||i.level!==r)&&(this.fragPlaying=t,this.hls.trigger(m.FRAG_CHANGED,{frag:t}),(!i||i.level!==r)&&this.hls.trigger(m.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;let t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return F$1(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;let t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(F$1(t)){let s=this.getLevelDetails(),i=this.currentFrag||(s?ot$3(null,s.fragments,t):null);if(i){let r=i.programDateTime;if(r!==null){let a=r+(t-i.start)*1e3;return new Date(a)}}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}};var _r$3=class extends xe$2{constructor(e,t){super(`key-loader`,t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let s in this.keyIdToKeyInfo){let i=this.keyIdToKeyInfo[s].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=L$2.KEY_LOAD_ERROR,s,i,r){return new we$2({type:V$1.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:s,networkDetails:i})}loadClear(e,t,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,r=t.length;i<r;i++){let a=t[i];if(e.cc<=a.cc&&(!le$4(e)||!le$4(a)||e.sn<a.sn)||!s&&i==r-1)return this.emeController.selectKeySystemFormat(a).then(o=>{if(!this.emeController)return;a.setKeyFormat(o);let c=os$3(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){let i=_t$5(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,i;t&&e.setKeyFormat(t);let r=e.decryptdata;if(!r){let l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,L$2.KEY_LOAD_ERROR,l))}let a=r.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,L$2.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=li$3(r),c=this.keyIdToKeyInfo[o];if((s=c)!=null&&s.decryptdata.key)return r.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(i=c)!=null&&i.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case`usable`:case`usable-in-future`:return c.keyLoadPromise.then(h=>{let{keyInfo:u}=h;return r.key=u.decryptdata.key,{frag:e,keyInfo:u}})}switch(this.log(`${this.keyIdToKeyInfo[o]?`Rel`:`L`}oading${r.keyId?` keyId: `+ge$2(r.keyId):``} URI: ${r.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return r.keyFormat===`identity`?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case`AES-128`:case`AES-256`:case`AES-256-CTR`:return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,L$2.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){let s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i;if(!e.decryptdata.keyId&&(i=t.initSegment)!=null&&i.data){let a=el$3(t.initSegment.data);if(a.length){let o=a[0];o.some(c=>c!==0)?(this.log(`Using keyId found in init segment ${ge$2(o)}`),At$2.setKeyIdForUri(e.decryptdata.uri,o)):(o=At$2.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${ge$2(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!le$4(t))return Promise.resolve(s);
vendor: 5,713 bytes, line 2426
2426return(e.keyLoadPromise=this.emeController.loadKey(s).then(a=>(e.mediaKeySessionContext=a,s))).catch(a=>{throw e.keyLoadPromise=null,`data`in a&&(a.data.frag=t),a})}return Promise.resolve(s)}loadKeyHTTP(e,t){let s=this.config,i=s.loader,r=new i(s);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((a,o)=>{let c={keyInfo:e,frag:t,responseType:`arraybuffer`,url:e.decryptdata.uri},l=s.keyLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(c,h,{onSuccess:(d,f,g,p)=>{let{frag:y,keyInfo:E}=g,T=li$3(E.decryptdata);if(!y.decryptdata||E!==this.keyIdToKeyInfo[T])return o(this.createKeyLoadError(y,L$2.KEY_LOAD_ERROR,new Error(`after key load, decryptdata unset or changed`),p));E.decryptdata.key=y.decryptdata.key=new Uint8Array(d.data),y.keyLoader=null,E.loader=null,a({frag:y,keyInfo:E})},onError:(d,f,g,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,L$2.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),g,ee$2({url:c.url,data:void 0},d)))},onTimeout:(d,f,g)=>{this.resetLoader(f),o(this.createKeyLoadError(t,L$2.KEY_LOAD_TIMEOUT,new Error(`key loading timed out`),g))},onAbort:(d,f,g)=>{this.resetLoader(f),o(this.createKeyLoadError(t,L$2.INTERNAL_ABORTED,new Error(`key loading aborted`),g))}})})}resetLoader(e){let{frag:t,keyInfo:s,url:i}=e,r=s.loader;t.keyLoader===r&&(t.keyLoader=null,s.loader=null);let a=li$3(s.decryptdata)||i;delete this.keyIdToKeyInfo[a],r&&r.destroy()}};function li$3(n){if(n.keyFormat!==me$2.FAIRPLAY){let e=n.keyId;if(e)return ge$2(e)}return n.uri}function ha$2(n){let{type:e}=n;switch(e){case z$2.AUDIO_TRACK:return N$1.AUDIO;case z$2.SUBTITLE_TRACK:return N$1.SUBTITLE;default:return N$1.MAIN}}function ci$2(n,e){let t=n.url;return(t===void 0||t.indexOf(`data:`)===0)&&(t=e.url),t}var Dr$3=class{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){let{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(m.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){let{hls:e}=this;e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_LOADING,this.onLevelLoading,this),e.off(m.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(m.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){let t=this.hls.config,s=t.pLoader,i=t.loader,a=new(s||i)(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:`text`,type:z$2.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){let{id:s,level:i,pathwayId:r,url:a,deliveryDirectives:o,levelInfo:c}=t;this.load({id:s,level:i,pathwayId:r,responseType:`text`,type:z$2.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){let{id:s,groupId:i,url:r,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:i,level:null,responseType:`text`,type:z$2.AUDIO_TRACK,url:r,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){let{id:s,groupId:i,url:r,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:i,level:null,responseType:`text`,type:z$2.SUBTITLE_TRACK,url:r,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){let s=this.loaders[z$2.LEVEL];if(s){let i=s.context;i&&!t.levels.some(r=>r===i.levelOrTrack)&&(s.abort(),delete this.loaders[z$2.LEVEL])}}load(e){var t;let s=this.hls.config,i=this.getInternalLoader(e);if(i){let l=this.hls.logger,h=i.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?l.log(`[playlist-loader]: ignore ${e.url} ongoing request`):l.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}l.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let r;if(e.type===z$2.MANIFEST?r=s.manifestLoadPolicy.default:r=se$3({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),F$1((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===z$2.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===z$2.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===z$2.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){let h=l.partTarget,u=l.targetduration;if(h&&u){let d=Math.max(h*3,u*.8)*1e3;r=se$3({},r,{maxTimeToFirstByteMs:Math.min(d,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,r.maxTimeToFirstByteMs)})}}}let a=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0};i.load(e,o,{onSuccess:(l,h,u,d)=>{let f=this.getInternalLoader(u);this.resetInternalLoader(u.type);let g=l.data;h.parsing.start=performance.now(),it$1.isMediaPlaylist(g)||u.type!==z$2.MANIFEST?this.handleTrackOrLevelPlaylist(l,h,u,d||null,f):this.handleMasterPlaylist(l,h,u,d)},onError:(l,h,u,d)=>{this.handleNetworkError(h,u,!1,l,d)},onTimeout:(l,h,u)=>{this.handleNetworkError(h,u,!0,void 0,l)}})}
vendor: 7,957 bytes, line 2426
2426checkAutostartLoad(){if(!this.hls)return;let{config:{autoStartLoad:e,startPosition:t},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?`auto`:`force`} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,s,i){let r=this.hls,a=e.data,o=ci$2(e,s),c=it$1.parseMasterPlaylist(a,o);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,s,c.playlistParsingError,i,t);return}let{contentSteering:l,levels:h,sessionData:u,sessionKeys:d,startTimeOffset:f,variableList:g}=c;this.variableList=g,h.forEach(T=>{let{unknownCodecs:S}=T;if(S){let{preferManagedMediaSource:v}=this.hls.config,{audioCodec:x,videoCodec:_}=T;for(let A=S.length;A--;){let R=S[A];Ot$4(R,`audio`,v)?(T.audioCodec=x=x?`${x},${R}`:R,xt$2.audio[x.substring(0,4)]=2,S.splice(A,1)):Ot$4(R,`video`,v)&&(T.videoCodec=_=_?`${_},${R}`:R,xt$2.video[_.substring(0,4)]=2,S.splice(A,1))}}});let{AUDIO:p=[],SUBTITLES:y,"CLOSED-CAPTIONS":E}=it$1.parseMasterPlaylistMedia(a,o,c);p.length&&!p.some(S=>!S.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(this.hls.logger.log(`[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one`),p.unshift({type:`main`,name:`main`,groupId:`main`,default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ne$2({}),bitrate:0,url:``})),r.trigger(m.MANIFEST_LOADED,{levels:h,audioTracks:p,subtitles:y,captions:E,contentSteering:l,url:o,stats:t,networkDetails:i,sessionData:u,sessionKeys:d,startTimeOffset:f,variableList:g})}handleTrackOrLevelPlaylist(e,t,s,i,r){let a=this.hls,{id:o,level:c,type:l}=s,h=ci$2(e,s),u=F$1(c)?c:F$1(o)?o:0,d=ha$2(s),f=it$1.parseLevelPlaylist(e.data,h,u,d,0,this.variableList);if(l===z$2.MANIFEST){let g={attrs:new ne$2({}),bitrate:0,details:f,name:``,url:h};f.requestScheduled=t.loading.start+Ua$2(f,0),a.trigger(m.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=f,this.handlePlaylistLoaded(f,e,t,s,i,r)}handleManifestParsingError(e,t,s,i,r){this.hls.trigger(m.ERROR,{type:V$1.NETWORK_ERROR,details:L$2.MANIFEST_PARSING_ERROR,fatal:t.type===z$2.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:i,stats:r})}handleNetworkError(e,t,s=!1,i,r){let a=`A network ${s?`timeout`:`error`+(i?` (status `+i.code+`)`:``)} occurred while loading ${e.type}`;e.type===z$2.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===z$2.AUDIO_TRACK||e.type===z$2.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);let o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let c=L$2.UNKNOWN,l=!1,h=this.getInternalLoader(e);switch(e.type){case z$2.MANIFEST:c=s?L$2.MANIFEST_LOAD_TIMEOUT:L$2.MANIFEST_LOAD_ERROR,l=!0;break;case z$2.LEVEL:c=s?L$2.LEVEL_LOAD_TIMEOUT:L$2.LEVEL_LOAD_ERROR,l=!1;break;case z$2.AUDIO_TRACK:c=s?L$2.AUDIO_TRACK_LOAD_TIMEOUT:L$2.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case z$2.SUBTITLE_TRACK:c=s?L$2.SUBTITLE_TRACK_LOAD_TIMEOUT:L$2.SUBTITLE_LOAD_ERROR,l=!1;break}h&&this.resetInternalLoader(e.type);let u={type:V$1.NETWORK_ERROR,details:c,fatal:l,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:r};if(i)u.response=ee$2({url:t?.url||e.url,data:void 0},i);this.hls.trigger(m.ERROR,u)}handlePlaylistLoaded(e,t,s,i,r,a){let o=this.hls,{type:c,level:l,levelOrTrack:h,id:u,groupId:d,deliveryDirectives:f}=i,g=ci$2(t,i),p=ha$2(i),y=typeof i.level==`number`&&p===N$1.MAIN?l:void 0,E=e.playlistParsingError;if(E){if(this.hls.logger.warn(`${E} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(m.ERROR,{type:V$1.NETWORK_ERROR,details:L$2.LEVEL_PARSING_ERROR,fatal:!1,url:g,error:E,reason:E.message,response:t,context:i,level:y,parent:p,networkDetails:r,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){let T=e.playlistParsingError=new Error(`No Segments found in Playlist`);o.trigger(m.ERROR,{type:V$1.NETWORK_ERROR,details:L$2.LEVEL_EMPTY_ERROR,fatal:!1,url:g,error:T,reason:T.message,response:t,context:i,level:y,parent:p,networkDetails:r,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case z$2.MANIFEST:case z$2.LEVEL:if(y){if(!h)y=0;else if(h!==o.levels[y]){let T=o.levels.indexOf(h);T>-1&&(y=T)}}o.trigger(m.LEVEL_LOADED,{details:e,levelInfo:h||o.levels[0],level:y||0,id:u||0,stats:s,networkDetails:r,deliveryDirectives:f,withoutMultiVariant:c===z$2.MANIFEST});break;case z$2.AUDIO_TRACK:o.trigger(m.AUDIO_TRACK_LOADED,{details:e,track:h,id:u||0,groupId:d||``,stats:s,networkDetails:r,deliveryDirectives:f});break;case z$2.SUBTITLE_TRACK:o.trigger(m.SUBTITLE_TRACK_LOADED,{details:e,track:h,id:u||0,groupId:d||``,stats:s,networkDetails:r,deliveryDirectives:f});break}}};var Yu$1=(()=>{class n{static get version(){return Ut$4}static isMSESupported(){return wo$3()}static isSupported(){return Uu$1()}static getMediaSource(){return Xe$1()}static get Events(){return m}static get MetadataSchema(){return Le$2}static get ErrorTypes(){return V$1}static get ErrorDetails(){return L$2}static get DefaultConfig(){return n.defaultConfig?n.defaultConfig:Pu$1}static set DefaultConfig(t){n.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Nr$3,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;let s=this.logger=Vo$3(t.debug||!1,`Hls instance`,t.assetPlayerId),i=this.config=wu$1(n.DefaultConfig,t,s);this.userConfig=t,i.progressive&&Ou$1(i,s);let{abrController:r,bufferController:a,capLevelController:o,errorController:c,fpsController:l}=i,h=new c(this),u=this.abrController=new r(this),d=new Ti$1(this),f=i.interstitialsController,g=f?this.interstitialsController=new f(this,n):null,p=this.bufferController=new a(this,d),y=this.capLevelController=new o(this),E=new l(this),T=new Dr$3(this),S=i.contentSteeringController,v=S?new S(this):null,x=this.levelController=new Rr$3(this,v),_=new Ir$3(this),A=new _r$3(this.config,this.logger),R=this.streamController=new br$3(this,d,A),b=this.gapController=new xr$3(this,d);y.setStreamController(R),E.setStreamController(R);let I=[T,x,R];g&&I.splice(1,0,g),v&&I.splice(1,0,v),this.networkControllers=I;let C=[u,p,b,y,E,_,d];this.audioTrackController=this.createController(i.audioTrackController,I);let O=i.audioStreamController;O&&I.push(this.audioStreamController=new O(this,d,A)),this.subtitleTrackController=this.createController(i.subtitleTrackController,I);let B=i.subtitleStreamController;B&&I.push(this.subtititleStreamController=new B(this,d,A)),this.createController(i.timelineController,C),A.emeController=this.emeController=this.createController(i.emeController,C),this.cmcdController=this.createController(i.cmcdController,C),this.latencyController=this.createController(Lr$3,C),this.coreComponents=C,I.push(h);let G=h.onErrorOut;typeof G==`function`&&this.on(m.ERROR,G,h),this.on(m.MANIFEST_LOADED,T.onManifestLoaded,T)}createController(t,s){if(t){let i=new t(this);return s&&s.push(i),i}return null}on(t,s,i=this){this._emitter.on(t,s,i)}once(t,s,i=this){this._emitter.once(t,s,i)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,s,i=this,r){this._emitter.off(t,s,i,r)}listeners(t){return this._emitter.listeners(t)}emit(t,s,i){return this._emitter.emit(t,s,i)}
vendor: 3,495 bytes, line 2426
2426trigger(t,s){if(this.config.debug)return this.emit(t,t,s);try{return this.emit(t,t,s)}catch(i){if(this.logger.error(`An internal error happened while handling event `+t+`. Error message: "`+i.message+`". Here is a stacktrace:`,i),!this.triggeringException){this.triggeringException=!0;let r=t===m.ERROR;this.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.INTERNAL_EXCEPTION,fatal:r,event:t,error:i}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){this.logger.log(`destroy`),this.trigger(m.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(s=>s.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(s=>s.destroy()),this.coreComponents.length=0;let t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){if(!t||`media`in t&&!t.media){let a=new Error(`attachMedia failed: invalid argument (${t})`);this.trigger(m.ERROR,{type:V$1.OTHER_ERROR,details:L$2.ATTACH_MEDIA_ERROR,fatal:!0,error:a});return}this.logger.log(`attachMedia`),this._media&&(this.logger.warn(`media must be detached before attaching`),this.detachMedia());let s=`media`in t,i=s?t.media:t,r=s?t:{media:i};this._media=i,this.trigger(m.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log(`detachMedia`),this.trigger(m.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;let t=this.bufferController.transferMedia();return this.trigger(m.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();let s=this.media,i=this._url,r=this._url=Cr$3.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),s&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(s)),this.trigger(m.MANIFEST_LOADING,{url:t})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(t=-1,s){this.logger.log(`startLoad(${t+(s?`, <skip seek to start>`:``)})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(t,s),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log(`stopLoad`),this.started=!1;for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!(this.started||!this.networkControllers));t++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log(`resume buffering`),this.networkControllers.forEach(t=>{t.resumeBuffering&&t.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log(`pause buffering`),this.networkControllers.forEach(t=>{t.pauseBuffering&&t.pauseBuffering()}))}get inFlightFragments(){let t={[N$1.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(t[N$1.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[N$1.SUBTITLE]=this.subtititleStreamController.inFlightFrag),t}swapAudioCodec(){this.logger.log(`swapAudioCodec`),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log(`recoverMediaError`);let t=this._media,s=t?.currentTime;this.detachMedia(),t&&(this.attachMedia(t),s&&this.startLoad(s))}removeLevel(t){this.levelController.removeLevel(t)}
2426get sessionId(){let t=this._sessionId;return t||(t=this._sessionId=Jh$1()),t}get levels(){return this.levelController.levels||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){this.logger.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){this.logger.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){this.logger.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){this.logger.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){let t=this.levelController.startLevel;return t===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){this.logger.log(`set startLevel:${t}`),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){let s=!!t;s!==this.config.capLevelToPlayerSize&&(s?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=s)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get abrEwmaDefaultEstimate(){let{bwEstimator:t}=this.abrController;return t?t.defaultEstimate:NaN}get ttfbEstimate(){let{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(this.logger.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){vl$3(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:t,config:{minAutoBitrate:s}}=this;if(!t)return 0;let i=t.length;for(let r=0;r<i;r++)if(t[r].maxBitrate>=s)return r;return 0}get maxAutoLevel(){let{levels:t,autoLevelCapping:s,maxHdcpLevel:i}=this,r;if(s===-1&&t!=null&&t.length?r=t.length-1:r=s,i)for(let a=r;a--;){let o=t[a].attrs[`HDCP-LEVEL`];if(o&&o<=i)return a}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(t){var s;return((s=this.audioTrackController)==null?void 0:s.setAudioOption(t))||null}setSubtitleOption(t){var s;return((s=this.subtitleTrackController)==null?void 0:s.setSubtitleOption(t))||null}get allAudioTracks(){let t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){let t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){let t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){let s=this.audioTrackController;s&&(s.audioTrack=t)}get allSubtitleTracks(){let t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){let t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){let t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){let s=this.subtitleTrackController;s&&(s.subtitleTrack=t)}get subtitleDisplay(){let t=this.subtitleTrackController;return t?t.subtitleDisplay:!1}set subtitleDisplay(t){let s=this.subtitleTrackController;s&&(s.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(t){this.latencyController.targetLatency=t}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(t){this.levelController.pathwayPriority=t}get bufferedToEnd(){var t;return!!((t=this.bufferController)!=null&&t.bufferedToEnd)}get interstitialsManager(){var t;return((t=this.interstitialsController)==null?void 0:t.interstitialsManager)||null}getMediaDecodingInfo(t,s=this.allAudioTracks){return Ia$2(t,Ra$2(s),navigator.mediaCapabilities)}}return n.defaultConfig=void 0,n})();function ut$2(t,a){}var f$1=class{viewContainerRef;injector;id;role=`dialog`;panelClass=``;hasBackdrop=!0;backdropClass=``;disableClose=!1;closePredicate;width=``;height=``;minWidth;minHeight;maxWidth;maxHeight;position;data=null;direction;ariaDescribedBy=null;ariaLabelledBy=null;ariaLabel=null;ariaModal=!1;
vendor: 9,117 bytes, lines 2426-2598
2426autoFocus=`first-tabbable`;restoreFocus=!0;delayFocusTrap=!0;scrollStrategy;closeOnNavigation=!0;enterAnimationDuration;exitAnimationDuration;bindings};var w$1=`mdc-dialog--open`;var ot$2=`mdc-dialog--opening`;var st$3=`mdc-dialog--closing`;var pt$3=150;var ft$4=75;var _t$4=(()=>{class t extends le$5{_animationStateChanged=new Qe$1;_animationsEnabled=!nt$5();_actionSectionCount=0;_hostElement=this._elementRef.nativeElement;_enterAnimationDuration=this._animationsEnabled?lt$2(this._config.enterAnimationDuration)??pt$3:0;_exitAnimationDuration=this._animationsEnabled?lt$2(this._config.exitAnimationDuration)??ft$4:0;_animationTimer=null;_contentAttached(){super._contentAttached(),this._startOpenAnimation()}_startOpenAnimation(){this._animationStateChanged.emit({state:`opening`,totalTime:this._enterAnimationDuration}),this._animationsEnabled?(this._hostElement.style.setProperty(rt$2,`${this._enterAnimationDuration}ms`),this._requestAnimationFrame(()=>this._hostElement.classList.add(ot$2,w$1)),this._waitForAnimationToComplete(this._enterAnimationDuration,this._finishDialogOpen)):(this._hostElement.classList.add(w$1),Promise.resolve().then(()=>this._finishDialogOpen()))}_startExitAnimation(){this._animationStateChanged.emit({state:`closing`,totalTime:this._exitAnimationDuration}),this._hostElement.classList.remove(w$1),this._animationsEnabled?(this._hostElement.style.setProperty(rt$2,`${this._exitAnimationDuration}ms`),this._requestAnimationFrame(()=>this._hostElement.classList.add(st$3)),this._waitForAnimationToComplete(this._exitAnimationDuration,this._finishDialogClose)):Promise.resolve().then(()=>this._finishDialogClose())}_updateActionSectionCount(e){this._actionSectionCount+=e,this._changeDetectorRef.markForCheck()}_finishDialogOpen=()=>{this._clearAnimationClasses(),this._openAnimationDone(this._enterAnimationDuration)};_finishDialogClose=()=>{this._clearAnimationClasses(),this._animationStateChanged.emit({state:`closed`,totalTime:this._exitAnimationDuration})};_clearAnimationClasses(){this._hostElement.classList.remove(ot$2,st$3)}_waitForAnimationToComplete(e,i){this._animationTimer!==null&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(i,e)}_requestAnimationFrame(e){this._ngZone.runOutsideAngular(()=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()})}_captureInitialFocus(){this._config.delayFocusTrap||this._trapFocus()}_openAnimationDone(e){this._config.delayFocusTrap&&this._trapFocus(),this._animationStateChanged.next({state:`opened`,totalTime:e})}ngOnDestroy(){super.ngOnDestroy(),this._animationTimer!==null&&clearTimeout(this._animationTimer)}attachComponentPortal(e){let i=super.attachComponentPortal(e);return i.location.nativeElement.classList.add(`mat-mdc-dialog-component-host`),i}static ɵfac=(()=>{let e;return function(n){return(e||(e=lv(t)))(n||t)}})();static ɵcmp=PD({type:t,selectors:[[`mat-dialog-container`]],hostAttrs:[`tabindex`,`-1`,1,`mat-mdc-dialog-container`,`mdc-dialog`],hostVars:10,hostBindings:function(i,n){i&2&&(Lh$3(`id`,n._config.id),xh$2(`aria-modal`,n._config.ariaModal)(`role`,n._config.role)(`aria-labelledby`,n._config.ariaLabel?null:n._ariaLabelledByQueue[0])(`aria-label`,n._config.ariaLabel)(`aria-describedby`,n._config.ariaDescribedBy||null),Yh$3(`_mat-animation-noopable`,!n._animationsEnabled)(`mat-mdc-dialog-container-with-actions`,n._actionSectionCount>0))},features:[wh$3],decls:3,vars:0,consts:[[1,`mat-mdc-dialog-inner-container`,`mdc-dialog__container`],[1,`mat-mdc-dialog-surface`,`mdc-dialog__surface`],[`cdkPortalOutlet`,``]],template:function(i,n){i&1&&(Bi$3(0,`div`,0)(1,`div`,1),Th$2(2,ut$2,0,0,`ng-template`,2),vl$4()())},dependencies:[vi$4],styles:[`.mat-mdc-dialog-container { 2427 width: 100%; 2428 height: 100%; 2429 display: block; 2430 box-sizing: border-box; 2431 max-height: inherit; 2432 min-height: inherit; 2433 min-width: inherit; 2434 max-width: inherit; 2435 outline: 0; 2436} 2437 2438.cdk-overlay-pane.mat-mdc-dialog-panel { 2439 max-width: var(--%NS%mat-dialog-container-max-width, 560px); 2440 min-width: var(--%NS%mat-dialog-container-min-width, 280px); 2441} 2442@media (max-width: 599px) { 2443 .cdk-overlay-pane.mat-mdc-dialog-panel { 2444 max-width: var(--%NS%mat-dialog-container-small-max-width, calc(100vw - 32px)); 2445 } 2446} 2447 2448.mat-mdc-dialog-inner-container { 2449 display: flex; 2450 flex-direction: row; 2451 align-items: center; 2452 justify-content: space-around; 2453 box-sizing: border-box; 2454 height: 100%; 2455 opacity: 0; 2456 transition: opacity linear var(--%NS%mat-dialog-transition-duration, 0ms); 2457 max-height: inherit; 2458 min-height: inherit; 2459 min-width: inherit; 2460 max-width: inherit; 2461} 2462.mdc-dialog--closing .mat-mdc-dialog-inner-container { 2463 transition: opacity 75ms linear; 2464 transform: none; 2465} 2466.mdc-dialog--open .mat-mdc-dialog-inner-container { 2467 opacity: 1; 2468} 2469._mat-animation-noopable .mat-mdc-dialog-inner-container { 2470 transition: none; 2471} 2472 2473.mat-mdc-dialog-surface { 2474 display: flex; 2475 flex-direction: column; 2476 flex-grow: 0; 2477 flex-shrink: 0; 2478 box-sizing: border-box; 2479 width: 100%; 2480 height: 100%; 2481 position: relative; 2482 overflow-y: auto; 2483 outline: 0; 2484 transform: scale(0.8); 2485 transition: transform var(--%NS%mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1); 2486 max-height: inherit; 2487 min-height: inherit; 2488 min-width: inherit; 2489 max-width: inherit; 2490 box-shadow: var(--%NS%mat-dialog-container-elevation-shadow, none); 2491 border-radius: var(--%NS%mat-dialog-container-shape, var(--%NS%mat-sys-corner-extra-large, 4px)); 2492 background-color: var(--%NS%mat-dialog-container-color, var(--%NS%mat-sys-surface, white)); 2493} 2494[dir=rtl] .mat-mdc-dialog-surface { 2495 text-align: right; 2496} 2497.mdc-dialog--open .mat-mdc-dialog-surface, .mdc-dialog--closing .mat-mdc-dialog-surface { 2498 transform: none; 2499} 2500._mat-animation-noopable .mat-mdc-dialog-surface { 2501 transition: none; 2502} 2503.mat-mdc-dialog-surface::before { 2504 position: absolute; 2505 box-sizing: border-box; 2506 width: 100%; 2507 height: 100%; 2508 top: 0; 2509 left: 0; 2510 border: 2px solid transparent; 2511 border-radius: inherit; 2512 content: ""; 2513 pointer-events: none; 2514} 2515 2516.mat-mdc-dialog-title { 2517 display: block; 2518 position: relative; 2519 flex-shrink: 0; 2520 box-sizing: border-box; 2521 margin: 0 0 1px; 2522 padding: var(--%NS%mat-dialog-headline-padding, 6px 24px 13px); 2523} 2524.mat-mdc-dialog-title::before { 2525 display: inline-block; 2526 width: 0; 2527 height: 40px; 2528 content: ""; 2529 vertical-align: 0; 2530} 2531[dir=rtl] .mat-mdc-dialog-title { 2532 text-align: right; 2533} 2534.mat-mdc-dialog-container .mat-mdc-dialog-title { 2535 color: var(--%NS%mat-dialog-subhead-color, var(--%NS%mat-sys-on-surface, rgba(0, 0, 0, 0.87))); 2536 font-family: var(--%NS%mat-dialog-subhead-font, var(--%NS%mat-sys-headline-small-font, inherit)); 2537 line-height: var(--%NS%mat-dialog-subhead-line-height, var(--%NS%mat-sys-headline-small-line-height, 1.5rem)); 2538 font-size: var(--%NS%mat-dialog-subhead-size, var(--%NS%mat-sys-headline-small-size, 1rem)); 2539 font-weight: var(--%NS%mat-dialog-subhead-weight, var(--%NS%mat-sys-headline-small-weight, 400)); 2540 letter-spacing: var(--%NS%mat-dialog-subhead-tracking, var(--%NS%mat-sys-headline-small-tracking, 0.03125em)); 2541} 2542 2543.mat-mdc-dialog-content { 2544 display: block; 2545 flex-grow: 1; 2546 box-sizing: border-box; 2547 margin: 0; 2548 overflow: auto; 2549 max-height: 65vh; 2550} 2551.mat-mdc-dialog-content > :first-child { 2552 margin-top: 0; 2553} 2554.mat-mdc-dialog-content > :last-child { 2555 margin-bottom: 0; 2556} 2557.mat-mdc-dialog-container .mat-mdc-dialog-content { 2558 color: var(--%NS%mat-dialog-supporting-text-color, var(--%NS%mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6))); 2559 font-family: var(--%NS%mat-dialog-supporting-text-font, var(--%NS%mat-sys-body-medium-font, inherit)); 2560 line-height: var(--%NS%mat-dialog-supporting-text-line-height, var(--%NS%mat-sys-body-medium-line-height, 1.5rem)); 2561 font-size: var(--%NS%mat-dialog-supporting-text-size, var(--%NS%mat-sys-body-medium-size, 1rem)); 2562 font-weight: var(--%NS%mat-dialog-supporting-text-weight, var(--%NS%mat-sys-body-medium-weight, 400)); 2563 letter-spacing: var(--%NS%mat-dialog-supporting-text-tracking, var(--%NS%mat-sys-body-medium-tracking, 0.03125em)); 2564} 2565.mat-mdc-dialog-container .mat-mdc-dialog-content { 2566 padding: var(--%NS%mat-dialog-content-padding, 20px 24px); 2567} 2568.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content { 2569 padding: var(--%NS%mat-dialog-with-actions-content-padding, 20px 24px 0); 2570} 2571.mat-mdc-dialog-container .mat-mdc-dialog-title + .mat-mdc-dialog-content { 2572 padding-top: 0; 2573} 2574 2575.mat-mdc-dialog-actions { 2576 display: flex; 2577 position: relative; 2578 flex-shrink: 0; 2579 flex-wrap: wrap; 2580 align-items: center; 2581 box-sizing: border-box; 2582 min-height: 52px; 2583 margin: 0; 2584 border-top: 1px solid transparent; 2585 padding: var(--%NS%mat-dialog-actions-padding, 16px 24px); 2586 justify-content: var(--%NS%mat-dialog-actions-alignment, flex-end); 2587} 2588@media (forced-colors: active) { 2589 .mat-mdc-dialog-actions { 2590 border-top-color: CanvasText; 2591 } 2592} 2593.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start, .mat-mdc-dialog-actions[align=start] { 2594 justify-content: start; 2595} 2596.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center, .mat-mdc-dialog-actions[align=center] { 2597 justify-content: center; 2598}
2599.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end, .mat-mdc-dialog-actions[align=end] { 2600 justify-content: flex-end; 2601} 2602.mat-mdc-dialog-actions .mat-button-base + .mat-button-base, 2603.mat-mdc-dialog-actions .mat-mdc-button-base + .mat-mdc-button-base { 2604 margin-left: 8px; 2605} 2606[dir=rtl] .mat-mdc-dialog-actions .mat-button-base + .mat-button-base, 2607[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base + .mat-mdc-button-base { 2608 margin-left: 0; 2609 margin-right: 8px; 2610} 2611 2612.mat-mdc-dialog-component-host { 2613 display: contents; 2614} 2615`],encapsulation:2,changeDetection:1})}return t})();var rt$2=`--mat-dialog-transition-duration`;function lt$2(t){return t==null?null:typeof t==`number`?t:t.endsWith(`ms`)?Tr$5(t.substring(0,t.length-2)):t.endsWith(`s`)?Tr$5(t.substring(0,t.length-1))*1e3:t===`0`?0:null}var p=(function(t){return t[t.OPEN=0]=`OPEN`,t[t.CLOSING=1]=`CLOSING`,t[t.CLOSED=2]=`CLOSED`,t})(p||{});var d$2=class{_ref;_config;_containerInstance;componentInstance;componentRef=null;disableClose;id;_afterOpened=new Wn$4(1);_beforeClosed=new Wn$4(1);_result;_closeFallbackTimeout;_state=p.OPEN;_closeInteractionType;constructor(a,e,i){this._ref=a,this._config=e,this._containerInstance=i,this.disableClose=e.disableClose,this.id=a.id,a.addPanelClass(`mat-mdc-dialog-panel`),i._animationStateChanged.pipe(hn$4(n=>n.state===`opened`),_t$9(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),i._animationStateChanged.pipe(hn$4(n=>n.state===`closed`),_t$9(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._finishDialogClose()}),a.overlayRef.detachments().subscribe(()=>{this._beforeClosed.next(this._result),this._beforeClosed.complete(),this._finishDialogClose()}),_m(this.backdropClick(),this.keydownEvents().pipe(hn$4(n=>n.keyCode===27&&!this.disableClose&&!Ho$5(n)))).subscribe(n=>{this.disableClose||(n.preventDefault(),dt$3(this,n.type===`keydown`?`keyboard`:`mouse`))})}close(a){let e=this._config.closePredicate;e&&!e(a,this._config,this.componentInstance)||(this._result=a,this._containerInstance._animationStateChanged.pipe(hn$4(i=>i.state===`closing`),_t$9(1)).subscribe(i=>{this._beforeClosed.next(a),this._beforeClosed.complete(),this._ref.overlayRef.detachBackdrop(),this._closeFallbackTimeout=setTimeout(()=>this._finishDialogClose(),i.totalTime+100)}),this._state=p.CLOSING,this._containerInstance._startExitAnimation())}afterOpened(){return this._afterOpened}afterClosed(){return this._ref.closed}beforeClosed(){return this._beforeClosed}backdropClick(){return this._ref.backdropClick}keydownEvents(){return this._ref.keydownEvents}updatePosition(a){let e=this._ref.config.positionStrategy;return a&&(a.left||a.right)?a.left?e.left(a.left):e.right(a.right):e.centerHorizontally(),a&&(a.top||a.bottom)?a.top?e.top(a.top):e.bottom(a.bottom):e.centerVertically(),this._ref.updatePosition(),this}updateSize(a=``,e=``){return this._ref.updateSize(a,e),this}addPanelClass(a){return this._ref.addPanelClass(a),this}removePanelClass(a){return this._ref.removePanelClass(a),this}getState(){return this._state}_finishDialogClose(){this._state=p.CLOSED,this._ref.close(this._result,{focusOrigin:this._closeInteractionType}),this.componentInstance=null}};function dt$3(t,a,e){return t._closeInteractionType=a,t.close(e)}var bt$4=new N$2(`MatMdcDialogData`);var yt$3=new N$2(`mat-mdc-dialog-default-options`);var vt$3=new N$2(`mat-mdc-dialog-scroll-strategy`,{providedIn:`root`,factory:()=>{let t=E(we$4);return()=>Le$4(t)}});var O$1=(()=>{class t{_defaultOptions=E(yt$3,{optional:!0});_scrollStrategy=E(vt$3);_parentDialog=E(t,{optional:!0,skipSelf:!0});_idGenerator=E(Or$4);_injector=E(we$4);_dialog=E(pe$5);_animationsDisabled=nt$5();_openDialogsAtThisLevel=[];_afterAllClosedAtThisLevel=new ee$5;_afterOpenedAtThisLevel=new ee$5;dialogConfigClass=f$1;_dialogRefConstructor;_dialogContainerType;_dialogDataToken;get openDialogs(){return this._parentDialog?this._parentDialog.openDialogs:this._openDialogsAtThisLevel}get afterOpened(){return this._parentDialog?this._parentDialog.afterOpened:this._afterOpenedAtThisLevel}_getAfterAllClosed(){let e=this._parentDialog;return e?e._getAfterAllClosed():this._afterAllClosedAtThisLevel}afterAllClosed=Cm(()=>this.openDialogs.length?this._getAfterAllClosed():this._getAfterAllClosed().pipe(Vm(void 0)));constructor(){this._dialogRefConstructor=d$2,this._dialogContainerType=_t$4,this._dialogDataToken=bt$4}open(e,i){let n;i=q$1(q$1({},this._defaultOptions||new f$1),i),i.id=i.id||this._idGenerator.getId(`mat-mdc-dialog-`),i.scrollStrategy=i.scrollStrategy||this._scrollStrategy();let _=this._dialog.open(e,W$4(q$1({},i),{positionStrategy:je$2(this._injector).centerHorizontally().centerVertically(),disableClose:!0,closePredicate:void 0,closeOnDestroy:!1,closeOnOverlayDetachments:!1,disableAnimations:this._animationsDisabled||i.enterAnimationDuration?.toLocaleStr
vendor: 4,125 bytes, line 2615
2615ing()===`0`||i.exitAnimationDuration?.toString()===`0`,container:{type:this._dialogContainerType,providers:()=>[{provide:this.dialogConfigClass,useValue:i},{provide:h$2,useValue:i}]},templateContext:()=>({dialogRef:n}),providers:(s,gt,I)=>(n=new this._dialogRefConstructor(s,i,I),n.updatePosition(i?.position),[{provide:this._dialogContainerType,useValue:I},{provide:this._dialogDataToken,useValue:gt.data},{provide:this._dialogRefConstructor,useValue:n},{provide:f$3,useValue:null}])}));return n.componentRef=_.componentRef,n.componentInstance=_.componentInstance,this.openDialogs.push(n),this.afterOpened.next(n),n.afterClosed().subscribe(()=>{let s=this.openDialogs.indexOf(n);s>-1&&(this.openDialogs.splice(s,1),this.openDialogs.length||this._getAfterAllClosed().next())}),n}closeAll(){this._closeDialogs(this.openDialogs)}getDialogById(e){return this.openDialogs.find(i=>i.id===e)}ngOnDestroy(){this._closeDialogs(this._openDialogsAtThisLevel),this._afterAllClosedAtThisLevel.complete(),this._afterOpenedAtThisLevel.complete()}_closeDialogs(e){let i=e.length;for(;i--;)e[i].close()}static ɵfac=function(i){return new(i||t)};static ɵprov=rn$5({token:t,factory:t.ɵfac})}return t})();var Vt$1=(()=>{class t{dialogRef=E(d$2,{optional:!0});_elementRef=E(Lr$5);_dialog=E(O$1);ariaLabel;type=`button`;dialogResult;_matDialogClose;ngOnInit(){this.dialogRef||(this.dialogRef=mt$4(this._elementRef,this._dialog.openDialogs))}ngOnChanges(e){let i=e._matDialogClose;i&&(this.dialogResult=i.currentValue)}_onButtonClick(e){this._elementRef.nativeElement.getAttribute(`aria-disabled`)!==`true`&&dt$3(this.dialogRef,e.screenX===0&&e.screenY===0?`keyboard`:`mouse`,this.dialogResult)}static ɵfac=function(i){return new(i||t)};static ɵdir=HD({type:t,selectors:[[``,`mat-dialog-close`,``],[``,`matDialogClose`,``]],hostVars:2,hostBindings:function(i,n){i&1&&jh$3(`click`,function(s){return n._onButtonClick(s)}),i&2&&xh$2(`aria-label`,n.ariaLabel||null)(`type`,n.type)},inputs:{ariaLabel:[0,`aria-label`,`ariaLabel`],type:`type`,dialogResult:[0,`mat-dialog-close`,`dialogResult`],_matDialogClose:[0,`matDialogClose`,`_matDialogClose`]},exportAs:[`matDialogClose`],features:[qy]})}return t})();var ct$4=(()=>{class t{_dialogRef=E(d$2,{optional:!0});_elementRef=E(Lr$5);_dialog=E(O$1);ngOnInit(){this._dialogRef||(this._dialogRef=mt$4(this._elementRef,this._dialog.openDialogs)),this._dialogRef&&Promise.resolve().then(()=>{this._onAdd()})}ngOnDestroy(){this._dialogRef?._containerInstance&&Promise.resolve().then(()=>{this._onRemove()})}static ɵfac=function(i){return new(i||t)};static ɵdir=HD({type:t})}return t})();var Gt$2=(()=>{class t extends ct$4{id=E(Or$4).getId(`mat-mdc-dialog-title-`);_onAdd(){this._dialogRef._containerInstance?._addAriaLabelledBy?.(this.id)}_onRemove(){this._dialogRef?._containerInstance?._removeAriaLabelledBy?.(this.id)}static ɵfac=(()=>{let e;return function(n){return(e||(e=lv(t)))(n||t)}})();static ɵdir=HD({type:t,selectors:[[``,`mat-dialog-title`,``],[``,`matDialogTitle`,``]],hostAttrs:[1,`mat-mdc-dialog-title`,`mdc-dialog__title`],hostVars:1,hostBindings:function(i,n){i&2&&Lh$3(`id`,n.id)},inputs:{id:`id`},exportAs:[`matDialogTitle`],features:[wh$3]})}return t})();var Ht$1=(()=>{class t{static ɵfac=function(i){return new(i||t)};static ɵdir=HD({type:t,selectors:[[``,`mat-dialog-content`,``],[`mat-dialog-content`],[``,`matDialogContent`,``]],hostAttrs:[1,`mat-mdc-dialog-content`,`mdc-dialog__content`],features:[WD([Ft$4])]})}return t})();var qt$4=(()=>{class t extends ct$4{align;_onAdd(){this._dialogRef._containerInstance?._updateActionSectionCount?.(1)}_onRemove(){this._dialogRef._containerInstance?._updateActionSectionCount?.(-1)}static ɵfac=(()=>{let e;return function(n){return(e||(e=lv(t)))(n||t)}})();static ɵdir=HD({type:t,selectors:[[``,`mat-dialog-actions`,``],[`mat-dialog-actions`],[``,`matDialogActions`,``]],hostAttrs:[1,`mat-mdc-dialog-actions`,`mdc-dialog__actions`],hostVars:6,hostBindings:function(i,n){i&2&&Yh$3(`mat-mdc-dialog-actions-align-start`,n.align===`start`)(`mat-mdc-dialog-actions-align-center`,n.align===`center`)(`mat-mdc-dialog-actions-align-en
2615d`,n.align===`end`)},inputs:{align:`align`},features:[wh$3]})}return t})();function mt$4(t,a){let e=t.nativeElement.parentElement;for(;e&&!e.classList.contains(`mat-mdc-dialog-container`);)e=e.parentElement;return e?a.find(i=>i.id===e.id):null}var Wt$2=(()=>{class t{static ɵfac=function(i){return new(i||t)};static ɵmod=FD({type:t});static ɵinj=ju$1({providers:[O$1],imports:[Me$3,di$3,Re$3,xn$4]})}return t})();var st$2=gT((B,G)=>{"use strict";(function(f,h){typeof B==`object`&&typeof G<`u`?G.exports=h():typeof define==`function`&&define.amd?define(h):(f=typeof globalThis<`u`?globalThis:f||self).dayjs_plugin_customParseFormat=h()})(B,(function(){"use strict";var f={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`},h=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,x=/\d/,v=/\d\d/,a=/\d\d?/,d=/\d*[^-_:/,()\s\d]+/,c={},s=function(t){return(t=+t)+(t>68?1900:2e3)},n=function(t){return function(e){this[t]=+e}},D=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=(function(e){if(!e||e===`Z`)return 0;var i=e.match(/([+-]|\d\d)/g),r=60*i[1]+(+i[2]||0);return r===0?0:i[0]===`+`?-r:r})(t)}],l=function(t){var e=c[t];return e&&(e.indexOf?e:e.s.concat(e.f))}
2615,O=function(t,e){var i,r=c.meridiem;if(r){for(var y=1;y<=24;y+=1)if(t.indexOf(r(y,0,e))>-1){i=y>12;break}}else i=t===(e?`pm`:`PM`);return i},z={A:[d,function(t){this.afternoon=O(t,!1)}],a:[d,function(t){this.afternoon=O(t,!0)}],Q:[x,function(t){this.month=3*(t-1)+1}],S:[x,function(t){this.milliseconds=100*+t}],SS:[v,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[a,n(`seconds`)],ss:[a,n(`seconds`)],m:[a,n(`minutes`)],mm:[a,n(`minutes`)],H:[a,n(`hours`)],h:[a,n(`hours`)],HH:[a,n(`hours`)],hh:[a,n(`hours`)],D:[a,n(`day`)],DD:[v,n(`day`)],Do:[d,function(t){var e=c.ordinal,i=t.match(/\d+/);if(this.day=i[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,``)===t&&(this.day=r)}],w:[a,n(`week`)],ww:[v,n(`week`)],M:[a,n(`month`)],MM:[v,n(`month`)],MMM:[d,function(t){var e=l(`months`),i=(l(`monthsShort`)||e.map((function(r){return r.slice(0,3)}))).indexOf(t)+1;if(i<1)throw new Error;this.month=i%12||i}],MMMM:[d,function(t){var e=l(`months`).indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,n(`year`)],YY:[v,function(t){this.year=s(t)}],YYYY:[/\d{4}/,n(`year`)],Z:D,ZZ:D};function C(t){var e=t,i=c&&c.formats;for(var r=(t=e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function($,g,m){var u=m&&m.toUpperCase();return g||i[m]||f[m]||i[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,k,T){return k||T.slice(1)}))}))).match(h),y=r.length,p=0;p<y;p+=1){var b=r[p],L=z[b],M=L&&L[0],Y=L&&L[1];r[p]=Y?{regex:M,parser:Y}:b.replace(/^\[|\]$/g,``)}return function($){for(var g={},m=0,u=0;m<y;m+=1){var w=r[m];if(typeof w==`string`)u+=w.length;else{var k=w.regex,T=w.parser,A=$.slice(u),S=k.exec(A)[0];T.call(g,S),$=$.replace(S,``)}}return(function(W){var Z=W.afternoon;if(Z!==void 0){var o=W.hours;Z?o<12&&(W.hours+=12):o===12&&(W.hours=0),delete W.afternoon}})(g),g}}return function(t,e,i){i.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,y=r.parse;r.parse=function(p){var b=p.date,L=p.utc,M=p.args;this.$u=L;var Y=M[1];if(typeof Y==`string`){var $=M[2]===!0,g=M[3]===!0,m=$||g,u=M[2];g&&(u=M[2]),c=this.$locale(),!$&&u&&(c=i.Ls[u]),this.$d=(function(A,S,W,Z){try{if([`x`,`X`].indexOf(S)>-1)return new Date((S===`X`?1e3:1)*A);var o=C(S)(A),F=o.year,_=o.month,tt=o.day,et=o.hours,nt=o.minutes,it=o.seconds,rt=o.milliseconds,K=o.zone,N=o.week,P=new Date,U=tt||(F||_?1:P.getDate()),E=F||P.getFullYear(),H=0;F&&!_||(H=_>0?_-1:P.getMonth());var j,Q=et||0,X=nt||0,V=it||0,q=rt||0;return K?new Date(Date.UTC(E,H,U,Q,X,V,q+60*K.offset*1e3)):W?new Date(Date.UTC(E,H,U,Q,X,V,q)):(j=new Date(E,H,U,Q,X,V,q),N&&(j=Z(j).week(N).toDate()),j)}catch(ot){return new Date(``)}})(b,Y,L,i),this.init(),u&&u!==!0&&(this.$L=this.locale(u).$L),m&&b!=this.format(Y)&&(this.$d=new Date(``)),c={}}else if(Y instanceof Array)for(var w=Y.length,k=1;k<=w;k+=1){M[1]=Y[k-1];var T=i.apply(this,M);if(T.isValid()){this.$d=T.$d,this.$L=T.$L,this.init();break}k===w&&(this.$d=new Date(``))}else y.call(this,p)}}}))});var at$1=gT((I,J)=>{"use strict";(function(f,h){typeof I==`object`&&typeof J<`u`?J.exports=h():typeof define==`function`&&define.amd?define(h):(f=typeof globalThis<`u`?globalThis:f||self).dayjs_plugin_isoWeek=h()})(I,(function(){"use strict";var f=`day`;return function(h,x,v){var a=function(s){return s.add(4-s.isoWeekday(),f)},d=x.prototype;d.isoWeekYear=function(){return a(this).year()},d.isoWeek=function(s){if(!this.$utils().u(s))return this.add(7*(s-this.isoWeek()),f);var n,D,l,O,z=a(this),C=(n=this.isoWeekYear(),D=this.$u,l=(D?v.utc:v)().year(n).startOf(`year`),O=4-l.isoWeekday(),l.isoWeekday()>4&&(O+=7),l.add(O,f));return z.diff(C,`week`)+1},d.isoWeekday=function(s){return this.$utils().u(s)?this.day()||7:this.day(this.day()%7?s:s-7)};var c=d.startOf;d.startOf=function(s,n){var D=this.$utils(),l=!!D.u(n)||n;return D.p(s)===`isoweek`?l?this.date(this.date()-(this.isoWeekday()-1)).startOf(`day`):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf(`day`):c.bind(this)(s,n)}}}))});function ce$2(e){return e+.5|0}var _t$3=(e,i,t)=>Math.max(Math.min(e,t),i);function ae$2(e){return _t$3(ce$2(e*2.55),0,255)}function yt$2(e){return _t$3(ce$2(e*255),0,255)}function dt$2(e){return _t$3(ce$2(e/2.55)/100,0,1)}function Bs$1(e){return _t$3(ce$2(e*100),0,100)}var et={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15};var xi$1=[...`0123456789ABCDEF`];var ir$2=e=>xi$1[e&15];var sr$2=e=>xi$1[(e&240)>>4]+xi$1[e&15];var Te$2=e=>(e&240)>>4===(e&15);var nr$2=e=>Te$2(e.r)&&Te$2(e.g)&&Te$2(e.b)&&Te$2(e.a);function or$2(e){var i=e.length,t;return e[0]===`#`&&(i===4||i===5?t={r:255&et[e[1]]*17,g:255&et[e[2]]*17,b:255&et[e[3]]*17,a:i===5?et[e[4]]*17:255}
vendor: 10,920 bytes, line 2615
2615:(i===7||i===9)&&(t={r:et[e[1]]<<4|et[e[2]],g:et[e[3]]<<4|et[e[4]],b:et[e[5]]<<4|et[e[6]],a:i===9?et[e[7]]<<4|et[e[8]]:255})),t}var rr$1=(e,i)=>e<255?i(e):``;function ar$2(e){var i=nr$2(e)?ir$2:sr$2;return e?`#`+i(e.r)+i(e.g)+i(e.b)+rr$1(e.a,i):void 0}var lr$1=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Hs$2(e,i,t){let s=i*Math.min(t,1-t),n=(o,r=(o+e/30)%12)=>t-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function cr$2(e,i,t){let s=(n,o=(n+e/60)%6)=>t-t*i*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function hr$2(e,i,t){let s=Hs$2(e,1,.5),n;for(i+t>1&&(n=1/(i+t),i*=n,t*=n),n=0;n<3;n++)s[n]*=1-i-t,s[n]+=i;return s}function dr$2(e,i,t,s,n){return e===n?(i-t)/s+(i<t?6:0):i===n?(t-e)/s+2:(e-i)/s+4}function _i$1(e){let t=e.r/255,s=e.g/255,n=e.b/255,o=Math.max(t,s,n),r=Math.min(t,s,n),a=(o+r)/2,l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=dr$2(t,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function yi$1(e,i,t,s){return(Array.isArray(i)?e(i[0],i[1],i[2]):e(i,t,s)).map(yt$2)}function vi$1(e,i,t){return yi$1(Hs$2,e,i,t)}function fr$2(e,i,t){return yi$1(hr$2,e,i,t)}function ur$2(e,i,t){return yi$1(cr$2,e,i,t)}function js$2(e){return(e%360+360)%360}function gr$2(e){let i=lr$1.exec(e),t=255,s;if(!i)return;i[5]!==s&&(t=i[6]?ae$2(+i[5]):yt$2(+i[5]));let n=js$2(+i[2]),o=+i[3]/100,r=+i[4]/100;return i[1]===`hwb`?s=fr$2(n,o,r):i[1]===`hsv`?s=ur$2(n,o,r):s=vi$1(n,o,r),{r:s[0],g:s[1],b:s[2],a:t}}function pr$2(e,i){var t=_i$1(e);t[0]=js$2(t[0]+i),t=vi$1(t),e.r=t[0],e.g=t[1],e.b=t[2]}function mr$2(e){if(!e)return;let i=_i$1(e),t=i[0],s=Bs$1(i[1]),n=Bs$1(i[2]);return e.a<255?`hsla(${t}, ${s}%, ${n}%, ${dt$2(e.a)})`:`hsl(${t}, ${s}%, ${n}%)`}var Ws$2={x:`dark`,Z:`light`,Y:`re`,X:`blu`,W:`gr`,V:`medium`,U:`slate`,A:`ee`,T:`ol`,S:`or`,B:`ra`,C:`lateg`,D:`ights`,R:`in`,Q:`turquois`,E:`hi`,P:`ro`,O:`al`,N:`le`,M:`de`,L:`yello`,F:`en`,K:`ch`,G:`arks`,H:`ea`,I:`ightg`,J:`wh`};var Ns$2={OiceXe:`f0f8ff`,antiquewEte:`faebd7`,aqua:`ffff`,aquamarRe:`7fffd4`,azuY:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`0`,blanKedOmond:`ffebcd`,Xe:`ff`,XeviTet:`8a2be2`,bPwn:`a52a2a`,burlywood:`deb887`,caMtXe:`5f9ea0`,KartYuse:`7fff00`,KocTate:`d2691e`,cSO:`ff7f50`,cSnflowerXe:`6495ed`,cSnsilk:`fff8dc`,crimson:`dc143c`,cyan:`ffff`,xXe:`8b`,xcyan:`8b8b`,xgTMnPd:`b8860b`,xWay:`a9a9a9`,xgYF:`6400`,xgYy:`a9a9a9`,xkhaki:`bdb76b`,xmagFta:`8b008b`,xTivegYF:`556b2f`,xSange:`ff8c00`,xScEd:`9932cc`,xYd:`8b0000`,xsOmon:`e9967a`,xsHgYF:`8fbc8f`,xUXe:`483d8b`,xUWay:`2f4f4f`,xUgYy:`2f4f4f`,xQe:`ced1`,xviTet:`9400d3`,dAppRk:`ff1493`,dApskyXe:`bfff`,dimWay:`696969`,dimgYy:`696969`,dodgerXe:`1e90ff`,fiYbrick:`b22222`,flSOwEte:`fffaf0`,foYstWAn:`228b22`,fuKsia:`ff00ff`,gaRsbSo:`dcdcdc`,ghostwEte:`f8f8ff`,gTd:`ffd700`,gTMnPd:`daa520`,Way:`808080`,gYF:`8000`,gYFLw:`adff2f`,gYy:`808080`,honeyMw:`f0fff0`,hotpRk:`ff69b4`,RdianYd:`cd5c5c`,Rdigo:`4b0082`,ivSy:`fffff0`,khaki:`f0e68c`,lavFMr:`e6e6fa`,lavFMrXsh:`fff0f5`,lawngYF:`7cfc00`,NmoncEffon:`fffacd`,ZXe:`add8e6`,ZcSO:`f08080`,Zcyan:`e0ffff`,ZgTMnPdLw:`fafad2`,ZWay:`d3d3d3`,ZgYF:`90ee90`,ZgYy:`d3d3d3`,ZpRk:`ffb6c1`,ZsOmon:`ffa07a`,ZsHgYF:`20b2aa`,ZskyXe:`87cefa`,ZUWay:`778899`,ZUgYy:`778899`,ZstAlXe:`b0c4de`,ZLw:`ffffe0`,lime:`ff00`,limegYF:`32cd32`,lRF:`faf0e6`,magFta:`ff00ff`,maPon:`800000`,VaquamarRe:`66cdaa`,VXe:`cd`,VScEd:`ba55d3`,VpurpN:`9370db`,VsHgYF:`3cb371`,VUXe:`7b68ee`,VsprRggYF:`fa9a`,VQe:`48d1cc`,VviTetYd:`c71585`,midnightXe:`191970`,mRtcYam:`f5fffa`,mistyPse:`ffe4e1`,moccasR:`ffe4b5`,navajowEte:`ffdead`,navy:`80`,Tdlace:`fdf5e6`,Tive:`808000`,TivedBb:`6b8e23`,Sange:`ffa500`,SangeYd:`ff4500`,ScEd:`da70d6`,pOegTMnPd:`eee8aa`,pOegYF:`98fb98`,pOeQe:`afeeee`,pOeviTetYd:`db7093`,papayawEp:`ffefd5`,pHKpuff:`ffdab9`,peru:`cd853f`,pRk:`ffc0cb`,plum:`dda0dd`,powMrXe:`b0e0e6`,purpN:`800080`,YbeccapurpN:`663399`,Yd:`ff0000`,Psybrown:`bc8f8f`,PyOXe:`4169e1`,saddNbPwn:`8b4513`,sOmon:`fa8072`,sandybPwn:`f4a460`,sHgYF:`2e8b57`,sHshell:`fff5ee`,siFna:`a0522d`,silver:`c0c0c0`,skyXe:`87ceeb`,UXe:`6a5acd`,UWay:`708090`,UgYy:`708090`,snow:`fffafa`,sprRggYF:`ff7f`,stAlXe:`4682b4`,tan:`d2b48c`,teO:`8080`,tEstN:`d8bfd8`,tomato:`ff6347`,Qe:`40e0d0`,viTet:`ee82ee`,JHt:`f5deb3`,wEte:`ffffff`,wEtesmoke:`f5f5f5`,Lw:`ffff00`,LwgYF:`9acd32`};function br$2(){let e={},i=Object.keys(Ns$2),t=Object.keys(Ws$2),s,n,o,r,a;for(s=0;s<i.length;s++){for(r=a=i[s],n=0;n<t.length;n++)o=t[n],a=a.replace(o,Ws$2[o]);o=parseInt(Ns$2[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}var Le$1;function xr$2(e){Le$1||(Le$1=br$2(),Le$1.transparent=[0,0,0,0]);let i=Le$1[e.toLowerCase()];return i&&{r:i[0],g:i[1],b:i[2],a:i.length===4?i[3]:255}}var _r$2=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function yr$2(e){let i=_r$2.exec(e),t=255,s,n,o;if(i){if(i[7]!==s){let r=+i[7];t=i[8]?ae$2(r):_t$3(r*255,0,255)}return s=+i[1],n=+i[3],o=+i[5],s=255&(i[2]?ae$2(s):_t$3(s,0,255)),n=255&(i[4]?ae$2(n):_t$3(n,0,255)),o=255&(i[6]?ae$2(o):_t$3(o,0,255)),{r:s,g:n,b:o,a:t}}}function vr$2(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${dt$2(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}var bi=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055;var Yt$1=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Mr$2(e,i,t){let s=Yt$1(dt$2(e.r)),n=Yt$1(dt$2(e.g)),o=Yt$1(dt$2(e.b));return{r:yt$2(bi(s+t*(Yt$1(dt$2(i.r))-s))),g:yt$2(bi(n+t*(Yt$1(dt$2(i.g))-n))),b:yt$2(bi(o+t*(Yt$1(dt$2(i.b))-o))),a:e.a+t*(i.a-e.a)}}function Re(e,i,t){if(e){let s=_i$1(e);s[i]=Math.max(0,Math.min(s[i]+s[i]*t,i===0?360:1)),s=vi$1(s),e.r=s[0],e.g=s[1],e.b=s[2]}}function Ys$2(e,i){return e&&Object.assign(i||{},e)}function Vs$2(e){var i={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(i={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(i.a=yt$2(e[3]))):(i=Ys$2(e,{r:0,g:0,b:0,a:1}),i.a=yt$2(i.a)),i}function kr$1(e){return e.charAt(0)===`r`?yr$2(e):gr$2(e)}var le$3=class e{constructor(i){if(i instanceof e)return i;let t=typeof i,s;t===`object`?s=Vs$2(i):t===`string`&&(s=or$2(i)||xr$2(i)||kr$1(i)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var i=Ys$2(this._rgb);return i&&(i.a=dt$2(i.a)),i}set rgb(i){this._rgb=Vs$2(i)}rgbString(){return this._valid?vr$2(this._rgb):void 0}hexString(){return this._valid?ar$2(this._rgb):void 0}hslString(){return this._valid?mr$2(this._rgb):void 0}mix(i,t){if(i){let s=this.rgb,n=i.rgb,o,r=t===o?.5:t,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(i,t){return i&&(this._rgb=Mr$2(this._rgb,i._rgb,t)),this}clone(){return new e(this.rgb)}alpha(i){return this._rgb.a=yt$2(i),this}clearer(i){let t=this._rgb;return t.a*=1-i,this}greyscale(){let i=this._rgb;return i.r=i.g=i.b=ce$2(i.r*.3+i.g*.59+i.b*.11),this}opaquer(i){let t=this._rgb;return t.a*=1+i,this}negate(){let i=this._rgb;return i.r=255-i.r,i.g=255-i.g,i.b=255-i.b,this}lighten(i){return Re(this._rgb,2,i),this}darken(i){return Re(this._rgb,2,-i),this}saturate(i){return Re(this._rgb,1,i),this}desaturate(i){return Re(this._rgb,1,-i),this}rotate(i){return pr$2(this._rgb,i),this}};function at(){}var en$1=(()=>{let e=0;return()=>e++})();function O(e){return e==null}function z$1(e){if(Array.isArray&&Array.isArray(e))return!0;let i=Object.prototype.toString.call(e);return i.slice(0,7)===`[object`&&i.slice(-6)===`Array]`}function A$1(e){return e!==null&&Object.prototype.toString.call(e)===`[object Object]`}function N(e){return(typeof e==`number`||e instanceof Number)&&isFinite(+e)}function J(e,i){return N(e)?e:i}function C(e,i){return typeof e>`u`?i:e}var sn$2=(e,i)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100:+e/i;var wi$1=(e,i)=>typeof e==`string`&&e.endsWith(`%`)?parseFloat(e)/100*i:+e;function I$2(e,i,t){if(e&&typeof e.call==`function`)return e.apply(t,i)}function R$2(e,i,t,s){let n,o,r;if(z$1(e))if(o=e.length,s)for(n=o-1;n>=0;n--)i.call(t,e[n],n);else for(n=0;n<o;n++)i.call(t,e[n],n);else if(A$1(e))for(r=Object.keys(e),o=r.length,n=0;n<o;n++)i.call(t,e[r[n]],r[n])}function fe$2(e,i){let t,s,n,o;if(!e||!i||e.length!==i.length)return!1;for(t=0,s=e.length;t<s;++t)if(n=e[t],o=i[t],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function ze$1(e){if(z$1(e))return e.map(ze$1);if(A$1(e)){let i=Object.create(null),t=Object.keys(e),s=t.length,n=0;for(;n<s;++n)i[t[n]]=ze$1(e[t[n]]);return i}return e}function nn$1(e){return[`__proto__`,`prototype`,`constructor`].indexOf(e)===-1}function Sr$2(e,i,t,s){if(!nn$1(e))return;let n=i[e],o=t[e];A$1(n)&&A$1(o)?Ut$3(n,o,s):i[e]=ze$1(o)}function Ut$3(e,i,t){let s=z$1(i)?i:[i],n=s.length;if(!A$1(e))return e;t=t||{};let o=t.merger||Sr$2,r;for(let a=0;a<n;++a){if(r=s[a],!A$1(r))continue;let l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],e,r,t)}return e}function Kt$2(e,i){return Ut$3(e,i,{merger:wr$2})}function wr$2(e,i,t){if(!nn$1(e))return;let s=i[e],n=t[e];A$1(s)&&A$1(n)?Kt$2(s,n):Object.prototype.hasOwnProperty.call(i,e)||(i[e]=ze$1(n))}var $s$2={"":e=>e,x:e=>e.x,y:e=>e.y};function Cr$2(e){let i=e.split(`.`),t=[],s=``;for(let n of i)s+=n,s.endsWith(`\\`)?s=s.slice(0,-1)+`.`:(t.push(s),s=``);return t}function Pr$2(e){let i=Cr$2(e);return t=>{for(let s of i){if(s===``)break;t=t&&t[s]}return t}}function gt$2(e,i){return($s$2[i]||($s$2[i]=Pr$2(i)))(e)}function Ve$1(e){return e.charAt(0).toUpperCase()+e.slice(1)}var qt$3=e=>typeof e<`u`;var ft$3=e=>typeof e==`function`;var Ci$1=(e,i)=>{if(e.size!==i.size)return!1;for(let t of e)if(!i.has(t))return!1;return!0};function on$2(e){return e.type===`mouseup`||e.type===`click`||e.type===`contextmenu`}var L$1=Math.PI;var B=2*L$1;var Dr$2=B+L$1;var Be=Number.POSITIVE_INFINITY;var Or$1=L$1/180;var V=L$1/2;var Lt$2=L$1/4;var Us$1=L$1*2/3;var ut$1=Math.log10;var nt$1=Math.sign;function Gt$1(e,i,t){return Math.abs(e-i)<t}function Pi$1(e){let i=Math.round(e);e=Gt$1(e,i,e/1e3)?i:e;let t=Math.pow(10,Math.floor(ut$1(e))),s=e/t;return(s<=1?1:s<=2?2:s<=5?5:10)*t}function rn$2(e){let i=[],t=Math.sqrt(e),s;for(s=1;s<t;s++)e%s===0&&(i.push(s),i.push(e/s));return t===(t|0)&&i.push(t),i.sort((n,o)=>n-o).pop(),i}function Ar$2(e){return typeof e==`symbol`||typeof e==`object`&&e!==null&&!(Symbol.toPrimitive in e||`toString`in e||`valueOf`in e)}function It$2(e){return!Ar$2(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function an$1(e,i){let t=Math.round(e);return t-i<=e&&t+i>=e}function Di$1(e,i,t){let s,n,o;for(s=0,n=e.length;s<n;s++)o=e[s][t],isNaN(o)||(i.min=Math.min(i.min,o),i.max=Math.max(i.max,o))}function it(e){return e*(L$1/180)}function He$1(e){return e*(180/L$1)}function Oi$1(e){if(!N(e))return;let i=1,t=0;for(;Math.round(e*i)/i!==e;)i*=10,t++;return t}function Ai$1(e,i){let t=i.x-e.x,s=i.y-e.y,n=Math.sqrt(t*t+s*s),o=Math.atan2(s,t);return o<-.5*L$1&&(o+=B),{angle:o,distance:n}}function We(e,i){return Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))}
2615function Tr$2(e,i){return(e-i+Dr$2)%B-L$1}function U$1(e){return(e%B+B)%B}function Jt(e,i,t,s){let n=U$1(e),o=U$1(i),r=U$1(t),a=U$1(o-n),l=U$1(r-n),c=U$1(n-o),h=U$1(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function Y(e,i,t){return Math.max(i,Math.min(t,e))}function ln$1(e){return Y(e,-32768,32767)}function lt$1(e,i,t,s=1e-6){return e>=Math.min(i,t)-s&&e<=Math.max(i,t)+s}function je(e,i,t){t=t||(r=>e[r]<i);let s=e.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,t(o)?n=o:s=o;return{lo:n,hi:s}}var ot$1=(e,i,t,s)=>je(e,t,s?n=>{let o=e[n][i];return o<t||o===t&&e[n+1][i]===t}:n=>e[n][i]<t);var cn$3=(e,i,t)=>je(e,t,s=>e[s][i]>=t);function hn$2(e,i,t){let s=0,n=e.length;for(;s<n&&e[s]<i;)s++;for(;n>s&&e[n-1]>t;)n--;return s>0||n<e.length?e.slice(s,n):e}var dn$3=[`push`,`pop`,`shift`,`splice`,`unshift`];function fn$3(e,i){if(e._chartjs){e._chartjs.listeners.push(i);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[i]}}),dn$3.forEach(t=>{let s=`_onData`+Ve$1(t),n=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...o){let r=n.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[s]==`function`&&a[s](...o)}),r}})})}function Ti(e,i){let t=e._chartjs;if(!t)return;let s=t.listeners,n=s.indexOf(i);n!==-1&&s.splice(n,1),!(s.length>0)&&(dn$3.forEach(o=>{delete e[o]}),delete e._chartjs)}function Li$1(e){let i=new Set(e);return i.size===e.length?e:Array.from(i)}var Ri$1=(function(){return typeof window>`u`?function(e){return e()}:window.requestAnimationFrame})();function Ei$1(e,i){let t=[],s=!1;return function(...n){t=n,s||(s=!0,Ri$1.call(window,()=>{s=!1,e.apply(i,t)}))}}function un$3(e,i){let t;return function(...s){return i?(clearTimeout(t),t=setTimeout(e,i,s)):e.apply(this,s),i}}var Ye=e=>e===`start`?`left`:e===`end`?`right`:`center`;var X$1=(e,i,t)=>e===`start`?i:e===`end`?t:(i+t)/2;var gn$3=(e,i,t,s)=>e===(s?`left`:`right`)?t:e===`center`?(i+t)/2:i;function Ii$1(e,i,t){let s=i.length,n=0,o=s;if(e._sorted){let{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,h=r.axis,{min:d,max:f,minDefined:u,maxDefined:g}=r.getUserBounds();if(u){if(n=Math.min(ot$1(l,h,d).lo,t?s:ot$1(i,h,r.getPixelForValue(d)).lo),c){let p=l.slice(0,n+1).reverse().findIndex(m=>!O(m[a.axis]));n-=Math.max(0,p)}n=Y(n,0,s-1)}if(g){let p=Math.max(ot$1(l,r.axis,f,!0).hi+1,t?0:ot$1(i,h,r.getPixelForValue(f),!0).hi+1);if(c){let m=l.slice(p-1).findIndex(x=>!O(x[a.axis]));p+=Math.max(0,m)}o=Y(p,n,s)-n}else o=s-n}return{start:n,count:o}}function Fi$1(e){let{xScale:i,yScale:t,_scaleRanges:s}=e,n={xmin:i.min,xmax:i.max,ymin:t.min,ymax:t.max};if(!s)return e._scaleRanges=n,!0;let o=s.xmin!==i.min||s.xmax!==i.max||s.ymin!==t.min||s.ymax!==t.max;return Object.assign(s,n),o}var Ee=e=>e===0||e===1;var Xs$2=(e,i,t)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-i)*B/t));var Ks$2=(e,i,t)=>Math.pow(2,-10*e)*Math.sin((e-i)*B/t)+1;var $t$1={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*V)+1,easeOutSine:e=>Math.sin(e*V),easeInOutSine:e=>-.5*(Math.cos(L$1*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>Ee(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>Ee(e)?e:Xs$2(e,.075,.3),easeOutElastic:e=>Ee(e)?e:Ks$2(e,.075,.3),easeInOutElastic(e){return Ee(e)?e:e<.5?.5*Xs$2(e*2,.1125,.45):.5+.5*Ks$2(e*2-1,.1125,.45)},easeInBack(e){return e*e*(2.70158*e-1.70158)},easeOutBack(e){return(e-=1)*e*(2.70158*e+1.70158)+1},easeInOutBack(e){let i=1.70158;return(e/=.5)<1?.5*(e*e*(((i*=1.525)+1)*e-i)):.5*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)},easeInBounce:e=>1-$t$1.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?$t$1.easeInBounce(e*2)*.5:$t$1.easeOutBounce(e*2-1)*.5+.5};function zi$1(e){if(e&&typeof e==`object`){let i=e.toString();return i===`[object CanvasPattern]`||i===`[object CanvasGradient]`}return!1}function Bi$1(e){return zi$1(e)?e:new le$3(e)}function Mi(e){return zi$1(e)?e:new le$3(e).saturate(.5).darken(.1).hexString()}var Lr$2=[`x`,`y`,`borderWidth`,`radius`,`tension`];var Rr$2=[`color`,`borderColor`,`backgroundColor`];function Er$2(e){e.set(`animation`,{delay:void 0,duration:1e3,easing:`easeOutQuart`,fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe(`animation`,{_fallback:!1,_indexable:!1,_scriptable:i=>i!==`onProgress`&&i!==`onComplete`&&i!==`fn`}
vendor: 3,807 bytes, line 2615
2615),e.set(`animations`,{colors:{type:`color`,properties:Rr$2},numbers:{type:`number`,properties:Lr$2}}),e.describe(`animations`,{_fallback:`animation`}),e.set(`transitions`,{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:`transparent`},visible:{type:`boolean`,duration:0}}},hide:{animations:{colors:{to:`transparent`},visible:{type:`boolean`,easing:`linear`,fn:i=>i|0}}}})}function Ir$2(e){e.set(`layout`,{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var qs$2=new Map;function Fr$1(e,i){i=i||{};let t=e+JSON.stringify(i),s=qs$2.get(t);return s||(s=new Intl.NumberFormat(e,i),qs$2.set(t,s)),s}function Zt$1(e,i,t){return Fr$1(i,t).format(e)}var pn$2={values(e){return z$1(e)?e:``+e},numeric(e,i,t){if(e===0)return`0`;let s=this.chart.options.locale,n,o=e;if(t.length>1){let c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>0x38d7ea4c68000)&&(n=`scientific`),o=zr$1(e,t)}let r=ut$1(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Zt$1(e,s,l)},logarithmic(e,i,t){if(e===0)return`0`;let s=t[i].significand||e/Math.pow(10,Math.floor(ut$1(e)));return[1,2,3,5,10,15].includes(s)||i>.8*t.length?pn$2.numeric.call(this,e,i,t):``}};function zr$1(e,i){let t=i.length>3?i[2].value-i[1].value:i[1].value-i[0].value;return Math.abs(t)>=1&&e!==Math.floor(e)&&(t=e-Math.floor(e)),t}var ue$1={formatters:pn$2};function Br$1(e){e.set(`scale`,{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:`ticks`,clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(i,t)=>t.lineWidth,tickColor:(i,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:``,padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:``,padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ue$1.formatters.values,minor:{},major:{},align:`center`,crossAlign:`near`,showLabelBackdrop:!1,backdropColor:`rgba(255, 255, 255, 0.75)`,backdropPadding:2}}),e.route(`scale.ticks`,`color`,``,`color`),e.route(`scale.grid`,`color`,``,`borderColor`),e.route(`scale.border`,`color`,``,`borderColor`),e.route(`scale.title`,`color`,``,`color`),e.describe(`scale`,{_fallback:!1,_scriptable:i=>!i.startsWith(`before`)&&!i.startsWith(`after`)&&i!==`callback`&&i!==`parser`,_indexable:i=>i!==`borderDash`&&i!==`tickBorderDash`&&i!==`dash`}),e.describe(`scales`,{_fallback:`scale`}),e.describe(`scale.ticks`,{_scriptable:i=>i!==`backdropPadding`&&i!==`callback`,_indexable:i=>i!==`backdropPadding`})}var kt$2=Object.create(null);var $e$1=Object.create(null);function he$1(e,i){if(!i)return e;let t=i.split(`.`);for(let s=0,n=t.length;s<n;++s){let o=t[s];e=e[o]||(e[o]=Object.create(null))}return e}function ki$1(e,i,t){return typeof i==`string`?Ut$3(he$1(e,i),t):Ut$3(he$1(e,``),i)}var Si=class{constructor(i,t){this.animation=void 0,this.backgroundColor=`rgba(0,0,0,0.1)`,this.borderColor=`rgba(0,0,0,0.1)`,this.color=`#666`,this.datasets={},this.devicePixelRatio=s=>s.chart.platform.getDevicePixelRatio(),this.elements={},this.events=[`mousemove`,`mouseout`,`click`,`touchstart`,`touchmove`],this.font={family:`'Helvetica Neue', 'Helvetica', 'Arial', sans-serif`,size:12,style:`normal`,lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(s,n)=>Mi(n.backgroundColor),this.hoverBorderColor=(s,n)=>Mi(n.borderColor),this.hoverColor=(s,n)=>Mi(n.color),this.indexAxis=`x`,this.interaction={mode:`nearest`,intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={}
vendor: 5,147 bytes, line 2615
2615,this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(i),this.apply(t)}set(i,t){return ki$1(this,i,t)}get(i){return he$1(this,i)}describe(i,t){return ki$1($e$1,i,t)}override(i,t){return ki$1(kt$2,i,t)}route(i,t,s,n){let o=he$1(this,i),r=he$1(this,s),a=`_`+t;Object.defineProperties(o,{[a]:{value:o[t],writable:!0},[t]:{enumerable:!0,get(){let l=this[a],c=r[n];return A$1(l)?Object.assign({},c,l):C(l,c)},set(l){this[a]=l}}})}apply(i){i.forEach(t=>t(this))}};var F=new Si({_scriptable:e=>!e.startsWith(`on`),_indexable:e=>e!==`events`,hover:{_fallback:`interaction`},interaction:{_scriptable:!1,_indexable:!1}},[Er$2,Ir$2,Br$1]);function Wr$2(e){return!e||O(e.size)||O(e.family)?null:(e.style?e.style+` `:``)+(e.weight?e.weight+` `:``)+e.size+`px `+e.family}function de$1(e,i,t,s,n){let o=i[n];return o||(o=i[n]=e.measureText(n).width,t.push(n)),o>s&&(s=o),s}function mn$2(e,i,t,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==i&&(n=s.data={},o=s.garbageCollect=[],s.font=i),e.save(),e.font=i;let r=0,a=t.length,l,c,h,d,f;for(l=0;l<a;l++)if(d=t[l],d!=null&&!z$1(d))r=de$1(e,n,o,r,d);else if(z$1(d))for(c=0,h=d.length;c<h;c++)f=d[c],f!=null&&!z$1(f)&&(r=de$1(e,n,o,r,f));e.restore();let u=o.length/2;if(u>t.length){for(l=0;l<u;l++)delete n[o[l]];o.splice(0,u)}return r}function St$2(e,i,t){let s=e.currentDevicePixelRatio,n=t!==0?Math.max(t/2,.5):0;return Math.round((i-n)*s)/s+n}function Wi$1(e,i){!i&&!e||(i=i||e.getContext(`2d`),i.save(),i.resetTransform(),i.clearRect(0,0,e.width,e.height),i.restore())}function Ue(e,i,t,s){Ni$1(e,i,t,s,null)}function Ni$1(e,i,t,s,n){let o,r,a,l,c,h,d,f,u=i.pointStyle,g=i.rotation,p=i.radius,m=(g||0)*Or$1;if(u&&typeof u==`object`&&(o=u.toString(),o===`[object HTMLImageElement]`||o===`[object HTMLCanvasElement]`)){e.save(),e.translate(t,s),e.rotate(m),e.drawImage(u,-u.width/2,-u.height/2,u.width,u.height),e.restore();return}if(!(isNaN(p)||p<=0)){switch(e.beginPath(),u){default:n?e.ellipse(t,s,n/2,p,0,0,B):e.arc(t,s,p,0,B),e.closePath();break;case`triangle`:h=n?n/2:p,e.moveTo(t+Math.sin(m)*h,s-Math.cos(m)*p),m+=Us$1,e.lineTo(t+Math.sin(m)*h,s-Math.cos(m)*p),m+=Us$1,e.lineTo(t+Math.sin(m)*h,s-Math.cos(m)*p),e.closePath();break;case`rectRounded`:c=p*.516,l=p-c,r=Math.cos(m+Lt$2)*l,d=Math.cos(m+Lt$2)*(n?n/2-c:l),a=Math.sin(m+Lt$2)*l,f=Math.sin(m+Lt$2)*(n?n/2-c:l),e.arc(t-d,s-a,c,m-L$1,m-V),e.arc(t+f,s-r,c,m-V,m),e.arc(t+d,s+a,c,m,m+V),e.arc(t-f,s+r,c,m+V,m+L$1),e.closePath();break;case`rect`:if(!g){l=Math.SQRT1_2*p,h=n?n/2:l,e.rect(t-h,s-l,2*h,2*l);break}m+=Lt$2;case`rectRot`:d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,f=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+f,s-r),e.lineTo(t+d,s+a),e.lineTo(t-f,s+r),e.closePath();break;case`crossRot`:m+=Lt$2;case`cross`:d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,f=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+d,s+a),e.moveTo(t+f,s-r),e.lineTo(t-f,s+r);break;case`star`:d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,f=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+d,s+a),e.moveTo(t+f,s-r),e.lineTo(t-f,s+r),m+=Lt$2,d=Math.cos(m)*(n?n/2:p),r=Math.cos(m)*p,a=Math.sin(m)*p,f=Math.sin(m)*(n?n/2:p),e.moveTo(t-d,s-a),e.lineTo(t+d,s+a),e.moveTo(t+f,s-r),e.lineTo(t-f,s+r);break;case`line`:r=n?n/2:Math.cos(m)*p,a=Math.sin(m)*p,e.moveTo(t-r,s-a),e.lineTo(t+r,s+a);break;case`dash`:e.moveTo(t,s),e.lineTo(t+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:e.closePath();break}e.fill(),i.borderWidth>0&&e.stroke()}}function rt$1(e,i,t){return t=t||.5,!i||e&&e.x>i.left-t&&e.x<i.right+t&&e.y>i.top-t&&e.y<i.bottom+t}function ge$1(e,i){e.save(),e.beginPath(),e.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),e.clip()}function pe$1(e){e.restore()}function bn$2(e,i,t,s,n){if(!i)return e.lineTo(t.x,t.y);if(n===`middle`){let o=(i.x+t.x)/2;e.lineTo(o,i.y),e.lineTo(o,t.y)}else n===`after`!=!!s?e.lineTo(i.x,t.y):e.lineTo(t.x,i.y);e.lineTo(t.x,t.y)}function xn$2(e,i,t,s){if(!i)return e.lineTo(t.x,t.y);e.bezierCurveTo(s?i.cp1x:i.cp2x,s?i.cp1y:i.cp2y,s?t.cp2x:t.cp1x,s?t.cp2y:t.cp1y,t.x,t.y)}function Nr$2(e,i){i.translation&&e.translate(i.translation[0],i.translation[1]),O(i.rotation)||e.rotate(i.rotation),i.color&&(e.fillStyle=i.color),i.textAlign&&(e.textAlign=i.textAlign),i.textBaseline&&(e.textBaseline=i.textBaseline)}function Vr$2(e,i,t,s,n){if(n.strikethrough||n.underline){let o=e.measureText(s),r=i-o.actualBoundingBoxLeft,a=i+o.actualBoundingBoxRight,l=t-o.actualBoundingBoxAscent,c=t+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=n.decorationWidth||2,e.moveTo(r,h),e.lineTo(a,h),e.stroke()}}function Hr$2(e,i){let t=e.fillStyle;e.fillStyle=i.color,e.fillRect(i.left,i.top,i.width,i.height),e.fillStyle=t}function wt$2(e,i,t,s,n,o={}){let r=z$1(i)?i:[i],a=o.strokeWidth>0&&o.strokeColor!==``,l,c;for(e.save(),e.font=n.string,Nr$2(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Hr$2(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),O(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,t,s,o.maxWidth)),e.fillText(c,t,s,o.maxWidth),Vr$2(e,t,s,c,o),s+=Number(n.lineHeight);
vendor: 5,249 bytes, line 2615
2615e.restore()}function Qt$1(e,i){let{x:t,y:s,w:n,h:o,radius:r}=i;e.arc(t+r.topLeft,s+r.topLeft,r.topLeft,1.5*L$1,L$1,!0),e.lineTo(t,s+o-r.bottomLeft),e.arc(t+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,L$1,V,!0),e.lineTo(t+n-r.bottomRight,s+o),e.arc(t+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,V,0,!0),e.lineTo(t+n,s+r.topRight),e.arc(t+n-r.topRight,s+r.topRight,r.topRight,0,-V,!0),e.lineTo(t+r.topLeft,s)}var jr$2=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/;var Yr$2=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function $r$2(e,i){let t=(``+e).match(jr$2);if(!t||t[1]===`normal`)return i*1.2;switch(e=+t[2],t[3]){case`px`:return e;case`%`:e/=100;break}return i*e}var Ur$1=e=>+e||0;function Xe(e,i){let t={},s=A$1(i),n=s?Object.keys(i):i,o=A$1(e)?s?r=>C(e[r],e[i[r]]):r=>e[r]:()=>e;for(let r of n)t[r]=Ur$1(o(r));return t}function Vi$1(e){return Xe(e,{top:`y`,right:`x`,bottom:`y`,left:`x`})}function Ct$1(e){return Xe(e,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`])}function K$1(e){let i=Vi$1(e);return i.width=i.left+i.right,i.height=i.top+i.bottom,i}function j$1(e,i){e=e||{},i=i||F.font;let t=C(e.size,i.size);typeof t==`string`&&(t=parseInt(t,10));let s=C(e.style,i.style);s&&!(``+s).match(Yr$2)&&(console.warn(`Invalid font style specified: "`+s+`"`),s=void 0);let n={family:C(e.family,i.family),lineHeight:$r$2(C(e.lineHeight,i.lineHeight),t),size:t,style:s,weight:C(e.weight,i.weight),string:``};return n.string=Wr$2(n),n}function te(e,i,t,s){let n=!0,o,r,a;for(o=0,r=e.length;o<r;++o)if(a=e[o],a!==void 0&&(i!==void 0&&typeof a==`function`&&(a=a(i),n=!1),t!==void 0&&z$1(a)&&(a=a[t%a.length],n=!1),a!==void 0))return s&&!n&&(s.cacheable=!1),a}function _n$2(e,i,t){let{min:s,max:n}=e,o=wi$1(i,(n-s)/2),r=(a,l)=>t&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function pt$2(e,i){return Object.assign(Object.create(e),i)}function Ke(e,i=[``],t,s,n=()=>e[0]){let o=t||e;typeof s>`u`&&(s=Mn$2(`_fallback`,e));return new Proxy({[Symbol.toStringTag]:`Object`,_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>Ke([a,...e],i,o,s)},{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return yn$2(a,l,()=>ta$1(l,i,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Js$2(a).includes(l)},ownKeys(a){return Js$2(a)},set(a,l,c){let h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function Et$2(e,i,t,s){let n={_cacheable:!1,_proxy:e,_context:i,_subProxy:t,_stack:new Set,_descriptors:Hi$1(e,s),setContext:o=>Et$2(e,o,t,s),override:o=>Et$2(e.override(o),i,t,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return yn$2(o,r,()=>Kr$2(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function Hi$1(e,i={scriptable:!0,indexable:!0}){let{_scriptable:t=i.scriptable,_indexable:s=i.indexable,_allKeys:n=i.allKeys}=e;return{allKeys:n,scriptable:t,indexable:s,isScriptable:ft$3(t)?t:()=>t,isIndexable:ft$3(s)?s:()=>s}}var Xr$2=(e,i)=>e?e+Ve$1(i):i;var ji$1=(e,i)=>A$1(i)&&e!==`adapters`&&(Object.getPrototypeOf(i)===null||i.constructor===Object);function yn$2(e,i,t){if(Object.prototype.hasOwnProperty.call(e,i)||i===`constructor`)return e[i];let s=t();return e[i]=s,s}function Kr$2(e,i,t){let{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=e,a=s[i];return ft$3(a)&&r.isScriptable(i)&&(a=qr$2(i,a,e,t)),z$1(a)&&a.length&&(a=Gr$2(i,a,e,r.isIndexable)),ji$1(i,a)&&(a=Et$2(a,n,o&&o[i],r)),a}function qr$2(e,i,t,s){let{_proxy:n,_context:o,_subProxy:r,_stack:a}=t;if(a.has(e))throw new Error(`Recursion detected: `+Array.from(a).join(`->`)+`->`+e);a.add(e);let l=i(o,r||s);return a.delete(e),ji$1(e,l)&&(l=Yi(n._scopes,n,e,l)),l}function Gr$2(e,i,t,s){let{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=t;if(typeof o.index<`u`&&s(e))return i[o.index%i.length];if(A$1(i[0])){let l=i,c=n._scopes.filter(h=>h!==l);i=[];for(let h of l){let d=Yi(c,n,e,h);i.push(Et$2(d,o,r&&r[e],a))}}return i}function vn$1(e,i,t){return ft$3(e)?e(i,t):e}var Jr$2=(e,i)=>e===!0?i:typeof e==`string`?gt$2(i,e):void 0;function Zr$2(e,i,t,s,n){for(let o of i){let r=Jr$2(t,o);if(r){e.add(r);let a=vn$1(r._fallback,t,n);if(typeof a<`u`&&a!==t&&a!==s)return a}else if(r===!1&&typeof s<`u`&&t!==s)return null}return!1}function Yi(e,i,t,s){let n=i._rootScopes,o=vn$1(i._fallback,t,s),r=[...e,...n],a=new Set;a.add(s);let l=Gs$2(a,r,t,o||t,s);return l===null||typeof o<`u`&&o!==t&&(l=Gs$2(a,r,o,l,s),l===null)?!1:Ke(Array.from(a),[``],n,o,()=>Qr$2(i,t,s))}function Gs$2(e,i,t,s,n){for(;t;)t=Zr$2(e,i,t,s,n);return t}function Qr$2(e,i,t){let s=e._getTarget();i in s||(s[i]={});let n=s[i];return z$1(n)&&A$1(t)?t:n||{}}function ta$1(e,i,t,s){let n;for(let o of i)if(n=Mn$2(Xr$2(o,e),t),typeof n<`u`)return ji$1(e,n)?Yi(t,s,e,n):n}function Mn$2(e,i){for(let t of i){if(!t)continue;let s=t[e];if(typeof s<`u`)return s}}function Js$2(e){let i=e._keys;
vendor: 4,760 bytes, line 2615
2615return i||(i=e._keys=ea$1(e._scopes)),i}function ea$1(e){let i=new Set;for(let t of e)for(let s of Object.keys(t).filter(n=>!n.startsWith(`_`)))i.add(s);return Array.from(i)}function $i$1(e,i,t,s){let{iScale:n}=e,{key:o=`r`}=this._parsing,r=new Array(s),a,l,c,h;for(a=0,l=s;a<l;++a)c=a+t,h=i[c],r[a]={r:n.parse(gt$2(h,o),c)};return r}var ia$1=Number.EPSILON||1e-14;var Xt$2=(e,i)=>i<e.length&&!e[i].skip&&e[i];var kn$2=e=>e===`x`?`y`:`x`;function sa$1(e,i,t,s){let n=e.skip?i:e,o=i,r=t.skip?i:t,a=We(o,n),l=We(r,o),c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;let d=s*c,f=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+f*(r.x-n.x),y:o.y+f*(r.y-n.y)}}}function na$1(e,i,t){let s=e.length,n,o,r,a,l,c=Xt$2(e,0);for(let h=0;h<s-1;++h)if(l=c,c=Xt$2(e,h+1),!(!l||!c)){if(Gt$1(i[h],0,ia$1)){t[h]=t[h+1]=0;continue}n=t[h]/i[h],o=t[h+1]/i[h],a=Math.pow(n,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),t[h]=n*r*i[h],t[h+1]=o*r*i[h])}}function oa$1(e,i,t=`x`){let s=kn$2(t),n=e.length,o,r,a,l=Xt$2(e,0);for(let c=0;c<n;++c){if(r=a,a=l,l=Xt$2(e,c+1),!a)continue;let h=a[t],d=a[s];r&&(o=(h-r[t])/3,a[`cp1${t}`]=h-o,a[`cp1${s}`]=d-o*i[c]),l&&(o=(l[t]-h)/3,a[`cp2${t}`]=h+o,a[`cp2${s}`]=d+o*i[c])}}function ra$1(e,i=`x`){let t=kn$2(i),s=e.length,n=Array(s).fill(0),o=Array(s),r,a,l,c=Xt$2(e,0);for(r=0;r<s;++r)if(a=l,l=c,c=Xt$2(e,r+1),!!l){if(c){let h=c[i]-l[i];n[r]=h!==0?(c[t]-l[t])/h:0}o[r]=a?c?nt$1(n[r-1])!==nt$1(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}na$1(e,n,o),oa$1(e,o,i)}function Ie$2(e,i,t){return Math.max(Math.min(e,t),i)}function aa$1(e,i){let t,s,n,o,r,a=rt$1(e[0],i);for(t=0,s=e.length;t<s;++t)r=o,o=a,a=t<s-1&&rt$1(e[t+1],i),o&&(n=e[t],r&&(n.cp1x=Ie$2(n.cp1x,i.left,i.right),n.cp1y=Ie$2(n.cp1y,i.top,i.bottom)),a&&(n.cp2x=Ie$2(n.cp2x,i.left,i.right),n.cp2y=Ie$2(n.cp2y,i.top,i.bottom)))}function Sn$2(e,i,t,s,n){let o,r,a,l;if(i.spanGaps&&(e=e.filter(c=>!c.skip)),i.cubicInterpolationMode===`monotone`)ra$1(e,n);else{let c=s?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=sa$1(c,a,e[Math.min(o+1,r-(s?0:1))%r],i.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}i.capBezierPoints&&aa$1(e,t)}function qe(){return typeof window<`u`&&typeof document<`u`}function Ge(e){let i=e.parentNode;return i&&i.toString()===`[object ShadowRoot]`&&(i=i.host),i}function Ne$1(e,i,t){let s;return typeof e==`string`?(s=parseInt(e,10),e.indexOf(`%`)!==-1&&(s=s/100*i.parentNode[t])):s=e,s}var Je$1=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function la$1(e,i){return Je$1(e).getPropertyValue(i)}var ca$1=[`top`,`right`,`bottom`,`left`];function Rt$1(e,i,t){let s={};t=t?`-`+t:``;for(let n=0;n<4;n++){let o=ca$1[n];s[o]=parseFloat(e[i+`-`+o+t])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}var ha$1=(e,i,t)=>(e>0||i>0)&&(!t||!t.shadowRoot);function da$1(e,i){let t=e.touches,s=t&&t.length?t[0]:e,{offsetX:n,offsetY:o}=s,r=!1,a,l;if(ha$1(n,o,e.target))a=n,l=o;else{let c=i.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Pt$2(e,i){if(`native`in e)return e;let{canvas:t,currentDevicePixelRatio:s}=i,n=Je$1(t),o=n.boxSizing===`border-box`,r=Rt$1(n,`padding`),a=Rt$1(n,`border`,`width`),{x:l,y:c,box:h}=da$1(e,t),d=r.left+(h&&a.left),f=r.top+(h&&a.top),{width:u,height:g}=i;return o&&(u-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-d)/u*t.width/s),y:Math.round((c-f)/g*t.height/s)}}function fa$1(e,i,t){let s,n;if(i===void 0||t===void 0){let o=e&&Ge(e);if(!o)i=e.clientWidth,t=e.clientHeight;else{let r=o.getBoundingClientRect(),a=Je$1(o),l=Rt$1(a,`border`,`width`),c=Rt$1(a,`padding`);i=r.width-c.width-l.width,t=r.height-c.height-l.height,s=Ne$1(a.maxWidth,o,`clientWidth`),n=Ne$1(a.maxHeight,o,`clientHeight`)}}return{width:i,height:t,maxWidth:s||Be,maxHeight:n||Be}}var Mt$3=e=>Math.round(e*10)/10;function wn$2(e,i,t,s){let n=Je$1(e),o=Rt$1(n,`margin`),r=Ne$1(n.maxWidth,e,`clientWidth`)||Be,a=Ne$1(n.maxHeight,e,`clientHeight`)||Be,l=fa$1(e,i,t),{width:c,height:h}=l;if(n.boxSizing===`content-box`){let f=Rt$1(n,`border`,`width`),u=Rt$1(n,`padding`);c-=u.width+f.width,h-=u.height+f.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Mt$3(Math.min(c,r,l.maxWidth)),h=Mt$3(Math.min(h,a,l.maxHeight)),c&&!h&&(h=Mt$3(c/2)),(i!==void 0||t!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Mt$3(Math.floor(h*s))),{width:c,height:h}}function Ui$1(e,i,t){let s=i||1,n=Mt$3(e.height*s),o=Mt$3(e.width*s);e.height=Mt$3(e.height),e.width=Mt$3(e.width);let r=e.canvas;return r.style&&(t||!r.style.height&&!r.style.width)&&(r.style.height=`${e.height}px`,r.style.width=`${e.width}px`),e.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(e.currentDevicePixelRatio=s,r.height=n,r.width=o,e.ctx.setTransform(s,
vendor: 4,254 bytes, line 2615
26150,0,s,0,0),!0):!1}var Cn$1=(function(){let e=!1;try{let i={get passive(){return e=!0,!1}};qe()&&(window.addEventListener(`test`,null,i),window.removeEventListener(`test`,null,i))}catch(i){}return e})();function Xi(e,i){let t=la$1(e,i),s=t&&t.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function vt$2(e,i,t,s){return{x:e.x+t*(i.x-e.x),y:e.y+t*(i.y-e.y)}}function Pn$2(e,i,t,s){return{x:e.x+t*(i.x-e.x),y:s===`middle`?t<.5?e.y:i.y:s===`after`?t<1?e.y:i.y:t>0?i.y:e.y}}function Dn$1(e,i,t,s){let n={x:e.cp2x,y:e.cp2y},o={x:i.cp1x,y:i.cp1y},r=vt$2(e,n,t),a=vt$2(n,o,t),l=vt$2(o,i,t);return vt$2(vt$2(r,a,t),vt$2(a,l,t),t)}var ua$1=function(e,i){return{x(t){return e+e+i-t},setWidth(t){i=t},textAlign(t){return t===`center`?t:t===`right`?`left`:`right`},xPlus(t,s){return t-s},leftForLtr(t,s){return t-s}}};var ga$1=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,i){return e+i},leftForLtr(e,i){return e}}};function Ft$2(e,i,t){return e?ua$1(i,t):ga$1()}function Ki$1(e,i){let t,s;(i===`ltr`||i===`rtl`)&&(t=e.canvas.style,s=[t.getPropertyValue(`direction`),t.getPropertyPriority(`direction`)],t.setProperty(`direction`,i,`important`),e.prevTextDirection=s)}function qi(e,i){i!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty(`direction`,i[0],i[1]))}function On$2(e){return e===`angle`?{between:Jt,compare:Tr$2,normalize:U$1}:{between:lt$1,compare:(i,t)=>i-t,normalize:i=>i}}function Zs$2({start:e,end:i,count:t,loop:s,style:n}){return{start:e%t,end:i%t,loop:s&&(i-e+1)%t===0,style:n}}function pa$1(e,i,t){let{property:s,start:n,end:o}=t,{between:r,normalize:a}=On$2(s),l=i.length,{start:c,end:h,loop:d}=e,f,u;if(d){for(c+=l,h+=l,f=0,u=l;f<u&&r(a(i[c%l][s]),n,o);++f)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:e.style}}function Gi$1(e,i,t){if(!t)return[e];let{property:s,start:n,end:o}=t,r=i.length,{compare:a,between:l,normalize:c}=On$2(s),{start:h,end:d,loop:f,style:u}=pa$1(e,i,t),g=[],p=!1,m=null,x,b,y,M=()=>l(n,y,x)&&a(n,y)!==0,_=()=>a(o,x)===0||l(o,y,x),v=()=>p||M(),S=()=>!p||_();for(let k=h,w=h;k<=d;++k)b=i[k%r],!b.skip&&(x=c(b[s]),x!==y&&(p=l(x,n,o),m===null&&v()&&(m=a(x,n)===0?k:w),m!==null&&S()&&(g.push(Zs$2({start:m,end:k,loop:f,count:r,style:u})),m=null),w=k,y=x));return m!==null&&g.push(Zs$2({start:m,end:d,loop:f,count:r,style:u})),g}function Ji$1(e,i){let t=[],s=e.segments;for(let n=0;n<s.length;n++){let o=Gi$1(s[n],e.points,i);o.length&&t.push(...o)}return t}function ma$1(e,i,t,s){let n=0,o=i-1;if(t&&!s)for(;n<i&&!e[n].skip;)n++;for(;n<i&&e[n].skip;)n++;for(n%=i,t&&(o+=n);o>n&&e[o%i].skip;)o--;return o%=i,{start:n,end:o}}function ba$1(e,i,t,s){let n=e.length,o=[],r=i,a=e[i],l;for(l=i+1;l<=t;++l){let c=e[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:i%n,end:(l-1)%n,loop:s}),i=r=c.stop?l:null):(r=l,a.skip&&(i=l)),a=c}return r!==null&&o.push({start:i%n,end:r%n,loop:s}),o}function An(e,i){let t=e.points,s=e.options.spanGaps,n=t.length;if(!n)return[];let o=!!e._loop,{start:r,end:a}=ma$1(t,n,o,s);if(s===!0)return Qs$2(e,[{start:r,end:a,loop:o}],t,i);return Qs$2(e,ba$1(t,r,a<r?a+n:a,!!e._fullLoop&&r===0&&a===n-1),t,i)}function Qs$2(e,i,t,s){return!s||!s.setContext||!t?i:xa$1(e,i,t,s)}function xa$1(e,i,t,s){let n=e._chart.getContext(),o=tn$1(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=t.length,c=[],h=o,d=i[0].start,f=d;function u(g,p,m,x){let b=a?-1:1;if(g!==p){for(g+=l;t[g%l].skip;)g-=b;for(;t[p%l].skip;)p+=b;g%l!==p%l&&(c.push({start:g%l,end:p%l,loop:m,style:x}),h=x,d=p%l)}}for(let g of i){d=a?d:g.start;let p=t[d%l],m;for(f=d+1;f<=g.end;f++){let x=t[f%l];m=tn$1(s.setContext(pt$2(n,{type:`segment`,p0:p,p1:x,p0DataIndex:(f-1)%l,p1DataIndex:f%l,datasetIndex:r}))),_a$1(m,h)&&u(d,f-1,g.loop,h),p=x,h=m}d<f-1&&u(d,f-1,g.loop,h)}return c}function tn$1(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function _a$1(e,i){if(!i)return!1;let t=[],s=function(n,o){return zi$1(o)?(t.includes(o)||t.push(o),t.indexOf(o)):o};return JSON.stringify(e,s)!==JSON.stringify(i,s)}function Fe$2(e,i,t){return e.options.clip?e[t]:i[t]}function ya$1(e,i){let{xScale:t,yScale:s}=e;
vendor: 11,896 bytes, line 2615
2615return t&&s?{left:Fe$2(t,i,`left`),right:Fe$2(t,i,`right`),top:Fe$2(s,i,`top`),bottom:Fe$2(s,i,`bottom`)}:i}function Zi$1(e,i){let t=i._clip;if(t.disabled)return!1;let s=ya$1(i,e.chartArea);return{left:t.left===!1?0:s.left-(t.left===!0?0:t.left),right:t.right===!1?e.width:s.right+(t.right===!0?0:t.right),top:t.top===!1?0:s.top-(t.top===!0?0:t.top),bottom:t.bottom===!1?e.height:s.bottom+(t.bottom===!0?0:t.bottom)}}var hs$2=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(i,t,s,n){let o=t.listeners[n],r=t.duration;o.forEach(a=>a({chart:i,initial:t.initial,numSteps:r,currentStep:Math.min(s-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Ri$1.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(i=Date.now()){let t=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;let o=s.items,r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(i),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,i,`progress`)),o.length||(s.running=!1,this._notify(n,s,i,`complete`),s.initial=!1),t+=o.length}),this._lastDate=i,t===0&&(this._running=!1)}_getAnims(i){let t=this._charts,s=t.get(i);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(i,s)),s}listen(i,t,s){this._getAnims(i).listeners[t].push(s)}add(i,t){!t||!t.length||this._getAnims(i).items.push(...t)}has(i){return this._getAnims(i).items.length>0}start(i){let t=this._charts.get(i);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(i){if(!this._running)return!1;let t=this._charts.get(i);return!(!t||!t.running||!t.items.length)}stop(i){let t=this._charts.get(i);if(!t||!t.items.length)return;let s=t.items,n=s.length-1;for(;n>=0;--n)s[n].cancel();t.items=[],this._notify(i,t,Date.now(),`complete`)}remove(i){return this._charts.delete(i)}};var mt$3=new hs$2;var Tn$1=`transparent`;var va$1={boolean(e,i,t){return t>.5?i:e},color(e,i,t){let s=Bi$1(e||Tn$1),n=s.valid&&Bi$1(i||Tn$1);return n&&n.valid?n.mix(s,t).hexString():i},number(e,i,t){return e+(i-e)*t}};var ds$2=class{constructor(i,t,s,n){let o=t[s];n=te([i.to,n,o,i.from]);let r=te([i.from,o,n]);this._active=!0,this._fn=i.fn||va$1[i.type||typeof r],this._easing=$t$1[i.easing]||$t$1.linear,this._start=Math.floor(Date.now()+(i.delay||0)),this._duration=this._total=Math.floor(i.duration),this._loop=!!i.loop,this._target=t,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(i,t,s){if(this._active){this._notify(!1);let n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,i.duration)),this._total+=o,this._loop=!!i.loop,this._to=te([i.to,t,n,i.from]),this._from=te([i.from,n,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(i){let t=i-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to,l;if(this._active=o!==a&&(r||t<s),!this._active){this._target[n]=a,this._notify(!0);return}if(t<0){this._target[n]=o;return}l=t/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){let i=this._promises||(this._promises=[]);return new Promise((t,s)=>{i.push({res:t,rej:s})})}_notify(i){let t=i?`res`:`rej`,s=this._promises||[];for(let n=0;n<s.length;n++)s[n][t]()}};var ri$2=class{constructor(i,t){this._chart=i,this._properties=new Map,this.configure(t)}configure(i){if(!A$1(i))return;let t=Object.keys(F.animation),s=this._properties;Object.getOwnPropertyNames(i).forEach(n=>{let o=i[n];if(!A$1(o))return;let r={};for(let a of t)r[a]=o[a];(z$1(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(i,t){let s=t.options,n=ka$1(i,s);if(!n)return[];let o=this._createAnimations(n,s);return s.$shared&&Ma$1(i.options.$animations,s).then(()=>{i.options=s},()=>{}),o}_createAnimations(i,t){let s=this._properties,n=[],o=i.$animations||(i.$animations={}),r=Object.keys(t),a=Date.now(),l;for(l=r.length-1;l>=0;--l){let c=r[l];if(c.charAt(0)===`$`)continue;if(c===`options`){n.push(...this._animateOptions(i,t));continue}let h=t[c],d=o[c],f=s.get(c);if(d)if(f&&d.active()){d.update(f,h,a);continue}else d.cancel();if(!f||!f.duration){i[c]=h;continue}o[c]=d=new ds$2(f,i,c,h),n.push(d)}return n}update(i,t){if(this._properties.size===0){Object.assign(i,t);return}let s=this._createAnimations(i,t);if(s.length)return mt$3.add(this._chart,s),!0}};function Ma$1(e,i){let t=[],s=Object.keys(i);for(let n=0;n<s.length;n++){let o=e[s[n]];o&&o.active()&&t.push(o.wait())}return Promise.all(t)}function ka$1(e,i){if(!i)return;let t=e.options;if(!t){e.options=i;return}return t.$shared&&(e.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function Ln$1(e,i){let t=e&&e.options||{},s=t.reverse,n=t.min===void 0?i:0,o=t.max===void 0?i:0;return{start:s?o:n,end:s?n:o}}function Sa$1(e,i,t){if(t===!1)return!1;let s=Ln$1(e,t),n=Ln$1(i,t);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function wa$1(e){let i,t,s,n;return A$1(e)?(i=e.top,t=e.right,s=e.bottom,n=e.left):i=t=s=n=e,{top:i,right:t,bottom:s,left:n,disabled:e===!1}}function Lo$2(e,i){let t=[],s=e._getSortedDatasetMetas(i),n,o;for(n=0,o=s.length;n<o;++n)t.push(s[n].index);return t}function Rn$2(e,i,t,s={}){let n=e.keys,o=s.mode===`single`,r,a,l,c;if(i===null)return;let h=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===t){if(h=!0,s.all)continue;break}c=e.values[l],N(c)&&(o||i===0||nt$1(i)===nt$1(c))&&(i+=c)}return!h&&!s.all?0:i}function Ca$1(e,i){let{iScale:t,vScale:s}=i,n=t.axis===`x`?`x`:`y`,o=s.axis===`x`?`x`:`y`,r=Object.keys(e),a=new Array(r.length),l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[n]:h,[o]:e[h]};return a}function Qi$1(e,i){let t=e&&e.options.stacked;return t||t===void 0&&i.stack!==void 0}function Pa$1(e,i,t){return`${e.id}.${i.id}.${t.stack||t.type}`}function Da$1(e){let{min:i,max:t,minDefined:s,maxDefined:n}=e.getUserBounds();return{min:s?i:Number.NEGATIVE_INFINITY,max:n?t:Number.POSITIVE_INFINITY}}function Oa$1(e,i,t){let s=e[i]||(e[i]={});return s[t]||(s[t]={})}function En$1(e,i,t,s){for(let n of i.getMatchingVisibleMetas(s).reverse()){let o=e[n.index];if(t&&o>0||!t&&o<0)return n.index}return null}function In$2(e,i){let{chart:t,_cachedMeta:s}=e,n=t._stacks||(t._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=Pa$1(o,r,s),d=i.length,f;for(let u=0;u<d;++u){let g=i[u],{[l]:p,[c]:m}=g,x=g._stacks||(g._stacks={});f=x[c]=Oa$1(n,h,p),f[a]=m,f._top=En$1(f,r,!0,s.type),f._bottom=En$1(f,r,!1,s.type);let b=f._visualValues||(f._visualValues={});b[a]=m}}function ts$2(e,i){let t=e.scales;return Object.keys(t).filter(s=>t[s].axis===i).shift()}function Aa$1(e,i){return pt$2(e,{active:!1,dataset:void 0,datasetIndex:i,index:i,mode:`default`,type:`dataset`})}function Ta$1(e,i,t){return pt$2(e,{active:!1,dataIndex:i,parsed:void 0,raw:void 0,element:t,index:i,mode:`default`,type:`data`})}function me$1(e,i){let t=e.controller.index,s=e.vScale&&e.vScale.axis;if(s){i=i||e._parsed;for(let n of i){let o=n._stacks;if(!o||o[s]===void 0||o[s][t]===void 0)return;delete o[s][t],o[s]._visualValues!==void 0&&o[s]._visualValues[t]!==void 0&&delete o[s]._visualValues[t]}}}var es$2=e=>e===`reset`||e===`none`;var Fn$1=(e,i)=>i?e:Object.assign({},e);var La$1=(e,i,t)=>e&&!i.hidden&&i._stacked&&{keys:Lo$2(t,!0),values:null};var Ot$3=(()=>{class e{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,s){this.chart=t,this._ctx=t.ctx,this.index=s,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Qi$1(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled(`filler`)&&console.warn(`Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options`)}updateIndex(t){this.index!==t&&me$1(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,s=this._cachedMeta,n=this.getDataset(),o=(f,u,g,p)=>f===`x`?u:f===`r`?p:g,r=s.xAxisID=C(n.xAxisID,ts$2(t,`x`)),a=s.yAxisID=C(n.yAxisID,ts$2(t,`y`)),l=s.rAxisID=C(n.rAxisID,ts$2(t,`r`)),c=s.indexAxis,h=s.iAxisID=o(c,r,a,l),d=s.vAxisID=o(c,a,r,l);s.xScale=this.getScaleForId(r),s.yScale=this.getScaleForId(a),s.rScale=this.getScaleForId(l),s.iScale=this.getScaleForId(h),s.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let s=this._cachedMeta;return t===s.iScale?s.vScale:s.iScale}reset(){this._update(`reset`)}_destroy(){let t=this._cachedMeta;this._data&&Ti(this._data,this),t._stacked&&me$1(t)}_dataCheck(){let t=this.getDataset(),s=t.data||(t.data=[]),n=this._data;if(A$1(s)){let o=this._cachedMeta;this._data=Ca$1(s,o)}else if(n!==s){if(n){Ti(n,this);let o=this._cachedMeta;me$1(o),o._parsed=[]}s&&Object.isExtensible(s)&&fn$3(s,this),this._syncList=[],this._data=s}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let s=this._cachedMeta,n=this.getDataset(),o=!1;this._dataCheck();let r=s._stacked;s._stacked=Qi$1(s.vScale,s),s.stack!==n.stack&&(o=!0,me$1(s),s.stack=n.stack),this._resyncElements(t),(o||r!==s._stacked)&&(In$2(this,s._parsed),s._stacked=Qi$1(s.vScale,s))}configure(){let t=this.chart.config,s=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),s,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,s){let{_cachedMeta:n,_data:o}=this,{iScale:r,_stacked:a}=n,l=r.axis,c=t===0&&s===o.length?!0:n._sorted,h=t>0&&n._parsed[t-1],d,f,u;if(this._parsing===!1)n._parsed=o,n._sorted=!0,u=o;else{z$1(o[t])?u=this.parseArrayData(n,o,t,s):A$1(o[t])?u=this.parseObjectData(n,o,t,s):u=this.parsePrimitiveData(n,o,t,s);let g=()=>f[l]===null||h&&f[l]<h[l];for(d=0;d<s;++d)n._parsed[d+t]=f=u[d],c&&(g()&&(c=!1),h=f);n._sorted=c}a&&In$2(this,u)}parsePrimitiveData(t,s,n,o){let{iScale:r,vScale:a}=t,l=r.axis,c=a.axis,h=r.getLabels(),d=r===a,f=new Array(o),u,g,p;for(u=0,g=o;u<g;++u)p=u+n,f[u]={[l]:d||r.parse(h[p],p),[c]:a.parse(s[p],p)};return f}parseArrayData(t,s,n,o){let{xScale:r,yScale:a}=t,l=new Array(o),c,h,d,f;for(c=0,h=o;c<h;++c)d=c+n,f=s[d],l[c]={x:r.parse(f[0],d),y:a.parse(f[1],d)};return l}parseObjectData(t,s,n,o){let{xScale:r,yScale:a}=t,{xAxisKey:l=`x`,yAxisKey:c=`y`}=this._parsing,h=new Array(o),d,f,u,g;for(d=0,f=o;d<f;++d)u=d+n,g=s[u],h[d]={x:r.parse(gt$2(g,l),u),y:a.parse(gt$2(g,c),u)};return h}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,s,n){let o=this.chart,r=this._cachedMeta,a=s[t.axis];return Rn$2({keys:Lo$2(o,!0),values:s._stacks[t.axis]._visualValues},a,r.index,{mode:n})}updateRangeFromParsed(t,s,n,o){let r=n[s.axis],a=r===null?NaN:r,l=o&&n._stacks[s.axis];o&&l&&(o.values=l,a=Rn$2(o,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,s){let n=this._cachedMeta,o=n._parsed,r=n._sorted&&t===n.iScale,a=o.length,l=this._getOtherScale(t),c=La$1(s,n,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:f}=Da$1(l),u,g;function p(){g=o[u];
vendor: 6,587 bytes, line 2615
2615let m=g[l.axis];return!N(g[t.axis])||d>m||f<m}for(u=0;u<a&&!(!p()&&(this.updateRangeFromParsed(h,t,g,c),r));++u);if(r){for(u=a-1;u>=0;--u)if(!p()){this.updateRangeFromParsed(h,t,g,c);break}}return h}getAllParsedValues(t){let s=this._cachedMeta._parsed,n=[],o,r,a;for(o=0,r=s.length;o<r;++o)a=s[o][t.axis],N(a)&&n.push(a);return n}getMaxOverflow(){return!1}getLabelAndValue(t){let s=this._cachedMeta,n=s.iScale,o=s.vScale,r=this.getParsed(t);return{label:n?``+n.getLabelForValue(r[n.axis]):``,value:o?``+o.getLabelForValue(r[o.axis]):``}}_update(t){let s=this._cachedMeta;this.update(t||`default`),s._clip=wa$1(C(this.options.clip,Sa$1(s.xScale,s.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,s=this.chart,n=this._cachedMeta,o=n.data||[],r=s.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||o.length-l,h=this.options.drawActiveElementsOnTop,d;for(n.dataset&&n.dataset.draw(t,r,l,c),d=l;d<l+c;++d){let f=o[d];f.hidden||(f.active&&h?a.push(f):f.draw(t,r))}for(d=0;d<a.length;++d)a[d].draw(t,r)}getStyle(t,s){let n=s?`active`:`default`;return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,s,n){let o=this.getDataset(),r;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];r=a.$context||(a.$context=Ta$1(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=o.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Aa$1(this.chart.getContext(),this.index)),r.dataset=o,r.index=r.datasetIndex=this.index;return r.active=!!s,r.mode=n,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,s){return this._resolveElementOptions(this.dataElementType.id,s,t)}_resolveElementOptions(t,s=`default`,n){let o=s===`active`,r=this._cachedDataOpts,a=t+`-`+s,l=r[a],c=this.enableOptionSharing&&qt$3(n);if(l)return Fn$1(l,c);let h=this.chart.config,d=h.datasetElementScopeKeys(this._type,t),f=o?[`${t}Hover`,`hover`,t,``]:[t,``],u=h.getOptionScopes(this.getDataset(),d),g=Object.keys(F.elements[t]),p=()=>this.getContext(n,o,s),m=h.resolveNamedOptions(u,g,p,f);return m.$shared&&(m.$shared=c,r[a]=Object.freeze(Fn$1(m,c))),m}_resolveAnimations(t,s,n){let o=this.chart,r=this._cachedDataOpts,a=`animation-${s}`,l=r[a];if(l)return l;let c;if(o.options.animation!==!1){let d=this.chart.config,f=d.datasetAnimationScopeKeys(this._type,s),u=d.getOptionScopes(this.getDataset(),f);c=d.createResolver(u,this.getContext(t,n,s))}let h=new ri$2(o,c&&c.animations);return c&&c._cacheable&&(r[a]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,s){return!s||es$2(t)||this.chart._animationsDisabled}_getSharedOptions(t,s){let n=this.resolveDataElementOptions(t,s),o=this._sharedOptions,r=this.getSharedOptions(n),a=this.includeOptions(s,r)||r!==o;return this.updateSharedOptions(r,s,n),{sharedOptions:r,includeOptions:a}}updateElement(t,s,n,o){es$2(o)?Object.assign(t,n):this._resolveAnimations(s,o).update(t,n)}updateSharedOptions(t,s,n){t&&!es$2(s)&&this._resolveAnimations(void 0,s).update(t,n)}_setStyle(t,s,n,o){t.active=o;let r=this.getStyle(s,o);this._resolveAnimations(s,n,o).update(t,{options:!o&&this.getSharedOptions(r)||r})}removeHoverStyle(t,s,n){this._setStyle(t,n,`active`,!1)}setHoverStyle(t,s,n){this._setStyle(t,n,`active`,!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,`active`,!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,`active`,!0)}_resyncElements(t){let s=this._data,n=this._cachedMeta.data;for(let[l,c,h]of this._syncList)this[l](c,h);this._syncList=[];let o=n.length,r=s.length,a=Math.min(r,o);a&&this.parse(0,a),r>o?this._insertElements(o,r-o,t):r<o&&this._removeElements(r,o-r)}_insertElements(t,s,n=!0){let o=this._cachedMeta,r=o.data,a=t+s,l,c=h=>{for(h.length+=s,l=h.length-1;l>=a;l--)h[l]=h[l-s]};for(c(r),l=t;l<a;++l)r[l]=new this.dataElementType;this._parsing&&c(o._parsed),this.parse(t,s),n&&this.updateElements(r,t,s,`reset`)}updateElements(t,s,n,o){}_removeElements(t,s){let n=this._cachedMeta;if(this._parsing){let o=n._parsed.splice(t,s);n._stacked&&me$1(n,o)}n.data.splice(t,s)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[s,n,o]=t;this[s](n,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync([`_insertElements`,this.getDataset().data.length-t,t])}_onDataPop(){this._sync([`_removeElements`,this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync([`_removeElements`,0,1])}_onDataSplice(t,s){s&&this._sync([`_removeElements`,t,s]);let n=arguments.length-2;n&&this._sync([`_insertElements`,t,n])}_onDataUnshift(){this._sync([`_insertElements`,0,arguments.length])}}return e})();function Ra$1(e,i){if(!e._cache.$bar){let t=e.getMatchingVisibleMetas(i),s=[];for(let n=0,o=t.length;n<o;n++)s=s.concat(t[n].controller.getAllParsedValues(e));e._cache.$bar=Li$1(s.sort((n,o)=>n-o))}return e._cache.$bar}function Ea$1(e){let i=e.iScale,t=Ra$1(i,e.type),s=i._length,n,o,r,a,l=()=>{r===32767||r===-32768||(qt$3(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=t.length;n<o;++n)r=i.getPixelForValue(t[n]),l();for(a=void 0,n=0,o=i.ticks.length;n<o;++n)r=i.getPixelForTick(n),l();return s}function Ia$1(e,i,t,s){let n=t.barThickness,o,r;return O(n)?(o=i.min*t.categoryPercentage,r=t.barPercentage):(o=n*s,r=1),{chunk:o/s,ratio:r,start:i.pixels[e]-o/2}}function Fa$1(e,i,t,s){let n=i.pixels,o=n[e],r=e>0?n[e-1]:null,a=e<n.length-1?n[e+1]:null,l=t.categoryPercentage;r===null&&(r=o-(a===null?i.end-i.start:a-o)),a===null&&(a=o+o-r);let c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/s,ratio:t.barPercentage,start:c}}function za$1(e,i,t,s){let n=t.parse(e[0],s),o=t.parse(e[1],s),r=Math.min(n,o),a=Math.max(n,o),l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),i[t.axis]=c,i._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function Ro$2(e,i,t,s){return z$1(e)?za$1(e,i,t,s):i[t.axis]=t.parse(e,s),i}function zn$1(e,i,t,s){let n=e.iScale,o=e.vScale,r=n.getLabels(),a=n===o,l=[],c,h,d,f;for(c=t,h=t+s;c<h;++c)f=i[c],d={},d[n.axis]=a||n.parse(r[c],c),l.push(Ro$2(f,d,o,c));return l}function is$2(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function Ba$1(e,i,t){return e!==0?nt$1(e):(i.isHorizontal()?1:-1)*(i.min>=t?1:-1)}function Wa(e){let i,t,s,n,o;return e.horizontal?(i=e.base>e.x,t=`left`,s=`right`):(i=e.base<e.y,t=`bottom`,s=`top`),i?(n=`end`,o=`start`):(n=`start`,o=`end`),{start:t,end:s,reverse:i,top:n,bottom:o}}
2615function Na$1(e,i,t,s){let n=i.borderSkipped,o={};if(!n){e.borderSkipped=o;return}if(n===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:r,end:a,reverse:l,top:c,bottom:h}=Wa(e);n===`middle`&&t&&(e.enableBorderRadius=!0,(t._top||0)===s?n=c:(t._bottom||0)===s?n=h:(o[Bn$1(h,r,a,l)]=!0,n=c)),o[Bn$1(n,r,a,l)]=!0,e.borderSkipped=o}function Bn$1(e,i,t,s){return s?(e=Va$1(e,i,t),e=Wn$1(e,t,i)):e=Wn$1(e,i,t),e}function Va$1(e,i,t){return e===i?t:e===t?i:e}function Wn$1(e,i,t){return e===`start`?i:e===`end`?t:e}function Ha(e,{inflateAmount:i},t){e.inflateAmount=i===`auto`?t===1?.33:0:i}var ja$1=(()=>{class e extends Ot$3{static id=`bar`;static defaults={datasetElementType:!1,dataElementType:`bar`,categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:`number`,properties:[`x`,`y`,`base`,`width`,`height`]}}};static overrides={scales:{_index_:{type:`category`,offset:!0,grid:{offset:!0}},_value_:{type:`linear`,beginAtZero:!0}}};parsePrimitiveData(t,s,n,o){return zn$1(t,s,n,o)}parseArrayData(t,s,n,o){return zn$1(t,s,n,o)}parseObjectData(t,s,n,o){let{iScale:r,vScale:a}=t,{xAxisKey:l=`x`,yAxisKey:c=`y`}=this._parsing,h=r.axis===`x`?l:c,d=a.axis===`x`?l:c,f=[],u,g,p,m;for(u=n,g=n+o;u<g;++u)m=s[u],p={},p[r.axis]=r.parse(gt$2(m,h),u),f.push(Ro$2(gt$2(m,d),p,a,u));return f}updateRangeFromParsed(t,s,n,o){super.updateRangeFromParsed(t,s,n,o);let r=n._custom;r&&s===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let{iScale:n,vScale:o}=this._cachedMeta,r=this.getParsed(t),a=r._custom,l=is$2(a)?`[`+a.start+`, `+a.end+`]`:``+o.getLabelForValue(r[o.axis]);return{label:``+n.getLabelForValue(r[n.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let s=this._cachedMeta;this.updateElements(s.data,0,s.data.length,t)}updateElements(t,s,n,o){let r=o===`reset`,{index:a,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),h=l.isHorizontal(),d=this._getRuler(),{sharedOptions:f,includeOptions:u}=this._getSharedOptions(s,o);for(let g=s;g<s+n;g++){let p=this.getParsed(g),m=r||O(p[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(g),x=this._calculateBarIndexPixels(g,d),b=(p._stacks||{})[l.axis],y={horizontal:h,base:m.base,enableBorderRadius:!b||is$2(p._custom)||a===b._top||a===b._bottom,x:h?m.head:x.center,y:h?x.center:m.head,height:h?x.size:Math.abs(m.size),width:h?Math.abs(m.size):x.size};u&&(y.options=f||this.resolveDataElementOptions(g,t[g].active?`active`:o));let M=y.options||t[g].options;Na$1(y,M,b,a),Ha(y,M,d.ratio),this.updateElement(t[g],g,y,o)}}_getStacks(t,s){let{iScale:n}=this._cachedMeta,o=n.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),r=n.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(s),c=l&&l[n.axis],h=d=>{let f=d._parsed.find(g=>g[n.axis]===c),u=f&&f[d.vScale.axis];if(O(u)||isNaN(u))return!0};for(let d of o)if(!(s!==void 0&&h(d))&&((r===!1||a.indexOf(d.stack)===-1||r===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,s=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===s).shift()}_getAxis(){let t={},s=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[C(this.chart.options.indexAxis===`x`?n.xAxisID:n.yAxisID,s)]=!0;return Object.keys(t)}_getStackIndex(t,s,n){let o=this._getStacks(t,n),r=s!==void 0?o.indexOf(s):-1;return r===-1?o.length-1:r}_getRuler(){let t=this.options,s=this._cachedMeta,n=s.iScale,o=[],r,a;for(r=0,a=s.data.length;r<a;++r)o.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));let l=t.barThickness;return{min:l||Ea$1(s),pixels:o,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:s,_stacked:n,index:o},options:{base:r,minBarLength:a}}=this,l=r||0,c=this.getParsed(t),h=c._custom,d=is$2(h),f=c[s.axis],u=0,g=n?this.applyStack(s,c,n):f,p,m;g!==f&&(u=g-f,g=f),d&&(f=h.barStart,g=h.barEnd-h.barStart,f!==0&&nt$1(f)!==nt$1(h.barEnd)&&(u=0),u+=f);let x=!O(r)&&!d?r:u,b=s.getPixelForValue(x);if(this.chart.getDataVisibility(t)?p=s.getPixelForValue(u+g):p=b,m=p-b,Math.abs(m)<a){m=Ba$1(m,s,l)*a,f===l&&(b-=m/2);let y=s.getPixelForDecimal(0),M=s.getPixelForDecimal(1);b=Math.max(Math.min(b,Math.max(y,M)),Math.min(y,M)),p=b+m,n&&!d&&(c._stacks[s.axis]._visualValues[o]=s.getValueForPixel(p)-s.getValueForPixel(b))}if(b===s.getPixelForValue(l)){let y=nt$1(m)*s.getLineWidthForValue(l)/2;b+=y,m-=y}return{size:m,base:b,head:p,center:p+m/2}}_calculateBarIndexPixels(t,s){let n=s.scale,o=this.options,r=o.skipNull,a=C(o.maxBarThickness,Infinity),l,c,h=this._getAxisCount();if(s.grouped){let d=r?this._getStackCount(t):s.stackCount,f=o.barThickness===`flex`?Fa$1(t,s,o,d*h):Ia$1(t,s,o,d*h),u=this.chart.options.indexAxis===`x`?this.getDataset().xAxisID:this.getDataset().yAxisID,g=this._getAxis().indexOf(C(u,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0)+g;l=f.start+f.chunk*p+f.chunk/2,c=Math.min(a,f.chunk*f.ratio)}else l=n.getPixelForValue(this.getParsed(t)[n.axis],t),c=Math.min(a,s.min*s.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){let t=this._cachedMeta,s=t.vScale,n=t.data,o=n.length,r=0;for(;r<o;++r)this.getParsed(r)[s.axis]!==null&&!n[r].hidden&&n[r].draw(this._ctx)}}return e})();var Ya=(()=>{class e extends Ot$3{static id=`bubble`;static defaults={datasetElementType:!1,dataElementType:`point`,animations:{numbers:{type:`number`,properties:[`x`,`y`,`borderWidth`,`radius`]}}};static overrides={scales:{x:{type:`linear`},y:{type:`linear`}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,s,n,o){let r=super.parsePrimitiveData(t,s,n,o);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+n).radius;return r}parseArrayData(t,s,n,o){let r=super.parseArrayData(t,s,n,o);for(let a=0;a<r.length;a++){let l=s[n+a];r[a]._custom=C(l[2],this.resolveDataElementOptions(a+n).radius)}return r}parseObjectData(t,s,n,o){let r=super.parseObjectData(t,s,n,o);for(let a=0;a<r.length;a++){let l=s[n+a];r[a]._custom=C(l&&l.r&&+l.r,this.resolveDataElementOptions(a+n).radius)}return r}getMaxOverflow(){let t=this._cachedMeta.data,s=0;for(let n=t.length-1;n>=0;--n)s=Math.max(s,t[n].size(this.resolveDataElementOptions(n))/2);return s>0&&s}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:r}=s,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y),h=a._custom;return{label:n[t]||``,value:`(`+l+`, `+c+(h?`, `+h:``)+`)`}}update(t){let s=this._cachedMeta.data;this.updateElements(s,0,s.length,t)}updateElements(t,s,n,o){let r=o===`reset`,{iScale:a,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(s,o),d=a.axis,f=l.axis;for(let u=s;u<s+n;u++){let g=t[u],p=!r&&this.getParsed(u),m={},x=m[d]=r?a.getPixelForDecimal(.5):a.getPixelForValue(p[d]),b=m[f]=r?l.getBasePixel():l.getPixelForValue(p[f]);m.skip=isNaN(x)||isNaN(b),h&&(m.options=c||this.resolveDataElementOptions(u,g.active?`active`:o),r&&(m.options.radius=0)),this.updateElement(g,u,m,o)}}resolveDataElementOptions(t,s){let n=this.getParsed(t),o=super.resolveDataElementOptions(t,s);o.$shared&&(o=Object.assign({},o,{$shared:!1}));let r=o.radius;return s!==`active`&&(o.radius=0),o.radius+=C(n&&n._custom,r),o}}return e})();function $a$1(e,i,t){let s=1,n=1,o=0,r=0;if(i<B){let a=e,l=a+i,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),f=Math.sin(l),u=(y,M,_)=>Jt(y,a,l,!0)?1:Math.max(M,M*t,_,_*t),g=(y,M,_)=>Jt(y,a,l,!0)?-1:Math.min(M,M*t,_,_*t),p=u(0,c,d),m=u(V,h,f),x=g(L$1,c,d),b=g(L$1+V,h,f);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,r=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}var ke$3=class extends Ot$3{static id=`doughnut`;static defaults={datasetElementType:!1,dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:`number`,properties:[`circumference`,`endAngle`,`innerRadius`,`outerRadius`,`startAngle`,`x`,`y`,`offset`,`borderWidth`,`spacing`]}}
vendor: 5,497 bytes, line 2615
2615,cutout:`50%`,rotation:0,circumference:360,radius:`100%`,spacing:0,indexAxis:`r`};static descriptors={_scriptable:i=>i!==`spacing`,_indexable:i=>i!==`spacing`&&!i.startsWith(`borderDash`)&&!i.startsWith(`hoverBorderDash`)};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){let t=i.data,{labels:{pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return t.labels.length&&t.datasets.length?t.labels.map((l,c)=>{let d=i.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!i.getDataVisibility(c),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:s,borderRadius:r&&(a||d.borderRadius),index:c}}):[]}},onClick(i,t,s){s.chart.toggleDataVisibility(t.index),s.chart.update()}}}};constructor(i,t){super(i,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(i,t){let s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=l=>+s[l];if(A$1(s[i])){let{key:l=`value`}=this._parsing;o=c=>+gt$2(s[c],l)}let r,a;for(r=i,a=i+t;r<a;++r)n._parsed[r]=o(r)}}_getRotation(){return it(this.options.rotation-90)}_getCircumference(){return it(this.options.circumference)}_getRotationExtents(){let i=B,t=-B;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){let n=this.chart.getDatasetMeta(s).controller,o=n._getRotation(),r=n._getCircumference();i=Math.min(i,o),t=Math.max(t,o+r)}return{rotation:i,circumference:t-i}}update(i){let{chartArea:s}=this.chart,n=this._cachedMeta,o=n.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-r)/2,0),l=Math.min(sn$2(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:f,ratioY:u,offsetX:g,offsetY:p}=$a$1(d,h,l),m=(s.width-r)/f,x=(s.height-r)/u,b=Math.max(Math.min(m,x)/2,0),y=wi$1(this.options.radius,b),_=(y-Math.max(y*l,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=p*y,n.total=this.calculateTotal(),this.outerRadius=y-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(o,0,o.length,i)}_circumference(i,t){let s=this.options,n=this._cachedMeta,o=this._getCircumference();return t&&s.animation.animateRotate||!this.chart.getDataVisibility(i)||n._parsed[i]===null||n.data[i].hidden?0:this.calculateCircumference(n._parsed[i]*o/B)}updateElements(i,t,s,n){let o=n===`reset`,r=this.chart,a=r.chartArea,c=r.options.animation,h=(a.left+a.right)/2,d=(a.top+a.bottom)/2,f=o&&c.animateScale,u=f?0:this.innerRadius,g=f?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(t,n),x=this._getRotation(),b;for(b=0;b<t;++b)x+=this._circumference(b,o);for(b=t;b<t+s;++b){let y=this._circumference(b,o),M=i[b],_={x:h+this.offsetX,y:d+this.offsetY,startAngle:x,endAngle:x+y,circumference:y,outerRadius:g,innerRadius:u};m&&(_.options=p||this.resolveDataElementOptions(b,M.active?`active`:n)),x+=y,this.updateElement(M,b,_,n)}}calculateTotal(){let i=this._cachedMeta,t=i.data,s=0,n;for(n=0;n<t.length;n++){let o=i._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!t[n].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(i){let t=this._cachedMeta.total;return t>0&&!isNaN(i)?B*(Math.abs(i)/t):0}getLabelAndValue(i){let t=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=Zt$1(t._parsed[i],s.options.locale);return{label:n[i]||``,value:o}}getMaxBorderWidth(i){let t=0,s=this.chart,n,o,r,a,l;if(!i){for(n=0,o=s.data.datasets.length;n<o;++n)if(s.isDatasetVisible(n)){r=s.getDatasetMeta(n),i=r.data,a=r.controller;break}}if(!i)return 0;for(n=0,o=i.length;n<o;++n)l=a.resolveDataElementOptions(n),l.borderAlign!==`inner`&&(t=Math.max(t,l.borderWidth||0,l.hoverBorderWidth||0));return t}getMaxOffset(i){let t=0;for(let s=0,n=i.length;s<n;++s){let o=this.resolveDataElementOptions(s);t=Math.max(t,o.offset||0,o.hoverOffset||0)}return t}_getRingWeightOffset(i){let t=0;for(let s=0;s<i;++s)this.chart.isDatasetVisible(s)&&(t+=this._getRingWeight(s));return t}_getRingWeight(i){return Math.max(C(this.chart.data.datasets[i].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};var Ua$1=(()=>{class e extends Ot$3{static id=`line`;static defaults={datasetElementType:`line`,dataElementType:`point`,showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:`category`},_value_:{type:`linear`}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let s=this._cachedMeta,{dataset:n,data:o=[],_dataset:r}=s,a=this.chart._animationsDisabled,{start:l,count:c}=Ii$1(s,o,a);this._drawStart=l,this._drawCount=c,Fi$1(s)&&(l=0,c=o.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=o;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:h},t),this.updateElements(o,l,c,t)}updateElements(t,s,n,o){let r=o===`reset`,{iScale:a,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,{sharedOptions:d,includeOptions:f}=this._getSharedOptions(s,o),u=a.axis,g=l.axis,{spanGaps:p,segment:m}
2615=this.options,x=It$2(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||r||o===`none`,y=s+n,M=t.length,_=s>0&&this.getParsed(s-1);for(let v=0;v<M;++v){let S=t[v],k=b?S:{};if(v<s||v>=y){k.skip=!0;continue}let w=this.getParsed(v),D=O(w[g]),P=k[u]=a.getPixelForValue(w[u],v),T=k[g]=r||D?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,w,c):w[g],v);k.skip=isNaN(P)||isNaN(T)||D,k.stop=v>0&&Math.abs(w[u]-_[u])>x,m&&(k.parsed=w,k.raw=h.data[v]),f&&(k.options=d||this.resolveDataElementOptions(v,S.active?`active`:o)),b||this.updateElement(S,v,k,o),_=w}}getMaxOverflow(){let t=this._cachedMeta,s=t.dataset,n=s.options&&s.options.borderWidth||0,o=t.data||[];if(!o.length)return n;let r=o[0].size(this.resolveDataElementOptions(0)),a=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(n,r,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}return e})();var ai$2=class extends Ot$3{static id=`polarArea`;static defaults={dataElementType:`arc`,animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:`number`,properties:[`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`]}},indexAxis:`r`,startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(i){let t=i.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:s,color:n}}=i.legend.options;return t.labels.map((o,r)=>{let l=i.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!i.getDataVisibility(r),index:r}})}return[]}},onClick(i,t,s){s.chart.toggleDataVisibility(t.index),s.chart.update()}}},scales:{r:{type:`radialLinear`,angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(i,t){super(i,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(i){let t=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=Zt$1(t._parsed[i].r,s.options.locale);return{label:n[i]||``,value:o}}parseObjectData(i,t,s,n){return $i$1.bind(this)(i,t,s,n)}update(i){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,i)}getMinMax(){let i=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return i.data.forEach((s,n)=>{let o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(o<t.min&&(t.min=o),o>t.max&&(t.max=o))}),t}_updateRadius(){let i=this.chart,t=i.chartArea,s=i.options,n=Math.min(t.right-t.left,t.bottom-t.top),o=Math.max(n/2,0),a=(o-Math.max(s.cutoutPercentage?o/100*s.cutoutPercentage:1,0))/i.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(i,t,s,n){let o=n===`reset`,r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,f=c.getIndexAngle(0)-.5*L$1,u=f,g,p=360/this.countVisibleElements();for(g=0;g<t;++g)u+=this._computeAngle(g,n,p);for(g=t;g<t+s;g++){let m=i[g],x=u,b=u+this._computeAngle(g,n,p),y=r.getDataVisibility(g)?c.getDistanceFromCenterForValue(this.getParsed(g).r):0;u=b,o&&(l.animateScale&&(y=0),l.animateRotate&&(x=b=f));let M={x:h,y:d,innerRadius:0,outerRadius:y,startAngle:x,endAngle:b,options:this.resolveDataElementOptions(g,m.active?`active`:n)};this.updateElement(m,g,M,n)}}countVisibleElements(){let i=this._cachedMeta,t=0;return i.data.forEach((s,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(i,t,s){return this.chart.getDataVisibility(i)?it(this.resolveDataElementOptions(i,t).angle||s):0}};var Ga=Object.freeze({__proto__:null,BarController:ja$1,BubbleController:Ya,DoughnutController:ke$3,LineController:Ua$1,PieController:(()=>{class e extends ke$3{static id=`pie`;static defaults={cutout:0,rotation:0,circumference:360,radius:`100%`}}return e})(),PolarAreaController:ai$2,RadarController:(()=>{class e extends Ot$3{static id=`radar`;static defaults={datasetElementType:`line`,dataElementType:`point`,indexAxis:`r`,showLine:!0,elements:{line:{fill:`start`}}};static overrides={aspectRatio:1,scales:{r:{type:`radialLinear`}}};getLabelAndValue(t){let s=this._cachedMeta.vScale,n=this.getParsed(t);return{label:s.getLabels()[t],value:``+s.getLabelForValue(n[s.axis])}}parseObjectData(t,s,n,o){return $i$1.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta,n=s.dataset,o=s.data||[],r=s.iScale.getLabels();if(n.points=o,t!==`resize`){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let l={_loop:!0,_fullLoop:r.length===o.length,options:a};this.updateElement(n,void 0,l,t)}this.updateElements(o,0,o.length,t)}updateElements(t,s,n,o){let r=this._cachedMeta.rScale,a=o===`reset`;for(let l=s;l<s+n;l++){let c=t[l],h=this.resolveDataElementOptions(l,c.active?`active`:o),d=r.getPointPositionForValue(l,this.getParsed(l).r),f=a?r.xCenter:d.x,u=a?r.yCenter:d.y,g={x:f,y:u,angle:d.angle,skip:isNaN(f)||isNaN(u),options:h};this.updateElement(c,l,g,o)}}}return e})(),ScatterController:(()=>{class e extends Ot$3{static id=`scatter`;static defaults={datasetElementType:!1,dataElementType:`point`,showLine:!1,fill:!1};static overrides={interaction:{mode:`point`},scales:{x:{type:`linear`},y:{type:`linear`}}};getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:r}=s,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y);return{label:n[t]||``,value:`(`+l+`, `+c+`)`}}update(t){let s=this._cachedMeta,{data:n=[]}=s,o=this.chart._animationsDisabled,{start:r,count:a}=Ii$1(s,n,o);if(this._drawStart=r,this._drawCount=a,Fi$1(s)&&(r=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:l,_dataset:c}=s;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=n;let h=this.resolveDatasetElementOptions(t);h.segment=this.options.segment,this.updateElement(l,void 0,{animated:!o,options:h},t)}else this.datasetElementType&&(delete s.dataset,this.datasetElementType=!1);this.updateElements(n,r,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement(`line`)),super.addElements()}updateElements(t,s,n,o){let r=o===`reset`,{iScale:a,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,d=this.resolveDataElementOptions(s,o),f=this.getSharedOptions(d),u=this.includeOptions(o,f),g=a.axis,p=l.axis,{spanGaps:m,segment:x}=this.options,b=It$2(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||r||o===`none`,M=s>0&&this.getParsed(s-1);for(let _=s;_<s+n;++_){let v=t[_],S=this.getParsed(_),k=y?v:{},w=O(S[p]),D=k[g]=a.getPixelForValue(S[g],_),P=k[p]=r||w?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,S,c):S[p],_);k.skip=isNaN(D)||isNaN(P)||w,k.stop=_>0&&Math.abs(S[g]-M[g])>b,x&&(k.parsed=S,k.raw=h.data[_]),u&&(k.options=f||this.resolveDataElementOptions(_,v.active?`active`:o)),y||this.updateElement(v,_,k,o),M=S}this.updateSharedOptions(f,o,d)}getMaxOverflow(){let t=this._cachedMeta,s=t.data||[];if(!this.options.showLine){let l=0;for(let c=s.length-1;c>=0;--c)l=Math.max(l,s[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}let n=t.dataset,o=n.options&&n.options.borderWidth||0;if(!s.length)return o;let r=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(o,r,a)/2}}return e})()});function zt$2(){throw new Error(`This method is not implemented: Check that a complete date adapter is provided.`)}var Ja$1={_date:class e{static override(i){Object.assign(e.prototype,i
vendor: 32,718 bytes, line 2615
2615)}options;constructor(i){this.options=i||{}}init(){}formats(){return zt$2()}parse(){return zt$2()}format(){return zt$2()}add(){return zt$2()}diff(){return zt$2()}startOf(){return zt$2()}endOf(){return zt$2()}}};function Za(e,i,t,s){let{controller:n,data:o,_sorted:r}=e,a=n._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&i===a.axis&&i!==`r`&&r&&o.length){let c=a._reversePixels?cn$3:ot$1;if(s){if(n._sharedOptions){let h=o[0],d=typeof h.getRange==`function`&&h.getRange(i);if(d){let f=c(o,i,t-d),u=c(o,i,t+d);return{lo:f.lo,hi:u.hi}}}}else{let h=c(o,i,t);if(l){let{vScale:d}=n._cachedMeta,{_parsed:f}=e,u=f.slice(0,h.lo+1).reverse().findIndex(p=>!O(p[d.axis]));h.lo-=Math.max(0,u);let g=f.slice(h.hi).findIndex(p=>!O(p[d.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function Pe$2(e,i,t,s,n){let o=e.getSortedVisibleDatasetMetas(),r=t[i];for(let a=0,l=o.length;a<l;++a){let{index:c,data:h}=o[a],{lo:d,hi:f}=Za(o[a],i,r,n);for(let u=d;u<=f;++u){let g=h[u];g.skip||s(g,c,u)}}}function Qa$1(e){let i=e.indexOf(`x`)!==-1,t=e.indexOf(`y`)!==-1;return function(s,n){let o=i?Math.abs(s.x-n.x):0,r=t?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function ss$2(e,i,t,s,n){let o=[];return!n&&!e.isPointInArea(i)||Pe$2(e,t,i,function(a,l,c){!n&&!rt$1(a,e.chartArea,0)||a.inRange(i.x,i.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function tl$2(e,i,t,s){let n=[];function o(r,a,l){let{startAngle:c,endAngle:h}=r.getProps([`startAngle`,`endAngle`],s),{angle:d}=Ai$1(r,{x:i.x,y:i.y});Jt(d,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return Pe$2(e,t,i,o),n}function el$2(e,i,t,s,n,o){let r=[],a=Qa$1(t),l=Number.POSITIVE_INFINITY;function c(h,d,f){let u=h.inRange(i.x,i.y,n);if(s&&!u)return;let g=h.getCenterPoint(n);if(!(!!o||e.isPointInArea(g))&&!u)return;let m=a(i,g);m<l?(r=[{element:h,datasetIndex:d,index:f}],l=m):m===l&&r.push({element:h,datasetIndex:d,index:f})}return Pe$2(e,t,i,c),r}function ns$2(e,i,t,s,n,o){return!o&&!e.isPointInArea(i)?[]:t===`r`&&!s?tl$2(e,i,t,n):el$2(e,i,t,s,n,o)}function Nn$2(e,i,t,s,n){let o=[],r=t===`x`?`inXRange`:`inYRange`,a=!1;return Pe$2(e,t,i,(l,c,h)=>{l[r]&&l[r](i[t],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(i.x,i.y,n))}),s&&!a?[]:o}var il$2={evaluateInteractionItems:Pe$2,modes:{index(e,i,t,s){let n=Pt$2(i,e),o=t.axis||`x`,r=t.includeInvisible||!1,a=t.intersect?ss$2(e,n,o,s,r):ns$2(e,n,o,!1,s,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{let h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(e,i,t,s){let n=Pt$2(i,e),o=t.axis||`xy`,r=t.includeInvisible||!1,a=t.intersect?ss$2(e,n,o,s,r):ns$2(e,n,o,!1,s,r);if(a.length>0){let l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(e,i,t,s){return ss$2(e,Pt$2(i,e),t.axis||`xy`,s,t.includeInvisible||!1)},nearest(e,i,t,s){let n=Pt$2(i,e),o=t.axis||`xy`,r=t.includeInvisible||!1;return ns$2(e,n,o,t.intersect,s,r)},x(e,i,t,s){return Nn$2(e,Pt$2(i,e),`x`,t.intersect,s)},y(e,i,t,s){return Nn$2(e,Pt$2(i,e),`y`,t.intersect,s)}}};var Eo$2=[`left`,`top`,`right`,`bottom`];function be$2(e,i){return e.filter(t=>t.pos===i)}function Vn$1(e,i){return e.filter(t=>Eo$2.indexOf(t.pos)===-1&&t.box.axis===i)}function xe$1(e,i){return e.sort((t,s)=>{let n=i?s:t,o=i?t:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function sl$2(e){let i=[],t,s,n,o,r,a;for(t=0,s=(e||[]).length;t<s;++t)n=e[t],{position:o,options:{stack:r,stackWeight:a=1}}=n,i.push({index:t,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return i}function nl$2(e){let i={};for(let t of e){let{stack:s,pos:n,stackWeight:o}=t;if(!s||!Eo$2.includes(n))continue;let r=i[s]||(i[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return i}function ol$2(e,i){let t=nl$2(e),{vBoxMaxWidth:s,hBoxMaxHeight:n}=i,o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];let{fullSize:l}=a.box,c=t[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*s:l&&i.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:l&&i.availableHeight)}return t}function rl$2(e){let i=sl$2(e),t=xe$1(i.filter(c=>c.box.fullSize),!0),s=xe$1(be$2(i,`left`),!0),n=xe$1(be$2(i,`right`)),o=xe$1(be$2(i,`top`),!0),r=xe$1(be$2(i,`bottom`)),a=Vn$1(i,`x`),l=Vn$1(i,`y`);return{fullSize:t,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:be$2(i,`chartArea`),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Hn$1(e,i,t,s){return Math.max(e[t],i[t])+Math.max(e[s],i[s])}function Io$2(e,i){e.top=Math.max(e.top,i.top),e.left=Math.max(e.left,i.left),e.bottom=Math.max(e.bottom,i.bottom),e.right=Math.max(e.right,i.right)}function al$2(e,i,t,s){let{pos:n,box:o}=t,r=e.maxPadding;if(!A$1(n)){t.size&&(e[n]-=t.size);let d=s[t.stack]||{size:0,count:1};d.size=Math.max(d.size,t.horizontal?o.height:o.width),t.size=d.size/d.count,e[n]+=t.size}o.getPadding&&Io$2(r,o.getPadding());let a=Math.max(0,i.outerWidth-Hn$1(r,e,`left`,`right`)),l=Math.max(0,i.outerHeight-Hn$1(r,e,`top`,`bottom`)),c=a!==e.w,h=l!==e.h;return e.w=a,e.h=l,t.horizontal?{same:c,other:h}:{same:h,other:c}}function ll$2(e){let i=e.maxPadding;function t(s){let n=Math.max(i[s]-e[s],0);return e[s]+=n,n}e.y+=t(`top`),e.x+=t(`left`),t(`right`),t(`bottom`)}function cl$2(e,i){let t=i.maxPadding;function s(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(i[r],t[r])}),o}return s(e?[`left`,`right`]:[`top`,`bottom`])}function ve$2(e,i,t,s){let n=[],o,r,a,l,c,h;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||i.w,a.height||i.h,cl$2(a.horizontal,i));let{same:d,other:f}=al$2(i,t,a,s);c|=d&&n.length,h=h||f,l.fullSize||n.push(a)}return c&&ve$2(n,i,t,s)||h}function Ze$1(e,i,t,s,n){e.top=t,e.left=i,e.right=i+s,e.bottom=t+n,e.width=s,e.height=n}function jn$1(e,i,t,s){let n=t.padding,{x:o,y:r}=i;for(let a of e){let l=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){let d=i.w*h,f=c.size||l.height;qt$3(c.start)&&(r=c.start),l.fullSize?Ze$1(l,n.left,r,t.outerWidth-n.right-n.left,f):Ze$1(l,i.left+c.placed,r,d,f),c.start=r,c.placed+=d,r=l.bottom}else{let d=i.h*h,f=c.size||l.width;qt$3(c.start)&&(o=c.start),l.fullSize?Ze$1(l,o,n.top,f,t.outerHeight-n.bottom-n.top):Ze$1(l,o,i.top+c.placed,f,d),c.start=o,c.placed+=d,o=l.right}}i.x=o,i.y=r}var G={addBox(e,i){e.boxes||(e.boxes=[]),i.fullSize=i.fullSize||!1,i.position=i.position||`top`,i.weight=i.weight||0,i._layers=i._layers||function(){return[{z:0,draw(t){i.draw(t)}}]},e.boxes.push(i)},removeBox(e,i){let t=e.boxes?e.boxes.indexOf(i):-1;t!==-1&&e.boxes.splice(t,1)},configure(e,i,t){i.fullSize=t.fullSize,i.position=t.position,i.weight=t.weight},update(e,i,t,s){if(!e)return;let n=K$1(e.options.layout.padding),o=Math.max(i-n.width,0),r=Math.max(t-n.height,0),a=rl$2(e.boxes),l=a.vertical,c=a.horizontal;R$2(e.boxes,p=>{typeof p.beforeLayout==`function`&&p.beforeLayout()});let h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:i,outerHeight:t,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),f=Object.assign({},n);Io$2(f,K$1(s));let u=Object.assign({maxPadding:f,w:o,h:r,x:n.left,y:n.top},n),g=ol$2(l.concat(c),d);ve$2(a.fullSize,u,d,g),ve$2(l,u,d,g),ve$2(c,u,d,g)&&ve$2(l,u,d,g),ll$2(u),jn$1(a.leftAndTop,u,d,g),u.x+=u.w,u.y+=u.h,jn$1(a.rightAndBottom,u,d,g),e.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},R$2(a.chartArea,p=>{let m=p.box;Object.assign(m,e.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};var li$2=class{acquireContext(i,t){}releaseContext(i){return!1}addEventListener(i,t,s){}removeEventListener(i,t,s){}getDevicePixelRatio(){return 1}getMaximumSize(i,t,s,n){return t=Math.max(0,t||i.width),s=s||i.height,{width:t,height:Math.max(0,n?Math.floor(t/n):s)}}isAttached(i){return!0}updateConfig(i){}};var us$2=class extends li$2{acquireContext(i){return i&&i.getContext&&i.getContext(`2d`)||null}updateConfig(i){i.options.animation=!1}};var ni$1=`$chartjs`;var hl$2={touchstart:`mousedown`,touchmove:`mousemove`,touchend:`mouseup`,pointerenter:`mouseenter`,pointerdown:`mousedown`,pointermove:`mousemove`,pointerup:`mouseup`,pointerleave:`mouseout`,pointerout:`mouseout`};var Yn$1=e=>e===null||e===``;function dl$2(e,i){let t=e.style,s=e.getAttribute(`height`),n=e.getAttribute(`width`);if(e[ni$1]={initial:{height:s,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||`block`,t.boxSizing=t.boxSizing||`border-box`,Yn$1(n)){let o=Xi(e,`width`);o!==void 0&&(e.width=o)}if(Yn$1(s))if(e.style.height===``)e.height=e.width/(i||2);else{let o=Xi(e,`height`);o!==void 0&&(e.height=o)}return e}var Fo$2=Cn$1?{passive:!0}:!1;function fl$2(e,i,t){e&&e.addEventListener(i,t,Fo$2)}function ul$2(e,i,t){e&&e.canvas&&e.canvas.removeEventListener(i,t,Fo$2)}function gl$2(e,i){let t=hl$2[e.type]||e.type,{x:s,y:n}=Pt$2(e,i);return{type:t,chart:i,native:e,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ci$1(e,i){for(let t of e)if(t===i||t.contains(i))return!0}function pl$2(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||ci$1(a.addedNodes,s),r=r&&!ci$1(a.removedNodes,s);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}function ml$2(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||ci$1(a.removedNodes,s),r=r&&!ci$1(a.addedNodes,s);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}var Se$1=new Map;var $n$1=0;function zo$2(){let e=window.devicePixelRatio;e!==$n$1&&($n$1=e,Se$1.forEach((i,t)=>{t.currentDevicePixelRatio!==e&&i()}))}function bl$2(e,i){Se$1.size||window.addEventListener(`resize`,zo$2),Se$1.set(e,i)}function xl$2(e){Se$1.delete(e),Se$1.size||window.removeEventListener(`resize`,zo$2)}function _l$2(e,i,t){let s=e.canvas,n=s&&Ge(s);if(!n)return;let o=Ei$1((a,l)=>{let c=n.clientWidth;t(a,l),c<n.clientWidth&&t()},window),r=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),bl$2(e,o),r}function os$2(e,i,t){t&&t.disconnect(),i===`resize`&&xl$2(e)}function yl$2(e,i,t){let s=e.canvas,n=Ei$1(o=>{e.ctx!==null&&t(gl$2(o,e))},e);return fl$2(s,i,n),n}var gs$2=class extends li$2{acquireContext(i,t){let s=i&&i.getContext&&i.getContext(`2d`);return s&&s.canvas===i?(dl$2(i,t),s):null}releaseContext(i){let t=i.canvas;if(!t[ni$1])return!1;let s=t[ni$1].initial;[`height`,`width`].forEach(o=>{let r=s[o];O(r)?t.removeAttribute(o):t.setAttribute(o,r)});let n=s.style||{};return Object.keys(n).forEach(o=>{t.style[o]=n[o]}),t.width=t.width,delete t[ni$1],!0}addEventListener(i,t,s){this.removeEventListener(i,t);let n=i.$proxies||(i.$proxies={});n[t]=({attach:pl$2,detach:ml$2,resize:_l$2}[t]||yl$2)(i,t,s)}removeEventListener(i,t){let s=i.$proxies||(i.$proxies={}),n=s[t];if(!n)return;({attach:os$2,detach:os$2,resize:os$2}[t]||ul$2)(i,t,n),s[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(i,t,s,n){return wn$2(i,t,s,n)}isAttached(i){let t=i&&Ge(i);return!!(t&&t.isConnected)}};function vl$2(e){return!qe()||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas?us$2:gs$2}var xt$1=(()=>{class e{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:s,y:n}=this.getProps([`x`,`y`],t);return{x:s,y:n}}hasValue(){return It$2(this.x)&&It$2(this.y)}getProps(t,s){let n=this.$animations;if(!s||!n)return this;let o={};return t.forEach(r=>{o[r]=n[r]&&n[r].active()?n[r]._to:this[r]}),o}}return e})();function Ml$2(e,i){let t=e.options.ticks,s=kl$2(e),n=Math.min(t.maxTicksLimit||s,s),o=t.major.enabled?wl$2(i):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return Cl$2(i,c,o,r/n),c;let h=Sl$2(o,i,n);if(r>0){let d,f,u=r>1?Math.round((l-a)/(r-1)):null;for(Qe(i,c,h,O(u)?0:a-u,a),d=0,f=r-1;d<f;d++)Qe(i,c,h,o[d],o[d+1]);return Qe(i,c,h,l,O(u)?i.length:l+u),c}return Qe(i,c,h),c}function kl$2(e){let i=e.options.offset,t=e._tickSize(),s=e._length/t+(i?0:1),n=e._maxLength/t;return Math.floor(Math.min(s,n))}function Sl$2(e,i,t){let s=Pl$2(e),n=i.length/t;if(!s)return Math.max(n,1);let o=rn$2(s);for(let r=0,a=o.length-1;r<a;r++){let l=o[r];if(l>n)return l}return Math.max(n,1)}function wl$2(e){let i=[],t,s;for(t=0,s=e.length;t<s;t++)e[t].major&&i.push(t);return i}function Cl$2(e,i,t,s){let n=0,o=t[0],r;for(s=Math.ceil(s),r=0;r<e.length;r++)r===o&&(i.push(e[r]),n++,o=t[n*s])}function Qe(e,i,t,s,n){let o=C(s,0),r=Math.min(C(n,e.length),e.length),a=0,l,c,h;for(t=Math.ceil(t),n&&(l=n-s,t=l/Math.floor(l/t)),h=o;h<0;)a++,h=Math.round(o+a*t);for(c=Math.max(o,0);c<r;c++)c===h&&(i.push(e[c]),a++,h=Math.round(o+a*t))}function Pl$2(e){let i=e.length,t,s;if(i<2)return!1;for(s=e[0],t=1;t<i;++t)if(e[t]-e[t-1]!==s)return!1;return s}var Dl$2=e=>e===`left`?`right`:e===`right`?`left`:e;var Un$1=(e,i,t)=>i===`top`||i===`left`?e[i]+t:e[i]-t;var Xn$2=(e,i)=>Math.min(i||e,e);function Kn$1(e,i){let t=[],s=e.length/i,n=e.length,o=0;for(;o<n;o+=s)t.push(e[Math.floor(o)]);return t}function Ol$2(e,i,t){let s=e.ticks.length,n=Math.min(i,s-1),o=e._startPixel,r=e._endPixel,a=1e-6,l=e.getPixelForTick(n),c;if(!(t&&(s===1?c=Math.max(l-o,r-l):i===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(n-1))/2,l+=n<i?c:-c,l<o-a||l>r+a)))return l}function Al$2(e,i){R$2(e,t=>{let s=t.gc,n=s.length/2,o;if(n>i){for(o=0;o<n;++o)delete t.data[s[o]];s.splice(0,n)}})}function _e$2(e){return e.drawTicks?e.tickLength:0}function qn$1(e,i){if(!e.display)return 0;let t=j$1(e.font,i),s=K$1(e.padding);return(z$1(e.text)?e.text.length:1)*t.lineHeight+s.height}function Tl$2(e,i){return pt$2(e,{scale:i,type:`scale`})}function Ll$2(e,i,t){return pt$2(e,{tick:t,index:i,type:`tick`})}function Rl$2(e,i,t){let s=Ye(e);return(t&&i!==`right`||!t&&i===`right`)&&(s=Dl$2(s)),s}function El$2(e,i,t,s){let{top:n,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:h}=l,d=0,f,u,g,p=r-n,m=a-o;if(e.isHorizontal()){if(u=X$1(s,o,a),A$1(t)){let x=Object.keys(t)[0],b=t[x];g=h[x].getPixelForValue(b)+p-i}else t===`center`?g=(c.bottom+c.top)/2+p-i:g=Un$1(e,t,i);f=a-o}else{if(A$1(t)){let x=Object.keys(t)[0],b=t[x];u=h[x].getPixelForValue(b)-m+i}else t===`center`?u=(c.left+c.right)/2-m+i:u=Un$1(e,t,i);g=X$1(s,r,n),d=t===`left`?-V:V}return{titleX:u,titleY:g,maxWidth:f,rotation:d}}var Wt$1=class e extends xt$1{constructor(i){super(),this.id=i.id,this.type=i.type,this.options=void 0,this.ctx=i.ctx,this.chart=i.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(i){this.options=i.setContext(this.getContext()),this.axis=i.axis,this._userMin=this.parse(i.min),this._userMax=this.parse(i.max),this._suggestedMin=this.parse(i.suggestedMin),this._suggestedMax=this.parse(i.suggestedMax)}parse(i,t){return i}getUserBounds(){let{_userMin:i,_userMax:t,_suggestedMin:s,_suggestedMax:n}=this;return i=J(i,Number.POSITIVE_INFINITY),t=J(t,Number.NEGATIVE_INFINITY),s=J(s,Number.POSITIVE_INFINITY),n=J(n,Number.NEGATIVE_INFINITY),{min:J(i,s),max:J(t,n),minDefined:N(i),maxDefined:N(t)}}getMinMax(i){let{min:t,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:t,max:s};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,i),n||(t=Math.min(t,r.min)),o||(s=Math.max(s,r.max));return t=o&&t>s?s:t,s=n&&t>s?t:s,{min:J(t,J(s,t)),max:J(s,J(t,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let i=this.chart.data;return this.options.labels||(this.isHorizontal()?i.xLabels:i.yLabels)||i.labels||[]}getLabelItems(i=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(i))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I$2(this.options.beforeUpdate,[this])}update(i,t,s){let{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=i,this.maxHeight=t,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_n$2(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?Kn$1(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source===`auto`)&&(this.ticks=Ml$2(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let i=this.options.reverse,t,s;this.isHorizontal()?(t=this.left,s=this.right):(t=this.top,s=this.bottom,i=!i),this._startPixel=t,this._endPixel=s,this._reversePixels=i,this._length=s-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I$2(this.options.afterUpdate,[this])}beforeSetDimensions(){I$2(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I$2(this.options.afterSetDimensions,[this])}_callHooks(i){this.chart.notifyPlugins(i,this.getContext()),I$2(this.options[i],[this])}beforeDataLimits(){this._callHooks(`beforeDataLimits`)}determineDataLimits(){}afterDataLimits(){this._callHooks(`afterDataLimits`)}beforeBuildTicks(){this._callHooks(`beforeBuildTicks`)}buildTicks(){return[]}afterBuildTicks(){this._callHooks(`afterBuildTicks`)}beforeTickToLabelConversion(){I$2(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(i){let t=this.options.ticks,s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s],o.label=I$2(t.callback,[o.value,s,i],this)}afterTickToLabelConversion(){I$2(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I$2(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let i=this.options,t=i.ticks,s=Xn$2(this.ticks.length,i.ticks.maxTicksLimit),n=t.minRotation||0,o=t.maxRotation,r=n,a,l,c;if(!this._isVisible()||!t.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,f=h.highest.height,u=Y(this.chart.width-d,0,this.maxWidth);a=i.offset?this.maxWidth/s:u/(s-1),d+6>a&&(a=u/(s-(i.offset?.5:1)),l=this.maxHeight-_e$2(i.grid)-t.padding-qn$1(i.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),r=He$1(Math.min(Math.asin(Y((h.highest.height+6)/a,-1,1)),Math.asin(Y(l/c,-1,1))-Math.asin(Y(f/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I$2(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I$2(this.options.beforeFit,[this])}fit(){let i={width:0,height:0},{chart:t,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=qn$1(n,t.options.font);if(a?(i.width=this.maxWidth,i.height=_e$2(o)+l):(i.height=this.maxHeight,i.width=_e$2(o)+l),s.display&&this.ticks.length){let{first:c,last:h,widest:d,highest:f}=this._getLabelSizes(),u=s.padding*2,g=it(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){let x=s.mirror?0:m*d.width+p*f.height;i.height=Math.min(this.maxHeight,i.height+x+u)}else{let x=s.mirror?0:p*d.width+m*f.height;i.width=Math.min(this.maxWidth,i.width+x+u)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=i.height):(this.width=i.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(i,t,s,n){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!==`top`&&this.axis===`x`;if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),f=0,u=0;l?c?(f=n*i.width,u=s*t.height):(f=s*i.height,u=n*t.width):o===`start`?u=t.width:o===`end`?f=i.width:o!==`inner`&&(f=i.width/2,u=t.width/2),this.paddingLeft=Math.max((f-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-d+r)*this.width/(this.width-d),0)}else{let h=t.height/2,d=i.height/2;o===`start`?(h=0,d=i.height):o===`end`&&(h=t.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I$2(this.options.afterFit,[this])}isHorizontal(){let{axis:i,position:t}=this.options;return t===`top`||t===`bottom`||i===`x`}isFullSize(){return this.options.fullSize}_convertTicksToLabels(i){this.beforeTickToLabelConversion(),this.generateTickLabels(i);let t,s;for(t=0,s=i.length;t<s;t++)O(i[t].label)&&(i.splice(t,1),s--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let i=this._labelSizes;if(!i){let t=this.options.ticks.sampleSize,s=this.ticks;t<s.length&&(s=Kn$1(s,t)),this._labelSizes=i=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return i}_computeLabelSizes(i,t,s){let{ctx:n,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(t/Xn$2(t,s)),c=0,h=0,d,f,u,g,p,m,x,b,y,M,_;for(d=0;d<t;d+=l){if(g=i[d].label,p=this._resolveTickFontOptions(d),n.font=m=p.string,x=o[m]=o[m]||{data:{},gc:[]},b=p.lineHeight,y=M=0,!O(g)&&!z$1(g))y=de$1(n,x.data,x.gc,y,g),M=b;else if(z$1(g))for(f=0,u=g.length;f<u;++f)_=g[f],!O(_)&&!z$1(_)&&(y=de$1(n,x.data,x.gc,y,_),M+=b);r.push(y),a.push(M),c=Math.max(y,c),h=Math.max(M,h)}Al$2(o,t);let v=r.indexOf(c),S=a.indexOf(h),k=w=>({width:r[w]||0,height:a[w]||0});return{first:k(0),last:k(t-1),widest:k(v),highest:k(S),widths:r,heights:a}}getLabelForValue(i){return i}getPixelForValue(i,t){return NaN}getValueForPixel(i){}getPixelForTick(i){let t=this.ticks;return i<0||i>t.length-1?null:this.getPixelForValue(t[i].value)}getPixelForDecimal(i){this._reversePixels&&(i=1-i);let t=this._startPixel+i*this._length;return ln$1(this._alignToPixels?St$2(this.chart,t,0):t)}getDecimalForPixel(i){let t=(i-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:i,max:t}=this;return i<0&&t<0?t:i>0&&t>0?i:0}getContext(i){let t=this.ticks||[];if(i>=0&&i<t.length){let s=t[i];return s.$context||(s.$context=Ll$2(this.getContext(),i,s))}return this.$context||(this.$context=Tl$2(this.chart.getContext(),this))}_tickSize(){let i=this.options.ticks,t=it(this.labelRotation),s=Math.abs(Math.cos(t)),n=Math.abs(Math.sin(t)),o=this._getLabelSizes(),r=i.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*n?a/s:l/n:l*n<a*s?l/s:a/n}_isVisible(){let i=this.options.display;return i!==`auto`?!!i:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(i){let t=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=_e$2(o),u=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,x=function(W){return St$2(s,W,p)},b,y,M,_,v,S,k,w,D,P,T,$;if(r===`top`)b=x(this.bottom),S=this.bottom-f,w=b-m,P=x(i.top)+m,$=i.bottom;else if(r===`bottom`)b=x(this.top),P=i.top,$=x(i.bottom)-m,S=b+m,w=this.top+f;else if(r===`left`)b=x(this.right),v=this.right-f,k=b-m,D=x(i.left)+m,T=i.right;else if(r===`right`)b=x(this.left),D=i.left,T=x(i.right)-m,v=b+m,k=this.left+f;else if(t===`x`){if(r===`center`)b=x((i.top+i.bottom)/2+.5);else if(A$1(r)){let W=Object.keys(r)[0],H=r[W];b=x(this.chart.scales[W].getPixelForValue(H))}P=i.top,$=i.bottom,S=b+m,w=S+f}else if(t===`y`){if(r===`center`)b=x((i.left+i.right)/2);else if(A$1(r)){let W=Object.keys(r)[0],H=r[W];b=x(this.chart.scales[W].getPixelForValue(H))}v=b-m,k=v-f,D=i.left,T=i.right}let tt=C(n.ticks.maxTicksLimit,d),E=Math.max(1,Math.ceil(d/tt));for(y=0;y<d;y+=E){let W=this.getContext(y),H=o.setContext(W),st=a.setContext(W),q=H.lineWidth,Vt=H.color,De=st.dash||[],Ht=st.dashOffset,oe=H.tickWidth,At=H.tickColor,re=H.tickBorderDash||[],Tt=H.tickBorderDashOffset;M=Ol$2(this,y,l),M!==void 0&&(_=St$2(s,M,q),c?v=k=D=T=_:S=w=P=$=_,u.push({tx1:v,ty1:S,tx2:k,ty2:w,x1:D,y1:P,x2:T,y2:$,width:q,color:Vt,borderDash:De,borderDashOffset:Ht,tickWidth:oe,tickColor:At,tickBorderDash:re,tickBorderDashOffset:Tt}))}return this._ticksLength=d,this._borderValue=b,u}_computeLabelItems(i){let t=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,f=_e$2(s.grid),u=f+h,g=d?-h:u,p=-it(this.labelRotation),m=[],x,b,y,M,_,v,S,k,w,D,P,T,$=`middle`;if(n===`top`)v=this.bottom-g,S=this._getXAxisLabelAlignment();else if(n===`bottom`)v=this.top+g,S=this._getXAxisLabelAlignment();else if(n===`left`){let E=this._getYAxisLabelAlignment(f);S=E.textAlign,_=E.x}else if(n===`right`){let E=this._getYAxisLabelAlignment(f);S=E.textAlign,_=E.x}else if(t===`x`){if(n===`center`)v=(i.top+i.bottom)/2+u;else if(A$1(n)){let E=Object.keys(n)[0],W=n[E];v=this.chart.scales[E].getPixelForValue(W)+u}S=this._getXAxisLabelAlignment()}else if(t===`y`){if(n===`center`)_=(i.left+i.right)/2-u;else if(A$1(n)){let E=Object.keys(n)[0],W=n[E];_=this.chart.scales[E].getPixelForValue(W)}S=this._getYAxisLabelAlignment(f).textAlign}t===`y`&&(l===`start`?$=`top`:l===`end`&&($=`bottom`));let tt=this._getLabelSizes();for(x=0,b=a.length;x<b;++x){y=a[x],M=y.label;let E=o.setContext(this.getContext(x));k=this.getPixelForTick(x)+o.labelOffset,w=this._resolveTickFontOptions(x),D=w.lineHeight,P=z$1(M)?M.length:1;let W=P/2,H=E.color,st=E.textStrokeColor,q=E.textStrokeWidth,Vt=S;r?(_=k,S===`inner`&&(x===b-1?Vt=this.options.reverse?`left`:`right`:x===0?Vt=this.options.reverse?`right`:`left`:Vt=`center`),n===`top`?c===`near`||p!==0?T=-P*D+D/2:c===`center`?T=-tt.highest.height/2-W*D+D:T=-tt.highest.height+D/2:c===`near`||p!==0?T=D/2:c===`center`?T=tt.highest.height/2-W*D:T=tt.highest.height-P*D,d&&(T*=-1),p!==0&&!E.showLabelBackdrop&&(_+=D/2*Math.sin(p))):(v=k,T=(1-P)*D/2);let De;if(E.showLabelBackdrop){let Ht=K$1(E.backdropPadding),oe=tt.heights[x],At=tt.widths[x],re=T-Ht.top,Tt=0-Ht.left;switch($){case`middle`:re-=oe/2;break;case`bottom`:re-=oe;break}switch(S){case`center`:Tt-=At/2;break;case`right`:Tt-=At;break;case`inner`:x===b-1?Tt-=At:x>0&&(Tt-=At/2);break}De={left:Tt,top:re,width:At+Ht.width,height:oe+Ht.height,color:E.backdropColor}}m.push({label:M,font:w,textOffset:T,options:{rotation:p,color:H,strokeColor:st,strokeWidth:q,textAlign:Vt,textBaseline:$,translation:[_,v],backdrop:De}})}return m}_getXAxisLabelAlignment(){let{position:i,ticks:t}=this.options;if(-it(this.labelRotation))return i===`top`?`left`:`right`;let n=`center`;return t.align===`start`?n=`left`:t.align===`end`?n=`right`:t.align===`inner`&&(n=`inner`),n}_getYAxisLabelAlignment(i){let{position:t,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=i+o,l=r.widest.width,c,h;return t===`left`?n?(h=this.right+o,s===`near`?c=`left`:s===`center`?(c=`center`,h+=l/2):(c=`right`,h+=l)):(h=this.right-a,s===`near`?c=`right`:s===`center`?(c=`center`,h-=l/2):(c=`left`,h=this.left)):t===`right`?n?(h=this.left+o,s===`near`?c=`right`:s===`center`?(c=`center`,h-=l/2):(c=`left`,h-=l)):(h=this.left+a,s===`near`?c=`left`:s===`center`?(c=`center`,h+=l/2):(c=`right`,h=this.right)):c=`right`,{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;let i=this.chart,t=this.options.position;if(t===`left`||t===`right`)return{top:0,left:this.left,bottom:i.height,right:this.right};if(t===`top`||t===`bottom`)return{top:this.top,left:0,bottom:this.bottom,right:i.width}}drawBackground(){let{ctx:i,options:{backgroundColor:t},left:s,top:n,width:o,height:r}=this;t&&(i.save(),i.fillStyle=t,i.fillRect(s,n,o,r),i.restore())}getLineWidthForValue(i){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(o=>o.value===i);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(i){let t=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(i)),o,r,a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(t.display)for(o=0,r=n.length;o<r;++o){let l=n[o];t.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:i,ctx:t,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;let a=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,h,d,f;this.isHorizontal()?(c=St$2(i,this.left,r)-r/2,h=St$2(i,this.right,a)+a/2,d=f=l):(d=St$2(i,this.top,r)-r/2,f=St$2(i,this.bottom,a)+a/2,c=h=l),t.save(),t.lineWidth=o.width,t.strokeStyle=o.color,t.beginPath(),t.moveTo(c,d),t.lineTo(h,f),t.stroke(),t.restore()}drawLabels(i){if(!this.options.ticks.display)return;let s=this.ctx,n=this._computeLabelArea();n&&ge$1(s,n);let o=this.getLabelItems(i);for(let r of o){let a=r.options,l=r.font,c=r.label,h=r.textOffset;wt$2(s,c,0,h,l,a)}n&&pe$1(s)}drawTitle(){let{ctx:i,options:{position:t,title:s,reverse:n}}=this;if(!s.display)return;let o=j$1(s.font),r=K$1(s.padding),a=s.align,l=o.lineHeight/2;t===`bottom`||t===`center`||A$1(t)?(l+=r.bottom,z$1(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;let{titleX:c,titleY:h,maxWidth:d,rotation:f}=El$2(this,l,t,a);wt$2(i,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:f,textAlign:Rl$2(a,t,n),textBaseline:`middle`,translation:[c,h]})}draw(i){this._isVisible()&&(this.drawBackground(),this.drawGrid(i),this.drawBorder(),this.drawTitle(),this.drawLabels(i))}_layers(){let i=this.options,t=i.ticks&&i.ticks.z||0,s=C(i.grid&&i.grid.z,-1),n=C(i.border&&i.border.z,0);return!this._isVisible()||this.draw!==e.prototype.draw?[{z:t,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(i){let t=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+`AxisID`,n=[],o,r;for(o=0,r=t.length;o<r;++o){let a=t[o];a[s]===this.id&&(!i||a.type===i)&&n.push(a)}return n}_resolveTickFontOptions(i){return j$1(this.options.ticks.setContext(this.getContext(i)).font)}_maxDigits(){let i=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/i}};var ie$1=class{constructor(i,t,s){this.type=i,this.scope=t,this.override=s,this.items=Object.create(null)}isForType(i){return Object.prototype.isPrototypeOf.call(this.type.prototype,i.prototype)}register(i){let t=Object.getPrototypeOf(i),s;zl$2(t)&&(s=this.register(t));let n=this.items,o=i.id,r=this.scope+`.`+o;if(!o)throw new Error(`class does not have id: `+i);return o in n||(n[o]=i,Il$2(i,r,s),this.override&&F.override(i.id,i.overrides)),r}get(i){return this.items[i]}unregister(i){let t=this.items,s=i.id,n=this.scope;s in t&&delete t[s],n&&s in F[n]&&(delete F[n][s],this.override&&delete kt$2[s])}};function Il$2(e,i,t){let s=Ut$3(Object.create(null),[t?F.get(t):{},F.get(i),e.defaults]);F.set(i,s),e.defaultRoutes&&Fl$2(i,e.defaultRoutes),e.descriptors&&F.describe(i,e.descriptors)}
vendor: 17,889 bytes, line 2615
2615function Fl$2(e,i){Object.keys(i).forEach(t=>{let s=t.split(`.`),n=s.pop(),o=[e].concat(s).join(`.`),r=i[t].split(`.`),a=r.pop(),l=r.join(`.`);F.route(o,n,l,a)})}function zl$2(e){return`id`in e&&`defaults`in e}var ps$2=class{constructor(){this.controllers=new ie$1(Ot$3,`datasets`,!0),this.elements=new ie$1(xt$1,`elements`),this.plugins=new ie$1(Object,`plugins`),this.scales=new ie$1(Wt$1,`scales`),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...i){this._each(`register`,i)}remove(...i){this._each(`unregister`,i)}addControllers(...i){this._each(`register`,i,this.controllers)}addElements(...i){this._each(`register`,i,this.elements)}addPlugins(...i){this._each(`register`,i,this.plugins)}addScales(...i){this._each(`register`,i,this.scales)}getController(i){return this._get(i,this.controllers,`controller`)}getElement(i){return this._get(i,this.elements,`element`)}getPlugin(i){return this._get(i,this.plugins,`plugin`)}getScale(i){return this._get(i,this.scales,`scale`)}removeControllers(...i){this._each(`unregister`,i,this.controllers)}removeElements(...i){this._each(`unregister`,i,this.elements)}removePlugins(...i){this._each(`unregister`,i,this.plugins)}removeScales(...i){this._each(`unregister`,i,this.scales)}_each(i,t,s){[...t].forEach(n=>{let o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(i,o,n):R$2(n,r=>{let a=s||this._getRegistryForType(r);this._exec(i,a,r)})})}_exec(i,t,s){let n=Ve$1(i);I$2(s[`before`+n],[],s),t[i](s),I$2(s[`after`+n],[],s)}_getRegistryForType(i){for(let t=0;t<this._typedRegistries.length;t++){let s=this._typedRegistries[t];if(s.isForType(i))return s}return this.plugins}_get(i,t,s){let n=t.get(i);if(n===void 0)throw new Error(`"`+i+`" is not a registered `+s+`.`);return n}};var ht$3=new ps$2;var ms$2=class{constructor(){this._init=void 0}notify(i,t,s,n){if(t===`beforeInit`&&(this._init=this._createDescriptors(i,!0),this._notify(this._init,i,`install`)),this._init===void 0)return;let o=n?this._descriptors(i).filter(n):this._descriptors(i),r=this._notify(o,i,t,s);return t===`afterDestroy`&&(this._notify(o,i,`stop`),this._notify(this._init,i,`uninstall`),this._init=void 0),r}_notify(i,t,s,n){n=n||{};for(let o of i){let r=o.plugin,a=r[s];if(I$2(a,[t,n,o.options],r)===!1&&n.cancelable)return!1}return!0}invalidate(){O(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(i){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(i);return this._notifyStateChanges(i),t}_createDescriptors(i,t){let s=i&&i.config,n=C(s.options&&s.options.plugins,{}),o=Bl$2(s);return n===!1&&!t?[]:Nl$2(i,o,n,t)}_notifyStateChanges(i){let t=this._oldCache||[],s=this._cache,n=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(t,s),i,`stop`),this._notify(n(s,t),i,`start`)}};function Bl$2(e){let i={},t=[],s=Object.keys(ht$3.plugins.items);for(let o=0;o<s.length;o++)t.push(ht$3.getPlugin(s[o]));let n=e.plugins||[];for(let o=0;o<n.length;o++){let r=n[o];t.indexOf(r)===-1&&(t.push(r),i[r.id]=!0)}return{plugins:t,localIds:i}}function Wl$2(e,i){return!i&&e===!1?null:e===!0?{}:e}function Nl$2(e,{plugins:i,localIds:t},s,n){let o=[],r=e.getContext();for(let a of i){let l=a.id,c=Wl$2(s[l],n);c!==null&&o.push({plugin:a,options:Vl$2(e.config,{plugin:a,local:t[l]},c,r)})}return o}function Vl$2(e,{plugin:i,local:t},s,n){let o=e.pluginScopeKeys(i),r=e.getOptionScopes(s,o);return t&&i.defaults&&r.push(i.defaults),e.createResolver(r,n,[``],{scriptable:!1,indexable:!1,allKeys:!0})}function bs$2(e,i){let t=F.datasets[e]||{};return((i.datasets||{})[e]||{}).indexAxis||i.indexAxis||t.indexAxis||`x`}function Hl$2(e,i){let t=e;return e===`_index_`?t=i:e===`_value_`&&(t=i===`x`?`y`:`x`),t}function jl$2(e,i){return e===i?`_index_`:`_value_`}function Gn$1(e){if(e===`x`||e===`y`||e===`r`)return e}function Yl$2(e){if(e===`top`||e===`bottom`)return`x`;if(e===`left`||e===`right`)return`y`}function xs$2(e,...i){if(Gn$1(e))return e;for(let t of i){let s=t.axis||Yl$2(t.position)||e.length>1&&Gn$1(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Jn$1(e,i,t){if(t[i+`AxisID`]===e)return{axis:i}}function $l$2(e,i){if(i.data&&i.data.datasets){let t=i.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(t.length)return Jn$1(e,`x`,t[0])||Jn$1(e,`y`,t[0])}return{}}function Ul$1(e,i){let t=kt$2[e.type]||{scales:{}},s=i.scales||{},n=bs$2(e.type,i),o=Object.create(null);return Object.keys(s).forEach(r=>{let a=s[r];if(!A$1(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=xs$2(r,a,$l$2(r,e),F.scales[a.type]),c=jl$2(l,n),h=t.scales||{};o[r]=Kt$2(Object.create(null),[{axis:l},a,h[l],h[c]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,l=r.indexAxis||bs$2(a,i),h=(kt$2[a]||{}).scales||{};Object.keys(h).forEach(d=>{let f=Hl$2(d,l),u=r[f+`AxisID`]||f;o[u]=o[u]||Object.create(null),Kt$2(o[u],[{axis:f},s[u],h[d]])})}),Object.keys(o).forEach(r=>{let a=o[r];Kt$2(a,[F.scales[a.type],F.scale])}),o}function Bo$2(e){let i=e.options||(e.options={});i.plugins=C(i.plugins,{}),i.scales=Ul$1(e,i)}function Wo$2(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Xl$2(e){return e=e||{},e.data=Wo$2(e.data),Bo$2(e),e}var Zn$1=new Map;var No$2=new Set;function ti$1(e,i){let t=Zn$1.get(e);return t||(t=i(),Zn$1.set(e,t),No$2.add(t)),t}var ye$3=(e,i,t)=>{let s=gt$2(i,t);s!==void 0&&e.add(s)};var _s$2=class{constructor(i){this._config=Xl$2(i),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(i){this._config.type=i}get data(){return this._config.data}set data(i){this._config.data=Wo$2(i)}get options(){return this._config.options}set options(i){this._config.options=i}get plugins(){return this._config.plugins}update(){let i=this._config;this.clearCache(),Bo$2(i)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(i){return ti$1(i,()=>[[`datasets.${i}`,``]])}datasetAnimationScopeKeys(i,t){return ti$1(`${i}.transition.${t}`,()=>[[`datasets.${i}.transitions.${t}`,`transitions.${t}`],[`datasets.${i}`,``]])}datasetElementScopeKeys(i,t){return ti$1(`${i}-${t}`,()=>[[`datasets.${i}.elements.${t}`,`datasets.${i}`,`elements.${t}`,``]])}pluginScopeKeys(i){let t=i.id,s=this.type;return ti$1(`${s}-plugin-${t}`,()=>[[`plugins.${t}`,...i.additionalOptionScopes||[]]])}_cachedScopes(i,t){let s=this._scopeCache,n=s.get(i);return(!n||t)&&(n=new Map,s.set(i,n)),n}getOptionScopes(i,t,s){let{options:n,type:o}=this,r=this._cachedScopes(i,s),a=r.get(t);if(a)return a;let l=new Set;t.forEach(h=>{i&&(l.add(i),h.forEach(d=>ye$3(l,i,d))),h.forEach(d=>ye$3(l,n,d)),h.forEach(d=>ye$3(l,kt$2[o]||{},d)),h.forEach(d=>ye$3(l,F,d)),h.forEach(d=>ye$3(l,$e$1,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),No$2.has(t)&&r.set(t,c),c}chartOptionScopes(){let{options:i,type:t}=this;return[i,kt$2[t]||{},F.datasets[t]||{},{type:t},F,$e$1]}resolveNamedOptions(i,t,s,n=[``]){let o={$shared:!0},{resolver:r,subPrefixes:a}=Qn$1(this._resolverCache,i,n),l=r;if(ql$2(r,t)){o.$shared=!1,s=ft$3(s)?s():s;let c=this.createResolver(i,s,a);l=Et$2(r,s,c)}for(let c of t)o[c]=l[c];return o}createResolver(i,t,s=[``],n){let{resolver:o}=Qn$1(this._resolverCache,i,s);return A$1(t)?Et$2(o,t,void 0,n):o}};function Qn$1(e,i,t){let s=e.get(i);s||(s=new Map,e.set(i,s));let n=t.join(),o=s.get(n);return o||(o={resolver:Ke(i,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes(`hover`))},s.set(n,o)),o}var Kl$2=e=>A$1(e)&&Object.getOwnPropertyNames(e).some(i=>ft$3(e[i]));function ql$2(e,i){let{isScriptable:t,isIndexable:s}=Hi$1(e);for(let n of i){let o=t(n),r=s(n),a=(r||o)&&e[n];if(o&&(ft$3(a)||Kl$2(a))||r&&z$1(a))return!0}return!1}var Gl$2=`4.5.1`;var Jl$2=[`top`,`bottom`,`left`,`right`,`chartArea`];function to$1(e,i){return e===`top`||e===`bottom`||Jl$2.indexOf(e)===-1&&i===`x`}function eo$1(e,i){return function(t,s){return t[e]===s[e]?t[i]-s[i]:t[e]-s[e]}}function io$1(e){let i=e.chart,t=i.options.animation;i.notifyPlugins(`afterRender`),I$2(t&&t.onComplete,[e],i)}function Zl$2(e){let i=e.chart,t=i.options.animation;I$2(t&&t.onProgress,[e],i)}function Vo$2(e){return qe()&&typeof e==`string`?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var oi$2={};var so$1=e=>{let i=Vo$2(e);return Object.values(oi$2).filter(t=>t.canvas===i).pop()};function Ql$2(e,i,t){let s=Object.keys(e);for(let n of s){let o=+n;if(o>=i){let r=e[n];delete e[n],(t>0||o>i)&&(e[o+t]=r)}}}function tc$2(e,i,t,s){return!t||e.type===`mouseout`?null:s?i:e}var ui$1=(()=>{class e{static defaults=F;static instances=oi$2;static overrides=kt$2;static registry=ht$3;static version=Gl$2;static getChart=so$1;static register(...t){ht$3.add(...t),no$1()}static unregister(...t){ht$3.remove(...t),no$1()}constructor(t,s){let n=this.config=new _s$2(s),o=Vo$2(t),r=so$1(o);if(r)throw new Error(`Canvas is already in use. Chart with ID '`+r.id+`' must be destroyed before the canvas with ID '`+r.canvas.id+`' can be reused.`);let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||(vl$2(o))),this.platform.updateConfig(n);let l=this.platform.acquireContext(o,a.aspectRatio),c=l&&l.canvas,h=c&&c.height,d=c&&c.width;if(this.id=en$1(),this.ctx=l,this.canvas=c,this.width=d,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ms$2,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=un$3(f=>this.update(f),a.resizeDelay||0),this._dataChanges=[],oi$2[this.id]=this,!l||!c){console.error(`Failed to create chart: can't acquire context from the given item`);return}mt$3.listen(this,`complete`,io$1),mt$3.listen(this,`progress`,Zl$2),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:s},width:n,height:o,_aspectRatio:r}=this;return O(t)?s&&r?r:o?n/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ht$3}_initialize(){return this.notifyPlugins(`beforeInit`),this.options.responsive?this.resize():Ui$1(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins(`afterInit`),this}clear(){return Wi$1(this.canvas,this.ctx),this}stop(){return mt$3.stop(this),this}resize(t,s){mt$3.running(this)?this._resizeBeforeDraw={width:t,height:s}:this._resize(t,s)}_resize(t,s){let n=this.options,o=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(o,t,s,r),l=n.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?`resize`:`attach`;this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Ui$1(this,l,!0)&&(this.notifyPlugins(`resize`,{size:a}),I$2(n.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){R$2(this.options.scales||{},(n,o)=>{n.id=o})}buildOrUpdateScales(){let t=this.options,s=t.scales,n=this.scales,o=Object.keys(n).reduce((a,l)=>(a[l]=!1,a),{}),r=[];s&&(r=r.concat(Object.keys(s).map(a=>{let l=s[a],c=xs$2(a,l),h=c===`r`,d=c===`x`;return{options:l,dposition:h?`chartArea`:d?`bottom`:`left`,dtype:h?`radialLinear`:d?`category`:`linear`}}))),R$2(r,a=>{let l=a.options,c=l.id,h=xs$2(c,l),d=C(l.type,a.dtype);(l.position===void 0||to$1(l.position,h)!==to$1(a.dposition))&&(l.position=a.dposition),o[c]=!0;let f=null;if(c in n&&n[c].type===d)f=n[c];else f=new(ht$3.getScale(d))({id:c,type:d,ctx:this.ctx,chart:this}),n[f.id]=f;f.init(l,t)}),R$2(o,(a,l)=>{a||delete n[l]}),R$2(n,a=>{G.configure(this,a,a.options),G.addBox(this,a)})}_updateMetasets(){let t=this._metasets,s=this.data.datasets.length,n=t.length;if(t.sort((o,r)=>o.index-r.index),n>s){for(let o=s;o<n;++o)this._destroyDatasetMeta(o);t.splice(s,n-s)}this._sortedMetasets=t.slice(0).sort(eo$1(`order`,`index`))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:s}}=this;t.length>s.length&&delete this._stacks,t.forEach((n,o)=>{s.filter(r=>r===n._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){let t=[],s=this.data.datasets,n,o;for(this._removeUnreferencedMetasets(),n=0,o=s.length;n<o;n++){let r=s[n],a=this.getDatasetMeta(n),l=r.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(n),a=this.getDatasetMeta(n)),a.type=l,a.indexAxis=r.indexAxis||bs$2(l,this.options),a.order=r.order||0,a.index=n,a.label=``+r.label,a.visible=this.isDatasetVisible(n),a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{let c=ht$3.getController(l),{datasetElementType:h,dataElementType:d}=F.datasets[l];Object.assign(c,{dataElementType:ht$3.getElement(d),datasetElementType:h&&ht$3.getElement(h)}),a.controller=new c(this,n),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){R$2(this.data.datasets,(t,s)=>{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins(`reset`)}update(t){let s=this.config;s.update();let n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins(`beforeUpdate`,{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins(`beforeElementsUpdate`);let a=0;for(let h=0,d=this.data.datasets.length;h<d;h++){let{controller:f}=this.getDatasetMeta(h),u=!o&&r.indexOf(f)===-1;f.buildOrUpdateElements(u),a=Math.max(+f.getMaxOverflow(),a)}a=this._minPadding=n.layout.autoPadding?a:0,this._updateLayout(a),o||R$2(r,h=>{h.reset()}),this._updateDatasets(t),this.notifyPlugins(`afterUpdate`,{mode:t}),this._layers.sort(eo$1(`z`,`_idx`));let{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){R$2(this.scales,t=>{G.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options;(!Ci$1(new Set(Object.keys(this._listeners)),new Set(t.events))||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,s=this._getUniformDataChanges()||[];for(let{method:n,start:o,count:r}of s)Ql$2(t,o,n===`_removeElements`?-r:r)}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let s=this.data.datasets.length,n=r=>new Set(t.filter(a=>a[0]===r).map((a,l)=>l+`,`+a.splice(1).join(`,`))),o=n(0);for(let r=1;r<s;r++)if(!Ci$1(o,n(r)))return;return Array.from(o).map(r=>r.split(`,`)).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins(`beforeLayout`,{cancelable:!0})===!1)return;G.update(this,this.width,this.height,t);let s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],R$2(this.boxes,o=>{n&&o.position===`chartArea`||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,r)=>{o._idx=r}),this.notifyPlugins(`afterLayout`)}_updateDatasets(t){if(this.notifyPlugins(`beforeDatasetsUpdate`,{mode:t,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s<n;++s)this.getDatasetMeta(s).controller.configure();for(let s=0,n=this.data.datasets.length;s<n;++s)this._updateDataset(s,ft$3(t)?t({datasetIndex:s}):t);this.notifyPlugins(`afterDatasetsUpdate`,{mode:t})}}_updateDataset(t,s){let n=this.getDatasetMeta(t),o={meta:n,index:t,mode:s,cancelable:!0};this.notifyPlugins(`beforeDatasetUpdate`,o)!==!1&&(n.controller._update(s),o.cancelable=!1,this.notifyPlugins(`afterDatasetUpdate`,o))}render(){this.notifyPlugins(`beforeRender`,{cancelable:!0})!==!1&&(mt$3.has(this)?this.attached&&!mt$3.running(this)&&mt$3.start(this):(this.draw(),io$1({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:n,height:o}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(n,o)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins(`beforeDraw`,{cancelable:!0})===!1)return;let s=this._layers;for(t=0;t<s.length&&s[t].z<=0;++t)s[t].draw(this.chartArea);for(this._drawDatasets();t<s.length;++t)s[t].draw(this.chartArea);this.notifyPlugins(`afterDraw`)}_getSortedDatasetMetas(t){let s=this._sortedMetasets,n=[],o,r;for(o=0,r=s.length;o<r;++o){let a=s[o];(!t||a.visible)&&n.push(a)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins(`beforeDatasetsDraw`,{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let s=t.length-1;s>=0;--s)this._drawDataset(t[s]);this.notifyPlugins(`afterDatasetsDraw`)}_drawDataset(t){let s=this.ctx,n={meta:t,index:t.index,cancelable:!0},o=Zi$1(this,t);this.notifyPlugins(`beforeDatasetDraw`,n)!==!1&&(o&&ge$1(s,o),t.controller.draw(),o&&pe$1(s),n.cancelable=!1,this.notifyPlugins(`afterDatasetDraw`,n))}isPointInArea(t){return rt$1(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,s,n,o){let r=il$2.modes[s];return typeof r==`function`?r(this,t,n,o):[]}getDatasetMeta(t){let s=this.data.datasets[t],n=this._metasets,o=n.filter(r=>r&&r._dataset===s).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:t,_dataset:s,_parsed:[],_sorted:!1},n.push(o)),o}getContext(){return this.$context||(this.$context=pt$2(null,{chart:this,type:`chart`}))}
vendor: 4,676 bytes, line 2615
2615getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let s=this.data.datasets[t];if(!s)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden==`boolean`?!n.hidden:!s.hidden}setDatasetVisibility(t,s){let n=this.getDatasetMeta(t);n.hidden=!s}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,s,n){let o=n?`show`:`hide`,r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,o);qt$3(s)?(r.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(r,{visible:n}),this.update(l=>l.datasetIndex===t?o:void 0))}hide(t,s){this._updateVisibility(t,s,!1)}show(t,s){this._updateVisibility(t,s,!0)}_destroyDatasetMeta(t){let s=this._metasets[t];s&&s.controller&&s.controller._destroy(),delete this._metasets[t]}_stop(){let t,s;for(this.stop(),mt$3.remove(this),t=0,s=this.data.datasets.length;t<s;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins(`beforeDestroy`);let{canvas:t,ctx:s}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Wi$1(t,s),this.platform.releaseContext(s),this.canvas=null,this.ctx=null),delete oi$2[this.id],this.notifyPlugins(`afterDestroy`)}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,s=this.platform,n=(r,a)=>{s.addEventListener(this,r,a),t[r]=a},o=(r,a,l)=>{r.offsetX=a,r.offsetY=l,this._eventHandler(r)};R$2(this.options.events,r=>n(r,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,s=this.platform,n=(c,h)=>{s.addEventListener(this,c,h),t[c]=h},o=(c,h)=>{t[c]&&(s.removeEventListener(this,c,h),delete t[c])},r=(c,h)=>{this.canvas&&this.resize(c,h)},a,l=()=>{o(`attach`,l),this.attached=!0,this.resize(),n(`resize`,r),n(`detach`,a)};a=()=>{this.attached=!1,o(`resize`,r),this._stop(),this._resize(0,0),n(`attach`,l)},s.isAttached(this.canvas)?l():a()}unbindEvents(){R$2(this._listeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._listeners={},R$2(this._responsiveListeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,s,n){let o=n?`set`:`remove`,r,a,l,c;for(s===`dataset`&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller[`_`+o+`DatasetHoverStyle`]()),l=0,c=t.length;l<c;++l){a=t[l];let h=a&&this.getDatasetMeta(a.datasetIndex).controller;h&&h[o+`HoverStyle`](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let s=this._active||[],n=t.map(({datasetIndex:r,index:a})=>{let l=this.getDatasetMeta(r);if(!l)throw new Error(`No dataset found at index `+r);return{datasetIndex:r,element:l.data[a],index:a}});!fe$2(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(t,s,n){return this._plugins.notify(this,t,s,n)}isPluginEnabled(t){return this._plugins._cache.filter(s=>s.plugin.id===t).length===1}_updateHoverStyles(t,s,n){let o=this.options.hover,r=(c,h)=>c.filter(d=>!h.some(f=>d.datasetIndex===f.datasetIndex&&d.index===f.index)),a=r(s,t),l=n?t:r(t,s);a.length&&this.updateHoverStyle(a,o.mode,!1),l.length&&o.mode&&this.updateHoverStyle(l,o.mode,!0)}_eventHandler(t,s){let n={event:t,replay:s,cancelable:!0,inChartArea:this.isPointInArea(t)},o=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins(`beforeEvent`,n,o)===!1)return;let r=this._handleEvent(t,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins(`afterEvent`,n,o),(r||n.changed)&&this.render(),this}_handleEvent(t,s,n){let{_active:o=[],options:r}=this,a=s,l=this._getActiveElements(t,o,n,a),c=on$2(t),h=tc$2(t,this._lastEvent,n,c);n&&(this._lastEvent=null,I$2(r.onHover,[t,l,this],this),c&&I$2(r.onClick,[t,l,this],this));let d=!fe$2(l,o);return(d||s)&&(this._active=l,this._updateHoverStyles(l,o,s)),this._lastEvent=h,d}_getActiveElements(t,s,n,o){if(t.type===`mouseout`)return[];if(!n)return s;let r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,o)}}return e})();function no$1(){return R$2(ui$1.instances,e=>e._plugins.invalidate())}function ec$2(e,i,t){let{startAngle:s,x:n,y:o,outerRadius:r,innerRadius:a,options:l}=i,{borderWidth:c,borderJoinStyle:h}=l,d=Math.min(c/r,U$1(s-t));if(e.beginPath(),e.arc(n,o,r-c/2,s+d/2,t-d/2),a>0){let f=Math.min(c/a,U$1(s-t));e.arc(n,o,a+c/2,t-f/2,s+f/2,!0)}else{let f=Math.min(c/2,r*U$1(s-t));if(h===`round`)e.arc(n,o,f,t-L$1/2,s+L$1/2,!0);else if(h===`bevel`){let u=2*f*f,g=-u*Math.cos(t+L$1/2)+n,p=-u*Math.sin(t
vendor: 4,325 bytes, line 2615
2615+L$1/2)+o,m=u*Math.cos(s+L$1/2)+n,x=u*Math.sin(s+L$1/2)+o;e.lineTo(g,p),e.lineTo(m,x)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip(`evenodd`)}function ic$2(e,i,t){let{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=i,c=n/a;e.beginPath(),e.arc(o,r,a,s-c,t+c),l>n?(c=n/l,e.arc(o,r,l,t+c,s-c,!0)):e.arc(o,r,n,t+V,s-V),e.closePath(),e.clip()}function sc$2(e){return Xe(e,[`outerStart`,`outerEnd`,`innerStart`,`innerEnd`])}function nc$2(e,i,t,s){let n=sc$2(e.options.borderRadius),o=(t-i)/2,r=Math.min(o,s*i/2),a=l=>{let c=(t-Math.min(o,l))*s/2;return Y(l,0,Math.min(o,c))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:Y(n.innerStart,0,r),innerEnd:Y(n.innerEnd,0,r)}}function ee$1(e,i,t,s){return{x:t+e*Math.cos(i),y:s+e*Math.sin(i)}}function hi$1(e,i,t,s,n,o){let{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=i,d=Math.max(i.outerRadius+s+t-c,0),f=h>0?h+s+t+c:0,u=0,g=n-l;if(s){let H=((h>0?h-s:0)+(d>0?d-s:0))/2;u=(g-(H!==0?g*H/(H+s):g))/2}let m=(g-Math.max(.001,g*d-t/L$1)/d)/2,x=l+m+u,b=n-m-u,{outerStart:y,outerEnd:M,innerStart:_,innerEnd:v}=nc$2(i,f,d,b-x),S=d-y,k=d-M,w=x+y/S,D=b-M/k,P=f+_,T=f+v,$=x+_/P,tt=b-v/T;if(e.beginPath(),o){let E=(w+D)/2;if(e.arc(r,a,d,w,E),e.arc(r,a,d,E,D),M>0){let q=ee$1(k,D,r,a);e.arc(q.x,q.y,M,D,b+V)}let W=ee$1(T,b,r,a);if(e.lineTo(W.x,W.y),v>0){let q=ee$1(T,tt,r,a);e.arc(q.x,q.y,v,b+V,tt+Math.PI)}let H=(b-v/f+(x+_/f))/2;if(e.arc(r,a,f,b-v/f,H,!0),e.arc(r,a,f,H,x+_/f,!0),_>0){let q=ee$1(P,$,r,a);e.arc(q.x,q.y,_,$+Math.PI,x-V)}let st=ee$1(S,x,r,a);if(e.lineTo(st.x,st.y),y>0){let q=ee$1(S,w,r,a);e.arc(q.x,q.y,y,x-V,w)}}else{e.moveTo(r,a);let E=Math.cos(w)*d+r,W=Math.sin(w)*d+a;e.lineTo(E,W);let H=Math.cos(D)*d+r,st=Math.sin(D)*d+a;e.lineTo(H,st)}e.closePath()}function oc$2(e,i,t,s,n){let{fullCircles:o,startAngle:r,circumference:a}=i,l=i.endAngle;if(o){hi$1(e,i,t,s,l,n);for(let c=0;c<o;++c)e.fill();isNaN(a)||(l=r+(a%B||B))}return hi$1(e,i,t,s,l,n),e.fill(),l}function rc$2(e,i,t,s,n){let{fullCircles:o,startAngle:r,circumference:a,options:l}=i,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:f,borderRadius:u}=l,g=l.borderAlign===`inner`;if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=f,g?(e.lineWidth=c*2,e.lineJoin=h||`round`):(e.lineWidth=c,e.lineJoin=h||`bevel`);let p=i.endAngle;if(o){hi$1(e,i,t,s,p,n);for(let m=0;m<o;++m)e.stroke();isNaN(a)||(p=r+(a%B||B))}g&&ic$2(e,i,p),l.selfJoin&&p-r>=L$1&&u===0&&h!==`miter`&&ec$2(e,i,p),o||(hi$1(e,i,t,s,p,n),e.stroke())}var ys$2=class extends xt$1{static id=`arc`;static defaults={borderAlign:`center`,borderColor:`#fff`,borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:`backgroundColor`};static descriptors={_scriptable:!0,_indexable:i=>i!==`borderDash`};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(i){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,i&&Object.assign(this,i)}inRange(i,t,s){let{angle:o,distance:r}=Ai$1(this.getProps([`x`,`y`],s),{x:i,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:h,circumference:d}=this.getProps([`startAngle`,`endAngle`,`innerRadius`,`outerRadius`,`circumference`],s),f=(this.options.spacing+this.options.borderWidth)/2,u=C(d,l-a),g=Jt(o,a,l)&&a!==l,p=u>=B||g,m=lt$1(r,c+f,h+f);return p&&m}getCenterPoint(i){let{x:t,y:s,startAngle:n,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps([`x`,`y`,`startAngle`,`endAngle`,`innerRadius`,`outerRadius`],i),{offset:l,spacing:c}=this.options,h=(n+o)/2,d=(r+a+c+l)/2;return{x:t+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(i){return this.getCenterPoint(i)}draw(i){let{options:t,circumference:s}=this,n=(t.offset||0)/4,o=(t.spacing||0)/2,r=t.circular;if(this.pixelMargin=t.borderAlign===`inner`?.33:0,this.fullCircles=s>B?Math.floor(s/B):0,s===0||this.innerRadius<0||this.outerRadius<0)return;i.save();let a=(this.startAngle+this.endAngle)/2;i.translate(Math.cos(a)*n,Math.sin(a)*n);let c=n*(1-Math.sin(Math.min(L$1,s||0)));i.fillStyle=t.backgroundColor,i.strokeStyle=t.borderColor,oc$2(i,this,c,o,r),rc$2(i,this,c,o,r),i.restore(
vendor: 5,914 bytes, line 2615
2615)}};function Ho$2(e,i,t=i){e.lineCap=C(t.borderCapStyle,i.borderCapStyle),e.setLineDash(C(t.borderDash,i.borderDash)),e.lineDashOffset=C(t.borderDashOffset,i.borderDashOffset),e.lineJoin=C(t.borderJoinStyle,i.borderJoinStyle),e.lineWidth=C(t.borderWidth,i.borderWidth),e.strokeStyle=C(t.borderColor,i.borderColor)}function ac$2(e,i,t){e.lineTo(t.x,t.y)}function lc$2(e){return e.stepped?bn$2:e.tension||e.cubicInterpolationMode===`monotone`?xn$2:ac$2}function jo$2(e,i,t={}){let s=e.length,{start:n=0,end:o=s-1}=t,{start:r,end:a}=i,l=Math.max(n,r),c=Math.min(o,a),h=n<r&&o<r||n>a&&o>a;return{count:s,start:l,loop:i.loop,ilen:c<l&&!h?s+c-l:c-l}}function cc$2(e,i,t,s){let{points:n,options:o}=i,{count:r,start:a,loop:l,ilen:c}=jo$2(n,t,s),h=lc$2(o),{move:d=!0,reverse:f}=s||{},u,g,p;for(u=0;u<=c;++u)g=n[(a+(f?c-u:u))%r],!g.skip&&(d?(e.moveTo(g.x,g.y),d=!1):h(e,p,g,f,o.stepped),p=g);return l&&(g=n[(a+(f?c:0))%r],h(e,p,g,f,o.stepped)),!!l}function hc$2(e,i,t,s){let n=i.points,{count:o,start:r,ilen:a}=jo$2(n,t,s),{move:l=!0,reverse:c}=s||{},h=0,d=0,f,u,g,p,m,x,b=M=>(r+(c?a-M:M))%o,y=()=>{p!==m&&(e.lineTo(h,m),e.lineTo(h,p),e.lineTo(h,x))};for(l&&(u=n[b(0)],e.moveTo(u.x,u.y)),f=0;f<=a;++f){if(u=n[b(f)],u.skip)continue;let M=u.x,_=u.y,v=M|0;v===g?(_<p?p=_:_>m&&(m=_),h=(d*h+M)/++d):(y(),e.lineTo(M,_),g=v,d=0,p=m=_),x=_}y()}function vs$2(e){let i=e.options,t=i.borderDash&&i.borderDash.length;return!e._decimated&&!e._loop&&!i.tension&&i.cubicInterpolationMode!==`monotone`&&!i.stepped&&!t?hc$2:cc$2}function dc$2(e){return e.stepped?Pn$2:e.tension||e.cubicInterpolationMode===`monotone`?Dn$1:vt$2}function fc$2(e,i,t,s){let n=i._path;n||(n=i._path=new Path2D,i.path(n,t,s)&&n.closePath()),Ho$2(e,i.options),e.stroke(n)}function uc$2(e,i,t,s){let{segments:n,options:o}=i,r=vs$2(i);for(let a of n)Ho$2(e,o,a.style),e.beginPath(),r(e,i,a,{start:t,end:t+s-1})&&e.closePath(),e.stroke()}var gc$2=typeof Path2D==`function`;function pc$2(e,i,t,s){gc$2&&!i.options.segment?fc$2(e,i,t,s):uc$2(e,i,t,s)}var se$2=class extends xt$1{static id=`line`;static defaults={borderCapStyle:`butt`,borderDash:[],borderDashOffset:0,borderJoinStyle:`miter`,borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:`default`,fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};static descriptors={_scriptable:!0,_indexable:i=>i!==`borderDash`&&i!==`fill`};constructor(i){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,i&&Object.assign(this,i)}updateControlPoints(i,t){let s=this.options;if((s.tension||s.cubicInterpolationMode===`monotone`)&&!s.stepped&&!this._pointsUpdated){let n=s.spanGaps?this._loop:this._fullLoop;Sn$2(this._points,s,i,n,t),this._pointsUpdated=!0}}set points(i){this._points=i,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=An(this,this.options.segment))}first(){let i=this.segments,t=this.points;return i.length&&t[i[0].start]}last(){let i=this.segments,t=this.points,s=i.length;return s&&t[i[s-1].end]}interpolate(i,t){let s=this.options,n=i[t],o=this.points,r=Ji$1(this,{property:t,start:n,end:n});if(!r.length)return;let a=[],l=dc$2(s),c,h;for(c=0,h=r.length;c<h;++c){let{start:d,end:f}=r[c],u=o[d],g=o[f];if(u===g){a.push(u);continue}let m=l(u,g,Math.abs((n-u[t])/(g[t]-u[t])),s.stepped);m[t]=i[t],a.push(m)}return a.length===1?a[0]:a}pathSegment(i,t,s){return vs$2(this)(i,this,t,s)}path(i,t,s){let n=this.segments,o=vs$2(this),r=this._loop;t=t||0,s=s||this.points.length-t;for(let a of n)r&=o(i,this,a,{start:t,end:t+s-1});return!!r}draw(i,t,s,n){let o=this.options||{};(this.points||[]).length&&o.borderWidth&&(i.save(),pc$2(i,this,s,n),i.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function oo$1(e,i,t,s){let n=e.options,{[t]:o}=e.getProps([t],s);return Math.abs(i-o)<n.radius+n.hitRadius}var mc$2=(()=>{class e extends xt$1{static id=`point`;parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:`circle`,radius:3,rotation:0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,s,n){let o=this.options,{x:r,y:a}=this.getProps([`x`,`y`],n);return Math.pow(t-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(t,s){return oo$1(this,t,`x`,s)}inYRange(t,s){return oo$1(this,t,`y`,s)}getCenterPoint(t){let{x:s,y:n}=this.getProps([`x`,`y`],t);return{x:s,y:n}}size(t){t=t||this.options||{};let s=t.radius||0;s=Math.max(s,s&&t.hoverRadius||0);let n=s&&t.borderWidth||0;return(s+n)*2}draw(t,s){let n=this.options;this.skip||n.radius<.1||!rt$1(this,s,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,Ue(t,n,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}}return e})();function Yo$2(e,i){let{x:t,y:s,base:n,width:o,height:r}=e.getProps([`x`,`y`,`base`,`width`,`height`],i),a,l,c,h,d;return e.horizontal?(d=r/2,a=Math.min(t,n),l=Math.max(t,n),c=s-d,h=s+d):(d=o/2,a=t-d,l=t+d,c=Math.min(s,n),h=Math.max(s,n)),{left:a,top:c,right:l,bottom:h}}function Dt$2(e,i,t,s){return e?0:Y(i,t,s)}function bc$2(e,i,t){let s=e.options.borderWidth,n=e.borderSkipped,o=Vi$1(s);return{t:Dt$2(n.top,o.top,0,t),r:Dt$2(n.right,o.right,0,i),b:Dt$2(n.bottom,o.bottom,0,t),l:Dt$2(n.left,o.left,0,i)}}function xc$2(e,i,t){let{enableBorderRadius:s}=e.getProps([`enableBorderRadius`]),n=e.options.borderRadius,o=Ct$1(n),r=Math.min(i,t),a=e.borderSkipped,l=s||A$1(n);return{topLeft:Dt$2(!l||a.top||a.left,o.topLeft,0,r),topRight:Dt$2(!l||a.top||a.r
2615ight,o.topRight,0,r),bottomLeft:Dt$2(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:Dt$2(!l||a.bottom||a.right,o.bottomRight,0,r)}}function _c$2(e){let i=Yo$2(e),t=i.right-i.left,s=i.bottom-i.top,n=bc$2(e,t/2,s/2),o=xc$2(e,t/2,s/2);return{outer:{x:i.left,y:i.top,w:t,h:s,radius:o},inner:{x:i.left+n.l,y:i.top+n.t,w:t-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function rs$2(e,i,t,s){let n=i===null,o=t===null,a=e&&!(n&&o)&&Yo$2(e,s);return a&&(n||lt$1(i,a.left,a.right))&&(o||lt$1(t,a.top,a.bottom))}function yc$2(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function vc$2(e,i){e.rect(i.x,i.y,i.w,i.h)}function as$2(e,i,t={}){let s=e.x!==t.x?-i:0,n=e.y!==t.y?-i:0,o=(e.x+e.w!==t.x+t.w?i:0)-s,r=(e.y+e.h!==t.y+t.h?i:0)-n;return{x:e.x+s,y:e.y+n,w:e.w+o,h:e.h+r,radius:e.radius}}var kc$2=Object.freeze({__proto__:null,ArcElement:ys$2,BarElement:(()=>{class e extends xt$1{static id=`bar`;static defaults={borderSkipped:`start`,borderWidth:0,borderRadius:0,inflateAmount:`auto`,pointStyle:void 0};static defaultRoutes={backgroundColor:`backgroundColor`,borderColor:`borderColor`};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:s,options:{borderColor:n,backgroundColor:o}}=this,{inner:r,outer:a}=_c$2(this),l=yc$2(a.radius)?Qt$1:vc$2;t.save(),(a.w!==r.w||a.h!==r.h)&&(t.beginPath(),l(t,as$2(a,s,r)),t.clip(),l(t,as$2(r,-s,a)),t.fillStyle=n,t.fill(`evenodd`)),t.beginPath(),l(t,as$2(r,s)),t.fillStyle=o,t.fill(),t.restore()}inRange(t,s,n){return rs$2(this,t,s,n)}inXRange(t,s){return rs$2(this,t,null,s)}inYRange(t,s){return rs$2(this,null,t,s)}getCenterPoint(t){let{x:s,y:n,base:o,horizontal:r}=this.getProps([`x`,`y`,`base`,`horizontal`],t);return{x:r?(s+o)/2:s,y:r?n:(n+o)/2}}getRange(t){return t===`x`?this.width/2:this.height/2}}return e})(),LineElement:se$2,PointElement:mc$2});var Ms$2=[`rgb(54, 162, 235)`,`rgb(255, 99, 132)`,`rgb(255, 159, 64)`,`rgb(255, 205, 86)`,`rgb(75, 192, 192)`,`rgb(153, 102, 255)`,`rgb(201, 203, 207)`];var ro$1=Ms$2.map(e=>e.replace(`rgb(`,`rgba(`).replace(`)`,`, 0.5)`));function $o$2(e){return Ms$2[e%Ms$2.length]}function Uo$2(e){return ro$1[e%ro$1.length]}function Sc$2(e,i){return e.borderColor=$o$2(i),e.backgroundColor=Uo$2(i),++i}function wc$2(e,i){return e.backgroundColor=e.data.map(()=>$o$2(i++)),i}function Cc$2(e,i){return e.backgroundColor=e.data.map(()=>Uo$2(i++)),i}function Pc$2(e){let i=0;return(t,s)=>{let n=e.getDatasetMeta(s).controller;n instanceof ke$3?i=wc$2(t,i):n instanceof ai$2?i=Cc$2(t,i):n&&(i=Sc$2(t,i))}}function ao$1(e){let i;for(i in e)if(e[i].borderColor||e[i].backgroundColor)return!0;return!1}function Dc$2(e){return e&&(e.borderColor||e.backgroundColor)}function Oc$2(){return F.borderColor!==`rgba(0,0,0,0.1)`||F.backgroundColor!==`rgba(0,0,0,0.1)`}var Ac$2={id:`colors`,defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,i,t){if(!t.enabled)return;let{data:{datasets:s},options:n}=e.config,{elements:o}=n,r=ao$1(s)||Dc$2(n)||o&&ao$1(o)||Oc$2();if(!t.forceOverride&&r)return;let a=Pc$2(e);s.forEach(a)}};function Tc$2(e,i,t,s,n){let o=n.samples||s;if(o>=t)return e.slice(i,i+t);let r=[],a=(t-2)/(o-2),l=0,c=i+t-1,h=i,d,f,u,g,p;for(r[l++]=e[h],d=0;d<o-2;d++){let m=0,x=0,b,y=Math.floor((d+1)*a)+1+i,M=Math.min(Math.floor((d+2)*a)+1,t)+i,_=M-y;for(b=y;b<M;b++)m+=e[b].x,x+=e[b].y;m/=_,x/=_;let v=Math.floor(d*a)+1+i,S=Math.min(Math.floor((d+1)*a)+1,t)+i,{x:k,y:w}=e[h];for(u=g=-1,b=v;b<S;b++)g=.5*Math.abs((k-m)*(e[b].y-w)-(k-e[b].x)*(x-w)),g>u&&(u=g,f=e[b],p=b);r[l++]=f,h=p}return r[l++]=e[c],r}function Lc$2(e,i,t,s){let n=0,o=0,r,a,l,c,h,d,f,u,g,p,m=[],x=i+t-1,b=e[i].x,M=e[x].x-b;for(r=i;r<i+t;++r){a=e[r],l=(a.x-b)/M*s,c=a.y;let _=l|0;if(_===h)c<g?(g=c,d=r):c>p&&(p=c,f=r),n=(o*n+a.x)/++o;else{let v=r-1;if(!O(d)&&!O(f)){let S=Math.min(d,f),k=Math.max(d,f);S!==u&&S!==v&&m.push(W$4(q$1({},e[S]),{x:n})),k!==u&&k!==v&&m.push(W$4(q$1({},e[k]),{x:n}))}r>0&&v!==u&&m.push(e[v]),m.push(a),h=_,o=0,g=p=c,d=f=u=r}}return m}function Xo$2(e){if(e._decimated){let i=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:i})}}
2615function lo$1(e){e.data.datasets.forEach(i=>{Xo$2(i)})}function Rc$2(e,i){let t=i.length,s=0,n,{iScale:o}=e,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(s=Y(ot$1(i,o.axis,r).lo,0,t-1)),c?n=Y(ot$1(i,o.axis,a).hi+1,s,t)-s:n=t-s,{start:s,count:n}}var Ec$2={id:`decimation`,defaults:{algorithm:`min-max`,enabled:!1},beforeElementsUpdate:(e,i,t)=>{if(!t.enabled){lo$1(e);return}let s=e.width;e.data.datasets.forEach((n,o)=>{let{_data:r,indexAxis:a}=n,l=e.getDatasetMeta(o),c=r||n.data;if(te([a,e.options.indexAxis])===`y`||!l.controller.supportsDecimation)return;let h=e.scales[l.xAxisID];if(h.type!==`linear`&&h.type!==`time`||e.options.parsing)return;let{start:d,count:f}=Rc$2(l,c);if(f<=(t.threshold||4*s)){Xo$2(n);return}O(r)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(t.algorithm){case`lttb`:g=Tc$2(c,d,f,s,t);break;case`min-max`:g=Lc$2(c,d,f,s);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}n._decimated=g})},destroy(e){lo$1(e)}};function Ic$2(e,i,t){let s=e.segments,n=e.points,o=i.points,r=[];for(let a of s){let{start:l,end:c}=a;c=gi$1(l,c,n);let h=ks$1(t,n[l],n[c],a.loop);if(!i.segments){r.push({source:a,target:h,start:n[l],end:n[c]});continue}let d=Ji$1(i,h);for(let f of d){let u=ks$1(t,o[f.start],o[f.end],f.loop),g=Gi$1(a,n,u);for(let p of g)r.push({source:p,target:f,start:{[t]:co$1(h,u,`start`,Math.max)},end:{[t]:co$1(h,u,`end`,Math.min)}})}}return r}function ks$1(e,i,t,s){if(s)return;let n=i[e],o=t[e];return e===`angle`&&(n=U$1(n),o=U$1(o)),{property:e,start:n,end:o}}function Fc$2(e,i){let{x:t=null,y:s=null}=e||{},n=i.points,o=[];return i.segments.forEach(({start:r,end:a})=>{a=gi$1(r,a,n);let l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:c.y}))}),o}function gi$1(e,i,t){for(;i>e;i--){let s=t[i];if(!isNaN(s.x)&&!isNaN(s.y))break}return i}function co$1(e,i,t,s){return e&&i?s(e[t],i[t]):e?e[t]:i?i[t]:0}function Ko$2(e,i){let t=[],s=!1;return z$1(e)?(s=!0,t=e):t=Fc$2(e,i),t.length?new se$2({points:t,options:{tension:0},_loop:s,_fullLoop:s}):null}function ho$1(e){return e&&e.fill!==!1}function zc$2(e,i,t){let n=e[i].fill,o=[i],r;if(!t)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!N(n))return n;if(r=e[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function Bc$2(e,i,t){let s=Hc$2(e);if(A$1(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return N(n)&&Math.floor(n)===n?Wc$2(s[0],i,n,t):[`origin`,`start`,`end`,`stack`,`shape`].indexOf(s)>=0&&s}function Wc$2(e,i,t,s){return(e===`-`||e===`+`)&&(t=i+t),t===i||t<0||t>=s?!1:t}function Nc$2(e,i){let t=null;return e===`start`?t=i.bottom:e===`end`?t=i.top:A$1(e)?t=i.getPixelForValue(e.value):i.getBasePixel&&(t=i.getBasePixel()),t}function Vc$2(e,i,t){let s;return e===`start`?s=t:e===`end`?s=i.options.reverse?i.min:i.max:A$1(e)?s=e.value:s=i.getBaseValue(),s}function Hc$2(e){let i=e.options,t=i.fill,s=C(t&&t.target,t);return s===void 0&&(s=!!i.backgroundColor),s===!1||s===null?!1:s===!0?`origin`:s}function jc$1(e){let{scale:i,index:t,line:s}=e,n=[],o=s.segments,r=s.points,a=Yc$2(i,t);a.push(Ko$2({x:null,y:i.bottom},s));for(let l=0;l<o.length;l++){let c=o[l];for(let h=c.start;h<=c.end;h++)$c$2(n,r[h],a)}return new se$2({points:n,options:{}})}function Yc$2(e,i){let t=[],s=e.getMatchingVisibleMetas(`line`);for(let n=0;n<s.length;n++){let o=s[n];if(o.index===i)break;o.hidden||t.unshift(o.dataset)}return t}function $c$2(e,i,t){let s=[];for(let n=0;n<t.length;n++){let o=t[n],{first:r,last:a,point:l}=Uc$2(o,i,`x`);if(!(!l||r&&a)){if(r)s.unshift(l);else if(e.push(l),!a)break}}e.push(...s)}function Uc$2(e,i,t){let s=e.interpolate(i,t);if(!s)return{};let n=s[t],o=e.segments,r=e.points,a=!1,l=!1;for(let c=0;c<o.length;c++){let h=o[c],d=r[h.start][t],f=r[h.end][t];if(lt$1(n,d,f)){a=n===d,l=n===f;break}}return{first:a,last:l,point:s}}var di$1=class{constructor(i){this.x=i.x,this.y=i.y,this.radius=i.radius}pathSegment(i,t,s){let{x:n,y:o,radius:r}=this;return t=t||{start:0,end:B},i.arc(n,o,r,t.end,t.start,!0),!s.bounds}interpolate(i){let{x:t,y:s,radius:n}=this,o=i.angle;return{x:t+Math.cos(o)*n,y:s+Math.sin(o)*n,angle:o}}};function Xc$2(e){let{chart:i,fill:t,line:s}=e;if(N(t))return Kc$2(i,t);if(t===`stack`)return jc$1(e);if(t===`shape`)return!0;let n=qc$2(e);return n instanceof di$1?n:Ko$2(n,s)}function Kc$2(e,i){let t=e.getDatasetMeta(i);return t&&e.isDatasetVisible(i)?t.dataset:null}function qc$2(e){return(e.scale||{}).getPointPositionForValue?Jc$2(e):Gc$2(e)}function Gc$2(e){let{scale:i={},fill:t}=e,s=Nc$2(t,i);if(N(s)){let n=i.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}
vendor: 5,231 bytes, line 2615
2615function Jc$2(e){let{scale:i,fill:t}=e,s=i.options,n=i.getLabels().length,o=s.reverse?i.max:i.min,r=Vc$2(t,i,o),a=[];if(s.grid.circular){let l=i.getPointPositionForValue(0,o);return new di$1({x:l.x,y:l.y,radius:i.getDistanceFromCenterForValue(r)})}for(let l=0;l<n;++l)a.push(i.getPointPositionForValue(l,r));return a}function ls$2(e,i,t){let s=Xc$2(i),{chart:n,index:o,line:r,scale:a,axis:l}=i,c=r.options,h=c.fill,d=c.backgroundColor,{above:f=d,below:u=d}=h||{},p=Zi$1(n,n.getDatasetMeta(o));s&&r.points.length&&(ge$1(e,t),Zc$2(e,{line:r,target:s,above:f,below:u,area:t,scale:a,axis:l,clip:p}),pe$1(e))}function Zc$2(e,i){let{line:t,target:s,above:n,below:o,area:r,scale:a,clip:l}=i,c=t._loop?`angle`:i.axis;e.save();let h=o;o!==n&&(c===`x`?(fo$1(e,s,r.top),cs$2(e,{line:t,target:s,color:n,scale:a,property:c,clip:l}),e.restore(),e.save(),fo$1(e,s,r.bottom)):c===`y`&&(uo$1(e,s,r.left),cs$2(e,{line:t,target:s,color:o,scale:a,property:c,clip:l}),e.restore(),e.save(),uo$1(e,s,r.right),h=n)),cs$2(e,{line:t,target:s,color:h,scale:a,property:c,clip:l}),e.restore()}function fo$1(e,i,t){let{segments:s,points:n}=i,o=!0,r=!1;e.beginPath();for(let a of s){let{start:l,end:c}=a,h=n[l],d=n[gi$1(l,c,n)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(h.x,t),e.lineTo(h.x,h.y)),r=!!i.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(d.x,t)}e.lineTo(i.first().x,t),e.closePath(),e.clip()}function uo$1(e,i,t){let{segments:s,points:n}=i,o=!0,r=!1;e.beginPath();for(let a of s){let{start:l,end:c}=a,h=n[l],d=n[gi$1(l,c,n)];o?(e.moveTo(h.x,h.y),o=!1):(e.lineTo(t,h.y),e.lineTo(h.x,h.y)),r=!!i.pathSegment(e,a,{move:r}),r?e.closePath():e.lineTo(t,d.y)}e.lineTo(t,i.first().y),e.closePath(),e.clip()}function cs$2(e,i){let{line:t,target:s,property:n,color:o,scale:r,clip:a}=i,l=Ic$2(t,s,n);for(let{source:c,target:h,start:d,end:f}of l){let{style:{backgroundColor:u=o}={}}=c,g=s!==!0;e.save(),e.fillStyle=u,Qc$1(e,r,a,g&&ks$1(n,d,f)),e.beginPath();let p=!!t.pathSegment(e,c),m;if(g){p?e.closePath():go$1(e,s,f,n);let x=!!s.pathSegment(e,h,{move:p,reverse:!0});m=p&&x,m||go$1(e,s,d,n)}e.closePath(),e.fill(m?`evenodd`:`nonzero`),e.restore()}}function Qc$1(e,i,t,s){let n=i.chart.chartArea,{property:o,start:r,end:a}=s||{};if(o===`x`||o===`y`){let l,c,h,d;o===`x`?(l=r,c=n.top,h=a,d=n.bottom):(l=n.left,c=r,h=n.right,d=a),e.beginPath(),t&&(l=Math.max(l,t.left),h=Math.min(h,t.right),c=Math.max(c,t.top),d=Math.min(d,t.bottom)),e.rect(l,c,h-l,d-c),e.clip()}}function go$1(e,i,t,s){let n=i.interpolate(t,s);n&&e.lineTo(n.x,n.y)}var th={id:`filler`,afterDatasetsUpdate(e,i,t){let s=(e.data.datasets||[]).length,n=[],o,r,a,l;for(r=0;r<s;++r)o=e.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof se$2&&(l={visible:e.isDatasetVisible(r),index:r,fill:Bc$2(a,r,s),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,n.push(l);for(r=0;r<s;++r)l=n[r],!(!l||l.fill===!1)&&(l.fill=zc$2(n,r,t.propagate))},beforeDraw(e,i,t){let s=t.drawTime===`beforeDraw`,n=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let r=n.length-1;r>=0;--r){let a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&ls$2(e.ctx,a,o))}},beforeDatasetsDraw(e,i,t){if(t.drawTime!==`beforeDatasetsDraw`)return;let s=e.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){let o=s[n].$filler;ho$1(o)&&ls$2(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,i,t){let s=i.meta.$filler;!ho$1(s)||t.drawTime!==`beforeDatasetDraw`||ls$2(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:`beforeDatasetDraw`}};var po$1=(e,i)=>{let{boxHeight:t=i,boxWidth:s=i}=e;return e.usePointStyle&&(t=Math.min(t,i),s=e.pointStyleWidth||Math.min(s,i)),{boxWidth:s,boxHeight:t,itemHeight:Math.max(i,t)}};var eh=(e,i)=>e!==null&&i!==null&&e.datasetIndex===i.datasetIndex&&e.index===i.index;var fi$1=class extends xt$1{constructor(i){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=i.chart,this.options=i.options,this.ctx=i.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(i,t,s){this.maxWidth=i,this.maxHeight=t,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let i=this.options.labels||{},t=I$2(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(s=>i.filter(s,this.chart.data))),i.sort&&(t=t.sort((s,n)=>i.sort(s,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:i,ctx:t}=this;if(!i.display){this.width=this.height=0;return}let s=i.labels,n=j$1(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=po$1(s,o),c,h;t.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,i.maxWidth||this.maxWidth),this.height=Math.min(h,i.maxHeight||this.maxHeight)}
vendor: 4,617 bytes, line 2615
2615_fitRows(i,t,s,n){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a,d=i;o.textAlign=`left`,o.textBaseline=`middle`;let f=-1,u=-h;return this.legendItems.forEach((g,p)=>{let m=s+t/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(d+=h,c[c.length-(p>0?0:1)]=0,u+=h,f++),l[p]={left:0,top:u,row:f,width:m,height:n},c[c.length-1]+=m+a}),d}_fitCols(i,t,s,n){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-i,d=a,f=0,u=0,g=0,p=0;return this.legendItems.forEach((m,x)=>{let{itemWidth:b,itemHeight:y}=ih(s,t,o,m,n);x>0&&u+y+2*a>h&&(d+=f+a,c.push({width:f,height:u}),g+=f+a,p++,f=u=0),l[x]={left:g,top:u,col:p,width:b,height:y},f=Math.max(f,b),u+=y+a}),d+=f,c.push({width:f,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;let i=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:s,labels:{padding:n},rtl:o}}=this,r=Ft$2(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=X$1(s,this.left+n,this.right-this.lineWidths[a]);for(let c of t)a!==c.row&&(a=c.row,l=X$1(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+i+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=X$1(s,this.top+i+n,this.bottom-this.columnSizes[a].height);for(let c of t)c.col!==a&&(a=c.col,l=X$1(s,this.top+i+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position===`top`||this.options.position===`bottom`}draw(){if(this.options.display){let i=this.ctx;ge$1(i,this),this._draw(),pe$1(i)}}_draw(){let{options:i,columnSizes:t,lineWidths:s,ctx:n}=this,{align:o,labels:r}=i,a=F.color,l=Ft$2(i.rtl,this.left,this.width),c=j$1(r.font),{padding:h}=r,d=c.size,f=d/2,u;this.drawTitle(),n.textAlign=l.textAlign(`left`),n.textBaseline=`middle`,n.lineWidth=.5,n.font=c.string;let{boxWidth:g,boxHeight:p,itemHeight:m}=po$1(r,d),x=function(v,S,k){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;n.save();let w=C(k.lineWidth,1);if(n.fillStyle=C(k.fillStyle,a),n.lineCap=C(k.lineCap,`butt`),n.lineDashOffset=C(k.lineDashOffset,0),n.lineJoin=C(k.lineJoin,`miter`),n.lineWidth=w,n.strokeStyle=C(k.strokeStyle,a),n.setLineDash(C(k.lineDash,[])),r.usePointStyle){let D={radius:p*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:w},P=l.xPlus(v,g/2),T=S+f;Ni$1(n,D,P,T,r.pointStyleWidth&&g)}else{let D=S+Math.max((d-p)/2,0),P=l.leftForLtr(v,g),T=Ct$1(k.borderRadius);n.beginPath(),Object.values(T).some($=>$!==0)?Qt$1(n,{x:P,y:D,w:g,h:p,radius:T}):n.rect(P,D,g,p),n.fill(),w!==0&&n.stroke()}n.restore()},b=function(v,S,k){wt$2(n,k.text,v,S+m/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},y=this.isHorizontal(),M=this._computeTitleHeight();y?u={x:X$1(o,this.left+h,this.right-s[0]),y:this.top+h+M,line:0}:u={x:this.left+h,y:X$1(o,this.top+M+h,this.bottom-t[0].height),line:0},Ki$1(this.ctx,i.textDirection);let _=m+h;this.legendItems.forEach((v,S)=>{n.strokeStyle=v.fontColor,n.fillStyle=v.fontColor;let k=n.measureText(v.text).width,w=l.textAlign(v.textAlign||(v.textAlign=r.textAlign)),D=g+f+k,P=u.x,T=u.y;l.setWidth(this.width),y?S>0&&P+D+h>this.right&&(T=u.y+=_,u.line++,P=u.x=X$1(o,this.left+h,this.right-s[u.line])):S>0&&T+_>this.bottom&&(P=u.x=P+t[u.line].width+h,u.line++,T=u.y=X$1(o,this.top+M+h,this.bottom-t[u.line].height));let $=l.x(P);if(x($,T,v),P=gn$3(w,P+g+f,y?P+D:this.right,i.rtl),b(l.x(P),T,v),y)u.x+=D+h;else if(typeof v.text!=`string`){let tt=c.lineHeight;u.y+=qo$2(v,tt)+h}else u.y+=_}),qi(this.ctx,i.textDirection)}drawTitle(){let i=this.options,t=i.title,s=j$1(t.font),n=K$1(t.padding);if(!t.display)return;let o=Ft$2(i.rtl,this.left,this.width),r=this.ctx,a=t.position,l=s.size/2,c=n.top+l,h,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),h=this.top+c,d=X$1(i.align,d,this.right-f);else{let g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+X$1(i.align,this.top,this.bottom-g-i.labels.padding-this._computeTitleHeight())}let u=X$1(a,d,d+f);r.textAlign=o.textAlign(Ye(a)),r.textBaseline=`middle`,r.strokeStyle=t.color,r.fillStyle=t.color,r.font=s.string,wt$2(r,t.text,u,h,s)}_computeTitleHeight(){let i=this.options.title,t=j$1(i.font),s=K$1(i.padding);return i.display?t.lineHeight+s.height:0}_getLegendItemAt(i,t){let s,n,o;if(lt$1(i,this.left,this.right)&<$1(t,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],lt$1(i,n.left,n.left+n.width)&<$1(t,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(i){let t=this.options;
vendor: 6,292 bytes, lines 2615-2617
2615if(!oh(i.type,t))return;let s=this._getLegendItemAt(i.x,i.y);if(i.type===`mousemove`||i.type===`mouseout`){let n=this._hoveredItem,o=eh(n,s);n&&!o&&I$2(t.onLeave,[i,n,this],this),this._hoveredItem=s,s&&!o&&I$2(t.onHover,[i,s,this],this)}else s&&I$2(t.onClick,[i,s,this],this)}};function ih(e,i,t,s,n){return{itemWidth:sh(s,e,i,t),itemHeight:nh(n,s,i.lineHeight)}}function sh(e,i,t,s){let n=e.text;return n&&typeof n!=`string`&&(n=n.reduce((o,r)=>o.length>r.length?o:r)),i+t.size/2+s.measureText(n).width}function nh(e,i,t){let s=e;return typeof i.text!=`string`&&(s=qo$2(i,t)),s}function qo$2(e,i){return i*(e.text?e.text.length:0)}function oh(e,i){return!!((e===`mousemove`||e===`mouseout`)&&(i.onHover||i.onLeave)||i.onClick&&(e===`click`||e===`mouseup`))}var rh={id:`legend`,_element:fi$1,start(e,i,t){let s=e.legend=new fi$1({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s)},stop(e){G.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,i,t){let s=e.legend;G.configure(e,s,t),s.options=t},afterUpdate(e){let i=e.legend;i.buildLabels(),i.adjustHitBoxes()},afterEvent(e,i){i.replay||e.legend.handleEvent(i.event)},defaults:{display:!0,position:`top`,align:`center`,fullSize:!0,reverse:!1,weight:1e3,onClick(e,i,t){let s=i.datasetIndex,n=t.chart;n.isDatasetVisible(s)?(n.hide(s),i.hidden=!0):(n.show(s),i.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let i=e.data.datasets,{labels:{usePointStyle:t,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(t?0:void 0),h=K$1(c.borderWidth);return{text:i[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:`center`,text:``}},descriptors:{_scriptable:e=>!e.startsWith(`on`),labels:{_scriptable:e=>![`generateLabels`,`filter`,`sort`].includes(e)}}};var we$1=class extends xt$1{constructor(i){super(),this.chart=i.chart,this.options=i.options,this.ctx=i.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(i,t){let s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=i,this.height=this.bottom=t;let n=z$1(s.text)?s.text.length:1;this._padding=K$1(s.padding);let o=n*j$1(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let i=this.options.position;return i===`top`||i===`bottom`}_drawArgs(i){let{top:t,left:s,bottom:n,right:o,options:r}=this,a=r.align,l=0,c,h,d;return this.isHorizontal()?(h=X$1(a,s,o),d=t+i,c=o-s):(r.position===`left`?(h=s+i,d=X$1(a,n,t),l=L$1*-.5):(h=o-i,d=X$1(a,t,n),l=L$1*.5),c=n-t),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){let i=this.ctx,t=this.options;if(!t.display)return;let s=j$1(t.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);wt$2(i,t.text,0,0,s,{color:t.color,maxWidth:l,rotation:c,textAlign:Ye(t.align),textBaseline:`middle`,translation:[r,a]})}};function ah(e,i){let t=new we$1({ctx:e.ctx,options:i,chart:e});G.configure(e,t,i),G.addBox(e,t),e.titleBlock=t}var lh={id:`title`,_element:we$1,start(e,i,t){ah(e,t)},stop(e){let i=e.titleBlock;G.removeBox(e,i),delete e.titleBlock},beforeUpdate(e,i,t){let s=e.titleBlock;G.configure(e,s,t),s.options=t},defaults:{align:`center`,display:!1,font:{weight:`bold`},fullSize:!0,padding:10,position:`top`,text:``,weight:2e3},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}};var ei$1=new WeakMap;var ch={id:`subtitle`,start(e,i,t){let s=new we$1({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s),ei$1.set(e,s)},stop(e){G.removeBox(e,ei$1.get(e)),ei$1.delete(e)},beforeUpdate(e,i,t){let s=ei$1.get(e);G.configure(e,s,t),s.options=t},defaults:{align:`center`,display:!1,font:{weight:`normal`},fullSize:!0,padding:0,position:`top`,text:``,weight:1500},defaultRoutes:{color:`color`},descriptors:{_scriptable:!0,_indexable:!1}};var Me$1={average(e){if(!e.length)return!1;let i,t,s=new Set,n=0,o=0;for(i=0,t=e.length;i<t;++i){let a=e[i].element;if(a&&a.hasValue()){let l=a.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:n/o}},nearest(e,i){if(!e.length)return!1;let t=i.x,s=i.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){let l=e[o].element;if(l&&l.hasValue()){let h=We(i,l.getCenterPoint());h<n&&(n=h,a=l)}}if(a){let l=a.tooltipPosition();t=l.x,s=l.y}return{x:t,y:s}}};function ct$3(e,i){return i&&(z$1(i)?Array.prototype.push.apply(e,i):e.push(i)),e}function bt$3(e){return(typeof e==`string`||e instanceof String)&&e.indexOf(` 2616`)>-1?e.split(` 2617`):e}function hh(e,i){let{element:t,datasetIndex:s,index:n}=i,o=e.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:e,label:r,parsed:o.getParsed(n),raw:e.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:t}}function mo$1(e,i){let t=e.chart.ctx,{body:s,footer:n,title:o}=e,{boxWidth:r,boxHeight:a}=i,l=j$1(i.bodyFont),c=j$1(i.titleFont),h=j$1(i.footerFont),d=o.length,f=n.length,u=s.length,g=K$1(i.padding),p=g.height,m=0,x=s.reduce((M,_)=>M+_.before.length+_.lines.length+_.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*i.titleSpacing+i.titleMarginBottom),x){let M=i.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=u*M+(x-u)*l.lineHeight+(x-1)*i.bodySpacing}f&&(p+=i.footerMarginTop+f*h.lineHeight+(f-1)*i.footerSpacing);let b=0,y=function(M){m=Math.max(m,t.measureText(M).width+b)};return t.save(),t.font=c.string,R$2(e.title,y),t.font=l.string,R$2(e.beforeBody.concat(e.afterBody),y),b=i.displayColors?r+2+i.boxPadding:0,R$2(s,M=>{R$2(M.before,y),R$2(M.lines,y),R$2(M.after,y)}
vendor: 9,544 bytes, line 2617
2617),b=0,t.font=h.string,R$2(e.footer,y),t.restore(),m+=g.width,{width:m,height:p}}function dh(e,i){let{y:t,height:s}=i;return t<s/2?`top`:t>e.height-s/2?`bottom`:`center`}function fh(e,i,t,s){let{x:n,width:o}=s,r=t.caretSize+t.caretPadding;if(e===`left`&&n+o+r>i.width||e===`right`&&n-o-r<0)return!0}function uh(e,i,t,s){let{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=e,c=`center`;return s===`center`?c=n<=(a+l)/2?`left`:`right`:n<=o/2?c=`left`:n>=r-o/2&&(c=`right`),fh(c,e,i,t)&&(c=`center`),c}function bo$2(e,i,t){let s=t.yAlign||i.yAlign||dh(e,t);return{xAlign:t.xAlign||i.xAlign||uh(e,i,t,s),yAlign:s}}function gh(e,i){let{x:t,width:s}=e;return i===`right`?t-=s:i===`center`&&(t-=s/2),t}function ph(e,i,t){let{y:s,height:n}=e;return i===`top`?s+=t:i===`bottom`?s-=n+t:s-=n/2,s}function xo$1(e,i,t,s){let{caretSize:n,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=t,c=n+o,{topLeft:h,topRight:d,bottomLeft:f,bottomRight:u}=Ct$1(r),g=gh(i,a),p=ph(i,l,c);return l===`center`?a===`left`?g+=c:a===`right`&&(g-=c):a===`left`?g-=Math.max(h,f)+n:a===`right`&&(g+=Math.max(d,u)+n),{x:Y(g,0,s.width-i.width),y:Y(p,0,s.height-i.height)}}function ii$2(e,i,t){let s=K$1(t.padding);return i===`center`?e.x+e.width/2:i===`right`?e.x+e.width-s.right:e.x+s.left}function _o$1(e){return ct$3([],bt$3(e))}function mh(e,i,t){return pt$2(e,{tooltip:i,tooltipItems:t,type:`tooltip`})}function yo$2(e,i){let t=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return t?e.override(t):e}var Go$2={beforeTitle:at,title(e){if(e.length>0){let i=e[0],t=i.chart.data.labels,s=t?t.length:0;if(this&&this.options&&this.options.mode===`dataset`)return i.dataset.label||``;if(i.label)return i.label;if(s>0&&i.dataIndex<s)return t[i.dataIndex]}return``},afterTitle:at,beforeBody:at,beforeLabel:at,label(e){if(this&&this.options&&this.options.mode===`dataset`)return e.label+`: `+e.formattedValue||e.formattedValue;let i=e.dataset.label||``;i&&(i+=`: `);let t=e.formattedValue;return O(t)||(i+=t),i},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:at,afterBody:at,beforeFooter:at,footer:at,afterFooter:at};function Z$1(e,i,t,s){let n=e[i].call(t,s);return typeof n>`u`?Go$2[i].call(t,s):n}var vo$1=(()=>{class e extends xt$1{static positioners=Me$1;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let s=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&s.options.animation&&n.animations,r=new ri$2(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=mh(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){let{callbacks:n}=s,o=Z$1(n,`beforeTitle`,this,t),r=Z$1(n,`title`,this,t),a=Z$1(n,`afterTitle`,this,t),l=[];return l=ct$3(l,bt$3(o)),l=ct$3(l,bt$3(r)),l=ct$3(l,bt$3(a)),l}getBeforeBody(t,s){return _o$1(Z$1(s.callbacks,`beforeBody`,this,t))}getBody(t,s){let{callbacks:n}=s,o=[];return R$2(t,r=>{let a={before:[],lines:[],after:[]},l=yo$2(n,r);ct$3(a.before,bt$3(Z$1(l,`beforeLabel`,this,r))),ct$3(a.lines,Z$1(l,`label`,this,r)),ct$3(a.after,bt$3(Z$1(l,`afterLabel`,this,r))),o.push(a)}),o}getAfterBody(t,s){return _o$1(Z$1(s.callbacks,`afterBody`,this,t))}getFooter(t,s){let{callbacks:n}=s,o=Z$1(n,`beforeFooter`,this,t),r=Z$1(n,`footer`,this,t),a=Z$1(n,`afterFooter`,this,t),l=[];return l=ct$3(l,bt$3(o)),l=ct$3(l,bt$3(r)),l=ct$3(l,bt$3(a)),l}_createItems(t){let s=this._active,n=this.chart.data,o=[],r=[],a=[],l=[],c,h;for(c=0,h=s.length;c<h;++c)l.push(hh(this.chart,s[c]));return t.filter&&(l=l.filter((d,f,u)=>t.filter(d,f,u,n))),t.itemSort&&(l=l.sort((d,f)=>t.itemSort(d,f,n))),R$2(l,d=>{let f=yo$2(t.callbacks,d);o.push(Z$1(f,`labelColor`,this,d)),r.push(Z$1(f,`labelPointStyle`,this,d)),a.push(Z$1(f,`labelTextColor`,this,d))}),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=l,l}update(t,s){let n=this.options.setContext(this.getContext()),o=this._active,r,a=[];if(!o.length)this.opacity!==0&&(r={opacity:0});else{let l=Me$1[n.position].call(this,o,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let c=this._size=mo$1(this,n),h=Object.assign({},l,c),d=bo$2(this.chart,n,h),f=xo$1(n,h,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,r={opacity:1,x:f.x,y:f.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(t,s,n,o){let r=this.getCaretPosition(t,n,o);s.lineTo(r.x1,r.y1),s.lineTo(r.x2,r.y2),s.lineTo(r.x3,r.y3)}getCaretPosition(t,s,n){let{xAlign:o,yAlign:r}=this,{caretSize:a,cornerRadius:l}=n,{topLeft:c,topRight:h,bottomLeft:d,bottomRight:f}=Ct$1(l),{x:u,y:g}=t,{width:p,height:m}=s,x,b,y,M,_,v;return r===`center`?(_=g+m/2,o===`left`?(x=u,b=x-a,M=_+a,v=_-a):(x=u+p,b=x+a,M=_-a,v=_+a),y=x):(o===`left`?b=u+Math.max(c,d)+a:o===`right`?b=u+p-Math.max(h,f)-a:b=this.caretX,r===`top`?(M=g,_=M-a,x=b-a,y=b+a):(M=g+m,_=M+a,x=b+a,y=b-a),v=M),{x1:x,x2:b,x3:y,y1:M,y2:_,y3:v}}drawTitle(t,s,n){let o=this.title,r=o.length,a,l,c;if(r){let h=Ft$2(n.rtl,this.x,this.width);for(t.x=ii$2(this,n.titleAlign,n),s.textAlign=h.textAlign(n.titleAlign),s.textBaseline=`middle`,a=j$1(n.titleFont),l=n.titleSpacing,s.fillStyle=n.titleColor,s.font=a.string,c=0;c<r;++c)s.fillText(o[c],h.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+l,c+1===r&&(t.y+=n.titleMarginBottom-l)}}_drawColorBox(t,s,n,o,r){let a=this.labelColors[n],l=this.labelPointStyles[n],{boxHeight:c,boxWidth:h}=r,d=j$1(r.bodyFont),f=ii$2(this,`left`,r),u=o.x(f),g=c<d.lineHeight?(d.lineHeight-c)/2:0,p=s.y+g;if(r.usePointStyle){let m={radius:Math.min(h,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},x=o.leftForLtr(u,h)+h/2,b=p+c/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,Ue(t,m,x,b),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Ue(t,m,x,b)}else{t.lineWidth=A$1(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let m=o.leftForLtr(u,h),x=o.leftForLtr(o.xPlus(u,1),h-2),b=Ct$1(a.borderRadius);Object.values(b).some(y=>y!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Qt$1(t,{x:m,y:p,w:h,h:c,radius:b}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Qt$1(t,{x,y:p+1,w:h-2,h:c-2,radius:b}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(m,p,h,c),t.strokeRect(m,p,h,c),t.fillStyle=a.backgroundColor,t.fillRect(x,p+1,h-2,c-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,s,n){let{body:o}=this,{bodySpacing:r,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:h,boxPadding:d}=n,f=j$1(n.bodyFont),u=f.lineHeight,g=0,p=Ft$2(n.rtl,this.x,this.width),m=function(w){s.fillText(w,p.x(t.x+g),t.y+u/2),t.y+=u+r},x=p.textAlign(a),b,y,M,_,v,S,k;for(s.textAlign=a,s.textBaseline=`middle`,s.font=f.string,t.x=ii$2(this,x,n),s.fillStyle=n.bodyColor,R$2(this.beforeBody,m),g=l&&x!==`right`?a===`center`?h/2+d:h+2+d:0,_=0,S=o.length;_<S;++_){for(b=o[_],y=this.labelTextColors[_],s.fillStyle=y,R$2(b.before,m),M=b.lines,l&&M.length&&(this._drawColorBox(s,t,_,p,n),u=Math.max(f.lineHeight,c)),v=0,k=M.length;v<k;++v)m(M[v]),u=f.lineHeight;R$2(b.after,m)}g=0,u=f.lineHeight,R$2(this.afterBody,m),t.y-=r}drawFooter(t,s,n){let o=this.footer,r=o.length,a,l;if(r){let c=Ft$2(n.rtl,this.x,this.width);for(t.x=ii$2(this,n.footerAlign,n),t.y+=n.footerMarginTop,s.textAlign=c.textAlign(n.footerAlign),s.textBaseline=`middle`,a=j$1(n.footerFont),s.fillStyle=n.footerColor,s.font=a.string,l=0;l<r;++l)s.fillText(o[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n.footerSpacing}}drawBackground(t,s,n,o){let{xAlign:r,yAlign:a}=this,{x:l,y:c}=t,{width:h,height:d}=n,{topLeft:f,topRight:u,bottomLeft:g,bottomRight:p}=Ct$1(o.cornerRadius);s.fillStyle=o.backgroundColor,s.strokeStyle=o.borderColor,s.lineWidth=o.borderWidth,s.beginPath(),s.moveTo(l+f,c),a===`top`&&this.drawCaret(t,s,n,o),s.lineTo(l+h-u,c),s.quadraticCurveTo(l+h,c,l+h,c+u),a===`center`&&r===`right`&&this.drawCaret(t,s,n,o),s.lineTo(l+h,c+d-p),s.quadraticCurveTo(l+h,c+d,l+h-p,c+d),a===`bottom`&&this.drawCaret(t,s,n,o),s.lineTo(l+g,c+d),s.quadraticCurveTo(l,c+d,l,c+d-g),a===`center`&&r===`left`&&this.drawCaret(t,s,n,o),s.lineTo(l,c+f),s.quadraticCurveTo(l,c,l
vendor: 6,745 bytes, line 2617
2617+f,c),s.closePath(),s.fill(),o.borderWidth>0&&s.stroke()}_updateAnimationTarget(t){let s=this.chart,n=this.$animations,o=n&&n.x,r=n&&n.y;if(o||r){let a=Me$1[t.position].call(this,this._active,this._eventPosition);if(!a)return;let l=this._size=mo$1(this,t),c=Object.assign({},a,this._size),h=bo$2(s,t,c),d=xo$1(t,c,h,s);(o._to!==d.x||r._to!==d.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){let s=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(s);let o={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=K$1(s.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&l&&(t.save(),t.globalAlpha=n,this.drawBackground(r,t,o,s),Ki$1(t,s.textDirection),r.y+=a.top,this.drawTitle(r,t,s),this.drawBody(r,t,s),this.drawFooter(r,t,s),qi(t,s.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,s){let n=this._active,o=t.map(({datasetIndex:l,index:c})=>{let h=this.chart.getDatasetMeta(l);if(!h)throw new Error(`Cannot find a dataset at index `+l);return{datasetIndex:l,element:h.data[c],index:c}}),r=!fe$2(n,o),a=this._positionChanged(o,s);(r||a)&&(this._active=o,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let o=this.options,r=this._active||[],a=this._getActiveElements(t,r,s,n),l=this._positionChanged(a,t),c=s||!fe$2(a,r)||l;return c&&(this._active=a,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,s))),c}_getActiveElements(t,s,n,o){let r=this.options;if(t.type===`mouseout`)return[];if(!o)return s.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,r.mode,r,n);return r.reverse&&a.reverse(),a}_positionChanged(t,s){let{caretX:n,caretY:o,options:r}=this,a=Me$1[r.position].call(this,t,s);return a!==!1&&(n!==a.x||o!==a.y)}}return e})();var xh=Object.freeze({__proto__:null,Colors:Ac$2,Decimation:Ec$2,Filler:th,Legend:rh,SubTitle:ch,Title:lh,Tooltip:{id:`tooltip`,_element:vo$1,positioners:Me$1,afterInit(e,i,t){t&&(e.tooltip=new vo$1({chart:e,options:t}))},beforeUpdate(e,i,t){e.tooltip&&e.tooltip.initialize(t)},reset(e,i,t){e.tooltip&&e.tooltip.initialize(t)},afterDraw(e){let i=e.tooltip;if(i&&i._willRender()){let t={tooltip:i};if(e.notifyPlugins(`beforeTooltipDraw`,W$4(q$1({},t),{cancelable:!0}))===!1)return;i.draw(e.ctx),e.notifyPlugins(`afterTooltipDraw`,t)}},afterEvent(e,i){if(e.tooltip){let t=i.replay;e.tooltip.handleEvent(i.event,t,i.inChartArea)&&(i.changed=!0)}},defaults:{enabled:!0,external:null,position:`average`,backgroundColor:`rgba(0,0,0,0.8)`,titleColor:`#fff`,titleFont:{weight:`bold`},titleSpacing:2,titleMarginBottom:6,titleAlign:`left`,bodyColor:`#fff`,bodySpacing:2,bodyFont:{},bodyAlign:`left`,footerColor:`#fff`,footerSpacing:2,footerMarginTop:6,footerFont:{weight:`bold`},footerAlign:`left`,padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,i)=>i.bodyFont.size,boxWidth:(e,i)=>i.bodyFont.size,multiKeyBackground:`#fff`,displayColors:!0,boxPadding:0,borderColor:`rgba(0,0,0,0)`,borderWidth:0,animation:{duration:400,easing:`easeOutQuart`},animations:{numbers:{type:`number`,properties:[`x`,`y`,`width`,`height`,`caretX`,`caretY`]},opacity:{easing:`linear`,duration:200}},callbacks:Go$2},defaultRoutes:{bodyFont:`font`,footerFont:`font`,titleFont:`font`},descriptors:{_scriptable:e=>e!==`filter`&&e!==`itemSort`&&e!==`external`,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:`animation`}},additionalOptionScopes:[`interaction`]}});var _h=(e,i,t,s)=>(typeof i==`string`?(t=e.push(i)-1,s.unshift({index:t,label:i})):isNaN(i)&&(t=null),t);function yh(e,i,t,s){let n=e.indexOf(i);if(n===-1)return _h(e,i,t,s);return n!==e.lastIndexOf(i)?t:n}var vh=(e,i)=>e===null?null:Y(Math.round(e),0,i);function Mo$2(e){let i=this.getLabels();return e>=0&&e<i.length?i[e]:e}var Mh=(()=>{class e extends Wt$1{static id=`category`;static defaults={ticks:{callback:Mo$2}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let s=this._addedLabels;if(s.length){let n=this.getLabels();for(let{index:o,label:r}of s)n[o]===r&&n.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,s){if(O(t))return null;let n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:yh(n,t,C(s,t),this._addedLabels),vh(s,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this.getMinMax(!0);this.options.bounds===`ticks`&&(t||(n=0),s||(o=this.getLabels().length-1)),this.min=n,this.max=o}buildTicks(){let t=this.min,s=this.max,n=this.options.offset,o=[],r=this.getLabels();r=t===0&&s===r.length-1?r:r.slice(t,s+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=s;a++)o.push({value:a});return o}getLabelForValue(t){return Mo$2.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!=`number`&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}return e})();function kh$1(e,i){let t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:f}=e,u=o||1,g=h-1,{min:p,max:m}=i,x=!O(r),b=!O(a),y=!O(c),M=(m-p)/(d+1),_=Pi$1((m-p)/g/u)*u,v,S,k,w;if(_<1e-14&&!x&&!b)return[{value:p},{value:m}];w=Math.ceil(m/_)-Math.floor(p/_),w>g&&(_=Pi$1(w*_/g/u)*u),O(l)||(v=Math.pow(10,l),_=Math.ceil(_*v)/v),n===`ticks`?(S=Math.floor(p/_)*_,k=Math.ceil(m/_)*_):(S=p,k=m),x&&b&&o&&an$1((a-r)/o,_/1e3)?(w=Math.round(Math.min((a-r)/_,h)),_=(a-r)/w,S=r,k=a):y?(S=x?r:S,k=b?a:k,w=c-1,_=(k-S)/w):(w=(k-S)/_,Gt$1(w,Math.round(w),_/1e3)?w=Math.round(w):w=Math.ceil(w));let D=Math.max(Oi$1(_),Oi$1(S));v=Math.pow(10,O(l)?D:l),S=Math.round(S*v)/v,k=Math.round(k*v)/v;let P=0;for(x&&(f&&S!==r?(t.push({value:r}),S<r&&P++,Gt$1(Math.round((S+P*_)*v)/v,r,ko$2(r,M,e))&&P++):S<r&&P++);P<w;++P){let T=Math.round((S+P*_)*v)/v;if(b&&T>a)break;t.push({value:T})}return b&&f&&k!==a?t.length&&Gt$1(t[t.length-1].value,a,ko$2(a,M,e))?t[t.length-1].value=a:t.push({value:a}
vendor: 7,212 bytes, line 2617
2617):(!b||k===a)&&t.push({value:k}),t}function ko$2(e,i,{horizontal:t,minRotation:s}){let n=it(s),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*i*(``+e).length;return Math.min(i/o,r)}var ne$1=class extends Wt$1{constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(i,t){return O(i)||(typeof i==`number`||i instanceof Number)&&!isFinite(+i)?null:+i}handleTickRangeOptions(){let{beginAtZero:i}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this,r=l=>n=t?n:l,a=l=>o=s?o:l;if(i){let l=nt$1(n),c=nt$1(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),i||r(n-l)}this.min=n,this.max=o}getTickLimit(){let{maxTicksLimit:t,stepSize:s}=this.options.ticks,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let i=this.options,t=i.ticks,s=this.getTickLimit();s=Math.max(2,s);let r=kh$1({maxTicks:s,bounds:i.bounds,min:i.min,max:i.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},this._range||this);return i.bounds===`ticks`&&Di$1(r,this,`value`),i.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let i=this.ticks,t=this.min,s=this.max;if(super.configure(),this.options.offset&&i.length){let n=(s-t)/Math.max(i.length-1,1)/2;t-=n,s+=n}this._startValue=t,this._endValue=s,this._valueRange=s-t}getLabelForValue(i){return Zt$1(i,this.chart.options.locale,this.options.ticks.format)}};var Sh=(()=>{class e extends ne$1{static id=`linear`;static defaults={ticks:{callback:ue$1.formatters.numeric}};determineDataLimits(){let{min:t,max:s}=this.getMinMax(!0);this.min=N(t)?t:0,this.max=N(s)?s:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),s=t?this.width:this.height,n=it(this.options.ticks.minRotation),o=(t?Math.sin(n):Math.cos(n))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(s/Math.min(40,r.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}return e})();var Ce$2=e=>Math.floor(ut$1(e));var Bt$2=(e,i)=>Math.pow(10,Ce$2(e)+i);function So$2(e){return e/Math.pow(10,Ce$2(e))===1}function wo$2(e,i,t){let s=Math.pow(10,t),n=Math.floor(e/s);return Math.ceil(i/s)-n}function wh$1(e,i){let s=Ce$2(i-e);for(;wo$2(e,i,s)>10;)s++;for(;wo$2(e,i,s)<10;)s--;return Math.min(s,Ce$2(e))}function Ch$1(e,{min:i,max:t}){i=J(e.min,i);let s=[],n=Ce$2(i),o=wh$1(i,t),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((i-l)*r)/r,h=Math.floor((i-l)/a/10)*a*10,d=Math.floor((c-h)/Math.pow(10,o)),f=J(e.min,Math.round((l+h+d*Math.pow(10,o))*r)/r);for(;f<t;)s.push({value:f,major:So$2(f),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,r=o>=0?1:r),f=Math.round((l+h+d*Math.pow(10,o))*r)/r;let u=J(e.max,f);return s.push({value:u,major:So$2(u),significand:d}),s}var Ph$1=(()=>{class e extends Wt$1{static id=`logarithmic`;static defaults={ticks:{callback:ue$1.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,s){let n=ne$1.prototype.parse.apply(this,[t,s]);if(n===0){this._zero=!0;return}return N(n)&&n>0?n:null}determineDataLimits(){let{min:t,max:s}=this.getMinMax(!0);this.min=N(t)?Math.max(0,t):null,this.max=N(s)?Math.max(0,s):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!N(this._userMin)&&(this.min=t===Bt$2(this.min,0)?Bt$2(this.min,-1):Bt$2(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:s}=this.getUserBounds(),n=this.min,o=this.max,r=l=>n=t?n:l,a=l=>o=s?o:l;n===o&&(n<=0?(r(1),a(10)):(r(Bt$2(n,-1)),a(Bt$2(o,1)))),n<=0&&r(Bt$2(o,-1)),o<=0&&a(Bt$2(n,1)),this.min=n,this.max=o}buildTicks(){let t=this.options,n=Ch$1({min:this._userMin,max:this._userMax},this);return t.bounds===`ticks`&&Di$1(n,this,`value`),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?`0`:Zt$1(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=ut$1(t),this._valueRange=ut$1(this.max)-ut$1(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ut$1(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let s=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+s*this._valueRange)}}return e})();function Ss$2(e){let i=e.ticks;if(i.display&&e.display){let t=K$1(i.backdropPadding);return C(i.font&&i.font.size,F.font.size)+t.height}return 0}function Dh$1(e,i,t){return t=z$1(t)?t:[t],{w:mn$2(e,i.string,t),h:t.length*i.lineHeight}}function Co$2(e,i,t,s,n){return e===s||e===n?{start:i-t/2,end:i+t/2}:e<s||e>n?{start:i-t,end:i}:{start:i,end:i+t}}function Oh$1(e){let i={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},t=Object.assign({},i),s=[],n=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?L$1/o:0;for(let l=0;l<o;l++){let c=r.setContext(e.getPointLabelContext(l));n[l]=c.padding;let h=e.getPointPosition(l,e.drawingArea+n[l],a),d=j$1(c.font),f=Dh$1(e.ctx,d,e._pointLabels[l]);s[l]=f;let u=U$1(e.getIndexAngle(l)+a),g=Math.round(He$1(u));Ah(t,i,u,Co$2(g,h.x,f.w,0,180),Co$2(g,h.y,f.h,90,270))}e.setCenterPoint(i.l-t.l,t.r-i.r,i.t-t.t,t.b-i.b),e._pointLabelItems=Rh$1(e,s,n)}function Ah(e,i,t,s,n){let o=Math.abs(Math.sin(t)),r=Math.abs(Math.cos(t)),a=0,l=0;s.start<i.l?(a=(i.l-s.start)/o,e.l=Math.min(e.l,i.l-a)):s.end>i.r&&(a=(s.end-i.r)/o,e.r=Math.max(e.r,i.r+a)),n.start<i.t?(l=(i.t-n.start)/r,e.t=Math.min(e.t,i.t-l)):n.end>i.b&&(l=(n.end-i.b)/r,e.b=Math.max(e.b,i.b+l))}function Th(e,i,t){let s=e.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=e.getPointPosition(i,s+n+r,o),c=Math.round(He$1(U$1(l.angle+V))),h=Fh$1(l.y,a.h,c),d=Eh$1(c),f=Ih$1(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:f,top:h,right:f+a.w,bottom:h+a.h}}function Lh$1(e,i){if(!i)return!0;let{left:t,top:s,right:n,bottom:o}=e;return!(rt$1({x:t,y:s},i)||rt$1({x:t,y:o},i)||rt$1({x:n,y:s},i)||rt$1({x:n,y:o},i))}function Rh$1(e,i,t){let s=[],n=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Ss$2(o)/2,additionalAngle:r?L$1/n:0},c;for(let h=0;h<n;h++){l.padding=t[h],l.size=i[h];let d=Th(e,h,l);s.push(d),a===`auto`&&(d.visible=Lh$1(d,c),d.visible&&(c=d))}return s}function Eh$1(e){return e===0||e===180?`center`:e<180?`left`:`right`}function Ih$1(e,i,t){return t===`right`?e-=i:t===`center`&&(e-=i/2),e}function Fh$1(e,i,t){return t===90||t===270?e-=i/2:(t>270||t<90)&&(e-=i),e}
vendor: 4,259 bytes, line 2617
2617function zh$1(e,i,t){let{left:s,top:n,right:o,bottom:r}=t,{backdropColor:a}=i;if(!O(a)){let l=Ct$1(i.borderRadius),c=K$1(i.backdropPadding);e.fillStyle=a;let h=s-c.left,d=n-c.top,f=o-s+c.width,u=r-n+c.height;Object.values(l).some(g=>g!==0)?(e.beginPath(),Qt$1(e,{x:h,y:d,w:f,h:u,radius:l}),e.fill()):e.fillRect(h,d,f,u)}}function Bh$1(e,i){let{ctx:t,options:{pointLabels:s}}=e;for(let n=i-1;n>=0;n--){let o=e._pointLabelItems[n];if(!o.visible)continue;let r=s.setContext(e.getPointLabelContext(n));zh$1(t,r,o);let a=j$1(r.font),{x:l,y:c,textAlign:h}=o;wt$2(t,e._pointLabels[n],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:`middle`})}}function Jo$2(e,i,t,s){let{ctx:n}=e;if(t)n.arc(e.xCenter,e.yCenter,i,0,B);else{let o=e.getPointPosition(0,i);n.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=e.getPointPosition(r,i),n.lineTo(o.x,o.y)}}function Wh$1(e,i,t,s,n){let o=e.ctx,r=i.circular,{color:a,lineWidth:l}=i;!r&&!s||!a||!l||t<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Jo$2(e,t,r,s),o.closePath(),o.stroke(),o.restore())}function Nh$1(e,i,t){return pt$2(e,{label:t,index:i,type:`pointLabel`})}var ws$2=class extends ne$1{static id=`radialLinear`;static defaults={display:!0,animate:!0,position:`chartArea`,angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ue$1.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(i){return i},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":`borderColor`,"pointLabels.color":`color`,"ticks.color":`color`};static descriptors={angleLines:{_fallback:`grid`}};constructor(i){super(i),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let i=this._padding=K$1(Ss$2(this.options)/2),t=this.width=this.maxWidth-i.width,s=this.height=this.maxHeight-i.height;this.xCenter=Math.floor(this.left+t/2+i.left),this.yCenter=Math.floor(this.top+s/2+i.top),this.drawingArea=Math.floor(Math.min(t,s)/2)}determineDataLimits(){let{min:i,max:t}=this.getMinMax(!1);this.min=N(i)&&!isNaN(i)?i:0,this.max=N(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ss$2(this.options))}generateTickLabels(i){ne$1.prototype.generateTickLabels.call(this,i),this._pointLabels=this.getLabels().map((t,s)=>{let n=I$2(this.options.pointLabels.callback,[t,s],this);return n||n===0?n:``}).filter((t,s)=>this.chart.getDataVisibility(s))}fit(){let i=this.options;i.display&&i.pointLabels.display?Oh$1(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(i,t,s,n){this.xCenter+=Math.floor((i-t)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(i,t,s,n))}getIndexAngle(i){let t=B/(this._pointLabels.length||1),s=this.options.startAngle||0;return U$1(i*t+it(s))}getDistanceFromCenterForValue(i){if(O(i))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-i)*t:(i-this.min)*t}getValueForDistanceFromCenter(i){if(O(i))return NaN;let t=i/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(i){let t=this._pointLabels||[];if(i>=0&&i<t.length){let s=t[i];return Nh$1(this.getContext(),i,s)}}getPointPosition(i,t,s=0){let n=this.getIndexAngle(i)-V+s;return{x:Math.cos(n)*t+this.xCenter,y:Math.sin(n)*t+this.yCenter,angle:n}}getPointPositionForValue(i,t){return this.getPointPosition(i,this.getDistanceFromCenterForValue(t))}getBasePosition(i){return this.getPointPositionForValue(i||0,this.getBaseValue())}getPointLabelPosition(i){let{left:t,top:s,right:n,bottom:o}=this._pointLabelItems[i];return{left:t,top:s,right:n,bottom:o}}drawBackground(){let{backgroundColor:i,grid:{circular:t}}=this.options;if(i){let s=this.ctx;s.save(),s.beginPath(),Jo$2(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),s.closePath(),s.fillStyle=i,s.fill(),s.restore()}}drawGrid(){let i=this.ctx,t=this.options,{angleLines:s,grid:n,border:o}=t,r=this._pointLabels.length,a,l,c;if(t.pointLabels.display&&Bh$1(this,r),n.display&&this.ticks.forEach((h,d)=>
vendor: 7,088 bytes, line 2617
2617{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let f=this.getContext(d),u=n.setContext(f),g=o.setContext(f);Wh$1(this,u,l,r,g)}}),s.display){for(i.save(),a=r-1;a>=0;a--){let h=s.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:f}=h;!f||!d||(i.lineWidth=f,i.strokeStyle=d,i.setLineDash(h.borderDash),i.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(a,l),i.beginPath(),i.moveTo(this.xCenter,this.yCenter),i.lineTo(c.x,c.y),i.stroke())}i.restore()}}drawBorder(){}drawLabels(){let i=this.ctx,t=this.options,s=t.ticks;if(!s.display)return;let n=this.getIndexAngle(0),o,r;i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign=`center`,i.textBaseline=`middle`,this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;let c=s.setContext(this.getContext(l)),h=j$1(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){i.font=h.string,r=i.measureText(a.label).width,i.fillStyle=c.backdropColor;let d=K$1(c.backdropPadding);i.fillRect(-r/2-d.left,-o-h.size/2-d.top,r+d.width,h.size+d.height)}wt$2(i,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),i.restore()}drawTitle(){}};var pi$2={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}};var Q=Object.keys(pi$2);function Po$2(e,i){return e-i}function Do$2(e,i){if(O(i))return null;let t=e._adapter,{parser:s,round:n,isoWeekday:o}=e._parseOpts,r=i;return typeof s==`function`&&(r=s(r)),N(r)||(r=typeof s==`string`?t.parse(r,s):t.parse(r)),r===null?null:(n&&(r=n===`week`&&(It$2(o)||o===!0)?t.startOf(r,`isoWeek`,o):t.startOf(r,n)),+r)}function Oo$2(e,i,t,s){let n=Q.length;for(let o=Q.indexOf(e);o<n-1;++o){let r=pi$2[Q[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((t-i)/(a*r.size))<=s)return Q[o]}return Q[n-1]}function Vh$1(e,i,t,s,n){for(let o=Q.length-1;o>=Q.indexOf(t);o--){let r=Q[o];if(pi$2[r].common&&e._adapter.diff(n,s,r)>=i-1)return r}return Q[t?Q.indexOf(t):0]}function Hh$1(e){for(let i=Q.indexOf(e)+1,t=Q.length;i<t;++i)if(pi$2[Q[i]].common)return Q[i]}function Ao$2(e,i,t){if(!t)e[i]=!0;else if(t.length){let{lo:s,hi:n}=je(t,i),o=t[s]>=i?t[s]:t[n];e[o]=!0}}function jh$1(e,i,t,s){let n=e._adapter,o=+n.startOf(i[0].value,s),r=i[i.length-1].value,a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=t[a],l>=0&&(i[l].major=!0);return i}function To$1(e,i,t){let s=[],n={},o=i.length,r,a;for(r=0;r<o;++r)a=i[r],n[a]=r,s.push({value:a,major:!1});return o===0||!t?s:jh$1(e,s,n,t)}var Cs$2=(()=>{class e extends Wt$1{static id=`time`;static defaults={bounds:`data`,adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:`millisecond`,displayFormats:{}},ticks:{source:`auto`,callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit=`day`,this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,s={}){let n=t.time||(t.time={}),o=this._adapter=new Ja$1._date(t.adapters.date);o.init(s),Kt$2(n.displayFormats,o.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized}parse(t,s){return t===void 0?null:Do$2(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,s=this._adapter,n=t.time.unit||`day`,{min:o,max:r,minDefined:a,maxDefined:l}=this.getUserBounds();function c(h){!a&&!isNaN(h.min)&&(o=Math.min(o,h.min)),!l&&!isNaN(h.max)&&(r=Math.max(r,h.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!==`ticks`||t.ticks.source!==`labels`)&&c(this.getMinMax(!1))),o=N(o)&&!isNaN(o)?o:+s.startOf(Date.now(),n),r=N(r)&&!isNaN(r)?r:+s.endOf(Date.now(),n)+1,this.min=Math.min(o,r-1),this.max=Math.max(o+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){let t=this.options,s=t.time,n=t.ticks,o=n.source===`labels`?this.getLabelTimestamps():this._generate();t.bounds===`ticks`&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);let r=this.min,a=this.max,l=hn$2(o,r,a);return this._unit=s.unit||(n.autoSkip?Oo$2(s.minUnit,this.min,this.max,this._getLabelCapacity(r)):Vh$1(this,l.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit===`year`?void 0:Hh$1(this._unit),this.initOffsets(o),t.reverse&&l.reverse(),To$1(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let s=0,n=0,o,r;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?s=1-o:s=(this.getDecimalForValue(t[1])-o)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?n=r:n=(r-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;s=Y(s,0,a),n=Y(n,0,a),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){let t=this._adapter,s=this.min,n=this.max,o=this.options,r=o.time,a=r.unit||Oo$2(r.minUnit,s,n,this._getLabelCapacity(s)),l=C(o.ticks.stepSize,1),c=a===`week`?r.isoWeekday:!1,h=It$2(c)||c===!0,d={},f=s,u,g;if(h&&(f=+t.startOf(f,`isoWeek`,c)),f=+t.startOf(f,h?`day`:a),t.diff(n,s,a)>1e5*l)throw new Error(s+` and `+n+` are too far apart with stepSize of `+l+` `+a);let p=o.ticks.source===`data`&&this.getDataTimestamps();for(u=f,g=0;u<n;u=+t.add(u,l,a),g++)Ao$2(d,u,p);return(u===n||o.bounds===`ticks`||g===1)&&Ao$2(d,u,p),Object.keys(d).sort(Po$2).map(m=>+m)}getLabelForValue(t){let s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){let o=this.options.time.displayFormats,r=this._unit,a=s||o[r];return this._adapter.format(t,a)}_tickFormatFunction(t,s,n,o){let r=this.options,a=r.ticks.callback;if(a)return I$2(a,[t,s,n],this);let l=r.time.displayFormats,c=this._unit,h=this._majorUnit,d=c&&l[c],f=h&&l[h],u=n[s],g=h&&f&&u&&u.major;return this._adapter.format(t,o||(g?f:d))}generateTickLabels(t){let s,n,o;for(s=0,n=t.length;s<n;++s)o=t[s],o.label=this._tickFormatFunction(o.value,s,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let s=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((s.start+n)*s.factor)}getValueForPixel(t){let s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){let s=this.options.ticks,n=this.ctx.measureText(t).width,o=it(this.isHorizontal()?s.maxRotation:s.minRotation),r=Math.cos(o),a=Math.sin(o),l=this._resolveTickFontOptions(0).size;return{w:n*r+l*a,h:n*a+l*r}}_getLabelCapacity(t){let s=this.options.time,n=s.displayFormats,o=n[s.unit]||n.millisecond,r=this._tick
2617FormatFunction(t,0,To$1(this,[t],this._majorUnit),o),a=this._getLabelSize(r),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;let o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(s=0,n=o.length;s<n;++s)t=t.concat(o[s].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],s,n;if(t.length)return t;let o=this.getLabels();for(s=0,n=o.length;s<n;++s)t.push(Do$2(this,o[s]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Li$1(t.sort(Po$2))}}return e})();function si$1(e,i,t){let s=0,n=e.length-1,o,r,a,l;t?(i>=e[s].pos&&i<=e[n].pos&&({lo:s,hi:n}=ot$1(e,`pos`,i)),{pos:o,time:a}=e[s],{pos:r,time:l}=e[n]):(i>=e[s].time&&i<=e[n].time&&({lo:s,hi:n}=ot$1(e,`time`,i)),{time:o,pos:a}=e[s],{time:r,pos:l}=e[n]);let c=r-o;return c?a+(l-a)*(i-o)/c:a}var Yh$1=(()=>{class e extends Cs$2{static id=`timeseries`;static defaults=Cs$2.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),s=this._table=this.buildLookupTable(t);this._minPos=si$1(s,this.min),this._tableRange=si$1(s,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:s,max:n}=this,o=[],r=[],a,l,c,h,d;for(a=0,l=t.length;a<l;++a)h=t[a],h>=s&&h<=n&&o.push(h);if(o.length<2)return[{time:s,pos:0},{time:n,pos:1}];for(a=0,l=o.length;a<l;++a)d=o[a+1],c=o[a-1],h=o[a],Math.round((d+c)/2)!==h&&r.push({time:h,pos:a/(l-1)});return r}_generate(){let t=this.min,s=this.max,n=super.getDataTimestamps();return(!n.includes(t)||!n.length)&&n.splice(0,0,t),(!n.includes(s)||n.length===1)&&n.push(s),n.sort((o,r)=>o-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let s=this.getDataTimestamps(),n=this.getLabelTimestamps();return s.length&&n.length?t=this.normalize(s.concat(n)):t=s.length?s:n,t=this._cache.all=t,t}getDecimalForValue(t){return(si$1(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let s=this._offsets,n=this.getDecimalForPixel(t)/s.factor-s.end;return si$1(this._table,n*this._tableRange+this._minPos,!0)}}return e})();var Zo$2=[Ga,kc$2,xh,Object.freeze({__proto__:null,CategoryScale:Mh,LinearScale:Sh,LogarithmicScale:Ph$1,RadialLinearScale:ws$2,TimeScale:Cs$2,TimeSeriesScale:Yh$1})];function Ps$2(e){if(!e||typeof e!=`object`)return!1;let i=Object.getPrototypeOf(e);return i===null||i===Object.prototype||Object.getPrototypeOf(i)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function Qo$2(e){return e===`__proto__`}function Nt$2(e,i){let t=Object.keys(i);for(let s=0;s<t.length;s++){let n=t[s];if(Qo$2(n))continue;let o=i[n],r=e[n];tr$2(o)&&tr$2(r)?e[n]=Nt$2(r,o):Array.isArray(o)?e[n]=Nt$2([],o):Ps$2(o)?e[n]=Nt$2({},o):(r===void 0||o!==void 0)&&(e[n]=o)}return e}function tr$2(e){return Ps$2(e)||Array.isArray(e)}var er$2=new N$2(`Configuration for ngCharts`);function bd$1(...e){return{registerables:[...Zo$2,...e]}}function xd$1(...e){return{provide:er$2,useValue:e.reduce(Nt$2,{})}}var Uh$1=(()=>{class e{constructor(){this.colorschemesOptions=new qn$4(void 0)}setColorschemesOptions(t){this.pColorschemesOptions=t,this.colorschemesOptions.next(t)}getColorschemesOptions(){return this.pColorschemesOptions}static{this.ɵfac=function(s){return new(s||e)}}static{this.ɵprov=ue$3({token:e,factory:e.ɵfac,providedIn:`root`})}}return e})();var _d$1=(()=>{class e{constructor(){this.type=`bar`,this.plugins=[],this.chartClick=new Qe$1,this.chartHover=new Qe$1,this.ctx=null,this.subs=[],this.themeOverrides={},this.element=E(Lr$5),this.zone=E(Z$4),this.themeService=E(Uh$1),this.config=E(er$2,{optional:!0}),this.platformId=E(My),this.isBrowser=Yi$2(this.platformId),this.config?.registerables&&ui$1.register(...this.config.registerables),this.config?.defaults&&F.set(this.config.defaults),this.isBrowser&&(this.ctx=this.element.nativeElement.getContext(`2d`)),this.subs.push(this.themeService.colorschemesOptions.pipe(xm()).subscribe(t=>this.themeChanged(t)))}ngOnChanges(t){if(!this.isBrowser)return;let s=[`type`],n=Object.getOwnPropertyNames(t);if(n.some(o=>s.includes(o))||n.every(o=>t[o].isFirstChange()))this.render();else if(this.chart&&t.legend){let o=this.getChartConfiguration();o.options&&(this.chart.options=o.options),this.update()}else if(this.chart){let o=this.getChartConfiguration();o.data&&this.chart.config.data&&Object.assign(this.chart.config.data,o.data),o.plugins&&this.chart.config.plugins&&Object.assign(this.chart.config.plugins,o.plugins),o.options&&this.chart.config.options&&Object.assign(this.chart.config.options,o.options),this.update()}}ngOnDestroy(){this.chart&&(this.chart.destroy(),this.chart=void 0),this.subs.forEac
2617h(t=>t.unsubscribe())}render(){if(!(!this.isBrowser||!this.ctx))return this.chart&&this.chart.destroy(),this.zone.runOutsideAngular(()=>this.chart=new ui$1(this.ctx,this.getChartConfiguration()))}update(t){this.chart&&this.isBrowser&&this.zone.runOutsideAngular(()=>this.chart?.update(t))}hideDataset(t,s){this.chart&&this.isBrowser&&(this.chart.getDatasetMeta(t).hidden=s,this.update())}isDatasetHidden(t){return this.chart?.getDatasetMeta(t)?.hidden}toBase64Image(){return this.chart?.toBase64Image()}themeChanged(t){this.themeOverrides=t,this.chart&&(this.chart.config.options&&Object.assign(this.chart.config.options,this.getChartOptions()),this.update())}getChartOptions(){return[{onHover:(t,s)=>{!this.chartHover.observed&&!this.chartHover.observers?.length||this.zone.run(()=>this.chartHover.emit({event:t,active:s}))},onClick:(t,s)=>{!this.chartClick.observed&&!this.chartClick.observers?.length||this.zone.run(()=>this.chartClick.emit({event:t,active:s}))}},this.themeOverrides??{},this.options??{},{plugins:{legend:{display:this.legend}}}].reduce(Nt$2,{})}getChartConfiguration(){return{type:this.type,data:this.getChartData(),options:this.getChartOptions(),plugins:this.plugins}}getChartData(){return this.data?this.data:{labels:this.labels||[],datasets:this.datasets||[]}}static{this.ɵfac=function(s){return new(s||e)}}static{this.ɵdir=HD({type:e,selectors:[[`canvas`,`baseChart`,``]],inputs:{type:`type`,legend:`legend`,data:`data`,options:`options`,plugins:`plugins`,labels:`labels`,datasets:`datasets`},outputs:{chartClick:`chartClick`,chartHover:`chartHover`},exportAs:[`base-chart`],features:[qy]})}}return e})();var b=gT((p,M)=>{"use strict";(function(e,t){typeof p==`object`&&typeof M<`u`?M.exports=t():typeof define==`function`&&define.amd?define(t):(e=typeof globalThis<`u`?globalThis:e||self).dayjs_plugin_advancedFormat=t()})(p,(function(){"use strict";return function(e,t){var r=t.prototype,n=r.format;r.format=function(f){var a=this,d=this.$locale();if(!this.isValid())return n.bind(this)(f);var o=this.$utils(),s=(f||`YYYY-MM-DDTHH:mm:ssZ`).replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(u){switch(u){case`Q`:return Math.ceil((a.$M+1)/3);case`Do`:return d.ordinal(a.$D);case`gggg`:return a.weekYear();case`GGGG`:return a.isoWeekYear();case`wo`:return d.ordinal(a.week(),`W`);case`w`:case`ww`:return o.s(a.week(),u===`w`?1:2,`0`);case`W`:case`WW`:return o.s(a.isoWeek(),u===`W`?1:2,`0`);case`k`:case`kk`:return o.s(String(a.$H===0?24:a.$H),u===`k`?1:2,`0`);case`X`:return Math.floor(a.$d.getTime()/1e3);case`x`:return a.$d.getTime();case`z`:return`[`+a.offsetName()+`]`;case`zzz`:return`[`+a.offsetName(`long`)+`]`;default:return u}}));return n.bind(this)(s)}}}))});var L=gT((g,y)=>{"use strict";(function(e,t){typeof g==`object`&&typeof y<`u`?y.exports=t():typeof define==`function`&&define.amd?define(t):(e=typeof globalThis<`u`?globalThis:e||self).dayjs_plugin_quarterOfYear=t()})(g,(function(){"use strict";var e=`month`,t=`quarter`;return function(r,n){var f=n.prototype;f.quarter=function(o){return this.$utils().u(o)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(o-1))};var a=f.add;f.add=function(o,s){return o=Number(o),this.$utils().p(s)===t?this.add(3*o,e):a.bind(this)(o,s)};var d=f.startOf;f.startOf=function(o,s){var u=this.$utils(),c=!!u.u(s)||s;if(u.p(o)===t){var h=this.quarter()-1;return c?this.month(3*h).startOf(e).startOf(`day`):this.month(3*h+2).endOf(e).endOf(`day`)}return d.bind(this)(o,s)}}}))});var T$1=gT((v,O)=>{"use strict";(function(e,t){typeof v==`object`&&typeof O<`u`?O.exports=t():typeof define==`function`&&define.amd?define(t):(e=typeof globalThis<`u`?globalThis:e||self).dayjs_plugin_localizedFormat=t()})(v,(function(){"use strict";var e={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`};return function(t,r,n){var f=r.prototype,a=f.format;n.en.formats=e,f.format=function(d){d===void 0&&(d=`YYYY-MM-DDTHH:mm:ssZ`);var o=this.$locale().formats,s=(function(u,c){return u.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(h,G,l){var S=l&&l.toUpperCase();return G||c[l]||e[l]||c[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(q,_,j){return _||j.slice(1)}))}))})(d,o===void 0?{}:o);return a.call(this,s)}}}))});var i$1=mT(ce$5(),1);var W$1=mT(st$2(),1);var $=mT(b(),1);var k$1=mT(L(),1);var w=mT(T$1(),1);
2617var z=mT(at$1(),1);i$1.default.extend($.default);i$1.default.extend(k$1.default);i$1.default.extend(w.default);i$1.default.extend(W$1.default);i$1.default.extend(z.default);var H={datetime:`MMM D, YYYY, h:mm:ss a`,millisecond:`h:mm:ss.SSS a`,second:`h:mm:ss a`,minute:`h:mm a`,hour:`hA`,day:`MMM D`,week:`ll`,month:`MMM YYYY`,quarter:`[Q]Q - YYYY`,year:`YYYY`};Ja$1._date.override({formats:function(){return H},parse:function(t,r){var n=typeof t;return t===null||n===`undefined`?null:n===`string`&&typeof r==`string`?(0,i$1.default)(t,r).isValid()?(0,i$1.default)(t,r).valueOf():null:t instanceof i$1.default?null:(0,i$1.default)(t).isValid()?(0,i$1.default)(t).valueOf():null},format:function(t,r){return(0,i$1.default)(t).format(r)},add:function(t,r,n){return(0,i$1.default)(t).add(r,n).valueOf()},diff:function(t,r,n){return(0,i$1.default)(t).diff((0,i$1.default)(r),n)},startOf:function(t,r,n){if(r===`isoWeek`){var f=typeof n==`number`&&n>0&&n<7?n:1;return(0,i$1.default)(t).isoWeekday(f).startOf(`day`).valueOf()}return(0,i$1.default)(t).startOf(r).valueOf()},endOf:function(t,r){return(0,i$1.default)(t).endOf(r).valueOf()}});function Zd(i,e){if(i&1){let t=Cw();Bi$3(0,`button`,9),jh$3(`pointerup`,function(){ld$2(t);return ud$1(xw().secondaryButtonClick())}),lC(1),OC(2,`translate`),vl$4()}if(i&2){let t=xw();Ah$2(`color`,t.data.secondaryButtonColor||`warn`),sE(),Cl$4(` `,LC(2,2,t.data.secondaryButtonText),` `)}}var Eh=class i{dialogRef=E(f$3);data=E(de$3);closeDialog(e=!1){this.dialogRef.close(e)}secondaryButtonClick(){this.closeDialog(`secondary`)}confirm(){this.closeDialog(!0)}cancel(){this.closeDialog(!1)}static ɵfac=function(t){return new(t||i)};static ɵcmp=PD({type:i,selectors:[[`app-confirmation-dialog`]],decls:18,vars:14,consts:[[1,`confirmation-dialog-container`,`p-4`],[1,`close-button`,3,`closed`],[1,`dialog-header`,`flex`,`justify-between`,`items-center`,`mb-4`],[1,`secondary-title`],[1,`dialog-content`,`mb-6`],[1,`text-base`],[1,`dialog-actions`,`flex`,`justify-end`,`gap-3`],[`mat-stroked-button`,``,3,`pointerup`],[`mat-flat-button`,``,3,`color`],[`mat-flat-button`,``,3,`pointerup`,`color`]],template:function(t,n){t&1&&(Bi$3(0,`div`,0)(1,`app-dialog-close-button`,1),jh$3(`closed`,function(){return n.cancel()}),vl$4(),Bi$3(2,`div`,2)(3,`h2`,3),lC(4),OC(5,`translate`),vl$4()(),Bi$3(6,`div`,4)(7,`p`,5),lC(8),OC(9,`translate`),vl$4()(),Bi$3(10,`div`,6)(11,`button`,7),jh$3(`pointerup`,function(){return n.cancel()}),lC(12),OC(13,`translate`),vl$4(),fw(14,Zd,3,4,`button`,8),Bi$3(15,`button`,9),jh$3(`pointerup`,function(){return n.confirm()}),lC(16),OC(17,`translate`),vl$4()()()),t&2&&(sE(4),ig(LC(5,6,n.data.title)),sE(4),ig(LC(9,8,n.data.message)),sE(4),Cl$4(` `,LC(13,10,n.data.cancelText||`button.cancel`),` `),sE(2),pw(n.data.secondaryButtonText?14:-1),sE(),Ah$2(`color`,n.data.confirmButtonColor||`warn`),sE(),Cl$4(` `,LC(17,12,n.data.confirmText||`button.confirm`),` `))},dependencies:[Ap$1,wp$2,yt$7,X$4,Xp$1],styles:[`[_nghost-%COMP%]{display:block;box-sizing:border-box;background-color:var(--%NS%dialog-dark-background);border-radius:10px;box-shadow:0 12px 40px #0000008c,0 0 0 1px #ffffff0f}.dialog-styling[_nghost-%COMP%], .dialog-styling [_nghost-%COMP%]{background-color:transparent;border-radius:0;box-shadow:none}.confirmation-dialog-container[_ngcontent-%COMP%]{max-width:31.25rem;min-width:18.75rem}.dialog-header[_ngcontent-%COMP%]{border-bottom:1px solid var(--%NS%border-color);padding-bottom:8px}.dialog-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0}.dialog-content[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;line-height:1.5;color:var(--%NS%text-color, #333)}.dialog-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:80px}`]})};var uu=0;var Fl$1=1;var du=2;var Mr$1=1;var fu=2;var Es$1=3;var vn=0;var zt$1=1;var un$2=2;var Nn$1=0;var Pi=1;var Ol$1=2;var Bl$1=3;var zl$1=4;var pu=5;var hi=100;var mu=101;var gu=102;var _u=103;var xu=104;var vu=200;var yu=201;var Mu=202;var Su=203;var mo=204;var go=205;var bu=206;var Tu=207;var Au=208;var Eu=209;var wu=210;var Ru=211;var Cu=212;var Iu=213;var Pu=214;var _o=0;var xo=1;var vo=2;var Li=3;var yo$1=4;var Mo$1=5;var So$1=6;var bo$1=7;var kl$1=0;var Lu=1;var Nu=2;var Mn$1=0;var Vl$1=1;var Gl$1=2;var Hl$1=3;var Wl$1=4;var Xl$1=5;var ql$1=6;var Yl$1=7;var Ml$1=`attached`;var Du=`detached`;var Sl$1=300;var gi=301;var zi=302;var Ho$1=303;var Wo$1=304;var Sr$1=306;var ui=1e3;var hn$1=1001;var cs$1=1002;var pt$1=1003;var Xo$1=1004;var ki=1005;var mt$2=1006;var ws$1=1007;var Sn$1=1008;var qt$2=1009;var Zl$1=1010;var Kl$1=1011;var Rs$1=1012;var qo$1=1013;var bn$1=1014;
2617var rn$1=1015;var Dn=1016;var Yo$1=1017;var Zo$1=1018;var Cs$1=1020;var Jl$1=35902;var $l$1=35899;var jl$1=1021;var Ql$1=1022;var on$1=1023;var In$1=1026;var _i=1027;var Ko$1=1028;var Jo$1=1029;var xi=1030;var $o$1=1031;var jo$1=1033;var br$1=33776;var Tr$1=33777;var Ar$1=33778;var Er$1=33779;var Qo$1=35840;var ea=35841;var ta=35842;var na=35843;var ia=36196;var sa=37492;var ra=37496;var oa=37488;var aa=37489;var wr$1=37490;var la=37491;var ca=37808;var ha=37809;var ua=37810;var da=37811;var fa=37812;var pa=37813;var ma=37814;var ga=37815;var _a=37816;var xa=37817;var va=37818;var ya=37819;var Ma=37820;var Sa=37821;var ba=36492;var Ta=36494;var Aa=36495;var Ea=36283;var wa=36284;var Rr$1=36285;var Ra=36286;var Ni=2300;var Di=2301;var po=2302;var bl$1=2303;var Tl$1=2400;var Al$1=2401;var El$1=2402;var Uu=2500;var ec$1=0;var Cr$1=1;var Is$1=2;var Fu=3200;var Ca=0;var Ou=1;var Qn=``;var ft$2=`srgb`;var Ot$2=`srgb-linear`;var $s$1=`linear`;var Ze=`srgb`;var Ci=7680;var wl$1=519;var Bu=512;var zu=513;var ku=514;var Ia=515;var Vu=516;var Gu=517;var Pa=518;var Hu=519;var To=35044;var tc$1=`300 es`;var _n$1=2e3;var hs$1=2001;function Kd(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Jd(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function us$1(i){return document.createElementNS(`http://www.w3.org/1999/xhtml`,i)}function Wu(){let i=us$1(`canvas`);return i.style.display=`block`,i}var wh={};var ds$1=null;function js$1(...i){let e=`THREE.`+i.shift();ds$1?ds$1(`log`,e,...i):console.log(e,...i)}function Xu(i){let e=i[0];if(typeof e==`string`&&e.startsWith(`TSL:`)){let t=i[1];t&&t.isStackTrace?i[0]+=` `+t.getLocation():i[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return i}function ye$2(...i){i=Xu(i);let e=`THREE.`+i.shift();if(ds$1)ds$1(`warn`,e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ce$1(...i){i=Xu(i);let e=`THREE.`+i.shift();if(ds$1)ds$1(`error`,e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Ii(...i){let e=i.join(` `);e in wh||(wh[e]=!0,ye$2(...i))}function qu(i,e,t){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}var Yu={[_o]:xo,[vo]:So$1,[yo$1]:bo$1,[Li]:Mo$1,[xo]:_o,[So$1]:vo,[bo$1]:yo$1,[Mo$1]:Li};var Pn$1=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let s=n[e];if(s!==void 0){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let s=n.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e);e.target=null}}};var Lt$1=[`00`,`01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`0a`,`0b`,`0c`,`0d`,`0e`,`0f`,`10`,`11`,`12`,`13`,`14`,`15`,`16`,`17`,`18`,`19`,`1a`,`1b`,`1c`,`1d`,`1e`,`1f`,`20`,`21`,`22`,`23`,`24`,`25`,`26`,`27`,`28`,`29`,`2a`,`2b`,`2c`,`2d`,`2e`,`2f`,`30`,`31`,`32`,`33`,`34`,`35`,`36`,`37`,`38`,`39`,`3a`,`3b`,`3c`,`3d`,`3e`,`3f`,`40`,`41`,`42`,`43`,`44`,`45`,`46`,`47`,`48`,`49`,`4a`,`4b`,`4c`,`4d`,`4e`,`4f`,`50`,`51`,`52`,`53`,`54`,`55`,`56`,`57`,`58`,`59`,`5a`,`5b`,`5c`,`5d`,`5e`,`5f`,`60`,`61`,`62`,`63`,`64`,`65`,`66`,`67`,`68`,`69`,`6a`,`6b`,`6c`,`6d`,`6e`,`6f`,`70`,`71`,`72`,`73`,`74`,`75`,`76`,`77`,`78`,`79`,`7a`,`7b`,`7c`,`7d`,`7e`,`7f`,`80`,`81`,`82`,`83`,`84`,`85`,`86`,`87`,`88`,`89`,`8a`,`8b`,`8c`,`8d`,`8e`,`8f`,`90`,`91`,`92`,`93`,`94`,`95`,`96`,`97`,`98`,`99`,`9a`,`9b`,`9c`,`9d`,`9e`,`9f`,`a0`,`a1`,`a2`,`a3`,`a4`,`a5`,`a6`,`a7`,`a8`,`a9`,`aa`,`ab`,`ac`,`ad`,`ae`,`af`,`b0`,`b1`,`b2`,`b3`,`b4`,`b5`,`b6`,`b7`,`b8`,`b9`,`ba`,`bb`,`bc`,`bd`,`be`,`bf`,`c0`,`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`ca`,`cb`,`cc`,`cd`,`
2617ce`,`cf`,`d0`,`d1`,`d2`,`d3`,`d4`,`d5`,`d6`,`d7`,`d8`,`d9`,`da`,`db`,`dc`,`dd`,`de`,`df`,`e0`,`e1`,`e2`,`e3`,`e4`,`e5`,`e6`,`e7`,`e8`,`e9`,`ea`,`eb`,`ec`,`ed`,`ee`,`ef`,`f0`,`f1`,`f2`,`f3`,`f4`,`f5`,`f6`,`f7`,`f8`,`f9`,`fa`,`fb`,`fc`,`fd`,`fe`,`ff`];var Rh=1234567;var Ks$1=Math.PI/180;var Ui=180/Math.PI;function xn$1(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Lt$1[i&255]+Lt$1[i>>8&255]+Lt$1[i>>16&255]+Lt$1[i>>24&255]+`-`+Lt$1[e&255]+Lt$1[e>>8&255]+`-`+Lt$1[e>>16&15|64]+Lt$1[e>>24&255]+`-`+Lt$1[t&63|128]+Lt$1[t>>8&255]+`-`+Lt$1[t>>16&255]+Lt$1[t>>24&255]+Lt$1[n&255]+Lt$1[n>>8&255]+Lt$1[n>>16&255]+Lt$1[n>>24&255]).toLowerCase()}function Ve(i,e,t){return Math.max(e,Math.min(t,i))}function nc$1(i,e){return(i%e+e)%e}function $d(i,e,t,n,s){return n+(i-e)*(s-n)/(t-e)}function jd(i,e,t){return i!==e?(t-i)/(e-i):0}function Js$1(i,e,t){return(1-t)*i+t*e}function Qd(i,e,t,n){return Js$1(i,e,1-Math.exp(-t*n))}function ef(i,e=1){return e-Math.abs(nc$1(i,e*2)-e)}function tf(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function nf(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function sf(i,e){return i+Math.floor(Math.random()*(e-i+1))}function rf(i,e){return i+Math.random()*(e-i)}function of(i){return i*(.5-Math.random())}function af(i){i!==void 0&&(Rh=i);let e=Rh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function lf(i){return i*Ks$1}function cf(i){return i*Ui}function hf(i){return(i&i-1)===0&&i!==0}function uf(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function df(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ff(i,e,t,n,s){let r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+n)/2),h=o((e+n)/2),d=r((e-n)/2),u=o((e-n)/2),f=r((n-e)/2),g=o((n-e)/2);switch(s){case`XYX`:i.set(a*h,l*d,l*u,a*c);break;case`YZY`:i.set(l*u,a*h,l*d,a*c);break;case`ZXZ`:i.set(l*d,l*u,a*h,a*c);break;case`XZX`:i.set(a*h,l*g,l*f,a*c);break;case`YXY`:i.set(l*f,a*h,l*g,a*c);break;case`ZYZ`:i.set(l*g,l*f,a*h,a*c);break;default:ye$2(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+s)}}function gn$2(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error(`THREE.MathUtils: Invalid component type.`)}}function Je(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error(`THREE.MathUtils: Invalid component type.`)}}var ic$1={DEG2RAD:Ks$1,RAD2DEG:Ui,generateUUID:xn$1,clamp:Ve,euclideanModulo:nc$1,mapLinear:$d,inverseLerp:jd,lerp:Js$1,damp:Qd,pingpong:ef,smoothstep:tf,smootherstep:nf,randInt:sf,randFloat:rf,randFloatSpread:of,seededRandom:af,degToRad:lf,radToDeg:cf,isPowerOfTwo:hf,ceilPowerOfTwo:uf,floorPowerOfTwo:df,setQuaternionFromProperEuler:ff,normalize:Je,denormalize:gn$2};var Fe$1=class i{static{i.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 17,883 bytes, line 2617
2617sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*s+e.x,this.y=r*s+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};var en=class{constructor(e=0,t=0,n=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=s}static slerpFlat(e,t,n,s,r,o,a){let l=n[s+0],c=n[s+1],h=n[s+2],d=n[s+3],u=r[o+0],f=r[o+1],g=r[o+2],y=r[o+3];if(d!==y||l!==u||c!==f||h!==g){let m=l*u+c*f+h*g+d*y;m<0&&(u=-u,f=-f,g=-g,y=-y,m=-m);let p=1-a;if(m<.9995){let E=Math.acos(m),w=Math.sin(E);p=Math.sin(p*E)/w,a=Math.sin(a*E)/w,l=l*p+u*a,c=c*p+f*a,h=h*p+g*a,d=d*p+y*a}else{l=l*p+u*a,c=c*p+f*a,h=h*p+g*a,d=d*p+y*a;let E=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=E,c*=E,h*=E,d*=E}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,s,r,o){let a=n[s],l=n[s+1],c=n[s+2],h=n[s+3],d=r[o],u=r[o+1],f=r[o+2],g=r[o+3];return e[t]=a*g+h*d+l*f-c*u,e[t+1]=l*g+h*u+c*d-a*f,e[t+2]=c*g+h*f+a*u-l*d,e[t+3]=h*g-a*d-l*u-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,s){return this._x=e,this._y=t,this._z=n,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),h=a(s/2),d=a(r/2),u=l(n/2),f=l(s/2),g=l(r/2);switch(o){case`XYZ`:this._x=u*h*d+c*f*g,this._y=c*f*d-u*h*g,this._z=c*h*g+u*f*d,this._w=c*h*d-u*f*g;break;case`YXZ`:this._x=u*h*d+c*f*g,this._y=c*f*d-u*h*g,this._z=c*h*g-u*f*d,this._w=c*h*d+u*f*g;break;case`ZXY`:this._x=u*h*d-c*f*g,this._y=c*f*d+u*h*g,this._z=c*h*g+u*f*d,this._w=c*h*d-u*f*g;break;case`ZYX`:this._x=u*h*d-c*f*g,this._y=c*f*d+u*h*g,this._z=c*h*g-u*f*d,this._w=c*h*d+u*f*g;break;case`YZX`:this._x=u*h*d+c*f*g,this._y=c*f*d+u*h*g,this._z=c*h*g-u*f*d,this._w=c*h*d-u*f*g;break;case`XZY`:this._x=u*h*d-c*f*g,this._y=c*f*d-u*h*g,this._z=c*h*g+u*f*d,this._w=c*h*d+u*f*g;break;default:ye$2(`Quaternion: .setFromEuler() encountered an unknown order: `+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,s=Math.sin(n);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],d=t[10],u=n+a+d;if(u>0){let f=.5/Math.sqrt(u+1);this._w=.25/f,this._x=(h-l)*f,this._y=(r-c)*f,this._z=(o-s)*f}else if(n>a&&n>d){let f=2*Math.sqrt(1+n-a-d);this._w=(h-l)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+c)/f}else if(a>d){let f=2*Math.sqrt(1+a-n-d);this._w=(r-c)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(l+h)/f}else{let f=2*Math.sqrt(1+d-n-a);this._w=(o-s)/f,this._x=(r+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ve(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let s=Math.min(1,t/n);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+o*a+s*c-r*l,this._y=s*h+o*l+r*a-n*c,this._z=r*h+o*c+n*l-s*a,this._w=o*h-n*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,s=e._y,r=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,s=-s,r=-r,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),h=Math.sin(c);l=Math.sin(l*c)/h,t=Math.sin(t*c)/h,this._x=this._x*l+n*t,this._y=this._y*l+s*t,this._z=this._z*l+r*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+s*t,this._z=this._z*l+r*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};var D$2=class i{static{i.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ch.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ch.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*s,this.y=r[1]*t+r[4]*n+r[7]*s,this.z=r[2]*t+r[5]*n+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*s+r[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*s-a*n),h=2*(a*t-r*s),d=2*(r*n-o*t);return this.x=t+l*c+o*d-a*h,this.y=n+l*h+a*c-r*d,this.z=s+l*d+r*h-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*s,this.y=r[1]*t+r[5]*n+r[9]*s,this.z=r[2]*t+r[6]*n+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-n*l,this.z=n*a-s*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ka.copy(this).projectOnVector(e),this.sub(Ka)}reflect(e){return this.sub(Ka.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,s=this.z-e.z;return t*t+n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let s=Math.sin(t)*e;return this.x=s*Math.sin(n),this.y=Math.cos(t)*e,this.z=s*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};var Ka=new D$2;var Ch=new en;var Pe$1=class i{static{i.prototype.isMatrix3=!0}constructor(e,t,n,s,r,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,o,a,l,c)}set(e,t,n,s,r,o,a,l,c){let h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=l,h[6]=n,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,s=t.elements,r=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],h=n[4],d=n[7],u=n[2],f=n[5],g=n[8],y=s[0],m=s[3],p=s[6],E=s[1],w=s[4],M=s[7],A=s[2],b=s[5],R=s[8];return r[0]=o*y+a*E+l*A,r[3]=o*m+a*w+l*b,r[6]=o*p+a*M+l*R,r[1]=c*y+h*E+d*A,r[4]=c*m+h*w+d*b,r[7]=c*p+h*M+d*R,r[2]=u*y+f*E+g*A,r[5]=u*m+f*w+g*b,r[8]=u*p+f*M+g*R,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-n*r*h+n*a*l+s*r*c-s*o*l}invert(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=h*o-a*c,u=a*l-h*r,f=c*r-o*l,g=t*d+n*u+s*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return e[0]=d*y,e[1]=(s*c-h*n)*y,e[2]=(a*n-s*o)*y,e[3]=u*y,e[4]=(h*t-s*l)*y,e[5]=(s*r-a*t)*y,e[6]=f*y,e[7]=(n*l-c*t)*y,e[8]=(o*t-n*r)*y,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,o,a){let l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Ii(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Ja.makeScale(e,t)),this}rotate(e){return Ii(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Ja.makeRotation(-e)),this}translate(e,t){return Ii(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Ja.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};var Ja=new Pe$1;var Ih=new Pe$1().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322);var Ph=new Pe$1().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 5,284 bytes, line 2617
26177,1.0569715);function pf(){let i={enabled:!0,workingColorSpace:Ot$2,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===Ze&&(s.r=Wn(s.r),s.g=Wn(s.g),s.b=Wn(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Ze&&(s.r=ls$1(s.r),s.g=ls$1(s.g),s.b=ls$1(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Qn?$s$1:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Ii(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Ii(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),i.colorSpaceToWorking(s,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ot$2]:{primaries:e,whitePoint:n,transfer:$s$1,toXYZ:Ih,fromXYZ:Ph,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ft$2},outputColorSpaceConfig:{drawingBufferColorSpace:ft$2}},[ft$2]:{primaries:e,whitePoint:n,transfer:Ze,toXYZ:Ih,fromXYZ:Ph,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ft$2}}}),i}var ze=pf();function Wn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ls$1(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Zi;var Ao$1=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Zi===void 0&&(Zi=us$1(`canvas`)),Zi.width=e.width,Zi.height=e.height;let s=Zi.getContext(`2d`);e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),n=Zi}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=us$1(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let s=n.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o<r.length;o++)r[o]=Wn(r[o]/255)*255;return n.putImageData(s,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Wn(t[n]/255)*255):t[n]=Wn(t[n]);return{data:t,width:e.width,height:e.height}}else return ye$2(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}};var mf=0;var fs$1=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:mf++}),this.uuid=xn$1(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push($a(s[o].image)):r.push($a(s[o]))}else r=$a(s);n.url=r}return t||(e.images[this.uuid]=n),n}};function $a(i){return typeof HTMLImageElement<`u`&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&i instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&i instanceof ImageBitmap?Ao$1.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(ye$2(`Texture: Unable to serialize Texture.`),{})}var gf=0;var ja=new D$2;var an=(()=>{class i extends Pn$1{constructor(t=i.DEFAULT_IMAGE,n=i.DEFAULT_MAPPING,s=hn$1,r=hn$1,o=mt$2,a=Sn$1,l=on$1,c=qt$2,h=i.DEFAULT_ANISOTROPY,d=Qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:gf++}),this.uuid=xn$1(),this.name=``,this.source=new fs$1(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=s,this.wrapT=r,this.magFilter=o,this.minFilter=a,this.anisotropy=h,this.format=l,this.internalFormat=null,this.type=c,this.offset=new Fe$1(0,0),this.repeat=new Fe$1(1,1),this.center=new Fe$1(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Pe$1,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace
vendor: 24,871 bytes, line 2617
2617=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(ja).x}get height(){return this.source.getSize(ja).y}get depth(){return this.source.getSize(ja).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,n){this.updateRanges.push({start:t,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let n in t){let s=t[n];if(s===void 0){ye$2(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}let r=this[n];if(r===void 0){ye$2(`Texture.setValues(): property '${n}' does not exist.`);continue}r&&s&&r.isVector2&&s.isVector2||r&&s&&r.isVector3&&s.isVector3||r&&s&&r.isMatrix3&&s.isMatrix3?r.copy(s):this[n]=s}}toJSON(t){let n=t===void 0||typeof t==`string`;if(!n&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let s={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(s.userData=this.userData),n||(t.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(t){if(this.mapping!==Sl$1)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ui:t.x=t.x-Math.floor(t.x);break;case hn$1:t.x=t.x<0?0:1;break;case cs$1:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ui:t.y=t.y-Math.floor(t.y);break;case hn$1:t.y=t.y<0?0:1;break;case cs$1:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}return i.DEFAULT_IMAGE=null,i.DEFAULT_MAPPING=Sl$1,i.DEFAULT_ANISOTROPY=1,i})();var $e=class i{static{i.prototype.isVector4=!0}constructor(e=0,t=0,n=0,s=1){this.x=e,this.y=t,this.z=n,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,s){return this.x=e,this.y=t,this.z=n,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error(`THREE.Vector4: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,s,r,l=e.elements,c=l[0],h=l[4],d=l[8],u=l[1],f=l[5],g=l[9],y=l[2],m=l[6],p=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-y)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+y)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let w=(c+1)/2,M=(f+1)/2,A=(p+1)/2,b=(h+u)/4,R=(d+y)/4,x=(g+m)/4;return w>M&&w>A?w<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(w),s=b/n,r=R/n):M>A?M<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(M),n=b/s,r=x/s):A<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(A),n=R/r,s=x/r),this.set(n,s,r,t),this}let E=Math.sqrt((m-g)*(m-g)+(d-y)*(d-y)+(u-h)*(u-h));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(d-y)/E,this.z=(u-h)/E,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this.w=Ve(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this.w=Ve(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var Eo$1=class extends Pn$1{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:mt$2,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new $e(0,0,e,t),this.scissorTest=!1,this.viewport=new $e(0,0,e,t),this.textures=[];let r=new an({width:e,height:t,depth:n.depth}),o=n.count;for(let a=0;a<o;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:mt$2,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=e,this.textures[s].image.height=t,this.textures[s].image.depth=n,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let s=Object.assign({},e.textures[t].image);this.textures[t].source=new fs$1(s)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:`dispose`})}};var tn=class extends Eo$1{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}};var Qs$1=class extends an{constructor(e=null,t=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=pt$1,this.minFilter=pt$1,this.wrapR=hn$1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var wo$1=class extends an{constructor(e=null,t=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:s},this.magFilter=pt$1,this.minFilter=pt$1,this.wrapR=hn$1,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Le=class i{static{i.prototype.isMatrix4=!0}constructor(e,t,n,s,r,o,a,l,c,h,d,u,f,g,y,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,o,a,l,c,h,d,u,f,g,y,m)}set(e,t,n,s,r,o,a,l,c,h,d,u,f,g,y,m){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=h,p[10]=d,p[14]=u,p[3]=f,p[7]=g,p[11]=y,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new i().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,s=1/Ki.setFromMatrixColumn(e,0).length(),r=1/Ki.setFromMatrixColumn(e,1).length(),o=1/Ki.setFromMatrixColumn(e,2).length();return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,s=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),d=Math.sin(r);if(e.order===`XYZ`){let u=o*h,f=o*d,g=a*h,y=a*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=f+g*c,t[5]=u-y*c,t[9]=-a*l,t[2]=y-u*c,t[6]=g+f*c,t[10]=o*l}else if(e.order===`YXZ`){let u=l*h,f=l*d,g=c*h,y=c*d;t[0]=u+y*a,t[4]=g*a-f,t[8]=o*c,t[1]=o*d,t[5]=o*h,t[9]=-a,t[2]=f*a-g,t[6]=y+u*a,t[10]=o*l}else if(e.order===`ZXY`){let u=l*h,f=l*d,g=c*h,y=c*d;t[0]=u-y*a,t[4]=-o*d,t[8]=g+f*a,t[1]=f+g*a,t[5]=o*h,t[9]=y-u*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order===`ZYX`){let u=o*h,f=o*d,g=a*h,y=a*d;t[0]=l*h,t[4]=g*c-f,t[8]=u*c+y,t[1]=l*d,t[5]=y*c+u,t[9]=f*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order===`YZX`){let u=o*l,f=o*c,g=a*l,y=a*c;t[0]=l*h,t[4]=y-u*d,t[8]=g*d+f,t[1]=d,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=f*d+g,t[10]=u-y*d}else if(e.order===`XZY`){let u=o*l,f=o*c,g=a*l,y=a*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=u*d+y,t[5]=o*h,t[9]=f*d-g,t[2]=g*d-f,t[6]=a*h,t[10]=y*d+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(_f,e,xf)}lookAt(e,t,n){let s=this.elements;return $t.subVectors(e,t),$t.lengthSq()===0&&($t.z=1),$t.normalize(),ii$1.crossVectors(n,$t),ii$1.lengthSq()===0&&(Math.abs(n.z)===1?$t.x+=1e-4:$t.z+=1e-4,$t.normalize(),ii$1.crossVectors(n,$t)),ii$1.normalize(),Vr$1.crossVectors($t,ii$1),s[0]=ii$1.x,s[4]=Vr$1.x,s[8]=$t.x,s[1]=ii$1.y,s[5]=Vr$1.y,s[9]=$t.y,s[2]=ii$1.z,s[6]=Vr$1.z,s[10]=$t.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,s=t.elements,r=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],h=n[1],d=n[5],u=n[9],f=n[13],g=n[2],y=n[6],m=n[10],p=n[14],E=n[3],w=n[7],M=n[11],A=n[15],b=s[0],R=s[4],x=s[8],T=s[12],L=s[1],C=s[5],F=s[9],X=s[13],$=s[2],O=s[6],q=s[10],V=s[14],J=s[3],Q=s[7],he=s[11],pe=s[15];return r[0]=o*b+a*L+l*$+c*J,r[4]=o*R+a*C+l*O+c*Q,r[8]=o*x+a*F+l*q+c*he,r[12]=o*T+a*X+l*V+c*pe,r[1]=h*b+d*L+u*$+f*J,r[5]=h*R+d*C+u*O+f*Q,r[9]=h*x+d*F+u*q+f*he,r[13]=h*T+d*X+u*V+f*pe,r[2]=g*b+y*L+m*$+p*J,r[6]=g*R+y*C+m*O+p*Q,r[10]=g*x+y*F+m*q+p*he,r[14]=g*T+y*X+m*V+p*pe,r[3]=E*b+w*L+M*$+A*J,r[7]=E*R+w*C+M*O+A*Q,r[11]=E*x+w*F+M*q+A*he,r[15]=E*T+w*X+M*V+A*pe,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],d=e[6],u=e[10],f=e[14],g=e[3],y=e[7],m=e[11],p=e[15],E=l*f-c*u,w=a*f-c*d,M=a*u-l*d,A=o*f-c*h,b=o*u-l*h,R=o*d-a*h;return t*(y*E-m*w+p*M)-n*(g*E-m*A+p*b)+s*(g*w-y*A+p*R)-r*(g*M-y*b+m*R)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],s=e[8],r=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10];return t*(o*h-a*c)-n*(r*h-a*l)+s*(r*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=e[9],u=e[10],f=e[11],g=e[12],y=e[13],m=e[14],p=e[15],E=t*a-n*o,w=t*l-s*o,M=t*c-r*o,A=n*l-s*a,b=n*c-r*a,R=s*c-r*l,x=h*y-d*g,T=h*m-u*g,L=h*p-f*g,C=d*m-u*y,F=d*p-f*y,X=u*p-f*m,$=E*X-w*F+M*C+A*L-b*T+R*x;if($===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let O=1/$;return e[0]=(a*X-l*F+c*C)*O,e[1]=(s*F-n*X-r*C)*O,e[2]=(y*R-m*b+p*A)*O,e[3]=(u*b-d*R-f*A)*O,e[4]=(l*L-o*X-c*T)*O,e[5]=(t*X-s*L+r*T)*O,e[6]=(m*M-g*R-p*w)*O,e[7]=(h*R-u*M+f*w)*O,e[8]=(o*F-a*L+c*x)*O,e[9]=(n*L-t*F-r*x)*O,e[10]=(g*b-y*M+p*E)*O,e[11]=(d*M-h*b-f*E)*O,e[12]=(a*T-o*C-l*x)*O,e[13]=(t*C-n*T+s*x)*O,e[14]=(y*w-g*A-m*E)*O,e[15]=(h*A-d*w+u*E)*O,this}scale(e){let t=this.elements,n=e.x,s=e.y,r=e.z;return t[0]*=n,t[4]*=s,t[8]*=r,t[1]*=n,t[5]*=s,t[9]*=r,t[2]*=n,t[6]*=s,t[10]*=r,t[3]*=n,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,s))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),s=Math.sin(t),r=1-n,o=e.x,a=e.y,l=e.z,c=r*o,h=r*a;return this.set(c*o+n,c*a-s*l,c*l+s*a,0,c*a+s*l,h*a+n,h*l-s*o,0,c*l-s*a,h*l+s*o,r*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,s,r,o){return this.set(1,n,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,n){let s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,h=o+o,d=a+a,u=r*c,f=r*h,g=r*d,y=o*h,m=o*d,p=a*d,E=l*c,w=l*h,M=l*d,A=n.x,b=n.y,R=n.z;return s[0]=(1-(y+p))*A,s[1]=(f+M)*A,s[2]=(g-w)*A,s[3]=0,s[4]=(f-M)*b,s[5]=(1-(u+p))*b,s[6]=(m+E)*b,s[7]=0,s[8]=(g+w)*R,s[9]=(m-E)*R,s[10]=(1-(u+y))*R,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,n){let s=this.elements;e.x=s[12],e.y=s[13],e.z=s[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let o=Ki.set(s[0],s[1],s[2]).length(),a=Ki.set(s[4],s[5],s[6]).length(),l=Ki.set(s[8],s[9],s[10]).length();r<0&&(o=-o),fn$2.copy(this);let c=1/o,h=1/a,d=1/l;return fn$2.elements[0]*=c,fn$2.elements[1]*=c,fn$2.elements[2]*=c,fn$2.elements[4]*=h,fn$2.elements[5]*=h,fn$2.elements[6]*=h,fn$2.elements[8]*=d,fn$2.elements[9]*=d,fn$2.elements[10]*=d,t.setFromRotationMatrix(fn$2),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,s,r,o,a=_n$1,l=!1){let c=this.elements,h=2*r/(t-e),d=2*r/(n-s),u=(t+e)/(t-e),f=(n+s)/(n-s),g,y;if(l)g=r/(o-r),y=o*r/(o-r);else if(a===_n$1)g=-(o+r)/(o-r),y=-2*o*r/(o-r);else if(a===hs$1)g=-o/(o-r),y=-o*r/(o-r);else throw new Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+a);return c[0]=h,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=d,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=y,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,s,r,o,a=_n$1,l=!1){let c=this.elements,h=2/(t-e),d=2/(n-s),u=-(t+e)/(t-e),f=-(n+s)/(n-s),g,y;if(l)g=1/(o-r),y=o/(o-r);else if(a===_n$1)g=-2/(o-r),y=-(o+r)/(o-r);else if(a===hs$1)g=-1/(o-r),y=-r/(o-r);else throw new Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+a);return c[0]=h,c[4]=0,c[8]=0,c[12]=u,c[1]=0,c[5]=d,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=g,c[14]=y,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let s=0;s<16;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};var Ki=new D$2;var fn$2=new Le;var _f=new D$2(0,0,0);var xf=new D$2(1,1,1);var ii$1=new D$2;var Vr$1=new D$2;var $t=new D$2;var Lh=new Le;var Nh=new en;var ps$1=(()=>{class i{constructor(t=0,n=0,s=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=s,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,n,s,r=this._order){return this._x=t,this._y=n,this._z=s,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,n=this._order,s=!0){let r=t.elements,o=r[0],a=r[4],l=r[8],c=r[1],h=r[5],d=r[9],u=r[2],f=r[6],g=r[10];switch(n){case`XYZ`:this._y=Math.asin(Ve(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(f,h),this._z=0);break;case`YXZ`:this._x=Math.asin(-Ve(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(l,g),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,o),this._z=0);break;case`ZXY`:this._x=Math.asin(Ve(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,g),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,o));break;case`ZYX`:this._y=Math.asin(-Ve(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,g),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,h));break;case`YZX`:this._z=Math.asin(Ve(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(l,g));break;case`XZY`:this._z=Math.asin(-Ve(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,h),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-d,g),this._y=0);break;default:ye$2(`Euler: .setFromRotationMatrix() encountered an unknown order: `+n)}return this._order=n,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,n,s){return Lh.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Lh,n,s)}setFromVector3(t,n=this._order){return this.set(t.x,t.y,t.z,n)}reorder(t){return Nh.setFromEuler(this),this.setFromQuaternion(Nh,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}return i.DEFAULT_ORDER=`XYZ`,i})();var ms$1=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}
2617isEnabled(e){return(this.mask&(1<<e|0))!==0}};var vf=0;var Dh=new D$2;var Ji=new en;var Bn=new Le;var Gr$1=new D$2;var Vs$1=new D$2;var yf=new D$2;var Mf=new en;var Uh=new D$2(1,0,0);var Fh=new D$2(0,1,0);var Oh=new D$2(0,0,1);var Bh={type:`added`};var Sf={type:`removed`};var $i={type:`childadded`,child:null};var Qa={type:`childremoved`,child:null};var bt$2=(()=>{class i extends Pn$1{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:vf++}),this.uuid=xn$1(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let t=new D$2,n=new ps$1,s=new en,r=new D$2(1,1,1);function o(){s.setFromEuler(n,!1)}function a(){n.setFromQuaternion(s,void 0,!1)}n._onChange(o),s._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Le},normalMatrix:{value:new Pe$1}}),this.matrix=new Le,this.matrixWorld=new Le,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ms$1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,n){this.quaternion.setFromAxisAngle(t,n)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,n){return Ji.setFromAxisAngle(t,n),this.quaternion.multiply(Ji),this}rotateOnWorldAxis(t,n){return Ji.setFromAxisAngle(t,n),this.quaternion.premultiply(Ji),this}rotateX(t){return this.rotateOnAxis(Uh,t)}rotateY(t){return this.rotateOnAxis(Fh,t)}rotateZ(t){return this.rotateOnAxis(Oh,t)}translateOnAxis(t,n){return Dh.copy(t).applyQuaternion(this.quaternion),this.position.add(Dh.multiplyScalar(n)),this}translateX(t){return this.translateOnAxis(Uh,t)}translateY(t){return this.translateOnAxis(Fh,t)}translateZ(t){return this.translateOnAxis(Oh,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Bn.copy(this.matrixWorld).invert())}lookAt(t,n,s){t.isVector3?Gr$1.copy(t):Gr$1.set(t,n,s);let r=this.parent;this.updateWorldMatrix(!0,!1),Vs$1.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bn.lookAt(Vs$1,Gr$1,this.up):Bn.lookAt(Gr$1,Vs$1,this.up),this.quaternion.setFromRotationMatrix(Bn),r&&(Bn.extractRotation(r.matrixWorld),Ji.setFromRotationMatrix(Bn),this.quaternion.premultiply(Ji.invert()))}add(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return t===this?(Ce$1(`Object3D.add: object can't be added as a child of itself.`,t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Bh),$i.child=t,this.dispatchEvent($i),$i.child=null):Ce$1(`Object3D.add: object not an instance of THREE.Object3D.`,t),this)}remove(t){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.remove(arguments[s]);return this}let n=this.children.indexOf(t);
vendor: 4,308 bytes, line 2617
2617return n!==-1&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Sf),Qa.child=t,this.dispatchEvent(Qa),Qa.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Bn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Bn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Bn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Bh),$i.child=t,this.dispatchEvent($i),$i.child=null,this}getObjectById(t){return this.getObjectByProperty(`id`,t)}getObjectByName(t){return this.getObjectByProperty(`name`,t)}getObjectByProperty(t,n){if(this[t]===n)return this;for(let s=0,r=this.children.length;s<r;s++){let a=this.children[s].getObjectByProperty(t,n);if(a!==void 0)return a}}getObjectsByProperty(t,n,s=[]){this[t]===n&&s.push(this);let r=this.children;for(let o=0,a=r.length;o<a;o++)r[o].getObjectsByProperty(t,n,s);return s}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vs$1,t,yf),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Vs$1,Mf,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let n=this.matrixWorld.elements;return t.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(t){t(this);let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].traverseVisible(t)}traverseAncestors(t){let n=this.parent;n!==null&&(t(n),n.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let n=t.x,s=t.y,r=t.z,o=this.matrix.elements;o[12]+=n-o[0]*n-o[4]*s-o[8]*r,o[13]+=s-o[1]*n-o[5]*s-o[9]*r,o[14]+=r-o[2]*n-o[6]*s-o[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].updateMatrixWorld(t)}updateWorldMatrix(t,n,s=!1){let r=this.parent;if(t===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||s)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,s=!0),n===!0){let o=this.children;for(let a=0,l=o.length;a<l;a++)o[a].updateWorldMatrix(!1,!0,s)}}toJSON(t){let n=t===void 0||typeof t==`string`,s={};n&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(l=>W$4(q$1({}
vendor: 17,093 bytes, line 2617
2617,l),{boundingBox:l.boundingBox?l.boundingBox.toJSON():void 0,boundingSphere:l.boundingSphere?l.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(l=>q$1({},l)),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(t),r.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function o(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(t)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=o(t.geometries,this.geometry);let l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){let c=l.shapes;if(Array.isArray(c))for(let h=0,d=c.length;h<d;h++){let u=c[h];o(t.shapes,u)}else o(t.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let l=[];for(let c=0,h=this.material.length;c<h;c++)l.push(o(t.materials,this.material[c]));r.material=l}else r.material=o(t.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){let c=this.animations[l];r.animations.push(o(t.animations,c))}}if(n){let l=a(t.geometries),c=a(t.materials),h=a(t.textures),d=a(t.images),u=a(t.shapes),f=a(t.skeletons),g=a(t.animations),y=a(t.nodes);l.length>0&&(s.geometries=l),c.length>0&&(s.materials=c),h.length>0&&(s.textures=h),d.length>0&&(s.images=d),u.length>0&&(s.shapes=u),f.length>0&&(s.skeletons=f),g.length>0&&(s.animations=g),y.length>0&&(s.nodes=y)}return s.object=r,s;function a(l){let c=[];for(let h in l){let d=l[h];delete d.metadata,c.push(d)}return c}}clone(t){return new this.constructor().copy(this,t)}copy(t,n=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),n===!0)for(let s=0;s<t.children.length;s++){let r=t.children[s];this.add(r.clone())}return this}}return i.DEFAULT_UP=new D$2(0,1,0),i.DEFAULT_MATRIX_AUTO_UPDATE=!0,i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,i})();var Qt=class extends bt$2{constructor(){super(),this.isGroup=!0,this.type=`Group`}};var bf={type:`move`};var gs$1=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qt,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Qt,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D$2,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D$2),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qt,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D$2,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D$2,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let s=null,r=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){o=!0;for(let y of e.hand.values()){let m=t.getJointPose(y,n),p=this._getHandJoint(c,y);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}let h=c.joints[`index-finger-tip`],d=c.joints[`thumb-tip`],u=h.position.distanceTo(d.position);c.inputState.pinching&&u>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:`gripUpdated`,data:e,target:this})));a!==null&&(s=t.getPose(e.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(bf)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Qt;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}};var Zu={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};var si={h:0,s:0,l:0};var Hr$1={h:0,s:0,l:0};function el$1(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ae$1=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let s=e;s&&s.isColor?this.copy(s):typeof s==`number`?this.setHex(s):typeof s==`string`&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ft$2){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ze.colorSpaceToWorking(this,t),this}setRGB(e,t,n,s=ze.workingColorSpace){return this.r=e,this.g=t,this.b=n,ze.colorSpaceToWorking(this,s),this}setHSL(e,t,n,s=ze.workingColorSpace){if(e=nc$1(e,1),t=Ve(t,0,1),n=Ve(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=el$1(o,r,e+1/3),this.g=el$1(o,r,e),this.b=el$1(o,r,e-1/3)}return ze.colorSpaceToWorking(this,s),this}setStyle(e,t=ft$2){function n(r){r!==void 0&&parseFloat(r)<1&&ye$2(`Color: Alpha component of `+e+` will be ignored.`)}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,o=s[1],a=s[2];switch(o){case`rgb`:case`rgba`:if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case`hsl`:case`hsla`:if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:ye$2(`Color: Unknown color model `+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);ye$2(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ft$2){let n=Zu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ye$2(`Color: Unknown color `+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Wn(e.r),this.g=Wn(e.g),this.b=Wn(e.b),this}copyLinearToSRGB(e){return this.r=ls$1(e.r),this.g=ls$1(e.g),this.b=ls$1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ft$2){return ze.workingToColorSpace(Nt$1.copy(this),e),Math.round(Ve(Nt$1.r*255,0,255))*65536+Math.round(Ve(Nt$1.g*255,0,255))*256+Math.round(Ve(Nt$1.b*255,0,255))}getHexString(e=ft$2){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ze.workingColorSpace){ze.workingToColorSpace(Nt$1.copy(this),t);let n=Nt$1.r,s=Nt$1.g,r=Nt$1.b,o=Math.max(n,s,r),a=Math.min(n,s,r),l,c,h=(a+o)/2;if(a===o)l=0,c=0;else{let d=o-a;switch(c=h<=.5?d/(o+a):d/(2-o-a),o){case n:l=(s-r)/d+(s<r?6:0);break;case s:l=(r-n)/d+2;break;case r:l=(n-s)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=ze.workingColorSpace){return ze.workingToColorSpace(Nt$1.copy(this),t),e.r=Nt$1.r,e.g=Nt$1.g,e.b=Nt$1.b,e}getStyle(e=ft$2){ze.workingToColorSpace(Nt$1.copy(this),e);let t=Nt$1.r,n=Nt$1.g,s=Nt$1.b;return e!==ft$2?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(e,t,n){return this.getHSL(si),this.setHSL(si.h+e,si.s+t,si.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(si),e.getHSL(Hr$1);let n=Js$1(si.h,Hr$1.h,t),s=Js$1(si.s,Hr$1.s,t),r=Js$1(si.l,Hr$1.l,t);return this.setHSL(n,s,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*s,this.g=r[1]*t+r[4]*n+r[7]*s,this.b=r[2]*t+r[5]*n+r[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};var Nt$1=new Ae$1;Ae$1.NAMES=Zu;var er$1=class extends bt$2{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ps$1,this.environmentIntensity=1,this.environmentRotation=new ps$1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};var pn$1=new D$2;var zn=new D$2;var tl$1=new D$2;var kn$1=new D$2;var ji=new D$2;var Qi=new D$2;var zh=new D$2;var nl$1=new D$2;var il$1=new D$2;var sl$1=new D$2;var rl$1=new $e;var ol$1=new $e;var al$1=new $e;var ci=class i{constructor(e=new D$2,t=new D$2,n=new D$2){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,s){s.subVectors(n,t),pn$1.subVectors(e,t),s.cross(pn$1);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,n,s,r){pn$1.subVectors(s,t),zn.subVectors(n,t),tl$1.subVectors(e,t);let o=pn$1.dot(pn$1),a=pn$1.dot(zn),l=pn$1.dot(tl$1),c=zn.dot(zn),h=zn.dot(tl$1),d=o*c-a*a;if(d===0)return r.set(0,0,0),null;
vendor: 56,797 bytes, line 2617
2617let u=1/d,f=(c*l-a*h)*u,g=(o*h-a*l)*u;return r.set(1-f-g,g,f)}static containsPoint(e,t,n,s){return this.getBarycoord(e,t,n,s,kn$1)===null?!1:kn$1.x>=0&&kn$1.y>=0&&kn$1.x+kn$1.y<=1}static getInterpolation(e,t,n,s,r,o,a,l){return this.getBarycoord(e,t,n,s,kn$1)===null?(l.x=0,l.y=0,`z`in l&&(l.z=0),`w`in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,kn$1.x),l.addScaledVector(o,kn$1.y),l.addScaledVector(a,kn$1.z),l)}static getInterpolatedAttribute(e,t,n,s,r,o){return rl$1.setScalar(0),ol$1.setScalar(0),al$1.setScalar(0),rl$1.fromBufferAttribute(e,t),ol$1.fromBufferAttribute(e,n),al$1.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(rl$1,r.x),o.addScaledVector(ol$1,r.y),o.addScaledVector(al$1,r.z),o}static isFrontFacing(e,t,n,s){return pn$1.subVectors(n,t),zn.subVectors(e,t),pn$1.cross(zn).dot(s)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,s){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,n,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return pn$1.subVectors(this.c,this.b),zn.subVectors(this.a,this.b),pn$1.cross(zn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,s,r){return i.getInterpolation(e,this.a,this.b,this.c,t,n,s,r)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,s=this.b,r=this.c,o,a;ji.subVectors(s,n),Qi.subVectors(r,n),nl$1.subVectors(e,n);let l=ji.dot(nl$1),c=Qi.dot(nl$1);if(l<=0&&c<=0)return t.copy(n);il$1.subVectors(e,s);let h=ji.dot(il$1),d=Qi.dot(il$1);if(h>=0&&d<=h)return t.copy(s);let u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(n).addScaledVector(ji,o);sl$1.subVectors(e,r);let f=ji.dot(sl$1),g=Qi.dot(sl$1);if(g>=0&&f<=g)return t.copy(r);let y=f*c-l*g;if(y<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(n).addScaledVector(Qi,a);let m=h*g-f*d;if(m<=0&&d-h>=0&&f-g>=0)return zh.subVectors(r,s),a=(d-h)/(d-h+(f-g)),t.copy(s).addScaledVector(zh,a);let p=1/(m+y+u);return o=y*p,a=u*p,t.copy(n).addScaledVector(ji,o).addScaledVector(Qi,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};var nn=class{constructor(e=new D$2(Infinity,Infinity,Infinity),t=new D$2(-Infinity,-Infinity,-Infinity)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(mn$1.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(mn$1.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=mn$1.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-Infinity,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=r.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,mn$1):mn$1.fromBufferAttribute(r,o),mn$1.applyMatrix4(e.matrixWorld),this.expandByPoint(mn$1);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Wr$1.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Wr$1.copy(n.boundingBox)),Wr$1.applyMatrix4(e.matrixWorld),this.union(Wr$1)}let s=e.children;for(let r=0,o=s.length;r<o;r++)this.expandByObject(s[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,mn$1),mn$1.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Gs$1),Xr$1.subVectors(this.max,Gs$1),es$1.subVectors(e.a,Gs$1),ts$1.subVectors(e.b,Gs$1),ns$1.subVectors(e.c,Gs$1),ri$1.subVectors(ts$1,es$1),oi$1.subVectors(ns$1,ts$1),Ai.subVectors(es$1,ns$1);let t=[0,-ri$1.z,ri$1.y,0,-oi$1.z,oi$1.y,0,-Ai.z,Ai.y,ri$1.z,0,-ri$1.x,oi$1.z,0,-oi$1.x,Ai.z,0,-Ai.x,-ri$1.y,ri$1.x,0,-oi$1.y,oi$1.x,0,-Ai.y,Ai.x,0];return!ll$1(t,es$1,ts$1,ns$1,Xr$1)||(t=[1,0,0,0,1,0,0,0,1],!ll$1(t,es$1,ts$1,ns$1,Xr$1))?!1:(qr$1.crossVectors(ri$1,oi$1),t=[qr$1.x,qr$1.y,qr$1.z],ll$1(t,es$1,ts$1,ns$1,Xr$1))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,mn$1).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(mn$1).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}};var Vn=[new D$2,new D$2,new D$2,new D$2,new D$2,new D$2,new D$2,new D$2];var mn$1=new D$2;var Wr$1=new nn;var es$1=new D$2;var ts$1=new D$2;var ns$1=new D$2;var ri$1=new D$2;var oi$1=new D$2;var Ai=new D$2;var Gs$1=new D$2;var Xr$1=new D$2;var qr$1=new D$2;var Ei=new D$2;function ll$1(i,e,t,n,s){for(let r=0,o=i.length-3;r<=o;r+=3){Ei.fromArray(i,r);let a=s.x*Math.abs(Ei.x)+s.y*Math.abs(Ei.y)+s.z*Math.abs(Ei.z),l=e.dot(Ei),c=t.dot(Ei),h=n.dot(Ei);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}var vt$1=new D$2;var Yr$1=new Fe$1;var Tf=0;var ct$2=class extends Pn$1{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Tf++}),this.name=``,this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=To,this.updateRanges=[],this.gpuType=rn$1,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[n+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Yr$1.fromBufferAttribute(this,t),Yr$1.applyMatrix3(e),this.setXY(t,Yr$1.x,Yr$1.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)vt$1.fromBufferAttribute(this,t),vt$1.applyMatrix3(e),this.setXYZ(t,vt$1.x,vt$1.y,vt$1.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)vt$1.fromBufferAttribute(this,t),vt$1.applyMatrix4(e),this.setXYZ(t,vt$1.x,vt$1.y,vt$1.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)vt$1.fromBufferAttribute(this,t),vt$1.applyNormalMatrix(e),this.setXYZ(t,vt$1.x,vt$1.y,vt$1.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)vt$1.fromBufferAttribute(this,t),vt$1.transformDirection(e),this.setXYZ(t,vt$1.x,vt$1.y,vt$1.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=gn$2(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=gn$2(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=gn$2(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=gn$2(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=gn$2(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,s){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),s=Je(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),s=Je(s,this.array),r=Je(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=s,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==``&&(e.name=this.name),this.usage!==To&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:`dispose`})}};var tr$1=class extends ct$2{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var nr$1=class extends ct$2{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var Ft$1=class extends ct$2{constructor(e,t,n){super(new Float32Array(e),t,n)}};var Af=new nn;var Hs$1=new D$2;var cl$1=new D$2;var Gt=class{constructor(e=new D$2,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Af.setFromPoints(e).getCenter(n);let s=0;for(let r=0,o=e.length;r<o;r++)s=Math.max(s,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Hs$1.subVectors(e,this.center);let t=Hs$1.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),s=(n-this.radius)*.5;this.center.addScaledVector(Hs$1,s/n),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(cl$1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Hs$1.copy(e.center).add(cl$1)),this.expandByPoint(Hs$1.copy(e.center).sub(cl$1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}};var Ef=0;var cn$2=new Le;var hl$1=new bt$2;var is$1=new D$2;var jt=new nn;var Ws$1=new nn;var wt$1=new D$2;var Bt$1=class i extends Pn$1{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ef++}),this.uuid=xn$1(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:Infinity},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Kd(e)?nr$1:tr$1)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Pe$1().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return cn$2.makeRotationFromQuaternion(e),this.applyMatrix4(cn$2),this}rotateX(e){return cn$2.makeRotationX(e),this.applyMatrix4(cn$2),this}rotateY(e){return cn$2.makeRotationY(e),this.applyMatrix4(cn$2),this}rotateZ(e){return cn$2.makeRotationZ(e),this.applyMatrix4(cn$2),this}translate(e,t,n){return cn$2.makeTranslation(e,t,n),this.applyMatrix4(cn$2),this}scale(e,t,n){return cn$2.makeScale(e,t,n),this.applyMatrix4(cn$2),this}lookAt(e){return hl$1.lookAt(e),hl$1.updateMatrix(),this.applyMatrix4(hl$1.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(is$1).negate(),this.translate(is$1.x,is$1.y,is$1.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let n=[];for(let s=0,r=e.length;s<r;s++){let o=e[s];n.push(o.x,o.y,o.z||0)}this.setAttribute(`position`,new Ft$1(n,3))}else{let n=Math.min(e.length,t.count);for(let s=0;s<n;s++){let r=e[s];t.setXYZ(s,r.x,r.y,r.z||0)}e.length>t.count&&ye$2(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new nn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ce$1(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new D$2(-Infinity,-Infinity,-Infinity),new D$2(Infinity,Infinity,Infinity));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,s=t.length;n<s;n++){let r=t[n];jt.setFromBufferAttribute(r),this.morphTargetsRelative?(wt$1.addVectors(this.boundingBox.min,jt.min),this.boundingBox.expandByPoint(wt$1),wt$1.addVectors(this.boundingBox.max,jt.max),this.boundingBox.expandByPoint(wt$1)):(this.boundingBox.expandByPoint(jt.min),this.boundingBox.expandByPoint(jt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ce$1(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Gt);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ce$1(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new D$2,Infinity);return}if(e){let n=this.boundingSphere.center;if(jt.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){let a=t[r];Ws$1.setFromBufferAttribute(a),this.morphTargetsRelative?(wt$1.addVectors(jt.min,Ws$1.min),jt.expandByPoint(wt$1),wt$1.addVectors(jt.max,Ws$1.max),jt.expandByPoint(wt$1)):(jt.expandByPoint(Ws$1.min),jt.expandByPoint(Ws$1.max))}jt.getCenter(n);let s=0;for(let r=0,o=e.count;r<o;r++)wt$1.fromBufferAttribute(e,r),s=Math.max(s,n.distanceToSquared(wt$1));if(t)for(let r=0,o=t.length;r<o;r++){let a=t[r],l=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)wt$1.fromBufferAttribute(a,c),l&&(is$1.fromBufferAttribute(e,c),wt$1.add(is$1)),s=Math.max(s,n.distanceToSquared(wt$1))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Ce$1(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ce$1(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,s=t.normal,r=t.uv,o=this.getAttribute(`tangent`);(o===void 0||o.count!==n.count)&&(o=new ct$2(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,o));let a=[],l=[];for(let x=0;x<n.count;x++)a[x]=new D$2,l[x]=new D$2;let c=new D$2,h=new D$2,d=new D$2,u=new Fe$1,f=new Fe$1,g=new Fe$1,y=new D$2,m=new D$2;function p(x,T,L){c.fromBufferAttribute(n,x),h.fromBufferAttribute(n,T),d.fromBufferAttribute(n,L),u.fromBufferAttribute(r,x),f.fromBufferAttribute(r,T),g.fromBufferAttribute(r,L),h.sub(c),d.sub(c),f.sub(u),g.sub(u);let C=1/(f.x*g.y-g.x*f.y);isFinite(C)&&(y.copy(h).multiplyScalar(g.y).addScaledVector(d,-f.y).multiplyScalar(C),m.copy(d).multiplyScalar(f.x).addScaledVector(h,-g.x).multiplyScalar(C),a[x].add(y),a[T].add(y),a[L].add(y),l[x].add(m),l[T].add(m),l[L].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let x=0,T=E.length;x<T;++x){let L=E[x],C=L.start,F=L.count;for(let X=C,$=C+F;X<$;X+=3)p(e.getX(X+0),e.getX(X+1),e.getX(X+2))}let w=new D$2,M=new D$2,A=new D$2,b=new D$2;function R(x){A.fromBufferAttribute(s,x),b.copy(A);let T=a[x];w.copy(T),w.sub(A.multiplyScalar(A.dot(T))).normalize(),M.crossVectors(b,T);let C=M.dot(l[x])<0?-1:1;o.setXYZW(x,w.x,w.y,w.z,C)}for(let x=0,T=E.length;x<T;++x){let L=E[x],C=L.start,F=L.count;for(let X=C,$=C+F;X<$;X+=3)R(e.getX(X+0)),R(e.getX(X+1)),R(e.getX(X+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new ct$2(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let u=0,f=n.count;u<f;u++)n.setXYZ(u,0,0,0);let s=new D$2,r=new D$2,o=new D$2,a=new D$2,l=new D$2,c=new D$2,h=new D$2,d=new D$2;if(e)for(let u=0,f=e.count;u<f;u+=3){let g=e.getX(u+0),y=e.getX(u+1),m=e.getX(u+2);s.fromBufferAttribute(t,g),r.fromBufferAttribute(t,y),o.fromBufferAttribute(t,m),h.subVectors(o,r),d.subVectors(s,r),h.cross(d),a.fromBufferAttribute(n,g),l.fromBufferAttribute(n,y),c.fromBufferAttribute(n,m),a.add(h),l.add(h),c.add(h),n.setXYZ(g,a.x,a.y,a.z),n.setXYZ(y,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let u=0,f=t.count;u<f;u+=3)s.fromBufferAttribute(t,u+0),r.fromBufferAttribute(t,u+1),o.fromBufferAttribute(t,u+2),h.subVectors(o,r),d.subVectors(s,r),h.cross(d),n.setXYZ(u+0,h.x,h.y,h.z),n.setXYZ(u+1,h.x,h.y,h.z),n.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)wt$1.fromBufferAttribute(e,t),wt$1.normalize(),e.setXYZ(t,wt$1.x,wt$1.y,wt$1.z)}toNonIndexed(){function e(a,l){let c=a.array,h=a.itemSize,d=a.normalized,u=new c.constructor(l.length*h),f=0,g=0;for(let y=0,m=l.length;y<m;y++){a.isInterleavedBufferAttribute?f=l[y]*a.data.stride+a.offset:f=l[y]*h;for(let p=0;p<h;p++)u[g++]=c[f++]}return new ct$2(u,h,d)}if(this.index===null)return ye$2(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let t=new i,n=this.index.array,s=this.attributes;for(let a in s){let l=s[a],c=e(l,n);t.setAttribute(a,c)}let r=this.morphAttributes;for(let a in r){let l=[],c=r[a];for(let h=0,d=c.length;h<d;h++){let u=c[h],f=e(u,n);l.push(f)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let s={},r=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d<u;d++){let f=c[d];h.push(f.toJSON(e.data))}h.length>0&&(s[l]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let s=e.attributes;for(let c in s){let h=s[c];this.setAttribute(c,h.clone(t))}let r=e.morphAttributes;for(let c in r){let h=[],d=r[c];for(let u=0,f=d.length;u<f;u++)h.push(d[u].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,h=o.length;c<h;c++){let d=o[c];this.addGroup(d.start,d.count,d.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}};var _s$1=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=To,this.updateRanges=[],this.version=0,this.uuid=xn$1()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let s=0,r=this.stride;s<r;s++)this.array[e+s]=t.array[n+s];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=xn$1()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=xn$1()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};var Ut$2=new D$2;var xs$1=class i{constructor(e,t,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ut$2.fromBufferAttribute(this,t),Ut$2.applyMatrix4(e),this.setXYZ(t,Ut$2.x,Ut$2.y,Ut$2.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ut$2.fromBufferAttribute(this,t),Ut$2.applyNormalMatrix(e),this.setXYZ(t,Ut$2.x,Ut$2.y,Ut$2.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ut$2.fromBufferAttribute(this,t),Ut$2.transformDirection(e),this.setXYZ(t,Ut$2.x,Ut$2.y,Ut$2.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=gn$2(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=gn$2(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=gn$2(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=gn$2(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=gn$2(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),s=Je(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this}setXYZW(e,t,n,s,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),s=Je(s,this.array),r=Je(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=s,this.data.array[e+3]=r,this}clone(e){if(e===void 0){js$1(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let t=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return new ct$2(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){js$1(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let t=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};var wf=0;var Ht=class extends Pn$1{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:wf++}),this.uuid=xn$1(),this.name=``,this.type=`Material`,this.blending=Pi,this.side=vn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=mo,this.blendDst=go,this.blendEquation=hi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ae$1(0,0,0),this.blendAlpha=0,this.depthFunc=Li,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wl$1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ci,this.stencilZFail=Ci,this.stencilZPass=Ci,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){ye$2(`Material: parameter '${t}' has value of undefined.`);continue}let s=this[t];if(s===void 0){ye$2(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector2&&n&&n.isVector2||s&&s.isEuler&&n&&n.isEuler||s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==Infinity&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Pi&&(n.blending=this.blending),this.side!==vn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==mo&&(n.blendSrc=this.blendSrc),this.blendDst!==go&&(n.blendDst=this.blendDst),this.blendEquation!==hi&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Li&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==wl$1&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ci&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ci&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ci&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function s(r){let o=[];for(let a in r){let l=r[a];delete l.metadata,o.push(l)}return o}if(t){let r=s(e.textures),o=s(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ae$1().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors==`number`?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Fe$1().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Fe$1().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let s=t.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}};var Gn=new D$2;var ul$1=new D$2;var Zr$1=new D$2;var ai$1=new D$2;var dl$1=new D$2;var Kr$1=new D$2;var fl$1=new D$2;var di=class{constructor(e=new D$2,t=new D$2(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Gn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gn.copy(this.origin).addScaledVector(this.direction,t),Gn.distanceToSquared(e))}distanceSqToSegment(e,t,n,s){ul$1.copy(e).add(t).multiplyScalar(.5),Zr$1.copy(t).sub(e).normalize(),ai$1.copy(this.origin).sub(ul$1);let r=e.distanceTo(t)*.5,o=-this.direction.dot(Zr$1),a=ai$1.dot(this.direction),l=-ai$1.dot(Zr$1),c=ai$1.lengthSq(),h=Math.abs(1-o*o),d,u,f,g;if(h>0)if(d=o*l-a,u=o*a-l,g=r*h,d>=0)if(u>=-g)if(u<=g){let y=1/h;d*=y,u*=y,f=d*(d+o*u+2*a)+u*(o*d+u+2*l)+c}else u=r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;else u<=-g?(d=Math.max(0,-(-o*r+a)),u=d>0?-r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c):u<=g?(d=0,u=Math.min(Math.max(-r,-l),r),f=u*(u+2*l)+c):(d=Math.max(0,-(o*r+a)),u=d>0?r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c);else u=o>0?-r:r,d=Math.max(0,-(o*u+a)),f=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),s&&s.copy(ul$1).addScaledVector(Zr$1,u),f}intersectSphere(e,t){Gn.subVectors(e.center,this.origin);let n=Gn.dot(this.direction),s=Gn.dot(Gn)-n*n,r=e.radius*e.radius;if(s>r)return null;let o=Math.sqrt(r-s),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,s,r,o,a,l,c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,s=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,s=(e.min.x-u.x)*c),h>=0?(r=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),n>o||r>s||((r>n||isNaN(n))&&(n=r),(o<s||isNaN(s))&&(s=o),d>=0?(a=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(a=(e.max.z-u.z)*d,l=(e.min.z-u.z)*d),n>l||a>s)||((a>n||n!==n)&&(n=a),(l<s||s!==s)&&(s=l),s<0)?null:this.at(n>=0?n:s,t)}intersectsBox(e){return this.intersectBox(e,Gn)!==null}intersectTriangle(e,t,n,s,r){dl$1.subVectors(t,e),Kr$1.subVectors(n,e),fl$1.crossVectors(dl$1,Kr$1);let o=this.direction.dot(fl$1),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ai$1.subVectors(this.origin,e);let l=a*this.direction.dot(Kr$1.crossVectors(ai$1,Kr$1));if(l<0)return null;let c=a*this.direction.dot(dl$1.cross(ai$1));if(c<0||l+c>o)return null;let h=-a*ai$1.dot(fl$1);return h<0?null:this.at(h/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var yn$1=class extends Ht{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Ae$1(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ps$1,this.combine=kl$1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};var kh=new Le;var wi=new di;var Jr$1=new Gt;var Vh=new D$2;var $r$1=new D$2;var jr$1=new D$2;var Qr$1=new D$2;var pl$1=new D$2;var eo=new D$2;var Gh=new D$2;var to=new D$2;var Mt$2=class extends bt$2{constructor(e=new Bt$1,t=new yn$1){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(s,e);let a=this.morphTargetInfluences;if(r&&a){eo.set(0,0,0);for(let l=0,c=r.length;l<c;l++){let h=a[l],d=r[l];h!==0&&(pl$1.fromBufferAttribute(d,e),o?eo.addScaledVector(pl$1,h):eo.addScaledVector(pl$1.sub(t),h))}t.add(eo)}return t}raycast(e,t){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Jr$1.copy(n.boundingSphere),Jr$1.applyMatrix4(r),wi.copy(e.ray).recast(e.near),!(Jr$1.containsPoint(wi.origin)===!1&&(wi.intersectSphere(Jr$1,Vh)===null||wi.origin.distanceToSquared(Vh)>(e.far-e.near)**2))&&(kh.copy(r).invert(),wi.copy(e.ray).applyMatrix4(kh),!(n.boundingBox!==null&&wi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,wi)))}_computeIntersections(e,t,n){let s,r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,d=r.attributes.normal,u=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,y=u.length;g<y;g++){let m=u[g],p=o[m.materialIndex],E=Math.max(m.start,f.start),w=Math.min(a.count,Math.min(m.start+m.count,f.start+f.count));for(let M=E,A=w;M<A;M+=3){let b=a.getX(M),R=a.getX(M+1),x=a.getX(M+2);s=no(this,p,e,n,c,h,d,b,R,x),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=m.materialIndex,t.push(s))}}else{let g=Math.max(0,f.start),y=Math.min(a.count,f.start+f.count);for(let m=g,p=y;m<p;m+=3){let E=a.getX(m),w=a.getX(m+1),M=a.getX(m+2);
vendor: 4,264 bytes, line 2617
2617s=no(this,o,e,n,c,h,d,E,w,M),s&&(s.faceIndex=Math.floor(m/3),t.push(s))}}else if(l!==void 0)if(Array.isArray(o))for(let g=0,y=u.length;g<y;g++){let m=u[g],p=o[m.materialIndex],E=Math.max(m.start,f.start),w=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let M=E,A=w;M<A;M+=3){let b=M,R=M+1,x=M+2;s=no(this,p,e,n,c,h,d,b,R,x),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=m.materialIndex,t.push(s))}}else{let g=Math.max(0,f.start),y=Math.min(l.count,f.start+f.count);for(let m=g,p=y;m<p;m+=3){let E=m,w=m+1,M=m+2;s=no(this,o,e,n,c,h,d,E,w,M),s&&(s.faceIndex=Math.floor(m/3),t.push(s))}}}};function Rf(i,e,t,n,s,r,o,a){let l;if(e.side===zt$1?l=n.intersectTriangle(o,r,s,!0,a):l=n.intersectTriangle(s,r,o,e.side===vn,a),l===null)return null;to.copy(a),to.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(to);return c<t.near||c>t.far?null:{distance:c,point:to.clone(),object:i}}function no(i,e,t,n,s,r,o,a,l,c){i.getVertexPosition(a,$r$1),i.getVertexPosition(l,jr$1),i.getVertexPosition(c,Qr$1);let h=Rf(i,e,t,n,$r$1,jr$1,Qr$1,Gh);if(h){let d=new D$2;ci.getBarycoord(Gh,$r$1,jr$1,Qr$1,d),s&&(h.uv=ci.getInterpolatedAttribute(s,a,l,c,d,new Fe$1)),r&&(h.uv1=ci.getInterpolatedAttribute(r,a,l,c,d,new Fe$1)),o&&(h.normal=ci.getInterpolatedAttribute(o,a,l,c,d,new D$2),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a,b:l,c,normal:new D$2,materialIndex:0};ci.getNormal($r$1,jr$1,Qr$1,u.normal),h.face=u,h.barycoord=d}return h}var Xs$1=new $e;var Hh=new $e;var Wh=new $e;var Cf=new $e;var Xh=new Le;var io=new D$2;var ml$1=new Gt;var qh=new Le;var gl$1=new di;var Fi=class extends Mt$2{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=Ml$1,this.bindMatrix=new Le,this.bindMatrixInverse=new Le,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new nn),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let n=0;n<t.count;n++)this.getVertexPosition(n,io),this.boundingBox.expandByPoint(io)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Gt),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let n=0;n<t.count;n++)this.getVertexPosition(n,io),this.boundingSphere.expandByPoint(io)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,s=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ml$1.copy(this.boundingSphere),ml$1.applyMatrix4(s),e.ray.intersectsSphere(ml$1)!==!1&&(qh.copy(s).invert(),gl$1.copy(e.ray).applyMatrix4(qh),!(this.boundingBox!==null&&gl$1.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,gl$1)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new $e,t=this.geometry.attributes.skinWeight;for(let n=0,s=t.count;n<s;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r!==Infinity?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ml$1?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Du?this.bindMatrixInverse.copy(this.bindMatrix).invert():ye$2(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,s=this.geometry;Hh.fromBufferAttribute(s.attributes.skinIndex,e),Wh.fromBufferAttribute(s.attributes.skinWeight,e),t.isVector4?(Xs$1.copy(t),t.set(0,0,0,0)):(Xs$1.set(...t,1),t.set(0,0,0)),Xs$1.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){let o=Wh.getComponent(r);if(o!==0){let a=Hh.getComponent(r);Xh.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(Cf.copy(Xs$1).applyMatrix4(Xh),o)}}
vendor: 11,747 bytes, line 2617
2617return t.isVector4&&(t.w=Xs$1.w),t.applyMatrix4(this.bindMatrixInverse)}};var vs$1=class extends bt$2{constructor(){super(),this.isBone=!0,this.type=`Bone`}};var ys$1=class extends an{constructor(e=null,t=1,n=1,s,r,o,a,l,c=pt$1,h=pt$1,d,u){super(null,o,a,l,c,h,s,r,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Yh=new Le;var If=new Le;var ir$1=class i{constructor(e=[],t=[]){this.uuid=xn$1(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){ye$2(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let n=0,s=this.bones.length;n<s;n++)this.boneInverses.push(new Le)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Le;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,s=this.boneTexture;for(let r=0,o=e.length;r<o;r++){let a=e[r]?e[r].matrixWorld:If;Yh.multiplyMatrices(a,t[r]),Yh.toArray(n,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new i(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new ys$1(t,e,e,on$1,rn$1);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,s=e.bones.length;n<s;n++){let r=e.bones[n],o=t[r];o===void 0&&(ye$2(`Skeleton: No bone found with UUID:`,r),o=new vs$1),this.bones.push(o),this.boneInverses.push(new Le().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let s=0,r=t.length;s<r;s++){let o=t[s];e.bones.push(o.uuid);let a=n[s];e.boneInverses.push(a.toArray())}return e}};var fi=class extends ct$2{constructor(e,t,n,s=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var ss$1=new Le;var Zh=new Le;var so=[];var Kh=new nn;var Pf=new Le;var qs$1=new Mt$2;var Ys$1=new Gt;var sr$1=class extends Mt$2{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new fi(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,Pf)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new nn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ss$1),Kh.copy(e.boundingBox).applyMatrix4(ss$1),this.boundingBox.union(Kh)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Gt),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ss$1),Ys$1.copy(e.boundingSphere).applyMatrix4(ss$1),this.boundingSphere.union(Ys$1)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,s=this.morphTexture.source.data.data,o=e*(n.length+1)+1;for(let a=0;a<n.length;a++)n[a]=s[o+a]}raycast(e,t){let n=this.matrixWorld,s=this.count;if(qs$1.geometry=this.geometry,qs$1.material=this.material,qs$1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ys$1.copy(this.boundingSphere),Ys$1.applyMatrix4(n),e.ray.intersectsSphere(Ys$1)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,ss$1),Zh.multiplyMatrices(n,ss$1),qs$1.matrixWorld=Zh,qs$1.raycast(e,so);for(let o=0,a=so.length;o<a;o++){let l=so[o];l.instanceId=r,l.object=this,t.push(l)}so.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new fi(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new ys$1(new Float32Array(s*this.count),s,this.count,Ko$1,rn$1));let r=this.morphTexture.source.data.data,o=0;for(let c=0;c<n.length;c++)o+=n[c];let a=this.geometry.morphTargetsRelative?1:1-o,l=s*e;return r[l]=a,r.set(n,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:`dispose`}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}};var _l$1=new D$2;var Lf=new D$2;var Nf=new Pe$1;var Rn$1=class{constructor(e=new D$2(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,s){return this.normal.set(e,t,n),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let s=_l$1.subVectors(n,t).cross(Lf.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let s=e.delta(_l$1),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(s,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Nf.getNormalMatrix(e),s=this.coplanarPoint(_l$1).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};var Ri=new Gt;var Df=new Fe$1(.5,.5);var ro=new D$2;var Ms$1=class{constructor(e=new Rn$1,t=new Rn$1,n=new Rn$1,s=new Rn$1,r=new Rn$1,o=new Rn$1){this.planes=[e,t,n,s,r,o]}set(e,t,n,s,r,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=_n$1,n=!1){let s=this.planes,r=e.elements,o=r[0],a=r[1],l=r[2],c=r[3],h=r[4],d=r[5],u=r[6],f=r[7],g=r[8],y=r[9],m=r[10],p=r[11],E=r[12],w=r[13],M=r[14],A=r[15];if(s[0].setComponents(c-o,f-h,p-g,A-E).normalize(),s[1].setComponents(c+o,f+h,p+g,A+E).normalize(),s[2].setComponents(c+a,f+d,p+y,A+w).normalize(),s[3].setComponents(c-a,f-d,p-y,A-w).normalize(),n)s[4].setComponents(l,u,m,M).normalize(),s[5].setComponents(c-l,f-u,p-m,A-M).normalize();else if(s[4].setComponents(c-l,f-u,p-m,A-M).normalize(),t===_n$1)s[5].setComponents(c+l,f+u,p+m,A+M).normalize();else if(t===hs$1)s[5].setComponents(l,u,m,M).normalize();else throw new Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ri.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ri.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ri)}intersectsSprite(e){Ri.center.set(0,0,0);return Ri.radius=.7071067811865476+Df.distanceTo(e.center),Ri.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ri)}intersectsSphere(e){let t=this.planes,n=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let s=t[n];if(ro.x=s.normal.x>0?e.max.x:e.min.x,ro.y=s.normal.y>0?e.max.y:e.min.y,ro.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(ro)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var Ss$1=class extends Ht{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new Ae$1(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};var Ro$1=new D$2;var Co$1=new D$2;var Jh=new Le;var Zs$1=new di;var oo=new Gt;var xl$1=new D$2;var $h=new D$2;var Oi=class extends bt$2{constructor(e=new Bt$1,t=new Ss$1){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let s=1,r=t.count;s<r;s++)Ro$1.fromBufferAttribute(t,s-1),Co$1.fromBufferAttribute(t,s),n[s]=n[s-1],n[s]+=Ro$1.distanceTo(Co$1);e.setAttribute(`lineDistance`,new Ft$1(n,1))}else ye$2(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}raycast(e,t){let n=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),oo.copy(n.boundingSphere),oo.applyMatrix4(s),oo.radius+=r,e.ray.intersectsSphere(oo)===!1)return;Jh.copy(s).invert(),Zs$1.copy(e.ray).applyMatrix4(Jh);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,h=n.index,u=n.attributes.position;if(h!==null){let f=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let y=f,m=g-1;y<m;y+=c){let p=h.getX(y),E=h.getX(y+1),w=ao(this,e,Zs$1,l,p,E,y);
vendor: 4,630 bytes, line 2617
2617w&&t.push(w)}if(this.isLineLoop){let y=h.getX(g-1),m=h.getX(f),p=ao(this,e,Zs$1,l,y,m,g-1);p&&t.push(p)}}else{let f=Math.max(0,o.start),g=Math.min(u.count,o.start+o.count);for(let y=f,m=g-1;y<m;y+=c){let p=ao(this,e,Zs$1,l,y,y+1,y);p&&t.push(p)}if(this.isLineLoop){let y=ao(this,e,Zs$1,l,g-1,f,g-1);y&&t.push(y)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};function ao(i,e,t,n,s,r,o){let a=i.geometry.attributes.position;if(Ro$1.fromBufferAttribute(a,s),Co$1.fromBufferAttribute(a,r),t.distanceSqToSegment(Ro$1,Co$1,xl$1,$h)>n)return;xl$1.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(xl$1);if(!(c<e.near||c>e.far))return{distance:c,point:$h.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var jh=new D$2;var Qh=new D$2;var rr=class extends Oi{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let s=0,r=t.count;s<r;s+=2)jh.fromBufferAttribute(t,s),Qh.fromBufferAttribute(t,s+1),n[s]=s===0?0:n[s-1],n[s+1]=n[s]+jh.distanceTo(Qh);e.setAttribute(`lineDistance`,new Ft$1(n,1))}else ye$2(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}};var or$1=class extends Oi{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}};var bs$1=class extends Ht{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new Ae$1(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};var eu=new Le;var Rl$1=new di;var lo=new Gt;var co=new D$2;var ar$1=class extends bt$2{constructor(e=new Bt$1,t=new bs$1){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,s=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),lo.copy(n.boundingSphere),lo.applyMatrix4(s),lo.radius+=r,e.ray.intersectsSphere(lo)===!1)return;eu.copy(s).invert(),Rl$1.copy(e.ray).applyMatrix4(eu);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,d=n.attributes.position;if(c!==null){let u=Math.max(0,o.start),f=Math.min(c.count,o.start+o.count);for(let g=u,y=f;g<y;g++){let m=c.getX(g);co.fromBufferAttribute(d,m),tu(co,m,l,s,e,t,this)}}else{let u=Math.max(0,o.start),f=Math.min(d.count,o.start+o.count);for(let g=u,y=f;g<y;g++)co.fromBufferAttribute(d,g),tu(co,g,l,s,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let s=t[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}};function tu(i,e,t,n,s,r,o){let a=Rl$1.distanceSqToPoint(i);if(a<t){let l=new D$2;Rl$1.closestPointToPoint(i,l),l.applyMatrix4(n);let c=s.ray.origin.distanceTo(l);if(c<s.near||c>s.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var lr=class extends an{constructor(e=[],t=gi,n,s,r,o,a,l,c,h){super(e,t,n,s,r,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Xn$1=class extends an{constructor(e,t,n=bn$1,s,r,o,a=pt$1,l=pt$1,c,h=In$1,d=1){if(h!==In$1&&h!==_i)throw new Error(`THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:d},s,r,o,a,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new fs$1(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}};var Io$1=class extends Xn$1{constructor(e,t=bn$1,n=gi,s,r,o=pt$1,a=pt$1,l,c=In$1
vendor: 6,684 bytes, lines 2617-2621
2617){let h={width:e,height:e,depth:1},d=[h,h,h,h,h,h];super(e,e,t,n,s,r,o,a,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}};var cr$1=class extends an{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}};var Ts$1=class i extends Bt$1{constructor(e=1,t=1,n=1,s=1,r=1,o=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:s,heightSegments:r,depthSegments:o};let a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);let l=[],c=[],h=[],d=[],u=0,f=0;g(`z`,`y`,`x`,-1,-1,n,t,e,o,r,0),g(`z`,`y`,`x`,1,-1,n,t,-e,o,r,1),g(`x`,`z`,`y`,1,1,e,n,t,s,o,2),g(`x`,`z`,`y`,1,-1,e,n,-t,s,o,3),g(`x`,`y`,`z`,1,-1,e,t,n,s,r,4),g(`x`,`y`,`z`,-1,-1,e,t,-n,s,r,5),this.setIndex(l),this.setAttribute(`position`,new Ft$1(c,3)),this.setAttribute(`normal`,new Ft$1(h,3)),this.setAttribute(`uv`,new Ft$1(d,2));function g(y,m,p,E,w,M,A,b,R,x,T){let L=M/R,C=A/x,F=M/2,X=A/2,$=b/2,O=R+1,q=x+1,V=0,J=0,Q=new D$2;for(let he=0;he<q;he++){let pe=he*C-X;for(let _e=0;_e<O;_e++)Q[y]=(_e*L-F)*E,Q[m]=pe*w,Q[p]=$,c.push(Q.x,Q.y,Q.z),Q[y]=0,Q[m]=0,Q[p]=b>0?1:-1,h.push(Q.x,Q.y,Q.z),d.push(_e/R),d.push(1-he/x),V+=1}for(let he=0;he<x;he++)for(let pe=0;pe<R;pe++){let _e=u+pe+O*he,Xe=u+pe+O*(he+1),rt=u+(pe+1)+O*(he+1),qe=u+(pe+1)+O*he;l.push(_e,Xe,qe),l.push(Xe,rt,qe),J+=6}a.addGroup(f,J,T),f+=J,u+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var hr$1=class i extends Bt$1{constructor(e=1,t=1,n=1,s=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:s};let r=e/2,o=t/2,a=Math.floor(n),l=Math.floor(s),c=a+1,h=l+1,d=e/a,u=t/l,f=[],g=[],y=[],m=[];for(let p=0;p<h;p++){let E=p*u-o;for(let w=0;w<c;w++){let M=w*d-r;g.push(M,-E,0),y.push(0,0,1),m.push(w/a),m.push(1-p/l)}}for(let p=0;p<l;p++)for(let E=0;E<a;E++){let w=E+c*p,M=E+c*(p+1),A=E+1+c*(p+1),b=E+1+c*p;f.push(w,M,b),f.push(M,A,b)}this.setIndex(f),this.setAttribute(`position`,new Ft$1(g,3)),this.setAttribute(`normal`,new Ft$1(y,3)),this.setAttribute(`uv`,new Ft$1(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};function Vi(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let s=i[t][n];if(nu(s))s.isRenderTargetTexture?(ye$2(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),e[t][n]=null):e[t][n]=s.clone();else if(Array.isArray(s))if(nu(s[0])){let r=[];for(let o=0,a=s.length;o<a;o++)r[o]=s[o].clone();e[t][n]=r}else e[t][n]=s.slice();else e[t][n]=s}}return e}function Dt$1(i){let e={};for(let t=0;t<i.length;t++){let n=Vi(i[t]);for(let s in n)e[s]=n[s]}return e}function nu(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Uf(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function sc$1(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ze.workingColorSpace}var Ku={clone:Vi,merge:Dt$1};var Ff=`void main() { 2618 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 2619}`;var Of=`void main() { 2620 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 2621}`;var sn$1=class extends Ht{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ff,this.fragmentShader=Of,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vi(e.uniforms),this.uniformsGroups=Uf(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let s in this.uniforms){let o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:`t`,value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:`c`,value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:`v2`,value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:`v3`,value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:`v4`,value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:`m3`,value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:`m4`,value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let s=e.uniforms[n];switch(this.uniforms[n]={},s.type){case`t`:this.uniforms[n].value=t[s.value]||null;break;case`c`:this.uniforms[n].value=new Ae$1().setHex(s.value);break;case`v2`:this.uniforms[n].value=new Fe$1().fromArray(s.value);break;case`v3`:this.uniforms[n].value=new D$2().fromArray(s.value);break;case`v4`:this.uniforms[n].value=new $e().fromArray(s.value);break;case`m3`:this.uniforms[n].value=new Pe$1().fromArray(s.value);break;case`m4`:this.uniforms[n].value=new Le().fromArray(s.value);break;default:this.uniforms[n].value=s.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}};var Po$1=class extends sn$1{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type=`RawS
2621haderMaterial`}};var qn=class extends Ht{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new Ae$1(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ae$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ca,this.normalScale=new Fe$1(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ps$1,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};var Wt=class extends qn{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Fe$1(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ve(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ae$1(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=Infinity,this.attenuationColor=new Ae$1(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ae$1(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};var Lo$1=class extends Ht{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=Fu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};var No$1=class extends Ht{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function ho(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT==`number`?new e(i):Array.prototype.slice.call(i)}function Bf(i){function e(s,r){return i[s]-i[r]}let t=i.length,n=new Array(t);for(let s=0;s!==t;++s)n[s]=s;return n.sort(e),n}function iu(i,e,t){let n=i.length,s=new i.constructor(n);for(let r=0,o=0;o!==n;++r){let a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=i[a+l]}return s}function zf(i,e,t,n){let s=1,r=i[0];for(;r!==void 0&&r[n]===void 0;)r=i[s++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push(...o)),r=i[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=i[s++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=i[s++];while(r!==void 0)}var Ln=class{constructor(e,t,n,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,s=t[n],r=t[n-1];n:{e:{let o;t:{i:if(!(e<s)){for(let a=n+2;;){if(s===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=s,s=t[++n],e<s)break e}o=t.length;break t}if(!(e>=r)){let a=t[1];e<a&&(n=2,r=a);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(s=r,r=t[--n-1],e>=r)break e}o=n,n=0;break t}break n}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(s=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s;for(let o=0;o!==s;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error(`THREE.Interpolant: Call to abstract method.`)}intervalChanged_(){}};var Do$1=class extends Ln{constructor(e,t,n,s){super(e,t,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Tl$1,endingEnd:Tl$1}}intervalChanged_(e,t,n){let s=this.parameterPositions,r=e-2,o=e+1,a=s[r],l=s[o];if(a===void 0)switch(this.getSettings_().endingStart){case Al$1:r=e,a=2*t-n;break;case El$1:r=s.length-2,a=t+s[r]-s[r+1];break;default:r=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Al$1:o=e,l=2*n-t;break;case El$1:o=1,l=n+s[1]-s[0];break;default:o=e-1,l=t}let c=(n-t)*.5,h=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=r*h,this._offsetNext=o*h}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=this._offsetPrev,d=this._offsetNext,u=this._weightPrev,f=this._weightNext,g=(n-t)/(s-t),y=g*g,m=y*g,p=-u*m+2*u*y-u*g,E=(1+u)*m+(-1.5-2*u)*y+(-.5+u)*g+1,w=(-1-f)*m+(1.5+f)*y+.5*g,M=f*m-f*y;for(let A=0;A!==a;++A)r[A]=p*o[h+A]+E*o[c+A]+w*o[l+A]+M*o[d+A];return r}};var Uo$1=class extends Ln{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=(n-t)/(s-t),d=1-h;for(let u=0;u!==a;++u)r[u]=o[c+u]*d+o[l+u]*h;return r}};var Fo$1=class extends Ln{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e){return this.copySampleValue_(e-1)}};var Oo$1=class extends Ln{interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,h=this.inTangents,d=this.outTangents;if(!h||!d){let g=(n-t)/(s-t),y=1-g;for(let m=0;m!==a;++m)r[m]=o[c+m]*y+o[l+m]*g;return r}let u=a*2,f=e-1;for(let g=0;g!==a;++g){let y=o[c+g],m=o[l+g],p=f*u+g*2,E=d[p],w=d[p+1],M=e*u+g*2,A=h[M],b=h[M+1],R=(n-t)/(s-t),x,T,L,C,F;for(let X=0;X<8;X++){x=R*R,T=x*R,L=1-R,C=L*L,F=C*L;let O=F*t+3*C*R*E+3*L*x*A+T*s-n;if(Math.abs(O)<1e-10)break;let q=3*C*(E-t)+6*L*R*(A-E)+3*x*(s-A);if(Math.abs(q)<1e-10)break;R=R-O/q,R=Math.max(0,Math.min(1,R))}r[g]=F*y+3*C*R*w+3*L*x*b+T*m}return r}};var Xt$1=class{constructor(e,t,n,s){if(e===void 0)throw new Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw new Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=ho(t,this.TimeBufferType),this.values=ho(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:ho(e.times,Array),values:ho(e.values,Array)};let s=e.getInterpolation();s!==e.DefaultInterpolation&&(n.interpolation=s)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Fo$1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Uo$1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Do$1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Oo$1(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case Ni:t=this.InterpolantFactoryMethodDiscrete;break;case Di:t=this.InterpolantFactoryMethodLinear;break;case po:t=this.InterpolantFactoryMethodSmooth;break;case bl$1:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return ye$2(`KeyframeTrack:`,n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ni;case this.InterpolantFactoryMethodLinear:return Di;case this.InterpolantFactoryMethodSmooth:return po;case this.InterpolantFactoryMethodBezier:return bl$1}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,s=t.length;n!==s;++n)t[n]*=e}return this}trim(e,t){let n=this.times,s=n.length,r=0,o=s-1;for(;r!==s&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);let a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ce$1(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Ce$1(`KeyframeTrack: Track is empty.`,this),e=!1);let o=null;for(let a=0;a!==r;a++){let l=n[a];if(typeof l==`number`&&isNaN(l)){Ce$1(`KeyframeTrack: Time is not a valid number.`,this,a,l),e=!1;break}if(o!==null&&o>l){Ce$1(`KeyframeTrack: Out of order keys.`,this,a,l,o),e=!1;break}o=l}if(s!==void 0&&Jd(s))for(let a=0,l=s.length;a!==l;++a){let c=s[a];if(isNaN(c)){Ce$1(`KeyframeTrack: Value is not a valid number.`,this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===po,r=e.length-1,o=1;for(let a=1;a<r;++a){let l=!1,c=e[a];if(c!==e[a+1]&&(a!==1||c!==e[0]))if(s)l=!0;else{let d=a*n,u=d-n,f=d+n;for(let g=0;g!==n;++g){let y=t[d+g];if(y!==t[u+g]||y!==t[f+g]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let d=a*n,u=o*n;for(let f=0;f!==n;++f)t[u+f]=t[d+f]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,s=new n(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}};Xt$1.prototype.ValueTypeName=``;Xt$1.prototype.TimeBufferType=Float32Array;Xt$1.prototype.ValueBufferType=Float32Array;Xt$1.prototype.DefaultInterpolation=Di;var Yn=class extends Xt$1{constructor(e,t,n){super(e,t,n)}};Yn.prototype.ValueTypeName=`bool`;Yn.prototype.ValueBufferType=Array;Yn.prototype.DefaultInterpolation=Ni;Yn.prototype.InterpolantFactoryMethodLinear=void 0;Yn.prototype.InterpolantFactoryMethodSmooth=void 0;var ur$1=class extends Xt$1{constructor(e,t,n,s){super(e,t,n,s)}};ur$1.prototype.ValueTypeName=`color`;var Zn=class extends Xt$1{constructor(e,t,n,s){super(e,t,n,s)}};Zn.prototype.ValueTypeName=`number`;var Bo$1=class extends Ln{constructor(e,t,n,s){super(e,t,n,s)}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(s-t),c=e*a;for(let h=c+a;c!==h;c+=4)en.slerpFlat(r,0,o,c-a,o,c,l);return r}};var Kn=class extends Xt$1{constructor(e,t,n,s){super(e,t,n,s)}InterpolantFactoryMethodLinear(e){return new Bo$1(this.times,this.values,this.getValueSize(),e)}};Kn.prototype.ValueTypeName=`quaternion`;Kn.prototype.InterpolantFactoryMethodSmooth=void 0;var Jn=class extends Xt$1{constructor(e,t,n){super(e,t,n)}};Jn.prototype.ValueTypeName=`string`;Jn.prototype.ValueBufferType=Array;Jn.prototype.DefaultInterpolation=Ni;Jn.prototype.InterpolantFactoryMethodLinear=void 0;Jn.prototype.InterpolantFactoryMethodSmooth=void 0;var pi$1=class extends Xt$1{constructor(e,t,n,s){super(e,t,n,s)}};pi$1.prototype.ValueTypeName=`vector`;var dr$1=class{constructor(e=``,t=-1,n=[],s=Uu){this.name=e,this.tracks=n,this.duration=t,this.blendMode=s,this.uuid=xn$1(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,s=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(Vf(n[o]).scale(s));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||`{}`),r}static toJSON(e){let t=[],n=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,o=n.length;r!==o;++r)t.push(Xt$1.toJSON(n[r]));return s}static CreateFromMorphTargetSequence(e,t,n,s){let r=t.length,o=[];for(let a=0;a<r;a++){let l=[],c=[];l.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);let h=Bf(l);l=iu(l,1,h),c=iu(c,1,h),!s&&l[0]===0&&(l.push(r),c.push(c[0])),o.push(new Zn(`.morphTargetInfluences[`+t[a].name+`]`,l,c).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let s=e;n=s.geometr
vendor: 15,359 bytes, line 2621
2621y&&s.geometry.animations||s.animations}for(let s=0;s<n.length;s++)if(n[s].name===t)return n[s];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let s={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let c=e[a],h=c.name.match(r);if(h&&h.length>1){let d=h[1],u=s[d];u||(s[d]=u=[]),u.push(c)}}let o=[];for(let a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,n));return o}resetDuration(){let e=this.tracks,t=0;for(let n=0,s=e.length;n!==s;++n){let r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}};function kf(i){switch(i.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return Zn;case`vector`:case`vector2`:case`vector3`:case`vector4`:return pi$1;case`color`:return ur$1;case`quaternion`:return Kn;case`bool`:case`boolean`:return Yn;case`string`:return Jn}throw new Error(`THREE.KeyframeTrack: Unsupported typeName: `+i)}function Vf(i){if(i.type===void 0)throw new Error(`THREE.KeyframeTrack: track type undefined, can not parse`);let e=kf(i.type);if(i.times===void 0){let t=[],n=[];zf(i.keys,t,n,`value`),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var Cn={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(su(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!su(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function su(i){try{let e=i.slice(i.indexOf(`:`)+1);return new URL(e).protocol===`blob:`}catch(e){return!1}}var zo$1=class{constructor(e,t,n){let s=this,r=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){a++,r===!1&&s.onStart!==void 0&&s.onStart(h,o,a),r=!0},this.itemEnd=function(h){o++,s.onProgress!==void 0&&s.onProgress(h,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return h=h.normalize(`NFC`),l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){let d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;d<u;d+=2){let f=c[d],g=c[d+1];if(f.global&&(f.lastIndex=0),f.test(h))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}};var Ju=new zo$1;var Gi=(()=>{class i{constructor(t){this.manager=t!==void 0?t:Ju,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(t,n){let s=this;return new Promise(function(r,o){s.load(t,r,n,o)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}return i.DEFAULT_MATERIAL_NAME=`__DEFAULT`,i})();var Hn={};var Cl$1=class extends Error{constructor(e,t){super(e),this.response=t}};var As$1=class extends Gi{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,s){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=Cn.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(Hn[e]!==void 0){Hn[e].push({onLoad:t,onProgress:n,onError:s});return}Hn[e]=[],Hn[e].push({onLoad:t,onProgress:n,onError:s});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&ye$2(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||c.body===void 0||c.body.getReader===void 0)return c;let h=Hn[e],d=c.body.getReader(),u=c.headers.get(`X-File-Size`)||c.headers.get(`Content-Length`),f=u?parseInt(u):0,g=f!==0,y=0,m=new ReadableStream({start(p){E();function E(){d.read().then(({done:w,value:M})=>{if(w)p.close();else{y+=M.byteLength;let A=new ProgressEvent(`progress`,{lengthComputable:g,loaded:y,total:f});for(let b=0,R=h.length;b<R;b++){let x=h[b];x.onProgress&&x.onProgress(A)}p.enqueue(M),E()}},w=>{p.error(w)})}}});return new Response(m)}else throw new Cl$1(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case`arraybuffer`:return c.arrayBuffer();case`blob`:return c.blob();case`document`:return c.text().then(h=>new DOMParser().parseFromString(h,a));case`json`:return c.json();default:if(a===``)return c.text();{let d=/charset="?([^;"\s]*)"?/i.exec(a),u=d&&d[1]?d[1].toLowerCase():void 0,f=new TextDecoder(u);return c.arrayBuffer().then(g=>f.decode(g))}}}).then(c=>{Cn.add(`file:${e}`,c);let h=Hn[e];delete Hn[e];for(let d=0,u=h.length;d<u;d++){let f=h[d];f.onLoad&&f.onLoad(c)}}).catch(c=>{let h=Hn[e];if(h===void 0)throw this.manager.itemError(e),c;delete Hn[e];for(let d=0,u=h.length;d<u;d++){let f=h[d];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var rs$1=new WeakMap;var ko$1=class extends Gi{constructor(e){super(e)}load(e,t,n,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,o=Cn.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0);else{let d=rs$1.get(o);d===void 0&&(d=[],rs$1.set(o,d)),d.push({onLoad:t,onError:s})}return o}let a=us$1(`img`);function l(){h(),t&&t(this);let d=rs$1.get(this)||[];for(let u=0;u<d.length;u++){let f=d[u];f.onLoad&&f.onLoad(this)}rs$1.delete(this),r.manager.itemEnd(e)}function c(d){h(),s&&s(d),Cn.remove(`image:${e}`);let u=rs$1.get(this)||[];for(let f=0;f<u.length;f++){let g=u[f];g.onError&&g.onError(d)}rs$1.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){a.removeEventListener(`load`,l,!1),a.removeEventListener(`error`,c,!1)}return a.addEventListener(`load`,l,!1),a.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),Cn.add(`image:${e}`,a),r.manager.itemStart(e),a.src=e,a}};var fr$1=class extends Gi{constructor(e){super(e)}load(e,t,n,s){let r=new an,o=new ko$1(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,s),r}};var Bi=class extends bt$2{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new Ae$1(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}};var pr$1=class extends Bi{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(bt$2.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ae$1(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}};var vl$1=new Le;var ru=new D$2;var ou=new D$2;var mr$1=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fe$1(512,512),this.mapType=qt$2,this.map=null,this.mapPass=null,this.matrix=new Le,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ms$1,this._frameExtents=new Fe$1(1,1),this._viewportCount=1,this._viewports=[new $e(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;ru.setFromMatrixPosition(e.matrixWorld),t.position.copy(ru),ou.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ou),t.updateMatrixWorld(),vl$1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vl$1,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===hs$1||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(vl$1)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}};var uo=new D$2;var fo=new en;var wn$1=new D$2;var gr$1=class extends bt$2{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new Le,this.projectionMatrix=new Le,this.projectionMatrixInverse=new Le,this.coordinateSystem=_n$1,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(uo,fo,wn$1),wn$1.x===1&&wn$1.y===1&&wn$1.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(uo,fo,wn$1.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(uo,fo,wn$1),wn$1.x===1&&wn$1.y===1&&wn$1.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(uo,fo,wn$1.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};var li$1=new D$2;var au=new Fe$1;var lu=new Fe$1;var yt$1=class extends gr$1{constructor(e=50,t=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ui*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Ks$1*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ui*2*Math.atan(Math.tan(Ks$1*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){li$1.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(li$1.x,li$1.y).multiplyScalar(-e/li$1.z),li$1.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(li$1.x,li$1.y).multiplyScalar(-e/li$1.z)}getViewSize(e,t){return this.getViewBounds(e,au,lu),t.subVectors(lu,au)}setViewOffset(e,t,n,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Ks$1*.5*this.fov)/this.zoom,n=2*t,s=this.aspect*n,r=-.5*s,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*n/c,s*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};var Il$1=class extends mr$1{constructor(){super(new yt$1(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ui*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};var _r$1=class extends Bi{constructor(e,t,n=0,s=Math.PI/3,r=0,o=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(bt$2.DEFAULT_UP),this.updateMatrix(),this.target=new bt$2,this.distance=n,this.angle=s,this.penumbra=r,this.decay=o,this.map=null,this.shadow=new Il$1}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}};var Pl$1=class extends mr$1{constructor(){super(new yt$1(90,1,.5,500)),this.isPointLightShadow=!0}
2621};var xr$1=class extends Bi{constructor(e,t,n=0,s=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=s,this.shadow=new Pl$1}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}};var mi=class extends gr$1{constructor(e=-1,t=1,n=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-e,o=n+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};var Ll$1=class extends mr$1{constructor(){super(new mi(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};var $n=class extends Bi{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(bt$2.DEFAULT_UP),this.updateMatrix(),this.target=new bt$2,this.shadow=new Ll$1}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}};var jn=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}};var yl$1=new WeakMap;var vr$1=class extends Gi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&ye$2(`ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&ye$2(`ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,s){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,o=Cn.get(`image-bitmap:${e}`);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(c=>{yl$1.has(o)===!0?(s&&s(yl$1.get(o)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(c),r.manager.itemEnd(e))});return}setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0);return}let a={};a.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,a.headers=this.requestHeader,a.signal=typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:`none`}))}).then(function(c){Cn.add(`image-bitmap:${e}`,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){s&&s(c),yl$1.set(l,c),Cn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});Cn.add(`image-bitmap:${e}`,l),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var os$1=-90;var as$1=1;var Vo$1=class extends bt$2{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new yt$1(os$1,as$1,e,t);s.layers=this.layers,this.add(s);let r=new yt$1(os$1,as$1,e,t);r.layers=this.layers,this.add(r);let o=new yt$1(os$1,as$1,e,t);o.layers=this.layers,this.add(o);let a=new yt$1(os$1,as$1,e,t);a.layers=this.layers,this.add(a);let l=new yt$1(os$1,as$1,e,t);l.layers=this.layers,this.add(l);let c=new yt$1(os$1,as$1,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,s,r,o,a,l]=t;for(let c of t)this.remove(c);if(e===_n$1)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===hs$1)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,o,a,l,c,h]=this.children,d=e.getRenderTarget(),u=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;let y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(n,0,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,s
2621),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=y,e.setRenderTarget(n,5,s),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(d,u,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}};var Go$1=class extends yt$1{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var rc$1=`\\[\\]\\.:\\/`;var Gf=new RegExp(`[`+rc$1+`]`,`g`);var oc$1=`[^`+rc$1+`]`;var Hf=`[^`+rc$1.replace(`\\.`,``)+`]`;var Wf=/((?:WC+[\/:])*)/.source.replace(`WC`,oc$1);var Xf=/(WCOD+)?/.source.replace(`WCOD`,Hf);var qf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace(`WC`,oc$1);var Yf=/\.(WC+)(?:\[(.+)\])?/.source.replace(`WC`,oc$1);var Zf=new RegExp(`^`+Wf+Xf+qf+Yf+`$`);var Kf=[`material`,`materials`,`bones`,`map`];var Nl$1=class{constructor(e,t,n){let s=n||st$1.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}};var st$1=(()=>{class i{constructor(t,n,s){this.path=n,this.parsedPath=s||i.parseTrackName(n),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,s){return t&&t.isAnimationObjectGroup?new i.Composite(t,n,s):new i(t,n,s)}static sanitizeNodeName(t){return t.replace(/\s/g,`_`).replace(Gf,``)}static parseTrackName(t){let n=Zf.exec(t);if(n===null)throw new Error(`THREE.PropertyBinding: Cannot parse trackName: `+t);let s={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=s.nodeName&&s.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let o=s.nodeName.substring(r+1);Kf.indexOf(o)!==-1&&(s.nodeName=s.nodeName.substring(0,r),s.objectName=o)}if(s.propertyName===null||s.propertyName.length===0)throw new Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+t);return s}static findNode(t,n){if(n===void 0||n===``||n===`.`||n===-1||n===t.name||n===t.uuid)return t;if(t.skeleton){let s=t.skeleton.getBoneByName(n);if(s!==void 0)return s}if(t.children){let s=function(o){for(let a=0;a<o.length;a++){let l=o[a];if(l.name===n||l.uuid===n)return l;let c=s(l.children);if(c)return c}return null},r=s(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,n){t[n]=this.targetObject[this.propertyName]}_getValue_array(t,n){let s=this.resolvedProperty;for(let r=0,o=s.length;r!==o;++r)t[n++]=s[r]}_getValue_arrayElement(t,n){t[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,n){this.resolvedProperty.toArray(t,n)}_setValue_direct(t,n){this.targetObject[this.propertyName]=t[n]}_setValue_direct_setNeedsUpdate(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,n){let s=this.resolvedProperty;for(let r=0,o=s.length;r!==o;++r)s[r]=t[n++]}_setValue_array_setNeedsUpdate(t,n){let s=this.resolvedProperty;for(let r=0,o=s.length;r!==o;++r)s[r]=t[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,n){let s=this.resolvedProperty;for(let r=0,o=s.length;r!==o;++r)s[r]=t[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,n){this.resolvedProperty[this.propertyIndex]=t[n]}_setValue_arrayElement_setNeedsUpdate(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,n){this.resolvedProperty.fromArray(t,n)}_setValue_fromArray_setNeedsUpdate(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.needsUpdate=!0}
vendor: 4,494 bytes, line 2621
2621_setValue_fromArray_setMatrixWorldNeedsUpdate(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,n){this.bind(),this.getValue(t,n)}_setValue_unbound(t,n){this.bind(),this.setValue(t,n)}bind(){let t=this.node,n=this.parsedPath,s=n.objectName,r=n.propertyName,o=n.propertyIndex;if(t||(t=i.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){ye$2(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(s){let h=n.objectIndex;switch(s){case`materials`:if(!t.material){Ce$1(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){Ce$1(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){Ce$1(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let d=0;d<t.length;d++)if(t[d].name===h){h=d;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){Ce$1(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){Ce$1(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[s]===void 0){Ce$1(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[s]}if(h!==void 0){if(t[h]===void 0){Ce$1(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[h]}}let a=t[r];if(a===void 0){let h=n.nodeName;Ce$1(`PropertyBinding: Trying to update property for track: `+h+`.`+r+` but it wasn't found.`,t);return}let l=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?l=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(o!==void 0){if(r===`morphTargetInfluences`){if(!t.geometry){Ce$1(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){Ce$1(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[o]!==void 0&&(o=t.morphTargetDictionary[o])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=o}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}return i.Composite=Nl$1,i})();st$1.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};st$1.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};st$1.prototype.GetterByBindingType=[st$1.prototype._getValue_direct,st$1.prototype._getValue_array,st$1.prototype._getValue_arrayElement,st$1.prototype._getValue_toArray];st$1.prototype.SetterByBindingTypeAndVersioning=[[st$1.prototype._setValue_direct,st$1.prototype._setValue_direct_setNeedsUpdate,st$1.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[st$1.prototype._setValue_array,st$1.prototype._setValue_array_setNeedsUpdate,st$1.prototype._setValue_array_setMatrixWorldNeedsUpdate],[st$1.prototype._setValue_arrayElement,st$1.prototype._setValue_arrayElement_setNeedsUpdate,st$1.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[st$1.prototype._setValue_fromArray,st$1.prototype._setValue_fromArray_setNeedsUpdate,st$1.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var cu=new Le;var yr$1=class{constructor(e,t,n=0,s=Infinity){this.ray=new di(e,t),this.near=n,this.far=s,this.camera=null,this.layers=new ms$1,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ce$1(`Raycaster:
2621Unsupported camera type: `+t.type)}setFromXRController(e){return cu.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cu),this}intersectObject(e,t=!0,n=[]){return Dl$1(e,this,n,t),n.sort(hu),n}intersectObjects(e,t=!0,n=[]){for(let s=0,r=e.length;s<r;s++)Dl$1(e[s],this,n,t);return n.sort(hu),n}};function hu(i,e){return i.distance-e.distance}function Dl$1(i,e,t,n){let s=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(s=!1),s===!0&&n===!0){let r=i.children;for(let o=0,a=r.length;o<a;o++)Dl$1(r[o],e,t,!0)}}(class i{static{i.prototype.isMatrix2=!0}constructor(e,t,n,s){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,s)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,s){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=s,this}});function ac$1(i,e,t,n){let s=Jf(n);switch(t){case jl$1:return i*e;case Ko$1:return i*e/s.components*s.byteLength;case Jo$1:return i*e/s.components*s.byteLength;case xi:return i*e*2/s.components*s.byteLength;case $o$1:return i*e*2/s.components*s.byteLength;case Ql$1:return i*e*3/s.components*s.byteLength;case on$1:return i*e*4/s.components*s.byteLength;case jo$1:return i*e*4/s.components*s.byteLength;case br$1:case Tr$1:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ar$1:case Er$1:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ea:case na:return Math.max(i,16)*Math.max(e,8)/4;case Qo$1:case ta:return Math.max(i,8)*Math.max(e,8)/2;case ia:case sa:case oa:case aa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ra:case wr$1:case la:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ca:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ha:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case ua:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case da:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case fa:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case pa:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case ma:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case ga:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case _a:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case xa:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case va:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case ya:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Ma:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Sa:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case ba:case Ta:case Aa:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Ea:case wa:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Rr$1:case Ra:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Jf(i){switch(i){case qt$2:case Zl$1:return{byteLength:1,components:1};case Rs$1:case Kl$1:case Dn:return{byteLength:2,components:1};case Yo$1:case Zo$1:return{byteLength:2,components:4};case bn$1:case qo$1:case rn$1:return{byteLength:4,components:1};case Jl$1:case $l$1:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`185`}}));typeof window<`u`&&(window.__THREE__?ye$2(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`185`);function vd(){let i=null,e=!1,t=null,n=null;function s(r,o){t(r,o),n=i.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(s),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){i=r}}}function jf(i){let e=new WeakMap;function t(a,l){let c=a.array,h=a.usage,d=c.byteLength,u=i.createBuffer();i.bindBuffer(l,u),i.bufferData(l,c,h),a.onUploadCallback();let f;if(c instanceof Float32Array)f=i.FLOAT;else if(typeof Float16Array<`u`&&c instanceof Float16Array)f=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=i.SHORT;else if(c instanceof Uint32Array)f=i.UNSIGNED_INT;else if(c instanceof Int32Array)f=i.INT;else if(c instanceof Int8Array)f=i.BYTE;else if(c instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=i.UNSIGNED_BYTE;else throw new Error(`THREE.WebGLAttributes: Unsupported buffer data format: `+c);return{buffer:u,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:d}}function n(a,l,c){let h=l.array,d=l.updateRanges;if(i.bindBuffer(c,a),d.length===0)i.bufferSubData(c,0,h);else{d.sort((f,g)=>f.start-g.start);let u=0;for(let f=1;f<d.length;f++){let g=d[u],y=d[f];y.start<=g.start+g.count+1?g.count=Math.max(g.count,y.start+y.count-g.start):(++u,d[u]=y)}d.length=u+1;for(let f=0,g=d.length;f<g;f++){let y=d[f];i.bufferSubData(c,y.start*h.BYTES_PER_ELEMENT,h,y.start,y.count)}
vendor: 4,567 bytes, lines 2621-2719
2621l.clearUpdateRanges()}l.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function r(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let h=e.get(a);(!h||h.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error(`THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.`);n(c.buffer,a,l),c.version=a.version}}return{get:s,remove:r,update:o}}var Oe$1={alphahash_fragment:`#ifdef USE_ALPHAHASH 2622 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 2623#endif`,alphahash_pars_fragment:`#ifdef USE_ALPHAHASH 2624 const float ALPHA_HASH_SCALE = 0.05; 2625 float hash2D( vec2 value ) { 2626 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 2627 } 2628 float hash3D( vec3 value ) { 2629 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 2630 } 2631 float getAlphaHashThreshold( vec3 position ) { 2632 float maxDeriv = max( 2633 length( dFdx( position.xyz ) ), 2634 length( dFdy( position.xyz ) ) 2635 ); 2636 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 2637 vec2 pixScales = vec2( 2638 exp2( floor( log2( pixScale ) ) ), 2639 exp2( ceil( log2( pixScale ) ) ) 2640 ); 2641 vec2 alpha = vec2( 2642 hash3D( floor( pixScales.x * position.xyz ) ), 2643 hash3D( floor( pixScales.y * position.xyz ) ) 2644 ); 2645 float lerpFactor = fract( log2( pixScale ) ); 2646 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 2647 float a = min( lerpFactor, 1.0 - lerpFactor ); 2648 vec3 cases = vec3( 2649 x * x / ( 2.0 * a * ( 1.0 - a ) ), 2650 ( x - 0.5 * a ) / ( 1.0 - a ), 2651 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 2652 ); 2653 float threshold = ( x < ( 1.0 - a ) ) 2654 ? ( ( x < a ) ? cases.x : cases.y ) 2655 : cases.z; 2656 return clamp( threshold , 1.0e-6, 1.0 ); 2657 } 2658#endif`,alphamap_fragment:`#ifdef USE_ALPHAMAP 2659 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 2660#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP 2661 uniform sampler2D alphaMap; 2662#endif`,alphatest_fragment:`#ifdef USE_ALPHATEST 2663 #ifdef ALPHA_TO_COVERAGE 2664 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 2665 if ( diffuseColor.a == 0.0 ) discard; 2666 #else 2667 if ( diffuseColor.a < alphaTest ) discard; 2668 #endif 2669#endif`,alphatest_pars_fragment:`#ifdef USE_ALPHATEST 2670 uniform float alphaTest; 2671#endif`,aomap_fragment:`#ifdef USE_AOMAP 2672 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 2673 reflectedLight.indirectDiffuse *= ambientOcclusion; 2674 #if defined( USE_CLEARCOAT ) 2675 clearcoatSpecularIndirect *= ambientOcclusion; 2676 #endif 2677 #if defined( USE_SHEEN ) 2678 sheenSpecularIndirect *= ambientOcclusion; 2679 #endif 2680 #if defined( USE_ENVMAP ) && defined( STANDARD ) 2681 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 2682 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 2683 #endif 2684#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP 2685 uniform sampler2D aoMap; 2686 uniform float aoMapIntensity; 2687#endif`,batching_pars_vertex:`#ifdef USE_BATCHING 2688 #if ! defined( GL_ANGLE_multi_draw ) 2689 #define gl_DrawID _gl_DrawID 2690 uniform int _gl_DrawID; 2691 #endif 2692 uniform highp sampler2D batchingTexture; 2693 uniform highp usampler2D batchingIdTexture; 2694 mat4 getBatchingMatrix( const in float i ) { 2695 int size = textureSize( batchingTexture, 0 ).x; 2696 int j = int( i ) * 4; 2697 int x = j % size; 2698 int y = j / size; 2699 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 2700 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 2701 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 2702 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 2703 return mat4( v1, v2, v3, v4 ); 2704 } 2705 float getIndirectIndex( const in int i ) { 2706 int size = textureSize( batchingIdTexture, 0 ).x; 2707 int x = i % size; 2708 int y = i / size; 2709 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 2710 } 2711#endif 2712#ifdef USE_BATCHING_COLOR 2713 uniform sampler2D batchingColorTexture; 2714 vec4 getBatchingColor( const in float i ) { 2715 int size = textureSize( batchingColorTexture, 0 ).x; 2716 int j = int( i ); 2717 int x = j % size; 2718 int y = j / size; 2719 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 )
vendor: 6,787 bytes, lines 2719-2880
2719; 2720 } 2721#endif`,batching_vertex:`#ifdef USE_BATCHING 2722 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 2723#endif`,begin_vertex:`vec3 transformed = vec3( position ); 2724#ifdef USE_ALPHAHASH 2725 vPosition = vec3( position ); 2726#endif`,beginnormal_vertex:`vec3 objectNormal = vec3( normal ); 2727#ifdef USE_TANGENT 2728 vec3 objectTangent = vec3( tangent.xyz ); 2729#endif`,bsdfs:`float G_BlinnPhong_Implicit( ) { 2730 return 0.25; 2731} 2732float D_BlinnPhong( const in float shininess, const in float dotNH ) { 2733 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 2734} 2735vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 2736 vec3 halfDir = normalize( lightDir + viewDir ); 2737 float dotNH = saturate( dot( normal, halfDir ) ); 2738 float dotVH = saturate( dot( viewDir, halfDir ) ); 2739 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 2740 float G = G_BlinnPhong_Implicit( ); 2741 float D = D_BlinnPhong( shininess, dotNH ); 2742 return F * ( G * D ); 2743} // validated`,iridescence_fragment:`#ifdef USE_IRIDESCENCE 2744 const mat3 XYZ_TO_REC709 = mat3( 2745 3.2404542, -0.9692660, 0.0556434, 2746 -1.5371385, 1.8760108, -0.2040259, 2747 -0.4985314, 0.0415560, 1.0572252 2748 ); 2749 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 2750 vec3 sqrtF0 = sqrt( fresnel0 ); 2751 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 2752 } 2753 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 2754 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 2755 } 2756 float IorToFresnel0( float transmittedIor, float incidentIor ) { 2757 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 2758 } 2759 vec3 evalSensitivity( float OPD, vec3 shift ) { 2760 float phase = 2.0 * PI * OPD * 1.0e-9; 2761 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 2762 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 2763 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 2764 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 2765 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 2766 xyz /= 1.0685e-7; 2767 vec3 rgb = XYZ_TO_REC709 * xyz; 2768 return rgb; 2769 } 2770 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 2771 vec3 I; 2772 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 2773 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 2774 float cosTheta2Sq = 1.0 - sinTheta2Sq; 2775 if ( cosTheta2Sq < 0.0 ) { 2776 return vec3( 1.0 ); 2777 } 2778 float cosTheta2 = sqrt( cosTheta2Sq ); 2779 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); 2780 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 2781 float T121 = 1.0 - R12; 2782 float phi12 = 0.0; 2783 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 2784 float phi21 = PI - phi12; 2785 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 2786 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 2787 vec3 phi23 = vec3( 0.0 ); 2788 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 2789 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 2790 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 2791 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 2792 vec3 phi = vec3( phi21 ) + phi23; 2793 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 2794 vec3 r123 = sqrt( R123 ); 2795 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 2796 vec3 C0 = R12 + Rs; 2797 I = C0; 2798 vec3 Cm = Rs - T121; 2799 for ( int m = 1; m <= 2; ++ m ) { 2800 Cm *= r123; 2801 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 2802 I += Cm * Sm; 2803 } 2804 return max( I, vec3( 0.0 ) ); 2805 } 2806#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP 2807 uniform sampler2D bumpMap; 2808 uniform float bumpScale; 2809 vec2 dHdxy_fwd() { 2810 vec2 dSTdx = dFdx( vBumpMapUv ); 2811 vec2 dSTdy = dFdy( vBumpMapUv ); 2812 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 2813 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 2814 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 2815 return vec2( dBx, dBy ); 2816 } 2817 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 2818 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 2819 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 2820 vec3 vN = surf_norm; 2821 vec3 R1 = cross( vSigmaY, vN ); 2822 vec3 R2 = cross( vN, vSigmaX ); 2823 float fDet = dot( vSigmaX, R1 ) * faceDirection; 2824 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 2825 return normalize( abs( fDet ) * surf_norm - vGrad ); 2826 } 2827#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0 2828 vec4 plane; 2829 #ifdef ALPHA_TO_COVERAGE 2830 float distanceToPlane, distanceGradient; 2831 float clipOpacity = 1.0; 2832 #pragma unroll_loop_start 2833 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 2834 plane = clippingPlanes[ i ]; 2835 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 2836 distanceGradient = fwidth( distanceToPlane ) / 2.0; 2837 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 2838 if ( clipOpacity == 0.0 ) discard; 2839 } 2840 #pragma unroll_loop_end 2841 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 2842 float unionClipOpacity = 1.0; 2843 #pragma unroll_loop_start 2844 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 2845 plane = clippingPlanes[ i ]; 2846 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 2847 distanceGradient = fwidth( distanceToPlane ) / 2.0; 2848 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 2849 } 2850 #pragma unroll_loop_end 2851 clipOpacity *= 1.0 - unionClipOpacity; 2852 #endif 2853 diffuseColor.a *= clipOpacity; 2854 if ( diffuseColor.a == 0.0 ) discard; 2855 #else 2856 #pragma unroll_loop_start 2857 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 2858 plane = clippingPlanes[ i ]; 2859 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 2860 } 2861 #pragma unroll_loop_end 2862 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 2863 bool clipped = true; 2864 #pragma unroll_loop_start 2865 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 2866 plane = clippingPlanes[ i ]; 2867 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 2868 } 2869 #pragma unroll_loop_end 2870 if ( clipped ) discard; 2871 #endif 2872 #endif 2873#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 2874 varying vec3 vClipPosition; 2875 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 2876#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 2877 varying vec3 vClipPosition; 2878#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 2879 vClipPosition = - mvPosition.xyz; 2880#endif`,color_fragment:`#if defined( USE_COLOR
2880 ) || defined( USE_COLOR_ALPHA ) 2881 diffuseColor *= vColor; 2882#endif`,color_pars_fragment:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) 2883 varying vec4 vColor; 2884#endif`,color_pars_vertex:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 2885 varying vec4 vColor; 2886#endif`,color_vertex:`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 2887 vColor = vec4( 1.0 ); 2888#endif 2889#ifdef USE_COLOR_ALPHA 2890 vColor *= color; 2891#elif defined( USE_COLOR ) 2892 vColor.rgb *= color; 2893#endif 2894#ifdef USE_INSTANCING_COLOR 2895 vColor.rgb *= instanceColor.rgb; 2896#endif 2897#ifdef USE_BATCHING_COLOR 2898 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); 2899#endif`,common:`#define PI 3.141592653589793 2900#define PI2 6.283185307179586 2901#define PI_HALF 1.5707963267948966 2902#define RECIPROCAL_PI 0.3183098861837907 2903#define RECIPROCAL_PI2 0.15915494309189535 2904#define EPSILON 1e-6 2905#ifndef saturate 2906#define saturate( a ) clamp( a, 0.0, 1.0 ) 2907#endif 2908#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 2909float pow2( const in float x ) { return x*x; } 2910vec3 pow2( const in vec3 x ) { return x*x; } 2911float pow3( const in float x ) { return x*x*x; } 2912float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 2913float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 2914float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 2915highp float rand( const in vec2 uv ) { 2916 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 2917 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 2918 return fract( sin( sn ) * c ); 2919} 2920#ifdef HIGH_PRECISION 2921 float precisionSafeLength( vec3 v ) { return length( v ); } 2922#else 2923 float precisionSafeLength( vec3 v ) { 2924 float maxComponent = max3( abs( v ) ); 2925 return length( v / maxComponent ) * maxComponent; 2926 } 2927#endif 2928struct IncidentLight { 2929 vec3 color; 2930 vec3 direction; 2931 bool visible; 2932}; 2933struct ReflectedLight { 2934 vec3 directDiffuse; 2935 vec3 directSpecular; 2936 vec3 indirectDiffuse; 2937 vec3 indirectSpecular; 2938}; 2939#ifdef USE_ALPHAHASH 2940 varying vec3 vPosition; 2941#endif 2942vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 2943 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 2944} 2945#define inverseTransformDirection transformDirectionByInverseViewMatrix 2946vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) { 2947 return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz ); 2948} 2949vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) { 2950 return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz ); 2951} 2952bool isPerspectiveMatrix( mat4 m ) { 2953 return m[ 2 ][ 3 ] == - 1.0; 2954} 2955vec2 equirectUv( in vec3 dir ) { 2956 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 2957 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 2958 return vec2( u, v ); 2959} 2960vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 2961 return RECIPROCAL_PI * diffuseColor; 2962} 2963vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 2964 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 2965 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 2966} 2967float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 2968 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 2969 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 2970} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV 2971 #define cubeUV_minMipLevel 4.0 2972 #define cubeUV_minTileSize 16.0 2973 float getFace( vec3 direction ) { 2974 vec3 absDirection = abs( direction ); 2975 float face = - 1.0; 2976 if ( absDirection.x > absDirection.z ) { 2977 if ( absDirection.x > absDirection.y ) 2978 face = direction.x > 0.0 ? 0.0 : 3.0; 2979 else 2980 face = direction.y > 0.0 ? 1.0 : 4.0; 2981 } else { 2982 if ( absDirection.z > absDirection.y ) 2983 face = direction.z > 0.0 ? 2.0 : 5.0; 2984 else 2985 face = direction.y > 0.0 ? 1.0 : 4.0; 2986 } 2987 return face; 2988 } 2989 vec2 getUV( vec3 direction, float face ) { 2990 vec2 uv; 2991 if ( face == 0.0 ) { 2992 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 2993 } else if ( face == 1.0 ) { 2994 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 2995 } else if ( face == 2.0 ) { 2996 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 2997 } else if ( face == 3.0 ) { 2998 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 2999 } else if ( face == 4.0 ) { 3000 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 3001 } else { 3002 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 3003 } 3004 return 0.5 * ( uv + 1.0 ); 3005 } 3006 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 3007 float face = getFace( direction ); 3008 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 3009 mipInt = max( mipInt, cubeUV_minMipLevel ); 3010 float faceSize = exp2( mipInt );
3011 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 3012 if ( face > 2.0 ) { 3013 uv.y += faceSize; 3014 face -= 3.0; 3015 } 3016 uv.x += face * faceSize; 3017 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 3018 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 3019 uv.x *= CUBEUV_TEXEL_WIDTH; 3020 uv.y *= CUBEUV_TEXEL_HEIGHT; 3021 #ifdef texture2DGradEXT 3022 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 3023 #else 3024 return texture2D( envMap, uv ).rgb; 3025 #endif 3026 } 3027 #define cubeUV_r0 1.0 3028 #define cubeUV_m0 - 2.0 3029 #define cubeUV_r1 0.8 3030 #define cubeUV_m1 - 1.0 3031 #define cubeUV_r4 0.4 3032 #define cubeUV_m4 2.0 3033 #define cubeUV_r5 0.305 3034 #define cubeUV_m5 3.0 3035 #define cubeUV_r6 0.21 3036 #define cubeUV_m6 4.0 3037 float roughnessToMip( float roughness ) { 3038 float mip = 0.0; 3039 if ( roughness >= cubeUV_r1 ) { 3040 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 3041 } else if ( roughness >= cubeUV_r4 ) { 3042 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 3043 } else if ( roughness >= cubeUV_r5 ) { 3044 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 3045 } else if ( roughness >= cubeUV_r6 ) { 3046 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 3047 } else { 3048 mip = - 2.0 * log2( 1.16 * roughness ); } 3049 return mip; 3050 } 3051 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 3052 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 3053 float mipF = fract( mip ); 3054 float mipInt = floor( mip ); 3055 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 3056 if ( mipF == 0.0 ) { 3057 return vec4( color0, 1.0 ); 3058 } else { 3059 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 3060 return vec4( mix( color0, color1, mipF ), 1.0 ); 3061 } 3062 } 3063#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; 3064#ifdef USE_TANGENT 3065 vec3 transformedTangent = objectTangent; 3066#endif 3067#ifdef USE_BATCHING 3068 mat3 bm = mat3( batchingMatrix ); 3069 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 3070 transformedNormal = bm * transformedNormal; 3071 #ifdef USE_TANGENT 3072 transformedTangent = bm * transformedTangent; 3073 #endif 3074#endif 3075#ifdef USE_INSTANCING 3076 mat3 im = mat3( instanceMatrix ); 3077 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 3078 transformedNormal = im * transformedNormal; 3079 #ifdef USE_TANGENT 3080 transformedTangent = im * transformedTangent; 3081 #endif 3082#endif 3083transformedNormal = normalMatrix * transformedNormal; 3084#ifdef FLIP_SIDED 3085 transformedNormal = - transformedNormal; 3086#endif 3087#ifdef USE_TANGENT 3088 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 3089#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP 3090 uniform sampler2D displacementMap; 3091 uniform float displacementScale; 3092 uniform float displacementBias; 3093#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP 3094 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); 3095#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP 3096 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 3097 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 3098 emissiveColor = sRGBTransferEOTF( emissiveColor ); 3099 #endif 3100 totalEmissiveRadiance *= emissiveColor.rgb; 3101#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP 3102 uniform sampler2D emissiveMap; 3103#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { 3104 return value; 3105} 3106vec4 sRGBTransferEOTF( in vec4 value ) { 3107 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 3108} 3109vec4 sRGBTransferOETF( in vec4 value ) { 3110 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 3111}`,envmap_fragment:`#ifdef USE_ENVMAP 3112 #ifdef ENV_WORLDPOS 3113 vec3 cameraToFrag; 3114 if ( isOrthographic ) { 3115 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 3116 } else { 3117 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 3118 } 3119 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 3120 #ifdef ENVMAP_MODE_REFLECTION 3121 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 3122 #else 3123 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 3124 #endif 3125 #else 3126 vec3 reflectVec = vReflect; 3127 #endif 3128 #ifdef ENVMAP_TYPE_CUBE 3129 vec4 envColor = textureCube( envMap, envMapRotation * reflectVec ); 3130 #ifdef ENVMAP_BLENDING_MULTIPLY 3131 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 3132 #elif defined( ENVMAP_BLENDING_MIX ) 3133 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 3134 #elif defined( ENVMAP_BLENDING_ADD ) 3135 outgoingLight += envColor.xyz * specularStrength * reflectivity; 3136 #endif 3137 #endif 3138#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP 3139 uniform float envMapIntensity; 3140 uniform mat3 envMapRotation; 3141 #ifdef ENVMAP_TYPE_CUBE 3142 uniform samplerCube envMap; 3143 #else 3144 uniform sampler2D envMap; 3145 #endif 3146#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP 3147 uniform float reflectivity; 3148 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 3149 #define ENV_WORLDPOS 3150 #endif 3151 #ifdef ENV_WORLDPOS 3152 varying vec3 vWorldPosition; 3153 uniform float refractionRatio; 3154 #else 3155 varying vec3 vReflect; 3156 #endif 3157#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP 3158 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 3159 #define ENV_WORLDPOS 3160 #endif 3161 #ifdef ENV_WORLDPOS 3162 3163 varying vec3 vWorldPosition; 3164 #else 3165 varying vec3 vReflect; 3166 uniform float refractionRatio; 3167 #endif 3168#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP 3169 vec3 getIBLIrradiance( const in vec3 normal ) { 3170 #ifdef ENVMAP_TYPE_CUBE_UV 3171 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 3172 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 3173 return PI * envMapColor.rgb * envMapIntensity; 3174 #else 3175 return vec3( 0.0 ); 3176 #endif 3177 } 3178 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 3179 #ifdef ENVMAP_TYPE_CUBE_UV 3180 vec3 reflectVec = reflect( - viewDir, normal );
3181 reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); 3182 reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix ); 3183 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 3184 return envMapColor.rgb * envMapIntensity; 3185 #else 3186 return vec3( 0.0 ); 3187 #endif 3188 } 3189 #ifdef USE_ANISOTROPY 3190 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 3191 #ifdef ENVMAP_TYPE_CUBE_UV 3192 vec3 bentNormal = cross( bitangent, viewDir ); 3193 bentNormal = normalize( cross( bentNormal, bitangent ) ); 3194 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 3195 return getIBLRadiance( viewDir, bentNormal, roughness ); 3196 #else 3197 return vec3( 0.0 ); 3198 #endif 3199 } 3200 #endif 3201#endif`,envmap_vertex:`#ifdef USE_ENVMAP 3202 #ifdef ENV_WORLDPOS 3203 vWorldPosition = worldPosition.xyz; 3204 #else 3205 vec3 cameraToVertex; 3206 if ( isOrthographic ) { 3207 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 3208 } else {
3209 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 3210 } 3211 vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 3212 #ifdef ENVMAP_MODE_REFLECTION 3213 vReflect = reflect( cameraToVertex, worldNormal ); 3214 #else 3215 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 3216 #endif 3217 #endif 3218#endif`,fog_vertex:`#ifdef USE_FOG 3219 vFogDepth = - mvPosition.z; 3220#endif`,fog_pars_vertex:`#ifdef USE_FOG 3221 varying float vFogDepth; 3222#endif`,fog_fragment:`#ifdef USE_FOG 3223 #ifdef FOG_EXP2 3224 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 3225 #else 3226 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 3227 #endif 3228 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 3229#endif`,fog_pars_fragment:`#ifdef USE_FOG 3230 uniform vec3 fogColor; 3231 varying float vFogDepth; 3232 #ifdef FOG_EXP2 3233 uniform float fogDensity; 3234 #else 3235 uniform float fogNear; 3236 uniform float fogFar; 3237 #endif 3238#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP 3239 uniform sampler2D gradientMap; 3240#endif 3241vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 3242 float dotNL = dot( normal, lightDirection ); 3243 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 3244 #ifdef USE_GRADIENTMAP 3245 return vec3( texture2D( gradientMap, coord ).r ); 3246 #else 3247 vec2 fw = fwidth( coord ) * 0.5; 3248 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 3249 #endif 3250}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP 3251 uniform sampler2D lightMap; 3252 uniform float lightMapIntensity; 3253#endif`,lights_lambert_fragment:`LambertMaterial material; 3254material.diffuseColor = diffuseColor.rgb; 3255material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; 3256struct LambertMaterial { 3257 vec3 diffuseColor; 3258 float specularStrength; 3259}; 3260void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 3261 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 3262 vec3 irradiance = dotNL * directLight.color; 3263 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 3264} 3265void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 3266 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 3267} 3268#define RE_Direct RE_Direct_Lambert 3269#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; 3270uniform vec3 ambientLightColor; 3271#if defined( USE_LIGHT_PROBES ) 3272 uniform vec3 lightProbe[ 9 ]; 3273#endif 3274vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 3275 float x = normal.x, y = normal.y, z = normal.z; 3276 vec3 result = shCoefficients[ 0 ] * 0.886227; 3277 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 3278 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 3279 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 3280 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 3281 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 3282 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 3283 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 3284 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 3285 return result; 3286} 3287vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 3288 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix ); 3289 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 3290 return irradiance; 3291} 3292vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 3293 vec3 irradiance = ambientLightColor; 3294 return irradiance; 3295} 3296float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 3297 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 3298 if ( cutoffDistance > 0.0 ) { 3299 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 3300 } 3301 return distanceFalloff; 3302} 3303float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 3304 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 3305} 3306#if NUM_DIR_LIGHTS > 0 3307 struct DirectionalLight { 3308 vec3 direction; 3309 vec3 color; 3310 }; 3311 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 3312 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 3313 light.color = directionalLight.color; 3314 light.direction = directionalLight.direction; 3315 light.visible = true; 3316 } 3317#endif 3318#if NUM_POINT_LIGHTS > 0 3319 struct PointLight { 3320 vec3 position; 3321 vec3 color; 3322 float distance; 3323 float decay; 3324 }; 3325 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 3326 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 3327 vec3 lVector = pointLight.position - geometryPosition; 3328 light.direction = normalize( lVector ); 3329 float lightDistance = length( lVector ); 3330 light.color = pointLight.color; 3331 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 3332 light.visible = ( light.color != vec3( 0.0 ) ); 3333 } 3334#endif
3335#if NUM_SPOT_LIGHTS > 0 3336 struct SpotLight { 3337 vec3 position; 3338 vec3 direction; 3339 vec3 color; 3340 float distance; 3341 float decay; 3342 float coneCos; 3343 float penumbraCos; 3344 }; 3345 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 3346 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 3347 vec3 lVector = spotLight.position - geometryPosition; 3348 light.direction = normalize( lVector ); 3349 float angleCos = dot( light.direction, spotLight.direction ); 3350 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 3351 if ( spotAttenuation > 0.0 ) { 3352 float lightDistance = length( lVector ); 3353 light.color = spotLight.color * spotAttenuation; 3354 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 3355 light.visible = ( light.color != vec3( 0.0 ) ); 3356 } else { 3357 light.color = vec3( 0.0 ); 3358 light.visible = false; 3359 } 3360 } 3361#endif 3362#if NUM_RECT_AREA_LIGHTS > 0 3363 struct RectAreaLight { 3364 vec3 color; 3365 vec3 position; 3366 vec3 halfWidth; 3367 vec3 halfHeight; 3368 }; 3369 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 3370 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 3371#endif 3372#if NUM_HEMI_LIGHTS > 0 3373 struct HemisphereLight { 3374 vec3 direction; 3375 vec3 skyColor; 3376 vec3 groundColor; 3377 }; 3378 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 3379 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 3380 float dotNL = dot( normal, hemiLight.direction ); 3381 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 3382 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 3383 return irradiance; 3384 } 3385#endif 3386#include <lightprobes_pars_fragment>`,lights_toon_fragment:`ToonMaterial material; 3387material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; 3388struct ToonMaterial { 3389 vec3 diffuseColor; 3390}; 3391void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 3392 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 3393 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 3394} 3395void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 3396 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 3397} 3398#define RE_Direct RE_Direct_Toon 3399#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; 3400material.diffuseColor = diffuseColor.rgb; 3401material.specularColor = specular; 3402material.specularShininess = shininess; 3403material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; 3404struct BlinnPhongMaterial { 3405 vec3 diffuseColor; 3406 vec3 specularColor; 3407 float specularShininess; 3408 float specularStrength; 3409}; 3410void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 3411 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 3412 vec3 irradiance = dotNL * directLight.color; 3413 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 3414 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 3415} 3416void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 3417 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 3418} 3419#define RE_Direct RE_Direct_BlinnPhong 3420#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; 3421material.diffuseColor = diffuseColor.rgb; 3422material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 3423material.metalness = metalnessFactor; 3424vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 3425float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 3426material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 3427material.roughness = min( material.roughness, 1.0 ); 3428#ifdef IOR 3429 material.ior = ior; 3430 #ifdef USE_SPECULAR 3431 float specularIntensityFactor = specularIntensity; 3432 vec3 specularColorFactor = specularColor; 3433 #ifdef USE_SPECULAR_COLORMAP 3434 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 3435 #endif 3436 #ifdef USE_SPECULAR_INTENSITYMAP 3437 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 3438 #endif 3439 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 3440 #else 3441 float specularIntensityFactor = 1.0; 3442 vec3 specularColorFactor = vec3( 1.0 ); 3443 material.specularF90 = 1.0; 3444 #endif 3445 material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; 3446 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 3447#else 3448 material.specularColor = vec3( 0.04 ); 3449 material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); 3450 material.specularF90 = 1.0; 3451#endif 3452#ifdef USE_CLEARCOAT 3453 material.clearcoat = clearcoat; 3454 material.clearcoatRoughness = clearcoatRoughness; 3455 material.clearcoatF0 = vec3( 0.04 ); 3456 material.clearcoatF90 = 1.0; 3457 #ifdef USE_CLEARCOATMAP 3458 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 3459 #endif 3460 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 3461 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 3462 #endif 3463 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 3464 material.clearcoatRoughness += geometryRoughness; 3465 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 3466#endif 3467#ifdef USE_DISPERSION
3468 material.dispersion = dispersion; 3469#endif 3470#ifdef USE_IRIDESCENCE 3471 material.iridescence = iridescence; 3472 material.iridescenceIOR = iridescenceIOR; 3473 #ifdef USE_IRIDESCENCEMAP 3474 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 3475 #endif 3476 #ifdef USE_IRIDESCENCE_THICKNESSMAP 3477 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 3478 #else 3479 material.iridescenceThickness = iridescenceThicknessMaximum; 3480 #endif 3481#endif 3482#ifdef USE_SHEEN 3483 material.sheenColor = sheenColor; 3484 #ifdef USE_SHEEN_COLORMAP 3485 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 3486 #endif 3487 material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); 3488 #ifdef USE_SHEEN_ROUGHNESSMAP 3489 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 3490 #endif 3491#endif 3492#ifdef USE_ANISOTROPY 3493 #ifdef USE_ANISOTROPYMAP 3494 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 3495 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 3496 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 3497 #else 3498 vec2 anisotropyV = anisotropyVector; 3499 #endif 3500 material.anisotropy = length( anisotropyV ); 3501 if( material.anisotropy == 0.0 ) { 3502 anisotropyV = vec2( 1.0, 0.0 ); 3503 } else { 3504 anisotropyV /= material.anisotropy; 3505 material.anisotropy = saturate( material.anisotropy ); 3506 } 3507 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); 3508 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 3509 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 3510#endif`,lights_physical_pars_fragment:`uniform sampler2D dfgLUT; 3511struct PhysicalMaterial { 3512 vec3 diffuseColor; 3513 vec3 diffuseContribution; 3514 vec3 specularColor; 3515 vec3 specularColorBlended; 3516 float roughness; 3517 float metalness; 3518 float specularF90; 3519 float dispersion; 3520 #ifdef USE_CLEARCOAT 3521 float clearcoat; 3522 float clearcoatRoughness; 3523 vec3 clearcoatF0; 3524 float clearcoatF90; 3525 #endif 3526 #ifdef USE_IRIDESCENCE 3527 float iridescence; 3528 float iridescenceIOR; 3529 float iridescenceThickness; 3530 vec3 iridescenceFresnel; 3531 vec3 iridescenceF0; 3532 vec3 iridescenceFresnelDielectric; 3533 vec3 iridescenceFresnelMetallic; 3534 #endif 3535 #ifdef USE_SHEEN 3536 vec3 sheenColor; 3537 float sheenRoughness; 3538 #endif 3539 #ifdef IOR 3540 float ior; 3541 #endif 3542 #ifdef USE_TRANSMISSION 3543 float transmission; 3544 float transmissionAlpha; 3545 float thickness; 3546 float attenuationDistance; 3547 vec3 attenuationColor; 3548 #endif 3549 #ifdef USE_ANISOTROPY 3550 float anisotropy; 3551 float alphaT; 3552 vec3 anisotropyT; 3553 vec3 anisotropyB; 3554 #endif 3555}; 3556vec3 clearcoatSpecularDirect = vec3( 0.0 ); 3557vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 3558vec3 sheenSpecularDirect = vec3( 0.0 ); 3559vec3 sheenSpecularIndirect = vec3(0.0 ); 3560vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 3561 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 3562 float x2 = x * x; 3563 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 3564 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 3565} 3566float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 3567 float a2 = pow2( alpha ); 3568 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 3569 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 3570 return 0.5 / max( gv + gl, EPSILON ); 3571} 3572float D_GGX( const in float alpha, const in float dotNH ) { 3573 float a2 = pow2( alpha ); 3574 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 3575 return RECIPROCAL_PI * a2 / pow2( denom ); 3576} 3577#ifdef USE_ANISOTROPY 3578 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 3579 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 3580 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 3581 return 0.5 / max( gv + gl, EPSILON )
vendor: 3,169 bytes, lines 3581-3656
3581; 3582 } 3583 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 3584 float a2 = alphaT * alphaB; 3585 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 3586 highp float v2 = dot( v, v ); 3587 float w2 = a2 / v2; 3588 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 3589 } 3590#endif 3591#ifdef USE_CLEARCOAT 3592 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 3593 vec3 f0 = material.clearcoatF0; 3594 float f90 = material.clearcoatF90; 3595 float roughness = material.clearcoatRoughness; 3596 float alpha = pow2( roughness ); 3597 vec3 halfDir = normalize( lightDir + viewDir ); 3598 float dotNL = saturate( dot( normal, lightDir ) ); 3599 float dotNV = saturate( dot( normal, viewDir ) ); 3600 float dotNH = saturate( dot( normal, halfDir ) ); 3601 float dotVH = saturate( dot( viewDir, halfDir ) ); 3602 vec3 F = F_Schlick( f0, f90, dotVH ); 3603 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 3604 float D = D_GGX( alpha, dotNH ); 3605 return F * ( V * D ); 3606 } 3607#endif 3608vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 3609 vec3 f0 = material.specularColorBlended; 3610 float f90 = material.specularF90; 3611 float roughness = material.roughness; 3612 float alpha = pow2( roughness ); 3613 vec3 halfDir = normalize( lightDir + viewDir ); 3614 float dotNL = saturate( dot( normal, lightDir ) ); 3615 float dotNV = saturate( dot( normal, viewDir ) ); 3616 float dotNH = saturate( dot( normal, halfDir ) ); 3617 float dotVH = saturate( dot( viewDir, halfDir ) ); 3618 vec3 F = F_Schlick( f0, f90, dotVH ); 3619 #ifdef USE_IRIDESCENCE 3620 F = mix( F, material.iridescenceFresnel, material.iridescence ); 3621 #endif 3622 #ifdef USE_ANISOTROPY 3623 float dotTL = dot( material.anisotropyT, lightDir ); 3624 float dotTV = dot( material.anisotropyT, viewDir ); 3625 float dotTH = dot( material.anisotropyT, halfDir ); 3626 float dotBL = dot( material.anisotropyB, lightDir ); 3627 float dotBV = dot( material.anisotropyB, viewDir ); 3628 float dotBH = dot( material.anisotropyB, halfDir ); 3629 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 3630 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 3631 #else 3632 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 3633 float D = D_GGX( alpha, dotNH ); 3634 #endif 3635 return F * ( V * D ); 3636} 3637vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 3638 const float LUT_SIZE = 64.0; 3639 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 3640 const float LUT_BIAS = 0.5 / LUT_SIZE; 3641 float dotNV = saturate( dot( N, V ) ); 3642 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 3643 uv = uv * LUT_SCALE + LUT_BIAS; 3644 return uv; 3645} 3646float LTC_ClippedSphereFormFactor( const in vec3 f ) { 3647 float l = length( f ); 3648 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 3649} 3650vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 3651 float x = dot( v1, v2 ); 3652 float y = abs( x ); 3653 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 3654 float b = 3.4175940 + ( 4.1616724 + y ) * y; 3655 float v = a / b; 3656 float theta_sintheta = ( x >
vendor: 4,203 bytes, lines 3656-3740
3656 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 3657 return cross( v1, v2 ) * theta_sintheta; 3658} 3659vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 3660 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 3661 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 3662 vec3 lightNormal = cross( v1, v2 ); 3663 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 3664 vec3 T1, T2; 3665 T1 = normalize( V - N * dot( V, N ) ); 3666 T2 = - cross( N, T1 ); 3667 mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); 3668 vec3 coords[ 4 ]; 3669 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 3670 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 3671 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 3672 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 3673 coords[ 0 ] = normalize( coords[ 0 ] ); 3674 coords[ 1 ] = normalize( coords[ 1 ] ); 3675 coords[ 2 ] = normalize( coords[ 2 ] ); 3676 coords[ 3 ] = normalize( coords[ 3 ] ); 3677 vec3 vectorFormFactor = vec3( 0.0 ); 3678 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 3679 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 3680 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 3681 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 3682 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 3683 return vec3( result ); 3684} 3685#if defined( USE_SHEEN ) 3686float D_Charlie( float roughness, float dotNH ) { 3687 float alpha = pow2( roughness ); 3688 float invAlpha = 1.0 / alpha; 3689 float cos2h = dotNH * dotNH; 3690 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 3691 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 3692} 3693float V_Neubelt( float dotNV, float dotNL ) { 3694 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 3695} 3696vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 3697 vec3 halfDir = normalize( lightDir + viewDir ); 3698 float dotNL = saturate( dot( normal, lightDir ) ); 3699 float dotNV = saturate( dot( normal, viewDir ) ); 3700 float dotNH = saturate( dot( normal, halfDir ) ); 3701 float D = D_Charlie( sheenRoughness, dotNH ); 3702 float V = V_Neubelt( dotNV, dotNL ); 3703 return sheenColor * ( D * V ); 3704} 3705#endif 3706float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 3707 float dotNV = saturate( dot( normal, viewDir ) ); 3708 float r2 = roughness * roughness; 3709 float rInv = 1.0 / ( roughness + 0.1 ); 3710 float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; 3711 float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; 3712 float DG = exp( a * dotNV + b ); 3713 return saturate( DG ); 3714} 3715vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 3716 float dotNV = saturate( dot( normal, viewDir ) ); 3717 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 3718 return specularColor * fab.x + specularF90 * fab.y; 3719} 3720#ifdef USE_IRIDESCENCE 3721void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 3722#else 3723void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 3724#endif 3725 float dotNV = saturate( dot( normal, viewDir ) ); 3726 vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; 3727 #ifdef USE_IRIDESCENCE 3728 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 3729 #else 3730 vec3 Fr = specularColor; 3731 #endif 3732 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 3733 float Ess = fab.x + fab.y; 3734 float Ems = 1.0 - Ess; 3735 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 3736 singleScatter += FssEss; 3737 multiScatter += Fms * Ems; 3738} 3739vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 3740 vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 6,009 bytes, lines 3741-3839
3741 float dotNL = saturate( dot( normal, lightDir ) ); 3742 float dotNV = saturate( dot( normal, viewDir ) ); 3743 vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; 3744 vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; 3745 vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; 3746 vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; 3747 float Ess_V = dfgV.x + dfgV.y; 3748 float Ess_L = dfgL.x + dfgL.y; 3749 float Ems_V = 1.0 - Ess_V; 3750 float Ems_L = 1.0 - Ess_L; 3751 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; 3752 vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); 3753 float compensationFactor = Ems_V * Ems_L; 3754 vec3 multiScatter = Fms * compensationFactor; 3755 return singleScatter + multiScatter; 3756} 3757#if NUM_RECT_AREA_LIGHTS > 0 3758 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 3759 vec3 normal = geometryNormal; 3760 vec3 viewDir = geometryViewDir; 3761 vec3 position = geometryPosition; 3762 vec3 lightPos = rectAreaLight.position; 3763 vec3 halfWidth = rectAreaLight.halfWidth; 3764 vec3 halfHeight = rectAreaLight.halfHeight; 3765 vec3 lightColor = rectAreaLight.color; 3766 float roughness = material.roughness; 3767 vec3 rectCoords[ 4 ]; 3768 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 3769 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 3770 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 3771 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 3772 vec4 t1 = texture2D( ltc_1, uv ); 3773 vec4 t2 = texture2D( ltc_2, uv ); 3774 mat3 mInv = mat3( 3775 vec3( t1.x, 0, t1.y ), 3776 vec3( 0, 1, 0 ), 3777 vec3( t1.z, 0, t1.w ) 3778 ); 3779 vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); 3780 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 3781 reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 3782 #ifdef USE_CLEARCOAT 3783 vec3 Ncc = geometryClearcoatNormal; 3784 vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); 3785 vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); 3786 vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); 3787 mat3 mInvClearcoat = mat3( 3788 vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), 3789 vec3( 0, 1, 0 ), 3790 vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) 3791 ); 3792 vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; 3793 clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); 3794 #endif 3795 } 3796#endif 3797void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 3798 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 3799 vec3 irradiance = dotNL * directLight.color; 3800 #ifdef USE_CLEARCOAT 3801 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 3802 vec3 ccIrradiance = dotNLcc * directLight.color; 3803 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 3804 #endif 3805 #ifdef USE_SHEEN 3806 3807 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 3808 3809 float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 3810 float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); 3811 3812 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); 3813 3814 irradiance *= sheenEnergyComp; 3815 3816 #endif 3817 reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); 3818 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); 3819} 3820void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 3821 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); 3822 #ifdef USE_SHEEN 3823 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 3824 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 3825 diffuse *= sheenEnergyComp; 3826 #endif 3827 reflectedLight.indirectDiffuse += diffuse; 3828} 3829void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 3830 #ifdef USE_CLEARCOAT 3831 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 3832 #endif 3833 #ifdef USE_SHEEN 3834 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; 3835 #endif 3836 vec3 singleScatteringDielectric = vec3( 0.0 ); 3837 vec3 multiScatteringDielectric = vec3( 0.0 ); 3838 vec3 singleScatteringMetallic = vec3( 0.0 ); 3839 vec3 multiScatteringMetallic = vec3( 0.0 );
vendor: 8,137 bytes, lines 3840-3982
3840 #ifdef USE_IRIDESCENCE 3841 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 3842 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 3843 #else 3844 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); 3845 computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); 3846 #endif 3847 vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); 3848 vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); 3849 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; 3850 vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); 3851 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 3852 vec3 indirectSpecular = radiance * singleScattering; 3853 indirectSpecular += multiScattering * cosineWeightedIrradiance; 3854 vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; 3855 #ifdef USE_SHEEN 3856 float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 3857 float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; 3858 indirectSpecular *= sheenEnergyComp; 3859 indirectDiffuse *= sheenEnergyComp; 3860 #endif 3861 reflectedLight.indirectSpecular += indirectSpecular; 3862 reflectedLight.indirectDiffuse += indirectDiffuse; 3863} 3864#define RE_Direct RE_Direct_Physical 3865#define RE_Direct_RectArea RE_Direct_RectArea_Physical 3866#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 3867#define RE_IndirectSpecular RE_IndirectSpecular_Physical 3868float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 3869 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 3870}`,lights_fragment_begin:` 3871vec3 geometryPosition = - vViewPosition; 3872vec3 geometryNormal = normal; 3873vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 3874vec3 geometryClearcoatNormal = vec3( 0.0 ); 3875#ifdef USE_CLEARCOAT 3876 geometryClearcoatNormal = clearcoatNormal; 3877#endif 3878#ifdef USE_IRIDESCENCE 3879 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 3880 if ( material.iridescenceThickness == 0.0 ) { 3881 material.iridescence = 0.0; 3882 } else { 3883 material.iridescence = saturate( material.iridescence ); 3884 } 3885 if ( material.iridescence > 0.0 ) { 3886 material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 3887 material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); 3888 material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); 3889 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 3890 } 3891#endif 3892IncidentLight directLight; 3893#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 3894 PointLight pointLight; 3895 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 3896 PointLightShadow pointLightShadow; 3897 #endif 3898 #pragma unroll_loop_start 3899 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 3900 pointLight = pointLights[ i ]; 3901 getPointLightInfo( pointLight, geometryPosition, directLight ); 3902 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 3903 pointLightShadow = pointLightShadows[ i ]; 3904 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 3905 #endif 3906 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 3907 } 3908 #pragma unroll_loop_end 3909#endif 3910#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 3911 SpotLight spotLight; 3912 vec4 spotColor; 3913 vec3 spotLightCoord; 3914 bool inSpotLightMap; 3915 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 3916 SpotLightShadow spotLightShadow; 3917 #endif 3918 #pragma unroll_loop_start 3919 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 3920 spotLight = spotLights[ i ]; 3921 getSpotLightInfo( spotLight, geometryPosition, directLight ); 3922 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 3923 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 3924 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 3925 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 3926 #else 3927 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 3928 #endif 3929 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 3930 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 3931 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 3932 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 3933 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 3934 #endif 3935 #undef SPOT_LIGHT_MAP_INDEX 3936 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 3937 spotLightShadow = spotLightShadows[ i ]; 3938 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 3939 #endif 3940 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 3941 } 3942 #pragma unroll_loop_end 3943#endif 3944#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 3945 DirectionalLight directionalLight; 3946 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 3947 DirectionalLightShadow directionalLightShadow; 3948 #endif 3949 #pragma unroll_loop_start 3950 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 3951 directionalLight = directionalLights[ i ]; 3952 getDirectionalLightInfo( directionalLight, directLight ); 3953 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 3954 directionalLightShadow = directionalLightShadows[ i ]; 3955 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 3956 #endif 3957 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 3958 } 3959 #pragma unroll_loop_end 3960#endif 3961#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 3962 RectAreaLight rectAreaLight; 3963 #pragma unroll_loop_start 3964 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 3965 rectAreaLight = rectAreaLights[ i ]; 3966 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 3967 } 3968 #pragma unroll_loop_end 3969#endif 3970#if defined( RE_IndirectDiffuse ) 3971 vec3 iblIrradiance = vec3( 0.0 ); 3972 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 3973 #if defined( USE_LIGHT_PROBES ) 3974 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 3975 #endif 3976 #if ( NUM_HEMI_LIGHTS > 0 ) 3977 #pragma unroll_loop_start 3978 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 3979 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 3980 } 3981 #pragma unroll_loop_end 3982 #endif
3983 #ifdef USE_LIGHT_PROBES_GRID 3984 vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz; 3985 vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix ); 3986 irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal ); 3987 #endif 3988#endif 3989#if defined( RE_IndirectSpecular ) 3990 vec3 radiance = vec3( 0.0 ); 3991 vec3 clearcoatRadiance = vec3( 0.0 ); 3992#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) 3993 #ifdef USE_LIGHTMAP 3994 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 3995 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 3996 irradiance += lightMapIrradiance; 3997 #endif 3998 #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) 3999 #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) 4000 iblIrradiance += getIBLIrradiance( geometryNormal ); 4001 #endif 4002 #endif 4003#endif 4004#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 4005 #ifdef USE_ANISOTROPY 4006 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 4007 #else 4008 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 4009 #endif 4010 #ifdef USE_CLEARCOAT 4011 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 4012 #endif 4013#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) 4014 #if defined( LAMBERT ) || defined( PHONG ) 4015 irradiance += iblIrradiance; 4016 #endif 4017 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 4018#endif 4019#if defined( RE_IndirectSpecular ) 4020 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 4021#endif`,lightprobes_pars_fragment:`#ifdef USE_LIGHT_PROBES_GRID 4022uniform highp sampler3D probesSH; 4023uniform vec3 probesMin; 4024uniform vec3 probesMax; 4025uniform vec3 probesResolution; 4026vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) { 4027 vec3 res = probesResolution; 4028 vec3 gridRange = probesMax - probesMin; 4029 vec3 resMinusOne = res - 1.0; 4030 vec3 probeSpacing = gridRange / resMinusOne; 4031 vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5; 4032 vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 ); 4033 uvw = uvw * resMinusOne / res + 0.5 / res; 4034 float nz = res.z; 4035 float paddedSlices = nz + 2.0; 4036 float atlasDepth = 7.0 * paddedSlices; 4037 float uvZBase = uvw.z * nz + 1.0; 4038 vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) ); 4039 vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) ); 4040 vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) ); 4041 vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) ); 4042 vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) ); 4043 vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) ); 4044 vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) ); 4045 vec3 c0 = s0.xyz; 4046 vec3 c1 = vec3( s0.w, s1.xy ); 4047 vec3 c2 = vec3( s1.zw, s2.x ); 4048 vec3 c3 = s2.yzw; 4049 vec3 c4 = s3.xyz; 4050 vec3 c5 = vec3( s3.w, s4.xy ); 4051 vec3 c6 = vec3( s4.zw, s5.x ); 4052 vec3 c7 = s5.yzw; 4053 vec3 c8 = s6.xyz; 4054 float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z; 4055 vec3 result = c0 * 0.886227; 4056 result += c1 * 2.0 * 0.511664 * y; 4057 result += c2 * 2.0 * 0.511664 * z; 4058 result += c3 * 2.0 * 0.511664 * x; 4059 result += c4 * 2.0 * 0.429043 * x * y; 4060 result += c5 * 2.0 * 0.429043 * y * z; 4061 result += c6 * ( 0.743125 * z * z - 0.247708 ); 4062 result += c7 * 2.0 * 0.429043 * x * z; 4063 result += c8 * 0.429043 * ( x * x - y * y ); 4064 return max( result, vec3( 0.0 ) ); 4065} 4066#endif`,logdepthbuf_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 4067 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 4068#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 4069 uniform float logDepthBufFC; 4070 varying float vFragDepth; 4071 varying float vIsPerspective; 4072#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 4073 varying float vFragDepth; 4074 varying float vIsPerspective; 4075#endif`,logdepthbuf_vertex:`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 4076 vFragDepth = 1.0 + gl_Position.w; 4077 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 4078#endif`,map_fragment:`#ifdef USE_MAP 4079 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 4080 #ifdef DECODE_VIDEO_TEXTURE 4081 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 4082 #endif 4083 diffuseColor *= sampledDiffuseColor; 4084#endif`,map_pars_fragment:`#ifdef USE_MAP 4085 uniform sampler2D map; 4086#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 4087 #if defined( USE_POINTS_UV ) 4088 vec2 uv = vUv; 4089 #else 4090 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 4091 #endif 4092#endif 4093#ifdef USE_MAP 4094 diffuseColor *= texture2D( map, uv ); 4095#endif 4096#ifdef USE_ALPHAMAP 4097 diffuseColor.a *= texture2D( alphaMap, uv ).g; 4098#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) 4099 varying vec2 vUv; 4100#else 4101 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 4102 uniform mat3 uvTransform; 4103 #endif 4104#endif 4105#ifdef USE_MAP 4106 uniform sampler2D map; 4107#endif 4108#ifdef USE_ALPHAMAP 4109 uniform sampler2D alphaMap; 4110#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; 4111#ifdef USE_METALNESSMAP 4112 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 4113 metalnessFactor *= texelMetalness.b; 4114#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP 4115 uniform sampler2D metalnessMap; 4116#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH 4117 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 4118 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 4119 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 4120 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 4121 } 4122#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) 4123 vColor *= morphTargetBaseInfluence; 4124 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 4125 #if defined( USE_COLOR_ALPHA ) 4126 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 4127 #elif defined( USE_COLOR ) 4128 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 4129 #endif 4130 } 4131#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS 4132 objectNormal *= morphTargetBaseInfluence; 4133 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 4134 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 4135 } 4136#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS 4137 #ifndef USE_INSTANCING_MORPH 4138 uniform float morphTargetBaseInfluence; 4139 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 4140 #endif 4141 uniform sampler2DArray morphTargetsTexture; 4142 uniform ivec2 morphTargetsTextureSize; 4143 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 4144 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 4145 int y = texelIndex / morphTargetsTextureSize.x; 4146 int x = texelIndex - y * morphTargetsTextureSize.x; 4147 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 4148 return texelFetch( morphTargetsTexture, morphUV, 0 ); 4149 } 4150#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS 4151 transformed *= morphTargetBaseInfluence; 4152 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 4153 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 4154 } 4155#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 4156#ifdef FLAT_SHADED 4157 vec3 fdx = dFdx( vViewPosition ); 4158 vec3 fdy = dFdy( vViewPosition ); 4159 vec3 normal = normalize( cross( fdx, fdy ) ); 4160#else 4161 vec3 normal = normalize( vNormal ); 4162 #ifdef DOUBLE_SIDED 4163 normal *= faceDirection; 4164 #endif 4165#endif 4166#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 4167 #ifdef USE_TANGENT 4168 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 4169 #else 4170 mat3 tbn = getTangentFrame( - vViewPosition, normal, 4171 #if defined( USE_NORMALMAP ) 4172 vNormalMapUv 4173 #elif defined( USE_CLEARCOAT_NORMALMAP ) 4174 vClearcoatNormalMapUv 4175 #else 4176 vUv 4177 #endif 4178 ); 4179 #endif 4180 #ifdef DOUBLE_SIDED 4181 tbn[0] *= faceDirection; 4182 tbn[1] *= faceDirection; 4183 #endif 4184#endif 4185#ifdef USE_CLEARCOAT_NORMALMAP 4186 #ifdef USE_TANGENT 4187 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 4188 #else 4189 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 4190 #endif 4191 #ifdef DOUBLE_SIDED 4192 tbn2[0] *= faceDirection; 4193 tbn2[1] *= faceDirection; 4194 #endif 4195#endif 4196vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE 4197 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 4198 #ifdef FLIP_SIDED 4199 normal = - normal; 4200 #endif 4201 #ifdef DOUBLE_SIDED 4202 normal = normal * faceDirection; 4203 #endif 4204 normal = normalize( normalMatrix * normal ); 4205#elif defined( USE_NORMALMAP_TANGENTSPACE ) 4206 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 4207 #if defined( USE_PACKED_NORMALMAP ) 4208 mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) ); 4209 #endif 4210 mapN.xy *= normalScale; 4211 normal = normalize( tbn * mapN ); 4212#elif defined( USE_BUMPMAP )
4213 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 4214#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED 4215 varying vec3 vNormal; 4216 #ifdef USE_TANGENT 4217 varying vec3 vTangent; 4218 varying vec3 vBitangent; 4219 #endif 4220#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED 4221 varying vec3 vNormal; 4222 #ifdef USE_TANGENT 4223 varying vec3 vTangent; 4224 varying vec3 vBitangent; 4225 #endif 4226#endif`,normal_vertex:`#ifndef FLAT_SHADED 4227 vNormal = normalize( transformedNormal ); 4228 #ifdef USE_TANGENT 4229 vTangent = normalize( transformedTangent ); 4230 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 4231 #ifdef FLIP_SIDED 4232 vBitangent = - vBitangent; 4233 #endif 4234 #endif 4235#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP 4236 uniform sampler2D normalMap; 4237 uniform vec2 normalScale; 4238#endif 4239#ifdef USE_NORMALMAP_OBJECTSPACE 4240 uniform mat3 normalMatrix; 4241#endif 4242#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 4243 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 4244 vec3 q0 = dFdx( eye_pos.xyz ); 4245 vec3 q1 = dFdy( eye_pos.xyz ); 4246 vec2 st0 = dFdx( uv.st ); 4247 vec2 st1 = dFdy( uv.st ); 4248 vec3 N = surf_norm; 4249 vec3 q1perp = cross( q1, N ); 4250 vec3 q0perp = cross( N, q0 ); 4251 vec3 T = q1perp * st0.x + q0perp * st1.x; 4252 vec3 B = q1perp * st0.y + q0perp * st1.y; 4253 float det = max( dot( T, T ), dot( B, B ) ); 4254 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 4255 return mat3( T * scale, B * scale, N ); 4256 } 4257#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT 4258 vec3 clearcoatNormal = nonPerturbedNormal; 4259#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP 4260 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 4261 clearcoatMapN.xy *= clearcoatNormalScale; 4262 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 4263#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP 4264 uniform sampler2D clearcoatMap; 4265#endif 4266#ifdef USE_CLEARCOAT_NORMALMAP 4267 uniform sampler2D clearcoatNormalMap; 4268 uniform vec2 clearcoatNormalScale; 4269#endif 4270#ifdef USE_CLEARCOAT_ROUGHNESSMAP 4271 uniform sampler2D clearcoatRoughnessMap; 4272#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP 4273 uniform sampler2D iridescenceMap; 4274#endif 4275#ifdef USE_IRIDESCENCE_THICKNESSMAP 4276 uniform sampler2D iridescenceThicknessMap; 4277#endif`,opaque_fragment:`#ifdef OPAQUE 4278diffuseColor.a = 1.0; 4279#endif 4280#ifdef USE_TRANSMISSION 4281diffuseColor.a *= material.transmissionAlpha; 4282#endif 4283gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { 4284 return normalize( normal ) * 0.5 + 0.5; 4285} 4286vec3 unpackRGBToNormal( const in vec3 rgb ) { 4287 return 2.0 * rgb.xyz - 1.0; 4288} 4289const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 4290const float Inv255 = 1. / 255.; 4291const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 4292const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 4293const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 4294const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 4295vec4 packDepthToRGBA( const in float v ) { 4296 if( v <= 0.0 ) 4297 return vec4( 0., 0., 0., 0. ); 4298 if( v >= 1.0 ) 4299 return vec4( 1., 1., 1., 1. ); 4300 float vuf; 4301 float af = modf( v * PackFactors.a, vuf ); 4302 float bf = modf( vuf * ShiftRight8, vuf ); 4303 float gf = modf( vuf * ShiftRight8, vuf ); 4304 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 4305} 4306vec3 packDepthToRGB( const in float v ) { 4307 if( v <= 0.0 ) 4308 return vec3( 0., 0., 0. ); 4309 if( v >= 1.0 ) 4310 return vec3( 1., 1., 1. ); 4311 float vuf; 4312 float bf = modf( v * PackFactors.b, vuf ); 4313 float gf = modf( vuf * ShiftRight8, vuf ); 4314 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 4315} 4316vec2 packDepthToRG( const in float v ) { 4317 if( v <= 0.0 ) 4318 return vec2( 0., 0. ); 4319 if( v >= 1.0 ) 4320 return vec2( 1., 1. ); 4321 float vuf; 4322 float gf = modf( v * 256., vuf ); 4323 return vec2( vuf * Inv255, gf ); 4324} 4325float unpackRGBAToDepth( const in vec4 v ) { 4326 return dot( v, UnpackFactors4 ); 4327} 4328float unpackRGBToDepth( const in vec3 v ) { 4329 return dot( v, UnpackFactors3 ); 4330} 4331float unpackRGToDepth( const in vec2 v ) { 4332 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 4333} 4334vec4 pack2HalfToRGBA( const in vec2 v ) {
4335 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 4336 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 4337} 4338vec2 unpackRGBATo2Half( const in vec4 v ) { 4339 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 4340} 4341float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 4342 return ( viewZ + near ) / ( near - far ); 4343} 4344float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 4345 #ifdef USE_REVERSED_DEPTH_BUFFER 4346 4347 return depth * ( far - near ) - far; 4348 #else 4349 return depth * ( near - far ) - near; 4350 #endif 4351} 4352float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 4353 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 4354} 4355float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 4356 4357 #ifdef USE_REVERSED_DEPTH_BUFFER 4358 return ( near * far ) / ( ( near - far ) * depth - near ); 4359 #else 4360 return ( near * far ) / ( ( far - near ) * depth - far ); 4361 #endif 4362}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA 4363 gl_FragColor.rgb *= gl_FragColor.a; 4364#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); 4365#ifdef USE_BATCHING 4366 mvPosition = batchingMatrix * mvPosition; 4367#endif 4368#ifdef USE_INSTANCING 4369 mvPosition = instanceMatrix * mvPosition; 4370#endif 4371mvPosition = modelViewMatrix * mvPosition; 4372gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING 4373 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 4374#endif`,dithering_pars_fragment:`#ifdef DITHERING 4375 vec3 dithering( vec3 color ) { 4376 float grid_position = rand( gl_FragCoord.xy ); 4377 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 4378 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 4379 return color + dither_shift_RGB; 4380 } 4381#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; 4382#ifdef USE_ROUGHNESSMAP 4383 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 4384 roughnessFactor *= texelRoughness.g; 4385#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP 4386 uniform sampler2D roughnessMap; 4387#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 4388 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 4389#endif 4390#if NUM_SPOT_LIGHT_MAPS > 0 4391 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 4392#endif 4393#ifdef USE_SHADOWMAP 4394 #if NUM_DIR_LIGHT_SHADOWS > 0 4395 #if defined( SHADOWMAP_TYPE_PCF ) 4396 uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 4397 #else 4398 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 4399 #endif 4400 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 4401 struct DirectionalLightShadow { 4402 float shadowIntensity; 4403 float shadowBias; 4404 float shadowNormalBias; 4405 float shadowRadius; 4406 vec2 shadowMapSize; 4407 }; 4408 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 4409 #endif 4410 #if NUM_SPOT_LIGHT_SHADOWS > 0 4411 #if defined( SHADOWMAP_TYPE_PCF ) 4412 uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 4413 #else 4414 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 4415 #endif 4416 struct SpotLightShadow { 4417 float shadowIntensity; 4418 float shadowBias; 4419 float shadowNormalBias; 4420 float shadowRadius; 4421 vec2 shadowMapSize; 4422 }; 4423 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 4424 #endif 4425 #if NUM_POINT_LIGHT_SHADOWS > 0 4426 #if defined( SHADOWMAP_TYPE_PCF ) 4427 uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 4428 #elif defined( SHADOWMAP_TYPE_BASIC ) 4429 uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 4430 #endif 4431 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 4432 struct PointLightShadow { 4433 float shadowIntensity; 4434 float shadowBias; 4435 float shadowNormalBias; 4436 float shadowRadius; 4437 vec2 shadowMapSize; 4438 float shadowCameraNear; 4439 float shadowCameraFar; 4440 }; 4441 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 4442 #endif 4443 #if defined( SHADOWMAP_TYPE_PCF ) 4444 float interleavedGradientNoise( vec2 position ) {
4445 return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); 4446 } 4447 vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { 4448 const float goldenAngle = 2.399963229728653; 4449 float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); 4450 float theta = float( sampleIndex ) * goldenAngle + phi; 4451 return vec2( cos( theta ), sin( theta ) ) * r; 4452 } 4453 #endif 4454 #if defined( SHADOWMAP_TYPE_PCF ) 4455 float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 4456 float shadow = 1.0; 4457 shadowCoord.xyz /= shadowCoord.w; 4458 shadowCoord.z += shadowBias; 4459 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 4460 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 4461 if ( frustumTest ) { 4462 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 4463 float radius = shadowRadius * texelSize.x; 4464 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 4465 shadow = ( 4466 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + 4467 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + 4468 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + 4469 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + 4470 texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) 4471 ) * 0.2; 4472 } 4473 return mix( 1.0, shadow, shadowIntensity ); 4474 } 4475 #elif defined( SHADOWMAP_TYPE_VSM ) 4476 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 4477 float shadow = 1.0; 4478 shadowCoord.xyz /= shadowCoord.w; 4479 #ifdef USE_REVERSED_DEPTH_BUFFER 4480 shadowCoord.z -= shadowBias; 4481 #else 4482 shadowCoord.z += shadowBias; 4483 #endif 4484 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 4485 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 4486 if ( frustumTest ) { 4487 vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; 4488 float mean = distribution.x; 4489 float variance = distribution.y * distribution.y; 4490 #ifdef USE_REVERSED_DEPTH_BUFFER 4491 float hard_shadow = step( mean, shadowCoord.z ); 4492 #else 4493 float hard_shadow = step( shadowCoord.z, mean ); 4494 #endif 4495 4496 if ( hard_shadow == 1.0 ) { 4497 shadow = 1.0; 4498 } else { 4499 variance = max( variance, 0.0000001 ); 4500 float d = shadowCoord.z - mean; 4501 float p_max = variance / ( variance + d * d ); 4502 p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); 4503 shadow = max( hard_shadow, p_max ); 4504 } 4505 } 4506 return mix( 1.0, shadow, shadowIntensity ); 4507 } 4508 #else 4509 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 4510 float shadow = 1.0; 4511 shadowCoord.xyz /= shadowCoord.w; 4512 #ifdef USE_REVERSED_DEPTH_BUFFER 4513 shadowCoord.z -= shadowBias; 4514 #else 4515 shadowCoord.z += shadowBias; 4516 #endif 4517 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 4518 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 4519 if ( frustumTest ) { 4520 float depth = texture2D( shadowMap, shadowCoord.xy ).r; 4521 #ifdef USE_REVERSED_DEPTH_BUFFER 4522 shadow = step( depth, shadowCoord.z ); 4523 #else 4524 shadow = step( shadowCoord.z, depth ); 4525 #endif 4526 } 4527 return mix( 1.0, shadow, shadowIntensity ); 4528 } 4529 #endif 4530 #if NUM_POINT_LIGHT_SHADOWS > 0 4531 #if defined( SHADOWMAP_TYPE_PCF ) 4532 float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 4533 float shadow = 1.0; 4534 vec3 lightToPosition = shadowCoord.xyz; 4535 vec3 bd3D = normalize( lightToPosition ); 4536 vec3 absVec = abs( lightToPosition ); 4537 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 4538 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 4539 #ifdef USE_REVERSED_DEPTH_BUFFER 4540 float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
4541 dp -= shadowBias; 4542 #else 4543 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 4544 dp += shadowBias; 4545 #endif 4546 float texelSize = shadowRadius / shadowMapSize.x; 4547 vec3 absDir = abs( bd3D ); 4548 vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); 4549 tangent = normalize( cross( bd3D, tangent ) ); 4550 vec3 bitangent = cross( bd3D, tangent ); 4551 float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; 4552 vec2 sample0 = vogelDiskSample( 0, 5, phi ); 4553 vec2 sample1 = vogelDiskSample( 1, 5, phi ); 4554 vec2 sample2 = vogelDiskSample( 2, 5, phi ); 4555 vec2 sample3 = vogelDiskSample( 3, 5, phi ); 4556 vec2 sample4 = vogelDiskSample( 4, 5, phi ); 4557 shadow = ( 4558 texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + 4559 texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + 4560 texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + 4561 texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + 4562 texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) 4563 ) * 0.2; 4564 } 4565 return mix( 1.0, shadow, shadowIntensity ); 4566 } 4567 #elif defined( SHADOWMAP_TYPE_BASIC ) 4568 float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 4569 float shadow = 1.0; 4570 vec3 lightToPosition = shadowCoord.xyz; 4571 vec3 absVec = abs( lightToPosition ); 4572 float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); 4573 if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { 4574 float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); 4575 dp += shadowBias; 4576 vec3 bd3D = normalize( lightToPosition ); 4577 float depth = textureCube( shadowMap, bd3D ).r; 4578 #ifdef USE_REVERSED_DEPTH_BUFFER 4579 depth = 1.0 - depth; 4580 #endif 4581 shadow = step( dp, depth ); 4582 } 4583 return mix( 1.0, shadow, shadowIntensity ); 4584 } 4585 #endif 4586 #endif 4587#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 4588 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 4589 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 4590#endif 4591#ifdef USE_SHADOWMAP 4592 #if NUM_DIR_LIGHT_SHADOWS > 0 4593 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 4594 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 4595 struct DirectionalLightShadow { 4596 float shadowIntensity; 4597 float shadowBias; 4598 float shadowNormalBias; 4599 float shadowRadius; 4600 vec2 shadowMapSize; 4601 }; 4602 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 4603 #endif 4604 #if NUM_SPOT_LIGHT_SHADOWS > 0 4605 struct SpotLightShadow { 4606 float shadowIntensity; 4607 float shadowBias; 4608 float shadowNormalBias; 4609 float shadowRadius; 4610 vec2 shadowMapSize; 4611 }; 4612 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 4613 #endif 4614 #if NUM_POINT_LIGHT_SHADOWS > 0 4615 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 4616 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 4617 struct PointLightShadow { 4618 float shadowIntensity; 4619 float shadowBias; 4620 float shadowNormalBias; 4621 float shadowRadius; 4622 vec2 shadowMapSize; 4623 float shadowCameraNear; 4624 float shadowCameraFar; 4625 }; 4626 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 4627 #endif 4628#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 4629 #ifdef HAS_NORMAL 4630 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix ); 4631 #else 4632 vec3 shadowWorldNormal = vec3( 0.0 ); 4633 #endif 4634 vec4 shadowWorldPosition; 4635#endif 4636#if defined( USE_SHADOWMAP ) 4637 #if NUM_DIR_LIGHT_SHADOWS > 0 4638 #pragma unroll_loop_start 4639 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 4640 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 4641 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 4642 } 4643 #pragma unroll_loop_end 4644 #endif 4645 #if NUM_POINT_LIGHT_SHADOWS > 0 4646 #pragma unroll_loop_start 4647 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 4648 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 4649 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 4650 } 4651 #pragma unroll_loop_end 4652 #endif 4653#endif
4654#if NUM_SPOT_LIGHT_COORDS > 0 4655 #pragma unroll_loop_start 4656 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 4657 shadowWorldPosition = worldPosition; 4658 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 4659 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 4660 #endif 4661 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 4662 } 4663 #pragma unroll_loop_end 4664#endif`,shadowmask_pars_fragment:`float getShadowMask() { 4665 float shadow = 1.0; 4666 #ifdef USE_SHADOWMAP 4667 #if NUM_DIR_LIGHT_SHADOWS > 0 4668 DirectionalLightShadow directionalLight; 4669 #pragma unroll_loop_start 4670 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 4671 directionalLight = directionalLightShadows[ i ]; 4672 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 4673 } 4674 #pragma unroll_loop_end 4675 #endif 4676 #if NUM_SPOT_LIGHT_SHADOWS > 0 4677 SpotLightShadow spotLight; 4678 #pragma unroll_loop_start 4679 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 4680 spotLight = spotLightShadows[ i ]; 4681 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 4682 } 4683 #pragma unroll_loop_end 4684 #endif 4685 #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) 4686 PointLightShadow pointLight; 4687 #pragma unroll_loop_start 4688 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 4689 pointLight = pointLightShadows[ i ]; 4690 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 4691 } 4692 #pragma unroll_loop_end 4693 #endif 4694 #endif 4695 return shadow; 4696}`,skinbase_vertex:`#ifdef USE_SKINNING 4697 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 4698 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 4699 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 4700 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 4701#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING 4702 uniform mat4 bindMatrix; 4703 uniform mat4 bindMatrixInverse; 4704 uniform highp sampler2D boneTexture; 4705 mat4 getBoneMatrix( const in float i ) { 4706 int size = textureSize( boneTexture, 0 ).x; 4707 int j = int( i ) * 4; 4708 int x = j % size; 4709 int y = j / size; 4710 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 4711 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 4712 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 4713 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 4714 return mat4( v1, v2, v3, v4 ); 4715 } 4716#endif`,skinning_vertex:`#ifdef USE_SKINNING 4717 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 4718 vec4 skinned = vec4( 0.0 ); 4719 skinned += boneMatX * skinVertex * skinWeight.x; 4720 skinned += boneMatY * skinVertex * skinWeight.y; 4721 skinned += boneMatZ * skinVertex * skinWeight.z; 4722 skinned += boneMatW * skinVertex * skinWeight.w; 4723 transformed = ( bindMatrixInverse * skinned ).xyz; 4724#endif`,skinnormal_vertex:`#ifdef USE_SKINNING 4725 mat4 skinMatrix = mat4( 0.0 ); 4726 skinMatrix += skinWeight.x * boneMatX; 4727 skinMatrix += skinWeight.y * boneMatY; 4728 skinMatrix += skinWeight.z * boneMatZ; 4729 skinMatrix += skinWeight.w * boneMatW; 4730 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 4731 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 4732 #ifdef USE_TANGENT 4733 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 4734 #endif 4735#endif`,specularmap_fragment:`float specularStrength; 4736#ifdef USE_SPECULARMAP 4737 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 4738 specularStrength = texelSpecular.r; 4739#else 4740 specularStrength = 1.0; 4741#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP 4742 uniform sampler2D specularMap; 4743#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) 4744 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 4745#endif`,tonemapping_pars_fragment:`#ifndef saturate 4746#define saturate( a ) clamp( a, 0.0, 1.0 ) 4747#endif 4748uniform float toneMappingExposure; 4749vec3 LinearToneMapping( vec3 color ) { 4750 return saturate( toneMappingExposure * color ); 4751} 4752vec3 ReinhardToneMapping( vec3 color ) { 4753 color *= toneMappingExposure; 4754 return saturate( color / ( vec3( 1.0 ) + color ) ); 4755} 4756vec3 CineonToneMapping( vec3 color ) { 4757 color *= toneMappingExposure; 4758 color = max( vec3( 0.0 ), color - 0.004 ); 4759 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 4760} 4761vec3 RRTAndODTFit( vec3 v ) { 4762 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 4763 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 4764 return a / b; 4765} 4766vec3 ACESFilmicToneMapping( vec3 color ) { 4767 const mat3 ACESInputMat = mat3( 4768 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 4769 vec3( 0.04823, 0.01566, 0.83777 ) 4770 ); 4771 const mat3 ACESOutputMat = mat3( 4772 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 4773 vec3( -0.07367, -0.00605, 1.07602 ) 4774 ); 4775 color *= toneMappingExposure / 0.6; 4776 color = ACESInputMat * color; 4777 color = RRTAndODTFit( color ); 4778 color = ACESOutputMat * color; 4779 return saturate( color ); 4780} 4781const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 4782 vec3( 1.6605, - 0.1246, - 0.0182 ), 4783 vec3( - 0.5876, 1.1329, - 0.1006 ), 4784 vec3( - 0.0728, - 0.0083, 1.1187 ) 4785); 4786const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 4787 vec3( 0.6274, 0.0691, 0.0164 ), 4788 vec3( 0.3293, 0.9195, 0.0880 ), 4789 vec3( 0.0433, 0.0113, 0.8956 ) 4790); 4791vec3 agxDefaultContrastApprox( vec3 x ) { 4792 vec3 x2 = x * x; 4793 vec3 x4 = x2 * x2; 4794 return + 15.5 * x4 * x2 4795 - 40.14 * x4 * x 4796 + 31.96 * x4 4797 - 6.868 * x2 * x 4798 + 0.4298 * x2 4799 + 0.1191 * x 4800 - 0.00232; 4801} 4802vec3 AgXToneMapping( vec3 color ) { 4803 const mat3 AgXInsetMatrix = mat3( 4804 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 4805 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 4806 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 4807 );
4808 const mat3 AgXOutsetMatrix = mat3( 4809 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 4810 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 4811 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 4812 ); 4813 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 4814 color *= toneMappingExposure; 4815 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 4816 color = AgXInsetMatrix * color; 4817 color = max( color, 1e-10 ); color = log2( color ); 4818 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 4819 color = clamp( color, 0.0, 1.0 ); 4820 color = agxDefaultContrastApprox( color ); 4821 color = AgXOutsetMatrix * color; 4822 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 4823 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 4824 color = clamp( color, 0.0, 1.0 ); 4825 return color; 4826} 4827vec3 NeutralToneMapping( vec3 color ) { 4828 const float StartCompression = 0.8 - 0.04; 4829 const float Desaturation = 0.15; 4830 color *= toneMappingExposure; 4831 float x = min( color.r, min( color.g, color.b ) ); 4832 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 4833 color -= offset; 4834 float peak = max( color.r, max( color.g, color.b ) ); 4835 if ( peak < StartCompression ) return color; 4836 float d = 1. - StartCompression; 4837 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 4838 color *= newPeak / peak; 4839 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 4840 return mix( color, vec3( newPeak ), g ); 4841} 4842vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION 4843 material.transmission = transmission; 4844 material.transmissionAlpha = 1.0; 4845 material.thickness = thickness; 4846 material.attenuationDistance = attenuationDistance; 4847 material.attenuationColor = attenuationColor; 4848 #ifdef USE_TRANSMISSIONMAP 4849 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 4850 #endif 4851 #ifdef USE_THICKNESSMAP 4852 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 4853 #endif 4854 vec3 pos = vWorldPosition; 4855 vec3 v = normalize( cameraPosition - pos ); 4856 vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix ); 4857 vec4 transmitted = getIBLVolumeRefraction( 4858 n, v, material.roughness, material.diffuseContribution, material.specularColorBlended
vendor: 14,463 bytes, lines 4858-5262
4858, material.specularF90, 4859 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 4860 material.attenuationColor, material.attenuationDistance ); 4861 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 4862 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 4863#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION 4864 uniform float transmission; 4865 uniform float thickness; 4866 uniform float attenuationDistance; 4867 uniform vec3 attenuationColor; 4868 #ifdef USE_TRANSMISSIONMAP 4869 uniform sampler2D transmissionMap; 4870 #endif 4871 #ifdef USE_THICKNESSMAP 4872 uniform sampler2D thicknessMap; 4873 #endif 4874 uniform vec2 transmissionSamplerSize; 4875 uniform sampler2D transmissionSamplerMap; 4876 uniform mat4 modelMatrix; 4877 uniform mat4 projectionMatrix; 4878 varying vec3 vWorldPosition; 4879 float w0( float a ) { 4880 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 4881 } 4882 float w1( float a ) { 4883 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 4884 } 4885 float w2( float a ){ 4886 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 4887 } 4888 float w3( float a ) { 4889 return ( 1.0 / 6.0 ) * ( a * a * a ); 4890 } 4891 float g0( float a ) { 4892 return w0( a ) + w1( a ); 4893 } 4894 float g1( float a ) { 4895 return w2( a ) + w3( a ); 4896 } 4897 float h0( float a ) { 4898 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 4899 } 4900 float h1( float a ) { 4901 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 4902 } 4903 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 4904 uv = uv * texelSize.zw + 0.5; 4905 vec2 iuv = floor( uv ); 4906 vec2 fuv = fract( uv ); 4907 float g0x = g0( fuv.x ); 4908 float g1x = g1( fuv.x ); 4909 float h0x = h0( fuv.x ); 4910 float h1x = h1( fuv.x ); 4911 float h0y = h0( fuv.y ); 4912 float h1y = h1( fuv.y ); 4913 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 4914 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 4915 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 4916 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 4917 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 4918 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 4919 } 4920 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 4921 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 4922 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 4923 vec2 fLodSizeInv = 1.0 / fLodSize; 4924 vec2 cLodSizeInv = 1.0 / cLodSize; 4925 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 4926 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 4927 return mix( fSample, cSample, fract( lod ) ); 4928 } 4929 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 4930 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 4931 vec3 modelScale; 4932 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 4933 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 4934 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 4935 return normalize( refractionVector ) * thickness * modelScale; 4936 } 4937 float applyIorToRoughness( const in float roughness, const in float ior ) { 4938 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 4939 } 4940 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 4941 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 4942 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 4943 } 4944 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 4945 if ( isinf( attenuationDistance ) ) { 4946 return vec3( 1.0 ); 4947 } else { 4948 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 4949 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 4950 } 4951 } 4952 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 4953 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 4954 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 4955 const in vec3 attenuationColor, const in float attenuationDistance ) { 4956 vec4 transmittedLight; 4957 vec3 transmittance; 4958 #ifdef USE_DISPERSION 4959 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 4960 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 4961 for ( int i = 0; i < 3; i ++ ) { 4962 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 4963 vec3 refractedRayExit = position + transmissionRay; 4964 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 4965 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 4966 refractionCoords += 1.0; 4967 refractionCoords /= 2.0; 4968 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 4969 transmittedLight[ i ] = transmissionSample[ i ]; 4970 transmittedLight.a += transmissionSample.a; 4971 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 4972 } 4973 transmittedLight.a /= 3.0; 4974 #else 4975 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 4976 vec3 refractedRayExit = position + transmissionRay; 4977 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 4978 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 4979 refractionCoords += 1.0; 4980 refractionCoords /= 2.0; 4981 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 4982 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 4983 #endif 4984 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 4985 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 4986 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 4987 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 4988 } 4989#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 4990 varying vec2 vUv; 4991#endif 4992#ifdef USE_MAP 4993 varying vec2 vMapUv; 4994#endif 4995#ifdef USE_ALPHAMAP 4996 varying vec2 vAlphaMapUv; 4997#endif 4998#ifdef USE_LIGHTMAP 4999 varying vec2 vLightMapUv; 5000#endif 5001#ifdef USE_AOMAP 5002 varying vec2 vAoMapUv; 5003#endif 5004#ifdef USE_BUMPMAP 5005 varying vec2 vBumpMapUv; 5006#endif 5007#ifdef USE_NORMALMAP 5008 varying vec2 vNormalMapUv; 5009#endif 5010#ifdef USE_EMISSIVEMAP 5011 varying vec2 vEmissiveMapUv; 5012#endif 5013#ifdef USE_METALNESSMAP 5014 varying vec2 vMetalnessMapUv; 5015#endif 5016#ifdef USE_ROUGHNESSMAP 5017 varying vec2 vRoughnessMapUv; 5018#endif 5019#ifdef USE_ANISOTROPYMAP 5020 varying vec2 vAnisotropyMapUv; 5021#endif 5022#ifdef USE_CLEARCOATMAP 5023 varying vec2 vClearcoatMapUv; 5024#endif 5025#ifdef USE_CLEARCOAT_NORMALMAP 5026 varying vec2 vClearcoatNormalMapUv; 5027#endif 5028#ifdef USE_CLEARCOAT_ROUGHNESSMAP 5029 varying vec2 vClearcoatRoughnessMapUv; 5030#endif 5031#ifdef USE_IRIDESCENCEMAP 5032 varying vec2 vIridescenceMapUv; 5033#endif 5034#ifdef USE_IRIDESCENCE_THICKNESSMAP 5035 varying vec2 vIridescenceThicknessMapUv; 5036#endif 5037#ifdef USE_SHEEN_COLORMAP 5038 varying vec2 vSheenColorMapUv; 5039#endif 5040#ifdef USE_SHEEN_ROUGHNESSMAP 5041 varying vec2 vSheenRoughnessMapUv; 5042#endif 5043#ifdef USE_SPECULARMAP 5044 varying vec2 vSpecularMapUv; 5045#endif 5046#ifdef USE_SPECULAR_COLORMAP 5047 varying vec2 vSpecularColorMapUv; 5048#endif 5049#ifdef USE_SPECULAR_INTENSITYMAP 5050 varying vec2 vSpecularIntensityMapUv; 5051#endif 5052#ifdef USE_TRANSMISSIONMAP 5053 uniform mat3 transmissionMapTransform; 5054 varying vec2 vTransmissionMapUv; 5055#endif 5056#ifdef USE_THICKNESSMAP 5057 uniform mat3 thicknessMapTransform; 5058 varying vec2 vThicknessMapUv; 5059#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 5060 varying vec2 vUv; 5061#endif 5062#ifdef USE_MAP 5063 uniform mat3 mapTransform; 5064 varying vec2 vMapUv; 5065#endif 5066#ifdef USE_ALPHAMAP 5067 uniform mat3 alphaMapTransform; 5068 varying vec2 vAlphaMapUv; 5069#endif 5070#ifdef USE_LIGHTMAP 5071 uniform mat3 lightMapTransform; 5072 varying vec2 vLightMapUv; 5073#endif 5074#ifdef USE_AOMAP 5075 uniform mat3 aoMapTransform; 5076 varying vec2 vAoMapUv; 5077#endif 5078#ifdef USE_BUMPMAP 5079 uniform mat3 bumpMapTransform; 5080 varying vec2 vBumpMapUv; 5081#endif 5082#ifdef USE_NORMALMAP 5083 uniform mat3 normalMapTransform; 5084 varying vec2 vNormalMapUv; 5085#endif 5086#ifdef USE_DISPLACEMENTMAP 5087 uniform mat3 displacementMapTransform; 5088 varying vec2 vDisplacementMapUv; 5089#endif 5090#ifdef USE_EMISSIVEMAP 5091 uniform mat3 emissiveMapTransform; 5092 varying vec2 vEmissiveMapUv; 5093#endif 5094#ifdef USE_METALNESSMAP 5095 uniform mat3 metalnessMapTransform; 5096 varying vec2 vMetalnessMapUv; 5097#endif 5098#ifdef USE_ROUGHNESSMAP 5099 uniform mat3 roughnessMapTransform; 5100 varying vec2 vRoughnessMapUv; 5101#endif 5102#ifdef USE_ANISOTROPYMAP 5103 uniform mat3 anisotropyMapTransform; 5104 varying vec2 vAnisotropyMapUv; 5105#endif 5106#ifdef USE_CLEARCOATMAP 5107 uniform mat3 clearcoatMapTransform; 5108 varying vec2 vClearcoatMapUv; 5109#endif 5110#ifdef USE_CLEARCOAT_NORMALMAP 5111 uniform mat3 clearcoatNormalMapTransform; 5112 varying vec2 vClearcoatNormalMapUv; 5113#endif 5114#ifdef USE_CLEARCOAT_ROUGHNESSMAP 5115 uniform mat3 clearcoatRoughnessMapTransform; 5116 varying vec2 vClearcoatRoughnessMapUv; 5117#endif 5118#ifdef USE_SHEEN_COLORMAP 5119 uniform mat3 sheenColorMapTransform; 5120 varying vec2 vSheenColorMapUv; 5121#endif 5122#ifdef USE_SHEEN_ROUGHNESSMAP 5123 uniform mat3 sheenRoughnessMapTransform; 5124 varying vec2 vSheenRoughnessMapUv; 5125#endif 5126#ifdef USE_IRIDESCENCEMAP 5127 uniform mat3 iridescenceMapTransform; 5128 varying vec2 vIridescenceMapUv; 5129#endif 5130#ifdef USE_IRIDESCENCE_THICKNESSMAP 5131 uniform mat3 iridescenceThicknessMapTransform; 5132 varying vec2 vIridescenceThicknessMapUv; 5133#endif 5134#ifdef USE_SPECULARMAP 5135 uniform mat3 specularMapTransform; 5136 varying vec2 vSpecularMapUv; 5137#endif 5138#ifdef USE_SPECULAR_COLORMAP 5139 uniform mat3 specularColorMapTransform; 5140 varying vec2 vSpecularColorMapUv; 5141#endif 5142#ifdef USE_SPECULAR_INTENSITYMAP 5143 uniform mat3 specularIntensityMapTransform; 5144 varying vec2 vSpecularIntensityMapUv; 5145#endif 5146#ifdef USE_TRANSMISSIONMAP 5147 uniform mat3 transmissionMapTransform; 5148 varying vec2 vTransmissionMapUv; 5149#endif 5150#ifdef USE_THICKNESSMAP 5151 uniform mat3 thicknessMapTransform; 5152 varying vec2 vThicknessMapUv; 5153#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 5154 vUv = vec3( uv, 1 ).xy; 5155#endif 5156#ifdef USE_MAP 5157 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 5158#endif 5159#ifdef USE_ALPHAMAP 5160 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 5161#endif 5162#ifdef USE_LIGHTMAP 5163 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 5164#endif 5165#ifdef USE_AOMAP 5166 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 5167#endif 5168#ifdef USE_BUMPMAP 5169 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 5170#endif 5171#ifdef USE_NORMALMAP 5172 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 5173#endif 5174#ifdef USE_DISPLACEMENTMAP 5175 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 5176#endif 5177#ifdef USE_EMISSIVEMAP 5178 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 5179#endif 5180#ifdef USE_METALNESSMAP 5181 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 5182#endif 5183#ifdef USE_ROUGHNESSMAP 5184 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 5185#endif 5186#ifdef USE_ANISOTROPYMAP 5187 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 5188#endif 5189#ifdef USE_CLEARCOATMAP 5190 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 5191#endif 5192#ifdef USE_CLEARCOAT_NORMALMAP 5193 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 5194#endif 5195#ifdef USE_CLEARCOAT_ROUGHNESSMAP 5196 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 5197#endif 5198#ifdef USE_IRIDESCENCEMAP 5199 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 5200#endif 5201#ifdef USE_IRIDESCENCE_THICKNESSMAP 5202 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 5203#endif 5204#ifdef USE_SHEEN_COLORMAP 5205 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 5206#endif 5207#ifdef USE_SHEEN_ROUGHNESSMAP 5208 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 5209#endif 5210#ifdef USE_SPECULARMAP 5211 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 5212#endif 5213#ifdef USE_SPECULAR_COLORMAP 5214 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 5215#endif 5216#ifdef USE_SPECULAR_INTENSITYMAP 5217 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 5218#endif 5219#ifdef USE_TRANSMISSIONMAP 5220 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 5221#endif 5222#ifdef USE_THICKNESSMAP 5223 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 5224#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 5225 vec4 worldPosition = vec4( transformed, 1.0 ); 5226 #ifdef USE_BATCHING 5227 worldPosition = batchingMatrix * worldPosition; 5228 #endif 5229 #ifdef USE_INSTANCING 5230 worldPosition = instanceMatrix * worldPosition; 5231 #endif 5232 worldPosition = modelMatrix * worldPosition; 5233#endif`,background_vert:`varying vec2 vUv; 5234uniform mat3 uvTransform; 5235void main() { 5236 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 5237 gl_Position = vec4( position.xy, 1.0, 1.0 ); 5238}`,background_frag:`uniform sampler2D t2D; 5239uniform float backgroundIntensity; 5240varying vec2 vUv; 5241void main() { 5242 vec4 texColor = texture2D( t2D, vUv ); 5243 #ifdef DECODE_VIDEO_TEXTURE 5244 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 5245 #endif 5246 texColor.rgb *= backgroundIntensity; 5247 gl_FragColor = texColor; 5248 #include <tonemapping_fragment> 5249 #include <colorspace_fragment> 5250}`,backgroundCube_vert:`varying vec3 vWorldDirection; 5251#include <common> 5252void main() { 5253 vWorldDirection = transformDirection( position, modelMatrix ); 5254 #include <begin_vertex> 5255 #include <project_vertex> 5256 gl_Position.z = gl_Position.w; 5257}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE 5258 uniform samplerCube envMap; 5259#elif defined( ENVMAP_TYPE_CUBE_UV ) 5260 uniform sampler2D envMap; 5261#endif 5262uniform float
5262backgroundBlurriness; 5263uniform float backgroundIntensity; 5264uniform mat3 backgroundRotation; 5265varying vec3 vWorldDirection; 5266#include <cube_uv_reflection_fragment> 5267void main() { 5268 #ifdef ENVMAP_TYPE_CUBE 5269 vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection ); 5270 #elif defined( ENVMAP_TYPE_CUBE_UV ) 5271 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 5272 #else 5273 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 5274 #endif 5275 texColor.rgb *= backgroundIntensity; 5276 gl_FragColor = texColor; 5277 #include <tonemapping_fragment> 5278 #include <colorspace_fragment> 5279}`,cube_vert:`varying vec3 vWorldDirection; 5280#include <common> 5281void main() { 5282 vWorldDirection = transformDirection( position, modelMatrix ); 5283 #include <begin_vertex> 5284 #include <project_vertex> 5285 gl_Position.z = gl_Position.w; 5286}`,cube_frag:`uniform samplerCube tCube; 5287uniform float tFlip; 5288uniform float opacity; 5289varying vec3 vWorldDirection; 5290void main() { 5291 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 5292 gl_FragColor = texColor; 5293 gl_FragColor.a *= opacity; 5294 #include <tonemapping_fragment> 5295 #include <colorspace_fragment> 5296}`,depth_vert:`#include <common> 5297#include <batching_pars_vertex> 5298#include <uv_pars_vertex> 5299#include <displacementmap_pars_vertex> 5300#include <morphtarget_pars_vertex> 5301#include <skinning_pars_vertex> 5302#include <logdepthbuf_pars_vertex> 5303#include <clipping_planes_pars_vertex> 5304varying vec2 vHighPrecisionZW; 5305void main() { 5306 #include <uv_vertex> 5307 #include <batching_vertex> 5308 #include <skinbase_vertex> 5309 #include <morphinstance_vertex> 5310 #ifdef USE_DISPLACEMENTMAP 5311 #include <beginnormal_vertex> 5312 #include <morphnormal_vertex> 5313 #include <skinnormal_vertex> 5314 #endif 5315 #include <begin_vertex> 5316 #include <morphtarget_vertex> 5317 #include <skinning_vertex> 5318 #include <displacementmap_vertex> 5319 #include <project_vertex> 5320 #include <logdepthbuf_vertex> 5321 #include <clipping_planes_vertex> 5322 vHighPrecisionZW = gl_Position.zw; 5323}`,depth_frag:`#if DEPTH_PACKING == 3200 5324 uniform float opacity; 5325#endif 5326#include <common> 5327#include <packing> 5328#include <uv_pars_fragment> 5329#include <map_pars_fragment> 5330#include <alphamap_pars_fragment> 5331#include <alphatest_pars_fragment> 5332#include <alphahash_pars_fragment> 5333#include <logdepthbuf_pars_fragment> 5334#include <clipping_planes_pars_fragment> 5335varying vec2 vHighPrecisionZW; 5336void main() { 5337 vec4 diffuseColor = vec4( 1.0 ); 5338 #include <clipping_planes_fragment> 5339 #if DEPTH_PACKING == 3200 5340 diffuseColor.a = opacity; 5341 #endif 5342 #include <map_fragment> 5343 #include <alphamap_fragment> 5344 #include <alphatest_fragment> 5345 #include <alphahash_fragment> 5346 #include <logdepthbuf_fragment> 5347 #ifdef USE_REVERSED_DEPTH_BUFFER 5348 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 5349 #else 5350 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 5351 #endif 5352 #if DEPTH_PACKING == 3200 5353 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 5354 #elif DEPTH_PACKING == 3201 5355 gl_FragColor = packDepthToRGBA( fragCoordZ ); 5356 #elif DEPTH_PACKING == 3202 5357 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 5358 #elif DEPTH_PACKING == 3203 5359 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 5360 #endif 5361}`,distance_vert:`#define DISTANCE 5362varying vec3 vWorldPosition; 5363#include <common> 5364#include <batching_pars_vertex> 5365#include <uv_pars_vertex> 5366#include <displacementmap_pars_vertex> 5367#include <morphtarget_pars_vertex> 5368#include <skinning_pars_vertex> 5369#include <clipping_planes_pars_vertex> 5370void main() { 5371 #include <uv_vertex> 5372 #include <batching_vertex> 5373 #include <skinbase_vertex> 5374 #include <morphinstance_vertex> 5375 #ifdef USE_DISPLACEMENTMAP 5376 #include <beginnormal_vertex> 5377 #include <morphnormal_vertex> 5378 #include <skinnormal_vertex> 5379 #endif 5380 #include <begin_vertex> 5381 #include <morphtarget_vertex> 5382 #include <skinning_vertex> 5383 #include <displacementmap_vertex> 5384 #include <project_vertex> 5385 #include <worldpos_vertex> 5386 #include <clipping_planes_vertex> 5387 vWorldPosition = worldPosition.xyz; 5388}`,distance_frag:`#define DISTANCE 5389uniform vec3 referencePosition; 5390uniform float nearDistance; 5391uniform float farDistance; 5392varying vec3 vWorldPosition; 5393#include <common> 5394#include <uv_pars_fragment> 5395#include <map_pars_fragment> 5396#include <alphamap_pars_fragment> 5397#include <alphatest_pars_fragment> 5398#include <alphahash_pars_fragment> 5399#include <clipping_planes_pars_fragment> 5400void main() { 5401 vec4 diffuseColor = vec4( 1.0 ); 5402 #include <clipping_planes_fragment> 5403 #include <map_fragment> 5404 #include <alphamap_fragment> 5405 #include <alphatest_fragment> 5406 #include <alphahash_fragment> 5407 float dist = length( vWorldPosition - referencePosition ); 5408 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 5409 dist = saturate( dist ); 5410 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); 5411}`,equirect_vert:`varying vec3 vWorldDirection; 5412#include <common> 5413void main() { 5414 vWorldDirection = transformDirection( position, modelMatrix ); 5415 #include <begin_vertex> 5416 #include <project_vertex> 5417}`,equirect_frag:`uniform sampler2D tEquirect; 5418varying vec3 vWorldDirection; 5419#include <common> 5420void main() { 5421 vec3 direction = normalize( vWorldDirection ); 5422 vec2 sampleUV = equirectUv( direction ); 5423 gl_FragColor = texture2D( tEquirect, sampleUV ); 5424 #include <tonemapping_fragment> 5425 #include <colorspace_fragment> 5426}`,linedashed_vert:`uniform float scale; 5427attribute float lineDistance; 5428varying float vLineDistance; 5429#include <common> 5430#include <uv_pars_vertex> 5431#include <color_pars_vertex> 5432#include <fog_pars_vertex> 5433#include <morphtarget_pars_vertex> 5434#include <logdepthbuf_pars_vertex> 5435#include <clipping_planes_pars_vertex> 5436void main() { 5437 vLineDistance = scale * lineDistance; 5438 #include <uv_vertex> 5439 #include <color_vertex> 5440 #include <morphinstance_vertex> 5441 #include <morphcolor_vertex> 5442 #include <begin_vertex> 5443 #include <morphtarget_vertex> 5444 #include <project_vertex> 5445 #include <logdepthbuf_vertex> 5446 #include <clipping_planes_vertex> 5447 #include <fog_vertex> 5448}`,linedashed_frag:`uniform vec3 diffuse; 5449uniform float opacity; 5450uniform float dashSize; 5451uniform float totalSize; 5452varying float vLineDistance; 5453#include <common> 5454#include <color_pars_fragment> 5455#include <uv_pars_fragment> 5456#include <map_pars_fragment> 5457#include <fog_pars_fragment> 5458#include <logdepthbuf_pars_fragment> 5459#include <clipping_planes_pars_fragment> 5460void main() { 5461 vec4 diffuseColor = vec4( diffuse, opacity ); 5462 #include <clipping_planes_fragment> 5463 if ( mod( vLineDistance, totalSize ) > dashSize ) { 5464 discard; 5465 } 5466 vec3 outgoingLight = vec3( 0.0 ); 5467 #include <logdepthbuf_fragment> 5468 #include <map_fragment> 5469 #include <color_fragment> 5470 outgoingLight = diffuseColor.rgb; 5471 #include <opaque_fragment> 5472 #include <tonemapping_fragment> 5473 #include <colorspace_fragment> 5474 #include <fog_fragment> 5475 #include <premultiplied_alpha_fragment> 5476}`,meshbasic_vert:`#include <common> 5477#include <batching_pars_vertex> 5478#include <uv_pars_vertex> 5479#include <envmap_pars_vertex> 5480#include <color_pars_vertex> 5481#include <fog_pars_vertex> 5482#include <morphtarget_pars_vertex> 5483#include <skinning_pars_vertex> 5484#include <logdepthbuf_pars_vertex> 5485#include <clipping_planes_pars_vertex> 5486void main() { 5487 #include <uv_vertex> 5488 #include <color_vertex> 5489 #include <morphinstance_vertex> 5490 #include <morphcolor_vertex> 5491 #include <batching_vertex> 5492 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 5493 #include <beginnormal_vertex> 5494 #include <morphnormal_vertex> 5495 #include <skinbase_vertex> 5496 #include <skinnormal_vertex> 5497 #include <defaultnormal_vertex> 5498 #endif 5499 #include <begin_vertex> 5500 #include <morphtarget_vertex> 5501 #include <skinning_vertex> 5502 #include <project_vertex> 5503 #include <logdepthbuf_vertex> 5504 #include <clipping_planes_vertex> 5505 #include <worldpos_vertex> 5506 #include <envmap_vertex> 5507 #include <fog_vertex> 5508}`,meshbasic_frag:`uniform vec3 diffuse; 5509uniform float opacity; 5510#ifndef FLAT_SHADED 5511 varying vec3 vNormal; 5512#endif 5513#include <common> 5514#include <dithering_pars_fragment> 5515#include <color_pars_fragment> 5516#include <uv_pars_fragment> 5517#include <map_pars_fragment> 5518#include <alphamap_pars_fragment> 5519#include <alphatest_pars_fragment> 5520#include <alphahash_pars_fragment> 5521#include <aomap_pars_fragment> 5522#include <lightmap_pars_fragment> 5523#include <envmap_common_pars_fragment> 5524#include <envmap_pars_fragment> 5525#include <fog_pars_fragment> 5526#include <specularmap_pars_fragment> 5527#include <logdepthbuf_pars_fragment> 5528#include <clipping_planes_pars_fragment> 5529void main() { 5530 vec4 diffuseColor = vec4( diffuse, opacity ); 5531 #include <clipping_planes_fragment> 5532 #include <logdepthbuf_fragment> 5533 #include <map_fragment> 5534 #include <color_fragment> 5535 #include <alphamap_fragment> 5536 #include <alphatest_fragment> 5537 #include <alphahash_fragment> 5538 #include <specularmap_fragment> 5539 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 5540 #ifdef USE_LIGHTMAP 5541 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 5542 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 5543 #else 5544 reflectedLight.indirectDiffuse += vec3( 1.0 ); 5545 #endif 5546 #include <aomap_fragment> 5547 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 5548 vec3 outgoingLight = reflectedLight.indirectDiffuse; 5549 #include <envmap_fragment> 5550 #include <opaque_fragment> 5551 #include <tonemapping_fragment> 5552 #include <colorspace_fragment> 5553 #include <fog_fragment> 5554 #include <premultiplied_alpha_fragment> 5555 #include <dithering_fragment> 5556}`,meshlambert_vert:`#define LAMBERT 5557varying vec3 vViewPosition; 5558#include <common> 5559#include <batching_pars_vertex> 5560#include <uv_pars_vertex> 5561#include <displacementmap_pars_vertex> 5562#include <envmap_pars_vertex> 5563#include <color_pars_vertex> 5564#include <fog_pars_vertex> 5565#include <normal_pars_vertex> 5566#include <morphtarget_pars_vertex> 5567#include <skinning_pars_vertex> 5568#include <shadowmap_pars_vertex> 5569#include <logdepthbuf_pars_vertex> 5570#include <clipping_planes_pars_vertex> 5571void main() { 5572 #include <uv_vertex> 5573 #include <color_vertex> 5574 #include <morphinstance_vertex> 5575 #include <morphcolor_vertex> 5576 #include <batching_vertex> 5577 #include <beginnormal_vertex> 5578 #include <morphnormal_vertex> 5579 #include <skinbase_vertex> 5580 #include <skinnormal_vertex> 5581 #include <defaultnormal_vertex> 5582 #include <normal_vertex> 5583 #include <begin_vertex> 5584 #include <morphtarget_vertex> 5585 #include <skinning_vertex> 5586 #include <displacementmap_vertex> 5587 #include <project_vertex> 5588 #include <logdepthbuf_vertex> 5589 #include <clipping_planes_vertex> 5590 vViewPosition = - mvPosition.xyz; 5591 #include <worldpos_vertex> 5592 #include <envmap_vertex> 5593 #include <shadowmap_vertex> 5594 #include <fog_vertex> 5595}`,meshlambert_frag:`#define LAMBERT 5596uniform vec3 diffuse; 5597uniform vec3 emissive; 5598uniform float opacity; 5599#include <common> 5600#include <dithering_pars_fragment> 5601#include <color_pars_fragment> 5602#include <uv_pars_fragment> 5603#include <map_pars_fragment> 5604#include <alphamap_pars_fragment> 5605#include <alphatest_pars_fragment> 5606#include <alphahash_pars_fragment> 5607#include <aomap_pars_fragment> 5608#include <lightmap_pars_fragment> 5609#include <emissivemap_pars_fragment> 5610#include <cube_uv_reflection_fragment> 5611#include <envmap_common_pars_fragment> 5612#include <envmap_pars_fragment> 5613#include <envmap_physical_pars_fragment> 5614#include <fog_pars_fragment> 5615#include <bsdfs> 5616#include <lights_pars_begin> 5617#include <normal_pars_fragment> 5618#include <lights_lambert_pars_fragment> 5619#include <shadowmap_pars_fragment> 5620#include <bumpmap_pars_fragment> 5621#include <normalmap_pars_fragment> 5622#include <specularmap_pars_fragment> 5623#include <logdepthbuf_pars_fragment> 5624#include <clipping_planes_pars_fragment> 5625void main() { 5626 vec4 diffuseColor = vec4( diffuse, opacity ); 5627 #include <clipping_planes_fragment> 5628 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 5629 vec3 totalEmissiveRadiance = emissive; 5630 #include <logdepthbuf_fragment> 5631 #include <map_fragment> 5632 #include <color_fragment> 5633 #include <alphamap_fragment> 5634 #include <alphatest_fragment> 5635 #include <alphahash_fragment> 5636 #include <specularmap_fragment> 5637 #include <normal_fragment_begin> 5638 #include <normal_fragment_maps> 5639 #include <emissivemap_fragment> 5640 #include <lights_lambert_fragment> 5641 #include <lights_fragment_begin> 5642 #include <lights_fragment_maps> 5643 #include <lights_fragment_end> 5644 #include <aomap_fragment> 5645 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 5646 #include <envmap_fragment> 5647 #include <opaque_fragment> 5648 #include <tonemapping_fragment> 5649 #include <colorspace_fragment> 5650 #include <fog_fragment> 5651 #include <premultiplied_alpha_fragment> 5652 #include <dithering_fragment> 5653}`,meshmatcap_vert:`#define MATCAP 5654varying vec3 vViewPosition; 5655#include <common> 5656#include <batching_pars_vertex> 5657#include <uv_pars_vertex> 5658#include <color_pars_vertex> 5659#include <displacementmap_pars_vertex> 5660#include <fog_pars_vertex> 5661#include <normal_pars_vertex> 5662#include <morphtarget_pars_vertex> 5663#include <skinning_pars_vertex> 5664#include <logdepthbuf_pars_vertex> 5665#include <clipping_planes_pars_vertex> 5666void main() { 5667 #include <uv_vertex> 5668 #include <color_vertex> 5669 #include <morphinstance_vertex> 5670 #include <morphcolor_vertex> 5671 #include <batching_vertex> 5672 #include <beginnormal_vertex> 5673 #include <morphnormal_vertex> 5674 #include <skinbase_vertex> 5675 #include <skinnormal_vertex> 5676 #include <defaultnormal_vertex> 5677 #include <normal_vertex> 5678 #include <begin_vertex> 5679 #include <morphtarget_vertex> 5680 #include <skinning_vertex> 5681 #include <displacementmap_vertex> 5682 #include <project_vertex> 5683 #include <logdepthbuf_vertex> 5684 #include <clipping_planes_vertex> 5685 #include <fog_vertex> 5686 vViewPosition = - mvPosition.xyz; 5687}`,meshmatcap_frag:`#define MATCAP 5688uniform vec3 diffuse; 5689uniform float opacity; 5690uniform sampler2D matcap; 5691varying vec3 vViewPosition; 5692#include <common> 5693#include <dithering_pars_fragment> 5694#include <color_pars_fragment> 5695#include <uv_pars_fragment> 5696#include <map_pars_fragment> 5697#include <alphamap_pars_fragment> 5698#include <alphatest_pars_fragment> 5699#include <alphahash_pars_fragment> 5700#include <fog_pars_fragment> 5701#include <normal_pars_fragment> 5702#include <bumpmap_pars_fragment> 5703#include <normalmap_pars_fragment> 5704#include <logdepthbuf_pars_fragment> 5705#include <clipping_planes_pars_fragment> 5706void main() { 5707 vec4 diffuseColor = vec4( diffuse, opacity ); 5708 #include <clipping_planes_fragment> 5709 #include <logdepthbuf_fragment> 5710 #include <map_fragment> 5711 #include <color_fragment> 5712 #include <alphamap_fragment> 5713 #include <alphatest_fragment> 5714 #include <alphahash_fragment> 5715 #include <normal_fragment_begin> 5716 #include <normal_fragment_maps> 5717 vec3 viewDir = normalize( vViewPosition ); 5718 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 5719 vec3 y = cross( viewDir, x ); 5720 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 5721 #ifdef USE_MATCAP
5722 vec4 matcapColor = texture2D( matcap, uv ); 5723 #else 5724 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 5725 #endif 5726 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 5727 #include <opaque_fragment> 5728 #include <tonemapping_fragment> 5729 #include <colorspace_fragment> 5730 #include <fog_fragment> 5731 #include <premultiplied_alpha_fragment> 5732 #include <dithering_fragment> 5733}`,meshnormal_vert:`#define NORMAL 5734#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 5735 varying vec3 vViewPosition; 5736#endif 5737#include <common> 5738#include <batching_pars_vertex> 5739#include <uv_pars_vertex> 5740#include <displacementmap_pars_vertex> 5741#include <normal_pars_vertex> 5742#include <morphtarget_pars_vertex> 5743#include <skinning_pars_vertex> 5744#include <logdepthbuf_pars_vertex> 5745#include <clipping_planes_pars_vertex> 5746void main() { 5747 #include <uv_vertex> 5748 #include <batching_vertex> 5749 #include <beginnormal_vertex> 5750 #include <morphinstance_vertex> 5751 #include <morphnormal_vertex> 5752 #include <skinbase_vertex> 5753 #include <skinnormal_vertex> 5754 #include <defaultnormal_vertex> 5755 #include <normal_vertex> 5756 #include <begin_vertex> 5757 #include <morphtarget_vertex> 5758 #include <skinning_vertex> 5759 #include <displacementmap_vertex> 5760 #include <project_vertex> 5761 #include <logdepthbuf_vertex> 5762 #include <clipping_planes_vertex> 5763#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 5764 vViewPosition = - mvPosition.xyz; 5765#endif 5766}`,meshnormal_frag:`#define NORMAL 5767uniform float opacity; 5768#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 5769 varying vec3 vViewPosition; 5770#endif 5771#include <uv_pars_fragment> 5772#include <normal_pars_fragment> 5773#include <bumpmap_pars_fragment> 5774#include <normalmap_pars_fragment> 5775#include <logdepthbuf_pars_fragment> 5776#include <clipping_planes_pars_fragment> 5777void main() { 5778 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 5779 #include <clipping_planes_fragment> 5780 #include <logdepthbuf_fragment> 5781 #include <normal_fragment_begin> 5782 #include <normal_fragment_maps> 5783 gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); 5784 #ifdef OPAQUE 5785 gl_FragColor.a = 1.0; 5786 #endif 5787}`,meshphong_vert:`#define PHONG 5788varying vec3 vViewPosition; 5789#include <common> 5790#include <batching_pars_vertex> 5791#include <uv_pars_vertex> 5792#include <displacementmap_pars_vertex> 5793#include <envmap_pars_vertex> 5794#include <color_pars_vertex> 5795#include <fog_pars_vertex> 5796#include <normal_pars_vertex> 5797#include <morphtarget_pars_vertex> 5798#include <skinning_pars_vertex> 5799#include <shadowmap_pars_vertex> 5800#include <logdepthbuf_pars_vertex> 5801#include <clipping_planes_pars_vertex> 5802void main() { 5803 #include <uv_vertex> 5804 #include <color_vertex> 5805 #include <morphcolor_vertex> 5806 #include <batching_vertex> 5807 #include <beginnormal_vertex> 5808 #include <morphinstance_vertex> 5809 #include <morphnormal_vertex> 5810 #include <skinbase_vertex> 5811 #include <skinnormal_vertex> 5812 #include <defaultnormal_vertex> 5813 #include <normal_vertex> 5814 #include <begin_vertex> 5815 #include <morphtarget_vertex> 5816 #include <skinning_vertex> 5817 #include <displacementmap_vertex> 5818 #include <project_vertex> 5819 #include <logdepthbuf_vertex> 5820 #include <clipping_planes_vertex> 5821 vViewPosition = - mvPosition.xyz; 5822 #include <worldpos_vertex> 5823 #include <envmap_vertex> 5824 #include <shadowmap_vertex> 5825 #include <fog_vertex> 5826}`,meshphong_frag:`#define PHONG 5827uniform vec3 diffuse; 5828uniform vec3 emissive; 5829uniform vec3 specular; 5830uniform float shininess; 5831uniform float opacity; 5832#include <common> 5833#include <dithering_pars_fragment> 5834#include <color_pars_fragment> 5835#include <uv_pars_fragment> 5836#include <map_pars_fragment> 5837#include <alphamap_pars_fragment> 5838#include <alphatest_pars_fragment> 5839#include <alphahash_pars_fragment> 5840#include <aomap_pars_fragment> 5841#include <lightmap_pars_fragment> 5842#include <emissivemap_pars_fragment> 5843#include <cube_uv_reflection_fragment> 5844#include <envmap_common_pars_fragment> 5845#include <envmap_pars_fragment> 5846#include <envmap_physical_pars_fragment> 5847#include <fog_pars_fragment> 5848#include <bsdfs> 5849#include <lights_pars_begin> 5850#include <normal_pars_fragment> 5851#include <lights_phong_pars_fragment> 5852#include <shadowmap_pars_fragment> 5853#include <bumpmap_pars_fragment> 5854#include <normalmap_pars_fragment> 5855#include <specularmap_pars_fragment> 5856#include <logdepthbuf_pars_fragment> 5857#include <clipping_planes_pars_fragment> 5858void main() { 5859 vec4 diffuseColor = vec4( diffuse, opacity ); 5860 #include <clipping_planes_fragment> 5861 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 5862 vec3 totalEmissiveRadiance = emissive; 5863 #include <logdepthbuf_fragment> 5864 #include <map_fragment> 5865 #include <color_fragment> 5866 #include <alphamap_fragment> 5867 #include <alphatest_fragment> 5868 #include <alphahash_fragment> 5869 #include <specularmap_fragment> 5870 #include <normal_fragment_begin> 5871 #include <normal_fragment_maps> 5872 #include <emissivemap_fragment> 5873 #include <lights_phong_fragment> 5874 #include <lights_fragment_begin> 5875 #include <lights_fragment_maps> 5876 #include <lights_fragment_end> 5877 #include <aomap_fragment> 5878 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 5879 #include <envmap_fragment> 5880 #include <opaque_fragment> 5881 #include <tonemapping_fragment> 5882 #include <colorspace_fragment> 5883 #include <fog_fragment> 5884 #include <premultiplied_alpha_fragment> 5885 #include <dithering_fragment> 5886}`,meshphysical_vert:`#define STANDARD 5887varying vec3 vViewPosition; 5888#ifdef USE_TRANSMISSION 5889 varying vec3 vWorldPosition; 5890#endif 5891#include <common> 5892#include <batching_pars_vertex> 5893#include <uv_pars_vertex> 5894#include <displacementmap_pars_vertex> 5895#include <color_pars_vertex> 5896#include <fog_pars_vertex> 5897#include <normal_pars_vertex> 5898#include <morphtarget_pars_vertex> 5899#include <skinning_pars_vertex> 5900#include <shadowmap_pars_vertex> 5901#include <logdepthbuf_pars_vertex> 5902#include <clipping_planes_pars_vertex> 5903void main() { 5904 #include <uv_vertex> 5905 #include <color_vertex> 5906 #include <morphinstance_vertex> 5907 #include <morphcolor_vertex> 5908 #include <batching_vertex> 5909 #include <beginnormal_vertex> 5910 #include <morphnormal_vertex> 5911 #include <skinbase_vertex> 5912 #include <skinnormal_vertex> 5913 #include <defaultnormal_vertex> 5914 #include <normal_vertex> 5915 #include <begin_vertex> 5916 #include <morphtarget_vertex> 5917 #include <skinning_vertex> 5918 #include <displacementmap_vertex> 5919 #include <project_vertex> 5920 #include <logdepthbuf_vertex> 5921 #include <clipping_planes_vertex> 5922 vViewPosition = - mvPosition.xyz; 5923 #include <worldpos_vertex> 5924 #include <shadowmap_vertex> 5925 #include <fog_vertex> 5926#ifdef USE_TRANSMISSION 5927 vWorldPosition = worldPosition.xyz; 5928#endif 5929}`,meshphysical_frag:`#define STANDARD 5930#ifdef PHYSICAL 5931 #define IOR 5932 #define USE_SPECULAR 5933#endif 5934uniform vec3 diffuse; 5935uniform vec3 emissive; 5936uniform float roughness; 5937uniform float metalness; 5938uniform float opacity; 5939#ifdef IOR 5940 uniform float ior; 5941#endif 5942#ifdef USE_SPECULAR 5943 uniform float specularIntensity; 5944 uniform vec3 specularColor; 5945 #ifdef USE_SPECULAR_COLORMAP 5946 uniform sampler2D specularColorMap; 5947 #endif 5948 #ifdef USE_SPECULAR_INTENSITYMAP 5949 uniform sampler2D specularIntensityMap; 5950 #endif 5951#endif 5952#ifdef USE_CLEARCOAT 5953 uniform float clearcoat; 5954 uniform float clearcoatRoughness; 5955#endif 5956#ifdef USE_DISPERSION 5957 uniform float dispersion; 5958#endif
5959#ifdef USE_IRIDESCENCE 5960 uniform float iridescence; 5961 uniform float iridescenceIOR; 5962 uniform float iridescenceThicknessMinimum; 5963 uniform float iridescenceThicknessMaximum; 5964#endif 5965#ifdef USE_SHEEN 5966 uniform vec3 sheenColor; 5967 uniform float sheenRoughness; 5968 #ifdef USE_SHEEN_COLORMAP 5969 uniform sampler2D sheenColorMap; 5970 #endif 5971 #ifdef USE_SHEEN_ROUGHNESSMAP 5972 uniform sampler2D sheenRoughnessMap; 5973 #endif 5974#endif 5975#ifdef USE_ANISOTROPY 5976 uniform vec2 anisotropyVector; 5977 #ifdef USE_ANISOTROPYMAP 5978 uniform sampler2D anisotropyMap; 5979 #endif 5980#endif 5981varying vec3 vViewPosition; 5982#include <common> 5983#include <dithering_pars_fragment> 5984#include <color_pars_fragment> 5985#include <uv_pars_fragment> 5986#include <map_pars_fragment> 5987#include <alphamap_pars_fragment> 5988#include <alphatest_pars_fragment> 5989#include <alphahash_pars_fragment> 5990#include <aomap_pars_fragment> 5991#include <lightmap_pars_fragment> 5992#include <emissivemap_pars_fragment> 5993#include <iridescence_fragment> 5994#include <cube_uv_reflection_fragment> 5995#include <envmap_common_pars_fragment> 5996#include <envmap_physical_pars_fragment> 5997#include <fog_pars_fragment> 5998#include <lights_pars_begin> 5999#include <normal_pars_fragment> 6000#include <lights_physical_pars_fragment> 6001#include <transmission_pars_fragment> 6002#include <shadowmap_pars_fragment> 6003#include <bumpmap_pars_fragment> 6004#include <normalmap_pars_fragment> 6005#include <clearcoat_pars_fragment> 6006#include <iridescence_pars_fragment> 6007#include <roughnessmap_pars_fragment> 6008#include <metalnessmap_pars_fragment> 6009#include <logdepthbuf_pars_fragment> 6010#include <clipping_planes_pars_fragment> 6011void main() { 6012 vec4 diffuseColor = vec4( diffuse, opacity ); 6013 #include <clipping_planes_fragment> 6014 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 6015 vec3 totalEmissiveRadiance = emissive; 6016 #include <logdepthbuf_fragment> 6017 #include <map_fragment> 6018 #include <color_fragment> 6019 #include <alphamap_fragment> 6020 #include <alphatest_fragment> 6021 #include <alphahash_fragment> 6022 #include <roughnessmap_fragment> 6023 #include <metalnessmap_fragment> 6024 #include <normal_fragment_begin> 6025 #include <normal_fragment_maps> 6026 #include <clearcoat_normal_fragment_begin> 6027 #include <clearcoat_normal_fragment_maps> 6028 #include <emissivemap_fragment> 6029 #include <lights_physical_fragment> 6030 #include <lights_fragment_begin> 6031 #include <lights_fragment_maps> 6032 #include <lights_fragment_end> 6033 #include <aomap_fragment> 6034 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 6035 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 6036 #include <transmission_fragment> 6037 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 6038 #ifdef USE_SHEEN 6039 6040 outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; 6041 6042 #endif 6043 #ifdef USE_CLEARCOAT 6044 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 6045 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 6046 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 6047 #endif 6048 #include <opaque_fragment> 6049 #include <tonemapping_fragment> 6050 #include <colorspace_fragment> 6051 #include <fog_fragment> 6052 #include <premultiplied_alpha_fragment> 6053 #include <dithering_fragment> 6054}`,meshtoon_vert:`#define TOON 6055varying vec3 vViewPosition; 6056#include <common> 6057#include <batching_pars_vertex> 6058#include <uv_pars_vertex> 6059#include <displacementmap_pars_vertex> 6060#include <color_pars_vertex> 6061#include <fog_pars_vertex> 6062#include <normal_pars_vertex> 6063#include <morphtarget_pars_vertex> 6064#include <skinning_pars_vertex> 6065#include <shadowmap_pars_vertex> 6066#include <logdepthbuf_pars_vertex> 6067#include <clipping_planes_pars_vertex> 6068void main() { 6069 #include <uv_vertex> 6070 #include <color_vertex> 6071 #include <morphinstance_vertex> 6072 #include <morphcolor_vertex> 6073 #include <batching_vertex> 6074 #include <beginnormal_vertex> 6075 #include <morphnormal_vertex> 6076 #include <skinbase_vertex> 6077 #include <skinnormal_vertex> 6078 #include <defaultnormal_vertex> 6079 #include <normal_vertex> 6080 #include <begin_vertex> 6081 #include <morphtarget_vertex> 6082 #include <skinning_vertex> 6083 #include <displacementmap_vertex> 6084 #include <project_vertex> 6085 #include <logdepthbuf_vertex> 6086 #include <clipping_planes_vertex> 6087 vViewPosition = - mvPosition.xyz; 6088 #include <worldpos_vertex> 6089 #include <shadowmap_vertex> 6090 #include <fog_vertex> 6091}`,meshtoon_frag:`#define TOON 6092uniform vec3 diffuse; 6093uniform vec3 emissive; 6094uniform float opacity; 6095#include <common> 6096#include <dithering_pars_fragment> 6097#include <color_pars_fragment> 6098#include <uv_pars_fragment> 6099#include <map_pars_fragment> 6100#include <alphamap_pars_fragment> 6101#include <alphatest_pars_fragment> 6102#include <alphahash_pars_fragment> 6103#include <aomap_pars_fragment> 6104#include <lightmap_pars_fragment> 6105#include <emissivemap_pars_fragment> 6106#include <gradientmap_pars_fragment> 6107#include <fog_pars_fragment> 6108#include <bsdfs> 6109#include <lights_pars_begin> 6110#include <normal_pars_fragment> 6111#include <lights_toon_pars_fragment> 6112#include <shadowmap_pars_fragment> 6113#include <bumpmap_pars_fragment> 6114#include <normalmap_pars_fragment> 6115#include <logdepthbuf_pars_fragment> 6116#include <clipping_planes_pars_fragment> 6117void main() { 6118 vec4 diffuseColor = vec4( diffuse, opacity ); 6119 #include <clipping_planes_fragment> 6120 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 6121 vec3 totalEmissiveRadiance = emissive; 6122 #include <logdepthbuf_fragment> 6123 #include <map_fragment> 6124 #include <color_fragment> 6125 #include <alphamap_fragment> 6126 #include <alphatest_fragment> 6127 #include <alphahash_fragment> 6128 #include <normal_fragment_begin> 6129 #include <normal_fragment_maps> 6130 #include <emissivemap_fragment> 6131 #include <lights_toon_fragment> 6132 #include <lights_fragment_begin> 6133 #include <lights_fragment_maps> 6134 #include <lights_fragment_end> 6135 #include <aomap_fragment> 6136 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 6137 #include <opaque_fragment> 6138 #include <tonemapping_fragment> 6139 #include <colorspace_fragment> 6140 #include <fog_fragment> 6141 #include <premultiplied_alpha_fragment> 6142 #include <dithering_fragment> 6143}`,points_vert:`uniform float size; 6144uniform float scale; 6145#include <common> 6146#include <color_pars_vertex> 6147#include <fog_pars_vertex> 6148#include <morphtarget_pars_vertex> 6149#include <logdepthbuf_pars_vertex> 6150#include <clipping_planes_pars_vertex> 6151#ifdef USE_POINTS_UV 6152 varying vec2 vUv; 6153 uniform mat3 uvTransform; 6154#endif 6155void main() { 6156 #ifdef USE_POINTS_UV 6157 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 6158 #endif 6159 #include <color_vertex> 6160 #include <morphinstance_vertex> 6161 #include <morphcolor_vertex> 6162 #include <begin_vertex> 6163 #include <morphtarget_vertex> 6164 #include <project_vertex> 6165 gl_PointSize = size; 6166 #ifdef USE_SIZEATTENUATION 6167 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 6168 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 6169 #endif 6170 #include <logdepthbuf_vertex> 6171 #include <clipping_planes_vertex> 6172 #include <worldpos_vertex> 6173 #include <fog_vertex> 6174}`,points_frag:`uniform vec3 diffuse; 6175uniform float opacity; 6176#include <common> 6177#include <color_pars_fragment> 6178#include <map_particle_pars_fragment> 6179#include <alphatest_pars_fragment> 6180#include <alphahash_pars_fragment> 6181#include <fog_pars_fragment> 6182#include <logdepthbuf_pars_fragment> 6183#include <clipping_planes_pars_fragment> 6184void main() { 6185 vec4 diffuseColor = vec4( diffuse, opacity ); 6186 #include <clipping_planes_fragment> 6187 vec3 outgoingLight = vec3( 0.0 ); 6188 #include <logdepthbuf_fragment> 6189 #include <map_particle_fragment> 6190 #include <color_fragment> 6191 #include <alphatest_fragment> 6192 #include <alphahash_fragment> 6193 outgoingLight = diffuseColor.rgb; 6194 #include <opaque_fragment> 6195 #include <tonemapping_fragment> 6196 #include <colorspace_fragment> 6197 #include <fog_fragment> 6198 #include <premultiplied_alpha_fragment> 6199}`,shadow_vert:`#include <common> 6200#include <batching_pars_vertex> 6201#include <fog_pars_vertex> 6202#include <morphtarget_pars_vertex> 6203#include <skinning_pars_vertex> 6204#include <logdepthbuf_pars_vertex> 6205#include <shadowmap_pars_vertex> 6206void main() { 6207 #include <batching_vertex> 6208 #include <beginnormal_vertex> 6209 #include <morphinstance_vertex> 6210 #include <morphnormal_vertex> 6211 #include <skinbase_vertex> 6212 #include <skinnormal_vertex> 6213 #include <defaultnormal_vertex> 6214 #include <begin_vertex> 6215 #include <morphtarget_vertex> 6216 #include <skinning_vertex> 6217 #include <project_vertex> 6218 #include <logdepthbuf_vertex> 6219 #include <worldpos_vertex> 6220 #include <shadowmap_vertex> 6221 #include <fog_vertex> 6222}`,shadow_frag:`uniform vec3 color; 6223uniform float opacity; 6224#include <common> 6225#include <fog_pars_fragment> 6226#include <bsdfs> 6227#include <lights_pars_begin> 6228#include <logdepthbuf_pars_fragment> 6229#include <shadowmap_pars_fragment> 6230#include <shadowmask_pars_fragment> 6231void main() { 6232 #include <logdepthbuf_fragment> 6233 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 6234 #include <tonemapping_fragment> 6235 #include <colorspace_fragment> 6236 #include <fog_fragment> 6237 #include <premultiplied_alpha_fragment> 6238}`,sprite_vert:`uniform float rotation; 6239uniform vec2 center; 6240#include <common> 6241#include <uv_pars_vertex> 6242#include <fog_pars_vertex> 6243#include <logdepthbuf_pars_vertex> 6244#include <clipping_planes_pars_vertex> 6245void main() { 6246 #include <uv_vertex> 6247 vec4 mvPosition = modelViewMatrix[ 3 ]; 6248 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 6249 #ifndef USE_SIZEATTENUATION 6250 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 6251 if ( isPerspective ) scale *= - mvPosition.z; 6252 #endif 6253 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 6254 vec2 rotatedPosition; 6255 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 6256 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 6257 mvPosition.xy += rotatedPosition; 6258 gl_Position = projectionMatrix * mvPosition; 6259 #include <logdepthbuf_vertex> 6260 #include <clipping_planes_vertex> 6261 #include <fog_vertex> 6262}`,sprite_frag:`uniform vec3 diffuse; 6263uniform float opacity; 6264#include <common> 6265#include <uv_pars_fragment> 6266#include <map_pars_fragment> 6267#include <alphamap_pars_fragment> 6268#include <alphatest_pars_fragment> 6269#include <alphahash_pars_fragment> 6270#include <fog_pars_fragment> 6271#include <logdepthbuf_pars_fragment> 6272#include <clipping_planes_pars_fragment> 6273void main() { 6274 vec4 diffuseColor = vec4( diffuse, opacity ); 6275 #include <clipping_planes_fragment> 6276 vec3 outgoingLight = vec3( 0.0 ); 6277 #include <logdepthbuf_fragment> 6278 #include <map_fragment> 6279 #include <alphamap_fragment> 6280 #include <alphatest_fragment> 6281 #include <alphahash_fragment> 6282 outgoingLight = diffuseColor.rgb; 6283 #include <opaque_fragment> 6284 #include <tonemapping_fragment> 6285 #include <colorspace_fragment> 6286 #include <fog_fragment> 6287}`};var ce$1={common:{diffuse:{value:new Ae$1(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Pe$1},alphaMap:{value:null},alphaMapTransform:{value:new Pe$1},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Pe$1}},envmap:{envMap:{value:null},envMapRotation:{value:new Pe$1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Pe$1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Pe$1}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Pe$1},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Pe$1},normalScale:{value:new Fe$1(1,1)}}
vendor: 7,898 bytes, line 6287
6287,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Pe$1},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Pe$1}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Pe$1}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Pe$1}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae$1(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new D$2},probesMax:{value:new D$2},probesResolution:{value:new D$2}},points:{diffuse:{value:new Ae$1(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Pe$1},alphaTest:{value:0},uvTransform:{value:new Pe$1}},sprite:{diffuse:{value:new Ae$1(16777215)},opacity:{value:1},center:{value:new Fe$1(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Pe$1},alphaMap:{value:null},alphaMapTransform:{value:new Pe$1},alphaTest:{value:0}}};var Fn={basic:{uniforms:Dt$1([ce$1.common,ce$1.specularmap,ce$1.envmap,ce$1.aomap,ce$1.lightmap,ce$1.fog]),vertexShader:Oe$1.meshbasic_vert,fragmentShader:Oe$1.meshbasic_frag},lambert:{uniforms:Dt$1([ce$1.common,ce$1.specularmap,ce$1.envmap,ce$1.aomap,ce$1.lightmap,ce$1.emissivemap,ce$1.bumpmap,ce$1.normalmap,ce$1.displacementmap,ce$1.fog,ce$1.lights,{emissive:{value:new Ae$1(0)},envMapIntensity:{value:1}}]),vertexShader:Oe$1.meshlambert_vert,fragmentShader:Oe$1.meshlambert_frag},phong:{uniforms:Dt$1([ce$1.common,ce$1.specularmap,ce$1.envmap,ce$1.aomap,ce$1.lightmap,ce$1.emissivemap,ce$1.bumpmap,ce$1.normalmap,ce$1.displacementmap,ce$1.fog,ce$1.lights,{emissive:{value:new Ae$1(0)},specular:{value:new Ae$1(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Oe$1.meshphong_vert,fragmentShader:Oe$1.meshphong_frag},standard:{uniforms:Dt$1([ce$1.common,ce$1.envmap,ce$1.aomap,ce$1.lightmap,ce$1.emissivemap,ce$1.bumpmap,ce$1.normalmap,ce$1.displacementmap,ce$1.roughnessmap,ce$1.metalnessmap,ce$1.fog,ce$1.lights,{emissive:{value:new Ae$1(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe$1.meshphysical_vert,fragmentShader:Oe$1.meshphysical_frag},toon:{uniforms:Dt$1([ce$1.common,ce$1.aomap,ce$1.lightmap,ce$1.emissivemap,ce$1.bumpmap,ce$1.normalmap,ce$1.displacementmap,ce$1.gradientmap,ce$1.fog,ce$1.lights,{emissive:{value:new Ae$1(0)}}]),vertexShader:Oe$1.meshtoon_vert,fragmentShader:Oe$1.meshtoon_frag},matcap:{uniforms:Dt$1([ce$1.common,ce$1.bumpmap,ce$1.normalmap,ce$1.displacementmap,ce$1.fog,{matcap:{value:null}}]),vertexShader:Oe$1.meshmatcap_vert,fragmentShader:Oe$1.meshmatcap_frag},points:{uniforms:Dt$1([ce$1.points,ce$1.fog]),vertexShader:Oe$1.points_vert,fragmentShader:Oe$1.points_frag},dashed:{uniforms:Dt$1([ce$1.common,ce$1.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe$1.linedashed_vert,fragmentShader:Oe$1.linedashed_frag},depth:{uniforms:Dt$1([ce$1.common,ce$1.displacementmap]),vertexShader:Oe$1.depth_vert,fragmentShader:Oe$1.depth_frag},normal:{uniforms:Dt$1([ce$1.common,ce$1.bumpmap,ce$1.normalmap,ce$1.displacementmap,{opacity:{value:1}}]),vertexShader:Oe$1.meshnormal_vert,fragmentShader:Oe$1.meshnormal_frag},sprite:{uniforms:Dt$1([ce$1.sprite,ce$1.fog]),vertexShader:Oe$1.sprite_vert,fragmentShader:Oe$1.sprite_frag},background:{uniforms:{uvTransform:{value:new Pe$1},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe$1.background_vert,fragmentShader:Oe$1.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Pe$1}},vertexShader:Oe$1.backgroundCube_vert,fragmentShader:Oe$1.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe$1.cube_vert,fragmentShader:Oe$1.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe$1.equirect_vert,fragmentShader:Oe$1.equirect_frag},distance:{uniforms:Dt$1([ce$1.common,ce$1.displacementmap,{referencePosition:{value:new D$2},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe$1.distance_vert,fragmentShader:Oe$1.distance_frag},shadow:{uniforms:Dt$1([ce$1.lights,ce$1.fog,{color:{value:new Ae$1(0)},opacity:{value:1}}]),vertexShader:Oe$1.shadow_vert,fragmentShader:Oe$1.shadow_frag}};Fn.physical={uniforms:Dt$1([Fn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Pe$1},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Pe$1},clearcoatNormalScale:{value:new Fe$1(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Pe$1},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Pe$1},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Pe$1},sheen:{value:0},sheenColor:{value:new Ae$1(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Pe$1},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Pe$1},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Pe$1},transmissionSamplerSize:{value:new Fe$1},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Pe$1},attenuationDistance:{value:0},attenuationColor:{value:new Ae$1(0)},specularColor:{value:new Ae$1(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Pe$1},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Pe$1},anisotropyVector:{value:new Fe$1},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Pe$1}}]),vertexShader:Oe$1.meshphysical_vert,fragmentShader:Oe$1.meshphysical_frag};var La={r:0,b:0,g:0};var Ng=new Le;var yd=new Pe$1;yd.set(-1,0,0,0,1,0,0,0,1);function Dg(i,e,t,n,s,r){let o=new Ae$1(0),a=s===!0?0:1,l,c,h=null,d=0,u=null;function f(E){let w=E.isScene===!0?E.background:null;if(w&&w.isTexture){let M=E.backgroundBlurriness>0;w=e.get(w,M)}return w}function g(E){let w=!1,M=f(E);M===null?m(o,a):M&&M.isColor&&(m(M,1),w=!0);let A=i.xr.getEnvironmentBlendMode();A===`additive`?t.buffers.color.setClear(0,0,0,1,r):A===`alpha-blend`&&t.buffers.color.setClear(0,0,0,0,r),(i.autoClear||w)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function y(E,w){let M=f(w);M&&(M.isCubeTexture||M.mapping===Sr$1)?(c===void 0&&(c=new Mt$2(new Ts$1(1,1,1),new sn$1({name:`Backgroun
6287dCubeMaterial`,uniforms:Vi(Fn.backgroundCube.uniforms),vertexShader:Fn.backgroundCube.vertexShader,fragmentShader:Fn.backgroundCube.fragmentShader,side:zt$1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute(`normal`),c.geometry.deleteAttribute(`uv`),c.onBeforeRender=function(A,b,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ng.makeRotationFromEuler(w.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(yd),c.material.toneMapped=ze.getTransfer(M.colorSpace)!==Ze,(h!==M||d!==M.version||u!==i.toneMapping)&&(c.material.needsUpdate=!0,h=M,d=M.version,u=i.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new Mt$2(new hr$1(2,2),new sn$1({name:`BackgroundMaterial`,uniforms:Vi(Fn.background.uniforms),vertexShader:Fn.background.vertexShader,fragmentShader:Fn.background.fragmentShader,side:vn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.toneMapped=ze.getTransfer(M.colorSpace)!==Ze,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||u!==i.toneMapping)&&(l.material.needsUpdate=!0,h=M,d=M.version,u=i.toneMapping),l.layers.enableAll(),E.unshift(l,l.geometry,l.material,0,0,null))}function m(E,w){E.getRGB(La,sc$1(i)),t.buffers.color.setClear(La.r,La.g,La.b,w,r)}function p(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(E,w=1){o.set(E),a=w,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(E){a=E,m(o,a)},render:g,addToRenderList:y,dispose:p}}function Ug(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=u(null),r=s,o=!1;function a(C,F,X,$,O){let q=!1,V=d(C,$,X,F);r!==V&&(r=V,c(r.object)),q=f(C,$,X,O),q&&g(C,$,X,O),O!==null&&e.update(O,i.ELEMENT_ARRAY_BUFFER),(q||o)&&(o=!1,M(C,F,X,$),O!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(O).buffer))}function l(){return i.createVertexArray()}function c(C){return i.bindVertexArray(C)}function h(C){return i.deleteVertexArray(C)}function d(C,F,X,$){let O=$.wireframe===!0,q=n[F.id];q===void 0&&(q={},n[F.id]=q);let V=C.isInstancedMesh===!0?C.id:0,J=q[V];J===void 0&&(J={},q[V]=J);let Q=J[X.id];Q===void 0&&(Q={},J[X.id]=Q);let he=Q[O];return he===void 0&&(he=u(l()),Q[O]=he),he}function u(C){let F=[],X=[],$=[];for(let O=0;O<t;O++)F[O]=0,X[O]=0,$[O]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:X,attributeDivisors:$,object:C,attributes:{},index:null}}function f(C,F,X,$){let O=r.attributes,q=F.attributes,V=0,J=X.getAttributes();for(let Q in J)if(J[Q].location>=0){let pe=O[Q],_e=q[Q];if(_e===void 0&&(Q===`instanceMatrix`&&C.instanceMatrix&&(_e=C.instanceMatrix),Q===`instanceColor`&&C.instanceColor&&(_e=C.instanceColor)),pe===void 0||pe.attribute!==_e||_e&&pe.data!==_e.data)return!0;V++}return r.attributesNum!==V||r.index!==$}function g(C,F,X,$){let O={},q=F.attributes,V=0,J=X.getAttributes();for(let Q in J)if(J[Q].location>=0){let pe=q[Q];pe===void 0&&(Q===`instanceMatrix`&&C.instanceMatrix&&(pe=C.instanceMatrix),Q===`instanceColor`&&C.instanceColor&&(pe=C.instanceColor));let _e={};_e.attribute=pe,pe&&pe.data&&(_e.data=pe.data),O[Q]=_e,V++}r.attributes=O,r.attributesNum=V,r.index=$}function y(){let C=r.newAttributes;for(let F=0,X=C.length;F<X;F++)C[F]=0}function m(C){p(C,0)}
vendor: 6,531 bytes, line 6287
6287function p(C,F){let X=r.newAttributes,$=r.enabledAttributes,O=r.attributeDivisors;X[C]=1,$[C]===0&&(i.enableVertexAttribArray(C),$[C]=1),O[C]!==F&&(i.vertexAttribDivisor(C,F),O[C]=F)}function E(){let C=r.newAttributes,F=r.enabledAttributes;for(let X=0,$=F.length;X<$;X++)F[X]!==C[X]&&(i.disableVertexAttribArray(X),F[X]=0)}function w(C,F,X,$,O,q,V){V===!0?i.vertexAttribIPointer(C,F,X,O,q):i.vertexAttribPointer(C,F,X,$,O,q)}function M(C,F,X,$){y();let O=$.attributes,q=X.getAttributes(),V=F.defaultAttributeValues;for(let J in q){let Q=q[J];if(Q.location>=0){let he=O[J];if(he===void 0&&(J===`instanceMatrix`&&C.instanceMatrix&&(he=C.instanceMatrix),J===`instanceColor`&&C.instanceColor&&(he=C.instanceColor)),he!==void 0){let pe=he.normalized,_e=he.itemSize,Xe=e.get(he);if(Xe===void 0)continue;let rt=Xe.buffer,qe=Xe.type,K=Xe.bytesPerElement,ie=qe===i.INT||qe===i.UNSIGNED_INT||he.gpuType===qo$1;if(he.isInterleavedBufferAttribute){let ee=he.data,Ie=ee.stride,Ne=he.offset;if(ee.isInstancedInterleavedBuffer){for(let we=0;we<Q.locationSize;we++)p(Q.location+we,ee.meshPerAttribute);C.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let we=0;we<Q.locationSize;we++)m(Q.location+we);i.bindBuffer(i.ARRAY_BUFFER,rt);for(let we=0;we<Q.locationSize;we++)w(Q.location+we,_e/Q.locationSize,qe,pe,Ie*K,(Ne+_e/Q.locationSize*we)*K,ie)}else{if(he.isInstancedBufferAttribute){for(let ee=0;ee<Q.locationSize;ee++)p(Q.location+ee,he.meshPerAttribute);C.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let ee=0;ee<Q.locationSize;ee++)m(Q.location+ee);i.bindBuffer(i.ARRAY_BUFFER,rt);for(let ee=0;ee<Q.locationSize;ee++)w(Q.location+ee,_e/Q.locationSize,qe,pe,_e*K,_e/Q.locationSize*ee*K,ie)}}else if(V!==void 0){let pe=V[J];if(pe!==void 0)switch(pe.length){case 2:i.vertexAttrib2fv(Q.location,pe);break;case 3:i.vertexAttrib3fv(Q.location,pe);break;case 4:i.vertexAttrib4fv(Q.location,pe);break;default:i.vertexAttrib1fv(Q.location,pe)}}}}E()}function A(){T();for(let C in n){let F=n[C];for(let X in F){let $=F[X];for(let O in $){let q=$[O];for(let V in q)h(q[V].object),delete q[V];delete $[O]}}delete n[C]}}function b(C){if(n[C.id]===void 0)return;let F=n[C.id];for(let X in F){let $=F[X];for(let O in $){let q=$[O];for(let V in q)h(q[V].object),delete q[V];delete $[O]}}delete n[C.id]}function R(C){for(let F in n){let X=n[F];for(let $ in X){let O=X[$];if(O[C.id]===void 0)continue;let q=O[C.id];for(let V in q)h(q[V].object),delete q[V];delete O[C.id]}}}function x(C){for(let F in n){let X=n[F],$=C.isInstancedMesh===!0?C.id:0,O=X[$];if(O!==void 0){for(let q in O){let V=O[q];for(let J in V)h(V[J].object),delete V[J];delete O[q]}delete X[$],Object.keys(X).length===0&&delete n[F]}}}function T(){L(),o=!0,r!==s&&(r=s,c(r.object))}function L(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:T,resetDefaultState:L,dispose:A,releaseStatesOfGeometry:b,releaseStatesOfObject:x,releaseStatesOfProgram:R,initAttributes:y,enableAttribute:m,disableUnusedAttributes:E}}function Fg(i,e,t){let n;function s(l){n=l}function r(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,h){h!==0&&(i.drawArraysInstanced(n,l,c,h),t.update(c,n,h))}function a(l,c,h){if(h===0)return;e.get(`WEBGL_multi_draw`).multiDrawArraysWEBGL(n,l,0,c,0,h);let u=0;for(let f=0;f<h;f++)u+=c[f];t.update(u,n,1)}this.setMode=s,this.render=r,this.renderInstances=o,this.renderMultiDraw=a}function Og(i,e,t,n){let s;function r(){if(s!==void 0)return s;if(e.has(`EXT_texture_filter_anisotropic`)===!0){let R=e.get(`EXT_texture_filter_anisotropic`);s=i.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function o(R){return!(R!==on$1&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(R){let x=R===Dn&&(e.has(`EXT_color_buffer_half_float`)||e.has(`EXT_color_buffer_float`));return!(R!==qt$2&&n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==rn$1&&!x)}function l(R){if(R===`highp`){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return`highp`;R=`mediump`}return R===`mediump`&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let c=t.precision!==void 0?t.precision:`highp`,h=l(c);h!==c&&(ye$2(`WebGLRenderer:`,c,`not supported, using`,h,`instead.`),c=h);let d=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has(`EXT_clip_control`);t.reversedDepthBuffer===!0&&u===!1&&ye$2(`WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.`);let f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),E=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),w=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),A=i.getParameter(i.MAX_SAMPLES),b=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:f,maxVertexTextures:g,maxTextureSize:y,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:E,maxVaryings:w,maxFragmentUniforms:M,maxSamples:A,samples:b}}function Bg(i){let e=this,t=null,n=0,s=!1,r=!1,o=new Rn$1,a=new Pe$1,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let f=d.length!==0||u||n!==0||s;return s=u,n=d.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,f){let g=d.clippingPlanes,y=d.clipIntersection,m=d.clipShadows,p=i.get(d);if(!s||g===null||g.length===0||r&&!m)r?h(null):c();else{let E=r?0:n,w=E*4,M=p.clippingState||null;l.value=M,M=h(g,u,w,f);for(let A=0;A!==w;++A)M[A]=t[A];p.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,u,f,g){let y=d!==null?d.length:0,m=null;if(y!==0){if(m=l.value,g!==!0||m===null){let p=f+y*4,E=u.matrixWorldInverse;a.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let w=0,M=f;w!==y;
vendor: 3,622 bytes, line 6287
6287++w,M+=4)o.copy(d[w]).applyMatrix4(E,a),o.normal.toArray(m,M),m[M+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,m}}var vi=4;var $u=[.125,.215,.35,.446,.526,.582];var Hi=20;var zg=256;var Ir$1=new mi;var ju=new Ae$1;var lc$1=null;var cc$1=0;var hc$1=0;var uc$1=!1;var kg=new D$2;var Da=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,s=100,r={}){let{size:o=256,position:a=kg}=r;lc$1=this._renderer.getRenderTarget(),cc$1=this._renderer.getActiveCubeFace(),hc$1=this._renderer.getActiveMipmapLevel(),uc$1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,s,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=td$1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ed$1(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(lc$1,cc$1,hc$1),this._renderer.xr.enabled=uc$1,e.scissorTest=!1,Ps$1(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===gi||e.mapping===zi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),lc$1=this._renderer.getRenderTarget(),cc$1=this._renderer.getActiveCubeFace(),hc$1=this._renderer.getActiveMipmapLevel(),uc$1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:mt$2,minFilter:mt$2,generateMipmaps:!1,type:Dn,format:on$1,colorSpace:Ot$2,depthBuffer:!1},s=Qu(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Qu(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Vg(r)),this._blurMaterial=Hg(r,e,t),this._ggxMaterial=Gg(r,e,t)}return s}_compileMaterial(e){let t=new Mt$2(new Bt$1,e);this._renderer.compile(t,Ir$1)}_sceneToCubeUV(e,t,n,s,r){let l=new yt$1(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],d=this._renderer,u=d.autoClear,f=d.toneMapping;d.getClearColor(ju),d.toneMapping=Mn$1,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(s),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Mt$2(new Ts$1,new yn$1({name:`PMREM.Backgroun
6287d`,side:zt$1,depthWrite:!1,depthTest:!1})));let y=this._backgroundBox,m=y.material,p=!1,E=e.background;E?E.isColor&&(m.color.copy(E),e.background=null,p=!0):(m.color.copy(ju),p=!0);for(let w=0;w<6;w++){let M=w%3;M===0?(l.up.set(0,c[w],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x+h[w],r.y,r.z)):M===1?(l.up.set(0,0,c[w]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+h[w],r.z)):(l.up.set(0,c[w],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+h[w]));let A=this._cubeSize;Ps$1(s,M*A,w>2?A:0,A,A),d.setRenderTarget(s),p&&d.render(y,l),d.render(e,l)}d.toneMapping=f,d.autoClear=u,e.background=E}_textureToCubeUV(e,t){let n=this._renderer,s=e.mapping===gi||e.mapping===zi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=td$1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ed$1());let r=s?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=r;let a=r.uniforms;a.envMap.value=e;let l=this._cubeSize;Ps$1(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Ir$1)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){let s=this._renderer,r=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-h*h)*(0+c*1.25),{_lodMax:g}=this,y=this._sizeLods[n],m=3*y*(n>g-vi?n-g+vi:0),p=4*(this._cubeSize-y);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=g-t,Ps$1(r,m,p,3*y,2*y),s.setRenderTarget(r),s.render(a,Ir$1),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=g-n,Ps$1(e,m,p,3*y,2*y),s.setRenderTarget(e),s.render(a,Ir$1)}_blur(e,t,n,s,r){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,s,`latitudinal`,r),this._halfBlur(o,e,n,n,s,`longitudinal`,r)}_halfBlur(e,t,n,s,r,o,a){let l=this._renderer,c=this._blurMaterial;o!==`latitudinal`&&o!==`longitudinal`&&Ce$1(`blur direction must be either latitudinal or longitudinal!`);let h=3,d=this._lodMeshes[s];d.material=c;let u=c.uniforms,f=this._sizeLods[n]-1,g=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Hi-1),y=r/g,m=isFinite(r)?1+Math.floor(h*y):Hi;m>Hi&&ye$2(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Hi}`);let p=[],E=0;for(let R=0;R<Hi;++R){let x=R/y,T=Math.exp(-x*x/2);p.push(T),R===0?E+=T:R<m&&(E+=2*T)}for(let R=0;R<p.length;R++)p[R]=p[R]/E;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=p,u.latitudinal.value=o===`latitudinal`,a&&(u.poleAxis.value=a);let{_lodMax:w}=this;u.dTheta.value=g,u.mipInt.value=w-n;let M=this._sizeLods[s];Ps$1(t,3*M*(s>w-vi?s-w+vi:0),4*(this._cubeSize-M),3*M,2*M),l.setRenderTarget(t),l.render(d,Ir$1)}};function Vg(i){let e=[],t=[],n=[],s=i,r=i-vi+1+$u.length;for(let o=0;o<r;o++){let a=Math.pow(2,s);e.push(a);let l=1/a;o>i-vi?l=$u[o-i+vi-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],f=6,g=6,y=3,m=2,p=1,E=new Float32Array(y*g*f),w=new Float32Array(m*g*f),M=new Float32Array(p*g*f);for(let b=0;b<f;b++){let R=b%3*2/3-1,x=b>2?0:-1,T=[R,x,0,R+2/3,x,0,R+2/3,x+1,0,R,x,0,R+2/3,x+1,0,R,x+1,0];E.set(T,y*g*b),w.set(u,m*g*b);let L=[b,b,b,b,b,b];M.set(L,p*g*b)}let A=new Bt$1;A.setAttribute(`position`,new ct$2(E,y)),A.setAttribute(`uv`,new ct$2(w,m)),A.setAttribute(`faceIndex`,new ct$2(M,p)),n.push(new Mt$2(A,null)),s>vi&&s--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Qu(i,e,t){let n=new tn(i,e,t);return n.texture.mapping=Sr$1,n.texture.name=`PMREM.cubeUv`,n.scissorTest=!0,n}function Ps$1(i,e,t,n,s){i.viewport.set(e,t,n,s),i.scissor.set(e,t,n,s)}function Gg(i,e,t){return new sn$1({name:`PMREMGGXConvolution`,defines:{GGX_SAMPLES:zg,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Oa(),fragmentShader:` 6288 6289 precision highp float; 6290 precision highp int; 6291 6292 varying vec3 vOutputDirection; 6293 6294 uniform sampler2D envMap; 6295 uniform float roughness; 6296 uniform float mipInt; 6297 6298 #define ENVMAP_TYPE_CUBE_UV 6299 #include <cube_uv_reflection_fragment> 6300 6301 #define PI 3.14159265359 6302 6303 // Van der Corput radical inverse 6304 float radicalInverse_VdC(uint bits) { 6305 bits = (bits << 16u) | (bits >> 16u); 6306 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 6307 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 6308 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 6309 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 6310 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 6311 } 6312 6313 // Hammersley sequence 6314 vec2 hammersley(uint i, uint N) { 6315 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 6316 } 6317 6318 // GGX VNDF importance sampling (Eric Heitz 2018) 6319 // "Sampling the GGX Distribution of Visible Normals" 6320 // https://jcgt.org/published/0007/04/01/ 6321 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 6322 float alpha = roughness * roughness; 6323 6324 // Section 4.1: Orthonormal basis 6325 vec3 T1 = vec3(1.0, 0.0, 0.0); 6326 vec3 T2 = cross(V, T1); 6327 6328 // Section 4.2: Parameterization of projected area 6329 float r = sqrt(Xi.x); 6330 float phi = 2.0 * PI * Xi.y; 6331 float t1 = r * cos(phi); 6332 float t2 = r * sin(phi); 6333 float s = 0.5 * (1.0 + V.z); 6334 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 6335 6336 // Section 4.3: Reprojection onto hemisphere 6337 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 6338 6339 // Section 3.4: Transform back to ellipsoid configuration 6340 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 6341 } 6342 6343 void main() { 6344 vec3 N = normalize(vOutputDirection); 6345 vec3 V = N; // Assume view direction equals normal for pre-filtering 6346 6347 vec3 prefilteredColor = vec3(0.0); 6348 float totalWeight = 0.0; 6349 6350 // For very low roughness, just sample the environment directly 6351 if (roughness < 0.001) { 6352 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 6353 return; 6354 } 6355 6356 // Tangent space basis for VNDF sampling 6357 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 6358 vec3 tangent = normalize(cross(up, N)); 6359 vec3 bitangent = cross(N, tangent); 6360
6361 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 6362 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 6363 6364 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 6365 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 6366 6367 // Transform H back to world space 6368 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 6369 vec3 L = normalize(2.0 * dot(V, H) * H - V); 6370 6371 float NdotL = max(dot(N, L), 0.0); 6372 6373 if(NdotL > 0.0) { 6374 // Sample environment at fixed mip level 6375 // VNDF importance sampling handles the distribution filtering 6376 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 6377 6378 // Weight by NdotL for the split-sum approximation 6379 // VNDF PDF naturally accounts for the visible microfacet distribution 6380 prefilteredColor += sampleColor * NdotL; 6381 totalWeight += NdotL; 6382 } 6383 } 6384 6385 if (totalWeight > 0.0) { 6386 prefilteredColor = prefilteredColor / totalWeight; 6387 } 6388 6389 gl_FragColor = vec4(prefilteredColor, 1.0); 6390 } 6391 `,blending:Nn$1,depthTest:!1,depthWrite:!1})}function Hg(i,e,t){let n=new Float32Array(Hi),s=new D$2(0,1,0);return new sn$1({name:`SphericalGaussianBlur`,defines:{n:Hi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Oa(),fragmentShader:` 6392 6393 precision mediump float; 6394 precision mediump int; 6395 6396 varying vec3 vOutputDirection; 6397 6398 uniform sampler2D envMap; 6399 uniform int samples; 6400 uniform float weights[ n ]; 6401 uniform bool latitudinal; 6402 uniform float dTheta; 6403 uniform float mipInt; 6404 uniform vec3 poleAxis; 6405 6406 #define ENVMAP_TYPE_CUBE_UV 6407 #include <cube_uv_reflection_fragment> 6408 6409 vec3 getSample( float theta, vec3 axis ) { 6410 6411 float cosTheta = cos( theta ); 6412 // Rodrigues' axis-angle rotation 6413 vec3 sampleDirection = vOutputDirection * cosTheta 6414 + cross( axis, vOutputDirection ) * sin( theta ) 6415 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 6416 6417 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 6418 6419 } 6420 6421 void main() { 6422 6423 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 6424 6425 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 6426 6427 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 6428 6429 } 6430 6431 axis = normalize( axis ); 6432 6433 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 6434 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 6435 6436 for ( int i = 1; i < n; i++ ) { 6437 6438 if ( i >= samples ) { 6439 6440 break; 6441 6442 } 6443 6444 float theta = dTheta * float( i ); 6445 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 6446 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 6447 6448 } 6449 6450 } 6451 `,blending:Nn$1,depthTest:!1,depthWrite:!1})}function ed$1(){return new sn$1({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:Oa(),fragmentShader:` 6452 6453 precision mediump float; 6454 precision mediump int; 6455 6456 varying vec3 vOutputDirection; 6457 6458 uniform sampler2D envMap; 6459 6460 #include <common> 6461 6462 void main() { 6463 6464 vec3 outputDirection = normalize( vOutputDirection ); 6465 vec2 uv = equirectUv( outputDirection ); 6466 6467 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 6468 6469 } 6470 `,blending:Nn$1,depthTest:!1,depthWrite:!1})}function td$1(){return new sn$1({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Oa(),fragmentShader:` 6471 6472 precision mediump float; 6473 precision mediump int; 6474 6475 uniform float flipEnvMap; 6476 6477 varying vec3 vOutputDirection; 6478 6479 uniform samplerCube envMap; 6480 6481 void main() { 6482 6483 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 6484 6485 } 6486 `,blending:Nn$1,depthTest:!1,depthWrite:!1})}function Oa(){return` 6487 6488 precision mediump float; 6489 precision mediump int; 6490 6491 attribute float faceIndex; 6492 6493 varying vec3 vOutputDirection; 6494 6495 // RH coordinate system; PMREM face-indexing convention 6496 vec3 getDirection( vec2 uv, float face ) { 6497 6498 uv = 2.0 * uv - 1.0; 6499 6500 vec3 direction = vec3( uv, 1.0 ); 6501 6502 if ( face == 0.0 ) { 6503 6504 direction = direction.zyx; // ( 1, v, u ) pos x 6505 6506 } else if ( face == 1.0 ) { 6507 6508 direction = direction.xzy; 6509 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 6510 6511 } else if ( face == 2.0 ) { 6512 6513 direction.x *= -1.0; // ( -u, v, 1 ) pos z 6514 6515 } else if ( face == 3.0 ) { 6516 6517 direction = direction.zyx; 6518 direction.xz *= -1.0; // ( -1, v, -u ) neg x 6519 6520 } else if ( face == 4.0 ) { 6521 6522 direction = direction.xzy; 6523 direction.xy *= -1.0; // ( -u, -1, v ) neg y 6524 6525 } else if ( face == 5.0 ) { 6526 6527 direction.z *= -1.0; // ( u, v, -1 ) neg z 6528 6529 } 6530 6531 return direction; 6532 6533 } 6534 6535 void main() { 6536 6537 vOutputDirection = getDirection( uv, faceIndex ); 6538 gl_Position = vec4( position, 1.0 ); 6539 6540 } 6541 `}var Ua=class extends tn{constructor(e=1,t={}
vendor: 12,070 bytes, lines 6541-6622
6541){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},s=[n,n,n,n,n,n];this.texture=new lr(s),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` 6542 6543 varying vec3 vWorldDirection; 6544 6545 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 6546 6547 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 6548 6549 } 6550 6551 void main() { 6552 6553 vWorldDirection = transformDirection( position, modelMatrix ); 6554 6555 #include <begin_vertex> 6556 #include <project_vertex> 6557 6558 } 6559 `,fragmentShader:` 6560 6561 uniform sampler2D tEquirect; 6562 6563 varying vec3 vWorldDirection; 6564 6565 #include <common> 6566 6567 void main() { 6568 6569 vec3 direction = normalize( vWorldDirection ); 6570 6571 vec2 sampleUV = equirectUv( direction ); 6572 6573 gl_FragColor = texture2D( tEquirect, sampleUV ); 6574 6575 } 6576 `},s=new Ts$1(5,5,5),r=new sn$1({name:`CubemapFromEquirect`,uniforms:Vi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:zt$1,blending:Nn$1});r.uniforms.tEquirect.value=t;let o=new Mt$2(s,r),a=t.minFilter;return t.minFilter===Sn$1&&(t.minFilter=mt$2),new Vo$1(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,s=!0){let r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,s);e.setRenderTarget(r)}};function Wg(i){let e=new WeakMap,t=new WeakMap,n=null;function s(u,f=!1){return u==null?null:f?o(u):r(u)}function r(u){if(u&&u.isTexture){let f=u.mapping;if(f===Ho$1||f===Wo$1)if(e.has(u)){let g=e.get(u).texture;return a(g,u.mapping)}else{let g=u.image;if(g&&g.height>0){let y=new Ua(g.height);return y.fromEquirectangularTexture(i,u),e.set(u,y),u.addEventListener(`dispose`,c),a(y.texture,u.mapping)}else return null}}return u}function o(u){if(u&&u.isTexture){let f=u.mapping,g=f===Ho$1||f===Wo$1,y=f===gi||f===zi;if(g||y){let m=t.get(u),p=m!==void 0?m.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==p)return n===null&&(n=new Da(i)),m=g?n.fromEquirectangular(u,m):n.fromCubemap(u,m),m.texture.pmremVersion=u.pmremVersion,t.set(u,m),m.texture;if(m!==void 0)return m.texture;{let E=u.image;return g&&E&&E.height>0||y&&E&&l(E)?(n===null&&(n=new Da(i)),m=g?n.fromEquirectangular(u):n.fromCubemap(u),m.texture.pmremVersion=u.pmremVersion,t.set(u,m),u.addEventListener(`dispose`,h),m.texture):null}}}return u}function a(u,f){return f===Ho$1?u.mapping=gi:f===Wo$1&&(u.mapping=zi),u}function l(u){let f=0,g=6;for(let y=0;y<g;y++)u[y]!==void 0&&f++;return f===g}function c(u){let f=u.target;f.removeEventListener(`dispose`,c);let g=e.get(f);g!==void 0&&(e.delete(f),g.dispose())}function h(u){let f=u.target;f.removeEventListener(`dispose`,h);let g=t.get(f);g!==void 0&&(t.delete(f),g.dispose())}function d(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:s,dispose:d}}function Xg(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let s=i.getExtension(n);return e[n]=s,s}return{has:function(n){return t(n)!==null},init:function(){t(`EXT_color_buffer_float`),t(`WEBGL_clip_cull_distance`),t(`OES_texture_float_linear`),t(`EXT_color_buffer_half_float`),t(`WEBGL_multisampled_render_to_texture`),t(`WEBGL_render_shared_exponent`)},get:function(n){let s=t(n);return s===null&&Ii(`WebGLRenderer: `+n+` extension not supported.`),s}}}function qg(i,e,t,n){let s={},r=new WeakMap;function o(d){let u=d.target;u.index!==null&&e.remove(u.index);for(let g in u.attributes)e.remove(u.attributes[g]);u.removeEventListener(`dispose`,o),delete s[u.id];let f=r.get(u);f&&(e.remove(f),r.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function a(d,u){return s[u.id]===!0||(u.addEventListener(`dispose`,o),s[u.id]=!0,t.memory.geometries++),u}function l(d){let u=d.attributes;for(let f in u)e.update(u[f],i.ARRAY_BUFFER)}function c(d){let u=[],f=d.index,g=d.attributes.position,y=0;if(g===void 0)return;if(f!==null){let E=f.array;y=f.version;for(let w=0,M=E.length;w<M;w+=3){let A=E[w+0],b=E[w+1],R=E[w+2];u.push(A,b,b,R,R,A)}}else{let E=g.array;y=g.version;for(let w=0,M=E.length/3-1;w<M;w+=3){let A=w+0,b=w+1,R=w+2;u.push(A,b,b,R,R,A)}}let m=new(g.count>=65535?nr$1:tr$1)(u,1);m.version=y;let p=r.get(d);p&&e.remove(p),r.set(d,m)}function h(d){let u=r.get(d);if(u){let f=d.index;f!==null&&u.version<f.version&&c(d)}else c(d);return r.get(d)}return{get:a,update:l,getWireframeAttribute:h}}function Yg(i,e,t){let n;function s(d){n=d}let r,o;function a(d){r=d.type,o=d.bytesPerElement}function l(d,u){i.drawElements(n,u,r,d*o),t.update(u,n,1)}function c(d,u,f){f!==0&&(i.drawElementsInstanced(n,u,r,d*o,f),t.update(u,n,f))}function h(d,u,f){if(f===0)return;e.get(`WEBGL_multi_draw`).multiDrawElementsWEBGL(n,u,0,r,d,0,f);let y=0;for(let m=0;m<f;m++)y+=u[m];t.update(y,n,1)}this.setMode=s,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function Zg(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(r/3);break;case i.LINES:t.lines+=a*(r/2);break;case i.LINE_STRIP:t.lines+=a*(r-1);break;case i.LINE_LOOP:t.lines+=a*r;break;case i.POINTS:t.points+=a*r;break;default:Ce$1(`WebGLInfo: Unknown draw mode:`,o);break}}function s(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:n}}function Kg(i,e,t){let n=new WeakMap,s=new $e;function r(o,a,l){let c=o.morphTargetInfluences,h=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,d=h!==void 0?h.length:0,u=n.get(a);if(u===void 0||u.count!==d){let L=function(){x.dispose(),n.delete(a),a.removeEventListener(`dispose`,L)};u!==void 0&&u.texture.dispose();let g=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,m=a.morphAttributes.color!==void 0,p=a.morphAttributes.position||[],E=a.morphAttributes.normal||[],w=a.morphAttributes.color||[],M=0;g===!0&&(M=1),y===!0&&(M=2),m===!0&&(M=3);let A=a.attributes.position.count*M,b=1;A>e.maxTextureSize&&(b=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);let R=new Float32Array(A*b*4*d),x=new Qs$1(R,A,b,d);x.type=rn$1,x.needsUpdate=!0;let T=M*4;for(let C=0;C<d;C++){let F=p[C],X=E[C],$=w[C],O=A*b*4*C;for(let q=0;q<F.count;q++){let V=q*T;g===!0&&(s.fromBufferAttribute(F,q),R[O+V+0]=s.x,R[O+V+1]=s.y,R[O+V+2]=s.z,R[O+V+3]=0),y===!0&&(s.fromBufferAttribute(X,q),R[O+V+4]=s.x,R[O+V+5]=s.y,R[O+V+6]=s.z,R[O+V+7]=0),m===!0&&(s.fromBufferAttribute($,q),R[O+V+8]=s.x,R[O+V+9]=s.y,R[O+V+10]=s.z,R[O+V+11]=$.itemSize===4?s.w:1)}}u={count:d,texture:x,size:new Fe$1(A,b)},n.set(a,u),a.addEventListener(`dispose`,L)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,`morphTexture`,o.morphTexture,t);else{let g=0;for(let m=0;m<c.length;m++)g+=c[m];let y=a.morphTargetsRelative?1:1-g;l.getUniforms().setValue(i,`morphTargetBaseInfluence`,y),l.getUniforms().setValue(i,`morphTargetInfluences`,c)}l.getUniforms().setValue(i,`morphTargetsTexture`,u.texture,t),l.getUniforms().setValue(i,`morphTargetsTextureSize`,u.size)}return{update:r}}function Jg(i,e,t,n,s){let r=new WeakMap;function o(c){let h=s.render.frame,d=c.geometry,u=e.get(c,d);if(r.get(u)!==h&&(e.update(u),r.set(u,h)),c.isInstancedMesh&&(c.hasEventListener(`dispose`,l)===!1&&c.addEventListener(`dispose`,l),r.get(c)!==h&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),r.set(c,h))),c.isSkinnedMesh){let f=c.skeleton;r.get(f)!==h&&(f.update(),r.set(f,h))}return u}function a(){r=new WeakMap}function l(c){let h=c.target;h.removeEventListener(`dispose`,l),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:o,dispose:a}}var $g={[Vl$1]:`LINEAR_TONE_MAPPING`,[Gl$1]:`REINHARD_TONE_MAPPING`,[Hl$1]:`CINEON_TONE_MAPPING`,[Wl$1]:`ACES_FILMIC_TONE_MAPPING`,[ql$1]:`AGX_TONE_MAPPING`,[Yl$1]:`NEUTRAL_TONE_MAPPING`,[Xl$1]:`CUSTOM_TONE_MAPPING`};function jg(i,e,t,n,s,r){let o=new tn(e,t,{type:i,depthBuffer:s,stencilBuffer:r,samples:n?4:0,depthTexture:s?new Xn$1(e,t):void 0}),a=new tn(e,t,{type:Dn,depthBuffer:!1,stencilBuffer:!1}),l=new Bt$1;l.setAttribute(`position`,new Ft$1([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute(`uv`,new Ft$1([0,2,0,0,2,0],2));let c=new Po$1({uniforms:{tDiffuse:{value:null}},vertexShader:` 6577 precision highp float; 6578 6579 uniform mat4 modelViewMatrix; 6580 uniform mat4 projectionMatrix; 6581 6582 attribute vec3 position; 6583 attribute vec2 uv; 6584 6585 varying vec2 vUv; 6586 6587 void main() { 6588 vUv = uv; 6589 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 6590 }`,fragmentShader:` 6591 precision highp float; 6592 6593 uniform sampler2D tDiffuse; 6594 6595 varying vec2 vUv; 6596 6597 #include <tonemapping_pars_fragment> 6598 #include <colorspace_pars_fragment> 6599 6600 void main() { 6601 gl_FragColor = texture2D( tDiffuse, vUv ); 6602 6603 #ifdef LINEAR_TONE_MAPPING 6604 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 6605 #elif defined( REINHARD_TONE_MAPPING ) 6606 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 6607 #elif defined( CINEON_TONE_MAPPING ) 6608 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 6609 #elif defined( ACES_FILMIC_TONE_MAPPING ) 6610 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 6611 #elif defined( AGX_TONE_MAPPING ) 6612 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 6613 #elif defined( NEUTRAL_TONE_MAPPING ) 6614 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 6615 #elif defined( CUSTOM_TONE_MAPPING ) 6616 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 6617 #endif 6618 6619 #ifdef SRGB_TRANSFER 6620 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 6621 #endif 6622 }`,depthTest:!1,depthWrite:!1}),h=new Mt$2(l,c),d=new mi(-1,1,1,-1,0,1),u=null,f=null,g=!1,y,m=null,p=[],E=!1;this.setSize=function(w,M){o.setSize(w,M),a.setSize(w,M);for(let A=0;A<p.length;A++){let b=p[A];b.setSize&&b.setSize(w,M)}},this.setEffects=function(w){p=w,E=p.length>0&&p[0].isRenderPass===!0;let M=o.width,A=o.height;for(let b=0;b<p.length;b++){let R=p[b];R.setSize&&R.setSize(M,A)}},this.begin=function(w,M){if(g||w.toneMapping===Mn$1&&p.length===0)return!1;if(m=M,M!==null){let A=M.width,b=M.height;(o.width!==A||o.height!==b)&&this.setSize(A,b)}return E===!1&&w.setRenderTarget(o),y=w.toneMapping,w.toneMapping=Mn$1,!0},this.hasRenderPass=function(){return E},this.end=function(w,M){w.toneMapping=y,g=!0;let A=o,b=a;for(let R=0;R<p.length;R++){let x=p[R];if(x.enabled!==!1&&(x.render(w,b,A,M),x.needsSwap!==!1)){let T=A;A=b,b=T}}if(u!==w.outputColorSpace||f!==w.toneMapping){u=w.outputColorSpace,f=w.toneMapping,c.defines={},ze.getTransfer(u)===Ze&&(c.defines.SRGB_TRANSFER=``);let R=$g[f];R&&(c.defines[R]=``),c.needsUpdate=!0}c.uniforms.tDiffuse.value=A.texture,w.setRenderTarget(m),w.render(h,d),m=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var Md=new an;var pc$1=new Xn$1(1,1);var Sd=new Qs$1;var bd=new wo$1;var Td=new lr;var nd$1=[];var id$1=[];var sd$1=new Float32Array(16);var rd$1=new Float32Array(9);var od$1=new Float32Array(4);function Ns$1(i,e,t){let n=i[0];if(n<=0||n>0)return i;let s=e*t,r=nd$1[s];if(r===void 0&&(r=new Float32Array(s),nd$1[s]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(r,a)}return r}function Tt$1(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function At$1(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Ba(i,e){let t=id$1[e];t===void 0&&(t=new Int32Array(e),id$1[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Qg(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function e0(i,e){let t=this.cache;
vendor: 13,337 bytes, lines 6622-6652
6622if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Tt$1(t,e))return;i.uniform2fv(this.addr,e),At$1(t,e)}}function t0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Tt$1(t,e))return;i.uniform3fv(this.addr,e),At$1(t,e)}}function n0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Tt$1(t,e))return;i.uniform4fv(this.addr,e),At$1(t,e)}}function i0(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Tt$1(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),At$1(t,e)}else{if(Tt$1(t,n))return;od$1.set(n),i.uniformMatrix2fv(this.addr,!1,od$1),At$1(t,n)}}function s0(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Tt$1(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),At$1(t,e)}else{if(Tt$1(t,n))return;rd$1.set(n),i.uniformMatrix3fv(this.addr,!1,rd$1),At$1(t,n)}}function r0(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Tt$1(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),At$1(t,e)}else{if(Tt$1(t,n))return;sd$1.set(n),i.uniformMatrix4fv(this.addr,!1,sd$1),At$1(t,n)}}function o0(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function a0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Tt$1(t,e))return;i.uniform2iv(this.addr,e),At$1(t,e)}}function l0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Tt$1(t,e))return;i.uniform3iv(this.addr,e),At$1(t,e)}}function c0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Tt$1(t,e))return;i.uniform4iv(this.addr,e),At$1(t,e)}}function h0(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function u0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Tt$1(t,e))return;i.uniform2uiv(this.addr,e),At$1(t,e)}}function d0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Tt$1(t,e))return;i.uniform3uiv(this.addr,e),At$1(t,e)}}function f0(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Tt$1(t,e))return;i.uniform4uiv(this.addr,e),At$1(t,e)}}function p0(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(pc$1.compareFunction=t.isReversedDepthBuffer()?Pa:Ia,r=pc$1):r=Md,t.setTexture2D(e||r,s)}function m0(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture3D(e||bd,s)}function g0(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTextureCube(e||Td,s)}function _0(i,e,t){let n=this.cache,s=t.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),t.setTexture2DArray(e||Sd,s)}function x0(i){switch(i){case 5126:return Qg;case 35664:return e0;case 35665:return t0;case 35666:return n0;case 35674:return i0;case 35675:return s0;case 35676:return r0;case 5124:case 35670:return o0;case 35667:case 35671:return a0;case 35668:case 35672:return l0;case 35669:case 35673:return c0;case 5125:return h0;case 36294:return u0;case 36295:return d0;case 36296:return f0;case 35678:case 36198:case 36298:case 36306:case 35682:return p0;case 35679:case 36299:case 36307:return m0;case 35680:case 36300:case 36308:case 36293:return g0;case 36289:case 36303:case 36311:case 36292:return _0}}function v0(i,e){i.uniform1fv(this.addr,e)}function y0(i,e){let t=Ns$1(e,this.size,2);i.uniform2fv(this.addr,t)}function M0(i,e){let t=Ns$1(e,this.size,3);i.uniform3fv(this.addr,t)}function S0(i,e){let t=Ns$1(e,this.size,4);i.uniform4fv(this.addr,t)}function b0(i,e){let t=Ns$1(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function T0(i,e){let t=Ns$1(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function A0(i,e){let t=Ns$1(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function E0(i,e){i.uniform1iv(this.addr,e)}function w0(i,e){i.uniform2iv(this.addr,e)}function R0(i,e){i.uniform3iv(this.addr,e)}function C0(i,e){i.uniform4iv(this.addr,e)}function I0(i,e){i.uniform1uiv(this.addr,e)}function P0(i,e){i.uniform2uiv(this.addr,e)}function L0(i,e){i.uniform3uiv(this.addr,e)}function N0(i,e){i.uniform4uiv(this.addr,e)}function D0(i,e,t){let n=this.cache,s=e.length,r=Ba(t,s);Tt$1(n,r)||(i.uniform1iv(this.addr,r),At$1(n,r));let o;this.type===i.SAMPLER_2D_SHADOW?o=pc$1:o=Md;for(let a=0;a!==s;++a)t.setTexture2D(e[a]||o,r[a])}function U0(i,e,t){let n=this.cache,s=e.length,r=Ba(t,s);Tt$1(n,r)||(i.uniform1iv(this.addr,r),At$1(n,r));for(let o=0;o!==s;++o)t.setTexture3D(e[o]||bd,r[o])}function F0(i,e,t){let n=this.cache,s=e.length,r=Ba(t,s);Tt$1(n,r)||(i.uniform1iv(this.addr,r),At$1(n,r));for(let o=0;o!==s;++o)t.setTextureCube(e[o]||Td,r[o])}function O0(i,e,t){let n=this.cache,s=e.length,r=Ba(t,s);Tt$1(n,r)||(i.uniform1iv(this.addr,r),At$1(n,r));for(let o=0;o!==s;++o)t.setTexture2DArray(e[o]||Sd,r[o])}function B0(i){switch(i){case 5126:return v0;case 35664:return y0;case 35665:return M0;case 35666:return S0;case 35674:return b0;case 35675:return T0;case 35676:return A0;case 5124:case 35670:return E0;case 35667:case 35671:return w0;case 35668:case 35672:return R0;case 35669:case 35673:return C0;case 5125:return I0;case 36294:return P0;case 36295:return L0;case 36296:return N0;case 35678:case 36198:case 36298:case 36306:case 35682:return D0;case 35679:case 36299:case 36307:return U0;case 35680:case 36300:case 36308:case 36293:return F0;case 36289:case 36303:case 36311:case 36292:return O0}}var mc$1=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=x0(t.type)}};var gc$1=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=B0(t.type)}};var _c$1=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let s=this.seq;for(let r=0,o=s.length;r!==o;++r){let a=s[r];a.setValue(e,t[a.id],n)}}};var dc$1=/(\w+)(\])?(\[|\.)?/g;function ad$1(i,e){i.seq.push(e),i.map[e.id]=e}function z0(i,e,t){let n=i.name,s=n.length;for(dc$1.lastIndex=0;;){let r=dc$1.exec(n),o=dc$1.lastIndex,a=r[1],l=r[2]===`]`,c=r[3];if(l&&(a=a|0),c===void 0||c===`[`&&o+2===s){ad$1(t,c===void 0?new mc$1(a,i,e):new gc$1(a,i,e));break}else{let d=t.map[a];d===void 0&&(d=new _c$1(a),ad$1(t,d)),t=d}}}var Ls$1=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o);z0(a,e.getUniformLocation(t,a.name),this)}let s=[],r=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?s.push(o):r.push(o);s.length>0&&(this.seq=s.concat(r))}setValue(e,t,n,s){let r=this.map[t];r!==void 0&&r.setValue(e,n,s)}setOptional(e,t,n){let s=t[n];s!==void 0&&this.setValue(e,n,s)}static upload(e,t,n,s){for(let r=0,o=t.length;r!==o;++r){let a=t[r],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,s)}}static seqWithValue(e,t){let n=[];for(let s=0,r=e.length;s!==r;++s){let o=e[s];o.id in t&&n.push(o)}return n}};function ld$1(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var k0=37297;var V0=0;function G0(i,e){let t=i.split(` 6623`),n=[],s=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let o=s;o<r;o++){let a=o+1;n.push(`${a===e?`>`:` `} ${a}: ${t[o]}`)}return n.join(` 6624`)}var cd$1=new Pe$1;function H0(i){ze._getMatrix(cd$1,ze.workingColorSpace,i);let e=`mat3( ${cd$1.elements.map(t=>t.toFixed(4))} )`;switch(ze.getTransfer(i)){case $s$1:return[e,`LinearTransferOETF`];case Ze:return[e,`sRGBTransferOETF`];default:return ye$2(`WebGLProgram: Unsupported color space: `,i),[e,`LinearTransferOETF`]}}function hd(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),r=(i.getShaderInfoLog(e)||``).trim();if(n&&r===``)return``;let o=/ERROR: 0:(\d+)/.exec(r);if(o){let a=parseInt(o[1]);return t.toUpperCase()+` 6625 6626`+r+` 6627 6628`+G0(i.getShaderSource(e),a)}else return r}function W0(i,e){let t=H0(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,`}`].join(` 6629`)}var X0={[Vl$1]:`Linear`,[Gl$1]:`Reinhard`,[Hl$1]:`Cineon`,[Wl$1]:`ACESFilmic`,[ql$1]:`AgX`,[Yl$1]:`Neutral`,[Xl$1]:`Custom`};function q0(i,e){let t=X0[e];return t===void 0?(ye$2(`WebGLProgram: Unsupported toneMapping:`,e),`vec3 `+i+`( vec3 color ) { return LinearToneMapping( color ); }`):`vec3 `+i+`( vec3 color ) { return `+t+`ToneMapping( color ); }`}var Na=new D$2;function Y0(){ze.getLuminanceCoefficients(Na);return[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${Na.x.toFixed(4)}, ${Na.y.toFixed(4)}, ${Na.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` 6630`)}function Z0(i){return[i.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,i.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(Lr$1).join(` 6631`)}function K0(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push(`#define `+t+` `+n)}return e.join(` 6632`)}function J0(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(e,s),o=r.name,a=1;r.type===i.FLOAT_MAT2&&(a=2),r.type===i.FLOAT_MAT3&&(a=3),r.type===i.FLOAT_MAT4&&(a=4),t[o]={type:r.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Lr$1(i){return i!==``}function ud(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function dd(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var $0=/^[ \t]*#include +<([\w\d./]+)>/gm;function xc$1(i){return i.replace($0,Q0)}var j0=new Map;function Q0(i,e){let t=Oe$1[e];if(t===void 0){let n=j0.get(e);if(n!==void 0)t=Oe$1[n],ye$2(`WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,e,n);else throw new Error(`THREE.WebGLProgram: Can not resolve #include <`+e+`>`)}return xc$1(t)}var e_=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function fd(i){return i.replace(e_,t_)}function t_(i,e,t,n){let s=``;for(let r=parseInt(e);r<parseInt(t);r++)s+=n.replace(/\[\s*i\s*\]/g,`[ `+r+` ]`).replace(/UNROLLED_LOOP_INDEX/g,r);return s}function pd$1(i){let e=`precision ${i.precision} float; 6633 precision ${i.precision} int; 6634 precision ${i.precision} sampler2D; 6635 precision ${i.precision} samplerCube; 6636 precision ${i.precision} sampler3D; 6637 precision ${i.precision} sampler2DArray; 6638 precision ${i.precision} sampler2DShadow; 6639 precision ${i.precision} samplerCubeShadow; 6640 precision ${i.precision} sampler2DArrayShadow; 6641 precision ${i.precision} isampler2D; 6642 precision ${i.precision} isampler3D; 6643 precision ${i.precision} isamplerCube; 6644 precision ${i.precision} isampler2DArray; 6645 precision ${i.precision} usampler2D; 6646 precision ${i.precision} usampler3D; 6647 precision ${i.precision} usamplerCube; 6648 precision ${i.precision} usampler2DArray; 6649 `;return i.precision===`highp`?e+=` 6650#define HIGH_PRECISION`:i.precision===`mediump`?e+=` 6651#define MEDIUM_PRECISION`:i.precision===`lowp`&&(e+=` 6652#define LOW_PRECISION`),e}var n_={[Mr$1]:`SHADOWMAP_TYPE_PCF`,[Es$1]:`SHADOWMAP_TYPE_VSM`};function i_(i){return n_[i.shadowMapType]||`SHADOWMAP_TYPE_BASIC`}var s_={[gi]:`ENVMAP_TYPE_CUBE`,[zi]:`ENVMAP_TYPE_CUBE`,[Sr$1]:`ENVMAP_TYPE_CUBE_UV`};function r_(i){return i.envMap===!1?`ENVMAP_TYPE_CUBE`:s_[i.envMapMode]||`ENVMAP_TYPE_CUBE`}var o_={[zi]:`ENVMAP_MODE_REFRACTION`};function a_(i){return i.envMap===!1?`ENVMAP_MODE_REFLECTION`:o_[i.envMapMode]||`ENVMAP_MODE_REFLECTION`}var l_={[kl$1]:`ENVMAP_BLENDING_MULTIPLY`,[Lu]:`ENVMAP_BLENDING_MIX`,[Nu]:`ENVMAP_BLENDING_ADD`};function c_(i){return i.envMap===!1?`ENVMAP_BLENDING_NONE`:l_[i.combine]||`ENVMAP_BLENDING_NONE`}function h_(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function u_(i,e,t,n){let s=i.getContext(),r=t.defines,o=t.vertexShader,a=t.fragmentShader,l=i_(t),c=r_(t),h=a_(t),d=c_(t),u=h_(t),f=Z0(t),g=K0(r),y=s.createProgram(),m,p,E=t.glslVersion?`#ver
6652sion `+t.glslVersion+` 6653`:``;t.isRawShaderMaterial?(m=[`#define SHADER_TYPE `+t.shaderType,`#define SHADER_NAME `+t.shaderName,g].filter(Lr$1).join(` 6654`),m.length>0&&(m+=` 6655`),p=[`#define SHADER_TYPE `+t.shaderType,`#define SHADER_NAME `+t.shaderName,g].filter(Lr$1).join(` 6656`),p.length>0&&(p+=` 6657`)):(m=[pd$1(t),`#define SHADER_TYPE `+t.shaderType,`#define SHADER_NAME `+t.shaderName,g,t.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,t.batching?`#define USE_BATCHING`:``,t.batchingColor?`#define USE_BATCHING_COLOR`:``,t.instancing?`#define USE_INSTANCING`:``,t.instancingColor?`#define USE_INSTANCING_COLOR`:``,t.instancingMorph?`#define USE_INSTANCING_MORPH`:``,t.useFog&&t.fog?`#define USE_FOG`:``,t.useFog&&t.fogExp2?`#define FOG_EXP2`:``,t.map?`#define USE_MAP`:``,t.envMap?`#define USE_ENVMAP`:``,t.envMap?`#define `+h:``,t.lightMap?`#define USE_LIGHTMAP`:``,t.aoMap?`#define USE_AOMAP`:``,t.bumpMap?`#define USE_BUMPMAP`:``,t.normalMap?`#define USE_NORMALMAP`:``,t.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,t.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,t.displacementMap?`#define USE_DISPLACEMENTMAP`:``,t.emissiveMap?`#define USE_EMISSIVEMAP`:``,t.anisotropy?`#define USE_ANISOTROPY`:``,t.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,t.clearcoatMap?`#define USE_CLEARCOATMAP`:``,t.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,t.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,t.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,t.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,t.specularMap?`#define USE_SPECULARMAP`:``,t.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,t.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,t.roughnessMap?`#define USE_ROUGHNESSMAP`:``,t.metalnessMap?`#define USE_METALNESSMAP`:``,t.alphaMap?`#define USE_ALPHAMAP`:``,t.alphaHash?`#define USE_ALPHAHASH`:``,t.transmission?`#define USE_TRANSMISSION`:``,t.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,t.thicknessMap?`#define USE_THICKNESSMAP`:``,t.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,t.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,t.mapUv?`#define MAP_UV `+t.mapUv:``,t.alphaMapUv?`#define ALPHAMAP_UV `+t.alphaMapUv:``,t.lightMapUv?`#define LIGHTMAP_UV `+t.lightMapUv:``,t.aoMapUv?`#define AOMAP_UV `+t.aoMapUv:``,t.emissiveMapUv?`#define EMISSIVEMAP_UV `+t.emissiveMapUv:``,t.bumpMapUv?`#define BUMPMAP_UV `+t.bumpMapUv:``,t.normalMapUv?`#define NORMALMAP_UV `+t.normalMapUv:``,t.displacementMapUv?`#define DISPLACEMENTMAP_UV `+t.displacementMapUv:``,t.metalnessMapUv?`#define METALNESSMAP_UV `+t.metalnessMapUv:``,t.roughnessMapUv?`#define ROUGHNESSMAP_UV `+t.roughnessMapUv:``,t.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+t.anisotropyMapUv:``,t.clearcoatMapUv?`#define CLEARCOATMAP_UV `+t.clearcoatMapUv:``,t.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+t.clearcoatNormalMapUv:``,t.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+t.clearcoatRoughnessMapUv:``,t.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+t.iridescenceMapUv:``,t.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+t.iridescenceThicknessMapUv:``,t.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+t.sheenColorMapUv:``,t.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+t.sheenRoughnessMapUv:``,t.specularMapUv?`#define SPECULARMAP_UV `+t.specularMapUv:``,t.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+t.specularColorMapUv:``,t.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+t.specularIntensityMapUv:``,t.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+t.transmissionMapUv:``,t.thicknessMapUv?`#define THICKNESSMAP_UV `+t.thicknessMapUv:``,t.vertexTangents&&t.flatShading===!1?`#define USE_TANGENT`:``,t.vertexNormals?`#define HAS_NORMAL`:``,t.vertexColors?`#define USE_COLOR`:``,t.vertexAlphas?`#define USE_COLOR_ALPHA`:``,t.vertexUv1s?`#define USE_UV1`:``,t.vertexUv2s?`#define USE_UV2`:``,t.vertexUv3s?`#define USE_UV3`:``,t.pointsUvs?`#define USE_POINTS_UV`:``,t.flatShading?`#define FLAT_SHADED`:``,t.skinning?`#define USE_SKINNING`:``,t.morphTargets?`#define USE_MORPHTARGETS`:``,t.morphNormals&&t.flatShading===!1?`#define USE_MORPHNORMALS`:``,t.morphColors?`#define USE_MORPHCOLORS`:``,t.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+t.morphTextureStride:``,t.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+t.morphTargetsCount:``,t.doubleSided?`#define DOUBLE_SIDED`:``,t.flipSided?`#define FLIP_SIDED`:``,t.shadowMapEnabled?`#define USE_SHADOWMAP`:``,t.shadowMapEnabled?`#define `+l:``,t.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,t.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,t.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,t.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` 6658`].filter(Lr$1).join(` 6659`),p=[pd$1(t),`#define SHADER_TYPE `+t.shaderType,`#define SHADER_NAME `+t.shaderName,g,t.useFog&&t.fog?`#define USE_FOG`:``,t.useFog&&t.fogExp2?`#define FOG_EXP2`:``,t.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,t.map?`#define USE_MAP`:``,t.matcap?`#define USE_MATCAP`:``,t.envMap?`#define USE_ENVMAP`:``,t.envMap?`#define `+c:``,t.envMap?`#define `+h:``,t.envMap?`#define `+d:``,u?`#define CUBEUV_TEXEL_WIDTH `+u.texelWidth:``,u?`#define CUBEUV_TEXEL_HEIGHT `+u.texelHeight:``,u?`#define CUBEUV_MAX_MIP `+u.maxMip+`.0`:``,t.lightMap?`#define USE_LIGHTMAP`:``,t.aoMap?`#define USE_AOMAP`:``,t.bumpMap?`#define USE_BUMPMAP`:``,t.normalMap?`#define USE_NORMALMAP`:``,t.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,t.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,t.packedNormalMap?`#define USE_PACKED_NORMALMAP`:``,t.emissiveMap?`#define USE_EMISSIVEMAP`:``,t.anisotropy?`#define USE_ANISOTROPY`:``,t.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,t.clearcoat?`#define USE_CLEARCOAT`:``,t.clearcoatMap?`#define USE_CLEARCOATMAP`:``,t.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,t.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,t.dispersion?`#define USE_DISPERSION`:``,t.iridescence?`#define USE_IR
6659IDESCENCE`:``,t.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,t.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,t.specularMap?`#define USE_SPECULARMAP`:``,t.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,t.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,t.roughnessMap?`#define USE_ROUGHNESSMAP`:``,t.metalnessMap?`#define USE_METALNESSMAP`:``,t.alphaMap?`#define USE_ALPHAMAP`:``,t.alphaTest?`#define USE_ALPHATEST`:``,t.alphaHash?`#define USE_ALPHAHASH`:``,t.sheen?`#define USE_SHEEN`:``,t.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,t.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,t.transmission?`#define USE_TRANSMISSION`:``,t.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,t.thicknessMap?`#define USE_THICKNESSMAP`:``,t.vertexTangents&&t.flatShading===!1?`#define USE_TANGENT`:``,t.vertexColors||t.instancingColor?`#define USE_COLOR`:``,t.vertexAlphas||t.batchingColor?`#define USE_COLOR_ALPHA`:``,t.vertexUv1s?`#define USE_UV1`:``,t.vertexUv2s?`#define USE_UV2`:``,t.vertexUv3s?`#define USE_UV3`:``,t.pointsUvs?`#define USE_POINTS_UV`:``,t.gradientMap?`#define USE_GRADIENTMAP`:``,t.flatShading?`#define FLAT_SHADED`:``,t.doubleSided?`#define DOUBLE_SIDED`:``,t.flipSided?`#define FLIP_SIDED`:``,t.shadowMapEnabled?`#define USE_SHADOWMAP`:``,t.shadowMapEnabled?`#define `+l:``,t.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,t.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,t.numLightProbeGrids>0?`#define USE_LIGHT_PROBES_GRID`:``,t.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,t.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,t.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,t.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,t.toneMapping!==Mn$1?`#define TONE_MAPPING`:``,t.toneMapping!==Mn$1?Oe$1.tonemapping_pars_fragment:``,t.toneMapping!==Mn$1?q0(`toneMapping`,t.toneMapping):``,t.dithering?`#define DITHERING`:``,t.opaque?`#define OPAQUE`:``,Oe$1.colorspace_pars_fragment,W0(`linearToOutputTexel`,t.outputColorSpace),Y0(),t.useDepthPacking?`#define DEPTH_PACKING `+t.depthPacking:``,` 6660`].filter(Lr$1).join(` 6661`)),o=xc$1(o),o=ud(o,t),o=dd(o,t),a=xc$1(a),a=ud(a,t),a=dd(a,t),o=fd(o),a=fd(a),t.isRawShaderMaterial!==!0&&(E=`#version 300 es 6662`,m=[f,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` 6663`)+` 6664`+m,p=[`#define varying in`,t.glslVersion===tc$1?``:`layout(location = 0) out highp vec4 pc_fragColor;`,t.glslVersion===tc$1?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` 6665`)+` 6666`+p);let w=E+m+o,M=E+p+a,A=ld$1(s,s.VERTEX_SHADER,w),b=ld$1(s,s.FRAGMENT_SHADER,M);s.attachShader(y,A),s.attachShader(y,b),t.index0AttributeName!==void 0?s.bindAttribLocation(y,0,t.index0AttributeName):t.hasPositionAttribute===!0&&s.bindAttribLocation(y,0,`position`),s.linkProgram(y);function R(C){if(i.debug.checkShaderErrors){let F=s.getProgramInfoLog(y)||``,X=s.getShaderInfoLog(A)||``,$=s.getShaderInfoLog(b)||``,O=F.trim(),q=X.trim(),V=$.trim(),J=!0,Q=!0;if(s.getProgramParameter(y,s.LINK_STATUS)===!1)if(J=!1,typeof i.debug.onShaderError==`function`)i.debug.onShaderError(s,y,A,b);else{let he=hd(s,A,`vertex`),pe=hd(s,b,`fragment`);Ce$1(`WebGLProgram: Shader Error `+s.getError()+` - VALIDATE_STATUS `+s.getProgramParameter(y,s.VALIDATE_STATUS)+` 6667 6668Material Name: `+C.name+` 6669Material Type: `+C.type+` 6670 6671Program Info Log: `+O+` 6672`+he+` 6673`+pe)}else O!==``?ye$2(`WebGLProgram: Program Info Log:`,O):(q===``||V===``)&&(Q=!1);Q&&(C.diagnostics={runnable:J,programLog:O,vertexShader:{log:q,prefix:m},fragmentShader:{log:V,prefix:p}})}s.deleteShader(A),s.deleteShader(b),x=new Ls$1(s,y),T=J0(s,y)}let x;this.getUniforms=function(){return x===void 0&&R(this),x};let T;this.getAttributes=function(){return T===void 0&&R(this),T};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=s.getProgramParameter(y,k0)),L},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=V0++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=A,this.fragmentShader=b,this}var d_=0;var vc$1=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let s=this._getShaderCacheForMaterial(e);return s.has(t)===!1&&(s.add(t),t.usedTimes++),s.has(n)===!1&&(s.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new yc$1(e),t.set(e,n)),n}};var yc$1=class{constructor(e){this.id=d_++,this.code=e,this.usedTimes=0}};function f_(i){return i===xi||i===wr$1||i===Rr$1}function p_(i,e,t,n,s,r){let o=new ms$1,a=new vc$1,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer,u=n.precision,f={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distance`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function g(x){return l.add(x),x===0?`uv`:`uv${x}`}function y(x,T,L,C,F,X){let $=C.fog,O=F.geometry,q=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?C.environment:null,V=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,J=e.get(x.envMap||q,V),Q=J&&J.mapping===Sr$1?J.image.height:null,he=f[x.t
vendor: 11,413 bytes, line 6673
6673ype];x.precision!==null&&(u=n.getMaxPrecision(x.precision),u!==x.precision&&ye$2(`WebGLProgram.getParameters:`,x.precision,`not supported, using`,u,`instead.`));let pe=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,_e=pe!==void 0?pe.length:0,Xe=0;O.morphAttributes.position!==void 0&&(Xe=1),O.morphAttributes.normal!==void 0&&(Xe=2),O.morphAttributes.color!==void 0&&(Xe=3);let rt,qe,K,ie;if(he){let xe=Fn[he];rt=xe.vertexShader,qe=xe.fragmentShader}else{rt=x.vertexShader,qe=x.fragmentShader;let xe=a.getVertexShaderStage(x),at=a.getFragmentShaderStage(x);a.update(x,xe,at),K=xe.id,ie=at.id}let ee=i.getRenderTarget(),Ie=i.state.buffers.depth.getReversed(),Ne=F.isInstancedMesh===!0,we=F.isBatchedMesh===!0,ht=!!x.map,Ge=!!x.matcap,Qe=!!J,Ye=!!x.aoMap,He=!!x.lightMap,_t=!!x.bumpMap&&x.wireframe===!1,St=!!x.normalMap,Et=!!x.displacementMap,Rt=!!x.emissiveMap,ot=!!x.metalnessMap,xt=!!x.roughnessMap,P=x.anisotropy>0,kt=x.clearcoat>0,Ke=x.dispersion>0,S=x.iridescence>0,_=x.sheen>0,U=x.transmission>0,k=P&&!!x.anisotropyMap,H=kt&&!!x.clearcoatMap,te=kt&&!!x.clearcoatNormalMap,se=kt&&!!x.clearcoatRoughnessMap,W=S&&!!x.iridescenceMap,Z=S&&!!x.iridescenceThicknessMap,re=_&&!!x.sheenColorMap,Se=_&&!!x.sheenRoughnessMap,le=!!x.specularMap,oe=!!x.specularColorMap,Ee=!!x.specularIntensityMap,Re=U&&!!x.transmissionMap,De=U&&!!x.thicknessMap,I=!!x.gradientMap,ne=!!x.alphaMap,Y=x.alphaTest>0,ae=!!x.alphaHash,fe=!!x.extensions,j=Mn$1;x.toneMapped&&(ee===null||ee.isXRRenderTarget===!0)&&(j=i.toneMapping);let Me={shaderID:he,shaderType:x.type,shaderName:x.name,vertexShader:rt,fragmentShader:qe,defines:x.defines,customVertexShaderID:K,customFragmentShaderID:ie,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:u,batching:we,batchingColor:we&&F._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&F.instanceColor!==null,instancingMorph:Ne&&F.morphTexture!==null,outputColorSpace:ee===null?i.outputColorSpace:ee.isXRRenderTarget===!0?ee.texture.colorSpace:ze.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:ht,matcap:Ge,envMap:Qe,envMapMode:Qe&&J.mapping,envMapCubeUVHeight:Q,aoMap:Ye,lightMap:He,bumpMap:_t,normalMap:St,displacementMap:Et,emissiveMap:Rt,normalMapObjectSpace:St&&x.normalMapType===Ou,normalMapTangentSpace:St&&x.normalMapType===Ca,packedNormalMap:St&&x.normalMapType===Ca&&f_(x.normalMap.format),metalnessMap:ot,roughnessMap:xt,anisotropy:P,anisotropyMap:k,clearcoat:kt,clearcoatMap:H,clearcoatNormalMap:te,clearcoatRoughnessMap:se,dispersion:Ke,iridescence:S,iridescenceMap:W,iridescenceThicknessMap:Z,sheen:_,sheenColorMap:re,sheenRoughnessMap:Se,specularMap:le,specularColorMap:oe,specularIntensityMap:Ee,transmission:U,transmissionMap:Re,thicknessMap:De,gradientMap:I,opaque:x.transparent===!1&&x.blending===Pi&&x.alphaToCoverage===!1,alphaMap:ne,alphaTest:Y,alphaHash:ae,combine:x.combine,mapUv:ht&&g(x.map.channel),aoMapUv:Ye&&g(x.aoMap.channel),lightMapUv:He&&g(x.lightMap.channel),bumpMapUv:_t&&g(x.bumpMap.channel),normalMapUv:St&&g(x.normalMap.channel),displacementMapUv:Et&&g(x.displacementMap.channel),emissiveMapUv:Rt&&g(x.emissiveMap.channel),metalnessMapUv:ot&&g(x.metalnessMap.channel),roughnessMapUv:xt&&g(x.roughnessMap.channel),anisotropyMapUv:k&&g(x.anisotropyMap.channel),clearcoatMapUv:H&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:te&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:se&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:Z&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:re&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:Se&&g(x.sheenRoughnessMap.channel),specularMapUv:le&&g(x.specularMap.channel),specularColorMapUv:oe&&g(x.specularColorMap.channel),specularIntensityMapUv:Ee&&g(x.specularIntensityMap.channel),transmissionMapUv:Re&&g(x.transmissionMap.channel),thicknessMapUv:De&&g(x.thicknessMap.channel),alphaMapUv:ne&&g(x.alphaMap.channel),vertexTangents:!!O.attributes.tangent&&(St||P),vertexNormals:!!O.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!O.attributes.uv&&(ht||ne),fog:!!$,useFog:x.fog===!0,fogExp2:!!$&&$.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||O.attributes.normal===void 0&&St===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:Ie,skinning:F.isSkinnedMesh===!0,hasPositionAttribute:O.attributes.position!==void 0,morphTargets:O.morphAttributes.position!==void 0,morphNormals:O.morphAttributes.normal!==void 0,morphColors:O.morphAttributes.color!==void 0,morphTargetsCount:_e,morphTextureStride:Xe,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numLightProbeGrids:X.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:x.dithering,shadowMapEnabled:i.shadowMap.enabled&&L.length>0,shadowMapType:i.shadowMap.type,toneMapping:j,decodeVideoTexture:ht&&x.map.isVideoTexture===!0&&ze.getTransfer(x.map.colorSpace)===Ze,decodeVideoTextureEmissive:Rt&&x.emissiveMap.isVideoTexture===!0&&ze.getTransfer(x.emissiveMap.colorSpace)===Ze,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===un$2,flipSided:x.side===zt$1,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:fe&&x.extensions.clipCullDistance===!0&&t.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(fe&&x.extensions.multiDraw===!0||we)&&t.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:t.has(`KHR_parallel_shader_compile`),customProgramCacheKey:x.customProgramCacheKey()};return Me.vertexUv1s=l.has(1),Me.vertexUv2s=l.has(2),Me.vertexUv3s=l.has(3),l.clear(),Me}function m(x){let T=[];if(x.shaderID?T.push(x.shaderID):(T.push(x.customVertexShaderID),T.push(x.customFragmentShaderID)),x.defines!==void 0)for(let L in x.defines)T.push(L),T.push(x.defines[L]);return x.isRawShaderMaterial===!1&&(p(T,x),E(T,x),T.push(i.outputColorSpace)),T.push(x.customProgramCacheKey),T.join()}function p(x,T){x.push(T.precision),x.push(T.outputColorSpace),x.push(T.envMapMode),x.push(T.envMapCubeUVHeight),x.push(T.mapUv),x.push(T.alphaMapUv),x.push(T.lightMapUv),x.push(T.aoMapUv),x.push(T.bumpMapUv),x.push(T.normalMapUv),x.push(T.displacementMapUv),x.push(T.emissiveMapUv),x.push(T.metalnessMapUv),x.push(T.roughnessMapUv),x.push(T.anisotropyMapUv),x.push(T.clearcoatMapUv),x.push(T.clearcoatNormalMapUv),x.push(T.clearcoatRoughnessMapUv),x.push(T.iridescenceMapUv),x.push(T.iridescenceThicknessMapUv),x.push(T.sheenColorMapUv),x.push(T.sheenRoughnessMapUv),x.push(T.specularMapUv),x.push(T.specularColorMapUv),x.push(T.specularIntensityMapUv),x.push(T.transmissionMapUv),x.push(T.thicknessMapUv),x.push(T.combine),x.push(T.fogExp2),x.push(T.sizeAttenuation),x.push(T.morphTargetsCount),x.push(T.morphAttributeCount),x.push(T.numDirLights),x.push(T.numPointLights),x.push(T.numSpotLights),x.push(T.numSpotLightMaps),x.push(T.numHemiLights),x.push(T.numRectAreaLights),x.push(T.numDirLightShadows),x.push(T.numPointLightShadows),x.push(T.numSpotLightShadows),x.push(T.numSpotLightShadowsWithMaps),x.push(T.numLightProbes),x.push(T.shadowMapType),x.push(T.toneMapping),x.push(T.numClippingPlanes),x.push(T.numClipIntersection),x.push(T.depthPacking)}function E(x,T){o.disableAll(),T.instancing&&o.enable(0),T.instancingColor&&o.enable(1),T.instancingMorph&&o.enable(2),T.matcap&&o.enable(3),T.envMap&&o.enable(4),T.normalMapObjectSpace&&o.enable(5),T.normalMapTangentSpace&&o.enable(6),T.clearcoat&&o.enable(7),T.iridescence&&o.enable(8),T.alphaTest&&o.enable(9),T.vertexColors&&o.enable(10),T.vertexAlphas&&o.enable(11),T.vertexUv1s&&o.enable(12),T.vertexUv2s&&o.enable(13),T.vertexUv3s&&o.enable(14),T.vertexTangents&&o.enable(15),T.anisotropy&&o.enable(16),T.alphaHash&&o.enable(17),T.batching&&o.enable(18),T.dispersion&&o.enable(19),T.batchingColor&&o.enable(20),T.gradientMap&&o.enable(21),T.packedNormalMap&&o.enable(22),T.vertexNormals&&o.enable(23),x.push(o.mask),o.disableAll(),T.fog&&o.enable(0),T.useFog&&o.enable(1),T.flatShading&&o.enable(2),T.logarithmicDepthBuffer&&o.enable(3),T.reversedDepthBuffer&&o.enable(4),T.skinning&&o.enable(5),T.morphTargets&&o.enable(6),T.morphNormals&&o.enable(7),T.morphColors&&o.enable(8),T.premultipliedAlpha&&o.enable(9),T.shadowMapEnabled&&o.enable(10),T.doubleSided&&o.enable(11),T.flipSided&&o.enable(12),T.useDepthPacking&&o.enable(13),T.dithering&&o.enable(14),T.transmission&&o.enable(15),T.sheen&&o.enable(16),T.opaque&&o.enable(17),T.pointsUvs&&o.enable(18),T.decodeVideoTexture&&o.enable(19),T.decodeVideoTextureEmissive&&o.enable(20),T.alphaToCoverage&&o.enable(21),T.numLightProbeGrids>0&&o.enable(22),T.hasPositionAttribute&&o.enable(23),x.push(o.mask)}function w(x){let T=f[x.type],L;if(T){let C=Fn[T];L=Ku.clone(C.uniforms)}else L=x.uniforms;return L}function M(x,T){let L=h.get(T);return L!==void 0?++L.usedTimes:(L=new u_(i,T,x,s),c.push(L),h.set(T,L)),L}function A(x){if(--x.usedTimes===0){let T=c.indexOf(x);c[T]=c[c.length-1],c.pop(),h.delete(x.cacheKey),x.destroy()}}function b(x){a.remove(x)}function R(){a.dispose()}return{getParameters:y,getProgramCacheKey:m,getUniforms:w,acquireProgram:M,releaseProgram:A,releaseShaderCache:b,programs:c,dispose:R}}function m_(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function s(o,a,l){i.get(o)[a]=l}function r(){i=new WeakMap}return{has:e,get:t,remove:n,update:s,dispose:r}}function g_(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function md(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function gd(){let i=[],e=0,t=[],n=[],s=[];function r(){e=0,t.length=0,n.length=0,s.length=0}function o(u){let f=0;return u.isInstancedMesh&&(f+=2),u.isSkinnedMesh&&(f+=1),f}function a(u,f,g,y,m,p){let E=i[e];return E===void 0?(E={id:u.id,object:u,geometry:f,material:g,materialVariant:o(u),groupOrder:y,renderOrder:u.renderOrder,z:m,group:p},i[e]=E):(E.id=u.id,E.object=u,E.geometry=f,E.material=g,E.materialVariant=o(u),E.groupOrder=y,E.renderOrder=u.renderOrder,E.z=m,E.group=p),e++,E}function l(u,f,g,y,m,p){let E=a(u,f,g,y,m,p);g.transmission>0?n.push(E):g.transparent===!0?s.push(E):t.push(E)}function c(u,f,g,y,m,p){let E=a(u,f,g,y,m,p);g.transmission>0?n.unshift(E):g.transparent===!0?s.unshift(E):t.unshift(E)}function h(u,f,g){t.length>1&&t.sort(u||g_),n.length>1&&n.sort(f||md),s.length>1&&s.sort(f||md),g&&(t.reverse(),n.reverse(),s.reverse())}function d(){for(let u=e,f=i.length;u<f;u++){let g=i[u];
vendor: 4,159 bytes, line 6673
6673if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:s,init:r,push:l,unshift:c,finish:d,sort:h}}function __(){let i=new WeakMap;function e(n,s){let r=i.get(n),o;return r===void 0?(o=new gd,i.set(n,[o])):s>=r.length?(o=new gd,r.push(o)):o=r[s],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function x_(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case`DirectionalLight`:t={direction:new D$2,color:new Ae$1};break;case`SpotLight`:t={position:new D$2,direction:new D$2,color:new Ae$1,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:t={position:new D$2,color:new Ae$1,distance:0,decay:0};break;case`HemisphereLight`:t={direction:new D$2,skyColor:new Ae$1,groundColor:new Ae$1};break;case`RectAreaLight`:t={color:new Ae$1,position:new D$2,halfWidth:new D$2,halfHeight:new D$2};break}return i[e.id]=t,t}}}function v_(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case`DirectionalLight`:t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe$1};break;case`SpotLight`:t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe$1};break;case`PointLight`:t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe$1,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var y_=0;function M_(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function S_(i){let e=new x_,t=v_(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new D$2);let s=new D$2,r=new Le,o=new Le;function a(c){let h=0,d=0,u=0;for(let T=0;T<9;T++)n.probe[T].set(0,0,0);let f=0,g=0,y=0,m=0,p=0,E=0,w=0,M=0,A=0,b=0,R=0;c.sort(M_);for(let T=0,L=c.length;T<L;T++){let C=c[T],F=C.color,X=C.intensity,$=C.distance,O=null;if(C.shadow&&C.shadow.map&&(C.shadow.map.texture.format===xi?O=C.shadow.map.texture:O=C.shadow.map.depthTexture||C.shadow.map.texture),C.isAmbientLight)h+=F.r*X,d+=F.g*X,u+=F.b*X;else if(C.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(C.sh.coefficients[q],X);R++}else if(C.isDirectionalLight){let q=e.get(C);if(q.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let V=C.shadow,J=t.get(C);J.shadowIntensity=V.intensity,J.shadowBias=V.bias,J.shadowNormalBias=V.normalBias,J.shadowRadius=V.radius,J.shadowMapSize=V.mapSize,n.directionalShadow[f]=J,n.directionalShadowMap[f]=O,n.directionalShadowMatrix[f]=C.shadow.matrix,E++}n.directional[f]=q,f++}else if(C.isSpotLight){let q=e.get(C);q.position.setFromMatrixPosition(C.matrixWorld),q.color.copy(F).multiplyScalar(X),q.distance=$,q.coneCos=Math.cos(C.angle),q.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),q.decay=C.decay,n.spot[y]=q;let V=C.shadow;if(C.map&&(n.spotLightMap[A]=C.map,A++,V.updateMatrices(C),C.castShadow&&b++),n.spotLightMatrix[y]=V.matrix,C.castShadow){let J=t.get(C);J.shadowIntensity=V.intensity,J.shadowBias=V.bias,J.shadowNormalBias=V.normalBias,J.shadowRadius=V.radius,J.shadowMapSize=V.mapSize,n.spotShadow[y]=J,n.spotShadowMap[y]=O,M++}y++}else if(C.isRectAreaLight){let q=e.get(C);q.color.copy(F).multiplyScalar(X),q.halfWidth.set(C.width*.5,0,0),q.halfHeight.set(0,C.height*.5,0),n.rectArea[m]=q,m++}else if(C.isPointLight){let q=e.get(C);if(q.color.copy(C.color).multiplyScalar(C.intensity),q.distance=C.distance,q.decay=C.decay,C.castShadow){let V=C.shadow,J=t.get(C);J.shadowIntensity=V.intensity,J.shadowBias=V.bias,J.shadowNormalBias=V.normalBias,J.shadowRadius=V.radius,J.shadowMapSize=V.mapSize,J.shadowCameraNear=V.
vendor: 54,013 bytes, lines 6673-6700
6673camera.near,J.shadowCameraFar=V.camera.far,n.pointShadow[g]=J,n.pointShadowMap[g]=O,n.pointShadowMatrix[g]=C.shadow.matrix,w++}n.point[g]=q,g++}else if(C.isHemisphereLight){let q=e.get(C);q.skyColor.copy(C.color).multiplyScalar(X),q.groundColor.copy(C.groundColor).multiplyScalar(X),n.hemi[p]=q,p++}}m>0&&(i.has(`OES_texture_float_linear`)===!0?(n.rectAreaLTC1=ce$1.LTC_FLOAT_1,n.rectAreaLTC2=ce$1.LTC_FLOAT_2):(n.rectAreaLTC1=ce$1.LTC_HALF_1,n.rectAreaLTC2=ce$1.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;let x=n.hash;(x.directionalLength!==f||x.pointLength!==g||x.spotLength!==y||x.rectAreaLength!==m||x.hemiLength!==p||x.numDirectionalShadows!==E||x.numPointShadows!==w||x.numSpotShadows!==M||x.numSpotMaps!==A||x.numLightProbes!==R)&&(n.directional.length=f,n.spot.length=y,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=w,n.pointShadowMap.length=w,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=w,n.spotLightMatrix.length=M+A-b,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=R,x.directionalLength=f,x.pointLength=g,x.spotLength=y,x.rectAreaLength=m,x.hemiLength=p,x.numDirectionalShadows=E,x.numPointShadows=w,x.numSpotShadows=M,x.numSpotMaps=A,x.numLightProbes=R,n.version=y_++)}function l(c,h){let d=0,u=0,f=0,g=0,y=0,m=h.matrixWorldInverse;for(let p=0,E=c.length;p<E;p++){let w=c[p];if(w.isDirectionalLight){let M=n.directional[d];M.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(m),d++}else if(w.isSpotLight){let M=n.spot[f];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(m),f++}else if(w.isRectAreaLight){let M=n.rectArea[g];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),o.identity(),r.copy(w.matrixWorld),r.premultiply(m),o.extractRotation(r),M.halfWidth.set(w.width*.5,0,0),M.halfHeight.set(0,w.height*.5,0),M.halfWidth.applyMatrix4(o),M.halfHeight.applyMatrix4(o),g++}else if(w.isPointLight){let M=n.point[u];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),u++}else if(w.isHemisphereLight){let M=n.hemi[y];M.direction.setFromMatrixPosition(w.matrixWorld),M.direction.transformDirection(m),y++}}}return{setup:a,setupView:l,state:n}}function _d(i){let e=new S_(i),t=[],n=[],s=[];function r(u){d.camera=u,t.length=0,n.length=0,s.length=0}function o(u){t.push(u)}function a(u){n.push(u)}function l(u){s.push(u)}function c(){e.setup(t)}function h(u){e.setupView(t,u)}let d={lightsArray:t,shadowsArray:n,lightProbeGridArray:s,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:d,setupLights:c,setupLightsView:h,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function b_(i){let e=new WeakMap;function t(s,r=0){let o=e.get(s),a;return o===void 0?(a=new _d(i),e.set(s,[a])):r>=o.length?(a=new _d(i),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var T_=`void main() { 6674 gl_Position = vec4( position, 1.0 ); 6675}`;var A_=`uniform sampler2D shadow_pass; 6676uniform vec2 resolution; 6677uniform float radius; 6678void main() { 6679 const float samples = float( VSM_SAMPLES ); 6680 float mean = 0.0; 6681 float squared_mean = 0.0; 6682 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 6683 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 6684 for ( float i = 0.0; i < samples; i ++ ) { 6685 float uvOffset = uvStart + i * uvStride; 6686 #ifdef HORIZONTAL_PASS 6687 vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; 6688 mean += distribution.x; 6689 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 6690 #else 6691 float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; 6692 mean += depth; 6693 squared_mean += depth * depth; 6694 #endif 6695 } 6696 mean = mean / samples; 6697 squared_mean = squared_mean / samples; 6698 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); 6699 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); 6700}`;var E_=[new D$2(1,0,0),new D$2(-1,0,0),new D$2(0,1,0),new D$2(0,-1,0),new D$2(0,0,1),new D$2(0,0,-1)];var w_=[new D$2(0,-1,0),new D$2(0,-1,0),new D$2(0,0,1),new D$2(0,0,-1),new D$2(0,-1,0),new D$2(0,-1,0)];var xd=new Le;var Pr$1=new D$2;var fc$1=new D$2;function R_(i,e,t){let n=new Ms$1,s=new Fe$1,r=new Fe$1,o=new $e,a=new Lo$1,l=new No$1,c={},h=t.maxTextureSize,d={[vn]:zt$1,[zt$1]:vn,[un$2]:un$2},u=new sn$1({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fe$1},radius:{value:4}},vertexShader:T_,fragmentShader:A_}),f=u.clone();f.defines.HORIZONTAL_PASS=1;let g=new Bt$1;g.setAttribute(`position`,new ct$2(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new Mt$2(g,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Mr$1;let p=this.type;this.render=function(b,R,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||b.length===0)return;this.type===fu&&(ye$2(`WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead.`),this.type=Mr$1);let T=i.getRenderTarget(),L=i.getActiveCubeFace(),C=i.getActiveMipmapLevel(),F=i.state;F.setBlending(Nn$1),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);let X=p!==this.type;X&&R.traverse(function($){$.material&&(Array.isArray($.material)?$.material.forEach(O=>O.needsUpdate=!0):$.material.needsUpdate=!0)});for(let $=0,O=b.length;$<O;$++){let q=b[$],V=q.shadow;if(V===void 0){ye$2(`WebGLShadowMap:`,q,`has no shadow.`);continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;s.copy(V.mapSize);let J=V.getFrameExtents();s.multiply(J),r.copy(V.mapSize),(s.x>h||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/J.x),s.x=r.x*J.x,V.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/J.y),s.y=r.y*J.y,V.mapSize.y=r.y));let Q=i.state.buffers.depth.getReversed();if(V.camera._reversedDepth=Q,V.map===null||X===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===Es$1){if(q.isPointLight){ye$2(`WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.`);continue}V.map=new tn(s.x,s.y,{format:xi,type:Dn,minFilter:mt$2,magFilter:mt$2,generateMipmaps:!1}),V.map.texture.name=q.name+`.shadowMap`,V.map.depthTexture=new Xn$1(s.x,s.y,rn$1),V.map.depthTexture.name=q.name+`.shadowMapDepth`,V.map.depthTexture.format=In$1,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=pt$1,V.map.depthTexture.magFilter=pt$1}else q.isPointLight?(V.map=new Ua(s.x),V.map.depthTexture=new Io$1(s.x,bn$1)):(V.map=new tn(s.x,s.y),V.map.depthTexture=new Xn$1(s.x,s.y,bn$1)),V.map.depthTexture.name=q.name+`.shadowMap`,V.map.depthTexture.format=In$1,this.type===Mr$1?(V.map.depthTexture.compareFunction=Q?Pa:Ia,V.map.depthTexture.minFilter=mt$2,V.map.depthTexture.magFilter=mt$2):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=pt$1,V.map.depthTexture.magFilter=pt$1);V.camera.updateProjectionMatrix()}let he=V.map.isWebGLCubeRenderTarget?6:1;for(let pe=0;pe<he;pe++){if(V.map.isWebGLCubeRenderTarget)i.setRenderTarget(V.map,pe),i.clear();else{pe===0&&(i.setRenderTarget(V.map),i.clear());let _e=V.getViewport(pe);o.set(r.x*_e.x,r.y*_e.y,r.x*_e.z,r.y*_e.w),F.viewport(o)}if(q.isPointLight){let _e=V.camera,Xe=V.matrix,rt=q.distance||_e.far;rt!==_e.far&&(_e.far=rt,_e.updateProjectionMatrix()),Pr$1.setFromMatrixPosition(q.matrixWorld),_e.position.copy(Pr$1),fc$1.copy(_e.position),fc$1.add(E_[pe]),_e.up.copy(w_[pe]),_e.lookAt(fc$1),_e.updateMatrixWorld(),Xe.makeTranslation(-Pr$1.x,-Pr$1.y,-Pr$1.z),xd.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),V._frustum.setFromProjectionMatrix(xd,_e.coordinateSystem,_e.reversedDepth)}else V.updateMatrices(q);n=V.getFrustum(),M(R,x,V.camera,q,this.type)}V.isPointLightShadow!==!0&&this.type===Es$1&&E(V,x),V.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(T,L,C)};function E(b,R){let x=e.update(y);u.defines.VSM_SAMPLES!==b.blurSamples&&(u.defines.VSM_SAMPLES=b.blurSamples,f.defines.VSM_SAMPLES=b.blurSamples,u.needsUpdate=!0,f.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new tn(s.x,s.y,{format:xi,type:Dn})),u.uniforms.shadow_pass.value=b.map.depthTexture,u.uniforms.resolution.value=b.mapSize,u.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(R,null,x,u,y,null),f.uniforms.shadow_pass.value=b.mapPass.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(R,null,x,f,y,null)}function w(b,R,x,T){let L=null,C=x.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0)L=C;else if(L=x.isPointLight===!0?l:a,i.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){let F=L.uuid,X=R.uuid,$=c[F];$===void 0&&($={},c[F]=$);let O=$[X];O===void 0&&(O=L.clone(),$[X]=O,R.addEventListener(`dispose`,A)),L=O}if(L.visible=R.visible,L.wireframe=R.wireframe,T===Es$1?L.side=R.shadowSide!==null?R.shadowSide:R.side:L.side=R.shadowSide!==null?R.shadowSide:d[R.side],L.alphaMap=R.alphaMap,L.alphaTest=R.alphaToCoverage===!0?.5:R.alphaTest,L.map=R.map,L.clipShadows=R.clipShadows,L.clippingPlanes=R.clippingPlanes,L.clipIntersection=R.clipIntersection,L.displacementMap=R.displacementMap,L.displacementScale=R.displacementScale,L.displacementBias=R.displacementBias,L.wireframeLinewidth=R.wireframeLinewidth,L.linewidth=R.linewidth,x.isPointLight===!0&&L.isMeshDistanceMaterial===!0){let F=i.properties.get(L);F.light=x}return L}function M(b,R,x,T,L){if(b.visible===!1)return;if(b.layers.test(R.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&L===Es$1)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,b.matrixWorld);let X=e.update(b),$=b.material;if(Array.isArray($)){let O=X.groups;for(let q=0,V=O.length;q<V;q++){let J=O[q],Q=$[J.materialIndex];if(Q&&Q.visible){let he=w(b,Q,T,L);b.onBeforeShadow(i,b,R,x,X,he,J),i.renderBufferDirect(x,null,X,he,b,J),b.onAfterShadow(i,b,R,x,X,he,J)}}}else if($.visible){let O=w(b,$,T,L);b.onBeforeShadow(i,b,R,x,X,O,null),i.renderBufferDirect(x,null,X,O,b,null),b.onAfterShadow(i,b,R,x,X,O,null)}}let F=b.children;for(let X=0,$=F.length;X<$;X++)M(F[X],R,x,T,L)}function A(b){b.target.removeEventListener(`dispose`,A);for(let x in c){let T=c[x],L=b.target.uuid;L in T&&(T[L].dispose(),delete T[L])}}}function C_(i,e){function t(){let I=!1,ne=new $e,Y=null,ae=new $e(0,0,0,0);return{setMask:function(fe){Y!==fe&&!I&&(i.colorMask(fe,fe,fe,fe),Y=fe)},setLocked:function(fe){I=fe},setClear:function(fe,j,Me,xe,at){at===!0&&(fe*=xe,j*=xe,Me*=xe),ne.set(fe,j,Me,xe),ae.equals(ne)===!1&&(i.clearColor(fe,j,Me,xe),ae.copy(ne))},reset:function(){I=!1,Y=null,ae.set(-1,0,0,0)}}}function n(){let I=!1,ne=!1,Y=null,ae=null,fe=null;return{setReversed:function(j){if(ne!==j){let Me=e.get(`EXT_clip_control`);j?Me.clipControlEXT(Me.LOWER_LEFT_EXT,Me.ZERO_TO_ONE_EXT):Me.clipControlEXT(Me.LOWER_LEFT_EXT,Me.NEGATIVE_ONE_TO_ONE_EXT),ne=j;let xe=fe;fe=null,this.setClear(xe)}},getReversed:function(){return ne},setTest:function(j){j?ee(i.DEPTH_TEST):Ie(i.DEPTH_TEST)},setMask:function(j){Y!==j&&!I&&(i.depthMask(j),Y=j)},setFunc:function(j){if(ne&&(j=Yu[j]),ae!==j){switch(j){case _o:i.depthFunc(i.NEVER);break;case xo:i.depthFunc(i.ALWAYS);break;case vo:i.depthFunc(i.LESS);break;case Li:i.depthFunc(i.LEQUAL);break;case yo$1:i.depthFunc(i.EQUAL);break;case Mo$1:i.depthFunc(i.GEQUAL);break;case So$1:i.depthFunc(i.GREATER);break;case bo$1:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}ae=j}},setLocked:function(j){I=j},setClear:function(j){fe!==j&&(fe=j,ne&&(j=1-j),i.clearDepth(j))},reset:function(){I=!1,Y=null,ae=null,fe=null,ne=!1}}}function s(){let I=!1,ne=null,Y=null,ae=null,fe=null,j=null,Me=null,xe=null,at=null;return{setTest:function(nt){I||(nt?ee(i.STENCIL_TEST):Ie(i.STENCIL_TEST))},setMask:function(nt){ne!==nt&&!I&&(i.stencilMask(nt),ne=nt)},setFunc:function(nt,Tn,An){(Y!==nt||ae!==Tn||fe!==An)&&(i.stencilFunc(nt,Tn,An),Y=nt,ae=Tn,fe=An)},setOp:function(nt,Tn,An){(j!==nt||Me!==Tn||xe!==An)&&(i.stencilOp(nt,Tn,An),j=nt,Me=Tn,xe=An)},setLocked:function(nt){I=nt},setClear:function(nt){at!==nt&&(i.clearStencil(nt),at=nt)},reset:function(){I=!1,ne=null,Y=null,ae=null,fe=null,j=null,Me=null,xe=null,at=null}}}let r=new t,o=new n,a=new s,l=new WeakMap,c=new WeakMap,h={},d={},u={},f=new WeakMap,g=[],y=null,m=!1,p=null,E=null,w=null,M=null,A=null,b=null,R=null,x=new Ae$1(0,0,0),T=0,L=!1,C=null,F=null,X=null,$=null,O=null,q=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),V=!1,J=0,Q=i.getParameter(i.VERSION);Q.indexOf(`WebGL`)!==-1?(J=parseFloat(/^WebGL (\d)/.exec(Q)[1]),V=J>=1):Q.indexOf(`OpenGL ES`)!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),V=J>=2);let he=null,pe={},_e=i.getParameter(i.SCISSOR_BOX),Xe=i.getParameter(i.VIEWPORT),rt=new $e().fromArray(_e),qe=new $e().fromArray(Xe);function K(I,ne,Y,ae){let fe=new Uint8Array(4),j=i.createTexture();i.bindTexture(I,j),i.texParameteri(I,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(I,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Me=0;Me<Y;Me++)I===i.TEXTURE_3D||I===i.TEXTURE_2D_ARRAY?i.texImage3D(ne,0,i.RGBA,1,1,ae,0,i.RGBA,i.UNSIGNED_BYTE,fe):i.texImage2D(ne+Me,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,fe);return j}let ie={};ie[i.TEXTURE_2D]=K(i.TEXTURE_2D,i.TEXTURE_2D,1),ie[i.TEXTURE_CUBE_MAP]=K(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[i.TEXTURE_2D_ARRAY]=K(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ie[i.TEXTURE_3D]=K(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ee(i.DEPTH_TEST),o.setFunc(Li),_t(!1),St(Fl$1),ee(i.CULL_FACE),Ye(Nn$1);function ee(I){h[I]!==!0&&(i.enable(I),h[I]=!0)}function Ie(I){h[I]!==!1&&(i.disable(I),h[I]=!1)}function Ne(I,ne){return u[I]!==ne?(i.bindFramebuffer(I,ne),u[I]=ne,I===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=ne),I===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=ne),!0):!1}function we(I,ne){let Y=g,ae=!1;if(I){Y=f.get(ne),Y===void 0&&(Y=[],f.set(ne,Y));let fe=I.textures;if(Y.length!==fe.length||Y[0]!==i.COLOR_ATTACHMENT0){for(let j=0,Me=fe.length;j<Me;j++)Y[j]=i.COLOR_ATTACHMENT0+j;Y.length=fe.length,ae=!0}}else Y[0]!==i.BACK&&(Y[0]=i.BACK,ae=!0);ae&&i.drawBuffers(Y)}function ht(I){return y!==I?(i.useProgram(I),y=I,!0):!1}let Ge={[hi]:i.FUNC_ADD,[mu]:i.FUNC_SUBTRACT,[gu]:i.FUNC_REVERSE_SUBTRACT};Ge[_u]=i.MIN,Ge[xu]=i.MAX;let Qe={[vu]:i.ZERO,[yu]:i.ONE,[Mu]:i.SRC_COLOR,[mo]:i.SRC_ALPHA,[wu]:i.SRC_ALPHA_SATURATE,[Au]:i.DST_COLOR,[bu]:i.DST_ALPHA,[Su]:i.ONE_MINUS_SRC_COLOR,[go]:i.ONE_MINUS_SRC_ALPHA,[Eu]:i.ONE_MINUS_DST_COLOR,[Tu]:i.ONE_MINUS_DST_ALPHA,[Ru]:i.CONSTANT_COLOR,[Cu]:i.ONE_MINUS_CONSTANT_COLOR,[Iu]:i.CONSTANT_ALPHA,[Pu]:i.ONE_MINUS_CONSTANT_ALPHA};function Ye(I,ne,Y,ae,fe,j,Me,xe,at,nt){if(I===Nn$1){m===!0&&(Ie(i.BLEND),m=!1);return}if(m===!1&&(ee(i.BLEND),m=!0),I!==pu){if(I!==p||nt!==L){if((E!==hi||A!==hi)&&(i.blendEquation(i.FUNC_ADD),E=hi,A=hi),nt)switch(I){case Pi:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ol$1:i.blendFunc(i.ONE,i.ONE);break;case Bl$1:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case zl$1:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ce$1(`WebGLState: Invalid blending: `,I);break}else switch(I){case Pi:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Ol$1:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Bl$1:Ce$1(`WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true`);break;case zl$1:Ce$1(`WebGLState: MultiplyBlending requires material.premultipliedAlpha = true`);break;default:Ce$1(`WebGLState: Invalid blending: `,I);break}w=null,M=null,b=null,R=null,x.set(0,0,0),T=0,p=I,L=nt}return}fe=fe||ne,j=j||Y,Me=Me||ae,(ne!==E||fe!==A)&&(i.blendEquationSeparate(Ge[ne],Ge[fe]),E=ne,A=fe),(Y!==w||ae!==M||j!==b||Me!==R)&&(i.blendFuncSeparate(Qe[Y],Qe[ae],Qe[j],Qe[Me]),w=Y,M=ae,b=j,R=Me),(xe.equals(x)===!1||at!==T)&&(i.blendColor(xe.r,xe.g,xe.b,at),x.copy(xe),T=at),p=I,L=!1}function He(I,ne){I.side===un$2?Ie(i.CULL_FACE):ee(i.CULL_FACE);let Y=I.side===zt$1;ne&&(Y=!Y),_t(Y),I.blending===Pi&&I.transparent===!1?Ye(Nn$1):Ye(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),o.setFunc(I.depthFunc),o.setTest(I.depthTest),o.setMask(I.depthWrite),r.setMask(I.colorWrite);let ae=I.stencilWrite;a.setTest(ae),ae&&(a.setMask(I.stencilWriteMask),a.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),a.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),Rt(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?ee(i.SAMPLE_ALPHA_TO_COVERAGE):Ie(i.SAMPLE_ALPHA_TO_COVERAGE)}function _t(I){C!==I&&(I?i.frontFace(i.CW):i.frontFace(i.CCW),C=I)}function St(I){I!==uu?(ee(i.CULL_FACE),I!==F&&(I===Fl$1?i.cullFace(i.BACK):I===du?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Ie(i.CULL_FACE),F=I}function Et(I){I!==X&&(V&&i.lineWidth(I),X=I)}function Rt(I,ne,Y){I?(ee(i.POLYGON_OFFSET_FILL),($!==ne||O!==Y)&&($=ne,O=Y,o.getReversed()&&(ne=-ne),i.polygonOffset(ne,Y))):Ie(i.POLYGON_OFFSET_FILL)}function ot(I){I?ee(i.SCISSOR_TEST):Ie(i.SCISSOR_TEST)}function xt(I){I===void 0&&(I=i.TEXTURE0+q-1),he!==I&&(i.activeTexture(I),he=I)}function P(I,ne,Y){Y===void 0&&(he===null?Y=i.TEXTURE0+q-1:Y=he);let ae=pe[Y];ae===void 0&&(ae={type:void 0,texture:void 0},pe[Y]=ae),(ae.type!==I||ae.texture!==ne)&&(he!==Y&&(i.activeTexture(Y),he=Y),i.bindTexture(I,ne||ie[I]),ae.type=I,ae.texture=ne)}function kt(){let I=pe[he];I!==void 0&&I.type!==void 0&&(i.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function Ke(){try{i.compressedTexImage2D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function S(){try{i.compressedTexImage3D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function _(){try{i.texSubImage2D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function U(){try{i.texSubImage3D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function k(){try{i.compressedTexSubImage2D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function H(){try{i.compressedTexSubImage3D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function te(){try{i.texStorage2D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function se(){try{i.texStorage3D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function W(){try{i.texImage2D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function Z(){try{i.texImage3D(...arguments)}catch(I){Ce$1(`WebGLState:`,I)}}function re(I){return d[I]!==void 0?d[I]:i.getParameter(I)}function Se(I,ne){d[I]!==ne&&(i.pixelStorei(I,ne),d[I]=ne)}function le(I){rt.equals(I)===!1&&(i.scissor(I.x,I.y,I.z,I.w),rt.copy(I))}function oe(I){qe.equals(I)===!1&&(i.viewport(I.x,I.y,I.z,I.w),qe.copy(I))}function Ee(I,ne){let Y=c.get(ne);Y===void 0&&(Y=new WeakMap,c.set(ne,Y));let ae=Y.get(I);ae===void 0&&(ae=i.getUniformBlockIndex(ne,I.name),Y.set(I,ae))}function Re(I,ne){let ae=c.get(ne).get(I);l.get(ne)!==ae&&(i.uniformBlockBinding(ne,ae,I.__bindingPointIndex),l.set(ne,ae))}function De(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),h={},d={},he=null,pe={},u={},f=new WeakMap,g=[],y=null,m=!1,p=null,E=null,w=null,M=null,A=null,b=null,R=null,x=new Ae$1(0,0,0),T=0,L=!1,C=null,F=null,X=null,$=null,O=null,rt.set(0,0,i.canvas.width,i.canvas.height),qe.set(0,0,i.canvas.width,i.canvas.height),r.reset(),o.reset(),a.reset()}return{buffers:{color:r,depth:o,stencil:a},enable:ee,disable:Ie,bindFramebuffer:Ne,drawBuffers:we,useProgram:ht,setBlending:Ye,setMaterial:He,setFlipSided:_t,setCullFace:St,setLineWidth:Et,setPolygonOffset:Rt,setScissorTest:ot,activeTexture:xt,bindTexture:P,unbindTexture:kt,compressedTexImage2D:Ke,compressedTexImage3D:S,texImage2D:W,texImage3D:Z,pixelStorei:Se,getParameter:re,updateUBOMapping:Ee,uniformBlockBinding:Re,texStorage2D:te,texStorage3D:se,texSubImage2D:_,texSubImage3D:U,compressedTexSubImage2D:k,compressedTexSubImage3D:H,scissor:le,viewport:oe,reset:De}}function I_(i,e,t,n,s,r,o){let a=e.has(`WEBGL_multisampled_render_to_texture`)?e.get(`WEBGL_multisampled_render_to_texture`):null,l=typeof navigator>`u`?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Fe$1,h=new WeakMap,d=new Set,u,f=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch(S){}function y(S,_){return g?new OffscreenCanvas(S,_):us$1(`canvas`)}function m(S,_,U){let k=1,H=Ke(S);if((H.width>U||H.height>U)&&(k=U/Math.max(H.width,H.height)),k<1)if(typeof HTMLImageElement<`u`&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&S instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&S instanceof ImageBitmap||typeof VideoFrame<`u`&&S instanceof VideoFrame){let te=Math.floor(k*H.width),se=Math.floor(k*H.height);u===void 0&&(u=y(te,se));let W=_?y(te,se):u;return W.width=te,W.height=se,W.getContext(`2d`).drawImage(S,0,0,te,se),ye$2(`WebGLRenderer: Texture has been resized from (`+H.width+`x`+H.height+`) to (`+te+`x`+se+`).`),W}else return`data`in S&&ye$2(`WebGLRenderer: Image in DataTexture is too big (`+H.width+`x`+H.height+`).`),S;return S}function p(S){return S.generateMipmaps}function E(S){i.generateMipmap(S)}function w(S){return S.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?i.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(S,_,U,k,H,te=!1){if(S!==null){if(i[S]!==void 0)return i[S];ye$2(`WebGLRenderer: Attempt to use non-existing WebGL internal format '`+S+`'`)}let se;k&&(se=e.get(`EXT_texture_norm16`),se||ye$2(`WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension`));let W=_;if(_===i.RED&&(U===i.FLOAT&&(W=i.R32F),U===i.HALF_FLOAT&&(W=i.R16F),U===i.UNSIGNED_BYTE&&(W=i.R8),U===i.UNSIGNED_SHORT&&se&&(W=se.R16_EXT),U===i.SHORT&&se&&(W=se.R16_SNORM_EXT)),_===i.RED_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.R8UI),U===i.UNSIGNED_SHORT&&(W=i.R16UI),U===i.UNSIGNED_INT&&(W=i.R32UI),U===i.BYTE&&(W=i.R8I),U===i.SHORT&&(W=i.R16I),U===i.INT&&(W=i.R32I)),_===i.RG&&(U===i.FLOAT&&(W=i.RG32F),U===i.HALF_FLOAT&&(W=i.RG16F),U===i.UNSIGNED_BYTE&&(W=i.RG8),U===i.UNSIGNED_SHORT&&se&&(W=se.RG16_EXT),U===i.SHORT&&se&&(W=se.RG16_SNORM_EXT)),_===i.RG_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.RG8UI),U===i.UNSIGNED_SHORT&&(W=i.RG16UI),U===i.UNSIGNED_INT&&(W=i.RG32UI),U===i.BYTE&&(W=i.RG8I),U===i.SHORT&&(W=i.RG16I),U===i.INT&&(W=i.RG32I)),_===i.RGB_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.RGB8UI),U===i.UNSIGNED_SHORT&&(W=i.RGB16UI),U===i.UNSIGNED_INT&&(W=i.RGB32UI),U===i.BYTE&&(W=i.RGB8I),U===i.SHORT&&(W=i.RGB16I),U===i.INT&&(W=i.RGB32I)),_===i.RGBA_INTEGER&&(U===i.UNSIGNED_BYTE&&(W=i.RGBA8UI),U===i.UNSIGNED_SHORT&&(W=i.RGBA16UI),U===i.UNSIGNED_INT&&(W=i.RGBA32UI),U===i.BYTE&&(W=i.RGBA8I),U===i.SHORT&&(W=i.RGBA16I),U===i.INT&&(W=i.RGBA32I)),_===i.RGB&&(U===i.UNSIGNED_SHORT&&se&&(W=se.RGB16_EXT),U===i.SHORT&&se&&(W=se.RGB16_SNORM_EXT),U===i.UNSIGNED_INT_5_9_9_9_REV&&(W=i.RGB9_E5),U===i.UNSIGNED_INT_10F_11F_11F_REV&&(W=i.R11F_G11F_B10F)),_===i.RGBA){let Z=te?$s$1:ze.getTransfer(H);U===i.FLOAT&&(W=i.RGBA32F),U===i.HALF_FLOAT&&(W=i.RGBA16F),U===i.UNSIGNED_BYTE&&(W=Z===Ze?i.SRGB8_ALPHA8:i.RGBA8),U===i.UNSIGNED_SHORT&&se&&(W=se.RGBA16_EXT),U===i.SHORT&&se&&(W=se.RGBA16_SNORM_EXT),U===i.UNSIGNED_SHORT_4_4_4_4&&(W=i.RGBA4),U===i.UNSIGNED_SHORT_5_5_5_1&&(W=i.RGB5_A1)}return(W===i.R16F||W===i.R32F||W===i.RG16F||W===i.RG32F||W===i.RGBA16F||W===i.RGBA32F)&&e.get(`EXT_color_buffer_float`),W}function A(S,_){let U;return S?_===null||_===bn$1||_===Cs$1?U=i.DEPTH24_STENCIL8:_===rn$1?U=i.DEPTH32F_STENCIL8:_===Rs$1&&(U=i.DEPTH24_STENCIL8,ye$2(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):_===null||_===bn$1||_===Cs$1?U=i.DEPTH_COMPONENT24:_===rn$1?U=i.DEPTH_COMPONENT32F:_===Rs$1&&(U=i.DEPTH_COMPONENT16),U}function b(S,_){return p(S)===!0||S.isFramebufferTexture&&S.minFilter!==pt$1&&S.minFilter!==mt$2?Math.log2(Math.max(_.width,_.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?_.mipmaps.length:1}function R(S){let _=S.target;_.removeEventListener(`dispose`,R),T(_),_.isVideoTexture&&h.delete(_),_.isHTMLTexture&&d.delete(_)}function x(S){let _=S.target;_.removeEventListener(`dispose`,x),C(_)}function T(S){let _=n.get(S);if(_.__webglInit===void 0)return;let U=S.source,k=f.get(U);if(k){let H=k[_.__cacheKey];H.usedTimes--,H.usedTimes===0&&L(S),Object.keys(k).length===0&&f.delete(U)}n.remove(S)}function L(S){let _=n.get(S);i.deleteTexture(_.__webglTexture);let U=S.source,k=f.get(U);delete k[_.__cacheKey],o.memory.textures--}function C(S){let _=n.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),n.remove(S.depthTexture)),S.isWebGLCubeRenderTarget)for(let k=0;k<6;k++){if(Array.isArray(_.__webglFramebuffer[k]))for(let H=0;H<_.__webglFramebuffer[k].length;H++)i.deleteFramebuffer(_.__webglFramebuffer[k][H]);else i.deleteFramebuffer(_.__webglFramebuffer[k]);_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer[k])}else{if(Array.isArray(_.__webglFramebuffer))for(let k=0;k<_.__webglFramebuffer.length;k++)i.deleteFramebuffer(_.__webglFramebuffer[k]);else i.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&i.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&i.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let k=0;k<_.__webglColorRenderbuffer.length;k++)_.__webglColorRenderbuffer[k]&&i.deleteRenderbuffer(_.__webglColorRenderbuffer[k]);_.__webglDepthRenderbuffer&&i.deleteRenderbuffer(_.__webglDepthRenderbuffer)}let U=S.textures;for(let k=0,H=U.length;k<H;k++){let te=n.get(U[k]);te.__webglTexture&&(i.deleteTexture(te.__webglTexture),o.memory.textures--),n.remove(U[k])}n.remove(S)}let F=0;function X(){F=0}function $(){return F}function O(S){F=S}function q(){let S=F;return S>=s.maxTextures&&ye$2(`WebGLTextures: Trying to use `+S+` texture units while this GPU supports only `+s.maxTextures),F+=1,S}function V(S){let _=[];return _.push(S.wrapS),_.push(S.wrapT),_.push(S.wrapR||0),_.push(S.magFilter),_.push(S.minFilter),_.push(S.anisotropy),_.push(S.internalFormat),_.push(S.format),_.push(S.type),_.push(S.generateMipmaps),_.push(S.premultiplyAlpha),_.push(S.flipY),_.push(S.unpackAlignment),_.push(S.colorSpace),_.join()}function J(S,_){let U=n.get(S);if(S.isVideoTexture&&P(S),S.isRenderTargetTexture===!1&&S.isExternalTexture!==!0&&S.version>0&&U.__version!==S.version){let k=S.image;if(k===null)ye$2(`WebGLRenderer: Texture marked for update but no image data found.`);else if(k.complete===!1)ye$2(`WebGLRenderer: Texture marked for update but image is incomplete`);else{Ie(U,S,_);return}}else S.isExternalTexture&&(U.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,U.__webglTexture,i.TEXTURE0+_)}function Q(S,_){let U=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&U.__version!==S.version){Ie(U,S,_);return}else S.isExternalTexture&&(U.__webglTexture=S.sourceTexture?S.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,U.__webglTexture,i.TEXTURE0+_)}function he(S,_){let U=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&U.__version!==S.version){Ie(U,S,_);return}t.bindTexture(i.TEXTURE_3D,U.__webglTexture,i.TEXTURE0+_)}function pe(S,_){let U=n.get(S);if(S.isCubeDepthTexture!==!0&&S.version>0&&U.__version!==S.version){Ne(U,S,_);return}t.bindTexture(i.TEXTURE_CUBE_MAP,U.__webglTexture,i.TEXTURE0+_)}let _e={[ui]:i.REPEAT,[hn$1]:i.CLAMP_TO_EDGE,[cs$1]:i.MIRRORED_REPEAT},Xe={[pt$1]:i.NEAREST,[Xo$1]:i.NEAREST_MIPMAP_NEAREST,[ki]:i.NEAREST_MIPMAP_LINEAR,[mt$2]:i.LINEAR,[ws$1]:i.LINEAR_MIPMAP_NEAREST,[Sn$1]:i.LINEAR_MIPMAP_LINEAR},rt={[Bu]:i.NEVER,[Hu]:i.ALWAYS,[zu]:i.LESS,[Ia]:i.LEQUAL,[ku]:i.EQUAL,[Pa]:i.GEQUAL,[Vu]:i.GREATER,[Gu]:i.NOTEQUAL};function qe(S,_){if(_.type===rn$1&&e.has(`OES_texture_float_linear`)===!1&&(_.magFilter===mt$2||_.magFilter===ws$1||_.magFilter===ki||_.magFilter===Sn$1||_.minFilter===mt$2||_.minFilter===ws$1||_.minFilter===ki||_.minFilter===Sn$1)&&ye$2(`WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),i.texParameteri(S,i.TEXTURE_WRAP_S,_e[_.wrapS]),i.texParameteri(S,i.TEXTURE_WRAP_T,_e[_.wrapT]),(S===i.TEXTURE_3D||S===i.TEXTURE_2D_ARRAY)&&i.texParameteri(S,i.TEXTURE_WRAP_R,_e[_.wrapR]),i.texParameteri(S,i.TEXTURE_MAG_FILTER,Xe[_.magFilter]),i.texParameteri(S,i.TEXTURE_MIN_FILTER,Xe[_.minFilter]),_.compareFunction&&(i.texParameteri(S,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(S,i.TEXTURE_COMPARE_FUNC,rt[_.compareFunction])),e.has(`EXT_texture_filter_anisotropic`)===!0){if(_.magFilter===pt$1||_.minFilter!==ki&&_.minFilter!==Sn$1||_.type===rn$1&&e.has(`OES_texture_float_linear`)===!1)return;if(_.anisotropy>1||n.get(_).__currentAnisotropy){let U=e.get(`EXT_texture_filter_anisotropic`);i.texParameterf(S,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,s.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy}}}function K(S,_){let U=!1;S.__webglInit===void 0&&(S.__webglInit=!0,_.addEventListener(`dispose`,R));let k=_.source,H=f.get(k);H===void 0&&(H={},f.set(k,H));let te=V(_);if(te!==S.__cacheKey){H[te]===void 0&&(H[te]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,U=!0),H[te].usedTimes++;let se=H[S.__cacheKey];se!==void 0&&(H[S.__cacheKey].usedTimes--,se.usedTimes===0&&L(_)),S.__cacheKey=te,S.__webglTexture=H[te].texture}return U}function ie(S,_,U){return Math.floor(Math.floor(S/U)/_)}function ee(S,_,U,k){let te=S.updateRanges;if(te.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,_.width,_.height,U,k,_.data);else{te.sort((Se,le)=>Se.start-le.start);let se=0;for(let Se=1;Se<te.length;Se++){let le=te[se],oe=te[Se],Ee=le.start+le.count,Re=ie(oe.start,_.width,4),De=ie(le.start,_.width,4);oe.start<=Ee+1&&Re===De&&ie(oe.start+oe.count-1,_.width,4)===Re?le.count=Math.max(le.count,oe.start+oe.count-le.start):(++se,te[se]=oe)}te.length=se+1;let W=t.getParameter(i.UNPACK_ROW_LENGTH),Z=t.getParameter(i.UNPACK_SKIP_PIXELS),re=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,_.width);for(let Se=0,le=te.length;Se<le;Se++){let oe=te[Se],Ee=Math.floor(oe.start/4),Re=Math.ceil(oe.count/4),De=Ee%_.width,I=Math.floor(Ee/_.width),ne=Re;t.pixelStorei(i.UNPACK_SKIP_PIXELS,De),t.pixelStorei(i.UNPACK_SKIP_ROWS,I),t.texSubImage2D(i.TEXTURE_2D,0,De,I,ne,1,U,k,_.data)}S.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,W),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Z),t.pixelStorei(i.UNPACK_SKIP_ROWS,re)}}function Ie(S,_,U){let k=i.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(k=i.TEXTURE_2D_ARRAY),_.isData3DTexture&&(k=i.TEXTURE_3D);let H=K(S,_),te=_.source;t.bindTexture(k,S.__webglTexture,i.TEXTURE0+U);let se=n.get(te);if(te.version!==se.__version||H===!0){if(t.activeTexture(i.TEXTURE0+U),(typeof ImageBitmap<`u`&&_.image instanceof ImageBitmap)===!1){let Y=ze.getPrimaries(ze.workingColorSpace),ae=_.colorSpace===Qn?null:ze.getPrimaries(_.colorSpace),fe=_.colorSpace===Qn||Y===ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,fe)}t.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment);let Z=m(_.image,!1,s.maxTextureSize);Z=kt(_,Z);let re=r.convert(_.format,_.colorSpace),Se=r.convert(_.type),le=M(_.internalFormat,re,Se,_.normalized,_.colorSpace,_.isVideoTexture);qe(k,_);let oe,Ee=_.mipmaps,Re=_.isVideoTexture!==!0,De=se.__version===void 0||H===!0,I=te.dataReady,ne=b(_,Z);if(_.isDepthTexture)le=A(_.format===_i,_.type),De&&(Re?t.texStorage2D(i.TEXTURE_2D,1,le,Z.width,Z.height):t.texImage2D(i.TEXTURE_2D,0,le,Z.width,Z.height,0,re,Se,null));else if(_.isDataTexture)if(Ee.length>0){Re&&De&&t.texStorage2D(i.TEXTURE_2D,ne,le,Ee[0].width,Ee[0].height);for(let Y=0,ae=Ee.length;Y<ae;Y++)oe=Ee[Y],Re?I&&t.texSubImage2D(i.TEXTURE_2D,Y,0,0,oe.width,oe.height,re,Se,oe.data):t.texImage2D(i.TEXTURE_2D,Y,le,oe.width,oe.height,0,re,Se,oe.data);_.generateMipmaps=!1}else Re?(De&&t.texStorage2D(i.TEXTURE_2D,ne,le,Z.width,Z.height),I&&ee(_,Z,re,Se)):t.texImage2D(i.TEXTURE_2D,0,le,Z.width,Z.height,0,re,Se,Z.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){Re&&De&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,le,Ee[0].width,Ee[0].height,Z.depth);for(let Y=0,ae=Ee.length;Y<ae;Y++)if(oe=Ee[Y],_.format!==on$1)if(re!==null)if(Re){if(I)if(_.layerUpdates.size>0){let fe=ac$1(oe.width,oe.height,_.format,_.type);for(let j of _.layerUpdates){let Me=oe.data.subarray(j*fe/oe.data.BYTES_PER_ELEMENT,(j+1)*fe/oe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Y,0,0,j,oe.width,oe.height,1,re,Me)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Y,0,0,0,oe.width,oe.height,Z.depth,re,oe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Y,le,oe.width,oe.height,Z.depth,0,oe.data,0,0);else ye$2(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else Re?I&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Y,0,0,0,oe.width,oe.height,Z.depth,re,Se,oe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Y,le,oe.width,oe.height,Z.depth,0,re,Se,oe.data)}else{Re&&De&&t.texStorage2D(i.TEXTURE_2D,ne,le,Ee[0].width,Ee[0].height);for(let Y=0,ae=Ee.length;Y<ae;Y++)oe=Ee[Y],_.format!==on$1?re!==null?Re?I&&t.compressedTexSubImage2D(i.TEXTURE_2D,Y,0,0,oe.width,oe.height,re,oe.data):t.compressedTexImage2D(i.TEXTURE_2D,Y,le,oe.width,oe.height,0,oe.data):ye$2(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):Re?I&&t.texSubImage2D(i.TEXTURE_2D,Y,0,0,oe.width,oe.height,re,Se,oe.data):t.texImage2D(i.TEXTURE_2D,Y,le,oe.width,oe.height,0,re,Se,oe.data)}else if(_.isDataArrayTexture)if(Re){if(De&&t.texStorage3D(i.TEXTURE_2D_ARRAY,ne,le,Z.width,Z.height,Z.depth),I)if(_.layerUpdates.size>0){let Y=ac$1(Z.width,Z.height,_.format,_.type);for(let ae of _.layerUpdates){let fe=Z.data.subarray(ae*Y/Z.data.BYTES_PER_ELEMENT,(ae+1)*Y/Z.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ae,Z.width,Z.height,1,re,Se,fe)}_.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Z.width,Z.height,Z.depth,re,Se,Z.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,le,Z.width,Z.height,Z.depth,0,re,Se,Z.data);else if(_.isData3DTexture)Re?(De&&t.texStorage3D(i.TEXTURE_3D,ne,le,Z.width,Z.height,Z.depth),I&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Z.width,Z.height,Z.depth,re,Se,Z.data)):t.texImage3D(i.TEXTURE_3D,0,le,Z.width,Z.height,Z.depth,0,re,Se,Z.data);else if(_.isFramebufferTexture){if(De)if(Re)t.texStorage2D(i.TEXTURE_2D,ne,le,Z.width,Z.height);else{let Y=Z.width,ae=Z.height;for(let fe=0;fe<ne;fe++)t.texImage2D(i.TEXTURE_2D,fe,le,Y,ae,0,re,Se,null),Y>>=1,ae>>=1}}else if(_.isHTMLTexture){if(`texElementImage2D`in i){let Y=i.canvas;if(Y.hasAttribute(`layoutsubtree`)||Y.setAttribute(`layoutsubtree`,`true`),Z.parentNode!==Y){Y.appendChild(Z),d.add(_),Y.onpaint=ae=>{let fe=ae.changedElements;for(let j of d)fe.includes(j.image)&&(j.needsUpdate=!0)},Y.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Z);else{let fe=i.RGBA,j=i.RGBA,Me=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,fe,j,Me,Z)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Ee.length>0){if(Re&&De){let Y=Ke(Ee[0]);t.texStorage2D(i.TEXTURE_2D,ne,le,Y.width,Y.height)}for(let Y=0,ae=Ee.length;Y<ae;Y++)oe=Ee[Y],Re?I&&t.texSubImage2D(i.TEXTURE_2D,Y,0,0,re,Se,oe):t.texImage2D(i.TEXTURE_2D,Y,le,re,Se,oe);_.generateMipmaps=!1}else if(Re){if(De){let Y=Ke(Z);t.texStorage2D(i.TEXTURE_2D,ne,le,Y.width,Y.height)}I&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,re,Se,Z)}else t.texImage2D(i.TEXTURE_2D,0,le,re,Se,Z);p(_)&&E(k),se.__version=te.version,_.onUpdate&&_.onUpdate(_)}S.__version=_.version}function Ne(S,_,U){if(_.image.length!==6)return;let k=K(S,_),H=_.source;t.bindTexture(i.TEXTURE_CUBE_MAP,S.__webglTexture,i.TEXTURE0+U);let te=n.get(H);if(H.version!==te.__version||k===!0){t.activeTexture(i.TEXTURE0+U);let se=ze.getPrimaries(ze.workingColorSpace),W=_.colorSpace===Qn?null:ze.getPrimaries(_.colorSpace),Z=_.colorSpace===Qn||se===W?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,_.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,_.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Z);let re=_.isCompressedTexture||_.image[0].isCompressedTexture,Se=_.image[0]&&_.image[0].isDataTexture,le=[];for(let j=0;j<6;j++)!re&&!Se?le[j]=m(_.image[j],!0,s.maxCubemapSize):le[j]=Se?_.image[j].image:_.image[j],le[j]=kt(_,le[j]);let oe=le[0],Ee=r.convert(_.format,_.colorSpace),Re=r.convert(_.type),De=M(_.internalFormat,Ee,Re,_.normalized,_.colorSpace),I=_.isVideoTexture!==!0,ne=te.__version===void 0||k===!0,Y=H.dataReady,ae=b(_,oe);qe(i.TEXTURE_CUBE_MAP,_);let fe;if(re){I&&ne&&t.texStorage2D(i.TEXTURE_CUBE_MAP,ae,De,oe.width,oe.height);for(let j=0;j<6;j++){fe=le[j].mipmaps;for(let Me=0;Me<fe.length;Me++){let xe=fe[Me];_.format!==on$1?Ee!==null?I?Y&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me,0,0,xe.width,xe.height,Ee,xe.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me,De,xe.width,xe.height,0,xe.data):ye$2(`WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):I?Y&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me,0,0,xe.width,xe.height,Ee,Re,xe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me,De,xe.width,xe.height,0,Ee,Re,xe.data)}}}else{if(fe=_.mipmaps,I&&ne){fe.length>0&&ae++;let j=Ke(le[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,ae,De,j.width,j.height)}for(let j=0;j<6;j++)if(Se){I?Y&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,le[j].width,le[j].height,Ee,Re,le[j].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,De,le[j].width,le[j].height,0,Ee,Re,le[j].data);for(let Me=0;Me<fe.length;Me++){let at=fe[Me].image[j].image;I?Y&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me+1,0,0,at.width,at.height,Ee,Re,at.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me+1,De,at.width,at.height,0,Ee,Re,at.data)}}else{I?Y&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,Ee,Re,le[j]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,De,Ee,Re,le[j]);for(let Me=0;Me<fe.length;Me++){let xe=fe[Me];I?Y&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me+1,0,0,Ee,Re,xe.image[j]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+j,Me+1,De,Ee,Re,xe.image[j])}}}p(_)&&E(i.TEXTURE_CUBE_MAP),te.__version=H.version,_.onUpdate&&_.onUpdate(_)}S.__version=_.version}function we(S,_,U,k,H,te){let se=r.convert(U.format,U.colorSpace),W=r.convert(U.type),Z=M(U.internalFormat,se,W,U.normalized,U.colorSpace),re=n.get(_),Se=n.get(U);if(Se.__renderTarget=_,!re.__hasExternalTextures){let le=Math.max(1,_.width>>te),oe=Math.max(1,_.height>>te);H===i.TEXTURE_3D||H===i.TEXTURE_2D_ARRAY?t.texImage3D(H,te,Z,le,oe,_.depth,0,se,W,null):t.texImage2D(H,te,Z,le,oe,0,se,W,null)}t.bindFramebuffer(i.FRAMEBUFFER,S),xt(_)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,k,H,Se.__webglTexture,0,ot(_)):(H===i.TEXTURE_2D||H>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&H<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,k,H,Se.__webglTexture,te),t.bindFramebuffer(i.FRAMEBUFFER,null)}function ht(S,_,U){if(i.bindRenderbuffer(i.RENDERBUFFER,S),_.depthBuffer){let k=_.depthTexture,H=k&&k.isDepthTexture?k.type:null,te=A(_.stencilBuffer,H),se=_.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;xt(_)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ot(_),te,_.width,_.height):U?i.renderbufferStorageMultisample(i.RENDERBUFFER,ot(_),te,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,te,_.width,_.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,se,i.RENDERBUFFER,S)}else{let k=_.textures;for(let H=0;H<k.length;H++){let te=k[H],se=r.convert(te.format,te.colorSpace),W=r.convert(te.type),Z=M(te.internalFormat,se,W,te.normalized,te.colorSpace);xt(_)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ot(_),Z,_.width,_.height):U?i.renderbufferStorageMultisample(i.RENDERBUFFER,ot(_),Z,_.width,_.height):i.renderbufferStorage(i.RENDERBUFFER,Z,_.width,_.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ge(S,_,U){let k=_.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,S),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error(`THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.`);let H=n.get(_.depthTexture);if(H.__renderTarget=_,(!H.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),k){if(H.__webglInit===void 0&&(H.__webglInit=!0,_.depthTexture.addEventListener(`dispose`,R)),H.__webglTexture===void 0){H.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,H.__webglTexture),qe(i.TEXTURE_CUBE_MAP,_.depthTexture);let re=r.convert(_.depthTexture.format),Se=r.convert(_.depthTexture.type),le;_.depthTexture.format===In$1?le=i.DEPTH_COMPONENT24:_.depthTexture.format===_i&&(le=i.DEPTH24_STENCIL8);for(let oe=0;oe<6;oe++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,le,_.width,_.height,0,re,Se,null)}}else J(_.depthTexture,0);let te=H.__webglTexture,se=ot(_),W=k?i.TEXTURE_CUBE_MAP_POSITIVE_X+U:i.TEXTURE_2D,Z=_.depthTexture.format===_i?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(_.depthTexture.format===In$1)xt(_)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,W,te,0,se):i.framebufferTexture2D(i.FRAMEBUFFER,Z,W,te,0);else if(_.depthTexture.format===_i)xt(_)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,W,te,0,se):i.framebufferTexture2D(i.FRAMEBUFFER,Z,W,te,0);else throw new Error(`THREE.WebGLTextures: Unknown depthTexture format.`)}function Qe(S){let _=n.get(S),U=S.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==S.depthTexture){let k=S.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),k){let H=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,k.removeEventListener(`dispose`,H)};k.addEventListener(`dispose`,H),_.__depthDisposeCallback=H}_.__boundDepthTexture=k}if(S.depthTexture&&!_.__autoAllocateDepthBuffer)if(U)for(let k=0;k<6;k++)Ge(_.__webglFramebuffer[k],S,k);else{let k=S.texture.mipmaps;k&&k.length>0?Ge(_.__webglFramebuffer[0],S,0):Ge(_.__webglFramebuffer,S,0)}else if(U){_.__webglDepthbuffer=[];for(let k=0;k<6;k++)if(t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[k]),_.__webglDepthbuffer[k]===void 0)_.__webglDepthbuffer[k]=i.createRenderbuffer(),ht(_.__webglDepthbuffer[k],S,!1);else{let H=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=_.__webglDepthbuffer[k];i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,H,i.RENDERBUFFER,te)}}else{let k=S.texture.mipmaps;if(k&&k.length>0?t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=i.createRenderbuffer(),ht(_.__webglDepthbuffer,S,!1);else{let H=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,te=_.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,te),i.framebufferRenderbuffer(i.FRAMEBUFFER,H,i.RENDERBUFFER,te)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ye(S,_,U){let k=n.get(S);_!==void 0&&we(k.__webglFramebuffer,S,S.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),U!==void 0&&Qe(S)}function He(S){let _=S.texture,U=n.get(S),k=n.get(_);S.addEventListener(`dispose`,x);let H=S.textures,te=S.isWebGLCubeRenderTarget===!0,se=H.length>1;if(se||(k.__webglTexture===void 0&&(k.__webglTexture=i.createTexture()),k.__version=_.version,o.memory.textures++),te){U.__webglFramebuffer=[];for(let W=0;W<6;W++)if(_.mipmaps&&_.mipmaps.length>0){U.__webglFramebuffer[W]=[];for(let Z=0;Z<_.mipmaps.length;Z++)U.__webglFramebuffer[W][Z]=i.createFramebuffer()}else U.__webglFramebuffer[W]=i.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){U.__webglFramebuffer=[];for(let W=0;W<_.mipmaps.length;W++)U.__webglFramebuffer[W]=i.createFramebuffer()}else U.__webglFramebuffer=i.createFramebuffer();if(se)for(let W=0,Z=H.length;W<Z;W++){let re=n.get(H[W]);re.__webglTexture===void 0&&(re.__webglTexture=i.createTexture(),o.memory.textures++)}if(S.samples>0&&xt(S)===!1){U.__webglMultisampledFramebuffer=i.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let W=0;W<H.length;W++){let Z=H[W];U.__webglColorRenderbuffer[W]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,U.__webglColorRenderbuffer[W]);let re=r.convert(Z.format,Z.colorSpace),Se=r.convert(Z.type),le=M(Z.internalFormat,re,Se,Z.normalized,Z.colorSpace,S.isXRRenderTarget===!0),oe=ot(S);i.renderbufferStorageMultisample(i.RENDERBUFFER,oe,le,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+W,i.RENDERBUFFER,U.__webglColorRenderbuffer[W])}i.bindRenderbuffer(i.RENDERBUFFER,null),S.depthBuffer&&(U.__webglDepthRenderbuffer=i.createRenderbuffer(),ht(U.__webglDepthRenderbuffer,S,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(te){t.bindTexture(i.TEXTURE_CUBE_MAP,k.__webglTexture),qe(i.TEXTURE_CUBE_MAP,_);for(let W=0;W<6;W++)if(_.mipmaps&&_.mipmaps.length>0)for(let Z=0;Z<_.mipmaps.length;Z++)we(U.__webglFramebuffer[W][Z],S,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,Z);else we(U.__webglFramebuffer[W],S,_,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);p(_)&&E(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(se){for(let W=0,Z=H.length;W<Z;W++){let re=H[W],Se=n.get(re),le=i.TEXTURE_2D;(S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(le=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(le,Se.__webglTexture),qe(le,re),we(U.__webglFramebuffer,S,re,i.COLOR_ATTACHMENT0+W,le,0),p(re)&&E(le)}t.unbindTexture()}else{let W=i.TEXTURE_2D;if((S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(W=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(W,k.__webglTexture),qe(W,_),_.mipmaps&&_.mipmaps.length>0)for(let Z=0;Z<_.mipmaps.length;Z++)we(U.__webglFramebuffer[Z],S,_,i.COLOR_ATTACHMENT0,W,Z);else we(U.__webglFramebuffer,S,_,i.COLOR_ATTACHMENT0,W,0);p(_)&&E(W),t.unbindTexture()}S.depthBuffer&&Qe(S)}function _t(S){let _=S.textures;for(let U=0,k=_.length;U<k;U++){let H=_[U];if(p(H)){let te=w(S),se=n.get(H).__webglTexture;t.bindTexture(te,se),E(te),t.unbindTexture()}}}let St=[],Et=[];function Rt(S){if(S.samples>0){if(xt(S)===!1){let _=S.textures,U=S.width,k=S.height,H=i.COLOR_BUFFER_BIT,te=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,se=n.get(S),W=_.length>1;if(W)for(let re=0;re<_.length;re++)t.bindFramebuffer(i.FRAMEBUFFER,se.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,se.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,se.__webglMultisampledFramebuffer);let Z=S.texture.mipmaps;Z&&Z.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,se.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,se.__webglFramebuffer);for(let re=0;re<_.length;re++){if(S.resolveDepthBuffer&&(S.depthBuffer&&(H|=i.DEPTH_BUFFER_BIT),S.stencilBuffer&&S.resolveStencilBuffer&&(H|=i.STENCIL_BUFFER_BIT)),W){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,se.__webglColorRenderbuffer[re]);let Se=n.get(_[re]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Se,0)}i.blitFramebuffer(0,0,U,k,0,0,U,k,H,i.NEAREST),l===!0&&(St.length=0,Et.length=0,St.push(i.COLOR_ATTACHMENT0+re),S.depthBuffer&&S.resolveDepthBuffer===!1&&(St.push(te),Et.push(te),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,Et)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,St))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),W)for(let re=0;re<_.length;re++){t.bindFramebuffer(i.FRAMEBUFFER,se.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,se.__webglColorRenderbuffer[re]);let Se=n.get(_[re]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,se.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,Se,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,se.__webglMultisampledFramebuffer)}else if(S.depthBuffer&&S.resolveDepthBuffer===!1&&l){let _=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[_])}}}function ot(S){return Math.min(s.maxSamples,S.samples)}function xt(S){let _=n.get(S);return S.samples>0&&e.has(`WEBGL_multisampled_render_to_texture`)===!0&&_.__useRenderToTexture!==!1}function P(S){let _=o.render.frame;h.get(S)!==_&&(h.set(S,_),S.update())}function kt(S,_){let U=S.colorSpace,k=S.format,H=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||U!==Ot$2&&U!==Qn&&(ze.getTransfer(U)===Ze?(k!==on$1||H!==qt$2)&&ye$2(`WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):Ce$1(`WebGLTextures: Unsupported texture color space:`,U)),_}function Ke(S){return typeof HTMLImageElement<`u`&&S instanceof HTMLImageElement?(c.width=S.naturalWidth||S.width,c.height=S.naturalHeight||S.height):typeof VideoFrame<`u`&&S instanceof VideoFrame?(c.width=S.displayWidth,c.height=S.displayHeight):(c.width=S.width,c.height=S.height),c}this.allocateTextureUnit=q,this.resetTextureUnits=X,this.getTextureUnits=$,this.setTextureUnits=O,this.setTexture2D=J,this.setTexture2DArray=Q,this.setTexture3D=he,this.setTextureCube=pe,this.rebindTextures=Ye,this.setupRenderTarget=He,this.updateRenderTargetMipmap=_t,this.updateMultisampleRenderTarget=Rt,this.setupDepthRenderbuffer=Qe,this.setupFrameBufferTexture=we,this.useMultisampledRTT=xt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function P_(i,e){function t(n,s=Qn){let r,o=ze.getTransfer(s);if(n===qt$2)return i.UNSIGNED_BYTE;if(n===Yo$1)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Zo$1)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Jl$1)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===$l$1)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Zl$1)return i.BYTE;if(n===Kl$1)return i.SHORT;if(n===Rs$1)return i.UNSIGNED_SHORT;if(n===qo$1)return i.INT;if(n===bn$1)return i.UNSIGNED_INT;if(n===rn$1)return i.FLOAT;if(n===Dn)return i.HALF_FLOAT;if(n===jl$1)return i.ALPHA;if(n===Ql$1)return i.RGB;if(n===on$1)return i.RGBA;if(n===In$1)return i.DEPTH_COMPONENT;if(n===_i)return i.DEPTH_STENCIL;if(n===Ko$1)return i.RED;if(n===Jo$1)return i.RED_INTEGER;if(n===xi)return i.RG;if(n===$o$1)return i.RG_INTEGER;if(n===jo$1)return i.RGBA_INTEGER;if(n===br$1||n===Tr$1||n===Ar$1||n===Er$1)if(o===Ze)if(r=e.get(`WEBGL_compressed_texture_s3tc_srgb`),r!==null){if(n===br$1)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Tr$1)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ar$1)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Er$1)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get(`WEBGL_compressed_texture_s3tc`),r!==null){if(n===br$1)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Tr$1)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ar$1)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Er$1)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Qo$1||n===ea||n===ta||n===na)if(r=e.get(`WEBGL_compressed_texture_pvrtc`),r!==null){if(n===Qo$1)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ea)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ta)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===na)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ia||n===sa||n===ra||n===oa||n===aa||n===wr$1||n===la)if(r=e.get(`WEBGL_compressed_texture_etc`),r!==null){if(n===ia||n===sa)return o===Ze?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ra)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;
vendor: 12,687 bytes, lines 6700-6724
6700if(n===oa)return r.COMPRESSED_R11_EAC;if(n===aa)return r.COMPRESSED_SIGNED_R11_EAC;if(n===wr$1)return r.COMPRESSED_RG11_EAC;if(n===la)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===ca||n===ha||n===ua||n===da||n===fa||n===pa||n===ma||n===ga||n===_a||n===xa||n===va||n===ya||n===Ma||n===Sa)if(r=e.get(`WEBGL_compressed_texture_astc`),r!==null){if(n===ca)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ha)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ua)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===da)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===fa)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===pa)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ma)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ga)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_a)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===xa)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===va)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ya)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ma)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Sa)return o===Ze?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===ba||n===Ta||n===Aa)if(r=e.get(`EXT_texture_compression_bptc`),r!==null){if(n===ba)return o===Ze?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ta)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Aa)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ea||n===wa||n===Rr$1||n===Ra)if(r=e.get(`EXT_texture_compression_rgtc`),r!==null){if(n===Ea)return r.COMPRESSED_RED_RGTC1_EXT;if(n===wa)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Rr$1)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ra)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Cs$1?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var L_=` 6701void main() { 6702 6703 gl_Position = vec4( position, 1.0 ); 6704 6705}`;var N_=` 6706uniform sampler2DArray depthColor; 6707uniform float depthWidth; 6708uniform float depthHeight; 6709 6710void main() { 6711 6712 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 6713 6714 if ( coord.x >= 1.0 ) { 6715 6716 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 6717 6718 } else { 6719 6720 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 6721 6722 } 6723 6724}`;var Mc$1=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new cr$1(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new sn$1({vertexShader:L_,fragmentShader:N_,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Mt$2(new hr$1(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}};var Sc$1=class extends Pn$1{constructor(e,t){super();let n=this,s=null,r=1,o=null,a=`local-floor`,l=1,c=null,h=null,d=null,u=null,f=null,g=null,y=typeof XRWebGLBinding<`u`,m=new Mc$1,p={},E=t.getContextAttributes(),w=null,M=null,A=[],b=[],R=new Fe$1,x=null,T=new yt$1;T.viewport=new $e;let L=new yt$1;L.viewport=new $e;let C=[T,L],F=new Go$1,X=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let ie=A[K];return ie===void 0&&(ie=new gs$1,A[K]=ie),ie.getTargetRaySpace()},this.getControllerGrip=function(K){let ie=A[K];return ie===void 0&&(ie=new gs$1,A[K]=ie),ie.getGripSpace()},this.getHand=function(K){let ie=A[K];return ie===void 0&&(ie=new gs$1,A[K]=ie),ie.getHandSpace()};function O(K){let ie=b.indexOf(K.inputSource);if(ie===-1)return;let ee=A[ie];ee!==void 0&&(ee.update(K.inputSource,K.frame,c||o),ee.dispatchEvent({type:K.type,data:K.inputSource}))}function q(){s.removeEventListener(`select`,O),s.removeEventListener(`selectstart`,O),s.removeEventListener(`selectend`,O),s.removeEventListener(`squeeze`,O),s.removeEventListener(`squeezestart`,O),s.removeEventListener(`squeezeend`,O),s.removeEventListener(`end`,q),s.removeEventListener(`inputsourceschange`,V);for(let K=0;K<A.length;K++){let ie=b[K];ie!==null&&(b[K]=null,A[K].disconnect(ie))}X=null,$=null,m.reset();for(let K in p)delete p[K];e.setRenderTarget(w),f=null,u=null,d=null,s=null,M=null,qe.stop(),n.isPresenting=!1,e.setPixelRatio(x),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(K){r=K,n.isPresenting===!0&&ye$2(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(K){a=K,n.isPresenting===!0&&ye$2(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(K){c=K},this.getBaseLayer=function(){return u!==null?u:f},this.getBinding=function(){return d===null&&y&&(d=new XRWebGLBinding(s,t)),d},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=function(K){return ps$4(this,null,function*(){if(s=K,s!==null){if(w=e.getRenderTarget(),s.addEventListener(`select`,O),s.addEventListener(`selectstart`,O),s.addEventListener(`selectend`,O),s.addEventListener(`squeeze`,O),s.addEventListener(`squeezestart`,O),s.addEventListener(`squeezeend`,O),s.addEventListener(`end`,q),s.addEventListener(`inputsourceschange`,V),E.xrCompatible!==!0&&(yield t.makeXRCompatible()),x=e.getPixelRatio(),e.getSize(R),y&&`createProjectionLayer`in XRWebGLBinding.prototype){let ee=null,Ie=null,Ne=null;E.depth&&(Ne=E.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ee=E.stencil?_i:In$1,Ie=E.stencil?Cs$1:bn$1);let we={colorFormat:t.RGBA8,depthFormat:Ne,scaleFactor:r};d=this.getBinding(),u=d.createProjectionLayer(we),s.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),M=new tn(u.textureWidth,u.textureHeight,{format:on$1,type:qt$2,depthTexture:new Xn$1(u.textureWidth,u.textureHeight,Ie,void 0,void 0,void 0,void 0,void 0,void 0,ee),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{let ee={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(s,t,ee),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new tn(f.framebufferWidth,f.framebufferHeight,{format:on$1,type:qt$2,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=yield s.requestReferenceSpace(a),qe.setContext(s),qe.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function V(K){for(let ie=0;ie<K.removed.length;ie++){let ee=K.removed[ie],Ie=b.indexOf(ee);Ie>=0&&(b[Ie]=null,A[Ie].disconnect(ee))}for(let ie=0;ie<K.added.length;ie++){let ee=K.added[ie],Ie=b.indexOf(ee);if(Ie===-1){for(let we=0;we<A.length;we++)if(we>=b.length){b.push(ee),Ie=we;break}else if(b[we]===null){b[we]=ee,Ie=we;break}if(Ie===-1)break}let Ne=A[Ie];Ne&&Ne.connect(ee)}}let J=new D$2,Q=new D$2;function he(K,ie,ee){J.setFromMatrixPosition(ie.matrixWorld),Q.setFromMatrixPosition(ee.matrixWorld);let Ie=J.distanceTo(Q),Ne=ie.projectionMatrix.elements,we=ee.projectionMatrix.elements,ht=Ne[14]/(Ne[10]-1),Ge=Ne[14]/(Ne[10]+1),Qe=(Ne[9]+1)/Ne[5],Ye=(Ne[9]-1)/Ne[5],He=(Ne[8]-1)/Ne[0],_t=(we[8]+1)/we[0],St=ht*He,Et=ht*_t,Rt=Ie/(-He+_t),ot=Rt*-He;if(ie.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(ot),K.translateZ(Rt),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert(),Ne[10]===-1)K.projectionMatrix.copy(ie.projectionMatrix),K.projectionMatrixInverse.copy(ie.projectionMatrixInverse);else{let xt=ht+Rt,P=Ge+Rt,kt=St-ot,Ke=Et+(Ie-ot),S=Qe*Ge/P*xt,_=Ye*Ge/P*xt;K.projectionMatrix.makePerspective(kt,Ke,S,_,xt,P),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}}function pe(K,ie){ie===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(ie.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(s===null)return;let ie=K.near,ee=K.far;m.texture!==null&&(m.depthNear>0&&(ie=m.depthNear),m.depthFar>0&&(ee=m.depthFar)),F.near=L.near=T.near=ie,F.far=L.far=T.far=ee,(X!==F.near||$!==F.far)&&(s.updateRenderState({depthNear:F.near,depthFar:F.far}),X=F.near,$=F.far),F.layers.mask=K.layers.mask|6,T.layers.mask=F.layers.mask&-5,L.layers.mask=F.layers.mask&-3;let Ie=K.parent,Ne=F.cameras;pe(F,Ie);for(let we=0;we<Ne.length;we++)pe(Ne[we],Ie);Ne.length===2?he(F,T,L):F.projectionMatrix.copy(T.projectionMatrix),_e(K,F,Ie)};function _e(K,ie,ee){ee===null?K.matrix.copy(ie.matrixWorld):(K.matrix.copy(ee.matrixWorld),K.matrix.invert(),K.matrix.multiply(ie.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(ie.projectionMatrix),K.projectionMatrixInverse.copy(ie.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=Ui*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(u===null&&f===null))return l},this.setFoveation=function(K){l=K,u!==null&&(u.fixedFoveation=K),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=K)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(F)},this.getCameraTexture=function(K){return p[K]};let Xe=null;function rt(K,ie){if(h=ie.getViewerPose(c||o),g=ie,h!==null){let ee=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Ie=!1;ee.length!==F.cameras.length&&(F.cameras.length=0,Ie=!0);for(let Ge=0;Ge<ee.length;Ge++){let Qe=ee[Ge],Ye=null;if(f!==null)Ye=f.getViewport(Qe);else{let _t=d.getViewSubImage(u,Qe);Ye=_t.viewport,Ge===0&&(e.setRenderTargetTextures(M,_t.colorTexture,_t.depthStencilTexture),e.setRenderTarget(M))}let He=C[Ge];He===void 0&&(He=new yt$1,He.layers.enable(Ge),He.viewport=new $e,C[Ge]=He),He.matrix.fromArray(Qe.transform.matrix),He.matrix.decompose(He.position,He.quaternion,He.scale),He.projectionMatrix.fromArray(Qe.projectionMatrix),He.projectionMatrixInverse.copy(He.projectionMatrix).invert(),He.viewport.set(Ye.x,Ye.y,Ye.width,Ye.height),Ge===0&&(F.matrix.copy(He.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Ie===!0&&F.cameras.push(He)}let Ne=s.enabledFeatures;if(Ne&&Ne.includes(`depth-sensing`)&&s.depthUsage==`gpu-optimized`&&y){d=n.getBinding();let Ge=d.getDepthInformation(ee[0]);Ge&&Ge.isValid&&Ge.texture&&m.init(Ge,s.renderState)}if(Ne&&Ne.includes(`camera-access`)&&y){e.state.unbindTexture(),d=n.getBinding();for(let Ge=0;Ge<ee.length;Ge++){let Qe=ee[Ge].camera;if(Qe){let Ye=p[Qe];Ye||(Ye=new cr$1,p[Qe]=Ye);let He=d.getCameraImage(Qe);Ye.sourceTexture=He}}}}for(let ee=0;ee<A.length;ee++){let Ie=b[ee],Ne=A[ee];Ie!==null&&Ne!==void 0&&Ne.update(Ie,ie,c||o)}Xe&&Xe(K,ie),ie.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:ie}),g=null}let qe=new vd;qe.setAnimationLoop(rt),this.setAnimationLoop=function(K){Xe=K},this.dispose=function(){}}};var D_=new Le;var Ad=new Pe$1;Ad.set(-1,0,0,0,1,0,0,0,1);function U_(i,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,sc$1(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function s(m,p,E,w,M){p.isNodeMaterial?p.uniformsNeedUpdate=!1:p.isMeshBasicMaterial?r(m,p):p.isMeshLambertMaterial?(r(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshToonMaterial?(r(m,p),d(m,p)):p.isMeshPhongMaterial?(r(m,p),h(m,p),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)):p.isMeshStandardMaterial?(r(m,p),u(m,p),p.isMeshPhysicalMaterial&&f(m,p,M)):p.isMeshMat
vendor: 4,305 bytes, line 6724
6724capMaterial?(r(m,p),g(m,p)):p.isMeshDepthMaterial?r(m,p):p.isMeshDistanceMaterial?(r(m,p),y(m,p)):p.isMeshNormalMaterial?r(m,p):p.isLineBasicMaterial?(o(m,p),p.isLineDashedMaterial&&a(m,p)):p.isPointsMaterial?l(m,p,E,w):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===zt$1&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===zt$1&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);let E=e.get(p),w=E.envMap,M=E.envMapRotation;w&&(m.envMap.value=w,m.envMapRotation.value.setFromMatrix4(D_.makeRotationFromEuler(M)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(Ad),m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,E,w){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=w*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function d(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function u(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===zt$1&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.
6724iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function y(m,p){let E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function F_(i,e,t,n){let s={},r={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,A){let b=A.program;n.uniformBlockBinding(M,b)}function c(M,A){let b=s[M.id];b===void 0&&(m(M),b=h(M),s[M.id]=b,M.addEventListener(`dispose`,E));let R=A.program;n.updateUBOMapping(M,R);let x=e.render.frame;r[M.id]!==x&&(u(M),r[M.id]=x)}function h(M){let A=d();M.__bindingPointIndex=A;let b=i.createBuffer(),R=M.__size,x=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,R,x),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,A,b),b}function d(){for(let M=0;M<a;M++)if(o.indexOf(M)===-1)return o.push(M),M;return Ce$1(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function u(M){let A=s[M.id],b=M.uniforms,R=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,A);for(let x=0,T=b.length;x<T;x++){let L=b[x];if(Array.isArray(L))for(let C=0,F=L.length;C<F;C++)f(L[C],x,C,R);else f(L,x,0,R)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(M,A,b,R){if(y(M,A,b,R)===!0){let x=M.__offset,T=M.value;if(Array.isArray(T)){let L=0;for(let C=0;C<T.length;C++){let F=T[C],X=p(F);g(F,M.__data,L),typeof F!=`number`&&typeof F!=`boolean`&&!F.isMatrix3&&!ArrayBuffer.isView(F)&&(L+=X.storage/Float32Array.BYTES_PER_ELEMENT)}}else g(T,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,x,M.__data)}}function g(M,A,b){typeof M==`number`||typeof M==`boolean`?A[0]=M:M.isMatrix3?(A[0]=M.elements[0],A[1]=M.elements[1],A[2]=M.elements[2],A[3]=0,A[4]=M.elements[3],A[5]=M.elements[4],A[6]=M.elements[5],A[7]=0,A[8]=M.elements[6],A[9]=M.elements[7],A[10]=M.elements[8],A[11]=0):ArrayBuffer.isView(M)?A.set(new M.constructor(M.buffer,M.byteOffset,A.length)):M.toArray(A,b)}function y(M,A,b,R){let x=M.value,T=A+`_`+b;if(R[T]===void 0)return typeof x==`number`||typeof x==`boolean`?R[T]=x:ArrayBuffer.isView(x)?R[T]=x.slice():R[T]=x.clone(),!0;{let L=R[T];if(typeof x==`number`||typeof x==`boolean`){if(L!==x)return R[T]=x,!0}else{if(ArrayBuffer.isView(x))return!0;if(L.equals(x)===!1)return L.copy(x),!0}}return!1}function m(M){let A=M.uniforms,b=0,R=16;for(let T=0,L=A.length;T<L;T++){let C=Array.isArray(A[T])?A[T]:[A[T]];for(let F=0,X=C.length;F<X;F++){let $=C[F],O=Array.isArray($.value)?$.value:[$.value];for(let q=0,V=O.length;q<V;q++){let J=O[q],Q=p(J),he=b%R,pe=he%Q.boundary,_e=he+pe;b+=pe,_e!==0&&R-_e<Q.storage&&(b+=R-_e),$.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),$.__offset=b,b+=Q.storage}}}let x=b%R;return x>0&&(b+=R-x),M.__size=b,M.__cache={},this}function p(M){let A={boundary:0,storage:0};return typeof M==`number`||typeof M==`boolean`?(A.boundary=4,A.storage=4):M.isVector2?(A.boundary=8,A.storage=8):M.isVector3||M.isColor?(A.boundary=16,A.storage=12):M.isVector4?(A.boundary=16,A.storage=16):M.isMatrix3?(A.boundary=48,A.storage=48):M.isMatrix4?(A.boundary=64,A.storage=64):M.isTexture?ye$2(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(M)?(A.boundary=16,A.storage=M.byteLength):ye$2(`WebGLRenderer: Unsupported uniform value type.`,M),A}function E(M){let A=M.target;A.removeEventListener(`dispose`,E);let b=o.indexOf(A.__bindingPointIndex);o.splice(b,1),i.deleteBuffer(s[A.id]),delete s[A.id],delete r[A.id]}function w(){for(let M in s)i.deleteBuffer(s[M]);o=[],s={},r={}}return{bind:l,update:c,dispose:w}}var O_=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10
vendor: 34,019 bytes, line 6724
6724751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);var Un=null;function B_(){return Un===null&&(Un=new ys$1(O_,16,16,xi,Dn),Un.name=`DFG_LUT`,Un.minFilter=mt$2,Un.magFilter=mt$2,Un.wrapS=hn$1,Un.wrapT=hn$1,Un.generateMipmaps=!1,Un.needsUpdate=!0),Un}var Fa=class{constructor(e={}){let{canvas:t=Wu(),context:n=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h=`default`,failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:f=qt$2}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw new Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);g=n.getContextAttributes().alpha}else g=o;let y=f,m=new Set([jo$1,$o$1,Jo$1]),p=new Set([qt$2,bn$1,Rs$1,Cs$1,Yo$1,Zo$1]),E=new Uint32Array(4),w=new Int32Array(4),M=new D$2,A=null,b=null,R=[],x=[],T=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Mn$1,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let L=this,C=!1,F=null,X=null,$=null,O=null;this._outputColorSpace=ft$2;let q=0,V=0,J=null,Q=-1,he=null,pe=new $e,_e=new $e,Xe=null,rt=new Ae$1(0),qe=0,K=t.width,ie=t.height,ee=1,Ie=null,Ne=null,we=new $e(0,0,K,ie),ht=new $e(0,0,K,ie),Ge=!1,Qe=new Ms$1,Ye=!1,He=!1,_t=new Le,St=new D$2,Et=new $e,Rt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ot=!1;function xt(){return J===null?ee:1}let P=n;function kt(v,N){return t.getContext(v,N)}try{let v={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r185`),t.addEventListener(`webglcontextlost`,at,!1),t.addEventListener(`webglcontextrestored`,nt,!1),t.addEventListener(`webglcontextcreationerror`,Tn,!1),P===null){let N=`webgl2`;if(P=kt(N,v),P===null)throw kt(N)?new Error(`THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.`):new Error(`THREE.WebGLRenderer: Error creating WebGL context.`)}}catch(v){throw Ce$1(`WebGLRenderer: `+v.message),v}let Ke,S,_,U,k,H,te,se,W,Z,re,Se,le,oe,Ee,Re,De,I,ne,Y,ae,fe,j;function Me(){Ke=new Xg(P),Ke.init(),ae=new P_(P,Ke),S=new Og(P,Ke,e,ae),_=new C_(P,Ke),S.reversedDepthBuffer&&u&&_.buffers.depth.setReversed(!0),X=P.createFramebuffer(),$=P.createFramebuffer(),O=P.createFramebuffer(),U=new Zg(P),k=new m_,H=new I_(P,Ke,_,k,S,ae,U),te=new Wg(L),se=new jf(P),fe=new Ug(P,se),W=new qg(P,se,U,fe),Z=new Jg(P,W,se,fe,U),I=new Kg(P,S,H),Ee=new Bg(k),re=new p_(L,te,Ke,S,fe,Ee),Se=new U_(L,k),le=new __,oe=new b_(Ke),De=new Dg(L,te,_,Z,g,l),Re=new R_(L,Z,S),j=new F_(P,U,S,_),ne=new Fg(P,Ke,U),Y=new Yg(P,Ke,U),U.programs=re.programs,L.capabilities=S,L.extensions=Ke,L.properties=k,L.renderLists=le,L.shadowMap=Re,L.state=_,L.info=U}Me(),y!==qt$2&&(T=new jg(y,t.width,t.height,a,s,r));let xe=new Sc$1(L,P);this.xr=xe,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let v=Ke.get(`WEBGL_lose_context`);v&&v.loseContext()},this.forceContextRestore=function(){let v=Ke.get(`WEBGL_lose_context`);v&&v.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(v){v!==void 0&&(ee=v,this.setSize(K,ie,!1))},this.getSize=function(v){return v.set(K,ie)},this.setSize=function(v,N,G=!0){if(xe.isPresenting){ye$2(`WebGLRenderer: Can't change size while VR device is presenting.`);return}K=v,ie=N,t.width=Math.floor(v*ee),t.height=Math.floor(N*ee),G===!0&&(t.style.width=v+`px`,t.style.height=N+`px`),T!==null&&T.setSize(t.width,t.height),this.setViewport(0,0,v,N)},this.getDrawingBufferSize=function(v){return v.set(K*ee,ie*ee).floor()},this.setDrawingBufferSize=function(v,N,G){K=v,ie=N,ee=G,t.width=Math.floor(v*G),t.height=Math.floor(N*G),this.setViewport(0,0,v,N)},this.setEffects=function(v){if(y===qt$2){Ce$1(`WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);return}if(v){for(let N=0;N<v.length;N++)if(v[N].isOutputPass===!0){ye$2(`WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}T.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(pe)},this.getViewport=function(v){return v.copy(we)},this.setViewport=function(v,N,G,B){v.isVector4?we.set(v.x,v.y,v.z,v.w):we.set(v,N,G,B),_.viewport(pe.copy(we).multiplyScalar(ee).round())},this.getScissor=function(v){return v.copy(ht)},this.setScissor=function(v,N,G,B){v.isVector4?ht.set(v.x,v.y,v.z,v.w):ht.set(v,N,G,B),_.scissor(_e.copy(ht).multiplyScalar(ee).round())},this.getScissorTest=function(){return Ge},this.setScissorTest=function(v){_.setScissorTest(Ge=v)},this.setOpaqueSort=function(v){Ie=v},this.setTransparentSort=function(v){Ne=v},this.getClearColor=function(v){return v.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor(...arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha(...arguments)},this.clear=function(v=!0,N=!0,G=!0){let B=0;if(v){let z=!1;if(J!==null){let de=J.texture.format;z=m.has(de)}if(z){let de=J.texture.type,ge=p.has(de),ue=De.getClearColor(),ve=De.getClearAlpha(),be=ue.r,Ue=ue.g,Be=ue.b;ge?(E[0]=be,E[1]=Ue,E[2]=Be,E[3]=ve,P.clearBufferuiv(P.COLOR,0,E)):(w[0]=be,w[1]=Ue,w[2]=Be,w[3]=ve,P.clearBufferiv(P.COLOR,0,w))}else B|=P.COLOR_BUFFER_BIT}N&&(B|=P.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),G&&(B|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B!==0&&P.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),F=v},this.dispose=function(){t.removeEventListener(`webglcontextlost`,at,!1),t.removeEventListener(`webglcontextrestored`,nt,!1),t.removeEventListener(`webglcontextcreationerror`,Tn,!1),De.dispose(),le.dispose(),oe.dispose(),k.dispose(),te.dispose(),Z.dispose(),fe.dispose(),j.dispose(),re.dispose(),xe.dispose(),xe.removeEventListener(`sessionstart`,Qc),xe.removeEventListener(`sessionend`,eh),Mi.stop()};function at(v){v.preventDefault(),js$1(`WebGLRenderer: Context Lost.`),C=!0}function nt(){js$1(`WebGLRenderer: Context Restored.`),C=!1;let v=U.autoReset,N=Re.enabled,G=Re.autoUpdate,B=Re.needsUpdate,z=Re.type;Me(),U.autoReset=v,Re.enabled=N,Re.autoUpdate=G,Re.needsUpdate=B,Re.type=z}function Tn(v){Ce$1(`WebGLRenderer: A WebGL context could not be created. Reason: `,v.statusMessage)}function An(v){let N=v.target;N.removeEventListener(`dispose`,An),Bd(N)}function Bd(v){zd(v),k.remove(v)}function zd(v){let N=k.get(v).programs;N!==void 0&&(N.forEach(function(G){re.releaseProgram(G)}),v.isShaderMaterial&&re.releaseShaderCache(v))}this.renderBufferDirect=function(v,N,G,B,z,de){N===null&&(N=Rt);let ge=z.isMesh&&z.matrixWorld.determinantAffine()<0,ue=Gd(v,N,G,B,z);_.setMaterial(B,ge);let ve=G.index,be=1;if(B.wireframe===!0){if(ve=W.getWireframeAttribute(G),ve===void 0)return;be=2}let Ue=G.drawRange,Be=G.attributes.position,Te=Ue.start*be,je=(Ue.start+Ue.count)*be;de!==null&&(Te=Math.max(Te,de.start*be),je=Math.min(je,(de.start+de.count)*be)),ve!==null?(Te=Math.max(Te,0),je=Math.min(je,ve.count)):Be!=null&&(Te=Math.max(Te,0),je=Math.min(je,Be.count));let ut=je-Te;if(ut<0||ut===Infinity)return;fe.setup(z,B,ue,G,ve);let lt,et=ne;if(ve!==null&&(lt=se.get(ve),et=Y,et.setIndex(lt)),z.isMesh)B.wireframe===!0?(_.setLineWidth(B.wireframeLinewidth*xt()),et.setMode(P.LINES)):et.setMode(P.TRIANGLES);else if(z.isLine){let It=B.linewidth;It===void 0&&(It=1),_.setLineWidth(It*xt()),z.isLineSegments?et.setMode(P.LINES):z.isLineLoop?et.setMode(P.LINE_LOOP):et.setMode(P.LINE_STRIP)}else z.isPoints?et.setMode(P.POINTS):z.isSprite&&et.setMode(P.TRIANGLES);if(z.isBatchedMesh)if(Ke.get(`WEBGL_multi_draw`))et.renderMultiDraw(z._multiDrawStarts,z._multiDrawCounts,z._multiDrawCount);else{let It=z._multiDrawStarts,me=z._multiDrawCounts,Yt=z._multiDrawCount,We=ve?se.get(ve).bytesPerElement:1,ln=k.get(B).currentProgram.getUniforms();for(let En=0;En<Yt;En++)ln.setValue(P,`_gl_DrawID`,En),et.render(It[En]/We,me[En])}else if(z.isInstancedMesh)et.renderInstances(Te,ut,z.count);else if(G.isInstancedBufferGeometry){let It=G._maxInstanceCount!==void 0?G._maxInstanceCount:Infinity,me=Math.min(G.instanceCount,It);et.renderInstances(Te,ut,me)}else et.render(Te,ut)};function jc(v,N,G){v.transparent===!0&&v.side===un$2&&v.forceSinglePass===!1?(v.side=zt$1,v.needsUpdate=!0,Fr(v,N,G),v.side=vn,v.needsUpdate=!0,Fr(v,N,G),v.side=un$2):Fr(v,N,G)}this.compile=function(v,N,G=null){G===null&&(G=v),b=oe.get(G),b.init(N),x.push(b),G.traverseVisible(function(z){z.isLight&&z.layers.test(N.layers)&&(b.pushLight(z),z.castShadow&&b.pushShadow(z))}),v!==G&&v.traverseVisible(function(z){z.isLight&&z.layers.test(N.layers)&&(b.pushLight(z),z.castShadow&&b.pushShadow(z))}),b.setupLights();let B=new Set;return v.traverse(function(z){if(!(z.isMesh||z.isPoints||z.isLine||z.isSprite))return;let de=z.material;if(de)if(Array.isArray(de))for(let ge=0;ge<de.length;ge++){let ue=de[ge];jc(ue,G,z),B.add(ue)}else jc(de,G,z),B.add(de)}),b=x.pop(),B},this.compileAsync=function(v,N,G=null){let B=this.compile(v,N,G);return new Promise(z=>{function de(){if(B.forEach(function(ge){k.get(ge).currentProgram.isReady()&&B.delete(ge)}),B.size===0){z(v);return}setTimeout(de,10)}Ke.get(`KHR_parallel_shader_compile`)!==null?de():setTimeout(de,10)})};let Ga=null;function kd(v){Ga&&Ga(v)}function Qc(){Mi.stop()}function eh(){Mi.start()}let Mi=new vd;Mi.setAnimationLoop(kd),typeof self<`u`&&Mi.setContext(self),this.setAnimationLoop=function(v){Ga=v,xe.setAnimationLoop(v),v===null?Mi.stop():Mi.start()},xe.addEventListener(`sessionstart`,Qc),xe.addEventListener(`sessionend`,eh),this.render=function(v,N){if(N!==void 0&&N.isCamera!==!0){Ce$1(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(C===!0)return;F!==null&&F.renderStart(v,N);let G=xe.enabled===!0&&xe.isPresenting===!0,B=T!==null&&(J===null||G)&&T.begin(L,J);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),xe.enabled===!0&&xe.isPresenting===!0&&(T===null||T.isCompositing()===!1)&&(xe.cameraAutoUpdate===!0&&xe.updateCamera(N),N=xe.getCamera()),v.isScene===!0&&v.onBeforeRender(L,v,N,J),b=oe.get(v,x.length),b.init(N),b.state.textureUnits=H.getTextureUnits(),x.push(b),_t.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Qe.setFromProjectionMatrix(_t,_n$1,N.reversedDepth),He=this.localClippingEnabled,Ye=Ee.init(this.clippingPlanes,He),A=le.get(v,R.length),A.init(),R.push(A),xe.enabled===!0&&xe.isPresenting===!0){let ge=L.xr.getDepthSensingMesh();ge!==null&&Ha(ge,N,-Infinity,L.sortObjects)}Ha(v,N,0,L.sortObjects),A.finish(),L.sortObjects===!0&&A.sort(Ie,Ne,N.reversedDepth),ot=xe.enabled===!1||xe.isPresenting===!1||xe.hasDepthSensing()===!1,ot&&De.addToRenderList(A,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Ye===!0&&Ee.beginShadows();let z=b.state.shadowsArray;if(Re.render(z,v,N),Ye===!0&&Ee.endShadows(),(B&&T.hasRenderPass())===!1){let ge=A.opaque,ue=A.transmissive;if(b.setupLights(),N.isArrayCamera){let ve=N.cameras;if(ue.length>0)for(let be=0,Ue=ve.length;be<Ue;be++){let Be=ve[be];nh(ge,ue,v,Be)}ot&&De.render(v);for(let be=0,Ue=ve.length;be<Ue;be++){let Be=ve[be];th(A,v,Be,Be.viewport)}}else ue.length>0&&nh(ge,ue,v,N),ot&&De.render(v),th(A,v,N)}J!==null&&V===0&&(H.updateMultisampleRenderTarget(J),H.updateRenderTargetMipmap(J)),B&&T.end(L),v.isScene===!0&&v.onAfterRender(L,v,N),fe.resetDefaultState(),Q=-1,he=null,x.pop(),x.length>0?(b=x[x.length-1],H.setTextureUnits(b.state.textureUnits),Ye===!0&&Ee.setGlobalState(L.clippingPlanes,b.state.camera)):b=null,R.pop(),R.length>0?A=R[R.length-1]:A=null,F!==null&&F.renderEnd()};function Ha(v,N,G,B){if(v.visible===!1)return;if(v.layers.test(N.layers)){if(v.isGroup)G=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(N);else if(v.isLightProbeGrid)b.pushLightProbeGrid(v);else if(v.isLight)b.pushLight(v),v.castShadow&&b.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||Qe.intersectsSprite(v)){B&&Et.setFromMatrixPosition(v.matrixWorld).applyMatrix4(_t);let ge=Z.update(v),ue=v.material;ue.visible&&A.push(v,ge,ue,G,Et.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||Qe.intersectsObject(v))){let ge=Z.update(v),ue=v.material;if(B&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),Et.copy(v.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),Et.copy(ge.boundingSphere.center)),Et.applyMatrix4(v.matrixWorld).applyMatrix4(_t)),Array.isArray(ue)){let ve=ge.groups;for(let be=0,Ue=ve.length;be<Ue;be++){let Be=ve[be],Te=ue[Be.materialIndex];Te&&Te.visible&&A.push(v,ge,Te,G,Et.z,Be)}}else ue.visible&&A.push(v,ge,ue,G,Et.z,null)}}let de=v.children;for(let ge=0,ue=de.length;ge<ue;ge++)Ha(de[ge],N,G,B)}function th(v,N,G,B){let{opaque:z,transmissive:de,transparent:ge}=v;b.setupLightsView(G),Ye===!0&&Ee.setGlobalState(L.clippingPlanes,G),B&&_.viewport(pe.copy(B)),z.length>0&&Ur(z,N,G),de.length>0&&Ur(de,N,G),ge.length>0&&Ur(ge,N,G),_.buffers.depth.setTest(!0),_.buffers.depth.setMask(!0),_.buffers.color.setMask(!0),_.setPolygonOffset(!1)}function nh(v,N,G,B){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(b.state.transmissionRenderTarget[B.id]===void 0){let Te=Ke.has(`EXT_color_buffer_half_float`)||Ke.has(`EXT_color_buffer_float`);b.state.transmissionRenderTarget[B.id]=new tn(1,1,{generateMipmaps:!0,type:Te?Dn:qt$2,minFilter:Sn$1,samples:Math.max(4,S.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ze.workingColorSpace})}let de=b.state.transmissionRenderTarget[B.id],ge=B.viewport||pe;de.setSize(ge.z*L.transmissionResolutionScale,ge.w*L.transmissionResolutionScale);let ue=L.getRenderTarget(),ve=L.getActiveCubeFace(),be=L.getActiveMipmapLevel();L.setRenderTarget(de),L.getClearColor(rt),qe=L.getClearAlpha(),qe<1&&L.setClearColor(16777215,.5),L.clear(),ot&&De.render(G);let Ue=L.toneMapping;L.toneMapping=Mn$1;let Be=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),b.setupLightsView(B),Ye===!0&&Ee.setGlobalState(L.clippingPlanes,B),Ur(v,G,B),H.updateMultisampleRenderTarget(de),H.updateRenderTargetMipmap(de),Ke.has(`WEBGL_multisampled_render_to_texture`)===!1){let Te=!1;for(let je=0,ut=N.length;je<ut;je++){let{object:et,geometry:It,material:me,group:Yt}=N[je];if(me.side===un$2&&et.layers.test(B.layers)){let We=me.side;me.side=zt$1,me.needsUpdate=!0,ih(et,G,B,It,me,Yt),me.side=We,me.needsUpdate=!0,Te=!0}}Te===!0&&(H.updateMultisampleRenderTarget(de),H.updateRenderTargetMipmap(de))}L.setRenderTarget(ue,ve,be),L.setClearColor(rt,qe),Be!==void 0&&(B.viewport=Be),L.toneMapping=Ue}function Ur(v,N,G){let B=N.isScene===!0?N.overrideMaterial:null;for(let z=0,de=v.length;z<de;z++){let ge=v[z],{object:ue,geometry:ve,group:be}=ge,Ue=ge.material;Ue.allowOverride===!0&&B!==null&&(Ue=B),ue.layers.test(G.layers)&&ih(ue,N,G,ve,Ue,be)}}function ih(v,N,G,B,z,de){v.onBeforeRender(L,N,G,B,z,de),v.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),z.onBeforeRender(L,N,G,B,v,de),z.transparent===!0&&z.side===un$2&&z.forceSinglePass===!1?(z.side=zt$1,z.needsUpdate=!0,L.renderBufferDirect(G,N,B,z,v,de),z.side=vn,z.needsUpdate=!0,L.renderBufferDirect(G,N,B,z,v,de),z.side=un$2):L.renderBufferDirect(G,N,B,z,v,de),v.onAfterRender(L,N,G,B,z,de)}function Fr(v,N,G){N.isScene!==!0&&(N=Rt);let B=k.get(v),z=b.state.lights,de=b.state.shadowsArray,ge=z.state.version,ue=re.getParameters(v,z.state,de,N,G,b.state.lightProbeGridArray),ve=re.getProgramCacheKey(ue),be=B.programs;B.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?N.environment:null,B.fog=N.fog;let Ue=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;B.envMap=te.get(v.envMap||B.environment,Ue),B.envMapRotation=B.environment!==null&&v.envMap===null?N.environmentRotation:v.envMapRotation,be===void 0&&(v.addEventListener(`dispose`,An),be=new Map,B.programs=be);let Be=be.get(ve);if(Be!==void 0){if(B.currentProgram===Be&&B.lightsStateVersion===ge)return rh(v,ue),Be}else ue.uniforms=re.getUniforms(v),F!==null&&v.isNodeMaterial&&F.build(v,G,ue),v.onBeforeCompile(ue,L),Be=re.acquireProgram(ue,ve),be.set(ve,Be),B.uniforms=ue.uniforms;let Te=B.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Te.clippingPlanes=Ee.uniform),rh(v,ue),B.needsLights=Wd(v),B.lightsStateVersion=ge,B.needsLights&&(Te.ambientLightColor.value=z.state.ambient,Te.lightProbe.value=z.state.probe,Te.directionalLights.value=z.state.directional,Te.directionalLightShadows.value=z.state.directionalShadow,Te.spotLights.value=z.state.spot,Te.spotLightShadows.value=z.state.spotShadow,Te.rectAreaLights.value=z.state.rectArea,Te.ltc_1.value=z.state.rectAreaLTC1,Te.ltc_2.value=z.state.rectAreaLTC2,Te.pointLights.value=z.state.point,Te.pointLightShadows.value=z.state.pointShadow,Te.hemisphereLights.value=z.state.hemi,Te.directionalShadowMatrix.value=z.state.directionalShadowMatrix,Te.spotLightMatrix.value=z.state.spotLightMatrix,Te.spotLightMap.value=z.state.spotLightMap,Te.pointShadowMatrix.value=z.state.pointShadowMatrix),B.lightProbeGrid=b.state.lightProbeGridArray.length>0,B.currentProgram=Be,B.uniformsList=null,Be}function sh(v){if(v.uniformsList===null){let N=v.currentProgram.getUniforms();v.uniformsList=Ls$1.seqWithValue(N.seq,v.uniforms)}return v.uniformsList}function rh(v,N){let G=k.get(v);G.outputColorSpace=N.outputColorSpace,G.batching=N.batching,G.batchingColor=N.batchingColor,G.instancing=N.instancing,G.instancingColor=N.instancingColor,G.instancingMorph=N.instancingMorph,G.skinning=N.skinning,G.morphTargets=N.morphTargets,G.morphNormals=N.morphNormals,G.morphColors=N.morphColors,G.morphTargetsCount=N.morphTargetsCount,G.numClippingPlanes=N.numClippingPlanes,G.numIntersection=N.numClipIntersection,G.vertexAlphas=N.vertexAlphas,G.vertexTangents=N.vertexTangents,G.toneMapping=N.toneMapping}function Vd(v,N){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(N.matrixWorld);for(let G=0,B=v.length;G<B;G++){let z=v[G];if(z.texture!==null&&z.boundingBox.containsPoint(M))return z}return null}function Gd(v,N,G,B,z){N.isScene!==!0&&(N=Rt),H.resetTextureUnits();let de=N.fog,ge=B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial?N.environment:null,ue=J===null?L.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:ze.workingColorSpace,ve=B.isMeshStandardMaterial||B.isMeshLambertMaterial&&!B.envMap||B.isMeshPhongMaterial&&!B.envMap,be=te.get(B.envMap||ge,ve),Ue=B.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,Be=!!G.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Te=!!G.morphAttributes.position,je=!!G.morphAttributes.normal,ut=!!G.morphAttributes.color,lt=Mn$1;B.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(lt=L.toneMapping);let et=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,It=et!==void 0?et.length:0,me=k.get(B),Yt=b.state.lights;if(Ye===!0&&(He===!0||v!==he)){let it=v===he&&B.id===Q;Ee.setState(B,v,it)}let We=!1;B.version===me.__version?(me.needsLights&&me.lightsStateVersion!==Yt.state.version||me.outputColorSpace!==ue||z.isBatchedMesh&&me.batching===!1||!z.isBatchedMesh&&me.batching===!0||z.isBatchedMesh&&me.batchingColor===!0&&z.colorTexture===null||z.isBatchedMesh&&me.batchingColor===!1&&z.colorTexture!==null||z.isInstancedMesh&&me.instancing===!1||!z.isInstancedMesh&&me.instancing===!0||z.isSkinnedMesh&&me.skinning===!1||!z.isSkinnedMesh&&me.skinning===!0||z.isInstancedMesh&&me.instancingColor===!0&&z.instanceColor===null||z.isInstancedMesh&&me.instancingColor===!1&&z.instanceColor!==null||z.isInstancedMesh&&me.instancingMorph===!0&&z.morphTexture===null||z.isInstancedMesh&&me.instancingMorph===!1&&z.morphTexture!==null||me.envMap!==be||B.fog===!0&&me.fog!==de||me.numClippingPlanes!==void 0&&(me.numClippingPlanes!==Ee.numPlanes||me.numIntersection!==Ee.numIntersection)||me.vertexAlphas!==Ue||me.vertexTangents!==Be||me.morphTargets!==Te||me.morphNormals!==je||me.morphColors!==ut||me.toneMapping!==lt||me.morphTargetsCount!==It||!!me.lightProbeGrid!=b.state.lightProbeGridArray.length>0)&&(We=!0):(We=!0,me.__version=B.version);let ln=me.currentProgram;We===!0&&(ln=Fr(B,N,z),F&&B.isNodeMaterial&&F.onUpdateProgram(B,ln,me));let En=!1,ei=!1,Xi=!1,tt=ln.getUniforms(),dt=me.uniforms;if(_.useProgram(ln.program)&&(En=!0,ei=!0,Xi=!0),B.id!==Q&&(Q=B.id,ei=!0),me.needsLights){let it=Vd(b.state.lightProbeGridArray,z);me.lightProbeGrid!==it&&(me.lightProbeGrid=it,ei=!0)}if(En||he!==v){_.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),tt.setValue(P,`projectionMatrix`,v.projectionMatrix),tt.setValue(P,`viewMatrix`,v.matrixWorldInverse);let ni=tt.map.cameraPosition;ni!==void 0&&ni.setValue(P,St.setFromMatrixPosition(v.matrixWorld)),S.logarithmicDepthBuffer&&tt.setValue(P,`logDepthBufFC`,2/(Math.log(v.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&tt.setValue(P,`isOrthographic`,v.isOrthographicCamera===!0),he!==v&&(he=v,ei=!0,Xi=!0)}if(me.needsLights&&(Yt.state.directionalShadowMap.length>0&&tt.setValue(P,`directionalShadowMap`,Yt.state.directionalShadowMap,H),Yt.state.spotShadowMap.length>0&&tt.setValue(P,`spotShadowMap`,Yt.state.spotShadowMap,H),Yt.state.pointShadowMap.length>0&&tt.setValue(P,`pointShadowMap`,Yt.state.pointShadowMap,H)),z.isSkinnedMesh){tt.setOptional(P,z,`bindMatrix`),tt.setOptional(P,z,`bindMatrixInverse`);let it=z.skeleton;it&&(it.boneTexture===null&&it.computeBoneTexture(),tt.setValue(P,`boneTexture`,it.boneTexture,H))}z.isBatchedMesh&&(tt.setOptional(P,z,`batchingTexture`),tt.setValue(P,`batchingTexture`,z._matricesTexture,H),tt.setOptional(P,z,`batchingIdTexture`),tt.setValue(P,`batchingIdTexture`,z._indirectTexture,H),tt.setOptional(P,z,`batchingColorTexture`),z._colorsTexture!==null&&tt.setValue(P,`batchingColorTexture`,z._colorsTexture,H));let ti=G.morphAttributes;if((ti.position!==void 0||ti.normal!==void 0||ti.color!==void 0)&&I.update(z,G,ln),(ei||me.receiveShadow!==z.receiveShadow)&&(me.receiveShadow=z.receiveShadow,tt.setValue(P,`receiveShadow`,z.receiveShadow)),(B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial)&&B.envMap===null&&N.environment!==null&&(dt.envMapIntensity.value=N.environmentIntensity),dt.dfgLUT!==void 0&&(dt.dfgLUT.value=B_()),ei){if(tt.setValue(P,`toneMappingExposure`,L.toneMappingExposure),me.needsLights&&Hd(dt,Xi),de&&B.fog===!0&&Se.refreshFogUniforms(dt,de),Se.refreshMaterialUniforms(dt,B,ee,ie,b.state.transmissionRenderTarget[v.id]),me.needsLights&&me.lightProbeGrid){let it=me.lightProbeGrid;dt.probesSH.value=it.texture,dt.probesMin.value.copy(it.boundingBox.min),dt.probesMax.value.copy(it.boundingBox.max),dt.probesResolution.value.copy(it.resolution)}Ls$1.upload(P,sh(me),dt,H)}if(B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(Ls$1.upload(P,sh(me),dt,H),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&tt.setValue(P,`center`,z.center),tt.setValue(P,`modelViewMatrix`,z.modelViewMatrix),tt.setValue(P,`normalMatrix`,z.normalMatrix),tt.setValue(P,`modelMatrix`,z.matrixWorld),B.uniformsGroups!==void 0){let it=B.uniformsGroups;for(let ni=0,qi=it.length;ni<qi;ni++){let oh=it[ni];j.update(oh,ln),j.bind(oh,ln)}}return ln}function Hd(v,N){v.ambientLightColor.needsUpdate=N,v.lightProbe.needsUpdate=N,v.directionalLights.needsUpdate=N,v.directionalLightShadows.needsUpdate=N,v.pointLights.needsUpdate=N,v.pointLightShadows.needsUpdate=N,v.spotLights.needsUpdate=N,v.spotLightShadows.needsUpdate=N,v.rectAreaLights.needsUpdate=N,v.hemisphereLights.needsUpdate=N}function Wd(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(v,N,G){let B=k.get(v);B.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),k.get(v.texture).__webglTexture=N,k.get(v.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:G,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,N){let G=k.get(v);G.__webglFramebuffer=N,G.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(v,N=0,G=0){J=v,q=N,V=G;let B=null,z=!1,de=!1;if(v){let ue=k.get(v);if(ue.__useDefaultFramebuffer!==void 0){_.bindFramebuffer(P.FRAMEBUFFER,ue.__webglFramebuffer),pe.copy(v.viewport),_e.copy(v.scissor),Xe=v.scissorTest,_.viewport(pe),_.scissor(_e),_.setScissorTest(Xe),Q=-1;return}else if(ue.__webglFramebuffer===void 0)H.setupRenderTarget(v);else if(ue.__hasExternalTextures)H.rebindTextures(v,k.get(v.texture).__webglTexture,k.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){let Ue=v.depthTexture;if(ue.__boundDepthTexture!==Ue){if(Ue!==null&&k.has(Ue)&&(v.width!==Ue.image.width||v.height!==Ue.image.height))throw new Error(`THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.`);H.setupDepthRenderbuffer(v)}}let ve=v.texture;(ve.isData3DTexture||ve.isDataArrayTexture||ve.isCompressedArrayTexture)&&(de=!0);let be=k.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(be[N])?B=be[N][G]:B=be[N],z=!0):v.samples>0&&H.useMultisampledRTT(v)===!1?B=k.get(v).__webglMultisampledFramebuffer:Array.isArray(be)?B=be[G]:B=be,pe.copy(v.viewport),_e.copy(v.scissor),Xe=v.scissorTest}else pe.copy(we).multiplyScalar(ee).floor(),_e.copy(ht).multiplyScalar(ee).floor(),Xe=Ge;if(G!==0&&(B=X),_.bindFramebuffer(P.FRAMEBUFFER,B)&&_.drawBuffers(v,B),_.viewport(pe),_.scissor(_e),_.setScissorTest(Xe),z){let ue=k.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+N,ue.__webglTexture,G)}else if(de){let ue=N;for(let ve=0;ve<v.textures.length;ve++){let be=k.get(v.textures[ve]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+ve,be.__webglTexture,G,ue)}}else if(v!==null&&G!==0){let ue=k.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,ue.__webglTexture,G)}Q=-1},this.readRenderTargetPixels=function(v,N,G,B,z,de,ge,ue=0){if(!(v&&v.isWebGLRenderTarget)){Ce$1(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let ve=k.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ge!==void 0&&(ve=ve[ge]),ve){_.bindFramebuffer(P.FRAMEBUFFER,ve);try{let be=v.textures[ue],Ue=be.format,Be=be.type;if(v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+ue),!S.textureFormatReadable(Ue)){Ce$1(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!S.textureTypeReadable(Be)){Ce$1(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}N>=0&&N<=v.width-B&&G>=0&&G<=v.height-z&&P.readPixels(N,G,B,z,ae.convert(Ue),ae.convert(Be),de)}finally{let be=J!==null?k.get(J).__webglFramebuffer:null;_.bindFramebuffer(P.FRAMEBUFFER,be)}}},this.readRenderTargetPixelsAsync=function(v,N,G,B,z,de,ge,ue=0){return ps$4(this,null,function*(){if(!(v&&v.isWebGLRenderTarget))throw new Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let ve=k.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&ge!==void 0&&(ve=ve[ge]),ve)if(N>=0&&N<=v.width-B&&G>=0&&G<=v.height-z){_.bindFramebuffer(P.FRAMEBUFFER,ve);let be=v.textures[ue],Ue=be.format,Be=be.type;if(v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+ue),!S.textureFormatReadable(Ue))throw new Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!S.textureTypeReadable(Be))throw new Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let Te=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Te),P.bufferData(P.PIXEL_PACK_BUFFER,de.byteLength,P.STREAM_READ),P.readPixels(N,G,B,z,ae.convert(Ue),ae.convert(Be),0);let je=J!==null?k.get(J).__webglFramebuffer:null;_.bindFramebuffer(P.FRAMEBUFFER,je);let ut=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),yield qu(P,ut,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,Te),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,de),P.deleteBuffer(Te),P.deleteSync(ut),de}else throw new Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)})},this.copyFramebufferToTexture=function(v,N=null,G=0){let B=Math.pow(2,-G),z=Math.floor(v.image.width*B),de=Math.floor(v.image.height*B),ge=N!==null?N.x:0,ue=N!==null?N.y:0;H.setTexture2D(v,0),P.copyTexSubImage2D(P.TEXTURE_2D,G,0,0,ge,ue,z,de),_.unbindTexture()},this.copyTextureToTexture=function(v,N,G=null,B=null,z=0,de=0){let ge,ue,ve,be,Ue,Be,Te,je,ut,lt=v.isCompressedTexture?v.mipmaps[de]:v.image;if(G!==null)ge=G.max.x-G.min.x,ue=G.max.y-G.min.y,ve=G.isBox3?G.max.z-G.min.z:1,be=G.min.x,Ue=G.min.y,Be=G.isBox3?G.min.z:0;else{let dt=Math.pow(2,-z);ge=Math.floor(lt.width*dt),ue=Math.floor(lt.height*dt),v.isDataArrayTexture?ve=lt.depth:v.isData3DTexture?ve=Math.floor(lt.depth*dt):ve=1,be=0,Ue=0,Be=0}B!==null?(Te=B.x,je=B.y,ut=B.z):(Te=0,je=0,ut=0);let et=ae.convert(N.format),It=ae.convert(N.type),me;N.isData3DTexture?(H.setTexture3D(N,0),me=P.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(H.setTexture2DArray(N,0),me=P.TEXTURE_2D_ARRAY):(H.setTexture2D(N,0),me=P.TEXTURE_2D),_.activeTexture(P.TEXTURE0),_.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,N.flipY),_.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),_.pixelStorei(P.UNPACK_ALIGNMENT,N.unpackAlignment);let Yt=_.getParameter(P.UNPACK_ROW_LENGTH),We=_.getParameter(P.UNPACK_IMAGE_HEIGHT),ln=_.getParameter(P.UNPACK_SKIP_PIXELS),En=_.getParameter(P.UNPACK_SKIP_ROWS),ei=_.getParameter(P.UNPACK_SKIP_IMAGES);_.pixelStorei(P.UNPACK_ROW_LENGTH,lt.width),_.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt.height),_.pixelStorei(P.UNPACK_SKIP_PIXELS,be),_.pixelStorei(P.UNPACK_SKIP_ROWS,Ue),_.pixelStorei(P.UNPACK_SKIP_IMAGES,Be);let Xi=v.isDataArrayTexture||v.isData3DTexture,tt=N.isDataArrayTexture||N.isData3DTexture;if(v.isDepthTexture){let dt=k.get(v),ti=k.get(N),it=k.get(dt.__renderTarget),ni=k.get(ti.__renderTarget);_.bindFramebuffer(P.READ_FRAMEBUFFER,it.__webglFramebuffer),_.bindFramebuffer(P.DRAW_FRAMEBUFFER,ni.__webglFramebuffer);for(let qi=0;qi<ve;qi++)Xi&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,k.get(v).__webglTexture,z,Be+qi),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,k.get(N).__webglTexture,de,ut+qi)),P.blitFramebuffer(be,Ue,ge,ue,Te,je,ge,ue,P.DEPTH_BUFFER_BIT,P.NEAREST);_.bindFramebuffer(P.READ_FRAMEBUFFER,null),_.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(z!==0||v.isRenderTargetTexture||k.has(v)){let dt=k.get(v),ti=k.get(N);_.bindFramebuffer(P.READ_FRAMEBUFFER,$),_.bindFramebuffer(P.DRAW_FRAMEBUFFER,O);for(let it=0;
vendor: 6,317 bytes, line 6724
6724it<ve;it++)Xi?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,dt.__webglTexture,z,Be+it):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,dt.__webglTexture,z),tt?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,ti.__webglTexture,de,ut+it):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,ti.__webglTexture,de),z!==0?P.blitFramebuffer(be,Ue,ge,ue,Te,je,ge,ue,P.COLOR_BUFFER_BIT,P.NEAREST):tt?P.copyTexSubImage3D(me,de,Te,je,ut+it,be,Ue,ge,ue):P.copyTexSubImage2D(me,de,Te,je,be,Ue,ge,ue);_.bindFramebuffer(P.READ_FRAMEBUFFER,null),_.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else tt?v.isDataTexture||v.isData3DTexture?P.texSubImage3D(me,de,Te,je,ut,ge,ue,ve,et,It,lt.data):N.isCompressedArrayTexture?P.compressedTexSubImage3D(me,de,Te,je,ut,ge,ue,ve,et,lt.data):P.texSubImage3D(me,de,Te,je,ut,ge,ue,ve,et,It,lt):v.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,de,Te,je,ge,ue,et,It,lt.data):v.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,de,Te,je,lt.width,lt.height,et,lt.data):P.texSubImage2D(P.TEXTURE_2D,de,Te,je,ge,ue,et,It,lt);_.pixelStorei(P.UNPACK_ROW_LENGTH,Yt),_.pixelStorei(P.UNPACK_IMAGE_HEIGHT,We),_.pixelStorei(P.UNPACK_SKIP_PIXELS,ln),_.pixelStorei(P.UNPACK_SKIP_ROWS,En),_.pixelStorei(P.UNPACK_SKIP_IMAGES,ei),de===0&&N.generateMipmaps&&P.generateMipmap(me),_.unbindTexture()},this.initRenderTarget=function(v){k.get(v).__webglFramebuffer===void 0&&H.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?H.setTextureCube(v,0):v.isData3DTexture?H.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?H.setTexture2DArray(v,0):H.setTexture2D(v,0),_.unbindTexture()},this.resetState=function(){q=0,V=0,J=null,_.reset(),fe.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return _n$1}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ze._getDrawingBufferColorSpace(e),t.unpackColorSpace=ze._getUnpackColorSpace()}};function bc$1(i,e){if(e===ec$1)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),i;if(e===Is$1||e===Cr$1){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute(`position`);if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.`),i}let n=t.count-2,s=[];if(e===Is$1)for(let o=1;o<=n;o++)s.push(t.getX(0)),s.push(t.getX(o)),s.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(s.push(t.getX(o)),s.push(t.getX(o+1)),s.push(t.getX(o+2))):(s.push(t.getX(o+2)),s.push(t.getX(o+1)),s.push(t.getX(o)));s.length/3!==n&&console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.`);let r=i.clone();return r.setIndex(s),r.clearGroups(),r}else return console.error(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:`,e),i}function Ed(i){let e=new Map,t=new Map,n=i.clone();return wd(i,n,function(s,r){e.set(r,s),t.set(s,r)}),n.traverse(function(s){if(!s.isSkinnedMesh)return;let r=s,o=e.get(s),a=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=a.map(function(l){return t.get(l)}),r.bind(r.skeleton,r.bindMatrix)}),n}function wd(i,e,t){t(i,e);for(let n=0;n<i.children.length;n++)wd(i.children[n],e.children[n],t)}var za=class extends Gi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Ic$1(t)}),this.register(function(t){return new Pc$1(t)}),this.register(function(t){return new kc$1(t)}),this.register(function(t){return new Vc$1(t)}),this.register(function(t){return new Gc$1(t)}),this.register(function(t){return new Nc$1(t)}),this.register(function(t){return new Dc$1(t)}),this.register(function(t){return new Uc$1(t)}),this.register(function(t){return new Fc$1(t)}),this.register(function(t){return new Cc$1(t)}),this.register(function(t){return new Oc$1(t)}),this.register(function(t){return new Lc$1(t)}),this.register(function(t){return new zc$1(t)}),this.register(function(t){return new Bc$1(t)}),this.register(function(t){return new wc$1(t)}),this.register(function(t){return new ka(t,ke$2.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new ka(t,ke$2.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Hc$1(t)})}load(e,t,n,s){let r=this,o;if(this.resourcePath!==``)o=this.resourcePath;else if(this.path!==``){let c=jn.extractUrlBase(e);o=jn.resolveURL(c,this.path)}else o=jn.extractUrlBase(e);this.manager.itemStart(e);let a=function(c){s?s(c):console.error(c),r.manager.itemError(e),r.manager.itemEnd(e)},l=new As$1(this.manager);l.setPath(this.path),l.setResponseType(`arraybuffer`),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{r.parse(c,o,function(h){t(h),r.manager.itemEnd(e)},a)}catch(h){a(h)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,s){let r,o={},a={},l=new TextDecoder;if(typeof e==`string`)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===Ld){try{o[ke$2.KHR_BINARY_GLTF]=new Wc$1(e)}catch(d){s&&s(d);return}r=JSON.parse(o[ke$2.KHR_BINARY_GLTF].content)}else r=JSON.parse(l.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new $c$1(r,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){let d=this.pluginCallbacks[h](c);
6724d.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),a[d.name]=d,o[d.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){let d=r.extensionsUsed[h],u=r.extensionsRequired||[];switch(d){case ke$2.KHR_MATERIALS_UNLIT:o[d]=new Rc$1;break;case ke$2.KHR_DRACO_MESH_COMPRESSION:o[d]=new Xc$1(r,this.dracoLoader);break;case ke$2.KHR_TEXTURE_TRANSFORM:o[d]=new qc$1;break;case ke$2.KHR_MESH_QUANTIZATION:o[d]=new Yc$1;break;default:u.indexOf(d)>=0&&a[d]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+d+`".`)}}c.setExtensions(o),c.setPlugins(a),c.parse(n,s)}parseAsync(e,t){let n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}};function k_(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}function gt$1(i,e,t){let n=i.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}var ke$2={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`};var wc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,s=t.cache.get(n);if(s)return s;let r=t.json,l=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e],c,h=new Ae$1(16777215);l.color!==void 0&&h.setRGB(l.color[0],l.color[1],l.color[2],Ot$2);let d=l.range!==void 0?l.range:0;switch(l.type){case`directional`:c=new $n(h),c.target.position.set(0,0,-1),c.add(c.target);break;case`point`:c=new xr$1(h),c.distance=d;break;case`spot`:c=new _r$1(h),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error(`THREE.GLTFLoader: Unexpected light type: `+l.type)}return c.position.set(0,0,0),On$1(c,l),l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||`light_`+e),s=Promise.resolve(c),t.cache.add(n,s),s}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return n._getNodeRef(t.cache,a,l)})}};var Rc$1=class{constructor(){this.name=ke$2.KHR_MATERIALS_UNLIT}getMaterialType(){return yn$1}extendParams(e,t,n){let s=[];e.color=new Ae$1(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let o=r.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],Ot$2),e.opacity=o[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,`map`,r.baseColorTexture,ft$2))}return Promise.all(s)}};var Cc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}};var Ic$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&s.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(s.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let r=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Fe$1(r,r)}return Promise.all(s)}};var Pc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_DISPERSION}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}};var Lc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&s.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&s.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(s)}};var Nc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_SHEEN}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];if(t.sheenColor=new Ae$1(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let r=n.sheenColorFactor;t.sheenColor.setRGB(r[0],r[1],r[2],Ot$2)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&s.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,ft$2)),n.sheenRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(s)}};var Dc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&s.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(s)}};var Uc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_VOLUME}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&s.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||Infinity;let r=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ae$1().setRGB(r[0],r[1],r[2],Ot$2),Promise.all(s)}};var Fc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_IOR}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);return n===null||(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}};var Oc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_SPECULAR}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&s.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let r=n.specularColorFactor||[1,1,1];return t.specularColor=new Ae$1().setRGB(r[0],r[1],r[2],Ot$2),n.specularColorTexture!==void 0&&s.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,ft$2)),Promise.all(s)}};var Bc$1=class{constructor(e){this.parser=e,this.name=ke$2.EXT_MATERIALS_BUMP}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&s.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(s)}};var zc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return gt$1(this.parser,e,this.name)!==null?Wt:null}extendMaterialParams(e,t){let n=gt$1(this.parser,e,this.name);if(n===null)return Promise.resolve();let s=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&s.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(s)}};var kc$1=class{constructor(e){this.parser=e,this.name=ke$2.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;let r=s.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,r.source,o)}};var Vc$1=class{constructor(e){this.parser=e,this.name=ke$2.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;let o=r.extensions[t],a=s.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(e,o.source,l)}
vendor: 10,272 bytes, line 6724
6724};var Gc$1=class{constructor(e){this.parser=e,this.name=ke$2.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;let o=r.extensions[t],a=s.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return n.loadTextureImage(e,o.source,l)}};var ka=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let s=n.extensions[this.name],r=this.parser.getDependency(`buffer`,s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(a){let l=s.byteOffset||0,c=s.byteLength||0,h=s.count,d=s.byteStride,u=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,d,u,s.mode,s.filter).then(function(f){return f.buffer}):o.ready.then(function(){let f=new ArrayBuffer(h*d);return o.decodeGltfBuffer(new Uint8Array(f),h,d,u,s.mode,s.filter),f})})}else return null}};var Hc$1=class{constructor(e){this.name=ke$2.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let s=t.meshes[n.mesh];for(let c of s.primitives)if(c.mode!==dn$2.TRIANGLES&&c.mode!==dn$2.TRIANGLE_STRIP&&c.mode!==dn$2.TRIANGLE_FAN&&c.mode!==void 0)return null;let o=n.extensions[this.name].attributes,a=[],l={};for(let c in o)a.push(this.parser.getDependency(`accessor`,o[c]).then(h=>(l[c]=h,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{let h=c.pop(),d=h.isGroup?h.children:[h],u=c[0].count,f=[];for(let g of d){let y=new Le,m=new D$2,p=new en,E=new D$2(1,1,1),w=new sr$1(g.geometry,g.material,u);for(let M=0;M<u;M++)l.TRANSLATION&&m.fromBufferAttribute(l.TRANSLATION,M),l.ROTATION&&p.fromBufferAttribute(l.ROTATION,M),l.SCALE&&E.fromBufferAttribute(l.SCALE,M),w.setMatrixAt(M,y.compose(m,p,E));for(let M in l)if(M===`_COLOR_0`){let A=l[M];w.instanceColor=new fi(A.array,A.itemSize,A.normalized)}else M!==`TRANSLATION`&&M!==`ROTATION`&&M!==`SCALE`&&g.geometry.setAttribute(M,l[M]);bt$2.prototype.copy.call(w,g),this.parser.assignFinalMaterial(w),f.push(w)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}};var Ld=`glTF`;var Nr$1=12;var Rd={JSON:1313821514,BIN:5130562};var Wc$1=class{constructor(e){this.name=ke$2.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Nr$1),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ld)throw new Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw new Error(`THREE.GLTFLoader: Legacy binary file detected.`);let s=this.header.length-Nr$1,r=new DataView(e,Nr$1),o=0;for(;o<s;){let a=r.getUint32(o,!0);o+=4;let l=r.getUint32(o,!0);if(o+=4,l===Rd.JSON){let c=new Uint8Array(e,Nr$1+o,a);this.content=n.decode(c)}else if(l===Rd.BIN){let c=Nr$1+o;this.body=e.slice(c,c+a)}o+=a}if(this.content===null)throw new Error(`THREE.GLTFLoader: JSON content not found.`)}};var Xc$1=class{constructor(e,t){if(!t)throw new Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=ke$2.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,s=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(let h in o){let d=Kc$1[h]||h.toLowerCase();a[d]=o[h]}for(let h in e.attributes){let d=Kc$1[h]||h.toLowerCase();if(o[h]!==void 0){let u=n.accessors[e.attributes[h]];c[d]=Ds$1[u.componentType].name,l[d]=u.normalized===!0}}return t.getDependency(`bufferView`,r).then(function(h){return new Promise(function(d,u){s.decodeDracoFile(h,function(f){for(let g in f.attributes){let y=f.attributes[g],m=l[g];m!==void 0&&(y.normalized=m)}d(f)},a,c,Ot$2,u)})})}};var qc$1=class{constructor(){this.name=ke$2.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}};var Yc$1=class{constructor(){this.name=ke$2.KHR_MESH_QUANTIZATION}};var Va=class extends Ln{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let o=0;o!==s;o++)t[o]=n[r+o];return t}interpolate_(e,t,n,s){let r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,h=s-t,d=(n-t)/h,u=d*d,f=u*d,g=e*c,y=g-c,m=-2*f+3*u,p=f-u,E=1-m,w=p-u+d;for(let M=0;M!==a;M++){let A=o[y+M+a],b=o[y+M+l]*h,R=o[g+M+a],x=o[g+M]*h;r[M]=E*A+w*b+m*R+p*x}return r}};var V_=new en;var Zc$1=class extends Va{interpolate_(e,t,n,s){let r=super.interpolate_(e,t,n,s);return V_.fromArray(r).normalize().toArray(r),r}};var dn$2={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123};var Ds$1={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};var Cd={9728:pt$1,9729:mt$2,9984:Xo$1,9985:ws$1,9986:ki,9987:Sn$1};var Id={33071:hn$1,33648:cs$1,10497:ui};var Tc$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var Kc$1={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`};var yi={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`};var G_={CUBICSPLINE:void 0,LINEAR:Di,STEP:Ni};var Ac$1={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`};function H_(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new qn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:vn})),i.DefaultMaterial}function Wi(i,e,t){for(let n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function On$1(i,e){e.extras!==void 0&&(typeof e.extras==`object`?Object.assign(i.userData,e.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+e.extras))}function W_(i,e,t){let n=!1,s=!1,r=!1;for(let c=0,h=e.length;c<h;c++){let d=e[c];if(d.POSITION!==void 0&&(n=!0),d.NORMAL!==void 0&&(s=!0),d.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(i);let o=[],a=[],l=[];for(let c=0,h=e.length;c<h;c++){let d=e[c];if(n){let u=d.POSITION!==void 0?t.getDependency(`accessor`,d.POSITION):i.attributes.position;o.push(u)}if(s){let u=d.NORMAL!==void 0?t.getDependency(`accessor`,d.NORMAL):i.attributes.normal;a.push(u)}if(r){let u=d.COLOR_0!==void 0?t.getDependency(`accessor`,d.COLOR_0):i.attributes.color;l.push(u)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){let h=c[0],d=c[1],u=c[2];return n&&(i.morphAttributes.position=h),s&&(i.morphAttributes.normal=d),r&&(i.morphAttributes.color=u),i.morphTargetsRelative=!0,i})}function X_(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)i.morphTargetDictionary[t[n]]=n}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function q_(i){let e,t=i.extensions&&i.extensions[ke$2.KHR_DRACO_MESH_COMPRESSION];if(t?e=`draco:`+t.bufferView+`:`+t.indices+`:`+Ec$1(t.attributes):e=i.indices+`:`+Ec$1(i.attributes)+`:`+i.mode,i.targets!==void 0)for(let n=0,s=i.targets.length;n<s;n++)e+=`:`+Ec$1(i.targets[n]);return e}function Ec$1(i){let e=``,t=Object.keys(i).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+`:`+i[t[n]]+`;`;return e}function Jc$1(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function Y_(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?`image/jpeg`:i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?`image/webp`:i.search(/\.ktx2($|\?)/i)>0||i.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var Z_=new Le;var $c$1=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new k_,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=-1,r=!1,o=-1;if(typeof navigator<`u`&&typeof navigator.userAgent<`u`){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let l=a.match(/Version\/(\d+)/);s=n&&l?parseInt(l[1],10):-1,r=a.indexOf(`Firefox`)>-1,o=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&s<17||r&&o<98?this.textureLoader=new fr$1(this.options.manager):this.textureLoader=new vr$1(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new As$1(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()}
vendor: 5,074 bytes, line 6724
6724)).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(o){let a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:n,userData:{}};return Wi(r,a,s),On$1(a,s),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(let l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){let o=t[s].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let s=0,r=e.length;s<r;s++){let o=e[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let s=n.clone(),r=(o,a)=>{let l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(let[c,h]of o.children.entries())r(h,a.children[c])};return r(n,s),s.name+=`_instance_`+e.uses[t]++,s}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let s=e(t[n]);if(s)return s}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let s=0;s<t.length;s++){let r=e(t[s]);r&&n.push(r)}return n}getDependency(e,t){let n=e+`:`+t,s=this.cache.get(n);if(!s){switch(e){case`scene`:s=this.loadScene(t);break;case`node`:s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case`mesh`:s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case`accessor`:s=this.loadAccessor(t);break;case`bufferView`:s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case`buffer`:s=this.loadBuffer(t);break;case`material`:s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case`texture`:s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case`skin`:s=this.loadSkin(t);break;case`animation`:s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case`camera`:s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!s)throw new Error(`Unknown type: `+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,s=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(s.map(function(r,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw new Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[ke$2.KHR_BINARY_GLTF].body);let s=this.options;return new Promise(function(r,o){n.load(jn.resolveURL(t.uri,s.path),r,void 0,function(){o(new Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(n){let s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){let t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){let o=Tc$1[s.type],a=Ds$1[s.componentType],l=s.normalized===!0,c=new a(s.count*o);return Promise.resolve(new ct$2(c,o,l))}let r=[];return s.bufferView!==void 0?r.push(this.getDependency(`bufferView`,s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency(`bufferView`,s.sparse.indices.bufferView)),r.push(this.getDependency(`bufferView`,s.sparse.values.bufferView))),Promise.all(r).then(function(o){let a=o[0],l=Tc$1[s.type],c=Ds$1[s.componentType],h=c.BYTES_PER_ELEMENT,d=h*l,u=s.byteOffset||0,f=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0,y,m;if(f&&f!==d){let p=Math.floor(u/f),E=`InterleavedBuffer:`+s.bufferView+`:`+s.componentType+`:`+p+`:`+s.count,w=t.cache.get(E);w||(y=new c(a,p*f,s.count*f/h),w=new _s$1(y,f/h),t.cache.add(E,w)),m=new xs$1(w,l,u%f/h,g)}else a===null?y=new c(s.count*l):y=new c(a,u,s.count*l),m=new ct$2(y,l,g);if(s.sparse!==void 0){let p=Tc$1.SCALAR,E=Ds$1[s.sparse.indices.componentType],w=s.sparse.indices.byteOffset||0,M=s.sparse.values.byteOffset||0,A=new E(o[1],w,s.sparse.count*p),b=new c(o[2],M,s.sparse.count*l);a!==null&&(m=new ct$2(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let R=0,x=A.length;R<x;R++){let T=A[R];if(m.setX(T,b[R*l]),l>=2&&m.setY(T,b[R*l+1]),l>=3&&m.setZ(T,b[R*l+2]),l>=4&&m.setW(T,b[R*l+3]),l>=5)throw new Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}m.normalized=g}return m})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,o=t.images[r],a=this.textureLoader;if(o.uri){let l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let s=this,r=this.json,o=r.textures[e],a=r.images[t],l=(a.uri||a.bufferView)+`
6724:`+o.sampler;if(this.textureCache[l])return this.textureCache[l];let c=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=o.name||a.name||``,h.name===``&&typeof a.uri==`string`&&a.uri.startsWith(`data:image/`)===!1&&(h.name=a.uri);let u=(r.samplers||{})[o.sampler]||{};return h.magFilter=Cd[u.magFilter]||mt$2,h.minFilter=Cd[u.minFilter]||Sn$1,h.wrapS=Id[u.wrapS]||ui,h.wrapT=Id[u.wrapT]||ui,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==pt$1&&h.minFilter!==mt$2,s.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){let n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());let o=s.images[e],a=self.URL||self.webkitURL,l=o.uri||``,c=!1;if(o.bufferView!==void 0)l=n.getDependency(`bufferView`,o.bufferView).then(function(d){c=!0;let u=new Blob([d],{type:o.mimeType});return l=a.createObjectURL(u),l});else if(o.uri===void 0)throw new Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let h=Promise.resolve(l).then(function(d){return new Promise(function(u,f){let g=u;t.isImageBitmapLoader===!0&&(g=function(y){let m=new an(y);m.needsUpdate=!0,u(m)}),t.load(jn.resolveURL(d,r.path),g,void 0,f)})}).then(function(d){return c===!0&&a.revokeObjectURL(l),On$1(d,o),d.userData.mimeType=o.mimeType||Y_(o.uri),d}).catch(function(d){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,l),d});return this.sourceCache[e]=h,h}assignTexture(e,t,n,s){let r=this;return this.getDependency(`texture`,n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),r.extensions[ke$2.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[ke$2.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let l=r.associations.get(o);o=r.extensions[ke$2.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,l)}}
vendor: 5,372 bytes, line 6724
6724return s!==void 0&&(o.colorSpace=s),e[t]=o,o})}assignFinalMaterial(e){let t=e.geometry,n=e.material,s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){let a=`PointsMaterial:`+n.uuid,l=this.cache.get(a);l||(l=new bs$1,Ht.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){let a=`LineBasicMaterial:`+n.uuid,l=this.cache.get(a);l||(l=new Ss$1,Ht.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(s||r||o){let a=`ClonedMaterial:`+n.uuid+`:`;s&&(a+=`derivative-tangents:`),r&&(a+=`vertex-colors:`),o&&(a+=`flat-shading:`);let l=this.cache.get(a);l||(l=n.clone(),r&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return qn}loadMaterial(e){let t=this,n=this.json,s=this.extensions,r=n.materials[e],o,a={},l=r.extensions||{},c=[];if(l[ke$2.KHR_MATERIALS_UNLIT]){let d=s[ke$2.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),c.push(d.extendParams(a,r,t))}else{let d=r.pbrMetallicRoughness||{};if(a.color=new Ae$1(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){let u=d.baseColorFactor;a.color.setRGB(u[0],u[1],u[2],Ot$2),a.opacity=u[3]}d.baseColorTexture!==void 0&&c.push(t.assignTexture(a,`map`,d.baseColorTexture,ft$2)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,`metalnessMap`,d.metallicRoughnessTexture)),c.push(t.assignTexture(a,`roughnessMap`,d.metallicRoughnessTexture))),o=this._invokeOne(function(u){return u.getMaterialType&&u.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(u){return u.extendMaterialParams&&u.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=un$2);let h=r.alphaMode||Ac$1.OPAQUE;if(h===Ac$1.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===Ac$1.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==yn$1&&(c.push(t.assignTexture(a,`normalMap`,r.normalTexture)),a.normalScale=new Fe$1(1,1),r.normalTexture.scale!==void 0)){let d=r.normalTexture.scale;a.normalScale.set(d,d)}if(r.occlusionTexture!==void 0&&o!==yn$1&&(c.push(t.assignTexture(a,`aoMap`,r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==yn$1){let d=r.emissiveFactor;a.emissive=new Ae$1().setRGB(d[0],d[1],d[2],Ot$2)}return r.emissiveTexture!==void 0&&o!==yn$1&&c.push(t.assignTexture(a,`emissiveMap`,r.emissiveTexture,ft$2)),Promise.all(c).then(function(){let d=new o(a);return r.name&&(d.name=r.name),On$1(d,r),t.associations.set(d,{materials:e}),r.extensions&&Wi(s,d,r),d})}createUniqueName(e){let t=st$1.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,s=this.primitiveCache;function r(a){return n[ke$2.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Pd(l,a,t)})}let o=[];for(let a=0,l=e.length;a<l;a++){let c=e[a],h=q_(c),d=s[h];if(d)o.push(d.promise);else{let u;c.extensions&&c.extensions[ke$2.KHR_DRACO_MESH_COMPRESSION]?u=r(c):u=Pd(new Bt$1,c,t),s[h]={primitive:c,promise:u},o.push(u)}}return Promise.all(o)}loadMesh(e){let t=this,n=this.json,s=this.extensions,r=n.meshes[e],o=r.primitives,a=[];for(let l=0,c=o.length;l<c;l++){let h=o[l].material===void 0?H_(this.cache):this.getDependency(`material`,o[l].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){let c=l.slice(0,l.length-1),h=l[l.length-1],d=[];for(let f=0,g=h.length;f<g;f++){let y=h[f],m=o[f],p,E=c[f];if(m.mode===dn$2.TRIANGLES||m.mode===dn$2.TRIANGLE_STRIP||m.mode===dn$2.TRIANGLE_FAN||m.mode===void 0)p=r.isSkinnedMesh===!0?new Fi(y,E):new Mt$2(y,E),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),m.mode===dn$2.TRIANGLE_STRIP?p.geometry=bc$1(p.geometry,Cr$1):m.mode===dn$2.TRIANGLE_FAN&&(p.geometry=bc$1(p.geometry,Is$1));else if(m.mode===dn$2.LINES)p=new rr(y,E);else if(m.mode===dn$2.LINE_STRIP)p=new Oi(y,E);else if(m.mode===dn$2.LINE_LOOP)p=new or$1(y,E);else if(m.mode===dn$2.POINTS)p=new ar$1(y,E);else throw new Error(`THREE.GLTFLoader: Primitive mode unsupported: `+m.mode);Object.keys(p.geometry.morphAttributes).length>0&&X_(p,r),p.name=t.createUniqueName(r.name||`mesh_`+e),On$1(p,r),m.extensions&&Wi(s,p,m),t.assignFinalMaterial(p),d.push(p)}for(let f=0,g=d.length;f<g;f++)t.associations.set(d[f],{meshes:e,primitives:f});if(d.length===1)return r.extensions&&Wi(s,d[0],r),d[0];let u=new Qt;r.extensions&&Wi(s,u,r),t.associations.set(u,{meshes:e});for(let f=0,g=d.length;f<g;f++)u.add(d[f]);return u})}loadCamera(e){let t,n=this.json.cameras[e],s=n[n.type];if(!s){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new yt$1(ic$1.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type===`orthographic`&&(t=new mi(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),On$1(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;
vendor: 4,263 bytes, line 6724
6724s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency(`accessor`,t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){let r=s.pop(),o=s,a=[],l=[];for(let c=0,h=o.length;c<h;c++){let d=o[c];if(d){a.push(d);let u=new Le;r!==null&&u.fromArray(r.array,c*16),l.push(u)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[c])}return new ir$1(a,l)})}loadAnimation(e){let t=this.json,n=this,s=t.animations[e],r=s.name?s.name:`animation_`+e,o=[],a=[],l=[],c=[],h=[];for(let d=0,u=s.channels.length;d<u;d++){let f=s.channels[d],g=s.samplers[f.sampler],y=f.target,m=y.node,p=s.parameters!==void 0?s.parameters[g.input]:g.input,E=s.parameters!==void 0?s.parameters[g.output]:g.output;y.node!==void 0&&(o.push(this.getDependency(`node`,m)),a.push(this.getDependency(`accessor`,p)),l.push(this.getDependency(`accessor`,E)),c.push(g),h.push(y))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c),Promise.all(h)]).then(function(d){let u=d[0],f=d[1],g=d[2],y=d[3],m=d[4],p=[];for(let w=0,M=u.length;w<M;w++){let A=u[w],b=f[w],R=g[w],x=y[w],T=m[w];if(A===void 0)continue;A.updateMatrix&&A.updateMatrix();let L=n._createAnimationTracks(A,b,R,x,T);if(L)for(let C=0;C<L.length;C++)p.push(L[C])}let E=new dr$1(r,void 0,p);return On$1(E,s),E})}createNodeMesh(e){let t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency(`mesh`,s.mesh).then(function(r){let o=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=s.weights.length;l<c;l++)a.morphTargetInfluences[l]=s.weights[l]}),o})}loadNode(e){let t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),o=[],a=s.children||[];for(let c=0,h=a.length;c<h;c++)o.push(n.getDependency(`node`,a[c]));let l=s.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,s.skin);return Promise.all([r,Promise.all(o),l]).then(function(c){let h=c[0],d=c[1],u=c[2];u!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(u,Z_)});for(let f=0,g=d.length;f<g;f++)h.add(d[f]);if(h.userData.pivot!==void 0&&d.length>0){let f=h.userData.pivot,g=d[0];h.pivot=new D$2().fromArray(f),h.position.x-=f[0],h.position.y-=f[1],h.position.z-=f[2],g.position.set(0,0,0),delete h.userData.pivot}return h})}_loadNodeShallow(e){let t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let r=t.nodes[e],o=r.name?s.createUniqueName(r.name):``,a=[],l=s._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),r.camera!==void 0&&a.push(s.getDependency(`camera`,r.camera).then(function(c){return s._getNodeRef(s.cameraCache,r.camera,c)})),s._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let h;if(r.isBone===!0?h=new vs$1:c.length>1?h=new Qt:c.length===1?h=c[0]:h=new bt$2,h!==c[0])for(let d=0,u=c.length;d<u;d++)h.add(c[d]);if(r.name&&(h.userData.name=r.name,h.name=o),On$1(h,r),r.extensions&&Wi(n,h,r),r.matrix!==void 0){let d=new Le;d.fromArray(r.matrix),h.applyMatrix4(d)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);if(!s.associations.has(h))s.associations.set(h,{});else if(r.mesh!==void 0&&s.meshCache.refs[r.mesh]>1){let d=s.associations.get(h);s.associations.set(h,q$1({},d))}return s.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],s=this,r=new Qt;n.name&&(r.name=s.createUniqueName(n.name)),On$1(r,n),n.extensions&&Wi(t,r,n);let o=n.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(s.getDependency(`node`,o[l]));return Promise.all(a).then(function(l){for(let h=0,d=l.length;h<d;h++){let u=l[h];u.parent!==null?r.add(Ed(u)):r.add(u)}let c=h=>{let d=new Map;for(let[u,f]of s.associations)(u instanceof Ht||u instanceof an)&&d.set(u,f);return h.traverse(u=>{let f=s.associations.get(u);f!=null&&d.set(u,f)}),d};return s.associations=c(r),r})}_createAnimationTracks(e,t,n,s,r){let o=[],a=e.name?e.name:e.uuid,l=[];function c(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}
6724yi[r.path]===yi.weights?(c(e),e.isGroup&&e.children.forEach(c)):l.push(a);let h;switch(yi[r.path]){case yi.weights:h=Zn;break;case yi.rotation:h=Kn;break;case yi.translation:case yi.scale:h=pi$1;break;default:n.itemSize===1?h=Zn:h=pi$1;break}let d=s.interpolation!==void 0?G_[s.interpolation]:Di,u=this._getArrayFromAccessor(n);for(let f=0,g=l.length;f<g;f++){let y=new h(l[f]+`.`+yi[r.path],t.array,u,d);s.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(y),o.push(y)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Jc$1(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r<o;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof Kn?Zc$1:Va)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function K_(i,e,t){let n=e.attributes,s=new nn;if(n.POSITION!==void 0){let a=t.json.accessors[n.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(s.set(new D$2(l[0],l[1],l[2]),new D$2(c[0],c[1],c[2])),a.normalized){let h=Jc$1(Ds$1[a.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let r=e.targets;if(r!==void 0){let a=new D$2,l=new D$2;for(let c=0,h=r.length;c<h;c++){let d=r[c];if(d.POSITION!==void 0){let u=t.json.accessors[d.POSITION],f=u.min,g=u.max;if(f!==void 0&&g!==void 0){if(l.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),l.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),l.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),u.normalized){let y=Jc$1(Ds$1[u.componentType]);l.multiplyScalar(y)}a.max(l)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}s.expandByVector(a)}i.boundingBox=s;let o=new Gt;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,i.boundingSphere=o}function Pd(i,e,t){let n=e.attributes,s=[];function r(o,a){return t.getDependency(`accessor`,o).then(function(l){i.setAttribute(a,l)})}for(let o in n){let a=Kc$1[o]||o.toLowerCase();a in i.attributes||s.push(r(n[o],a))}if(e.indices!==void 0&&!i.index){let o=t.getDependency(`accessor`,e.indices).then(function(a){i.setIndex(a)});s.push(o)}return ze.workingColorSpace!==Ot$2&&`COLOR_0`in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ze.workingColorSpace}" not supported.`),On$1(i,e),K_(i,e,t),Promise.all(s).then(function(){return e.targets!==void 0?W_(i,e.targets,t):i})}var Nd=[`chest`,`lats`,`upper_back`,`lower_back`,`front_delt`,`side_delt`,`rear_delt`,`biceps`,`triceps`,`quadriceps`,`hamstrings`,`glutes`,`calves`,`core`];var Dd={chest:`admin.exercises.muscleGroups.chest`,lats:`admin.exercises.muscleGroups.lats`,upper_back:`admin.exercises.muscleGroups.upperBack`,lower_back:`admin.exercises.muscleGroups.lowerBack`,front_delt:`admin.exercises.muscleGroups.frontDelt`,side_delt:`admin.exercises.muscleGroups.sideDelt`,rear_delt:`admin.exercises.muscleGroups.rearDelt`,biceps:`admin.exercises.muscleGroups.biceps`,triceps:`admin.exercises.muscleGroups.triceps`,quadriceps:`admin.exercises.muscleGroups.quadriceps`,hamstrings:`admin.exercises.muscleGroups.hamstrings`,glutes:`admin.exercises.muscleGroups.glutes`,calves:`admin.exercises.muscleGroups.calves`,core:`admin.exercises.muscleGroups.core`};var J_=[`canvasHost`];function $_(i,e){i&1&&(Bi$3(0,`span`,8),lC(1),vl$4()),i&2&&(sE(),ig(e))}function j_(i,e){if(i&1&&(Bi$3(0,`div`,3),lC(1),OC(2,`translate`),fw(3,$_,2,1,`span`,8),vl$4()),i&2){let t,n=xw();sE(),Cl$4(` `,LC(2,2,e),` `),sE(2),pw((t=n.hoveredWeightLabel())?3:-1,t)}}var Q_=`assets/models/muscle-group-body.glb`;var Dr$1=new Ae$1(12826795);var ex=new Ae$1(16766287);var tx=new Ae$1(15022389);function Ud(i){if(i<=0)return Dr$1.clone();let e=Math.min(Math.max((i-.1)/.9,0),1);return ex.clone().lerp(tx,e)}function Fd(i){return i.userData.muscleGroup||Nd.find(t=>i.name===t||i.name.startsWith(`${t}_`))}var Od=class i{weights=Q1({});hoveredGroup=Q1(null);groupHover=z1();canvasHost=Y1.required(`canvasHost`);zone=E(Z$4);renderer;scene;
6724camera;gltfLoader=new za;bodyGroup=new Qt;muscleMeshes=[];skinnedMesh;boneMuscleGroups=[];raycaster=new yr$1;pointerNdc=new Fe$1;resizeObserver;animationFrameId;dragging=!1;lastPointerX=0;lastPointerY=0;rotationY=.6;rotationX=0;autoRotate=!0;currentHovered=null;hoveredLabelKey=ni$3(null);hoveredWeightValue=ni$3(null);hoveredWeightLabel=$C(()=>{let e=this.hoveredWeightValue();return e===null?null:`${Math.round(e*100)}%`});tooltipLabelKey=$C(()=>this.hoveredLabelKey());constructor(){xd$2(()=>{let e=this.weights();this.applyWeights(e)}),xd$2(()=>{this.hoveredGroup(),this.applyHighlight()})}ngAfterViewInit(){this.zone.runOutsideAngular(()=>{this.initScene(),this.loadModel(),this.renderLoop()}),this.resizeObserver=new ResizeObserver(()=>this.handleResize()),this.resizeObserver.observe(this.canvasHost().nativeElement)}ngOnDestroy(){this.resizeObserver?.disconnect(),this.animationFrameId!==void 0&&cancelAnimationFrame(this.animationFrameId);let e=this.renderer?.domElement;e&&(e.removeEventListener(`pointerdown`,this.onPointerDown),e.removeEventListener(`pointermove`,this.onPointerMove),e.removeEventListener(`pointerleave`,this.onPointerLeave)),window.removeEventListener(`pointerup`,this.onPointerUp),this.scene?.traverse(t=>{if(t instanceof Mt$2){t.geometry.dispose();let n=t.material;Array.isArray(n)?n.forEach(s=>s.dispose()):n.dispose()}}),this.renderer?.dispose()}resetView(){this.rotationY=.6,this.rotationX=0,this.autoRotate=!0,this.bodyGroup.rotation.set(this.rotationX,this.rotationY,0)}initScene(){let e=this.canvasHost().nativeElement;this.scene=new er$1,this.camera=new yt$1(35,(e.clientWidth||1)/(e.clientHeight||1),.1,100),this.camera.position.set(0,.6,3.2),this.camera.lookAt(0,.55,0),this.renderer=new Fa({antialias:!0,alpha:!0}),this.renderer.outputColorSpace=ft$2,this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.renderer.setSize(e.clientWidth||1,e.clientHeight||1),e.appendChild(this.renderer.domElement),this.scene.add(new pr$1(16777215,5591103,1.2));let t=new $n(16774374,1.3);t.position.set(2,3.4,4),this.scene.add(t);let n=new $n(14477567,.45);n.position.set(-2.5,1,-2),this.scene.add(n);let s=new $n(16777215,.35);s.position.set(0,2,-3.5),this.scene.add(s),this.bodyGroup.rotation.y=this.rotationY,this.scene.add(this.bodyGroup);let r=this.renderer.domElement;r.style.touchAction=`none`,r.addEventListener(`pointerdown`,this.onPointerDown),r.addEventListener(`pointermove`,this.onPointerMove),r.addEventListener(`pointerleave`,this.onPointerLeave),window.addEventListener(`pointerup`,this.onPointerUp)}loadModel(){return ps$4(this,null,function*(){try{let e=yield this.gltfLoader.loadAsync(Q_);e.scene.traverse(t=>{if(t instanceof Fi&&!this.skinnedMesh)this.skinnedMesh=t,this.boneMuscleGroups=t.skeleton.bones.map(n=>Fd(n)),t.material=new qn({vertexColors:!0,roughness:.6,metalness:.04}),t.geometry.setAttribute(`color`,new ct$2(new Float32Array(t.geometry.getAttribute(`position`).count*3),3));else if(t instanceof Mt$2){let n=Fd(t);n&&this.muscleMeshes.push({muscleGroup:n,mesh:t})}}),this.bodyGroup.add(e.scene),this.applyWeights(this.weights()),this.applyHighlight()}catch(e){uu$2.error(`Failed to load muscle-group body model`,e)}})}onPointerDown=e=>{this.dragging=!0,this.autoRotate=!1,this.lastPointerX=e.clientX,this.lastPointerY=e.clientY};onPointerMove=e=>{if(this.dragging){let t=e.clientX-this.lastPointerX,n=e.clientY-this.lastPointerY;this.lastPointerX=e.clientX,this.lastPointerY=e.clientY,this.rotationY+=t*.01,this.rotationX=Math.max(-.5,Math.min(.5,this.rotationX+n*.01)),this.bodyGroup.rotation.y=this.rotationY,this.bodyGroup.rotation.x=this.rotationX;return}this.updateHover(e)};onPointerUp=()=>{this.dragging=!1};onPointerLeave=()=>{this.dragging=!1,this.setHovered(null)};updateHover(e){if(!this.renderer||!this.camera)return;let t=this.renderer.domElement.getBoundingClientRect();this.pointerNdc.x=(e.clientX-t.left)/t.width*2-1,this.pointerNdc.y=-((e.clientY-t.top)/t.height)*2+1,this.raycaster.setFromCamera(this.pointerNdc,this.camera);let n=this.muscleMeshes.map(o=>o.mesh);this.skinnedMesh&&n.push(this.skinnedMesh);let s=this.raycaster.intersectObjects(n)[0],r=null;s&&this.skinnedMesh&&s.object===this.skinnedMesh&&s.face?r=this.dominantGroupForVertex(s.face.a)??null:s&&(r=s.object.userData.muscleGroup??null),this.setHovered(r)}dominantGroupForVertex(e){let t=this.skinnedMesh?.geometry,n=t?.getAttribute(`skinIndex`),s=t?.getAttribute(`skinWeight`);if(!n||!s)return;let r,o=-1;for(let a=0;a<n.itemSize;a++){let l=s.getComponent(e,a);l<=o||(o=l,r=this.boneMuscleGroups[n.getComponent(e,a)])}return r}setHovered(e){e!==this.currentHovered&&(this.currentHovered=e,this.zone.run(()=>{this.groupHover.emit(e),this.hoveredLabelKey.set(e?Dd[e]:null),this.hoveredWeightValue.set(e?this.weights()[e]??0:null)}),this.applyHighlight())}applyHighlight(){let e=this.currentHovered??this.hoveredGroup();for(let t of this.muscleMeshes)t.mesh.material.emissive.set(e===t.muscleGroup?3815994:0);this.updateSkinnedMeshColors()}applyWeights(e){for(let t of this.muscleMeshes)t.mesh.material.color.copy(Ud(e[t.muscleGroup]??0));this.updateSkinnedMeshColors()}updateSkinnedMeshColors(){let e=this.skinnedMesh,t=e?.geometry,n=t?.getAttribute(`skinIndex`),s=t?.getAttribute(`skinWeight`),r=t?.getAttribute(`color`);if(!e||!t||!n||!s||!r)return;let o=this.weights(),a=this.currentHovered??this.hoveredGroup(),l=new Ae$1;for(let c=0;c<r.count;c++){l.setRGB(0,0,0);let h=0,d,u=-1;for(let g=0;g<n.itemSize;g++){let y=s.getComponent(c,g);
6724if(y<=0)continue;let m=this.boneMuscleGroups[n.getComponent(c,g)],p=m?Ud(o[m]??0):Dr$1;l.r+=p.r*y,l.g+=p.g*y,l.b+=p.b*y,h+=y,y>u&&(u=y,d=m)}let f=1-h;f>0&&(l.r+=Dr$1.r*f,l.g+=Dr$1.g*f,l.b+=Dr$1.b*f),a&&a===d&&l.offsetHSL(0,0,.12),r.setXYZ(c,l.r,l.g,l.b)}r.needsUpdate=!0}handleResize(){if(!this.renderer||!this.camera)return;let e=this.canvasHost().nativeElement,t=e.clientWidth||1,n=e.clientHeight||1;this.camera.aspect=t/n,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,n)}renderLoop=()=>{this.autoRotate&&!this.dragging&&(this.rotationY+=.0025,this.bodyGroup.rotation.y=this.rotationY),this.renderer?.render(this.scene,this.camera),this.animationFrameId=requestAnimationFrame(this.renderLoop)};static ɵfac=function(t){return new(t||i)};static ɵcmp=PD({type:i,selectors:[[`app-muscle-group-body-viewer`]],viewQuery:function(t,n){t&1&&qh$2(n.canvasHost,J_,5),t&2&&Fw()},inputs:{weights:[1,`weights`],hoveredGroup:[1,`hoveredGroup`]},outputs:{groupHover:`groupHover`},decls:20,vars:16,consts:[[`canvasHost`,``],[`data-testid`,`muscle-group-viewer`,1,`muscle-viewer`],[1,`muscle-viewer__canvas-host`],[`data-testid`,`muscle-group-viewer-tooltip`,1,`muscle-viewer__tooltip`],[`data-testid`,`muscle-group-viewer-hint`,1,`muscle-viewer__hint`],[`type`,`button`,`mat-icon-button`,``,`data-testid`,`muscle-group-viewer-reset`,1,`muscle-viewer__reset`,3,`click`,`matTooltip`],[`data-testid`,`muscle-group-viewer-legend`,1,`muscle-viewer__legend`],[1,`muscle-viewer__legend-gradient`],[1,`muscle-viewer__tooltip-weight`]],template:function(t,n){if(t&1&&(Bi$3(0,`div`,1),Rh$3(1,`div`,2,0),fw(3,j_,4,4,`div`,3),Bi$3(4,`div`,4),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`button`,5),OC(8,`translate`),OC(9,`translate`),jh$3(`click`,function(){return n.resetView()}),Bi$3(10,`mat-icon`),lC(11,`restart_alt`),vl$4()(),Bi$3(12,`div`,6)(13,`span`),lC(14),OC(15,`translate`),vl$4(),Rh$3(16,`span`,7),Bi$3(17,`span`),lC(18),OC(19,`translate`),vl$4()()()),t&2){let s;sE(3),pw((s=n.tooltipLabelKey())?3:-1,s),sE(2),Cl$4(` `,LC(6,6,`admin.exercises.muscleGroupViewerHint`),` `),sE(2),Ah$2(`matTooltip`,LC(8,8,`admin.exercises.muscleGroupViewerReset`)),xh$2(`aria-label`,LC(9,10,`admin.exercises.muscleGroupViewerReset`)),sE(7),ig(LC(15,12,`admin.exercises.muscleGroupViewerLow`)),sE(4),ig(LC(19,14,`admin.exercises.muscleGroupViewerHigh`))}},dependencies:[Ap$1,xc$4,yt$7,wt$5,I$6,Ct$5,Xp$1],styles:[`.muscle-viewer[_ngcontent-%COMP%]{position:relative;width:100%;height:100%;min-height:260px;border-radius:8px;overflow:hidden;background:var(--%NS%box-color, rgba(0, 0, 0, .03))}.muscle-viewer__canvas-host[_ngcontent-%COMP%]{width:100%;height:100%;cursor:grab}.muscle-viewer__canvas-host[_ngcontent-%COMP%]:active{cursor:grabbing}.muscle-viewer__canvas-host[_ngcontent-%COMP%] canvas[_ngcontent-%COMP%]{display:block}.muscle-viewer__hint[_ngcontent-%COMP%]{position:absolute;top:6px;left:8px;font-size:.6875rem;color:var(--%NS%gray-link-color, #888);pointer-events:none}.muscle-viewer__reset[_ngcontent-%COMP%]{position:absolute;top:2px;right:2px}.muscle-viewer__tooltip[_ngcontent-%COMP%]{position:absolute;bottom:40px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.375rem;padding:2px 10px;border-radius:999px;background:#000000bf;color:#fff;font-size:.75rem;white-space:nowrap;pointer-events:none}.muscle-viewer__tooltip-weight[_ngcontent-%COMP%]{font-weight:600;font-variant-numeric:tabular-nums}.muscle-viewer__legend[_ngcontent-%COMP%]{position:absolute;bottom:8px;left:8px;right:8px;display:flex;align-items:center;gap:.375rem;font-size:.625rem;color:var(--%NS%gray-link-color, #888);pointer-events:none}.muscle-viewer__legend-gradient[_ngcontent-%COMP%]{flex:1;height:6px;border-radius:3px;background:linear-gradient(to right,#c3b8ab,#ffd54f,#e53935)}`]})};var d$1=class n{size=Q1(`md`);static ɵfac=function(t){return new(t||n)};static ɵcmp=PD({type:n,selectors:[[`app-beta-badge`]],inputs:{size:[1,`size`]},decls:2,vars:4,consts:[[1,`beta-badge`]],template:function(t,o){t&1&&(Il$4(0,`span`,0),lC(1,`Beta`),El$4()),t&2&&Yh$3(`beta-badge--sm`,o.size()===`sm`)(`beta-badge--md`,o.size()===`md`)},styles:[`[_nghost-%COMP%]{display:inline-flex;align-items:center}.beta-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;background-color:var(--%NS%primarylime);color:var(--%NS%primaryBlack);font-weight:700;letter-spacing:.07em;text-transform:uppercase;line-height:1}.beta-badge--md[_ngcontent-%COMP%]{font-size:.6rem;padding:.22rem .55rem}.beta-badge--sm[_ngcontent-%COMP%]{font-size:.5rem;padding:.15rem .4rem}`]})};function W(n,e){if(n&1&&(Bi$3(0,`span`),lC(1),OC(2,`translate`),vl$4()),n&2){let t=xw().$implicit;sE(),Cl$4(` `,LC(2,1,t.translationKey),` `)}}function A(n,e){if(n&1&&lC(0),n&2){let t=xw().$implicit;Cl$4(` `,t.label,` `)}}function K(n,e){n&1&&Rh$3(0,`app-beta-badge`,3)}function R$1(n,e){if(n&1){let t=Cw();Bi$3(0,`button`,2),jh$3(`click`,function(){let G=ld$2(t).$implicit;return ud$1(xw().selectOption(G.value))}),fw(1,W,3,3,`span`)(2,A,1,1),fw(3,K,1,0,`app-beta-badge`,3),vl$4()}if(n&2){let t=e.$implicit,o=xw();Xw(o.getSizeClasses()),Yh$3(`active`,o.isSelected(t.value))(`shadow-sm`,o.isSelected(t.value))(`text-gray-900`,o.isSelected(t.value))(`text-gray-600`,!o.isSelected(t.value)),Ah$2(`disabled`,o.disabled),sE(),pw(t.translationKey?1:2),sE(2),pw(t.badge?3:-1)}}var D$1=class n{options=[];disabled=!1;size=`medium`;fullWidth=!1;value=``;selectionChange=new Qe$1;_internalValue=``;onChange=e=>{};onTouched=()=>{};get currentValue(){return this.value||this._internalValue}selectOption(e){this.disabled||(this._internalValue=e,this.onChange(e),this.onTouched(),this.selectionChange.emit(e))}isSelected(e){return this.currentValue===e}getSizeClasses(){let e=`rounded-full transition-colors touch-manipulation`;switch(this.size){case`small`:return`${e} px-4 py-4 text-xs`;case`large`:return`${e} px-3 py-3 text-sm`;default:return`${e} px-2.5 py-1 text-sm sm:px-3`}}getContainerClasses(){let e=`flex flex-wrap w-full p-1 min-w-0 gap-1 sm:gap-2 lg:gap-3`;return this.fullWidth?`${e} flex-1`:e}writeValue(e){this._internalValue=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.disabled=e}static ɵfac=function(t){return new(t||n)};static ɵcmp=PD({type:n,selectors:[[`app-toggle-button-group`]],inputs:{options:`options`,disabled:`disabled`,size:`size`,fullWidth:`fullWidth`,value:`value`},outputs:{selectionChange:`selectionChange`},features:[CC([{provide:E$3,useExisting:Oo$4(()=>n),multi:!0}])],decls:3,vars:4,consts:[[1,`btn-group`],[`type`,`button`,1,`toggle-btn`,3,`class`,`active`,`shadow-sm`,`text-gray-900`,`text-gray-600`,`disabled`],[`type`,`button`,1,`toggle-btn`,3,`click`,`disabled`],[`size`,`sm`]],template:function(t,o){t&1&&(Bi$3(0,`div`,0),mw(1,R$1,4,13,`button`,1,gw),vl$4()),t&2&&(Xw(o.getContainerClasses()),Yh$3(`opacity-50`,o.disabled),sE(),yw(o.options))},dependencies:[d$1,Xp$1],styles:[`[_nghost-%COMP%]{display:block;width:100%;max-width:100%;min-width:0}.layout-mode-toggle[_nghost-%COMP%]{width:auto;max-width:100%;flex-shrink:0}.table-category-toggle[_nghost-%COMP%]{width:auto;max-width:100%}.table-category-toggle[_nghost-%COMP%] .btn-group[_ngcontent-%COMP%]{border:1px solid var(--%NS%border-color);border-radius:999px;padding:.25rem;width:auto;gap:.25rem;background:transparent}.table-category-toggle[_nghost-%COMP%] .toggle-btn[_ngcontent-%COMP%]{border-radius:999px;padding:.625rem 1.25rem;background:transparent;border:none;font-size:.9rem}.table-category-toggle[_nghost-%COMP%] .toggle-btn.active[_ngcontent-%COMP%]{background:var(--%NS%primary);color:var(--%NS%primaryBlack);box-shadow:none}.table-category-toggle[_nghost-%COMP%] .toggle-btn.active[_ngcontent-%COMP%]:hover{background:var(--%NS%primary);color:var(--%NS%primaryBlack)}.table-category-toggle[_nghost-%COMP%] .toggle-btn[_ngcontent-%COMP%]:not(.active){color:var(--%NS%gray-link-color);background:transparent}.table-category-toggle[_nghost-%COMP%] .toggle-btn[_ngcontent-%COMP%]:not(.active):hover{color:var(--%NS%text-color);background:#ffffff0a}.table-edit-scope-toggle[_nghost-%COMP%]{width:auto;max-width:none;flex:0 0 auto}.table-edit-scope-toggle[_nghost-%COMP%] .btn-group[_ngcontent-%COMP%]{width:auto;flex-wrap:nowrap}.btn-group[_ngcontent-%COMP%]{border-radius:.5rem;padding:.125rem;display:flex;flex-wrap:wrap;width:100%;overflow-x:hidden}.toggle-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;font-weight:600}.toggle-btn[_ngcontent-%COMP%]:not(:disabled):hover{background-color:#0000000d}.toggle-btn[_ngcontent-%COMP%]:not(:disabled):active{transform:scale(.98)}.toggle-btn.active[_ngcontent-%COMP%]{background:var(--%NS%primary);color:var(--%NS%primaryBlack);box-shadow:0 1px 2px #0000001a}.toggle-btn.active[_ngcontent-%COMP%]:hover{background:var(--%NS%primary-dark);color:var(--%NS%primaryWhite)}.toggle-btn[_ngcontent-%COMP%]:not(.active){color:var(--%NS%gray-link-color)}.toggle-btn[_ngcontent-%COMP%]:not(.active):hover{background:var(--%NS%primary-dark);color:var(--%NS%text-color)}.toggle-btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}button[_ngcontent-%COMP%]:focus-visible{outline:2px solid theme("colors.blue.500");outline-offset:2px}button[_ngcontent-%COMP%]{min-width:fit-content;white-space:nowrap}button[_ngcontent-%COMP%]{transition:all .15s ease-in-out}`]})};var I$1=[[[``,`aiQuotaSecondaryAction`,``]]];var T=[`[aiQuotaSecondaryAction]`];function k(t,p){if(t&1){let i=Cw();Bi$3(0,`button`,8),jh$3(`click`,function(){ld$2(i);return ud$1(xw().goToBilling())}),lC(1),OC(2,`translate`),vl$4()}t&2&&(sE(),Cl$4(` `,LC(2,1,`aiQuota.exhausted.managerCta`),` `))}function D(t,p){t&1&&(Bi$3(0,`p`,7),lC(1),OC(2,`translate`),vl$4()),t&2&&(sE(),Cl$4(` `,LC(2,1,`aiQuota.exhausted.coachGuidance`),` `))}var q=class t{router=E(G$4);profileService=E(ie$4);goToBilling(){this.router.navigate([`/manager/billing`])}static ɵfac=function(i){return new(i||t)};static ɵcmp=PD({type:t,selectors:[[`app-ai-quota-exhausted-panel`]],ngContentSelectors:T,decls:14,vars:7,consts:[[`role`,`alert`,`data-testid`,`ai-quota-exhausted-panel`,1,`rounded-lg`,`p-4`,2,`background`,`var(--box-color)`,`border`,`1px solid var(--warning)`],[1,`flex`,`items-start`,`gap-3`],[`aria-hidden`,`true`,2,`color`,`var(--warning)`],[1,`min-w-0`,`flex-1`],[1,`font-semibold`],[1,`mt-1`,`text-sm`,2,`color`,`var(--text-secondary)`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`ai-quota-go-to-billing`,1,`mt-3`],[`data-testid`,`ai-quota-coach-guidance`,1,`mt-3`,`text-sm`,`font-medium`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`ai-quota-go-to-billing`,1,`mt-3`,3,`click`]],template:function(i,m){i&1&&(Rw(I$1),Bi$3(0,`section`,0)(1,`div`,1)(2,`mat-icon`,2),lC(3,`lock`),vl$4(),Bi$3(4,`div`,3)(5,`h2`,4),lC(6),OC(7,`translate`),vl$4(),Bi$3(8,`p`,5),lC(9),OC(10,`translate`),vl$4(),fw(11,k,3,3,`button`,6)(12,D,3,3,`p`,7),kw(13),vl$4()()()),i&2&&(sE(6),ig(LC(7,3,`aiQuota.exhausted.title`)),sE(3),Cl$4(` `,LC(10,5,`aiQuota.exhausted.message`),` `),sE(2),pw(m.profileService.isAdminOrManager()?11:12))},dependencies:[Ap$1,wp$2,yt$7,wt$5,Xp$1],encapsulation:2})};var a=[`coachOnboarding.loading.messages.answers`,`coachOnboarding.loading.messages.data`,`coachOnboarding.loading.messages.bottlenecks`,`coachOnboarding.loading.messages.personalized`];var i=_$3.map(o=>({id:o.id,titleKey:o.pageTitleKey,introKey:o.introKey??o.pageTitleKey}));var c=5*1024*1024;var I=[`image/jpeg`,`image/png`,`image/webp`];var f=6e4;var d=class i{http=E(yo$5);api=E(E$1);ownImageUrl=ni$3(void 0);ownImageExpiresAtMs=0;imageUrl=this.ownImageUrl.asReadonly();validateFile(e){return I.includes(e.type)?e.size<=0||e.size>
6724c?`profile.image.tooLarge`:null:`profile.image.invalidType`}getOwnImageUrl(e=!1){return ps$4(this,null,function*(){let r=this.ownImageUrl();if(!e&&r!==void 0&&Date.now()<this.ownImageExpiresAtMs-f)return r;try{let t=yield this.api.get(`/api/v3/me/profile-image-url`),o=t.image_url??null;return this.ownImageUrl.set(o),this.ownImageExpiresAtMs=t.expires_at?new Date(t.expires_at).getTime():0,o}catch(t){return uu$2.error(`Failed to fetch own profile image url:`,t),this.ownImageUrl.set(null),null}})}uploadOwnImage(e){return ps$4(this,null,function*(){let r=yield this.api.post(`/api/v3/me/profile-image/upload-url`,{content_type:e.type,size_bytes:e.size});yield pm(this.http.put(r.upload_url,e,{headers:r.required_headers,responseType:`text`})),yield this.api.put(`/api/v3/me/profile-image`,{blob_path:r.blob_path,content_type:e.type}),yield this.getOwnImageUrl(!0)})}deleteOwnImage(){return ps$4(this,null,function*(){yield this.api.delete(`/api/v3/me/profile-image`),this.ownImageUrl.set(null),this.ownImageExpiresAtMs=0})}static ɵfac=function(r){return new(r||i)};static ɵprov=ue$3({token:i,factory:i.ɵfac,providedIn:`root`})};function l(s){let r=s?.trim();if(!r)return`?`;let t=r.split(/\s+/).filter(n=>n.length>0);if(t.length>=2)return`${t[0][0]}${t[t.length-1][0]}`.toUpperCase();let e=t[0];return e.length>=2?e.slice(0,2).toUpperCase():e.toUpperCase()}var R=new N$2(`CdkAccordion`);var fe$1=(()=>{class t{_stateChanges=new ee$5;_openCloseAllActions=new ee$5;id=E(Or$4).getId(`cdk-accordion-`);multi=!1;openAll(){this.multi&&this._openCloseAllActions.next(!0)}closeAll(){this._openCloseAllActions.next(!1)}ngOnChanges(e){this._stateChanges.next(e)}ngOnDestroy(){this._stateChanges.complete(),this._openCloseAllActions.complete()}static ɵfac=function(n){return new(n||t)};static ɵdir=HD({type:t,selectors:[[`cdk-accordion`],[``,`cdkAccordion`,``]],inputs:{multi:[2,`multi`,`multi`,rj]},exportAs:[`cdkAccordion`],features:[CC([{provide:R,useExisting:t}]),qy]})}return t})();var be$1=(()=>{class t{accordion=E(R,{optional:!0,skipSelf:!0});_changeDetectorRef=E(ej);_expansionDispatcher=E(vt$7);_openCloseAllSubscription=F$2.EMPTY;closed=new Qe$1;opened=new Qe$1;destroyed=new Qe$1;expandedChange=new Qe$1;id=E(Or$4).getId(`cdk-accordion-child-`);get expanded(){return this._expanded}set expanded(e){if(this._expanded!==e){if(this._expanded=e,this.expandedChange.emit(e),e){this.opened.emit();let n=this.accordion?this.accordion.id:this.id;this._expansionDispatcher.notify(this.id,n)}else this.closed.emit();this._changeDetectorRef.markForCheck()}}_expanded=!1;get disabled(){return this._disabled()}set disabled(e){this._disabled.set(e)}_disabled=ni$3(!1);_removeUniqueSelectionListener=()=>{};ngOnInit(){this._removeUniqueSelectionListener=this._expansionDispatcher.listen((e,n)=>{this.accordion&&!this.accordion.multi&&this.accordion.id===n&&this.id!==e&&(this.expanded=!1)}),this.accordion&&(this._openCloseAllSubscription=this._subscribeToOpenCloseAllActions())}ngOnDestroy(){this.opened.complete(),this.closed.complete(),this.destroyed.emit(),this.destroyed.complete(),this._removeUniqueSelectionListener(),this._openCloseAllSubscription.unsubscribe()}toggle(){this.disabled||(this.expanded=!this.expanded)}close(){this.disabled||(this.expanded=!1)}open(){this.disabled||(this.expanded=!0)}_subscribeToOpenCloseAllActions(){return this.accordion._openCloseAllActions.subscribe(e=>{this.disabled||(this.expanded=e)})}static ɵfac=function(n){return new(n||t)};static ɵdir=HD({type:t,selectors:[[`cdk-accordion-item`],[``,`cdkAccordionItem`,``]],inputs:{expanded:[2,`expanded`,`expanded`,rj],disabled:[2,`disabled`,`disabled`,rj]},outputs:{closed:`closed`,opened:`opened`,destroyed:`destroyed`,expandedChange:`expandedChange`},exportAs:[`cdkAccordionItem`],features:[CC([{provide:R,useValue:void 0}])]})}return t})();var _e$1=(()=>{class t{static ɵfac=function(n){return new(n||t)};static ɵmod=FD({type:t});static ɵinj=ju$1({})}return t})();var Ne=[`body`];var Me=[`bodyWrapper`];var Ae=[[[`mat-expansion-panel-header`]],`*`,[[`mat-action-row`]]];var De=[`mat-expansion-panel-header`,`*`,`mat-action-row`];function Pe(t,we){}var ke$1=[[[`mat-panel-title`]],[[`mat-panel-description`]],`*`];var Te$1=[`mat-panel-title`,`mat-panel-description`,`*`];function Ie$1(t,we){t&1&&(Il$4(0,`span`,1),Dd$1(),Il$4(1,`svg`,2),kh$3(2,`path`,3),El$4()())}var j=new N$2(`MAT_ACCORDION`);var ye$1=new N$2(`MAT_EXPANSION_PANEL`);var He=(()=>{class t{_template=E(Ar$5);_expansionPanel=E(ye$1,{optional:!0});static ɵfac=function(n){return new(n||t)};static ɵdir=HD({type:t,selectors:[[`ng-template`,`matExpansionPanelContent`,``]]})}return t})();var ve$1=new N$2(`MAT_EXPANSION_PANEL_DEFAULT_OPTIONS`);var Oe=(()=>
6724{class t extends be$1{_viewContainerRef=E(is$5);_animationsDisabled=nt$5();_document=E(ti$3);_ngZone=E(Z$4);_elementRef=E(Lr$5);_renderer=E(pc$4);_cleanupTransitionEnd;get hideToggle(){return this._hideToggle||this.accordion&&this.accordion.hideToggle}set hideToggle(e){this._hideToggle=e}_hideToggle=!1;get togglePosition(){return this._togglePosition||this.accordion&&this.accordion.togglePosition}set togglePosition(e){this._togglePosition=e}_togglePosition;afterExpand=new Qe$1;afterCollapse=new Qe$1;_inputChanges=new ee$5;accordion=E(j,{optional:!0,skipSelf:!0});_lazyContent;_body;_bodyWrapper;_portal;_headerId=E(Or$4).getId(`mat-expansion-panel-header-`);constructor(){super();let e=E(ve$1,{optional:!0});this._expansionDispatcher=E(vt$7),e&&(this.hideToggle=e.hideToggle)}_hasSpacing(){return this.accordion?this.expanded&&this.accordion.displayMode==="default":!1}_getExpandedState(){return this.expanded?`expanded`:`collapsed`}toggle(){this.expanded=!this.expanded}close(){this.expanded=!1}open(){this.expanded=!0}ngAfterContentInit(){this._lazyContent&&this._lazyContent._expansionPanel===this&&this.opened.pipe(Vm(null),hn$4(()=>this.expanded&&!this._portal),_t$9(1)).subscribe(()=>{this._portal=new I$4(this._lazyContent._template,this._viewContainerRef)}),this._setupAnimationEvents()}ngOnChanges(e){this._inputChanges.next(e)}ngOnDestroy(){super.ngOnDestroy(),this._cleanupTransitionEnd?.(),this._inputChanges.complete()}_containsFocus(){if(this._body){let e=this._document.activeElement,n=this._body.nativeElement;return e===n||n.contains(e)}return!1}_transitionEndListener=({target:e,propertyName:n})=>{e===this._bodyWrapper?.nativeElement&&n===`grid-template-rows`&&this._ngZone.run(()=>
6724{this.expanded?this.afterExpand.emit():this.afterCollapse.emit()})};_setupAnimationEvents(){this._ngZone.runOutsideAngular(()=>{this._animationsDisabled?(this.opened.subscribe(()=>this._ngZone.run(()=>this.afterExpand.emit())),this.closed.subscribe(()=>this._ngZone.run(()=>this.afterCollapse.emit()))):setTimeout(()=>{let e=this._elementRef.nativeElement;this._cleanupTransitionEnd=this._renderer.listen(e,`transitionend`,this._transitionEndListener),e.classList.add(`mat-expansion-panel-animations-enabled`)},200)})}static ɵfac=function(n){return new(n||t)};static ɵcmp=PD({type:t,selectors:[[`mat-expansion-panel`]],contentQueries:function(n,a,r){if(n&1&&Bh$3(r,He,5),n&2){let o;Pw(o=Lw())&&(a._lazyContent=o.first)}},viewQuery:function(n,a){if(n&1&&$h$2(Ne,5)(Me,5),n&2){let r;Pw(r=Lw())&&(a._body=r.first),Pw(r=Lw())&&(a._bodyWrapper=r.first)}},hostAttrs:[1,`mat-expansion-panel`],hostVars:4,hostBindings:function(n,a){n&2&&Yh$3(`mat-expanded`,a.expanded)(`mat-expansion-panel-spacing`,a._hasSpacing())},inputs:{hideToggle:[2,`hideToggle`,`hideToggle`,rj],togglePosition:`togglePosition`},outputs:{afterExpand:`afterExpand`,afterCollapse:`afterCollapse`},exportAs:[`matExpansionPanel`],features:[CC([{provide:j,useValue:void 0},{provide:ye$1,useExisting:t}]),wh$3,qy],ngContentSelectors:De,decls:9,vars:4,consts:[[`bodyWrapper`,``],[`body`,``],[1,`mat-expansion-panel-content-wrapper`],[`role`,`region`,1,`mat-expansion-panel-content`,3,`id`],[1,`mat-expansion-panel-body`],[3,`cdkPortalOutlet`]],template:function(n,a){n&1&&(Rw(Ae),kw(0),Bi$3(1,`div`,2,0)(3,`div`,3,1)(5,`div`,4),kw(6,1),Th$2(7,Pe,0,0,`ng-template`,5),vl$4(),kw(8,2),vl$4()()),n&2&&(sE(),xh$2(`inert`,a.expanded?null:``),sE(2),Ah$2(`id`,a.id),xh$2(`aria-labelledby`,a._headerId),sE(4),Ah$2(`cdkPortalOutlet`,a._portal))},dependencies:[vi$4],styles:[`.mat-expansion-panel { 6725 box-sizing: content-box; 6726 display: block; 6727 margin: 0; 6728 overflow: hidden; 6729} 6730.mat-expansion-panel.mat-expansion-panel-animations-enabled { 6731 transition: margin 225ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1); 6732} 6733.mat-expansion-panel { 6734 position: relative; 6735 background: var(--%NS%mat-expansion-container-background-color, var(--%NS%mat-sys-surface)); 6736 color: var(--%NS%mat-expansion-container-text-color, var(--%NS%mat-sys-on-surface)); 6737 border-radius: var(--%NS%mat-expansion-container-shape, 12px); 6738} 6739.mat-expansion-panel:not([class*=mat-elevation-z]) { 6740 box-shadow: var(--%NS%mat-expansion-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)); 6741} 6742.mat-accordion .mat-expansion-panel:not(.mat-expanded), .mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing) { 6743 border-radius: 0; 6744} 6745.mat-accordion .mat-expansion-panel:first-of-type { 6746 border-top-right-radius: var(--%NS%mat-expansion-container-shape, 12px); 6747 border-top-left-radius: var(--%NS%mat-expansion-container-shape, 12px); 6748} 6749.mat-accordion .mat-expansion-panel:last-of-type { 6750 border-bottom-right-radius: var(--%NS%mat-expansion-container-shape, 12px); 6751 border-bottom-left-radius: var(--%NS%mat-expansion-container-shape, 12px); 6752} 6753@media (forced-colors: active) { 6754 .mat-expansion-panel { 6755 outline: solid 1px; 6756 } 6757} 6758 6759.mat-expansion-panel-content-wrapper { 6760 display: grid; 6761 grid-template-rows: 0fr; 6762 grid-template-columns: 100%; 6763} 6764.mat-expansion-panel-animations-enabled .mat-expansion-panel-content-wrapper { 6765 transition: grid-template-rows 225ms cubic-bezier(0.4, 0, 0.2, 1); 6766} 6767.mat-expansion-panel.mat-expanded > .mat-expansion-panel-content-wrapper { 6768 grid-template-rows: 1fr; 6769} 6770@supports not (grid-template-rows: 0fr) { 6771 .mat-expansion-panel-content-wrapper { 6772 height: 0; 6773 } 6774 .mat-expansion-panel.mat-expanded > .mat-expansion-panel-content-wrapper { 6775 height: auto; 6776 } 6777} 6778@media print { 6779 .mat-expansion-panel-content-wrapper { 6780 height: 0; 6781 } 6782 .mat-expansion-panel.mat-expanded > .mat-expansion-panel-content-wrapper { 6783 height: auto; 6784 } 6785} 6786 6787.mat-expansion-panel-content { 6788 display: flex; 6789 flex-direction: column; 6790 overflow: visible; 6791 min-height: 0; 6792 visibility: hidden; 6793} 6794.mat-expansion-panel-animations-enabled .mat-expansion-panel-content { 6795 transition: visibility 190ms linear; 6796} 6797.mat-expansion-panel.mat-expanded > .mat-expansion-panel-content-wrapper > .mat-expansion-panel-content { 6798 visibility: visible; 6799} 6800.mat-expansion-panel-content { 6801 font-family: var(--%NS%mat-expansion-container-text-font, var(--%NS%mat-sys-body-large-font)); 6802 font-size: var(--%NS%mat-expansion-container-text-size, var(--%NS%mat-sys-body-large-size)); 6803 font-weight: var(--%NS%mat-expansion-container-text-weight, var(--%NS%mat-sys-body-large-weight)); 6804 line-height: var(--%NS%mat-expansion-container-text-line-height, var(--%NS%mat-sys-body-large-line-height)); 6805 letter-spacing: var(--%NS%mat-expansion-container-text-tracking, var(--%NS%mat-sys-body-large-tracking)); 6806} 6807 6808.mat-expansion-panel-body { 6809 padding: 0 24px 16px; 6810} 6811 6812.mat-expansion-panel-spacing { 6813 margin: 16px 0; 6814} 6815.mat-accordion > .mat-expansion-panel-spacing:first-child, .mat-accordion > *:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing { 6816 margin-top: 0; 6817} 6818.mat-accordion > .mat-expansion-panel-spacing:last-child, .mat-accordion > *:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing { 6819 margin-bottom: 0; 6820} 6821 6822.mat-action-row { 6823 border-top-style: solid; 6824 border-top-width: 1px; 6825 display: flex; 6826 flex-direction: row; 6827 justify-content: flex-end; 6828 padding: 16px 8px 16px 24px; 6829 border-top-color: var(--%NS%mat-expansion-actions-divider-color, var(--%NS%mat-sys-outline)); 6830} 6831.mat-action-row .mat-button-base, 6832.mat-action-row .mat-mdc-button-base { 6833 margin-left: 8px; 6834} 6835[dir=rtl] .mat-action-row .mat-button-base, 6836[dir=rtl] .mat-action-row .mat-mdc-button-base { 6837 margin-left: 0; 6838 margin-right: 8px; 6839} 6840`],encapsulation:2})}return t})();var Fe=(()=>{class t{panel=E(Oe,{host:!0});_element=E(Lr$5);_focusMonitor=E(yn$4);_changeDetectorRef=E(ej);_parentChangeSubscription=F$2.EMPTY;constructor(){E(be$3).load(ra$5);let e=this.panel,n=E(ve$1,{optional:!0}),a=E(new Tg(`tabindex`),{optional:!0}),r=e.accordion?e.accordion._stateChanges.pipe(hn$4(o=>!!(o.hideToggle||o.togglePosition))):bt$8;this.tabIndex=parseInt(a||``)||0,this._parentChangeSubscription=_m(e.opened,e.closed,r,e._inputChanges.pipe(hn$4(o=>!!(o.hideToggle||o.disabled||o.togglePosition)))).subscribe(()=>this._changeDetectorRef.markForCheck()),e.closed.pipe(hn$4(()=>e._containsFocus())).subscribe(()=>this._focusMonitor.focusVia(this._element,`program`)),n&&(this.expandedHeight=n.expandedHeight,this.collapsedHeight=n.collapsedHeight)}expandedHeight;collapsedHeight;tabIndex=0;get disabled(){return this.panel.disabled}
6840_toggle(){this.disabled||this.panel.toggle()}_isExpanded(){return this.panel.expanded}_getExpandedState(){return this.panel._getExpandedState()}_getPanelId(){return this.panel.id}_getTogglePosition(){return this.panel.togglePosition}_showToggle(){return!this.panel.hideToggle&&!this.panel.disabled}_getHeaderHeight(){let e=this._isExpanded();return e&&this.expandedHeight?this.expandedHeight:!e&&this.collapsedHeight?this.collapsedHeight:null}_keydown(e){switch(e.keyCode){case 32:case 13:Ho$5(e)||(e.preventDefault(),this._toggle());break;default:this.panel.accordion&&this.panel.accordion._handleHeaderKeydown(e);return}}focus(e,n){e?this._focusMonitor.focusVia(this._element,e,n):this._element.nativeElement.focus(n)}ngAfterViewInit(){this._focusMonitor.monitor(this._element).subscribe(e=>{e&&this.panel.accordion&&this.panel.accordion._handleHeaderFocus(this)})}ngOnDestroy(){this._parentChangeSubscription.unsubscribe(),this._focusMonitor.stopMonitoring(this._element)}static ɵfac=function(n){return new(n||t)};static ɵcmp=PD({type:t,selectors:[[`mat-expansion-panel-header`]],hostAttrs:[`role`,`button`,1,`mat-expansion-panel-header`,`mat-focus-indicator`],hostVars:13,hostBindings:function(n,a){n&1&&jh$3(`click`,function(){return a._toggle()})(`keydown`,function(o){return a._keydown(o)}),n&2&&(xh$2(`id`,a.panel._headerId)(`tabindex`,a.disabled?-1:a.tabIndex)(`aria-controls`,a._getPanelId())(`aria-expanded`,a._isExpanded())(`aria-disabled`,a.panel.disabled),Zh$2(`height`,a._getHeaderHeight()),Yh$3(`mat-expanded`,a._isExpanded())(`mat-expansion-toggle-indicator-after`,a._getTogglePosition()===`after`)(`mat-expansion-toggle-indicator-before`,a._getTogglePosition()===`before`))},inputs:{expandedHeight:`expandedHeight`,collapsedHeight:`collapsedHeight`,tabIndex:[2,`tabIndex`,`tabIndex`,e=>e==null?0:oj(e)]},ngContentSelectors:Te$1,decls:5,vars:3,consts:[[1,`mat-content`],[1,`mat-expansion-indicator`],[`xmlns`,`http://www.w3.org/2000/svg`,`viewBox`,`0 -960 960 960`,`aria-hidden`,`true`,`focusable`,`false`],[`d`,`M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z`]],template:function(n,a){n&1&&(Rw(ke$1),Il$4(0,`span`,0),kw(1),kw(2,1),kw(3,2),El$4(),fw(4,Ie$1,3,0,`span`,1)),n&2&&(Yh$3(`mat-content-hide-toggle`,!a._showToggle()),sE(4),pw(a._showToggle()?4:-1))},styles:[`.mat-expansion-panel-header { 6841 display: flex; 6842 flex-direction: row; 6843 align-items: center; 6844 padding: 0 24px; 6845 border-radius: inherit; 6846 outline: 0; 6847} 6848.mat-expansion-panel-animations-enabled .mat-expansion-panel-header { 6849 transition: height 225ms cubic-bezier(0.4, 0, 0.2, 1); 6850} 6851.mat-expansion-panel-header::before { 6852 border-radius: inherit; 6853} 6854.mat-expansion-panel-header { 6855 height: var(--%NS%mat-expansion-header-collapsed-state-height, 48px); 6856 font-family: var(--%NS%mat-expansion-header-text-font, var(--%NS%mat-sys-title-medium-font)); 6857 font-size: var(--%NS%mat-expansion-header-text-size, var(--%NS%mat-sys-title-medium-size)); 6858 font-weight: var(--%NS%mat-expansion-header-text-weight, var(--%NS%mat-sys-title-medium-weight)); 6859 line-height: var(--%NS%mat-expansion-header-text-line-height, var(--%NS%mat-sys-title-medium-line-height)); 6860 letter-spacing: var(--%NS%mat-expansion-header-text-tracking, var(--%NS%mat-sys-title-medium-tracking)); 6861} 6862.mat-expansion-panel-header.mat-expanded { 6863 height: var(--%NS%mat-expansion-header-expanded-state-height, 64px); 6864} 6865.mat-expansion-panel-header[aria-disabled=true] { 6866 color: var(--%NS%mat-expansion-header-disabled-state-text-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) 38%, transparent)); 6867} 6868.mat-expansion-panel-header:not([aria-disabled=true]) { 6869 cursor: pointer; 6870} 6871.mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover { 6872 background: var(--%NS%mat-expansion-header-hover-state-layer-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) calc(var(--%NS%mat-sys-hover-state-layer-opacity) * 100%), transparent)); 6873} 6874@media (hover: none) { 6875 .mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:not([aria-disabled=true]):hover { 6876 background: var(--%NS%mat-expansion-container-background-color, var(--%NS%mat-sys-surface)); 6877 } 6878} 6879.mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-keyboard-focused, .mat-expansion-panel .mat-expansion-panel-header:not([aria-disabled=true]).cdk-program-focused { 6880 background: var(--%NS%mat-expansion-header-focus-state-layer-color, color-mix(in srgb, var(--%NS%mat-sys-on-surface) calc(var(--%NS%mat-sys-focus-state-layer-opacity) * 100%), transparent)); 6881} 6882.mat-expansion-panel-header._mat-animation-noopable { 6883 transition: none; 6884} 6885.mat-expansion-panel-header.mat-expanded:focus, .mat-expansion-panel-header.mat-expanded:hover { 6886 background: inherit; 6887} 6888.mat-expansion-panel-header.mat-expansion-toggle-indicator-before { 6889 flex-direction: row-reverse; 6890} 6891.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator { 6892 margin: 0 16px 0 0; 6893} 6894[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator { 6895 margin: 0 0 0 16px; 6896} 6897 6898.mat-content { 6899 display: flex; 6900 flex: 1; 6901 flex-direction: row; 6902 overflow: hidden; 6903} 6904.mat-content.mat-content-hide-toggle { 6905 margin-right: 8px; 6906} 6907[dir=rtl] .mat-content.mat-content-hide-toggle { 6908 margin-right: 0; 6909 margin-left: 8px; 6910} 6911.mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle { 6912 margin-left: 24px; 6913 margin-right: 0; 6914} 6915[dir=rtl] .mat-expansion-toggle-indicator-before .mat-content.mat-content-hide-toggle { 6916 margin-right: 24px; 6917 margin-left: 0; 6918} 6919 6920.mat-expansion-panel-header-title { 6921 color: var(--%NS%mat-expansion-header-text-color, var(--%NS%mat-sys-on-surface)); 6922} 6923 6924.mat-expansion-panel-header-title, 6925.mat-expansion-panel-header-description { 6926 display: flex; 6927 flex-grow: 1; 6928 flex-basis: 0; 6929 margin-right: 16px; 6930 align-items: center; 6931} 6932[dir=rtl] .mat-expansion-panel-header-title, 6933[dir=rtl] .mat-expansion-panel-header-description { 6934 margin-right: 0; 6935 margin-left: 16px; 6936} 6937.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-title, 6938.mat-expansion-panel-header[aria-disabled=true] .mat-expansion-panel-header-description { 6939 color: inherit; 6940} 6941 6942.mat-expansion-panel-header-description { 6943 flex-grow: 2; 6944 color: var(--%NS%mat-expansion-header-description-color, var(--%NS%mat-sys-on-surface-variant)); 6945} 6946 6947.mat-expansion-panel-animations-enabled .mat-expansion-indicator { 6948 transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1); 6949} 6950.mat-expansion-panel-header.mat-expanded .mat-expansion-indicator { 6951 transform: rotate(180deg); 6952} 6953.mat-expansion-indicator::after { 6954 border-style: solid; 6955 border-width: 0 2px 2px 0; 6956 content: ""; 6957 padding: 3px; 6958 transform: rotate(45deg); 6959 vertical-align: middle; 6960 color: var(--%NS%mat-expansion-header-indicator-color, var(--%NS%mat-sys-on-surface-variant)); 6961 display: var(--%NS%mat-expansion-legacy-header-indicator-display, none); 6962} 6963.mat-expansion-indicator svg { 6964 width: 24px; 6965 height: 24px; 6966 margin: 0 -8px; 6967 vertical-align: middle; 6968 fill: var(--%NS%mat-expansion-header-indicator-color, var(--%NS%mat-sys-on-surface-variant)); 6969 display: var(--%NS%mat-expansion-header-indicator-display, inline-block); 6970} 6971 6972@media (forced-colors: active) { 6973 .mat-expansion-panel-content { 6974 border-top: 1px solid; 6975 border-top-left-radius: 0; 6976 border-top-right-radius: 0; 6977 } 6978} 6979`],encapsulation:2})}return t})();var gn$1=(()=>{class t{static ɵfac=function(n){return new(n||t)};static ɵdir=HD({type:t,selectors:[[`mat-panel-description`]],hostAttrs:[1,`mat-expansion-panel-header-description`]})}return t})();var un$1=(()=>{class t{static ɵfac=function(n){return new(n||t)};static ɵdir=HD({type:t,selectors:[[`mat-panel-title`]],hostAttrs:[1,`mat-expansion-panel-header-title`]})}return t})();var xn=(()=>{class t extends fe$1{_keyManager;_ownHeaders=new Ci$3;_headers;hideToggle=!1;displayMode=`default`;togglePosition=`after`;ngAfterContentInit(){this._headers.changes.pipe(Vm(this._headers)).subscribe(e=>{this._ownHeaders.reset(e.filter(n=>n.panel.accordion===this)),this._ownHeaders.notifyOnChanges()}),this._keyManager=new Rr$6(this._ownHeaders).withWrap().withHomeAndEnd()}_handleHeaderKeydown(e){this._keyManager.onKeydown(e)}_handleHeaderFocus(e){this._keyManager.updateActiveItem(e)}ngOnDestroy(){super.ngOnDestroy(),this._keyManager?.destroy(),this._ownHeaders.destroy()}static ɵfac=(()=>{let e;return function(a){return(e||(e=lv(t)))(a||t)}})();static ɵdir=HD({type:t,selectors:[[`mat-accordion`]],contentQueries:function(n,a,r){if(n&1&&Bh$3(r,Fe,5),n&2){let o;Pw(o=Lw())&&(a._headers=o)}},hostAttrs:[1,`mat-accordion`],hostVars:2,hostBindings:function(n,a){n&2&&Yh$3(`mat-accordion-multi`,a.multi)},inputs:{hideToggle:[2,`hideToggle`,`hideToggle`,rj],displayMode:`dis
6979playMode`,togglePosition:`togglePosition`},exportAs:[`matAccordion`],features:[CC([{provide:j,useExisting:t}]),wh$3]})}return t})();var fn$1=(()=>{class t{static ɵfac=function(n){return new(n||t)};static ɵmod=FD({type:t});static ɵinj=ju$1({imports:[_e$1,Re$3,xn$4]})}return t})();var _t$2=[`*`];function ee(a,s){a&1&&kw(0)}var ne=[`tabListContainer`];var ae$1=[`tabList`];var ie=[`tabListInner`];var oe=[`nextPaginator`];var re=[`previousPaginator`];var se$1=[`content`];function le$2(a,s){}var de=[`tabBodyWrapper`];var ce=[`tabHeader`];function be(a,s){}function me(a,s){if(a&1&&Th$2(0,be,0,0,`ng-template`,12),a&2){let t=xw().$implicit;Ah$2(`cdkPortalOutlet`,t.templateLabel)}}function he(a,s){if(a&1&&lC(0),a&2){let t=xw().$implicit;ig(t.textLabel)}}function _e(a,s){if(a&1){let t=Cw();Bi$3(0,`div`,7,2),jh$3(`click`,function(){let n=ld$2(t),i=n.$implicit,o=n.$index,f=xw(),k=jw(1);return ud$1(f._handleClick(i,k,o))})(`cdkFocusChange`,function(n){let i=ld$2(t).$index;return ud$1(xw()._tabFocusChanged(n,i))}),Rh$3(2,`span`,8)(3,`div`,9),Bi$3(4,`span`,10)(5,`span`,11),fw(6,me,1,1,null,12)(7,he,1,1),vl$4()()()}if(a&2){let t=s.$implicit,e=s.$index,n=jw(1),i=xw();Xw(t.labelClass),Yh$3(`mdc-tab--active`,i.selectedIndex===e),Ah$2(`id`,i._getTabLabelId(t,e))(`disabled`,t.disabled)(`fitInkBarToContent`,i.fitInkBarToContent),xh$2(`tabIndex`,i._getTabIndex(e))(`aria-posinset`,e+1)(`aria-setsize`,i._tabs.length)(`aria-controls`,i._getTabContentId(e))(`aria-selected`,i.selectedIndex===e)(`aria-label`,t.ariaLabel||null)(`aria-labelledby`,!t.ariaLabel&&t.ariaLabelledby?t.ariaLabelledby:null),sE(3),Ah$2(`matRippleTrigger`,n)(`matRippleDisabled`,t.disabled||i.disableRipple),sE(3),pw(t.templateLabel?6:7
6979)}}function pe(a,s){a&1&&kw(0)}function ue(a,s){if(a&1){let t=Cw();Bi$3(0,`mat-tab-body`,13),jh$3(`_onCentered`,function(){ld$2(t);return ud$1(xw()._removeTabBodyWrapperHeight())})(`_onCentering`,function(n){ld$2(t);return ud$1(xw()._setTabBodyWrapperHeight(n))})(`_beforeCentering`,function(n){ld$2(t);return ud$1(xw()._bodyCentered(n))}),vl$4()}if(a&2){let t=s.$implicit,e=s.$index,n=xw();Xw(t.bodyClass),Ah$2(`id`,n._getTabContentId(e))(`content`,t.content)(`position`,t.position)(`animationDuration`,n._bodyAnimationDuration)(`preserveContent`,n.preserveContent),xh$2(`tabindex`,n.contentTabIndex!=null&&n.selectedIndex===e?n.contentTabIndex:null)(`aria-labelledby`,n._getTabLabelId(t,e))(`aria-hidden`,n.selectedIndex!==e)}}var fe=new N$2(`MatTabContent`);var ge=(()=>{class a{template=E(Ar$5);static ɵfac=function(e){return new(e||a)};static ɵdir=HD({type:a,selectors:[[``,`matTabContent`,``]],features:[CC([{provide:fe,useExisting:a}])]})}return a})();var ve=new N$2(`MatTabLabel`);var Yt=new N$2(`MAT_TAB`);var ye=(()=>{class a extends mi$2{_closestTab=E(Yt,{optional:!0});static ɵfac=(()=>{let t;return function(n){return(t||(t=lv(a)))(n||a)}})();static ɵdir=HD({type:a,selectors:[[``,`mat-tab-label`,``],[``,`matTabLabel`,``]],features:[CC([{provide:ve,useExisting:a}]),wh$3]})}return a})();var Xt=new N$2(`MAT_TAB_GROUP`);var ke=(()=>{class a{_viewContainerRef=E(is$5);_closestTabGroup=E(Xt,{optional:!0});disabled=!1;get templateLabel(){return this._templateLabel}set templateLabel(t){this._setTemplateLabelInput(t)}_templateLabel;_explicitContent=void 0;_implicitContent;textLabel=``;ariaLabel;ariaLabelledby;labelClass;bodyClass;id=null;_contentPortal=null;get content(){return this._contentPortal}_stateChanges=new ee$5;position=null;origin=null;isActive=!1;constructor(){E(be$3).load(ra$5)}ngOnChanges(t){(t.hasOwnProperty(`textLabel`)||t.hasOwnProperty(`disabled`))&&this._stateChanges.next()}ngOnDestroy(){this._stateChanges.complete()}ngOnInit(){this._contentPortal=new I$4(this._explicitContent||this._implicitContent,this._viewContainerRef)}_setTemplateLabelInput(t){t&&t._closestTab===this&&(this._templateLabel=t)}static ɵfac=function(e){return new(e||a)};static ɵcmp=PD({type:a,selectors:[[`mat-tab`]],contentQueries:function(e,n,i){if(e&1&&Bh$3(i,ye,5)(i,ge,7,Ar$5),e&2){let o;Pw(o=Lw())&&(n.templateLabel=o.first),Pw(o=Lw())&&(n._explicitContent=o.first)}},viewQuery:function(e,n){if(e&1&&$h$2(Ar$5,7),e&2){let i;Pw(i=Lw())&&(n._implicitContent=i.first)}},hostAttrs:[`hidden`,``],hostVars:1,hostBindings:function(e,n){e&2&&xh$2(`id`,null)},inputs:{disabled:[2,`disabled`,`disabled`,rj],textLabel:[0,`label`,`textLabel`],ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`],labelClass:`labelClass`,bodyClass:`bodyClass`,id:`id`},exportAs:[`matTab`],features:[CC([{provide:Yt,useExisting:a}]),qy],ngContentSelectors:_t$2,decls:1,vars:0,template:function(e,n){e&1&&(Rw(),bh$1(0,ee,1,0,`ng-template`))},encapsulation:2,changeDetection:1})}return a})();var dt$1=`mdc-tab-indicator--active`;var qt$1=`mdc-tab-indicator--no-transition`;var bt$1=class{_items;_currentItem;constructor(s){this._items=s}hide(){this._items.forEach(s=>s.deactivateInkBar()),this._currentItem=void 0}alignToElement(s){let t=this._items.find(n=>n.elementRef.nativeElement===s),e=this._currentItem;if(t!==e&&(e?.deactivateInkBar(),t)){let n=e?.elementRef.nativeElement.getBoundingClientRect?.();t.activateInkBar(n),this._currentItem=t}}};var Te=(()=>{class a{_elementRef=E(Lr$5);_inkBarElement=null;_inkBarContentElement=null;_fitToContent=!1;get fitInkBarToContent(){return this._fitToContent}set fitInkBarToContent(t){this._fitToContent!==t&&(this._fitToContent=t,this._inkBarElement&&this._appendInkBarElement())}activateInkBar(t){let e=this._elementRef.nativeElement;if(!t||!e.getBoundingClientRect||!this._inkBarContentElement){e.classList.add(dt$1);return}let n=e.getBoundingClientRect(),i=t.width/n.width,o=t.left-n.left;e.classList.add(qt$1),this._inkBarContentElement.style.setProperty(`transform`,`translateX(${o}px) scaleX(${i})`),e.getBoundingClientRect(),e.classList.remove(qt$1),e.classList.add(dt$1),this._inkBarContentElement.style.setProperty(`transform`,``)}deactivateInkBar(){this._elementRef.nativeElement.classList.remove(dt$1)}ngOnInit(){this._createInkBarElement()}ngOnDestroy(){this._inkBarElement?.remove(),this._inkBarElement=this._inkBarContentElement=null}_createInkBarElement(){let t=this._elementRef.nativeElement.ownerDocument||document,e=this._inkBarElement=t.createElement(`span`),n=this._inkBarContentElement=t.createElement(`span`);e.className=`mdc-tab-indicator`,n.className=`mdc-tab-indicator__content mdc-tab-indicator__content--underline`,e.appendChild(this._inkBarContentElement),this._appendInkBarElement()}_appendInkBarElement(){this._inkBarElement;(this._fitToContent?this._elementRef.nativeElement.querySelector(`.mdc-tab__content`):this._elementRef.nativeElement).appendChild(this._inkBarElement)}static ɵfac=function(e){return new(e||a)};static ɵdir=HD({type:a,inputs:{fitInkBarToContent:[2,`fitInkBarToContent`,`fitInkBarToContent`,rj]}})}return a})();var Ut$1=(()=>{class a extends Te{elementRef=E(Lr$5);disabled=!1;focus(){this.elementRef.nativeElement.focus()}getOffsetLeft(){return this.elementRef.nativeElement.offsetLeft}getOffsetWidth(){return this.elementRef.nativeElement.offsetWidth}static ɵfac=(()=>{let t;return function(n){return(t||(t=lv(a)))(n||a)}})();static ɵdir=HD({type:a,selectors:[[``,`matTabLabelWrapper`,``]],hostVars:3,hostBindings:function(e,n){e&2&&(xh$2(`aria-disabled`,!!n.disabled),Yh$3(`mat-mdc-tab-disabled`,n.disabled))},inputs:{disabled:[2,`disabled`,`disabled`,rj]},features:[wh$3]})}return a})();var Zt={passive:!0};var Ce=650;var xe=100;function ct$1(a){let s=a+``;return/^[0-9]+(?:\.[0-9]+)?$/.test(s)?`${a}ms`:/^[0-9]+(?:\.[0-9]+)?(?:ms|s)$/.test(s)?s:``}var Ie=(()=>{class a{_elementRef=E(Lr$5);_changeDetectorRef=E(ej);
6979_viewportRuler=E(B$4);_dir=E(Oc$4,{optional:!0});_ngZone=E(Z$4);_platform=E(k$2);_sharedResizeObserver=E(we$5);_injector=E(we$4);_renderer=E(pc$4);_animationsDisabled=nt$5();_eventCleanups;_scrollDistance=0;_selectedIndexChanged=!1;_destroyed=new ee$5;_showPaginationControls=!1;_disableScrollAfter=!0;_disableScrollBefore=!0;_tabLabelCount;_scrollDistanceChanged=!1;_keyManager;_currentTextContent;_stopScrolling=new ee$5;disablePagination=!1;get selectedIndex(){return this._selectedIndex}set selectedIndex(t){let e=isNaN(t)?0:t;this._selectedIndex!=e&&(this._selectedIndexChanged=!0,this._selectedIndex=e,this._keyManager&&this._keyManager.updateActiveItem(e))}_selectedIndex=0;selectFocusedIndex=new Qe$1;indexFocused=new Qe$1;constructor(){this._eventCleanups=this._ngZone.runOutsideAngular(()=>[this._renderer.listen(this._elementRef.nativeElement,`mouseleave`,()=>this._stopInterval())])}ngAfterViewInit(){this._eventCleanups.push(this._renderer.listen(this._previousPaginator.nativeElement,`touchstart`,()=>this._handlePaginatorPress(`before`),Zt),this._renderer.listen(this._nextPaginator.nativeElement,`touchstart`,()=>this._handlePaginatorPress(`after`),Zt))}ngAfterContentInit(){let t=this._dir?this._dir.change:um(`ltr`),e=this._sharedResizeObserver.observe(this._elementRef.nativeElement).pipe(Wl$4(32),Eu$2(this._destroyed)),n=this._viewportRuler.change(150).pipe(Eu$2(this._destroyed)),i=()=>{this.updatePagination(),this._alignInkBarToSelectedTab()};this._keyManager=new Rr$6(this._items).withHorizontalOrientation(this._getLayoutDirection()).withHomeAndEnd().withWrap().skipPredicate(()=>!1),this._keyManager.updateActiveItem(Math.max(this._selectedIndex,0)),wp$1(i,{injector:this._injector}),_m(t,n,e,this._items.changes,this._itemsResized()).pipe(Eu$2(this._destroyed)).subscribe(()=>{this._ngZone.run(()=>{Promise.resolve().then(()=>{this._scrollDistance=Math.max(0,Math.min(this._getMaxScrollDistance(),this._scrollDistance)),i()})}),this._keyManager?.withHorizontalOrientation(this._getLayoutDirection())}),this._keyManager.change.subscribe(o=>{this.indexFocused.emit(o),this._setTabFocus(o)})}_itemsResized(){return typeof ResizeObserver!=`function`?bt$8:this._items.changes.pipe(Vm(this._items),Iu$2(t=>new b$1(e=>this._ngZone.runOutsideAngular(()=>{let n=new ResizeObserver(i=>e.next(i));return t.forEach(i=>n.observe(i.elementRef.nativeElement)),()=>{n.disconnect()}}))),jm(1),hn$4(t=>t.some(e=>e.contentRect.width>0&&e.contentRect.height>0)))}ngAfterContentChecked(){this._tabLabelCount!=this._items.length&&(this.updatePagination(),this._tabLabelCount=this._items.length,this._changeDetectorRef.markForCheck()),this._selectedIndexChanged&&(this._scrollToLabel(this._selectedIndex),this._checkScrollingControls(),this._alignInkBarToSelectedTab(),this._selectedIndexChanged=!1,this._changeDetectorRef.markForCheck()),this._scrollDistanceChanged&&(this._updateTabScrollPosition(),this._scrollDistanceChanged=!1,this._changeDetectorRef.markForCheck())}ngOnDestroy(){this._eventCleanups.forEach(t=>t()),this._keyManager?.destroy(),this._destroyed.next(),this._destroyed.complete(),this._stopScrolling.complete()}_handleKeydown(t){if(!Ho$5(t))switch(t.keyCode){case 13:case 32:if(this.focusIndex!==this.selectedIndex){let e=this._items.get(this.focusIndex);e&&!e.disabled&&(this.selectFocusedIndex.emit(this.focusIndex),this._itemSelected(t))}break;default:this._keyManager?.onKeydown(t)}}_onContentChanges(){let t=this._elementRef.nativeElement.textContent;t!==this._currentTextContent&&(this._currentTextContent=t||``,this._ngZone.run(()=>{this.updatePagination(),this._alignInkBarToSelectedTab(),this._changeDetectorRef.markForCheck()}))}updatePagination(){this._checkPaginationEnabled(),this._checkScrollingControls(),this._updateTabScrollPosition()}get focusIndex(){return this._keyManager?this._keyManager.activeItemIndex:0}set focusIndex(t){!this._isValidIndex(t)||this.focusIndex===t||!this._keyManager||this._keyManager.setActiveItem(t)}_isValidIndex(t){return this._items?!!this._items.toArray()[t]:!0}_setTabFocus(t){if(this._showPaginationControls&&this._scrollToLabel(t),this._items&&this._items.length){this._items.toArray()[t].focus();let e=this._tabListContainer.nativeElement;this._getLayoutDirection()==`ltr`?e.scrollLeft=0:e.scrollLeft=e.scrollWidth-e.offsetWidth}}_getLayoutDirection(){return this._dir&&this._dir.value===`rtl`?`rtl`:`ltr`}_updateTabScrollPosition(){if(this.disablePagination)return;let t=this.scrollDistance,e=this._getLayoutDirection()===`ltr`?-t:t;this._tabList.nativeElement.style.transform=`translateX(${Math.round(e)}px)`,(this._platform.TRIDENT||this._platform.EDGE)&&(this._tabListContainer.nativeElement.scrollLeft=0)}get scrollDistance(){return this._scrollDistance}set scrollDistance(t){this._scrollTo(t)}_scrollHeader(t){let e=this._tabListContainer.nativeElement.offsetWidth,n=(t==`before`?-1:1)*e/3;return this._scrollTo(this._scrollDistance+n)}_handlePaginatorClick(t){this._stopInterval(),this._scrollHeader(t)}_scrollToLabel(t){if(this.disablePagination)return;let e=this._items?this._items.toArray()[t]:null;if(!e)return;let n=this._tabListContainer.nativeElement.offsetWidth,{offsetLeft:i,offsetWidth:o}=e.elementRef.nativeElement,f,k;this._getLayoutDirection()==`ltr`?(f=i,k=f+o):(k=this._tabListInner.nativeElement.offsetWidth-i,f=k-o);let Z=this.scrollDistance,pt=this.scrollDistance+n;f<Z?this.scrollDistance-=Z-f:k>pt&&(this.scrollDistance+=Math.min(k-pt,f-Z))}_checkPaginationEnabled(){if(this.disablePagination)this._showPaginationControls=!1;else{let n=this._tabListInner.nativeElement.scrollWidth-this._elementRef.nativeElement.offsetWidth>=5;n||(this.scrollDistance=0),n!==this._showPaginationControls&&(this._showPaginationControls=n,this._changeDetectorRef.markForCheck())}}_checkScrollingControls(){this.disablePagination?this._disableScrollAfter=this._disableScrollBefore=!0:(this._disableScrollBefore=this.scrollDistance==0,this._disableScrollAfter=this.scrollDistance==this._getMaxScrollDistance(),this._changeDetectorRef.markForCheck())}_getMaxScrollDistance(){return this._tabListInner.nativeElement.scrollWidth-this._tabListContainer.nativeElement.offsetWidth||0}_alignInkBarToSelectedTab(){let t=this._items&&this._items.length?this._items.toArray()[this.selectedIndex]:null,e=t?t.elementRef.nativeElement:null;e?this._inkBar.alignToElement(e):this._inkBar.hide()}_stopInterval(){this._stopScrolling.next()}_handlePaginatorPress(t,e){e&&e.button!=null&&e.button!==0||(this._stopInterval(),We$2(Ce,xe).pipe(Eu$2(_m(this._stopScrolling,this._destroyed))).subscribe(()=>{let{maxScrollDistance:n,distance:i}=this._scrollHeader(t);(i===0||i>=n)&&this._stopInterval()}))}_scrollTo(t){if(this.disablePagination)return{maxScrollDistance:0,distance:0};let e=this._getMaxScrollDistance();return this._scrollDistance=Math.max(0,Math.min(e,t)),this._scrollDistanceChanged=!0,this._checkScrollingControls(),{maxScrollDistance:e,distance:this._scrollDistance}}static ɵfac=function(e){return new(e||a)};static ɵdir=HD({type:a,inputs:{disablePagination:[2,`disablePagination`,`disablePagination`,rj],selectedIndex:[2,`selectedIndex`,`selectedIndex`,oj]},outputs:{selectFocusedIndex:`selectFocusedIndex`,indexFocused:`indexFocused`}})}return a})();var Se=(()=>{class a extends Ie{_items;_tabListContainer;_tabList;_tabListInner;_nextPaginator;_previousPaginator;_inkBar;ariaLabel;ariaLabelledby;disableRipple=!1;ngAfterContentInit(){this._inkBar=new bt$1(this._items),super.ngAfterContentInit()}_itemSelected(t){t.preventDefault()}static ɵfac=(()=>{let t;return function(n){return(t||(t=lv(a)))(n||a)}})();static ɵcmp=PD({type:a,selectors:[[`mat-tab-header`]],contentQueries:function(e,n,i){if(e&1&&Bh$3(i,Ut$1,4),e&2){let o;Pw(o=Lw())&&(n._items=o)}},viewQuery:function(e,n){if(e&1&&$h$2(ne,7)(ae$1,7)(ie,7)(oe,5)(re,5),e&2){let i;Pw(i=Lw())&&(n._tabListContainer=i.first),Pw(i=Lw())&&(n._tabList=i.first),Pw(i=Lw())&&(n._tabListInner=i.first),Pw(i=Lw())&&(n._nextPaginator=i.first),Pw(i=Lw())&&(n._previousPaginator=i.first)}},hostAttrs:[1,`mat-mdc-tab-header`],hostVars:4,hostBindings:function(e,n){e&2&&Yh$3(`mat-mdc-tab-header-pagination-controls-enabled`,n._showPaginationControls)(`mat-mdc-tab-header-rtl`,n._getLayoutDirection()==`rtl`)},inputs:{ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`],disableRipple:[2,`disableRipple`,`disableRipple`,rj]},features:[wh$3],ngContentSelectors:_t$2,decls:13,vars:10,consts:[[`previousPaginator`,``],[`tabListContainer`,``],[`tabList`,``],[`tabListInner`,``],[`nextPaginator`,``],[`mat-ripple`,``,1,`mat-mdc-tab-header-pagination`,`mat-mdc-tab-header-pagination-before`,3,`click`,`mousedown`,`touchend`,`matRippleDisabled`],[1,`mat-mdc-tab-header-pagination-chevron`],[1,`mat-mdc-tab-label-container`,3,`keydown`],[`role`,`tablist`,1,`mat-mdc-tab-list`,3,`cdkObserveContent`],[1,`mat-mdc-tab-labels`],[`mat-ripple`,``,1,`mat-mdc-tab-header-pagination`,`mat-mdc-tab-header-pagination-after`,3,`mousedown`,`click`,`touchend`,`matRippleDisabled`]],template:function(e,n){e&1&&(Rw(),Bi$3(0,`div`,5,0),jh$3(`click`,function(){return n._handlePaginatorClick(`before`)})(`mousedown`,function(o){return n._handlePaginatorPress(`before`,o)})(`touchend`,function(){return n._stopInterval()}),Rh$3(2,`div`,6),vl$4(),Bi$3(3,`div`,7,1),jh$3(`keydown`,function(o){return n._handleKeydown(o)}),Bi$3(5,`div`,8,2),jh$3(`cdkObserveContent`,function(){return n._onContentChanges()}),Bi$3(7,`div`,9,3),kw(9),vl$4()()(),Bi$3(10,`div`,10,4),jh$3(`mousedown`,function(o){return n._handlePaginatorPress(`after`,o)})(`click`,function(){return n._handlePaginatorClick(`after`)})(`touchend`,function(){return n._stopInterval()}),Rh$3(12,`div`,6),vl$4()),e&2&&(Yh$3(`mat-mdc-tab-header-pagination-disabled`,n._disableScrollBefore),Ah$2(`matRippleDisabled`,n._disableScrollBefore||n.disableRipple),sE(3),Yh$3(`_mat-animation-noopable`,n._animationsDisabled),sE(2),xh$2(`aria-label`,n.ariaLabel||null)(`aria-labelledby`,n.ariaLabelledby||null),sE(5),Yh$3(`mat-mdc-tab-header-pagination-disabled`,n._disableScrollAfter),Ah$2(`matRippleDisabled`,n._disableScrollAfter||n.disableRipple))},dependencies:[$h$3,rm],styles:[`.mat-mdc-tab-header { 6980 display: flex; 6981 overflow: hidden; 6982 position: relative; 6983 flex-shrink: 0; 6984} 6985 6986.mdc-tab-indicator .mdc-tab-indicator__content { 6987 transition-duration: var(--%NS%mat-tab-header-animation-duration, 250ms); 6988} 6989 6990.mat-mdc-tab-header-pagination { 6991 -webkit-user-select: none; 6992 user-select: none; 6993 position: relative; 6994 display: none; 6995 justify-content: center; 6996 align-items: center; 6997 min-width: 32px; 6998 cursor: pointer; 6999 z-index: 2; 7000 -webkit-tap-highlight-color: transparent; 7001 touch-action: none; 7002 box-sizing: content-box; 7003 outline: 0; 7004} 7005.mat-mdc-tab-header-pagination::-moz-focus-inner { 7006 border: 0; 7007} 7008.mat-mdc-tab-header-pagination .mat-ripple-element { 7009 opacity: 0.12; 7010 background-color: var(--%NS%mat-tab-inactive-ripple-color, var(--%NS%mat-sys-on-surface)); 7011} 7012.mat-mdc-tab-header-pagination-controls-enabled .mat-mdc-tab-header-pagination { 7013 display: flex; 7014} 7015 7016.mat-mdc-tab-header-pagination-before, 7017.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after { 7018 padding-left: 4px; 7019} 7020.mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron, 7021.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron { 7022 transform: rotate(-135deg); 7023} 7024 7025.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before, 7026.mat-mdc-tab-header-pagination-after { 7027 padding-right: 4px; 7028} 7029.mat-mdc-tab-header-rtl .mat-mdc-tab-header-pagination-before .mat-mdc-tab-header-pagination-chevron, 7030.mat-mdc-tab-header-pagination-after .mat-mdc-tab-header-pagination-chevron { 7031 transform: rotate(45deg); 7032} 7033 7034.mat-mdc-tab-header-pagination-chevron { 7035 border-style: solid; 7036 border-width: 2px 2px 0 0; 7037 height: 8px; 7038 width: 8px; 7039 border-color: var(--%NS%mat-tab-pagination-icon-color, var(--%NS%mat-sys-on-surface)); 7040} 7041 7042.mat-mdc-tab-header-pagination-disabled { 7043 box-shadow: none; 7044 cursor: default; 7045 pointer-events: none; 7046} 7047.mat-mdc-tab-header-pagination-disabled .mat-mdc-tab-header-pagination-chevron { 7048 opacity: 0.4; 7049} 7050 7051.mat-mdc-tab-list { 7052 flex-grow: 1; 7053 position: relative; 7054 transition: transform 500ms cubic-bezier(0.35, 0, 0.25, 1); 7055} 7056._mat-animation-noopable .mat-mdc-tab-list { 7057 transition: none; 7058} 7059 7060.mat-mdc-tab-label-container { 7061 display: flex; 7062 flex-grow: 1; 7063 overflow: hidden; 7064 z-index: 1; 7065 border-bottom-style: solid; 7066 border-bottom-width: var(--%NS%mat-tab-divider-height, 1px); 7067 border-bottom-color: var(--%NS%mat-tab-divider-color, var(--%NS%mat-sys-surface-variant)); 7068} 7069.mat-mdc-tab-group-inverted-header .mat-mdc-tab-label-container { 7070 border-bottom: none; 7071 border-top-style: solid; 7072 border-top-width: var(--%NS%mat-tab-divider-height, 1px); 7073 border-top-color: var(--%NS%mat-tab-divider-color, var(--%NS%mat-sys-surface-variant)); 7074} 7075 7076.mat-mdc-tab-labels { 7077 display: flex; 7078 flex: 1 0 auto; 7079} 7080[mat-align-tabs=center] > .mat-mdc-tab-header .mat-mdc-tab-labels { 7081 justify-content: center; 7082} 7083[mat-align-tabs=end] > .mat-mdc-tab-header .mat-mdc-tab-labels { 7084 justify-content: flex-end; 7085} 7086.cdk-drop-list .mat-mdc-tab-labels, .mat-mdc-tab-labels.cdk-drop-list { 7087 min-height: var(--%NS%mat-tab-container-height, 48px); 7088} 7089 7090.mat-mdc-tab::before { 7091 margin: 5px; 7092} 7093@media (forced-colors: active) { 7094 .mat-mdc-tab[aria-disabled=true] { 7095 color: GrayText; 7096 } 7097} 7098`],encapsulation:2,changeDetection:1})}return a})();var we=new N$2(`MAT_TABS_CONFIG`);var Kt$1=(()=>{class a extends vi$4{_host=E(mt$1);_ngZone=E(Z$4);_centeringSub=F$2.EMPTY;_leavingSub=F$2.EMPTY;ngOnInit(){super.ngOnInit(),this._centeringSub=this._host._beforeCentering.pipe(Vm(this._host._isCenterPosition())).subscribe(t=>{this._host._content&&t&&!this.hasAttached()&&this._ngZone.run(()=>{Promise.resolve().then(),this.attach(this._host._content)})}),this._leavingSub=this._host._afterLeavingCenter.subscribe(()=>{this._host.preserveContent||this._ngZone.run(()=>this.detach())})}ngOnDestroy(){super.ngOnDestroy(),this._centeringSub.unsubscribe(),this._leavingSub.unsubscribe()}static ɵfac=(()=>{let t;return function(n){return(t||(t=lv(a)))(n||a)}})();static ɵdir=HD({type:a,selectors:[[``,`matTabBodyHost`,``]],features:[wh$3]})}return a})();var mt$1=(()=>{class a{_elementRef=E(Lr$5);
7098_dir=E(Oc$4,{optional:!0});_ngZone=E(Z$4);_injector=E(we$4);_renderer=E(pc$4);_diAnimationsDisabled=nt$5();_eventCleanups;_initialized=!1;_fallbackTimer;_positionIndex;_dirChangeSubscription=F$2.EMPTY;_position;_previousPosition;_onCentering=new Qe$1;_beforeCentering=new Qe$1;_afterLeavingCenter=new Qe$1;_onCentered=new Qe$1(!0);_portalHost;_contentElement;_content;animationDuration=`500ms`;preserveContent=!1;set position(t){this._positionIndex=t,this._computePositionAnimationState()}constructor(){if(this._dir){let t=E(ej);this._dirChangeSubscription=this._dir.change.subscribe(e=>{this._computePositionAnimationState(e),t.markForCheck()})}}ngOnInit(){this._bindTransitionEvents(),this._position===`center`&&(this._setActiveClass(!0),wp$1(()=>this._onCentering.emit(this._elementRef.nativeElement.clientHeight),{injector:this._injector})),this._initialized=!0}ngOnDestroy(){clearTimeout(this._fallbackTimer),this._eventCleanups?.forEach(t=>t()),this._dirChangeSubscription.unsubscribe()}_bindTransitionEvents(){this._ngZone.runOutsideAngular(()=>{let t=this._elementRef.nativeElement,e=n=>{n.target===this._contentElement?.nativeElement&&(this._elementRef.nativeElement.classList.remove(`mat-tab-body-animating`),n.type===`transitionend`&&this._transitionDone())};this._eventCleanups=[this._renderer.listen(t,`transitionstart`,n=>{n.target===this._contentElement?.nativeElement&&(this._elementRef.nativeElement.classList.add(`mat-tab-body-animating`),this._transitionStarted())}),this._renderer.listen(t,`transitionend`,e),this._renderer.listen(t,`transitioncancel`,e)]})}_transitionStarted(){clearTimeout(this._fallbackTimer);let t=this._position===`center`;this._beforeCentering.emit(t),t&&this._onCentering.emit(this._elementRef.nativeElement.clientHeight)}_transitionDone(){this._position===`center`?this._onCentered.emit():this._previousPosition===`center`&&this._afterLeavingCenter.emit()}_setActiveClass(t){this._elementRef.nativeElement.classList.toggle(`mat-mdc-tab-body-active`,t)}_getLayoutDirection(){return this._dir&&this._dir.value===`rtl`?`rtl`:`ltr`}_isCenterPosition(){return this._positionIndex===0}_computePositionAnimationState(t=this._getLayoutDirection()){this._previousPosition=this._position,this._positionIndex<0?this._position=t==`ltr`?`left`:`right`:this._positionIndex>0?this._position=t==`ltr`?`right`:`left`:this._position=`center`,this._animationsDisabled()?this._simulateTransitionEvents():this._initialized&&(this._position===`center`||this._previousPosition===`center`)&&(clearTimeout(this._fallbackTimer),this._fallbackTimer=this._ngZone.runOutsideAngular(()=>setTimeout(()=>this._simulateTransitionEvents(),100)))}_simulateTransitionEvents(){this._transitionStarted(),wp$1(()=>this._transitionDone(),{injector:this._injector})}_animationsDisabled(){return this._diAnimationsDisabled||this.animationDuration===`0ms`||this.animationDuration===`0s`}static ɵfac=function(e){return new(e||a)};static ɵcmp=PD({type:a,selectors:[[`mat-tab-body`]],viewQuery:function(e,n){if(e&1&&$h$2(Kt$1,5)(se$1,5),e&2){let i;Pw(i=Lw())&&(n._portalHost=i.first),Pw(i=Lw())&&(n._contentElement=i.first)}},hostAttrs:[1,`mat-mdc-tab-body`],hostVars:1,hostBindings:function(e,n){e&2&&xh$2(`inert`,n._position===`center`?null:``)},inputs:{_content:[0,`content`,`_content`],animationDuration:`animationDuration`,preserveContent:`preserveContent`,position:`position`},outputs:{_onCentering:`_onCentering`,_beforeCentering:`_beforeCentering`,_onCentered:`_onCentered`},decls:3,vars:6,consts:[[`content`,``],[`cdkScrollable`,``,1,`mat-mdc-tab-body-content`],[`matTabBodyHost`,``]],template:function(e,n){e&1&&(Bi$3(0,`div`,1,0),Th$2(2,le$2,0,0,`ng-template`,2),vl$4()),e&2&&Yh$3(`mat-tab-body-content-left`,n._position===`left`)(`mat-tab-body-content-right`,n._position===`right`)(`mat-tab-body-content-can-animate`,n._position===`center`||n._previousPosition===`center`)},dependencies:[Kt$1,Ft$4],styles:[`.mat-mdc-tab-body { 7099 top: 0; 7100 left: 0; 7101 right: 0; 7102 bottom: 0; 7103 position: absolute; 7104 display: block; 7105 overflow: hidden; 7106 outline: 0; 7107 flex-basis: 100%; 7108} 7109.mat-mdc-tab-body.mat-mdc-tab-body-active { 7110 position: relative; 7111 overflow-x: hidden; 7112 overflow-y: auto; 7113 z-index: 1; 7114 flex-grow: 1; 7115} 7116.mat-mdc-tab-group.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body.mat-mdc-tab-body-active { 7117 overflow-y: hidden; 7118} 7119 7120.mat-mdc-tab-body-content { 7121 height: 100%; 7122 overflow: auto; 7123 transform: none; 7124 visibility: hidden; 7125} 7126.mat-tab-body-animating > .mat-mdc-tab-body-content, .mat-mdc-tab-body-active > .mat-mdc-tab-body-content { 7127 visibility: visible; 7128} 7129.mat-tab-body-animating > .mat-mdc-tab-body-content { 7130 min-height: 1px; 7131} 7132.mat-mdc-tab-group-dynamic-height .mat-mdc-tab-body-content { 7133 overflow: hidden; 7134} 7135 7136.mat-tab-body-content-can-animate { 7137 transition: transform var(--%NS%mat-tab-body-animation-duration) 1ms cubic-bezier(0.35, 0, 0.25, 1); 7138} 7139.mat-mdc-tab-body-wrapper._mat-animation-noopable .mat-tab-body-content-can-animate { 7140 transition: none; 7141} 7142 7143.mat-tab-body-content-left { 7144 transform: translate3d(-100%, 0, 0); 7145} 7146 7147.mat-tab-body-content-right { 7148 transform: translate3d(100%, 0, 0); 7149} 7150`],encapsulation:2,changeDetection:1})}return a})();var dn$1=(()=>{class a{_elementRef=E(Lr$5);_changeDetectorRef=E(ej);_ngZone=E(Z$4);_tabsSubscription=F$2.EMPTY;_tabLabelSubscription=F$2.EMPTY;_tabBodySubscription=F$2.EMPTY;_diAnimationsDisabled=nt$5();_bodyAnimationDuration;_headerAnimationDuration;_allTabs;_tabBodies;_tabBodyWrapper;_tabHeader;_tabs=new Ci$3;_indexToSelect=0;_lastFocusedTabIndex=null;_tabBodyWrapperHeight=0;color;get fitInkBarToContent(){return this._fitInkBarToContent}set fitInkBarToContent(t){this._fitInkBarToContent=t,this._changeDetectorRef.markForCheck()}_fitInkBarToContent=!1;stretchTabs=!0;alignTabs=null;dynamicHeight=!1;get selectedIndex(){return this._selectedIndex}set selectedIndex(t){this._indexToSelect=isNaN(t)?null:t}_selectedIndex=null;headerPosition=`above`;get animationDuration(){return this._animationDuration}set animationDuration(t){this._animationDuration=t,t&&typeof t==`object`?(this._bodyAnimationDuration=ct$1(t.body),this._headerAnimationDuration=ct$1(t.header)):this._headerAnimationDuration=this._bodyAnimationDuration=ct$1(t)}_animationDuration;get contentTabIndex(){return this._contentTabIndex}set contentTabIndex(t){this._contentTabIndex=isNaN(t)?null:t}_contentTabIndex=null;disablePagination=!1;disableRipple=!1;preserveContent=!1;get backgroundColor(){return this._backgroundColor}set backgroundColor(t){let e=this._elementRef.nativeElement.classList;e.remove(`mat-tabs-with-background`,`mat-background-${this.backgroundColor}`),t&&e.add(`mat-tabs-with-background`,`mat-background-${t}`),this._backgroundColor=t}_backgroundColor;ariaLabel;ariaLabelledby;selectedIndexChange=new Qe$1;focusChange=new Qe$1;animationDone=new Qe$1;selectedTabChange=new Qe$1(!0);_groupId;_isServer=!E(k$2).isBrowser;constructor(){let t=E(we,{optional:!0});this._groupId=E(Or$4).getId(`mat-tab-group-`),this.animationDuration=t&&t.animationDuration?t.animationDuration:`500ms`,this.disablePagination=t&&t.disablePagination!=null?t.disablePagination:!1,this.dynamicHeight=t&&t.dynamicHeight!=null?t.dynamicHeight:!1,t?.contentTabIndex!=null&&(this.contentTabIndex=t.contentTabIndex),this.preserveContent=!!t?.preserveContent,this.fitInkBarToContent=t&&t.fitInkBarToContent!=null?t.fitInkBarToContent:!1,this.stretchTabs=t&&t.stretchTabs!=null?t.stretchTabs:!0,this.alignTabs=t&&t.alignTabs!=null?t.alignTabs:null}ngAfterContentChecked(){let t=this._indexToSelect=this._clampTabIndex(this._indexToSelect);if(this._selectedIndex!=t){let e=this._selectedIndex==null;if(!e){this.selectedTabChange.emit(this._createChangeEvent(t));let n=this._tabBodyWrapper.nativeElement;n.style.minHeight=n.clientHeight+`px`}Promise.resolve().then(()=>
7150{this._tabs.forEach((n,i)=>n.isActive=i===t),e||(this.selectedIndexChange.emit(t),this._tabBodyWrapper.nativeElement.style.minHeight=``)})}this._tabs.forEach((e,n)=>{e.position=n-t,this._selectedIndex!=null&&e.position==0&&!e.origin&&(e.origin=t-this._selectedIndex)}),this._selectedIndex!==t&&(this._selectedIndex=t,this._lastFocusedTabIndex=null,this._changeDetectorRef.markForCheck())}ngAfterContentInit(){this._subscribeToAllTabChanges(),this._subscribeToTabLabels(),this._tabsSubscription=this._tabs.changes.subscribe(()=>{let t=this._clampTabIndex(this._indexToSelect);if(t===this._selectedIndex){let e=this._tabs.toArray(),n;for(let i=0;i<e.length;i++)if(e[i].isActive){this._indexToSelect=this._selectedIndex=i,this._lastFocusedTabIndex=null,n=e[i];break}!n&&e[t]&&Promise.resolve().then(()=>{e[t].isActive=!0,this.selectedTabChange.emit(this._createChangeEvent(t))})}this._changeDetectorRef.markForCheck()})}ngAfterViewInit(){this._tabBodySubscription=this._tabBodies.changes.subscribe(()=>this._bodyCentered(!0))}_subscribeToAllTabChanges(){this._allTabs.changes.pipe(Vm(this._allTabs)).subscribe(t=>{this._tabs.reset(t.filter(e=>e._closestTabGroup===this||!e._closestTabGroup)),this._tabs.notifyOnChanges()})}ngOnDestroy(){this._tabs.destroy(),this._tabsSubscription.unsubscribe(),this._tabLabelSubscription.unsubscribe(),this._tabBodySubscription.unsubscribe()}realignInkBar(){this._tabHeader&&this._tabHeader._alignInkBarToSelectedTab()}updatePagination(){this._tabHeader&&this._tabHeader.updatePagination()}focusTab(t){let e=this._tabHeader;e&&(e.focusIndex=t)}_focusChanged(t){this._lastFocusedTabIndex=t,this.focusChange.emit(this._createChangeEvent(t))}_createChangeEvent(t){let e=new ht$2;return e.index=t,this._tabs&&this._tabs.length&&(e.tab=this._tabs.toArray()[t]),e}_subscribeToTabLabels(){this._tabLabelSubscription&&this._tabLabelSubscription.unsubscribe(),this._tabLabelSubscription=_m(...this._tabs.map(t=>t._stateChanges)).subscribe(()=>this._changeDetectorRef.markForCheck())}_clampTabIndex(t){return Math.min(this._tabs.length-1,Math.max(t||0,0))}_getTabLabelId(t,e){return t.id||`${this._groupId}-label-${e}`}_getTabContentId(t){return`${this._groupId}-content-${t}`}_setTabBodyWrapperHeight(t){if(!this.dynamicHeight||!this._tabBodyWrapperHeight){this._tabBodyWrapperHeight=t;return}let e=this._tabBodyWrapper.nativeElement;e.style.height=this._tabBodyWrapperHeight+`px`,this._tabBodyWrapper.nativeElement.offsetHeight&&(e.style.height=t+`px`)}_removeTabBodyWrapperHeight(){let t=this._tabBodyWrapper.nativeElement;this._tabBodyWrapperHeight=t.clientHeight,t.style.height=``,this._ngZone.run(()=>this.animationDone.emit())}_handleClick(t,e,n){e.focusIndex=n,t.disabled||(this.selectedIndex=n)}_getTabIndex(t){return t===(this._lastFocusedTabIndex??this.selectedIndex)?0:-1}_tabFocusChanged(t,e){t&&t!==`mouse`&&t!==`touch`&&(this._tabHeader.focusIndex=e)}_bodyCentered(t){t&&this._tabBodies?.forEach((e,n)=>e._setActiveClass(n===this._selectedIndex))}_bodyAnimationsDisabled(){return this._diAnimationsDisabled||this._bodyAnimationDuration===`0`||this._bodyAnimationDuration===`0ms`}static ɵfac=function(e){return new(e||a)};static ɵcmp=PD({type:a,selectors:[[`mat-tab-group`]],contentQueries:function(e,n,i){if(e&1&&Bh$3(i,ke,5),e&2){let o;Pw(o=Lw())&&(n._allTabs=o)}},viewQuery:function(e,n){if(e&1&&$h$2(de,5)(ce,5)(mt$1,5),e&2){let i;Pw(i=Lw())&&(n._tabBodyWrapper=i.first),Pw(i=Lw())&&(n._tabHeader=i.first),Pw(i=Lw())&&(n._tabBodies=i)}},hostAttrs:[1,`mat-mdc-tab-group`],hostVars:13,hostBindings:function(e,n){e&2&&(xh$2(`mat-align-tabs`,n.alignTabs),Xw(`mat-`+(n.color||`primary`)),Zh$2(`--%NS%mat-tab-body-animation-duration`,n._bodyAnimationDuration)(`--%NS%mat-tab-header-animation-duration`,n._headerAnimationDuration),Yh$3(`mat-mdc-tab-group-dynamic-height`,n.dynamicHeight)(`mat-mdc-tab-group-inverted-header`,n.headerPosition===`below`)(`mat-mdc-tab-group-stretch-tabs`,n.stretchTabs))},inputs:{color:`color`,fitInkBarToContent:[2,`fitInkBarToContent`,`fitInkBarToContent`,rj],stretchTabs:[2,`mat-stretch-tabs`,`stretchTabs`,rj],alignTabs:[0,`mat-align-tabs`,`alignTabs`],dynamicHeight:[2,`dynamicHeight`,`dynamicHeight`,rj],selectedIndex:[2,`selectedIndex`,`selectedIndex`,oj],headerPosition:`headerPosition`,animationDuration:`animationDuration`,contentTabIndex:[2,`contentTabIndex`,`contentTabIndex`,oj],disablePagination:[2,`disablePagination`,`disablePagination`,rj],disableRipple:[2,`disableRipple`,`disableRipple`,rj],preserveContent:[2,`preserveContent`,`preserveContent`,rj],backgroundColor:`backgroundColor`,ariaLabel:[0,`aria-label`,`ariaLabel`],ariaLabelledby:[0,`aria-labelledby`,`ariaLabelledby`]},outputs:{selectedIndexChange:`selectedIndexChange`,focusChange:`focusChange`,animationDone:`animationDone`,selectedTabChange:`selectedTabChange`},exportAs:[`matTabGroup`],features:[CC([{provide:Xt,useExisting:a}])],ngContentSelectors:_t$2,decls:9,vars:8,consts:[[`tabHeader`,``],[`tabBodyWrapper`,``],[`tabNode`,``],[3,`indexFocused`,`selectFocusedIndex`,`selectedIndex`,`disableRipple`,`disablePagination`,`aria-label`,`aria-labelledby`],[`role`,`tab`,`matTabLabelWrapper`,``,`cdkMonitorElementFocus`,``,1,`mdc-tab`,`mat-mdc-tab`,`mat-focus-indicator`,3,`id`,`mdc-tab--active`,`class`,`disabled`,`fitInkBarToContent`],[1,`mat-mdc-tab-body-wrapper`],[`role`,`tabpanel`,3,`id`,`class`,`content`,`position`,`animationDuration`,`preserveContent`],[`role`,`tab`,`matTabLabelWrapper`,``,`cdkMonitorElementFocus`,``,1,`mdc-tab`,`mat-mdc-tab`,`mat-focus-indicator`,3,`click`,`cdkFocusChange`,`id`,`disabled`,`fitInkBarToContent`],[1,`mdc-tab__ripple`],[`mat-ripple`,``,1,`mat-mdc-tab-ripple`,3,`matRippleTrigger`,`matRippleDisabled`],[1,`mdc-tab__content`],[1,`mdc-tab__text-label`],[3,`cdkPortalOutlet`],[`role`,`tabpanel`,3,`_onCentered`,`_onCentering`,`_beforeCentering`,`id`,`content`,`position`,`animationDuration`,`preserveContent`]],template:function(e,n){e&1&&(Rw(),Bi$3(0,`mat-tab-header`,3,0),jh$3(`indexFocused`,function(o){return n._focusChanged(o)})(`selectFocusedIndex`,function(o){return n.selectedIndex=o}),mw(2,_e,8,17,`div`,4,gw),vl$4(),fw(4,pe,1,0),Bi$3(5,`div`,5,1),mw(7,ue,1,10,`mat-tab-body`,6,gw),vl$4()),e&2&&(Ah$2(`selectedIndex`,n.selectedIndex||0)(`disableRipple`,n.disableRipple)(`disablePagination`,n.disablePagination),Sh$2(`aria-label`,n.ariaLabel)(`aria-labelledby`,n.ariaLabelledby),sE(2),yw(n._tabs),sE(2),pw(n._isServer?4:-1),sE(),Yh$3(`_mat-animation-noopable`,n._bodyAnimationsDisabled()),sE(2),yw(n._tabs))},dependencies:[Se,Ut$1,Js$4,$h$3,vi$4,mt$1],styles:[`.mdc-tab { 7151 min-width: 90px; 7152 padding: 0 24px; 7153 display: flex; 7154 flex: 1 0 auto; 7155 justify-content: center; 7156 box-sizing: border-box; 7157 border: none; 7158 outline: none; 7159 text-align: center; 7160 white-space: nowrap; 7161 cursor: pointer; 7162 z-index: 1; 7163 touch-action: manipulation; 7164} 7165 7166.mdc-tab__content { 7167 display: flex; 7168 align-items: center; 7169 justify-content: center; 7170 height: inherit; 7171 pointer-events: none; 7172} 7173 7174.mdc-tab__text-label { 7175 transition: 150ms color linear; 7176 display: inline-block; 7177 line-height: 1; 7178 z-index: 2; 7179} 7180 7181.mdc-tab--active .mdc-tab__text-label { 7182 transition-delay: 100ms; 7183} 7184 7185._mat-animation-noopable .mdc-tab__text-label { 7186 transition: none; 7187} 7188 7189.mdc-tab-indicator { 7190 display: flex; 7191 position: absolute; 7192 top: 0; 7193 left: 0; 7194 justify-content: center; 7195 width: 100%; 7196 height: 100%; 7197 pointer-events: none; 7198 z-index: 1; 7199} 7200 7201.mdc-tab-indicator__content { 7202 transition: var(--%NS%mat-tab-header-animation-duration, 250ms) transform cubic-bezier(0.4, 0, 0.2, 1); 7203 transform-origin: left; 7204 opacity: 0; 7205} 7206 7207.mdc-tab-indicator__content--underline { 7208 align-self: flex-end; 7209 box-sizing: border-box; 7210 width: 100%; 7211 border-top-style: solid; 7212} 7213 7214.mdc-tab-indicator--active .mdc-tab-indicator__content { 7215 opacity: 1; 7216} 7217 7218._mat-animation-noopable .mdc-tab-indicator__content, .mdc-tab-indicator--no-transition .mdc-tab-indicator__content { 7219 transition: none; 7220} 7221 7222.mat-mdc-tab-ripple.mat-mdc-tab-ripple { 7223 position: absolute; 7224 top: 0; 7225 left: 0; 7226 bottom: 0; 7227 right: 0; 7228 pointer-events: none; 7229} 7230 7231.mat-mdc-tab { 7232 -webkit-tap-highlight-color: transparent; 7233 -webkit-font-smoothing: antialiased; 7234 -moz-osx-font-smoothing: grayscale; 7235 text-decoration: none; 7236 background: none; 7237 height: var(--%NS%mat-tab-container-height, 48px); 7238 font-family: var(--%NS%mat-tab-label-text-font, var(--%NS%mat-sys-title-small-font)); 7239 font-size: var(--%NS%mat-tab-label-text-size, var(--%NS%mat-sys-title-small-size)); 7240 letter-spacing: var(--%NS%mat-tab-label-text-tracking, var(--%NS%mat-sys-title-small-tracking)); 7241 line-height: var(--%NS%mat-tab-label-text-line-height, var(--%NS%mat-sys-title-small-line-height)); 7242 font-weight: var(--%NS%mat-tab-label-text-weight, var(--%NS%mat-sys-title-small-weight)); 7243} 7244.mat-mdc-tab.mdc-tab { 7245 flex-grow: 0; 7246} 7247.mat-mdc-tab .mdc-tab-indicator__content--underline { 7248 border-color: var(--%NS%mat-tab-active-indicator-color, var(--%NS%mat-sys-primary)); 7249 border-top-width: var(--%NS%mat-tab-active-indicator-height, 2px); 7250 border-radius: var(--%NS%mat-tab-active-indicator-shape, 0); 7251} 7252.mat-mdc-tab:hover .mdc-tab__text-label { 7253 color: var(--%NS%mat-tab-inactive-hover-label-text-color, var(--%NS%mat-sys-on-surface)); 7254} 7255.mat-mdc-tab:focus .mdc-tab__text-label { 7256 color: var(--%NS%mat-tab-inactive-focus-label-text-color, var(--%NS%mat-sys-on-surface)); 7257} 7258.mat-mdc-tab.mdc-tab--active .mdc-tab__text-label { 7259 color: var(--%NS%mat-tab-active-label-text-color, var(--%NS%mat-sys-on-surface)); 7260} 7261.mat-mdc-tab.mdc-tab--active .mdc-tab__ripple::before, 7262.mat-mdc-tab.mdc-tab--active .mat-ripple-element { 7263 background-color: var(--%NS%mat-tab-active-ripple-color, var(--%NS%mat-sys-on-surface)); 7264} 7265.mat-mdc-tab.mdc-tab--%NS%active:hover .mdc-tab__text-label { 7266 color: var(--%NS%mat-tab-active-hover-label-text-color, var(--%NS%mat-sys-on-surface)); 7267} 7268.mat-mdc-tab.mdc-tab--%NS%active:hover .mdc-tab-indicator__content--underline { 7269 border-color: var(--%NS%mat-tab-active-hover-indicator-color, var(--%NS%mat-sys-primary)); 7270} 7271.mat-mdc-tab.mdc-tab--%NS%active:focus .mdc-tab__text-label { 7272 color: var(--%NS%mat-tab-active-focus-label-text-color, var(--%NS%mat-sys-on-surface)); 7273} 7274.mat-mdc-tab.mdc-tab--%NS%active:focus .mdc-tab-indicator__content--underline { 7275 border-color: var(--%NS%mat-tab-active-focus-indicator-color, var(--%NS%mat-sys-primary)); 7276} 7277.mat-mdc-tab.mat-mdc-tab-disabled { 7278 opacity: 0.4; 7279 pointer-events: none; 7280} 7281.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__content { 7282 pointer-events: none; 7283} 7284.mat-mdc-tab.mat-mdc-tab-disabled .mdc-tab__ripple::before, 7285.mat-mdc-tab.mat-mdc-tab-disabled .mat-ripple-element { 7286 background-color: var(--%NS%mat-tab-disabled-ripple-color, var(--%NS%mat-sys-on-surface-variant)); 7287} 7288.mat-mdc-tab .mdc-tab__ripple::before { 7289 content: ""; 7290 display: block; 7291 position: absolute; 7292 top: 0; 7293 left: 0; 7294 right: 0; 7295 bottom: 0; 7296 opacity: 0; 7297 pointer-events: none; 7298 background-color: var(--%NS%mat-tab-inactive-ripple-color, var(--%NS%mat-sys-on-surface)); 7299} 7300.mat-mdc-tab .mdc-tab__text-label { 7301 color: var(--%NS%mat-tab-inactive-label-text-color, var(--%NS%mat-sys-on-surface)); 7302 display: inline-flex; 7303 align-items: center; 7304} 7305.mat-mdc-tab .mdc-tab__content { 7306 position: relative; 7307 pointer-events: auto; 7308} 7309.mat-mdc-tab:hover .mdc-tab__ripple::before { 7310 opacity: 0.04; 7311} 7312.mat-mdc-tab.cdk-program-focused .mdc-tab__ripple::before, .mat-mdc-tab.cdk-keyboard-focused .mdc-tab__ripple::before { 7313 opacity: 0.12; 7314} 7315.mat-mdc-tab .mat-ripple-element { 7316 opacity: 0.12; 7317 background-color: var(--%NS%mat-tab-inactive-ripple-color, var(--%NS%mat-sys-on-surface)); 7318} 7319.mat-mdc-tab-group.mat-mdc-tab-group-stretch-tabs > .mat-mdc-tab-header .mat-mdc-tab { 7320 flex-grow: 1; 7321} 7322 7323.mat-mdc-tab-group { 7324 display: flex; 7325 flex-direction: column; 7326 max-width: 100%; 7327} 7328.mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header, .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header-pagination { 7329 background-color: var(--%NS%mat-tab-background-color); 7330} 7331.mat-mdc-tab-group.mat-tabs-with-background.mat-primary > .mat-mdc-tab-header .mat-mdc-tab .mdc-tab__text-label { 7332 color: var(--%NS%mat-tab-foreground-color); 7333} 7334.mat-mdc-tab-group.mat-tabs-with-background.mat-primary > .mat-mdc-tab-header .mdc-tab-indicator__content--underline { 7335 border-color: var(--%NS%mat-tab-foreground-color); 7336} 7337.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary) > .mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label { 7338 color: var(--%NS%mat-tab-foreground-color); 7339} 7340.mat-mdc-tab-group.mat-tabs-with-background:not(.mat-primary) > .mat-mdc-tab-header .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab-indicator__content--underline { 7341 border-color: var(--%NS%mat-tab-foreground-color); 7342} 7343.mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron, 7344.mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header .mat-focus-indicator::before, .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron, 7345.mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header-pagination .mat-focus-indicator::before { 7346 border-color: var(--%NS%mat-tab-foreground-color); 7347} 7348.mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header .mat-ripple-element, .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header .mdc-tab__ripple::before, .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header-pagination .mat-ripple-element, .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header-pagination .mdc-tab__ripple::before { 7349 background-color: var(--%NS%mat-tab-foreground-color); 7350} 7351.mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header .mat-mdc-tab-header-pagination-chevron, .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header-pagination .mat-mdc-tab-header-pagination-chevron { 7352 color: var(--%NS%mat-tab-foreground-color); 7353} 7354.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header { 7355 flex-direction: column-reverse; 7356} 7357.mat-mdc-tab-group.mat-mdc-tab-group-inverted-header .mdc-tab-indicator__content--underline { 7358 align-self: flex-start; 7359} 7360 7361.mat-mdc-tab-body-wrapper { 7362 position: relative; 7363 overflow: hidden; 7364 display: flex; 7365 transition: height 500ms cubic-bezier(0.35, 0, 0.25, 1); 7366} 7367.mat-mdc-tab-body-wrapper._mat-animation-noopable { 7368 transition: none !important; 7369 animation: none !important; 7370} 7371`],encapsulation:2,changeDetection:1})}return a})();var ht$2=class{index;tab};var cn$1=(()=>{class a{static ɵfac=function(e){return new(e||a)};static ɵmod=FD({type:a});static ɵinj=ju$1({imports:[xn$4]})}return a})();function ot(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`validation.required`)))}function rt(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`validation.required`)))}function st(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`settings.passwordTooShort`)))}function lt(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`validation.required`)))}function pt(e,i){e&1&&(Bi$3(0,`p`,9),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`settings.passwordsMustMatch`)))}function mt(e){return e.get(`newPassword`)?.value===e.get(`confirmPassword`)?.value?null:{passwordsMatch:!0}}var ae=class e{profileService=E(ie$4);fb=E(Kn$4);isSaving=ni$3(!1);form=this.fb.group({currentPassword:[``,[ye$4.required]],newPassword:[``,[ye$4.required,ye$4.minLength(8)]],confirmPassword:[``,[ye$4.required]]},{validators:mt});save(){return ps$4(this,null,function*(){if(this.form.markAllAsTouched(),!this.form.invali
7371d){this.isSaving.set(!0);try{yield this.profileService.changePassword(this.form.value.currentPassword,this.form.value.newPassword),this.form.reset()}catch(i){uu$2.error(`Change password failed:`,i)}finally{this.isSaving.set(!1)}}})}static ɵfac=function(o){return new(o||e)};static ɵcmp=PD({type:e,selectors:[[`app-change-password-form`]],decls:35,vars:24,consts:[[`data-testid`,`change-password-form`,1,`change-password-form`],[1,`text-lg`,`font-medium`,`mb-3`],[1,`text-sm`,`mb-4`],[3,`formGroup`],[1,`mb-4`],[`appearance`,`outline`,1,`w-full`],[`matInput`,``,`type`,`password`,`formControlName`,`currentPassword`,`data-testid`,`current-password-input`],[`matInput`,``,`type`,`password`,`formControlName`,`newPassword`,`data-testid`,`new-password-input`],[`matInput`,``,`type`,`password`,`formControlName`,`confirmPassword`,`data-testid`,`confirm-password-input`],[1,`text-red-500`,`text-sm`,`-mt-5`,`mb-4`],[1,`flex`,`justify-end`,`mt-2`],[`mat-flat-button`,``,`color`,`primary`,`data-testid`,`change-password-save-button`,3,`pointerup`,`disabled`]],template:function(o,s){o&1&&(Bi$3(0,`div`,0)(1,`h3`,1),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`p`,2),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`form`,3)(8,`div`,4)(9,`mat-form-field`,5)(10,`mat-label`),lC(11),OC(12,`translate`),vl$4(),Rh$3(13,`input`,6),WE(),fw(14,ot,3,3,`mat-error`),vl$4()(),Bi$3(15,`div`,4)(16,`mat-form-field`,5)(17,`mat-label`),lC(18),OC(19,`translate`),vl$4(),Rh$3(20,`input`,7),WE(),fw(21,rt,3,3,`mat-error`)(22,st,3,3,`mat-error`),vl$4()(),Bi$3(23,`div`,4)(24,`mat-form-field`,5)(25,`mat-label`),lC(26),OC(27,`translate`),vl$4(),Rh$3(28,`input`,8),WE(),fw(29,lt,3,3,`mat-error`),vl$4()(),fw(30,pt,3,3,`p`,9),Bi$3(31,`div`,10)(32,`button`,11),jh$3(`pointerup`,function(){return s.save()}),lC(33),OC(34,`translate`),vl$4()()()()),o&2&&(sE(2),ig(LC(3,12,`settings.changePassword`)),sE(3),ig(LC(6,14,`settings.changePasswordSubtitle`)),sE(2),Ah$2(`formGroup`,s.form),sE(4),ig(LC(12,16,`settings.currentPassword`)),sE(2),zE(),sE(),pw(s.form.get(`currentPassword`)?.hasError(`required`)?14:-1),sE(4),ig(LC(19,18,`settings.newPassword`)),sE(2),zE(),sE(),pw(s.form.get(`newPassword`)?.hasError(`required`)?21:s.form.get(`newPassword`)?.hasError(`minlength`)?22:-1),sE(5),ig(LC(27,20,`settings.confirmNewPassword`)),sE(2),zE(),sE(),pw(s.form.get(`confirmPassword`)?.hasError(`required`)?29:-1),sE(),pw(s.form.hasError(`passwordsMatch`)&&s.form.get(`confirmPassword`)?.touched?30:-1),sE(2),Ah$2(`disabled`,s.isSaving()),sE(),Cl$4(` `,LC(34,22,`button.save`),` `))},dependencies:[Qn$4,Zn$4,Qe$2,qn$5,$n$4,bn$4,Vn$4,en$4,je$3,X$5,gt$7,Be$2,Pe$4,Ap$1,wp$2,Xp$1],encapsulation:2})};function dt(e,i){e&1&&Rh$3(0,`img`,6),e&2&&Ah$2(`src`,i,lp$1)}function ct(e,i){if(e&1&&(Bi$3(0,`span`),lC(1),vl$4()),e&2){let o=xw(2);sE(),ig(o.initials())}}
7371function gt(e,i){if(e&1){let o=Cw();Bi$3(0,`button`,9),jh$3(`click`,function(){ld$2(o);return ud$1(xw(2).onRemoveImage())}),Bi$3(1,`mat-icon`),lC(2,`delete`),vl$4(),lC(3),OC(4,`translate`),vl$4()}if(e&2)Ah$2(`disabled`,xw(2).uploading()),sE(3),Cl$4(` `,LC(4,2,`profile.image.remove`),` `)}function ft$1(e,i){e&1&&(Bi$3(0,`span`,11),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`profile.image.uploading`)))}function ut(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1,`30â300 kg`),vl$4())}function _t$1(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1,`100â250 cm`),vl$4())}function bt(e,i){e&1&&(Bi$3(0,`mat-error`),lC(1,`100â250 bpm`),vl$4())}function vt(e,i){if(e&1&&(Bi$3(0,`div`,21)(1,`mat-icon`,22),lC(2,`watch`),vl$4(),Bi$3(3,`div`,23)(4,`span`,24),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`span`,25),lC(8),vl$4()()()),e&2){let o=xw();sE(5),ig(LC(6,2,`profile.connectedDevice`)),sE(3),ig(o.connected_device)}}function yt(e,i){if(e&1){let o=Cw();Bi$3(0,`div`,4)(1,`div`,5),fw(2,dt,1,1,`img`,6)(3,ct,2,1,`span`),vl$4(),Bi$3(4,`div`,7)(5,`input`,8,0),OC(7,`translate`),jh$3(`change`,function(m){ld$2(o);return ud$1(xw().onFileSelected(m))}),vl$4(),Bi$3(8,`button`,9),jh$3(`click`,function(){ld$2(o);return ud$1(jw(6).click())}),Bi$3(9,`mat-icon`),lC(10,`photo_camera`),vl$4(),lC(11),OC(12,`translate`),vl$4(),fw(13,gt,5,4,`button`,10),fw(14,ft$1,3,3,`span`,11),vl$4()(),Bi$3(15,`form`,12)(16,`mat-form-field`,13)(17,`mat-label`),lC(18),OC(19,`translate`),vl$4(),Rh$3(20,`input`,14),WE(),vl$4(),Bi$3(2
73711,`mat-form-field`,13)(22,`mat-label`),lC(23),OC(24,`translate`),vl$4(),Rh$3(25,`input`,15),WE(),vl$4(),Bi$3(26,`mat-form-field`,13)(27,`mat-label`),lC(28),OC(29,`translate`),vl$4(),Rh$3(30,`input`,16),WE(),vl$4(),Bi$3(31,`mat-form-field`,13)(32,`mat-label`),lC(33),OC(34,`translate`),vl$4(),Rh$3(35,`input`,17),WE(),Bi$3(36,`span`,18),lC(37,`kg`),vl$4(),fw(38,ut,2,0,`mat-error`),vl$4(),Bi$3(39,`mat-form-field`,13)(40,`mat-label`),lC(41),OC(42,`translate`),vl$4(),Rh$3(43,`input`,19),WE(),Bi$3(44,`span`,18),lC(45,`cm`),vl$4(),fw(46,_t$1,2,0,`mat-error`),vl$4(),Bi$3(47,`mat-form-field`,13)(48,`mat-label`),lC(49),OC(50,`translate`),vl$4(),Rh$3(51,`input`,20),WE(),Bi$3(52,`span`,18),lC(53,`bpm`),vl$4(),fw(54,bt,2,0,`mat-error`),vl$4(),Bi$3(55,`div`,21)(56,`mat-icon`,22),lC(57,`email`),vl$4(),Bi$3(58,`div`,23)(59,`span`,24),lC(60),OC(61,`translate`),vl$4(),Bi$3(62,`span`,25),lC(63),vl$4()()(),Bi$3(64,`div`,21)(65,`mat-icon`,22),lC(66,`work`),vl$4(),Bi$3(67,`div`,23)(68,`span`,24),lC(69),OC(70,`translate`),vl$4(),Bi$3(71,`span`,25),lC(72),vl$4()()(),fw(73,vt,9,4,`div`,21),vl$4()}if(e&2){let o,s=i,m=xw();sE(2),pw((o=m.imageUrl())?2:3,o),sE(3),xh$2(`aria-label`,LC(7,21,`profile.image.upload`)),sE(3),Ah$2(`disabled`,m.uploading()),sE(3),Cl$4(` `,LC(12,23,m.imageUrl()?`profile.image.change`:`profile.image.upload`),` `),sE(2),pw(m.imageUrl()?13:-1),sE(),pw(m.uploading()?14:-1),sE(),Ah$2(`formGroup`,m.form),sE(3),ig(LC(19,25,`profile.firstName`)),sE(2),zE(),sE(3),ig(LC(24,27,`profile.lastName`)),sE(2),zE(),sE(3),ig(LC(29,29,`profile.nickname`)),sE(2),zE(),sE(3),ig(LC(34,31,`profile.weight`)),sE(2),zE(),sE(3),pw(m.form.get(`weight`)?.hasError(`min`)||m.form.get(`weight`)?.hasError(`max`)?38:-1),sE(3),ig(LC(42,33,`profile.height`)),sE(2),zE(),sE(3),pw(m.form.get(`height`)?.hasError(`min`)||m.form.get(`height`)?.hasError(`max`)?46:-1),sE(3),ig(LC(50,35,`profile.maxHeartRate`)),sE(2),zE(),sE(3),pw(m.form.get(`heartratemax`)?.hasError(`min`)||m.form.get(`heartratemax`)?.hasError(`max`)?54:-1),sE(6),ig(LC(61,37,`profile.email`)),sE(3),ig(s.email||`N/A`),sE(6),ig(LC(70,39,`profile.role`)),sE(3),ig(s.role||`N/A`),sE(),pw(s.connected_device?73:-1)}}function Ct(e,i){e&1&&(Bi$3(0,`div`,3)(1,`mat-icon`),lC(2,`warning`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()),e&2&&(sE(4),ig(LC(5,1,`settings.noProfileData`)))}var U=class e{profileService=E(ie$4);profileImageService=E(d);toast=E(ut$6);fb=E(Kn$4);imageUrl=this.profileImageService.imageUrl;uploading=ni$3(!1);initials=$C(()=>{let i=this.profileService.profile();return l(i?.nickname?.trim()||i?.firstname?.trim()||``)});form=this.fb.group({firstname:[``],lastname:[``],nickname:[``],weight:[null,[ye$4.min(30),ye$4.max(300)]],height:[null,[ye$4.min(100),ye$4.max(250)]],heartratemax:[null,[ye$4.min(100),ye$4.max(250)]]});constructor(){let i=this.profileService.profile();i&&this.patchForm(i),this.profileService.fetchProfile().then(()=>{let o=this.profileService.profile();o&&this.patchForm(o)}),this.profileImageService.getOwnImageUrl()}onFileSelected(i){return ps$4(this,null,function*(){let o=i.target,s=o.files?.[0];if(o.value=``,!s)return;let m=this.profileImageService.validateFile(s);if(m){this.toast.show(m,`error`);return}this.uploading.set(!0);try{yield this.profileImageService.uploadOwnImage(s)}catch(C){uu$2.error(`Profile image upload failed:`,C)}finally{this.uploading.set(!1)}})}onRemoveImage(){return ps$4(this,null,function*(){this.uploading.set(!0);try{yield this.profileImageService.deleteOwnImage()}catch(i){uu$2.error(`Profile image removal failed:`,i)}finally{this.uploading.set(!1)}})}patchForm(i){this.form.patchValue({firstname:i?.firstname??``,lastname:i?.lastname??``,nickname:i?.nickname??``,weight:i?.weight??null,height:i?.height??null,heartratemax:i?.heartratemax??null})}save(i){return ps$4(this,null,function*(){if(this.form.invalid)return;let o=this.form.value,s=this.form.controls,m=q$1({},i);if(s.firstname.dirty&&(m.first_name=o.firstname||null),s.lastname.dirty&&(m.last_name=o.lastname||null),s.nickname.dirty&&(m.nickname=o.nickname||null),s.weight.dirty&&(m.weight=o.weight??null),s.height.dirty&&(m.height=o.height??null),s.heartratemax.dirty&&(m.heart_rate_max=o.heartratemax??null),Object.keys(m).length!==0)try{yield this.profileService.updateOwnProfile(m),this.form.markAsPristine()}catch(C){uu$2.error(`Profile save failed:`,C)}})}static ɵfac=function(o){return new(o||e)};static ɵcmp=PD({type:e,selectors:[[`app-user-profile-info`]],decls:6,vars:4,consts:[[`fileInput`,``],[1,`user-profile-info`],[1,`text-lg`,`font-medium`,`mb-3`],[1,`no-profile`],[1,`profile-photo`],[`aria-hidden`,`true`,1,`profile-photo__avatar`],[`alt`,``,1,`profile-photo__img`,3,`src`],[1,`profile-photo__actions`],[`type`,`file`,`accept`,`image/jpeg,image/png,image/webp`,1,`profile-photo__file-input`,3,`change`],[`mat-stroked-button`,``,`type`,`button`,3,`click`,`disabled`],[`mat-stroked-button`,``,`type`,`button`,3,`disabled`],[1,`profile-photo__status`],[1,`profile-form`,3,`formGroup`],[`appearance`,`outline`,1,`w-full`],[`matInput`,``,`formControlName`,`firstname`],[`matInput`,``,`formControlName`,`lastname`],[`matInput`,``,`formControlName`,`nickname`],[`matInput`,``,`type`,`number`,`formControlName`,`weight`,`min`,`30`,`max`,`300`],[`matSuffix`,``],[`matInput`,``,`type`,`number`,`formControlName`,`height`,`min`,`100`,`max`,`250`],[`matInput`,``,`type`,`number`,`formControlName`,`heartratemax`,`min`,`100`,`max`,`250`],[1,`profile-item`],[1,`profile-icon`],[1,`profile-details`],[1,`profile-label`],[1,`profile-value`]],template:function(o,s){if(o&1&&(Bi$3(0,`div`,1)(1,`h3`,2),lC(2),OC(3,`translate`),vl$4(),fw(4,yt,74,41)(5,Ct,6,3,`div`,3),vl$4()),o&2){let m;sE(2),Cl$4(` `,LC(3,2,`settings.currentUser`),` `),sE(2),pw((m=s.profileService.profile())?4:5,m)}},dependencies:[Qn$4,Zn$4,Qe$2,pn$4,qn$5,$n$4,Zt$4,$t$4,bn$4,Vn$4,en$4,je$3,X$5,gt$7,xt$5,Be$2,Pe$4,yt$7,wt$5,Ap$1,wp$2,Xp$1],styles:[`.user-profile-info[_ngcontent-%COMP%]{margin-bottom:2rem}.user-profile-info[_ngcontent-%COMP%] .mat-mdc-form-field-icon-suffix{margin-right:8px}.user-profile-info[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{color:var(--%NS%mat-sys-on-surface);margin-bottom:1rem}.user-profile-info[_ngcontent-%COMP%] .profile-photo[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:1.25rem}.user-profile-info[_ngcontent-%COMP%] .profile-photo__avatar[_ng
7371content-%COMP%]{position:relative;flex-shrink:0;width:4rem;height:4rem;border-radius:50%;background:linear-gradient(135deg,#4f9fd4,#7b6fd6);display:flex;align-items:center;justify-content:center;font-weight:600;font-size:1.5rem;color:#fff;overflow:hidden}.user-profile-info[_ngcontent-%COMP%] .profile-photo__img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover}.user-profile-info[_ngcontent-%COMP%] .profile-photo__actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.user-profile-info[_ngcontent-%COMP%] .profile-photo__file-input[_ngcontent-%COMP%]{display:none}.user-profile-info[_ngcontent-%COMP%] .profile-photo__status[_ngcontent-%COMP%]{font-size:.8rem;color:var(--%NS%mat-sys-on-surface-variant)}.user-profile-info[_ngcontent-%COMP%] .profile-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}.user-profile-info[_ngcontent-%COMP%] .profile-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;padding:.5rem 0;border-bottom:1px solid var(--%NS%mat-sys-outline-variant)}.user-profile-info[_ngcontent-%COMP%] .profile-item[_ngcontent-%COMP%]:last-child{border-bottom:none}.user-profile-info[_ngcontent-%COMP%] .profile-item[_ngcontent-%COMP%] .profile-icon[_ngcontent-%COMP%]{color:var(--%NS%mat-sys-primary);font-size:1.25rem;width:1.25rem;height:1.25rem;flex-shrink:0}.user-profile-info[_ngcontent-%COMP%] .profile-item[_ngcontent-%COMP%] .profile-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-grow:1;gap:.125rem}.user-profile-info[_ngcontent-%COMP%] .profile-item[_ngcontent-%COMP%] .profile-details[_ngcontent-%COMP%] .profile-label[_ngcontent-%COMP%]{font-size:.75rem;color:var(--%NS%mat-sys-on-surface-variant);font-weight:500;text-transform:uppercase;letter-spacing:.5px}.user-profile-info[_ngcontent-%COMP%] .profile-item[_ngcontent-%COMP%] .profile-details[_ngcontent-%COMP%] .profile-value[_ngcontent-%COMP%]{font-size:.875rem;color:var(--%NS%mat-sys-on-surface);font-weight:400}.user-profile-info[_ngcontent-%COMP%] .no-profile[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:1rem;background:var(--%NS%mat-sys-error-container);color:var(--%NS%mat-sys-on-error-container);border-radius:8px;font-size:.875rem}.user-profile-info[_ngcontent-%COMP%] .no-profile[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.125rem;width:1.125rem;height:1.125rem}`]})};function ht$1(e,i){if(e&1&&(Bi$3(0,`mat-option`,4),lC(1),OC(2,`translate`),vl$4()),e&2){let o=i.$implicit;Ah$2(`value`,o),sE(),Cl$4(` `,LC(2,2,`settings.languages.`+o),` `)}}function xt(e,i){if(e&1){let o=Cw();Bi$3(0,`button`,8),jh$3(`pointerup`,function(){ld$2(o);return ud$1(xw().cancelSettings())}),lC(1),OC(2,`translate`),vl$4()}e&2&&(sE(),Cl$4(` `,LC(2,1,`button.cancel`),` `))}function St$1(e,i){if(e&1){let o=Cw();Bi$3(0,`button`,9),jh$3(`pointerup`,function(){ld$2(o);return ud$1(xw().saveSettings())}),lC(1),OC(2,`translate`),vl$4()}e&2&&(sE(),Cl$4(` `,LC(2,1,`button.save`),` `))}var se=class e{saveChanges=new Qe$1;cancelChanges=new Qe$1;buttons=[`save`,`cancel`];profileFormRef;settingsService=E(A$3);coachId=this.settingsService.getUserId();availableLanguages=[`en`,`fi`,`se`,`de`];settings=E(A$3);currentLanguage=this.settings.getCurrentLanguage();constructor(){xd$2(()=>{let i=this.settings.settings();this.currentLanguage=i.language})}changeLanguage(i){this.currentLanguage=i}saveSettings(){return ps$4(this,null,function*(){this.settings.setLanguage(this.currentLanguage),yield this.profileFormRef.save(),this.saveChanges.emit(),location.reload()})}cancelSettings(){this.currentLanguage=this.settings.settings().language,this.cancelChanges.emit()}static ɵfac=function(o){return new(o||e)};static ɵcmp=PD({type:e,selectors:[[`app-settings-form`]],viewQuery:function(o,s){if(o&1&&$h$2(U,5),o&2){let m;Pw(m=Lw())&&(s.profileFormRef=m.first)}},inputs:{buttons:`buttons`},outputs:{saveChanges:`saveChanges`,cancelChanges:`cancelChanges`},decls:13,vars:6,consts:[[1,`settings-content`],[1,`setting-group`,`mb-4`],[`appearance`,`outline`,1,`w-full`,`black-color-select`],[3,`valueChange`,`selectionChange`,`value`],[3,`value`],[1,`dialog-actions`,`flex`,`justify-end`,`gap-3`,`mt-4`],[`mat-stroked-button`,``],[`mat-flat-button`,``,`color`,`primary`],[`mat-stroked-button`,``,3,`pointerup`],[`mat-flat-button`,``,`color`,`primary`,3,`pointerup`]],template:function(o,s){o&1&&(Bi$3(0,`div`,0)(1,`div`,1)(2,`mat-label`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`mat-form-field`,2)(6,`mat-select`,3),dg(`valueChange`,function(C){return gC(s.currentLanguage,C)||
7371(s.currentLanguage=C),C}),jh$3(`selectionChange`,function(C){return s.changeLanguage(C.value)}),mw(7,ht$1,3,4,`mat-option`,4,gw),vl$4()()()(),Rh$3(9,`app-user-profile-info`),Bi$3(10,`div`,5),fw(11,xt,3,3,`button`,6),fw(12,St$1,3,3,`button`,7),vl$4()),o&2&&(sE(3),ig(LC(4,4,`settings.selectLanguage`)),sE(3),ug(`value`,s.currentLanguage),sE(),yw(s.availableLanguages),sE(4),pw(s.buttons.includes(`cancel`)?11:-1),sE(),pw(s.buttons.includes(`save`)?12:-1))},dependencies:[en$4,je$3,X$5,Jn$4,Gi$3,Hi$3,$$3,we$3,Ap$1,wp$2,yt$7,U,Xp$1],styles:[`.setting-group[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.08);padding-bottom:16px}.setting-group[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-weight:500;margin:0}`]})};var wt=()=>({restart:`1`});var Mt$1=(e,i)=>i.sectionId;var Pt$1=(e,i)=>i.questionKey;function It$1(e,i){e&1&&(Bi$3(0,`div`,2),Rh$3(1,`mat-progress-spinner`,3),Bi$3(2,`p`,4),lC(3),OC(4,`translate`),vl$4()()),e&2&&(sE(3),Cl$4(` `,LC(4,1,`settings.onboarding.loading`),` `))}function Ot$1(e,i){if(e&1){let o=Cw();Bi$3(0,`p`,5),lC(1),OC(2,`translate`),vl$4(),Bi$3(3,`p`,6),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`div`,7)(7,`button`,8),jh$3(`click`,function(){ld$2(o);return ud$1(xw().retryLoad())}),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`a`,9),lC(11),OC(12,`translate`),vl$4(),Bi$3(13,`a`,10),lC(14),OC(15,`translate`),vl$4()()}e&2&&(sE(),ig(LC(2,6,`settings.onboarding.loadError`)),sE(3),ig(LC(5,8,`settings.onboarding.loadErrorHint`)),sE(4),Cl$4(` `,LC(9,10,`settings.onboarding.retry`),` `),sE(3),Cl$4(` `,LC(12,12,`settings.onboarding.openSurvey`),` `),sE(2),Ah$2(`queryParams`,TC(16,wt)),sE(),Cl$4(` `,LC(15,14,`settings.onboarding.openSurveyRestart`),` `))}function Et$1(e,i){e&1&&(lC(0),OC(1,`translate`)),e&2&&Cl$4(` `,LC(1,1,i),` `)}function Tt(e,i){if(e&1&&lC(0),e&2){let o=xw().$implicit;Cl$4(` `,o.answerText,` `)}}function Ft(e,i){if(e&1&&(Bi$3(0,`article`,20)(1,`p`,21),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`p`,22),fw(5,Et$1,2,3)(6,Tt,1,1),vl$4()()),e&2){let o,s=i.$implicit;sE(2),ig(LC(3,2,s.questionLabelKey)),sE(3),pw((o=s.answerLabelKey)?5:6,o)}}function Bt(e,i){if(e&1&&(Bi$3(0,`mat-expansion-panel`)(1,`mat-expansion-panel-header`)(2,`mat-panel-title`),lC(3),OC(4,`translate`),vl$4()(),Bi$3(5,`div`,19),mw(6,Ft,7,4,`article`,20,Pt$1),vl$4()()),e&2){let o=i.$implicit;sE(3),ig(LC(4,1,o.sectionLabelKey)),sE(3),yw(o.items)}}function Nt(e,i){if(e&1&&(Bi$3(0,`mat-accordion`),mw(1,Bt,8,3,`mat-expansion-panel`,null,Mt$1),vl$4()),e&2){let o=xw(2);sE(),yw(o.groupedResponses())}}function Lt(e,i){e&1&&(Bi$3(0,`p`,6),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`settings.onboarding.noResponses`)))}function kt$1(e,i){e&1&&(Bi$3(0,`p`,17),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`settings.onboarding.analysisLoadFailed`)))}function Vt(e,i){if(e&1&&(Bi$3(0,`article`,18)(1,`h5`),lC(2),vl$4(),Bi$3(3,`p`,23),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`),lC(7),vl$4(),Bi$3(8,`p`,23),lC(9),OC(10,`translate`),vl$4(),Bi$3(11,`p`),lC(12),vl$4(),Bi$3(13,`p`,23),lC(14),OC(15,`translate`),vl$4(),Bi$3(16,`p`)(17,`strong`),lC(18),vl$4()(),Bi$3(19,`p`),lC(20),vl$4(),Bi$3(2
73711,`p`,23),lC(22),OC(23,`translate`),vl$4(),Bi$3(24,`p`),lC(25),vl$4()()),e&2){let o=i;sE(2),ig(o.title),sE(2),Cl$4(` `,LC(5,10,`coachOnboarding.analysis.personalizedOpening`),` `),sE(3),ig(o.personalizedOpening),sE(2),ig(LC(10,12,`coachOnboarding.analysis.currentSituation`)),sE(3),ig(o.currentSituation),sE(2),Cl$4(` `,LC(15,14,`coachOnboarding.analysis.primaryBottleneck`),` `),sE(4),ig(o.primaryBottleneck.title),sE(2),ig(o.primaryBottleneck.description),sE(2),ig(LC(23,16,`coachOnboarding.analysis.practicalMeaning`)),sE(3),ig(o.practicalMeaning)}}function Dt(e,i){e&1&&(Bi$3(0,`p`,6),lC(1),OC(2,`translate`),vl$4()),e&2&&(sE(),ig(LC(2,1,`settings.onboarding.noAnalysis`)))}function Rt(e,i){if(e&1){let o=Cw();Bi$3(0,`div`,11)(1,`button`,12),jh$3(`click`,function(){ld$2(o);return ud$1(xw().refreshAnalysis())}),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`button`,13),jh$3(`click`,function(){ld$2(o);return ud$1(xw().restartOnboarding())}),lC(5),OC(6,`translate`),vl$4()(),Bi$3(7,`div`,14)(8,`div`,15)(9,`h4`),lC(10),OC(11,`translate`),vl$4(),fw(12,Nt,3,0,`mat-accordion`)(13,Lt,3,3,`p`,6),vl$4(),Bi$3(14,`div`,16)(15,`h4`),lC(16),OC(17,`translate`),vl$4(),fw(18,kt$1,3,3,`p`,17),fw(19,Vt,26,18,`article`,18)(20,Dt,3,3,`p`,6),vl$4()()}if(e&2){let o,s=xw();sE(),Ah$2(`disabled`,s.analysisLoading()||s.restartLoading()),sE(),Cl$4(` `,LC(3,9,`settings.onboarding.refreshAnalysis`),` `),sE(2),Ah$2(`disabled`,s.analysisLoading()||s.restartLoading()),sE(),Cl$4(` `,LC(6,11,`settings.onboarding.restart`),` `),sE(5),ig(LC(11,13,`settings.onboarding.responsesTitle`)),sE(2),pw(s.hasResponses()?12:13),sE(4),ig(LC(17,15,`settings.onboarding.analysisTitle`)),sE(2),pw(s.analysisLoadFailed()?18:-1),sE(),pw((o=s.hasAnalysis()&&s.analysis())?19:20,o)}}var le$1=class e{onboardingService=E(p$2);toast=E(ut$6);router=E(G$4);translate=E(Gr$5);restartRequested=z1();loading=ni$3(!0);analysisLoading=ni$3(!1);restartLoading=ni$3(!1);loadingFailed=ni$3(!1);analysisLoadFailed=ni$3(!1);responses=ni$3([]);analysis=ni$3(null);groupedResponses=$C(()=>{let i$2=new Map(S().map(s=>[s.id,s])),o=new Map;for(let s of this.responses()){let m=o.get(s.section)??[];m.push(s),o.set(s.section,m)}return i.map(s=>{let m=o.get(s.id)??[],C=[];for(let pe of m){let ge=i$2.get(pe.questionKey);ge&&C.push({questionKey:pe.questionKey,questionLabelKey:ge.titleKey,answerLabelKey:null,answerText:pe.answer})}return{sectionId:s.id,sectionLabelKey:s.titleKey,items:C}}).filter(s=>s.items.length>0)});hasResponses=$C(()=>this.groupedResponses().length>0);hasAnalysis=$C(()=>this.analysis()!==null);constructor(){this.loadData()}refreshAnalysis(){return ps$4(this,null,function*(){if(!this.analysisLoading()){this.analysisLoading.set(!0);try{let i=yield this.onboardingService.generateAnalysis();this.analysis.set(i)}catch(i){uu$2.error(`Failed to refresh onboarding analysis in settings`,i),this.toast.show(this.translate.instant(`coachOnboarding.analysis.errorTitle`),`error`)}finally{this.analysisLoading.set(!1)}}})}restartOnboarding(){return ps$4(this,null,function*(){if(!this.restartLoading()){this.restartLoading.set(!0);try{(yield this.onboardingService.resetOnboarding()).completed||(this.responses.set([]),this.analysis.set(null)),this.restartRequested.emit(),yield this.router.navigateByUrl(`/onboarding`)}catch(i){uu$2.error(`Failed to restart onboarding from settings`,i),this.toast.show(this.translate.instant(`coachOnboarding.errors.save`),`error`)}finally{this.restartLoading.set(!1)}}})}retryLoad(){this.loadData()}loadData(){return ps$4(this,null,function*(){this.loading.set(!0),this.loadingFailed.set(!1),this.analysisLoadFailed.set(!1);try{let i=yield this.onboardingService.getResponses();this.responses.set(i.responses)}catch(i){uu$2.error(`Failed to load onboarding responses in settings`,i),this.loadingFailed.set(!0),this.responses.set([]),this.analysis.set(null),this.loading.set(!1);return}try{let i=yield this.onboardingService.generateAnalysis();this.analysis.set(i)}catch(i){uu$2.error(`Failed to generate onboarding analysis for settings`,i),this.analysis.set(null),this.analysisLoadFailed.set(!0)}finally{this.loading.set(!1)}})}static ɵfac=function(o){return new(o||e)};static ɵcmp=PD({type:e,selectors:[[`app-settings-onboarding`]],outputs:{restartRequested:`restartRequested`},decls:11,vars:7,consts:[[`data-testid`,`settings-onboarding-section`,1,`onboarding-settings-section`],[1,`section-header`],[`data-testid`,`settings-onboarding-loading`,`role`,`status`,`aria-live`,`polite`,`aria-busy`,`true`,1,`loading-panel`],[`mode`,`indeterminate`,`diameter`,`40`,`data-testid`,`settings-onboarding-loading-spinner`,1,`loading-spinner`],[1,`status-text`,`loading-status`],[1,`status-text`,`status-error`],[1,`status-text`],[1,`actions-row`,`error-actions`],[`type`,`button`,`mat-stroked-button`,``,3,`click`],[`mat-flat-button`,``,`color`,`primary`,`routerLink`,`/onboarding`],[`mat-button`,``,`routerLink`,`/onboarding`,3,`queryParams`],[1,`actions-row`],[`type`,`button`,`mat-stroked-button`,``,`data-testid`,`settings-onboarding-refresh-analysis`,3,`click`,`disabled`],[`type`,`button`,`mat-flat-button`,``,`color`,`primary`,`data-testid`,`settings-onboarding-restart`,3,`click`,`disabled`],[1,`content-grid`],[1,`responses-column`],[1,`analysis-column`],[1,`status-text`,`analysis-unavailable`],[`data-testid`,`settings-onboarding-analysis`,1,`analysis-card`],[1,`section-content`],[1,`qa-item`],[1,`question`],[1,`answer`],[1,`analysis-block-title`]],template:function(o,s){o&1&&(Bi$3(0,`section`,0)(1,`div`,1)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`p`),lC(6),OC(7,`translate`),vl$4()(),fw(8,It$1,5,3,`div`,2)(9,Ot$1,16,17)(10,Rt,21,17),vl$4()),o&2&&(sE(3),ig(LC(4,3,`settings.onboarding.title`)),sE(3),ig(LC(7,5,`settings.onboarding.description`)),sE(2),pw(s.loading()?8:s.loadingFailed()?9:10))},dependencies:[Ap$1,wp$2,fn$1,xn,Oe,Fe,un$1,J$1,Z$2,si$3,Xp$1],styles:[`.onboarding-settings-section[_ngcontent-%COMP%]{margin-top:1.25rem;border-top:1px solid rgba(0,0,0,.12);padding-top:1rem}.section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1.1rem;font-weight:600}.section-header[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:.35rem 0 0;color:var(--%NS%text-color-secondary)}.actions-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;margin-top:1rem}.content-grid[_ngcontent-%COMP%]{display:grid;gap:1rem;grid-template-columns:1fr;margin-top:1rem}.responses-column[_ngcontent-%COMP%], .analysis-column[_ngcontent-%COMP%]{background:var(--%NS%box-color);border-radius:.75rem;padding:1rem}
7371.responses-column[_ngcontent-%COMP%] h4[_ngcontent-%COMP%], .analysis-column[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem}.section-content[_ngcontent-%COMP%]{display:grid;gap:.85rem}.qa-item[_ngcontent-%COMP%] .question[_ngcontent-%COMP%]{margin:0;font-weight:600}.qa-item[_ngcontent-%COMP%] .answer[_ngcontent-%COMP%]{margin:.25rem 0 0}.analysis-card[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1.05rem}.analysis-block-title[_ngcontent-%COMP%]{margin:1rem 0 .25rem;font-weight:600}.status-text[_ngcontent-%COMP%]{margin:.5rem 0 0}.loading-status[_ngcontent-%COMP%]{margin:0}.loading-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:.75rem;margin-top:1rem;padding:1.5rem 1rem}.loading-spinner[_ngcontent-%COMP%]{--%NS%mdc-circular-progress-active-indicator-color: var(--%NS%primary)}.status-error[_ngcontent-%COMP%]{color:var(--%NS%error)}.analysis-unavailable[_ngcontent-%COMP%]{color:var(--%NS%text-color-secondary);font-size:.95rem}.error-actions[_ngcontent-%COMP%]{margin-top:.75rem}@media(min-width:1024px){.content-grid[_ngcontent-%COMP%]{grid-template-columns:1fr 1fr}}`]})};var qt=()=>[`save`];function At(e,i){e&1&&(Bi$3(0,`span`,4),OC(1,`translate`),Bi$3(2,`span`,5),lC(3,`tune`),vl$4(),Bi$3(4,`span`,6),lC(5),OC(6,`translate`),vl$4()()),e&2&&(Ah$2(`title`,LC(1,2,`settings.general`)),sE(5),ig(LC(6,4,`settings.general`)))}function Ut(e,i){e&1&&(Bi$3(0,`span`,4),OC(1,`translate`),Bi$3(2,`span`,5),lC(3,`lock`),vl$4(),Bi$3(4,`span`,6),lC(5),OC(6,`translate`),vl$4()()),e&2&&(Ah$2(`title`,LC(1,2,`settings.changePassword`)),sE(5),ig(LC(6,4,`settings.changePassword`)))}function Kt(e,i){e&1&&(Bi$3(0,`span`,4),OC(1,`translate`),Bi$3(2,`span`,5),lC(3,`quiz`),vl$4(),Bi$3(4,`span`,6),lC(5),OC(6,`translate`),vl$4()()),e&2&&(Ah$2(`title`,LC(1,2,`settings.onboarding.title`)),sE(5),ig(LC(6,4,`settings.onboarding.title`)))}function zt(e,i){if(e&1){let o=Cw();Bi$3(0,`mat-tab`),Th$2(1,Kt,7,6,`ng-template`,1),Bi$3(2,`div`,2)(3,`app-settings-onboarding`,7),jh$3(`restartRequested`,function(){ld$2(o);return ud$1(xw().restartRequested.emit())}),vl$4()()()}}var nt=class e{profileService=E(ie$4);restartRequested=z1();showOnboardingTab=$C(()=>{let i=this.profileService.profile()?.role;return i===`coach`||i===`manager`});static ɵfac=function(o){return new(o||e)};static ɵcmp=PD({type:e,selectors:[[`app-settings-tabs`]],outputs:{restartRequested:`restartRequested`},decls:10,vars:3,consts:[[`animationDuration`,`200ms`,1,`settings-tabs`],[`mat-tab-label`,``],[1,`tab-content`,`py-4`],[3,`buttons`],[1,`tab-label`,`flex`,`items-center`,`gap-2`,3,`title`],[1,`material-symbols-outlined`,`tab-icon`,`text-[18px]`,`leading-none`],[1,`tab-label-text`],[3,`restartRequested`]],template:function(o,s){o&1&&(Bi$3(0,`mat-tab-group`,0)(1,`mat-tab`),Th$2(2,At,7,6,`ng-template`,1),Bi$3(3,`div`,2),Rh$3(4,`app-settings-form`,3),vl$4()(),Bi$3(5,`mat-tab`),Th$2(6,Ut,7,6,`ng-template`,1),Bi$3(7,`div`,2),Rh$3(8,`app-change-password-form`),vl$4()(),fw(9,zt,4,0,`mat-tab`),vl$4()),o&2&&(sE(4),Ah$2(`buttons`,TC(2,qt)),sE(5),pw(s.showOnboardingTab()?9:-1))},dependencies:[se,ae,le$1,cn$1,ye,ke,dn$1,Xp$1],styles:[`[_nghost-%COMP%]{display:block}.settings-tabs[_ngcontent-%COMP%]{width:100%}@media(max-width:760px){ .settings-tabs .mdc-tab{min-width:0;padding:0 12px}.tab-label-text[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;white-space:nowrap;clip:rect(0,0,0,0);border:0}}`]})};var wo=gT((jn,Kn)=>{"use strict";(function(n,t){typeof jn==`object`&&typeof Kn<`u`?Kn.exports=t():typeof define==`function`&&define.amd?define(t):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_isBetween=t()})(jn,(function(){"use strict";return function(n,t,e){t.prototype.isBetween=function(i,s,u,v){var S=e(i),L=e(s),F=(v=v||`()`)[0]===`(`,ie=v[1]===`)`;return(F?this.isAfter(S,u):!this.isBefore(S,u))&&(ie?this.isBefore(L,u):!this.isAfter(L,u))||(F?this.isBefore(S,u):!this.isAfter(S,u))&&(ie?this.isAfter(L,u):!this.isBefore(L,u))}}}))});var So=gT((qn,Gn)=>{"use strict";(function(n,t){typeof qn==`object`&&typeof Gn<`u`?Gn.exports=t():typeof define==`function`&&define.amd?define(t):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_isSameOrAfter=t()})(qn,(function(){"use strict";return function(n,t){t.prototype.isSameOrAfter=function(e,i){return this.isSame(e,i)||this.isAfter(e,i)}}}))});var Po=gT((Yn,Zn)=>{"use strict";(function(n,t){typeof Yn==`object`&&typeof Zn<`u`?Zn.exports=t():typeof define==`function`&&define.amd?define(t):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_isSameOrBefore=t()})(Yn,(function(){"use strict";return function(n,t){t.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)}}}))});var Eo=gT((Jn,Qn)=>{"use strict";(function(n,t){typeof Jn==`object`&&typeof Qn<`u`?Qn.exports=t():typeof define==`function`&&define.amd?define(t):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_weekOfYear=t()})(Jn,(function(){"use strict";var n=`week`,t=`year`;return function(e,i,s){var u=i.prototype;u.week=function(v){if(v===void 0&&(v=null),v!==null)return this.add(7*(v-this.week()),`day`);var S=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var L=s(this).startOf(t).add(1,t).date(S),F=s(this).endOf(n);if(L.isBefore(F))return 1}var ie=s(this).startOf(t).date(S).startOf(n).subtract(1,`millisecond`),Ae=this.diff(ie,n,!0);return Ae<0?s(this).startOf(`week`).week():Math.ceil(Ae)},u.weeks=function(v){return v===void 0&&(v=null),this.week(v)}}}))});function sr(n){let e=Math.floor(Math.abs(n)),i=n.toString().replace(/^[^.]*\.?/,``).length;return e===1&&i===0?1:5}var Co=[`de`,[[`AM`,`PM`]],void 0,[[`S`,`M`,`D`,`M`,`D`,`F`,`S`],[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`],[`Sonntag`,`Montag`,`Dienstag`,`Mittw
7371och`,`Donnerstag`,`Freitag`,`Samstag`],[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`]],[[`S`,`M`,`D`,`M`,`D`,`F`,`S`],[`So`,`Mo`,`Di`,`Mi`,`Do`,`Fr`,`Sa`],[`Sonntag`,`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`],[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`]],[[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],[`Jan.`,`Feb.`,`März`,`Apr.`,`Mai`,`Juni`,`Juli`,`Aug.`,`Sept.`,`Okt.`,`Nov.`,`Dez.`],[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]],[[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],[`Jan`,`Feb`,`Mär`,`Apr`,`Mai`,`Jun`,`Jul`,`Aug`,`Sep`,`Okt`,`Nov`,`Dez`],[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]],[[`v. Chr.`,`n. Chr.`]],1,[6,0],[`dd.MM.yy`,`dd.MM.y`,`d. MMMM y`,`EEEE, d. MMMM y`],[`HH:mm`,`HH:mm:ss`,`HH:mm:ss z`,`HH:mm:ss zzzz`],[`{1}, {0}`,void 0,void 0,void 0],[`,`,`.`,`;`,`%`,`+`,`-`,`E`,`·`,`â°`,`â`,`NaN`,`:`],[`#,##0.###`,`#,##0\xA0%`,`#,##0.00\xA0¤`,`#E0`],`EUR`,`â¬`,`Euro`,{ATS:[`öS`],AUD:[`AU$`,`$`],BGM:[`BGK`],BGO:[`BGJ`],BYN:[void 0,`Ñ.`],CUC:[void 0,`Cub$`],DEM:[`DM`],FKP:[void 0,`Fl£`],GHS:[void 0,`âµ`],GNF:[void 0,`F.G.`],KMF:[void 0,`FC`],PHP:[void 0,`â±`],RON:[void 0,`L`],RUR:[void 0,`Ñ.`],RWF:[void 0,`F.Rw`],SYP:[void 0,`SYP`],THB:[`฿`],TWD:[`NT$`],XXX:[],ZMW:[void 0,`K`]},`ltr`,sr];function pr(n){let e=Math.floor(Math.abs(n)),i=n.toString().replace(/^[^.]*\.?/,``).length;return e===1&&i===0?1:5}var bo=[`fi`,[[`ap.`,`ip.`]],void 0,[[`S`,`M`,`T`,`K`,`T`,`P`,`L`],[`su`,`ma`,`ti`,`ke`,`to`,`pe`,`la`],[`sunnuntai`,`maanantaina`,`tiistaina`,`keskiviikkona`,`torstaina`,`perjantaina`,`lauantaina`],[`su`,`ma`,`ti`,`ke`,`to`,`pe`,`la`]],[[`S`,`M`,`T`,`K`,`T`,`P`,`L`],[`su`,`ma`,`ti`,`ke`,`to`,`pe`,`la`],[`sunnuntai`,`maanantai`,`tiistai`,`keskiviikko`,`torstai`,`perjantai`,`lauantai`],[`su`,`ma`,`ti`,`ke`,`to`,`pe`,`la`]],[[`T`,`H`,`M`,`H`,`T`,`K`,`H`,`E`,`S`,`L`,`M`,`J`],[`tammi`,`helmi`,`maalis`,`huhti`,`touko`,`kesä`,`heinä`,`elo`,`syys`,`loka`,`marras`,`joulu`],[`tammikuuta`,`helmikuuta`,`maaliskuuta`,`huhtikuuta`,`toukokuuta`,`kesäkuuta`,`heinäkuuta`,`elokuuta`,`syyskuuta`,`lokakuuta`,`marraskuuta`,`joulukuuta`]],[[`T`,`H`,`M`,`H`,`T`,`K`,`H`,`E`,`S`,`L`,`M`,`J`],[`tammi`,`helmi`,`maalis`,`huhti`,`touko`,`kesä`,`heinä`,`elo`,`syys`,`loka`,`marras`,`joulu`],[`tammikuu`,`helmikuu`,`maaliskuu`,`huhtikuu`,`toukokuu`,`kesäkuu`,`heinäkuu`,`elokuu`,`syyskuu`,`lokakuu`,`marraskuu`,`joulukuu`]],[[`eKr`,`jKr`],[`eKr.`,`jKr.`],[`ennen Kristuksen syntymää`,`jälkeen Kristuksen syntymän`]],1,[6,0],[`d.M.y`,void 0,`d. MMMM y`,`cccc d. MMMM y`],[`H.mm`,`H.mm.ss`,`H.mm.ss z`,`H.mm.ss zzzz`],[`{1} {0}`,void 0,void 0,void 0],[`,`,`\xA0`,`;`,`%`,`+`,`â`,`E`,`Ã`,`â°`,`â`,`epäluku`,`.`],[`#,##0.###`,`#,##0\xA0%`,`#,##0.00\xA0¤`,`#E0`],`EUR`,`â¬`,`euro`,{AOA:[void 0,`AOA`],ARS:[void 0,`ARS`],AUD:[],BAM:[void 0,`BAM`],BBD:[void 0,`BBD`],BDT:[void 0,`BDT`],BMD:[void 0,`BMD`],BND:[void 0,`BND`],BOB:[void 0,`BOB`],BRL:[],BSD:[void 0,`BSD`],BWP:[void 0,`BWP`],BZD:[void 0,`BZD`],CAD:[],CLP:[void 0,`CLP`],CNY:[],COP:[void 0,`COP`],CRC:[void 0,`CRC`],CUC:[void 0,`CUC`],CUP:[void 0,`CUP`],CZK:[void 0,`CZK`],DKK:[void 0,`DKK`],DOP:[void 0,`DOP`],EGP:[void 0,`EGP`],ESP:[void 0,`ESP`],FIM:[`mk`],FJD:[void 0,`FJD`],FKP:[void 0,`FKP`],GEL:[void 0,`GEL`],GIP:[void 0,`GIP`],GNF:[void 0,`GNF`],GTQ:[void 0,`GTQ`],GYD:[void 0,`GYD`],HKD:[],HNL:[void 0,`HNL`],HRK:[void 0,`HRK`],HUF:[void 0,`HUF`],IDR:[void 0,`IDR`],ILS:[],INR:[],ISK:[void 0,`ISK`],JMD:[void 0,`JMD`],KHR:[void 0,`KHR`],KMF:[void 0,`KMF`],KPW:[void 0,`KPW`],KRW:[],KYD:[void 0,`KYD`],KZT:[void 0,`KZT`],LAK:[void 0,`LAK`],LBP:[void 0,`LBP`],LKR:[void 0,`LKR`],LRD:[void 0,`LRD`],LTL:[void 0,`LTL`],LVL:[void 0,`LVL`],MGA:[void 0,`MGA`],MMK:[void 0,`MMK`],MNT:[void 0,`MNT`],MUR:[void 0,`MUR`],MXN:[],MYR:[void 0,`MYR`],NAD:[void 0,`NAD`],NGN:[void 0,`NGN`],NIO:[void 0,`NIO`],NOK:[void 0,`NOK`],NPR:[void 0,`NPR`],NZD:[],PHP:[],PKR:[void 0,`PKR`],PLN:[void 0,`PLN`],PYG:[void 0,`PYG`],RON:[void 0,`RON`],RWF:[void 0,`RWF`],SBD:[void 0,`SBD`],SEK:[void 0,`SEK`],SGD:[void 0,`SGD`],SHP:[void 0,`SHP`],SRD:[void 0,`SRD`],SSP:[void 0,`SSP`],STN:[void 0,`STD`],SYP:[void 0,`SYP`],THB:[void 0,`THB`],TOP:[void 0,`TOP`],TRY:[void 0,`TRY`],TTD:[void 0,`TTD`],TWD:[],UAH:[void 0,`UAH`],UYU:[void 0,`UYU`],VEF:[void 0,`VEF`],VND:[],XCD:[],XPF:[],XXX:[],ZAR:[void 0,`ZAR`],ZMW:[void 0,`ZMW`]},`ltr`,pr];function cr(n){let e=Math.floor(Math.abs(n)),i=n.toString().replace(/^[^.]*\.?/,``).length;return e===1&&i===0?1:5}var yo=[`sv`,[[`fm`,`em`]],[[`fm`,`em`],void 0,[`förmiddag`,`eftermiddag`]],[[`S`,`M`,`T`,`O`,`T`,`F`,`L`],[`sön`,`mÃ¥n`,`tis`,`ons`,`tors`,`fre`,`lör`],[`söndag`,`mÃ¥ndag`,`tisdag`,`onsdag`,`torsdag`,`fredag`,`lördag`],[`sö`,`mÃ¥`,`ti`,`on`,`to`,`fr`,`lö`]],void 0,[[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],[`jan.`,`feb.`,`mars`,`apr.`,`maj`,`juni`,`juli`,`aug.`,`sep.`,`okt.`,`nov.`,`dec.`],[`januari`,`februari`,`mars`,`april`,`maj`,`juni`,`juli`,`augusti`,`september`,`oktober`,`november`,`december`]],void 0,[[`f.Kr.`,`e.Kr.`],void 0,[`före Kristus`,`efter Kristus`]],1,[6,0],[`y-MM-dd`,`d MMM y`,`d MMMM y`,`EEEE d MMMM y`],[`HH:mm`,`HH:mm:ss`,`HH:mm:ss z`,`HH:mm:ss zzzz`],[`{1} {0}`,void 0,void 0,void 0],[`,`,`\xA0`,`;`,`%`,`+`,`â`,`Ã10^`,`Ã`,`â°`,`â`,`NaN`,`:`],[`#,##0.###`,`#,##0\xA0%`,`#,##0.00\xA0¤`,`#E0`],`SEK`,`kr`,`svensk krona`,{AUD:[void 0,`$`],BBD:[`Bds$`,`$`],BMD:[`BM$`,`$`],BRL:[`BR$`,`R$`],BSD:[`BS$`,`$`],BYN:[void 0,`Ñ.`],BZD:[`BZ$`,`$`],CNY:[void 0,`Â¥`],DKK:[`Dkr`,`kr`],DOP:[`RD$`,`$`],EEK:[`Ekr`],EGP:[`EG£`,`E£`],ESP:[void 0,`ESP`],GBP:[void 0,`£`],HKD:[void 0,`$`],IEP:[`IE£`],INR:[void 0,`â¹`],ISK:[`Ikr`,`kr`],JMD:[`JM$`,`$`],JPY:[void 0,`Â¥`],KRW:[void 0,`â©`],NOK:[`Nkr`,`kr`],NZD:[void 0,`$`],PHP:[void 0,`â±`],RON:[void 0,`L`],SEK:[`kr`],TWD:[void 0,`NT$`],USD:[`US$`,`$`],VND:[void 0,`â«`]},`ltr`,cr];var It=mT(ce$5());var Uo=mT(wo());var jo=mT(So());var Ko=mT(Po());var qo=mT(Eo());var on=mT(ce$5());function dr(n){let t=(0,on.default)(n),e=(0,on.default)().startOf(`day`),i=e.subtract(1,`day`),s=e.subtract(6,`day`);return t.isSame(e,`day`)?{key:`agent.date.today`,isTranslationKey:!0}
7371:t.isSame(i,`day`)?{key:`agent.date.yesterday`,isTranslationKey:!0}:t.isAfter(s)||t.isSame(s,`day`)?{key:`agent.date.${t.format(`dddd`).toLowerCase()}`,isTranslationKey:!0}:{key:t.format(`D.M.YYYY`),isTranslationKey:!1}}function mr(n){return(0,on.default)(n).format(`YYYY-MM-DD`)}function Mo(n){if(!n.length)return[];let t=new Map;for(let e of n){let i=mr(e.timestamp),s=t.get(i);if(s)s.messages.push(e);else{let u=dr(e.timestamp);t.set(i,{dateKey:i,dateLabel:u.key,messages:[e]})}}return Array.from(t.values()).sort((e,i)=>e.dateKey.localeCompare(i.dateKey))}var rn=class n{static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-thinking-pulse`]],decls:5,vars:0,consts:[[`aria-hidden`,`true`,1,`pulse-ring`],[1,`pulse-wave`],[1,`pulse-core`]],template:function(e,i){e&1&&(Il$4(0,`div`,0),kh$3(1,`div`,1)(2,`div`,1)(3,`div`,1)(4,`div`,2),El$4())},styles:[`.pulse-ring[_ngcontent-%COMP%]{position:relative;width:28px;height:28px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.pulse-core[_ngcontent-%COMP%]{width:10px;height:10px;border-radius:50%;background:var(--%NS%primarylime);animation:_ngcontent-%COMP%_corepulse 1.6s ease-in-out infinite}.pulse-wave[_ngcontent-%COMP%]{position:absolute;width:10px;height:10px;border-radius:50%;border:2px solid var(--%NS%primarylime);animation:_ngcontent-%COMP%_ripple 1.6s ease-out infinite}.pulse-wave[_ngcontent-%COMP%]:nth-child(2){animation-delay:.5s}.pulse-wave[_ngcontent-%COMP%]:nth-child(3){animation-delay:1s}@keyframes _ngcontent-%COMP%_corepulse{0%,to{transform:scale(.85);opacity:.7}50%{transform:scale(1.1);opacity:1}}@keyframes _ngcontent-%COMP%_ripple{0%{transform:scale(1);opacity:.8}to{transform:scale(3.2);opacity:0}
7371}@media(prefers-reduced-motion:reduce){.pulse-core[_ngcontent-%COMP%], .pulse-wave[_ngcontent-%COMP%]{animation:none}.pulse-core[_ngcontent-%COMP%]{opacity:1;transform:none}.pulse-wave[_ngcontent-%COMP%]{display:none}}`]})};var ln=class n{translateService=E(Gr$5);status=Q1(null);isWriting=Q1(!1);phaseText=$C(()=>{let t=this.status();if(t){let i=this.translateService.instant(t.translationKey);return i!==t.translationKey?i:t.message?t.message:t.phase}let e=this.isWriting()?`agent.status.writing`:`agent.status.processing`;return this.translateService.instant(e)});static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-chat-activity-indicator`]],inputs:{status:[1,`status`],isWriting:[1,`isWriting`]},decls:4,vars:2,consts:[[`role`,`status`,1,`chat-activity-indicator`],[`aria-live`,`polite`,1,`phase-text`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0),Rh$3(1,`app-thinking-pulse`),Bi$3(2,`span`,1),lC(3),vl$4()()),e&2&&(xh$2(`aria-label`,i.phaseText()),sE(3),ig(i.phaseText()))},dependencies:[rn],styles:[`.chat-activity-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;padding:8px 12px;background:var(--%NS%chat-agent-bubble);border-radius:12px 12px 12px 4px;width:fit-content;max-width:100%}.chat-activity-indicator[_ngcontent-%COMP%] .phase-text[_ngcontent-%COMP%]{font-size:12px;color:var(--%NS%chat-agent-text);opacity:.75;min-height:1.25rem}`]})};var ur=[{id:`group_attention_now`,labelKey:`agent.chip.group.attentionNow`},{id:`group_survey_missing`,labelKey:`agent.chip.group.surveyMissing`},{id:`group_adaptation_decisions`,labelKey:`agent.chip.group.adaptationDecisions`},{id:`group_workout_comments_flagged`,labelKey:`agent.chip.group.commentsFlagged`},{id:`group_training_last_week`,labelKey:`agent.chip.group.trainingLastWeek`}];var gr=[{id:`athlete_immediate_attention`,labelKey:`agent.chip.athlete.immediateAttention`},{id:`athlete_program_fit`,labelKey:`agent.chip.athlete.programFit`},{id:`athlete_week_so_far`,labelKey:`agent.chip.athlete.weekSoFar`},{id:`athlete_remaining_workouts`,labelKey:`agent.chip.athlete.remainingWorkouts`},{id:`athlete_adaptation_changes`,labelKey:`agent.chip.athlete.adaptationChanges`},{id:`athlete_workout_comments`,labelKey:`agent.chip.athlete.workoutComments`}];function ko(n){return n===`group`?ur:n===`athlete`?gr:[]}var _r=(n,t)=>t.id;function fr(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,4),jh$3(`click`,function(){let s=ld$2(e).$implicit;return ud$1(xw(2).select(s))}),lC(1),OC(2,`translate`),vl$4()}if(n&2){let e=t.$implicit;Ah$2(`disabled`,xw(2).disabled()),sE(),Cl$4(` `,LC(2,2,e.labelKey),` `)}}function hr(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,0),jh$3(`click`,function(){ld$2(e);return ud$1(xw().togglePresets())}),Bi$3(1,`mat-icon`),lC(2,`tips_and_updates`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`mat-icon`,1),lC(7,`expand_more`),vl$4()(),Bi$3(8,`div`,2),OC(9,`translate`),mw(10,fr,3,4,`button`,3,_r),vl$4()}if(n&2){let e=xw();sE(4),ig(LC(5,6,`agent.presets.label`)),sE(2),Yh$3(`open`,e.presetsOpen()),sE(2),Yh$3(`hidden`,!e.presetsOpen()),xh$2(`aria-label`,LC(9,8,`agent.chip.barLabel`)),sE(2),yw(e.chips())}}var sn=class n{scope=Q1(null);disabled=Q1(!1);chipSelected=z1();chips=$C(()=>ko(this.scope()?.type));presetsOpen=Q1(!0);presetsOpenChange=z1();togglePresets(){this.presetsOpenChange.emit(!this.presetsOpen())}select(t){this.disabled()||this.chipSelected.emit(t)}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-chat-chip-bar`]],inputs:{scope:[1,`scope`],disabled:[1,`disabled`],presetsOpen:[1,`presetsOpen`]},outputs:{chipSelected:`chipSelected`,presetsOpenChange:`presetsOpenChange`},decls:1,vars:1,consts:[[`type`,`button`,1,`chip-toggle`,3,`click`],[1,`chip-toggle-chevron`],[`role`,`group`,1,`chip-bar`],[`type`,`button`,`data-testid`,`chat-chip`,1,`chip`,3,`disabled`],[`type`,`button`,`data-testid`,`chat-chip`,1,`chip`,3,`click`,`disabled`]],template:function(e,i){e&1&&fw(0,hr,12,10),e&2&&pw(i.chips().length?0:-1)},dependencies:[yt$7,wt$5,Xp$1],styles:[`[_nghost-%COMP%]{display:block}.chip-toggle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;border:0;padding:0;background:transparent;color:color-mix(in srgb,var(--%NS%chat-agent-text) 70%,transparent);font-size:11px;text-transform:uppercase;letter-spacing:.04em;font-weight:600;cursor:pointer;margin-bottom:10px}.chip-toggle[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:16px;height:16px;font-size:16px;color:var(--%NS%primarylime)}.chip-toggle[_ngcontent-%COMP%]:hover{color:var(--%NS%chat-agent-text)}.chip-toggle-chevron[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%chat-agent-text) 50%,transparent);transition:transform .2s ease}.chip-toggle-chevron.open[_ngcontent-%COMP%]{transform:rotate(180deg)}
7371.chip-bar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px}.chip-bar.hidden[_ngcontent-%COMP%]{display:none}.chip[_ngcontent-%COMP%]{flex:0 1 auto;width:fit-content;max-width:100%;padding:6px 12px;font-size:12px;line-height:1.35;text-align:left;border-radius:999px;border:1px solid var(--%NS%chat-input-border);background:var(--%NS%chat-agent-bubble);color:var(--%NS%chat-agent-text);cursor:pointer;transition:background .15s ease,border-color .15s ease}.chip[_ngcontent-%COMP%]:hover:not(:disabled){border-color:color-mix(in srgb,var(--%NS%primarylime) 45%,var(--%NS%chat-input-border));background:color-mix(in srgb,var(--%NS%primarylime) 12%,var(--%NS%chat-agent-bubble))}.chip[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--%NS%primarylime);outline-offset:2px}.chip[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}`]})};var pn=class n{message=Q1.required();static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-chat-message`]],inputs:{message:[1,`message`]},decls:6,vars:9,consts:[[1,`message`],[1,`bubble`]],template:function(e,i){e&1&&(Il$4(0,`div`,0)(1,`div`,1),lC(2),El$4(),Il$4(3,`time`),lC(4),OC(5,`date`),El$4()()),e&2&&(Yh$3(`user`,i.message().role===`user`)(`assistant`,i.message().role===`assistant`),sE(2),ig(i.message().content),sE(2),ig(FC(5,6,i.message().timestamp,`HH:mm`)))},dependencies:[es$4],styles:[`.message[_ngcontent-%COMP%]{display:flex;flex-direction:column;max-width:80%;margin-bottom:8px;animation:_ngcontent-%COMP%_chat-message-fade .2s ease}.message.user[_ngcontent-%COMP%]{margin-left:auto;align-items:flex-end}.message.user[_ngcontent-%COMP%] .bubble[_ngcontent-%COMP%]{background:var(--%NS%chat-user-bubble);color:var(--%NS%chat-user-text);border-radius:12px 12px 4px}.message.assistant[_ngcontent-%COMP%]{margin-right:auto;align-items:flex-start}.message.assistant[_ngcontent-%COMP%] .bubble[_ngcontent-%COMP%]{background:var(--%NS%chat-agent-bubble);color:var(--%NS%chat-agent-text);border-radius:12px 12px 12px 4px;border:1px solid var(--%NS%chat-input-border)}.message[_ngcontent-%COMP%] .bubble[_ngcontent-%COMP%]{padding:10px 14px;word-wrap:break-word;white-space:pre-wrap}.message[_ngcontent-%COMP%] time[_ngcontent-%COMP%]{font-size:11px;opacity:.6;margin-top:4px}@keyframes _ngcontent-%COMP%_chat-message-fade{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.message[_ngcontent-%COMP%]{animation:none}}`]})};var xr=n=>({count:n});var Oo=(n,t)=>t.id;function vr(n,t){if(n&1&&lC(0),n&2)Cl$4(` `,xw().currentName(),` `)}function Cr(n,t){n&1&&(lC(0),OC(1,`translate`)),n&2&&Cl$4(` `,LC(1,1,`agent.scope.generalChat`),` `)}function br(n,t){if(n&1&&(Bi$3(0,`span`,4),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw();sE(),Cl$4(` · `,LC(2,1,e.isGroup()?`agent.scope.groupKind`:`agent.scope.athleteKind`),` `)}}function yr(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,12),jh$3(`click`,function(){ld$2(e);return ud$1(xw(2).selectFreeChat())}),Bi$3(1,`span`,13)(2,`mat-icon`),lC(3,`chat`),vl$4()(),Bi$3(4,`span`,14),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`mat-icon`,15),lC(8,`check`),vl$4()(),Rh$3(9,`div`,16)}if(n&2){let e=xw(2);sE(5),ig(LC(6,3,`agent.scope.generalChat`)),sE(2),Yh$3(`active`,e.isChecked(`free`))}}function wr(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,12),jh$3(`click`,function(){let s=ld$2(e).$implicit;return ud$1(xw(3).selectGroup(s.id))}),Bi$3(1,`span`,19)(2,`mat-icon`),lC(3,`groups`),vl$4()(),Bi$3(4,`span`,20),lC(5),vl$4(),Bi$3(6,`span`,21),lC(7),OC(8,`translate`),vl$4(),Bi$3(9,`mat-icon`,15),lC(10,`check`),vl$4()()}if(n&2){let e=t.$implicit,i=xw(3);sE(5),ig(e.name),sE(2),ig(FC(8,4,`agent.scope.memberCount`,bC(7,xr,e.memberCount))),sE(2),Yh$3(`active`,i.isChecked(`group`,e.id))}}function Sr(n,t){if(n&1&&(Bi$3(0,`div`,17),lC(1),OC(2,`translate`),vl$4(),mw(3,wr,11,9,`button`,18,Oo)),n&2){let e=xw(2);sE(),ig(LC(2,1,`agent.scope.groups`)),sE(2),yw(e.filteredGroups())}}function Pr(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,12),jh$3(`click`,function(){let s=ld$2(e).$implicit;return ud$1(xw(3).selectAthlete(s.id))}),Bi$3(1,`span`,22),lC(2),vl$4(),Bi$3(3,`span`,14),lC(4),vl$4(),Bi$3(5,`mat-icon`,15),lC(6,`check`),vl$4()()}if(n&2){let e=t.$implicit,i=xw(3);sE(2),ig(i.avatarInitial(e.name)),sE(2),ig(e.name),sE(),Yh$3(`active`,i.isChecked(`athlete`,e.id))}}function Er(n,t){if(n&1&&(Bi$3(0,`div`,17),lC(1),OC(2,`translate`),vl$4(),mw(3,Pr,7,4,`button`,18,Oo)),n&2){let e=xw(2);
7371sE(),ig(LC(2,1,`agent.scope.clients`)),sE(2),yw(e.filteredAthletes())}}function Mr(n,t){n&1&&(Bi$3(0,`div`,11),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`agent.scope.noResults`)))}function kr(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,6)(1,`div`,7)(2,`div`,8)(3,`mat-icon`),lC(4,`search`),vl$4(),Bi$3(5,`input`,9),OC(6,`translate`),jh$3(`input`,function(s){ld$2(e);return ud$1(xw().onSearchInput(s))}),vl$4()()(),Bi$3(7,`div`,10),fw(8,yr,10,5),fw(9,Sr,5,3),fw(10,Er,5,3),fw(11,Mr,3,3,`div`,11),vl$4()()}if(n&2){let e=xw();sE(5),Ah$2(`value`,e.search())(`placeholder`,LC(6,6,`agent.scope.searchPlaceholder`)),sE(3),pw(e.showGeneral()?8:-1),sE(),pw(e.filteredGroups().length?9:-1),sE(),pw(e.filteredAthletes().length?10:-1),sE(),pw(e.noResults()?11:-1)}}var cn=class n{clientData=E(E$2);selected=Q1(null);selectionChange=z1();dropdownOpen=ni$3(!1);search=ni$3(``);dataRequested=!1;groupsRaw=$C(()=>this.clientData.trainingGroups().filter(t=>!t.default_group).sort((t,e)=>t.name.localeCompare(e.name)));groups=$C(()=>this.groupsRaw().map(t=>({id:t.id,name:t.name,memberCount:t.users.length})));athletes=$C(()=>[...this.clientData.clientsData().values()].filter(t=>t.role!==`coach`&&t.role!==`manager`&&t.role!==`admin`).map(t=>({id:t.id,name:t.clientName?.trim()||t.email||`#${t.id}`})).sort((t,e)=>t.name.localeCompare(e.name)));currentValue=$C(()=>{let t=this.selected();return t?`${t.type===`group`?`g`:`a`}:${t.id}`:``});currentTarget=$C(()=>{let t=this.selected();return t?(t.type===`group`?this.groups():this.athletes()).find(i=>i.id===t.id)??{id:t.id,name:t.name}:null});currentName=$C(()=>this.currentTarget()?.name??``);isGroup=$C(()=>this.selected()?.type===`group`);isAthlete=$C(()=>this.selected()?.type===`athlete`);hasTarget=$C(()=>!!this.selected());filteredGroups=$C(()=>this.groups().filter(t=>this.matches(t.name,this.search())));filteredAthletes=$C(()=>this.athletes().filter(t=>this.matches(t.name,this.search())));showGeneral=$C(()=>{let t=[`general chat`,`yleinen keskustelu`,`allgemeiner chat`,`allman chatt`],e=this.search().trim().toLowerCase();return e?t.some(i=>i.includes(e)):!0});noResults=$C(()=>!this.filteredGroups().length&&!this.filteredAthletes().length&&!this.showGeneral());constructor(){this.ensureData()}onDocumentPointerDown(t){!this.dropdownOpen()||t.target?.closest(`.scope-selector`)||this.dropdownOpen.set(!1)}ensureData(){if(this.dataRequested)return;this.dataRequested=!0;let t=this.clientData.trainingGroups().length===0,e=this.clientData.clientsData().size===0;e&&(this.clientData.fetchLicences(),this.clientData.fetchUngroupedClients()),(t||e)&&this.clientData.fetchTrainingGroupData()}toggleDropdown(t){t.stopPropagation(),this.dropdownOpen.update(e=>!e),this.search.set(``)}onSearchInput(t){this.search.set(t.target.value)}selectFreeChat(){this.dropdownOpen.set(!1),this.search.set(``),this.selectionChange.emit(null)}selectGroup(t){let e=this.groups().find(i=>i.id===t);this.dropdownOpen.set(!1),this.search.set(``),this.selectionChange.emit({type:`group`,id:t,name:e?.name??``})}selectAthlete(t){let e=this.athletes().find(i=>i.id===t);this.dropdownOpen.set(!1),this.search.set(``),this.selectionChange.emit({type:`athlete`,id:t,name:e?.name??``})}isChecked(t,e){let i=this.selected();return t===`free`?!i:i?i.type===t&&i.id===e:!1}avatarInitial(t){return t.trim().charAt(0).toUpperCase()||`?`}matches(t,e){let i=e.trim().toLowerCase();return!i||t.toLowerCase().includes(i)}onSelectionChange(t){if(!t){this.selectionChange.emit(null);return}let[e,i]=t.split(`:`),s=Number(i);e===`g`?this.selectGroup(s):this.selectAthlete(s)}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-chat-scope-selector`]],hostBindings:function(e,i){e&1&&jh$3(`pointerdown`,function(u){return i.onDocumentPointerDown(u)},aI)},inputs:{selected:[1,`selected`]},outputs:{selectionChange:`selectionChange`},decls:12,vars:4,consts:[[1,`scope-selector`],[`type`,`button`,`data-testid`,`chat-scope-select`,1,`scope-trigger`,3,`pointerdown`],[1,`scope-icon`],[1,`scope-name`],[1,`scope-kind`],[1,`scope-chevron`],[1,`scope-
7371dropdown`],[1,`scope-search-wrap`],[1,`scope-search`],[`type`,`text`,3,`input`,`value`,`placeholder`],[1,`scope-list`],[1,`scope-empty`],[`type`,`button`,1,`scope-option`,3,`click`],[1,`scope-avatar`,`scope-avatar-muted`],[1,`scope-option-name`],[1,`scope-check`],[1,`scope-divider`],[1,`scope-label`],[`type`,`button`,1,`scope-option`],[1,`scope-avatar`],[1,`scope-option-name`,`scope-truncate`],[1,`scope-option-meta`],[1,`scope-avatar`,`scope-avatar-initial`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0)(1,`button`,1),jh$3(`pointerdown`,function(u){return i.toggleDropdown(u)}),Bi$3(2,`span`,2)(3,`mat-icon`),lC(4),vl$4()(),Bi$3(5,`span`,3),fw(6,vr,1,1)(7,Cr,2,3),vl$4(),fw(8,br,3,3,`span`,4),Bi$3(9,`mat-icon`,5),lC(10,`expand_more`),vl$4()(),fw(11,kr,12,8,`div`,6),vl$4()),e&2&&(sE(4),ig(i.isGroup()?`groups`:i.isAthlete()?`person`:`chat`),sE(2),pw(i.hasTarget()?6:7),sE(2),pw(i.hasTarget()?8:-1),sE(3),pw(i.dropdownOpen()?11:-1))},dependencies:[Jn$4,yt$7,wt$5,Xp$1],styles:[`[_nghost-%COMP%]{display:block}.scope-selector[_ngcontent-%COMP%]{position:relative;max-width:min(420px,58vw)}.scope-trigger[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:7px;max-width:100%;border:1px solid var(--%NS%chat-input-border);background:color-mix(in srgb,var(--%NS%chat-agent-bubble) 65%,transparent);border-radius:10px;padding:6px 10px 6px 8px;color:var(--%NS%chat-agent-text);cursor:pointer}.scope-icon[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;color:var(--%NS%primarylime)}.scope-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:15px;height:15px;font-size:15px}.scope-name[_ngcontent-%COMP%]{font-size:13px;font-weight:600;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.scope-kind[_ngcontent-%COMP%]{font-size:12px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 52%,transparent)}.scope-chevron[_ngcontent-%COMP%]{width:15px;height:15px;font-size:15px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 45%,transparent)}.scope-dropdown[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 6px);right:0;width:300px;max-width:min(300px,82vw);border:1px solid var(--%NS%chat-input-border);border-radius:12px;overflow:hidden;background:var(--%NS%chat-panel-header-bg);box-shadow:0 14px 34px #00000073;z-index:30}.scope-search-wrap[_ngcontent-%COMP%]{padding:8px;border-bottom:1px solid color-mix(in srgb,var(--%NS%chat-agent-text) 8%,transparent)}.scope-search[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;background:var(--%NS%chat-panel-bg);border:1px solid var(--%NS%chat-input-border);border-radius:8px;padding:6px 8px}.scope-search[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:14px;height:14px;font-size:14px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 48%,transparent)}.scope-search[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%;border:0;outline:0;background:transparent;color:var(--%NS%chat-agent-text);font-size:13px}.scope-list[_ngcontent-%COMP%]{max-height:320px;overflow-y:auto;padding:6px}.scope-label[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%chat-agent-text) 44%,transparent);font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:8px 10px 4px}.scope-option[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:8px;border:0;border-radius:8px;padding:8px 10px;background:transparent;color:inherit;text-align:left;cursor:pointer}.scope-option[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--%NS%chat-agent-text) 8%,transparent)}.scope-avatar[_ngcontent-%COMP%]{width:22px;height:22px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--%NS%chat-agent-text) 12%,var(--%NS%chat-agent-bubble));color:var(--%NS%primarylime);flex-shrink:0}.scope-avatar[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:14px;height:14px;font-size:14px}.scope-avatar-muted[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%chat-agent-text) 62%,transparent)}.scope-avatar-initial[_ngcontent-%COMP%]{font-size:11px;font-weight:700}
7371.scope-option-name[_ngcontent-%COMP%]{flex:1;font-size:13px}.scope-truncate[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scope-option-meta[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%chat-agent-text) 50%,transparent);font-size:11px}.scope-check[_ngcontent-%COMP%]{width:15px;height:15px;font-size:15px;color:transparent;flex-shrink:0}.scope-check.active[_ngcontent-%COMP%]{color:var(--%NS%primarylime)}.scope-divider[_ngcontent-%COMP%]{height:1px;background:color-mix(in srgb,var(--%NS%chat-agent-text) 10%,transparent);margin:4px 8px}.scope-empty[_ngcontent-%COMP%]{text-align:center;font-size:13px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 52%,transparent);padding:16px 10px}@media(max-width:760px){.scope-selector[_ngcontent-%COMP%]{max-width:100%}.scope-trigger[_ngcontent-%COMP%]{width:100%}.scope-name[_ngcontent-%COMP%]{max-width:none}.scope-dropdown[_ngcontent-%COMP%]{width:100%;left:0;right:auto;max-width:none}}`]})};var Or=[`messagesContainer`];var Ir=(n,t)=>t.dateKey;var Tr=(n,t)=>t.id;function Nr(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,26),OC(1,`translate`),jh$3(`click`,function(){ld$2(e);return ud$1(xw().clearChat())}),Bi$3(2,`mat-icon`),lC(3,`delete`),vl$4()()}n&2&&xh$2(`aria-label`,LC(1,1,`agent.clearHistory`))}function Rr(n,t){n&1&&(Bi$3(0,`div`,22)(1,`mat-icon`),lC(2,`description`),vl$4(),Bi$3(3,`span`,27),lC(4),vl$4(),Bi$3(5,`span`,28),lC(6,`Ask any questions about this report`),vl$4()()),n&2&&(sE(4),ig(t.title||`Report context loaded`))}function Dr(n,t){n&1&&(Bi$3(0,`div`,24)(1,`div`,29)(2,`mat-icon`),lC(3,`smart_toy`),vl$4()(),Bi$3(4,`p`,30),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`p`,31),lC(8),OC(9,`translate`),vl$4()()),n&2&&(sE(5),ig(LC(6,2,`agent.emptyState`)),sE(3),ig(LC(9,4,`agent.emptyStateHint`)))}function Ar(n,t){if(n&1&&(lC(0),OC(1,`translate`)),n&2){let e=xw().$implicit;Cl$4(` `,LC(1,1,e.dateLabel),` `)}}function Br(n,t){if(n&1&&lC(0),n&2){let e=xw().$implicit;Cl$4(` `,e.dateLabel,` `)}}function Fr(n,t){if(n&1&&Rh$3(0,`app-chat-message`,33),n&2){let e=t.$implicit;Ah$2(`message`,e)}}function Lr(n,t){if(n&1&&(Bi$3(0,`div`,32),fw(1,Ar,2,3)(2,Br,1,1),vl$4(),mw(3,Fr,1,1,`app-chat-message`,33,Tr)),n&2){let e=t.$implicit,i=xw();sE(),pw(i.isTranslationKey(e.dateLabel)?1:2),sE(2),yw(e.messages)}}function Vr(n,t){if(n&1&&(Bi$3(0,`div`,34)(1,`div`,36),lC(2),vl$4(),Rh$3(3,`app-chat-activity-indicator`,37),vl$4()),n&2){let e=xw(2);sE(2),ig(e.streamingContent()),sE(),Ah$2(`status`,e.streamingStatus())(`isWriting`,!e.streamingStatus())}}function Wr(n,t){if(n&1&&Rh$3(0,`app-chat-activity-indicator`,35),n&2)Ah$2(`status`,xw(2).streamingStatus())}function Hr(n,t){if(n&1&&fw(0,Vr,4,3,`div`,34)(1,Wr,1,1,`app-chat-activity-indicator`,35),n&2)pw(xw().streamingContent()?0:1)}function $r(n,t){n&1&&Rh$3(0,`app-ai-quota-exhausted-panel`)}function zr(n,t){if(n&1){let e=Cw();Bi$3(0,`app-chat-chip-bar`,41),jh$3(`presetsOpenChange`,function(s){ld$2(e);return ud$1(xw(2).onPresetsOpenChange(s))})(`chipSelected`,function(s){ld$2(e);return ud$1(xw(2).onChipSelected(s))}),vl$4()}if(n&2){let e=xw(2);Ah$2(`scope`,e.scope())(`disabled`,e.isLoading())(`presetsOpen`,e.presetsOpen())}}function Ur(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,39)(1,`input`,42),OC(2,`translate`),dg(`ngModelChange`,function(s){ld$2(e);let u=xw(2);return gC(u.inputText,s)||(u.inputText=s),ud$1(s)}),jh$3(`keydown.enter`,function(){ld$2(e);return ud$1(xw(2).send())}),vl$4(),WE(),Bi$3(3,`button`,43),OC(4,`translate`),jh$3(`click`,function(){ld$2(e);return ud$1(xw(2).send())}),Bi$3(5,`mat-icon`),lC(6,`send`),vl$4()()()}if(n&2){let e=xw(2);sE(),ug(`ngModel`,e.inputText),Ah$2(`placeholder`,LC(2,5,`agent.placeholder`))(`disabled`,e.isLoading()),zE(),sE(2),Ah$2(`disabled`,e.isLoading()||!e.inputText().trim()),xh$2(`aria-label`,LC(4,7,`agent.send`))}}function jr(n,t){n&1&&(Bi$3(0,`div`,40)(1,`mat-icon`,44),lC(2,`lock`),vl$4(),Bi$3(3,`span`,45),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`button`,46),OC(7,`translate`),Bi$3(8,`mat-icon`),lC(9,`send`),vl$4()()()),n&2&&(sE(4),ig(LC(5,2,`agent.freeChatMaintenance`)),sE(2),xh$2(`aria-label`,LC(7,4,`agent.send`)))}function Kr(n,t){if(n&1&&(Bi$3(0,`footer`,25),fw(1,zr,1,3,`app-chat-chip-bar`,38),fw(2,Ur,7,9,`div`,39)(3,jr,10,6,`div`,40),vl$4()),n&2){let e=xw();sE(),pw(e.scope()?1:-1),sE(),pw(e.freeTextChatEnabled?2:3)}}var dn=class n{chatService=E(lt$4);chatStateService=E(Ln$5);translate=E(Gr$5);aiQuota=E(f$2);MIN_PANEL_WIDTH=320;MIN_PANEL_HEIGHT=200;panelLeft=ni$3(0);panelTop=ni$3(0);panelWidth=ni$3(0);panelHeight=ni$3(0);get isMobile(){return window.innerWidth<=760}constructor(){let t=Math.min(Math.max(window.innerWidth*.45,576),720),e=Math.min(window.innerHeight-120,600),i=this.chatStateService.panelSize(),s=this.chatStateService.panelPosition(),u=i?.width??t,v=i?.height??e;this.panelWidth.set(u),this.panelHeight.set(v),this.panelLeft.set(s?.left??window.innerWidth-u-20),this.panelTop.set(s?.top??window.innerHeight-v-20),xd$2(()=>{let S=this.streamingContent(),L=this.isLoading(),F=this.streamingStatus();(S||L||F)&&this.scrollToBottom()})}startDrag(t){if(this.isMobile)return;let e=t.target;if(e.closest(`button`)||e.closest(`.scope-selector`))return;t.preventDefault();let i=t.clientX,s=t.clientY,u=this.panelLeft(),v=this.panelTop(),S=F=>{this.panelLeft.set(Math.max(0,Math.min(u+F.clientX-i,window.innerWidth-this.panelWidth()))),this.panelTop.set(Math.max(0,Math.min(v+F.clientY-s,window.innerHeight-this.panelHeight())))},L=()=>{document.removeEventListener(`pointermove`,S),document.removeEventListener(`pointerup`,L),this.chatStateService.setPanelPosition(this.panelLeft(),this.panelTop())};document.addEventListener(`pointermove`,S),document.addEventListener(`pointerup`,L)}startResize(t,e){if(this.isMobile)return;t.preventDefault(),t.stopPropagation();let i=t.clientX,s=t.clientY,u=this.panelLeft(),v=this.panelTop(),S=this.panelWidth(),L=this.panelHeight(),F=Ae=>{let xt=Ae.clientX-i,Tt=Ae.clientY-s;if(e.e&&this.panelWidth.set(Math.max(this.MIN_PANEL_WIDTH,S+xt)),e.w){let Be=Math.max(this.MIN_PANEL_WIDTH,S-xt);this.panelLeft.set(u+S-Be),this.panelWidth.set(Be)}if(e.s&&this.panelHeight.set(Math.max(this.MIN_PANEL_HEIGHT,L+Tt)),e.n){let Be=Math.max(this.MIN_PANEL_HEIGHT,L-Tt);this.panelTop.set(v+L-Be),this.panelHeight.set(Be)}},ie=()=>{document.removeEventListener(`pointermove`,F),document.removeEventListener(`pointerup`,ie),this.chatStateService.setPanelPosition(this.panelLeft(),this.panelTop()),this.chatStateService.setPanelSize(this.panelWidth(),this.panelHeight())};document.addEventListener(`pointermove`,F),document.addEventListener(`pointerup`,ie)}messagesContainer;closed=z1();freeTextChatEnabled=!1;inputText=ni$3(``);presetsOpen=ni$3(!0);messages=$C(()=>this.chatService.messages());messageGroups=$C(()=>
7371Mo(this.messages()));isLoading=$C(()=>this.chatService.isLoading());streamingContent=$C(()=>this.chatService.streamingContent());streamingStatus=$C(()=>this.chatService.streamingStatus());aiQuotaExhausted=$C(()=>this.aiQuota.exhausted());context=$C(()=>this.chatStateService.context());scope=$C(()=>this.chatStateService.scope());isTranslationKey(t){return t.startsWith(`agent.date.`)}close(){this.closed.emit()}clearChat(){this.chatService.clearHistory()}send(){return ps$4(this,null,function*(){if(!this.freeTextChatEnabled||this.aiQuotaExhausted())return;let t=this.inputText().trim();if(!t||this.isLoading())return;this.inputText.set(``),this.scrollToBottom();let e=this.context(),i=t;e&&(i=`${e.systemPrompt} 7372 7373${e.content} 7374 7375Coach question: ${t}`,this.chatStateService.clearContext()),yield this.chatService.sendMessage(i),this.scrollToBottom()})}onScopeChange(t){this.chatStateService.setScope(t)}onPresetsOpenChange(t){this.presetsOpen.set(t)}onChipSelected(t){return ps$4(this,null,function*(){let e=this.scope();if(!e||this.isLoading())return;let i=this.translate.instant(t.labelKey),s=this.translate.instant(`agent.chip.error`);this.scrollToBottom(),yield this.chatService.sendChip(t.id,e,i,s),this.scrollToBottom()})}scrollToBottom(){setTimeout(()=>{if(this.messagesContainer){let t=this.messagesContainer.nativeElement;t.scrollTop=t.scrollHeight}},50)}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-ai-chat-panel`]],viewQuery:function(e,i){if(e&1&&$h$2(Or,5),e&2){let s;Pw(s=Lw())&&(i.messagesContainer=s.first)}},hostVars:8,hostBindings:function(e,i){e&2&&Zh$2(`left`,i.isMobile?null:i.panelLeft(),`px`)(`top`,i.isMobile?null:i.panelTop(),`px`)(`width`,i.isMobile?null:i.panelWidth(),`px`)(`height`,i.isMobile?null:i.panelHeight(),`px`)},outputs:{closed:`closed`},decls:39,vars:15,consts:[[`messagesContainer`,``],[`data-testid`,`old-ai-chat-panel`,1,`chat-panel`],[1,`resize-handle`,`resize-handle--n`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--e`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--s`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--w`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--ne`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--se`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--sw`,3,`pointerdown`],[1,`resize-handle`,`resize-handle--nw`,3,`pointerdown`],[1,`chat-header`,3,`pointerdown`],[1,`header-title`],[1,`header-logo`],[1,`header-text`],[1,`flex`,`items-center`,`gap-1.5`],[1,`title`],[`size`,`sm`],[1,`subtitle`],[3,`selectionChange`,`selected`],[1,`header-actions`],[`mat-icon-button`,``,1,`clear-btn`],[`mat-icon-button`,``,1,`close-btn`,3,`click`],[1,`context-banner`],[`role`,`log`,`aria-live`,`polite`,1,`chat-messages`],[1,`empty-state`],[1,`chat-input`],[`mat-icon-button`,``,1,`clear-btn`,3,`click`],[1,`context-title`],[1,`context-hint`],[1,`empty-icon`],[1,`empty-title`],[1,`empty-hint`],[1,`date-separator`],[3,`message`],[1,`message`,`assistant`,`streaming`],[3,`status`],[1,`bubble`],[3,`status`,`isWriting`],[3,`scope`,`disabled`,`presetsOpen`],[1,`chat-input-row`],[`role`,`status`,`aria-live`,`polite`,1,`chat-input-row`,`chat-input-row--locked`],[3,`presetsOpenChange`,`chipSelected`,`scope`,`disabled`,`presetsOpen`],[`type`,`text`,3,`ngModelChange`,`keydown.enter`,`ngModel`,`placeholder`,`disabled`],[`mat-icon-button`,``,1,`send-btn`,3,`click`,`disabled`],[`aria-hidden`,`true`,1,`lock-icon`],[1,`locked-message`],[`mat-icon-button`,``,`disabled`,``,1,`send-btn`]],template:function(e,i){if(e&1&&(Bi$3(0,`div`,1)(1,`div`,2),jh$3(`pointerdown`,function(u){return i.startResize(u,{n:!0})}),vl$4(),Bi$3(2,`div`,3),jh$3(`pointerdown`,function(u){return i.startResize(u,{e:!0})}),vl$4(),Bi$3(3,`div`,4),jh$3(`pointerdown`,function(u){return i.startResize(u,{s:!0})}),vl$4(),Bi$3(4,`div`,5),jh$3(`pointerdown`,function(u){return i.startResize(u,{w:!0})}),vl$4(),Bi$3(5,`div`,6),jh$3(`pointerdown`,function(u){return i.startResize(u,{n:!0,e:!0})}),vl$4(),Bi$3(6,`div`,7),jh$3(`pointerdown`,function(u){return i.startResize(u,{s:!0,e:!0})}),vl$4(),Bi$3(7,`div`,8),jh$3(`pointerdown`,function(u){return i.startResize(u,{s:!0,w:!0})}),vl$4(),Bi$3(8,`div`,9),jh$3(`pointerdown`,function(u){return i.startResize(u,{n:!0,w:!0})}),vl$4(),Bi$3(9,`header`,10),jh$3(`pointerdown`,function(u){return i.startDrag(u)}),Bi$3(10,`div`,11)(11,`div`,12)(12,`mat-icon`),lC(13,`smart_toy`),vl$4()(),Bi$3(14,`div`,13)(15,`div`,14)(16,`span`,15),lC(17),OC(18,`translate`),vl$4(),Rh$3(19,`app-beta-badge`,16),vl$4(),Bi$3(20,`span`,17),lC(21),OC(22,`translate`),vl$4()()(),Bi$3(23,`app-chat-scope-selector`,18),jh$3(`selectionChange`,function(u){return i.onScopeChange(u)}),vl$4(),Bi$3(24,`div`,19),fw(25,Nr,4,3,`button`,20),Bi$3(26,`button`,21),OC(27,`translate`),jh$3(`click`,function(){return i.close()}),Bi$3(28,`mat-icon`),lC(29,`close`),vl$4()()()(),fw(30,Rr,7,1,`div`,22),Bi$3(31,`div`,23,0),fw(33,Dr,10,6,`div`,24),mw(34,Lr,5,1,null,null,Ir),fw(36,Hr,2,1),vl$4(),fw(37,$r,1,0,`app-ai-quota-exhausted-panel`)(38,Kr,4,2,`footer`,25),vl$4()),e&2){let s;sE(17),ig(LC(18,9,`agent.title`)),sE(4),ig(LC(22,11,`agent.dataAgent`)),sE(2),Ah$2(`selected`,i.scope()),sE(2),pw(i.messages().length>0?25:-1),sE(),xh$2(`aria-label`,LC(27,13,`common.close`)),sE(4),pw((s=i.context())?30:-1,s),sE(3),pw(i.messages().length===0&&!i.isLoading()?33:-1),sE(),yw(i.messageGroups()),sE(2),pw(i.isLoading()?36:-1),sE(),pw(i.aiQuotaExhausted()?37:38)}},dependencies:[Jn$4,Qe$2,qn$5,fn$5,Ap$1,xc$4,yt$7,wt$5,d$1,ln,pn,cn,sn,q,Xp$1],styles:[`[_nghost-%COMP%]{display:flex;flex-direction:column;position:fixed;z-index:1000;border-radius:12px;box-shadow:0 4px 20px #00000080;overflow:hidden;background:var(--%NS%chat-panel-bg);color:var(--%NS%chat-agent-text)}.chat-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;position:relative}.chat-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;padding:14px 16px;background:var(--%NS%chat-panel-header-bg);border-bottom:1px solid var(--%NS%chat-input-border);cursor:move;-webkit-user-select:none;user-select:none;overflow:visible}.chat-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.chat-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%] .header-logo[_ngcontent-%COMP%]{width:30px;height:30px;border-radius:9px;border:1px solid color-mix(in srgb,var(--%NS%chat-agent-text) 10%,transparent);background:color-mix(in srgb,var(--%NS%chat-agent-bubble) 74%,transparent);display:inline-flex;align-items:center;justify-content:center}.chat-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%] .header-logo[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--%NS%primarylime);width:17px;height:17px;font-size:17px}.chat-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%] .header-text[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:6px}.chat-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{font-weight:600;font-size:15px}.chat-header[_ngcontent-%COMP%] .header-title[_ngcontent-%COMP%] .subtitle[_ngcontent-%COMP%]{font-size:13px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 60%,transparent)}.chat-header[_ngcontent-%COMP%] .close-btn[_ngcontent-%COMP%]{color:inherit}.chat-header[_ngcontent-%COMP%] .header-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;margin-left:auto}.chat-header[_ngcontent-%COMP%] .header-actions[_ngcontent-%COMP%] .clear-btn[_ngcontent-%COMP%], .chat-header[_ngcontent-%COMP%] .header-actions[_ngcontent-%COMP%] .close-btn[_ngcontent-%COMP%]{color:inherit}.context-banner[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:10px 16px;background:color-mix(in srgb,var(--%NS%primary) 10%,transparent);border-bottom:1px solid color-mix(in srgb,var(--%NS%primary) 20%,transparent);font-size:.8rem;flex-wrap:wrap}.context-banner[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;opacity:.7}.context-banner[_ngcontent-%COMP%] .context-title[_ngcontent-%COMP%]{font-weight:600}.context-banner[_ngcontent-%COMP%] .context-hint[_ngcontent-%COMP%]{opacity:.6;margin-left:auto}.chat-messages[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:4px}
7375.date-separator[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;margin:16px 0 8px;font-size:12px;color:var(--%NS%chat-agent-text);opacity:.6}.date-separator[_ngcontent-%COMP%]:before, .date-separator[_ngcontent-%COMP%]:after{content:"";flex:1;height:1px;background:currentColor;opacity:.3}.date-separator[_ngcontent-%COMP%]:before{margin-right:12px}.date-separator[_ngcontent-%COMP%]:after{margin-left:12px}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;padding:24px;max-width:360px;margin:auto}.empty-state[_ngcontent-%COMP%] .empty-icon[_ngcontent-%COMP%]{width:58px;height:58px;border-radius:16px;border:1px solid color-mix(in srgb,var(--%NS%chat-agent-text) 10%,transparent);background:color-mix(in srgb,var(--%NS%chat-agent-bubble) 74%,transparent);display:inline-flex;align-items:center;justify-content:center;margin-bottom:14px}.empty-state[_ngcontent-%COMP%] .empty-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:30px;width:30px;height:30px;color:var(--%NS%primarylime)}.empty-title[_ngcontent-%COMP%]{margin:0 0 6px;font-size:15px;font-weight:600}.empty-hint[_ngcontent-%COMP%]{margin:0;font-size:13px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 58%,transparent);line-height:1.45}.message.assistant.streaming[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;max-width:80%;margin-right:auto;align-items:flex-start}.message.assistant.streaming[_ngcontent-%COMP%] .bubble[_ngcontent-%COMP%]{padding:10px 14px;background:var(--%NS%chat-agent-bubble);color:var(--%NS%chat-agent-text);border-radius:12px 12px 12px 4px;word-wrap:break-word;white-space:pre-wrap}.chat-input[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding:12px 16px;background:var(--%NS%chat-input-bg);border-top:1px solid var(--%NS%chat-input-border)}.chat-input-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;border:1px solid var(--%NS%chat-input-border);border-radius:12px;background:color-mix(in srgb,var(--%NS%chat-panel-bg) 90%,transparent);padding:6px 6px 6px 12px}.chat-input-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1;border:0;border-radius:0;padding:10px 0;font-size:14px;outline:none;background:transparent;color:inherit}.chat-input-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus{border-color:var(--%NS%primary)}.chat-input-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]::placeholder{opacity:.5}.chat-input-row--locked[_ngcontent-%COMP%]{align-items:flex-start;padding:10px 6px 10px 12px}.chat-input-row--locked[_ngcontent-%COMP%] .lock-icon[_ngcontent-%COMP%]{flex-shrink:0;margin-top:2px;width:20px;height:20px;font-size:20px;color:color-mix(in srgb,var(--%NS%chat-agent-text) 48%,transparent)}.chat-input-row--locked[_ngcontent-%COMP%] .locked-message[_ngcontent-%COMP%]{flex:1;padding:2px 0;font-size:13px;line-height:1.4;color:color-mix(in srgb,var(--%NS%chat-agent-text) 58%,transparent)}.chat-input-row--locked[_ngcontent-%COMP%] .send-btn[_ngcontent-%COMP%]{align-self:center}.send-btn[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%chat-agent-text) 48%,transparent)}.send-btn[_ngcontent-%COMP%]:disabled{opacity:.6}.send-btn[_ngcontent-%COMP%]:not(:disabled){color:var(--%NS%chat-panel-bg);background:linear-gradient(135deg,var(--%NS%primarylime),color-mix(in srgb,var(--%NS%primarylime) 75%,var(--%NS%chat-user-bubble)))}@media(max-width:760px){[_nghost-%COMP%]{inset:0;width:100%;height:100%;border-radius:0}.chat-panel[_ngcontent-%COMP%]{height:100%}.chat-header[_ngcontent-%COMP%]{flex-wrap:wrap;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{margin-left:0}}.resize-handle[_ngcontent-%COMP%]{position:absolute;z-index:20}.resize-handle--n[_ngcontent-%COMP%]{top:0;left:12px;right:12px;height:5px;cursor:n-resize}.resize-handle--e[_ngcontent-%COMP%]{right:0;top:12px;bottom:12px;width:5px;cursor:e-resize}.resize-handle--s[_ngcontent-%COMP%]{bottom:0;left:12px;right:12px;height:5px;cursor:s-resize}.resize-handle--w[_ngcontent-%COMP%]{left:0;top:12px;bottom:12px;width:5px;cursor:w-resize}.resize-handle--ne[_ngcontent-%COMP%]{top:0;right:0;width:14px;
7375height:14px;cursor:ne-resize}.resize-handle--se[_ngcontent-%COMP%]{bottom:0;right:0;width:14px;height:14px;cursor:se-resize}.resize-handle--sw[_ngcontent-%COMP%]{bottom:0;left:0;width:14px;height:14px;cursor:sw-resize}.resize-handle--nw[_ngcontent-%COMP%]{top:0;left:0;width:14px;height:14px;cursor:nw-resize}@media(max-width:760px){.resize-handle[_ngcontent-%COMP%]{display:none}}`]})};var qr=(n,t)=>t.id;function Gr(n,t){if(n&1&&(Bi$3(0,`span`,3),lC(1),vl$4()),n&2){let e=xw();sE(),ig(e.notificationsService.unreadCount())}}function Yr(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,11),jh$3(`pointerup`,function(){let s=ld$2(e).$implicit;return ud$1(xw(2).markSeen(s.id))}),Bi$3(1,`button`,12),OC(2,`translate`),jh$3(`pointerup`,function(s){let u=ld$2(e).$implicit,v=xw(2);return s.stopPropagation(),ud$1(v.deleteOne(u.id))}),Bi$3(3,`mat-icon`),lC(4,`delete`),vl$4()(),Bi$3(5,`mat-icon`,13),lC(6,`circle`),vl$4(),Bi$3(7,`div`,14)(8,`span`,15),lC(9),vl$4(),Bi$3(10,`span`,16),lC(11),OC(12,`date`),vl$4()()()}if(n&2){let e=t.$implicit,i=xw(2);Yh$3(`unseen`,!e.seen)(`deleting`,i.deletingIds().has(e.id)),sE(),xh$2(`aria-label`,LC(2,7,`notifications.delete`)),sE(8),ig(e.message),sE(2),ig(FC(12,9,e.createdAt,`HH:mm`))}}function Zr(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,6)(1,`button`,7),OC(2,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().markAllSeen())}),Bi$3(3,`mat-icon`),lC(4,`done_all`),vl$4(),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`button`,8),OC(8,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().deleteAll())}),Bi$3(9,`mat-icon`),lC(10,`delete_sweep`),vl$4(),lC(11),OC(12,`translate`),vl$4()(),Bi$3(13,`div`,9),mw(14,Yr,13,12,`div`,10,qr),vl$4()}if(n&2){let e=xw();sE(),xh$2(`aria-label`,LC(2,4,`notifications.markAllSeen`)),sE(4),Cl$4(` `,LC(6,6,`notifications.markAllSeen`),` `),sE(2),xh$2(`aria-label`,LC(8,8,`notifications.deleteAll`)),sE(4),Cl$4(` `,LC(12,10,`notifications.deleteAll`),` `),sE(3),yw(e.notificationsService.notifications())}}function Jr(n,t){n&1&&(Bi$3(0,`div`,5)(1,`mat-icon`),lC(2,`notifications_none`),vl$4(),Bi$3(3,`p`),lC(4),OC(5,`translate`),vl$4()()),n&2&&(sE(4),ig(LC(5,1,`notifications.noNotifications`)))}var mn=class n{notificationsService=E(ie$3);deletingIds=ni$3(new Set,{equal:()=>!1});closed=z1();close(){this.closed.emit()}markAllSeen(){this.notificationsService.markAllSeen()}markSeen(t){this.notificationsService.markSeen(t)}deleteOne(t){this.deletingIds.update(e=>(e.add(t),e)),setTimeout(()=>{this.notificationsService.delete(t),this.deletingIds.update(e=>(e.delete(t),e))},280)}deleteAll(){this.notificationsService.deleteAll()}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-notifications-panel`]],outputs:{closed:`closed`},decls:14,vars:11,consts:[[`role`,`dialog`,1,`panel`],[1,`panel-header`],[1,`panel-title`],[1,`count-badge`],[`icon`,`close`,`data-testid`,`notifications-close-btn`,3,`pointerup`,`ariaLabel`],[`data-testid`,`notifications-empty-state`,1,`empty-state`],[1,`panel-actions`],[`mat-flat-button`,``,`data-testid`,`notifications-mark-all-seen-btn`,1,`action-btn`,3,`pointerup`],[`mat-flat-button`,``,`data-testid`,`notifications-delete-all-btn`,1,`action-btn`,`danger`,3,`pointerup`],[`role`,`list`,1,`notifications-list`],[`role`,`listitem`,1,`notification-item`,3,`unseen`,`deleting`],[`role`,`listitem`,1,`notification-item`,3,`pointerup`],[`mat-icon-button`,``,1,`delete-btn`,3,`pointerup`],[1,`dot`],[1,`notification-body`],[1,`notification-message`],[1,`notification-time`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0),OC(1,`translate`),Bi$3(2,`header`,1)(3,`div`,2)(4,`mat-icon`),lC(5,`notifications`),vl$4(),Bi$3(6,`span`),lC(7),OC(8,`translate`),vl$4(),fw(9,Gr,2,1,`span`,3),vl$4(),Bi$3(10,`app-icon-button`,4),OC(11,`translate`),jh$3(`pointerup`,function(){return i.close()}),vl$4()(),fw(12,Zr,16,12)(13,Jr,6,3,`div`,5),vl$4()),e&2&&(xh$2(`aria-label`,LC(1,5,`common.notifications`)),sE(7),ig(LC(8,7,`common.notifications`)),sE(2),pw(i.notificationsService.unreadCount()>0?9:-1),sE(),Ah$2(`ariaLabel`,LC(11,9,`common.close`)),sE(2),pw(i.notificationsService.n
7375otifications().length>0?12:13))},dependencies:[Ap$1,wp$2,xc$4,yt$7,wt$5,b$3,Xp$1,es$4],styles:[`[_nghost-%COMP%]{display:flex;flex-direction:column;position:fixed;top:0;right:0;width:380px;height:100vh;z-index:1000;background-color:var(--%NS%dialog-dark-background);border-left:var(--%NS%border);box-shadow:-4px 0 24px #0006;animation:_ngcontent-%COMP%_slideInRight .25s ease-out}@media(max-width:760px){[_nghost-%COMP%]{width:100vw;border-left:none}}@keyframes _ngcontent-%COMP%_slideInRight{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden}.panel-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 16px 24px;border-bottom:var(--%NS%border);flex-shrink:0}.panel-header[_ngcontent-%COMP%] .panel-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;font-size:1.1rem;font-weight:600;color:var(--%NS%text-color)}.panel-header[_ngcontent-%COMP%] .panel-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--%NS%primary)}.panel-actions[_ngcontent-%COMP%]{display:flex;gap:10px;padding:14px 24px;border-bottom:var(--%NS%border);flex-shrink:0}.panel-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;font-size:.8rem;padding:6px 12px;background:var(--%NS%transparent-dark-background);color:var(--%NS%text-color);border:var(--%NS%border)}.panel-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.panel-actions[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]:hover{background:var(--%NS%box-color)}.panel-actions[_ngcontent-%COMP%] .action-btn.danger[_ngcontent-%COMP%]{color:var(--%NS%primaryRed)}.panel-actions[_ngcontent-%COMP%] .action-btn.danger[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,var(--%NS%danger) 15%,transparent)}@keyframes _ngcontent-%COMP%_notif-delete{0%{opacity:1;max-height:200px;padding-top:14px;padding-bottom:14px}to{opacity:0;max-height:0;padding-top:0;padding-bottom:0;border-width:0}}.notifications-list[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:8px 0}.notification-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:12px;padding:14px 24px 14px 12px;border-bottom:1px solid color-mix(in srgb,var(--%NS%border-color) 40%,transparent);transition:background .15s ease;cursor:pointer;overflow:hidden}.notification-item.deleting[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_notif-delete .28s ease forwards;pointer-events:none}.notification-item[_ngcontent-%COMP%]:last-child{border-bottom:none}.notification-item[_ngcontent-%COMP%]:hover{background:var(--%NS%transparent-dark-background)}.notification-item[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{flex-shrink:0;width:32px;height:32px;color:var(--%NS%text-color);opacity:.35;margin-top:-4px}.notification-item[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.notification-item[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{opacity:1;color:var(--%NS%primaryRed)}.notification-item[_ngcontent-%COMP%] .dot[_ngcontent-%COMP%]{font-size:8px;width:8px;height:8px;margin-top:4px;color:var(--%NS%quaternaryBlack);flex-shrink:0;transition:color .35s ease}.notification-item.unseen[_ngcontent-%COMP%] .dot[_ngcontent-%COMP%]{color:var(--%NS%primary-dark)}.notification-item[_ngcontent-%COMP%] .notification-message[_ngcontent-%COMP%]{font-size:.875rem;color:var(--%NS%text-color);line-height:1.5;transition:opacity .35s ease}.notification-item.unseen[_ngcontent-%COMP%] .notification-message[_ngcontent-%COMP%]{font-weight:500}.notification-item[_ngcontent-%COMP%]:not(.unseen) .notification-message[_ngcontent-%COMP%]{opacity:.7}.notification-item[_ngcontent-%COMP%] .notification-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px}.notification-item[_ngcontent-%COMP%] .notification-time[_ngcontent-%COMP%]{font-size:.75rem;color:var(--%NS%text-color);opacity:.5}.empty-state[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px 24px;color:var(--%NS%quaternaryBlack)}.empty-state[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:48px;width:48px;height:48px;opacity:.5}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.9rem;opacity:.7}`]})};var Qr=[`messagesContainer`];var No=()=>[];var le=n=>({count:n});var Xn=n=>({attributes:n}
7375);var Ro=n=>({label:n});var Pt=n=>({date:n});var Xr=n=>({reason:n});var el=(n,t)=>({start:n,end:t});var Do=n=>({number:n});var Et=n=>({$implicit:n});var tl=(n,t)=>({from:n,to:t});var St=(n,t)=>t.id;var _n=(n,t)=>t.operationId;var nl=(n,t)=>t.exerciseId;var ei=(n,t)=>t.reasonCode;var ti=(n,t)=>t.key;var Ao=(n,t)=>t.workoutId;var un=(n,t)=>t.workoutExerciseId;var il=(n,t)=>t.weekStart;var Io=(n,t)=>t.interval;function al(n,t){n&1&&(Bi$3(0,`span`,25),lC(1),vl$4()),n&2&&(sE(),ig(t))}function ol(n,t){n&1&&(Bi$3(0,`span`,26),lC(1,`/`),vl$4(),Bi$3(2,`span`,25),lC(3),vl$4()),n&2&&(sE(3),ig(t))}function rl(n,t){if(n&1&&(Bi$3(0,`div`,6),fw(1,al,2,1,`span`,25),fw(2,ol,4,1),vl$4()),n&2){let e,i,s=xw();sE(),pw((e=s.selectedAthleteName())?1:-1,e),sE(),pw((i=s.selectedProgramName())?2:-1,i)}}function ll(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,27),jh$3(`click`,function(){ld$2(e);return ud$1(xw().clearConversation())}),lC(1),OC(2,`translate`),vl$4()}if(n&2){let e=xw();Ah$2(`disabled`,e.isSending()||e.isApplyingProposal()||e.isUndoing()),sE(),Cl$4(` `,LC(2,2,`planEditor.clearConversation`),` `)}}function sl(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.history.loading`)))}function pl(n,t){if(n&1&&(Bi$3(0,`article`,32)(1,`div`,33)(2,`span`,34),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`),lC(6),OC(7,`date`),vl$4()(),Bi$3(8,`p`),lC(9),vl$4()()),n&2){let e=t.$implicit;sE(3),ig(LC(4,3,`planEditor.history.status.`+e.status)),sE(3),ig(FC(7,5,e.createdAt,`short`)),sE(3),ig(e.summary)}}function cl(n,t){if(n&1&&(Bi$3(0,`div`,31),mw(1,pl,10,8,`article`,32,St),vl$4()),n&2){let e=xw(2);sE(),yw(e.history())}}function dl(n,t){if(n&1){let e=Cw();Bi$3(0,`section`,13)(1,`div`,28)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`button`,29),jh$3(`click`,function(){ld$2(e);return ud$1(xw().undoLatestAction())}),lC(6),OC(7,`translate`),vl$4()(),fw(8,sl,3,3,`p`,30)(9,cl,3,0,`div`,31),vl$4()}if(n&2){let e=xw();sE(3),ig(LC(4,4,`planEditor.history.title`)),sE(2),Ah$2(`disabled`,!e.latestUndoableAction()||e.isUndoing()||e.isSending()),sE(),Cl$4(` `,LC(7,6,`planEditor.history.undo`),` `),sE(2),pw(e.isLoadingHistory()?8:9)}}function ml(n,t){if(n&1&&(Bi$3(0,`option`,40),lC(1),vl$4()),n&2){let e=t.$implicit;Ah$2(`value`,e.id),sE(),ig(e.name)}}function ul(n,t){if(n&1&&(Bi$3(0,`option`,40),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw(2);Ah$2(`value`,e.id),sE(),ig(i.formatProgramOptionLabel(e))}}function gl(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.selection.loadingAthletes`)))}function _l(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.selection.noAthletes`)))}function fl(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.selection.loadingPrograms`)))}function hl(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.selection.noPrograms`)))}function xl(n,t){if(n&1){let e=Cw();Bi$3(0,`section`,14)(1,`div`,35)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`p`),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`div`,36)(9,`label`,37)(10,`span`),lC(11),OC(12,`translate`),vl$4(),Bi$3(13,`select`,38),jh$3(`change`,function(s){ld$2(e);return ud$1(xw().selectAthlete(s.target.value))}),Bi$3(14,`option`,39),lC(15),OC(16,`translate`),vl$4(),mw(17,ml,2,2,`option`,40,St),vl$4()(),Bi$3(19,`label`,41)(20,`span`),lC(21),OC(22,`translate`),vl$4(),Bi$3(23,`select`,42),jh$3(`change`,function(s){ld$2(e);return ud$1(xw().selectProgram(s.target.value))}),Bi$3(24,`option`,39),lC(25),OC(26,`translate`),vl$4(),mw(27,ul,2,2,`option`,40,St),vl$4()()(),fw(29,gl,3,3,`p`,30)(30,_l,3,3,`p`,30),fw(31,fl,3,3,`p`,30)(32,hl,3,3,`p`,30),vl$4()}if(n&2){let e=xw();sE(3),ig(LC(4,12,`planEditor.selection.title`)),sE(3),ig(LC(7,14,`planEditor.selection.body`)),sE(5),ig(LC(12,16,`planEditor.selection.athleteLabel`)),sE(2),Ah$2(`value`,e.context()?.athleteId??``)(`disabled`,e.isLoadingAthletes()||e.isSelectingSwap()),sE(2),ig(LC(16,18,`planEditor.selection.athletePlaceholder`)),sE(2),yw(e.availableAthletes()),sE(4),ig(LC(22,20,`planEditor.selection.programLabel`)),sE(2),Ah$2(`value`,e.context()?.programId??``)(`disabled`,e.context()?.athleteId===null||e.context()?.athleteId===void 0||e.isLoadingPrograms()||e.isSelectingSwap()),sE(2),ig(LC(26,22,`planEditor.selection.programPlaceholder`)),sE(2),yw(e.availablePrograms()),sE(2),pw(e.isLoadingAthletes()?29:e.availableAthletes().length===0?30:-1),sE(2),pw(e.context()?.athleteId!==null&&e.context()?.athleteId!==void 0&&e.isLoadingPrograms()?31:e.context()?.athleteId!==null&&e.context()?.athleteId!==void 0&&e.availablePrograms().length===0?32:-1)}}function vl(n,t){n&1&&(Bi$3(0,`div`,15)(1,`mat-icon`),lC(2,`edit_note`),vl$4(),Bi$3(3,`h3`),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`),lC(7),OC(8,`translate`),vl$4()()),n&2&&(sE(4),ig(LC(5,2,`planEditor.emptyState.title`)),sE(3),ig(LC(8,4,`planEditor.emptyState.body`)))}
7375function Cl(n,t){if(n&1&&(Bi$3(0,`article`,17)(1,`div`,43),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,44),lC(5),vl$4()()),n&2){let e=t.$implicit;Yh$3(`message--user`,e.role===`user`),sE(2),Cl$4(` `,LC(3,4,e.role===`user`?`planEditor.message.user`:`planEditor.message.assistant`),` `),sE(3),ig(e.content)}}function bl(n,t){n&1&&(Bi$3(0,`article`,17)(1,`div`,43),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,45),lC(5),OC(6,`translate`),vl$4()()),n&2&&(sE(2),ig(LC(3,2,`planEditor.message.assistant`)),sE(3),Cl$4(` `,LC(6,4,`planEditor.loading`),` `))}function yl(n,t){if(n&1&&(Bi$3(0,`span`,49),lC(1),vl$4()),n&2){let e=xw().$implicit;sE(),ig(e.description)}}function wl(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,27),jh$3(`click`,function(){let s=ld$2(e).$implicit;return ud$1(xw(3).chooseClarificationOption(s.id))}),Bi$3(1,`span`,48),lC(2),vl$4(),fw(3,yl,2,1,`span`,49),vl$4()}if(n&2){let e=t.$implicit;Ah$2(`disabled`,xw(3).isSending()),sE(2),ig(e.label),sE(),pw(e.description?3:-1)}}function Sl(n,t){if(n&1&&(Bi$3(0,`div`,46),mw(1,wl,4,3,`button`,8,St),vl$4()),n&2){let e=xw();sE(),yw(e.options??TC(0,No))}}function Pl(n,t){if(n&1&&(Bi$3(0,`span`,52),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw(3);sE(),ig(i.formatRequiredContext(e))}}function El(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.clarification.requiredContextHelp`)))}function Ml(n,t){if(n&1&&(Bi$3(0,`div`,47)(1,`div`,50),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,51),mw(5,Pl,2,1,`span`,52,gw),vl$4(),fw(7,El,3,3,`p`,30),vl$4()),n&2){let e=xw(),i=xw();sE(2),ig(LC(3,2,`planEditor.clarification.requiredContext`)),sE(3),yw(e.requiredContext??TC(4,No)),sE(2),pw(i.clarificationHasOptions()?-1:7)}}function kl(n,t){if(n&1&&(Bi$3(0,`section`,18)(1,`h3`),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`p`),lC(5),vl$4(),fw(6,Sl,3,1,`div`,46),fw(7,Ml,8,5,`div`,47),vl$4()),n&2){let e=xw();sE(2),ig(LC(3,4,`planEditor.clarification.title`)),sE(3),ig(t.question),sE(),pw(e.clarificationHasOptions()?6:-1),sE(),pw(e.clarificationNeedsExplicitContext()?7:-1)}}function Ol(n,t){n&1&&(Bi$3(0,`p`),lC(1),vl$4()),n&2&&(sE(),ig(t))}function Il(n,t){if(n&1&&(Bi$3(0,`span`,57),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw(),i=xw();sE(),Cl$4(` `,FC(2,1,`planEditor.semanticSwap.avoids`,bC(4,Xn,i.formatSemanticSwapAvoidAttributes(e))),` `)}}function Tl(n,t){if(n&1&&(lC(0),OC(1,`translate`)),n&2){let e=xw().$implicit;Cl$4(` `,FC(1,1,`planEditor.semanticSwap.workout`,bC(4,Pt,e.startDate)),` `)}}function Nl(n,t){if(n&1&&(Bi$3(0,`span`),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw().$implicit,i=xw(2);sE(),Cl$4(` `,FC(2,1,`planEditor.semanticSwap.matchedAttributes`,bC(4,Xn,i.formatSemanticSwapAttributes(e))),` `)}}function Rl(n,t){if(n&1&&(Bi$3(0,`option`,40),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw(3);Ah$2(`value`,e.exerciseId),sE(),Cl$4(` `,i.formatSemanticSwapCandidate(e),` `)}}function Dl(n,t){if(n&1){let e=Cw();Bi$3(0,`article`,59)(1,`div`,63)(2,`div`,64)(3,`div`,65),lC(4),vl$4(),Bi$3(5,`div`,66),fw(6,Tl,2,6),fw(7,Nl,3,6,`span`),vl$4()(),Bi$3(8,`span`,53),lC(9),OC(10,`translate`),vl$4()(),Bi$3(11,`label`,67)(12,`span`),lC(13),OC(14,`translate`),vl$4(),Bi$3(15,`select`,68),OC(16,`translate`),jh$3(`change`,function(s){let u=ld$2(e).$implicit;return ud$1(xw(2).selectSemanticSwapReplacement(u,s.target.value))}),Bi$3(17,`option`,39),lC(18),OC(19,`translate`),vl$4(),mw(20,Rl,2,2,`option`,40,nl),vl$4()()()}if(n&2){let e=t.$implicit,i=xw(2);sE(4),Cl$4(` `,e.currentExerciseName||e.label,` `),sE(2),pw(e.startDate?6:-1),sE(),pw(e.matchedAttributes?.length?7:-1),sE(2),ig(LC(10,12,`planEditor.semanticSwap.swap`)),sE(2),xh$2(`for`,`plan-editor-semantic-swap-select-`+e.workoutExerciseId),sE(2),ig(LC(14,14,`planEditor.semanticSwap.replacementLabel`)),sE(2),Ah$2(`value`,i.semanticSwapSelection(e))(`disabled`,i.isSelectingSwap()),xh$2(`id`,`plan-editor-semantic-swap-select-`+e.workoutExerciseId)(`aria-label`,FC(16,16,`planEditor.semanticSwap.replacementAria`,bC(21,Ro,e.currentExerciseName||e.label)))(`data-testid`,`plan-editor-semantic-swap-select-`+e.workoutExerciseId),sE(3),Cl$4(` `,LC(19,19,`planEditor.semanticSwap.replacementPlaceholder`),` `),sE(2),yw(i.semanticSwapCandidates(e))}}function Al(n,t){if(n&1&&(Bi$3(0,`li`),lC(1),vl$4()),n&2){let e=t.$implicit;sE(),ig(e)}}function Bl(n,t){if(n&1&&(Bi$3(0,`div`,75)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`ul`),mw(5,Al,2,1,`li`,null,gw),vl$4()()),n&2){let e=xw().$implicit;sE(2),Cl$4(` `,LC(3,1,`planEditor.batch.examples`),` `),sE(3),yw(e.examples)}}function Fl(n,t){if(n&1&&(Bi$3(0,`article`,72)(1,`div`,73)(2,`div`,74),lC(3),vl$4(),Bi$3(4,`span`,57),lC(5),OC(6,`translate`),vl$4()(),fw(7,Bl,7,3,`div`,75),vl$4()),n&2){let e=t.$implicit,i=xw(4);sE(3),Cl$4(` `,i.formatBatchExclusionReason(e),` `),sE(2),Cl$4(` `,FC(6,3,`planEditor.batch.exclusionReasonCount`,bC(6,le,e.count)),` `),sE(2),pw(e.examples.length?7:-1)}}function Ll(n,t){if(n&1&&(Bi$3(0,`section`,69)(1,`div`,70)(2,`div`)(3,`div`,56),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`),lC(7),OC(8,`translate`),vl$4()(),Bi$3(9,`span`,57),lC(10),OC(11,`translate`),vl$4()(),Bi$3(12,`div`,71),mw(13,Fl,8,8,`article`,72,ei),vl$4()()),n&2){let e=xw(),i=xw(),s=xw();sE(4),Cl$4(` `,LC(5,3,`planEditor.semanticSwap.exclusionsTitle`),` `),sE(3),ig(LC(8,5,`planEditor.semanticSwap.exclusionsHint`)),sE(3),Cl$4(` `,FC(11,7,`planEditor.semanticSwap.exclusionCount`,bC(10,le,s.semanticSwapExcludedCount(i))),` `),sE(3),yw(e)}}function Vl(n,t){n&1&&fw(0,Ll,15,12,`section`,69),n&2&&pw(t.length?0:-1)}function Wl(n,t){if(n&1){let e=Cw();Bi$3(0,`section`,19)(1,`div`,28)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`,53),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`p`,30),lC(9),OC(10,`translate`),vl$4(),Bi$3(11,`section`,54)(12,`div`,55)(13,`div`)(14,`div`,56),lC(15),OC(16,`translate`),vl$4(),fw(17,Ol,2,1,`p`),vl$4(),fw(18,Il,3,6,`span`,57),vl$4(),Bi$3(19,`div`,58),mw(20,Dl,22,23,`article`,59,_n),vl$4(),fw(22,Vl,1,1
7375),vl$4(),Bi$3(23,`div`,60)(24,`button`,61),jh$3(`click`,function(){ld$2(e);return ud$1(xw().discardSemanticSwapReview())}),lC(25),OC(26,`translate`),vl$4(),Bi$3(27,`button`,62),jh$3(`click`,function(){let s=ld$2(e);return ud$1(xw().submitSemanticSwapSelections(s))}),lC(28),OC(29,`translate`),vl$4()()()}if(n&2){let e,i,s=t,u=xw();sE(3),ig(LC(4,11,`planEditor.semanticSwap.title`)),sE(3),Cl$4(` `,FC(7,13,`planEditor.semanticSwap.targetCount`,bC(24,le,s.targetCount)),` `),sE(3),ig(LC(10,16,`planEditor.semanticSwap.hint`)),sE(6),ig(LC(16,18,`planEditor.semanticSwap.scope`)),sE(2),pw((e=u.formatSemanticSwapDateRange(s))?17:-1,e),sE(),pw(s.avoidLoadAttributes?.length?18:-1),sE(2),yw(u.semanticSwapTargets(s)),sE(2),pw((i=u.semanticSwapExclusions(s))?22:-1,i),sE(2),Ah$2(`disabled`,u.isSelectingSwap()),sE(),Cl$4(` `,LC(26,20,`planEditor.proposal.reject`),` `),sE(2),Ah$2(`disabled`,!u.canSubmitSemanticSwap()||u.isSelectingSwap()),sE(),Cl$4(` `,LC(29,22,`planEditor.semanticSwap.reviewSelections`),` `)}}function Hl(n,t){if(n&1&&(Bi$3(0,`article`,85)(1,`div`,86),lC(2),vl$4(),Bi$3(3,`div`,87),lC(4),vl$4()()),n&2){let e=t.$implicit;sE(2),ig(e.label),sE(2),ig(e.value)}}function $l(n,t){if(n&1&&(Bi$3(0,`section`,83)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,84),mw(5,Hl,5,2,`article`,85,ti),vl$4()()),n&2){let e=xw();sE(2),ig(LC(3,1,`planEditor.proposal.highlightsTitle`)),sE(3),yw(e)}}function zl(n,t){n&1&&fw(0,$l,7,3,`section`,83),n&2&&pw(t.length?0:-1)}function Ul(n,t){n&1&&(Bi$3(0,`p`,90),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),Cl$4(` `,FC(2,1,`planEditor.semanticRemove.narrowed`,bC(4,le,t.deselectedCount)),` `))}function jl(n,t){if(n&1){let e=Cw();Bi$3(0,`label`,95)(1,`input`,97),OC(2,`translate`),jh$3(`change`,function(){let s=ld$2(e).$implicit,u=xw(2);return ud$1(xw(2).deselectSemanticRemoveOperation(u,s.operationId))}),vl$4(),Bi$3(3,`span`,98)(4,`span`,99),lC(5),vl$4(),Bi$3(6,`span`,100),lC(7),OC(8,`translate`),vl$4()(),Bi$3(9,`span`,57),lC(10),OC(11,`translate`),vl$4()()}if(n&2){let e=t.$implicit,i=xw(2),s=xw(2);xh$2(`for`,`plan-editor-semantic-remove-`+e.operationId),sE(),Ah$2(`disabled`,s.isSemanticRemoveDeselectDisabled(i)),xh$2(`id`,`plan-editor-semantic-remove-`+e.operationId)(`aria-label`,FC(2,8,`planEditor.semanticRemove.deselectAria`,bC(16,Ro,e.label)))(`data-testid`,`plan-editor-semantic-remove-`+e.operationId),sE(4),ig(e.label),sE(2),Cl$4(` `,FC(8,11,`planEditor.semanticRemove.matchedAttributes`,bC(18,Xn,s.formatSemanticRemoveAttributes(e))),` `),sE(3),Cl$4(` `,LC(11,14,`planEditor.semanticRemove.remove`),` `)}}function Kl(n,t){if(n&1&&(Bi$3(0,`article`,96)(1,`span`,98)(2,`span`,99),lC(3),vl$4(),Bi$3(4,`span`,100),lC(5),OC(6,`translate`),vl$4()(),Bi$3(7,`span`,53),lC(8),OC(9,`translate`),vl$4()()),n&2){let e=t.$implicit,i=xw(4);sE(3),ig(e.label),sE(2),Cl$4(` `,FC(6,3,`planEditor.semanticRemove.keepReason`,bC(8,Xr,i.formatSemanticRemoveKeepReason(e.reasonCode))),` `),sE(3),ig(LC(9,6,`planEditor.semanticRemove.keep`))}}function ql(n,t){if(n&1&&(Bi$3(0,`section`,92)(1,`div`,94),lC(2),OC(3,`translate`),vl$4(),mw(4,jl,12,20,`label`,95,_n),mw(6,Kl,10,10,`article`,96,un),vl$4()),n&2){let e=t.$implicit;sE(2),Cl$4(` `,FC(3,1,`planEditor.semanticRemove.workout`,bC(4,Pt,e.startDate)),` `),sE(2),yw(e.remove),sE(2),yw(e.keep)}}function Gl(n,t){if(n&1&&(Bi$3(0,`li`),lC(1),vl$4()),n&2){let e=t.$implicit;sE(),ig(e)}}function Yl(n,t){if(n&1&&(Bi$3(0,`div`,75)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`ul`),mw(5,Gl,2,1,`li`,null,gw),vl$4()()),n&2){let e=xw().$implicit;sE(2),ig(LC(3,1,`planEditor.batch.examples`)),sE(3),yw(e.examples)}}function Zl(n,t){if(n&1&&(Bi$3(0,`article`,72)(1,`div`,73)(2,`div`,74),lC(3),vl$4(),Bi$3(4,`span`,57),lC(5),OC(6,`translate`),vl$4()(),fw(7,Yl,7,3,`div`,75),vl$4()),n&2){let e=t.$implicit,i=xw(4);sE(3),Cl$4(` `,i.formatBatchExclusionReason(e),` `),sE(2),Cl$4(` `,FC(6,3,`planEditor.batch.exclusionReasonCount`,bC(6,le,e.count)),` `),sE(2),pw(e.examples.length?7:-1)}}function Jl(n,t){if(n&1&&(Bi$3(0,`section`,93)(1,`div`,101)(2,`div`)(3,`div`,56),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`),lC(7),OC(8,`translate`),vl$4()(),Bi$3(9,`span`,57),lC(10),OC(11,`translate`),vl$4()(),Bi$3(12,`div`,71),mw(13,Zl,8,8,`article`,72,ei),vl$4()()),n&2){let e=xw(),i=xw(2);sE(4),Cl$4(` `,LC(5,3,`planEditor.semanticRemove.exclusionsTitle`),` `),sE(3),ig(LC(8,5,`planEditor.semanticRemove.exclusionsHint`)),sE(3),Cl$4(` `,FC(11,7,`planEditor.semanticRemove.exclusionCount`,bC(10,le,i.semanticRemoveExcludedCount(e))),` `),sE(3),yw(e.exclusions)}}function Ql(n,t){if(n&1&&(Bi$3(0,`section`,79)(1,`div`,88)(2,`div`)(3,`div`,56),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`p`),lC(7),OC(8,`translate`),vl$4()(),Bi$3(9,`div`,89)(10,`span`,57),lC(11),OC(12,`translate`),vl$4(),Bi$3(13,`span`,53),lC(14),OC(15,`translate`),vl$4()()(),fw(16,Ul,3,6,`p`,90),Bi$3(17,`div`,91),mw(18,ql,8,6,`section`,92,Ao),vl$4(),fw(20,Jl,15,12,`section`,93),vl$4()),n&2){let e,i=t;sE(4),ig(LC(5,6,`planEditor.semanticRemove.title`)),sE(3),ig(LC(8,8,`planEditor.semanticRemove.hint`)),sE(4),Cl$4(` `,FC(12,10,`planEditor.semanticRemove.removeCount`,bC(16,le,i.membership.removeCount)),` `),sE(3),Cl$4(` `,FC(15,13,`planEditor.semanticRemove.keepCount`,bC(18,le,i.membership.keepCount)),` `),sE(2),pw((e=i.narrowed)?16:-1,e),sE(2),yw(i.membership.workouts),sE(2),pw(i.exclusions.length?20:-1)}}function Xl(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,80)(1,`button`,102),jh$3(`click`,function(){ld$2(e);let s=xw();return ud$1(xw().toggleProposalDetails(s))}),Bi$3(2,`mat-icon`),lC(3),vl$4(),lC(4),OC(5,`translate`),vl$4()()}if(n&2){let e=xw(),i=xw();
7375sE(3),Cl$4(` `,i.isProposalDetailsExpanded(e)?`expand_less`:`expand_more`,` `),sE(),Cl$4(` `,LC(5,2,i.isProposalDetailsExpanded(e)?`planEditor.proposal.hideDetails`:`planEditor.proposal.reviewDetails`),` `)}}function es(n,t){if(n&1&&(lC(0),OC(1,`translate`)),n&2){let e=xw(2).$implicit;Cl$4(` `,FC(1,1,`planEditor.batch.setNumber`,bC(4,Do,e.setNumber)),` `)}}function ts(n,t){if(n&1&&lC(0),n&2){let e=xw(2).$implicit;Cl$4(` `,e.label,` `)}}function ns(n,t){if(n&1&&(Bi$3(0,`div`,122),fw(1,es,2,6)(2,ts,1,1),vl$4()),n&2){let e=xw().$implicit;sE(),pw(e.setNumber!==null&&e.setNumber!==void 0?1:2)}}function is(n,t){if(n&1&&(Bi$3(0,`div`,121),fw(1,ns,3,1,`div`,122),Bi$3(2,`div`,123)(3,`section`,124)(4,`div`,125),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`span`,126),lC(8),vl$4()(),Bi$3(9,`section`,124)(10,`div`,125),lC(11),OC(12,`translate`),vl$4(),Bi$3(13,`span`,126),lC(14),vl$4()()()()),n&2){let e=t.$implicit,i=xw().$implicit,s=xw(4),u=xw(3);sE(),pw(u.shouldShowBatchOperationLabel(e,i.operations.length)?1:-1),sE(4),Cl$4(` `,LC(6,5,`planEditor.preview.before`),` `),sE(3),Cl$4(` `,u.formatBatchOperationValue(s.fieldName,e.before),` `),sE(3),Cl$4(` `,LC(12,7,`planEditor.preview.after`),` `),sE(3),Cl$4(` `,u.formatBatchOperationValue(s.fieldName,e.after),` `)}}function as(n,t){if(n&1&&(Bi$3(0,`article`,117)(1,`div`,118)(2,`div`,119),lC(3),vl$4(),Bi$3(4,`span`,53),lC(5),vl$4()(),Bi$3(6,`div`,120),mw(7,is,15,9,`div`,121,_n),vl$4()()),n&2){let e=t.$implicit,i=xw(7);sE(3),ig(e.label),sE(2),Cl$4(` `,i.formatBatchOperationCount(e.operations.length),` `),sE(2),yw(e.operations)}}function os(n,t){if(n&1&&(Bi$3(0,`section`,114)(1,`div`,115),lC(2),vl$4(),Bi$3(3,`div`,116),mw(4,as,9,2,`article`,117,un),vl$4()()),n&2){let e=t.$implicit;sE(2),ig(e.label),sE(2),yw(e.exercises)}}function rs(n,t){if(n&1&&(Bi$3(0,`article`,110)(1,`div`,111)(2,`div`,112),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`,53),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`div`,113),mw(9,os,6,1,`section`,114,Ao),vl$4()()),n&2){let e=t.$implicit;sE(3),Cl$4(` `,FC(4,2,`planEditor.batch.weekRange`,_C(8,el,e.weekStart,e.weekEnd)),` `),sE(3),Cl$4(` `,FC(7,5,`planEditor.batch.workoutCount`,bC(11,le,e.workouts.length)),` `),sE(3),yw(e.workouts)}}function ls(n,t){if(n&1&&(Bi$3(0,`section`,107)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,109),mw(5,rs,11,13,`article`,110,il),vl$4()()),n&2){let e=xw();sE(2),ig(LC(3,1,`planEditor.batch.groupedPreview`)),sE(3),yw(e.groupedByWeek)}}function ss(n,t){if(n&1&&(Bi$3(0,`li`),lC(1),vl$4()),n&2){let e=t.$implicit;sE(),ig(e)}}function ps(n,t){if(n&1&&(Bi$3(0,`div`,75)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`ul`),mw(5,ss,2,1,`li`,null,gw),vl$4()()),n&2){let e=xw().$implicit;sE(2),ig(LC(3,1,`planEditor.batch.examples`)),sE(3),yw(e.examples)}}function cs(n,t){if(n&1&&(Bi$3(0,`article`,72)(1,`div`,73)(2,`div`,74),lC(3),vl$4(),Bi$3(4,`span`,57),lC(5),OC(6,`translate`),vl$4()(),fw(7,ps,7,3,`div`,75),vl$4()),n&2){let e=t.$implicit,i=xw(5);sE(3),Cl$4(` `,i.formatBatchExclusionReason(e),` `),sE(2),Cl$4(` `,FC(6,3,`planEditor.batch.exclusionReasonCount`,bC(6,le,e.count)),` `),sE(2),pw(e.examples.length?7:-1)}}function ds(n,t){if(n&1&&(Bi$3(0,`section`,108)(1,`div`,127)(2,`div`,56),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`,57),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`p`,30),lC(9),OC(10,`translate`),vl$4(),Bi$3(11,`div`,71),mw(12,cs,8,8,`article`,72,ei),vl$4()()),n&2){let e=xw();sE(3),ig(LC(4,3,`planEditor.batch.exclusionsTitle`)),sE(3),Cl$4(` `,FC(7,5,`planEditor.batch.exclusionCount`,bC(10,le,e.exclusionCount)),` `),sE(3),ig(LC(10,8,`planEditor.batch.exclusionsHint`)),sE(3),yw(e.exclusions)}}function ms(n,t){if(n&1&&(Bi$3(0,`section`,104)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`dl`,105)(5,`div`,106)(6,`dt`),lC(7),OC(8,`translate`),vl$4(),Bi$3(9,`dd`),lC(10),vl$4()(),Bi$3(11,`div`,106)(12,`dt`),lC(13),OC(14,`translate`),vl$4(),Bi$3(15,`dd`),lC(16),vl$4()(),Bi$3(17,`div`,106)(18,`dt`),lC(19),OC(20,`translate`),vl$4(),Bi$3(2
73751,`dd`),lC(22),vl$4()(),Bi$3(23,`div`,106)(24,`dt`),lC(25),OC(26,`translate`),vl$4(),Bi$3(27,`dd`),lC(28),vl$4()(),Bi$3(29,`div`,106)(30,`dt`),lC(31),OC(32,`translate`),vl$4(),Bi$3(33,`dd`),lC(34),vl$4()(),Bi$3(35,`div`,106)(36,`dt`),lC(37),OC(38,`translate`),vl$4(),Bi$3(39,`dd`),lC(40),vl$4()(),Bi$3(41,`div`,106)(42,`dt`),lC(43),OC(44,`translate`),vl$4(),Bi$3(45,`dd`),lC(46),vl$4()()(),fw(47,ls,7,3,`section`,107),vl$4(),fw(48,ds,14,12,`section`,108)),n&2){let e=t,i=xw(3);sE(2),ig(LC(3,17,`planEditor.batch.title`)),sE(5),ig(LC(8,19,`planEditor.batch.field`)),sE(3),ig(i.formatBatchField(e.fieldName)),sE(3),ig(LC(14,21,`planEditor.batch.affectedCount`)),sE(3),ig(i.formatBatchAffectedCount(e)),sE(3),ig(LC(20,23,`planEditor.batch.selector`)),sE(3),ig(i.formatBatchSelectorSummary(e)),sE(3),ig(LC(26,25,`planEditor.batch.dateRange`)),sE(3),Cl$4(` `,i.formatBatchDateRangeSummary(e),` `),sE(3),ig(LC(32,27,`planEditor.batch.adjustment`)),sE(3),ig(i.formatBatchAdjustmentSummary(e)),sE(3),ig(LC(38,29,`planEditor.batch.includePlaceholders`)),sE(3),ig(i.formatPreviewPrimitive(e.includePlaceholders)),sE(3),ig(LC(44,31,`planEditor.batch.roundingRule`)),sE(3),ig(e.roundingRule.description),sE(),pw(e.groupedByWeek.length?47:-1),sE(),pw(e.exclusions.length?48:-1)}}function us(n,t){if(n&1&&(Bi$3(0,`section`,103)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Ph$3(4,128),vl$4()),n&2){xw(3);let e=jw(40);sE(2),ig(LC(3,3,`planEditor.proposal.preview`)),sE(2),Ah$2(`ngTemplateOutlet`,e)(`ngTemplateOutletContext`,bC(5,Et,t))}}function gs(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,134)(2,`div`,135)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,136),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),OC(11,`translate`),vl$4()(),Bi$3(12,`div`,137)(13,`div`,56),lC(14),OC(15,`translate`),vl$4(),Bi$3(16,`div`,138),lC(17),vl$4()(),Bi$3(18,`div`,123)(19,`section`,124)(20,`div`,125),lC(21),OC(22,`translate`),vl$4(),Bi$3(23,`span`,126),lC(24),OC(25,`translate`),vl$4()(),Bi$3(26,`section`,124)(27,`div`,125),lC(28),OC(29,`translate`),vl$4(),Bi$3(30,`span`,126),lC(31),vl$4()()()()()),n&2){let e=xw().$implicit;sE(5),Cl$4(` `,LC(6,9,`planEditor.proposal.operationPreview`),` `),sE(3),ig(e.preview.after),sE(2),Cl$4(` `,LC(11,11,`planEditor.exerciseCatalog.action.add`),` `),sE(4),Cl$4(` `,LC(15,13,`planEditor.exerciseCatalog.location`),` `),sE(3),ig(e.preview.label),sE(4),Cl$4(` `,LC(22,15,`planEditor.preview.before`),` `),sE(3),Cl$4(` `,LC(25,17,`planEditor.exerciseCatalog.state.notInWorkout`),` `),sE(4),Cl$4(` `,LC(29,19,`planEditor.preview.after`),` `),sE(3),ig(e.preview.after)}}function _s(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,134)(2,`div`,135)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,136),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),OC(11,`translate`),vl$4()(),Bi$3(12,`div`,137)(13,`div`,56),lC(14),OC(15,`translate`),vl$4(),Bi$3(16,`div`,138),lC(17),vl$4()(),Bi$3(18,`div`,123)(19,`section`,124)(20,`div`,125),lC(21),OC(22,`translate`),vl$4(),Bi$3(23,`span`,126),lC(24),vl$4()(),Bi$3(25,`section`,124)(26,`div`,125),lC(27),OC(28,`translate`),vl$4(),Bi$3(29,`span`,126),lC(30),OC(31,`translate`),vl$4()()()()()),n&2){let e=xw().$implicit;sE(5),Cl$4(` `,LC(6,9,`planEditor.proposal.operationPreview`),` `),sE(3),ig(e.preview.label),sE(2),Cl$4(` `,LC(11,11,`planEditor.exerciseCatalog.action.remove`),` `),sE(4),Cl$4(` `,LC(15,13,`planEditor.exerciseCatalog.location`),` `),sE(3),Cl$4(` `,e.preview.workout,` `),sE(4),ig(LC(22,15,`planEditor.preview.before`)),sE(3),ig(e.preview.before),sE(3),ig(LC(28,17,`planEditor.preview.after`)),sE(3),Cl$4(` `,LC(31,19,`planEditor.exerciseCatalog.state.removed`),` `)}}function fs(n,t){if(n&1&&(Bi$3(0,`div`,106)(1,`dt`),lC(2),vl$4(),Bi$3(3,`dd`),lC(4),vl$4()()),n&2){let e=xw(6);sE(2),ig(e.formatPreviewKey(`mode`)),sE(2),ig(e.formatPreviewKey(t))}}function hs(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,139)(2,`div`,140)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,141),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),OC(11,`translate`),vl$4()(),Bi$3(12,`div`,137)(13,`div`,56),lC(14),OC(15,`translate`),vl$4(),Bi$3(16,`div`,138),lC(17),vl$4()(),Bi$3(18,`div`,142)(19,`div`,56),lC(20),OC(21,`translate`),vl$4(),Bi$3(22,`dl`,105)(23,`div`,106)(24,`dt`),lC(25),OC(26,`translate`),vl$4(),Bi$3(27,`dd`),lC(28),vl$4()(),Bi$3(29,`div`,106)(30,`dt`),lC(31),vl$4(),Bi$3(32,`dd`),lC(33),vl$4()(),fw(34,fs,5,2,`div`,106),vl$4()(),Bi$3(35,`div`,123)(36,`section`,124)(37,`div`,125),lC(38),OC(39,`translate`),vl$4(),Bi$3(40,`span`,126),lC(41),vl$4()(),Bi$3(42,`section`,124)(43,`div`,125),lC(44),OC(45,`translate`),vl$4(),Bi$3(46,`span`,126),lC(47),vl$4()()()()()),n&2){let e,i=xw().$implicit,s=xw(4);sE(5),Cl$4(` `,LC(6,15,`planEditor.proposal.operationPreview`),` `),sE(3),ig(i.preview.label),sE(2),Cl$4(` `,LC(11,17,`planEditor.exerciseCatalog.action.swap`),` `),sE(4),Cl$4(` `,LC(15,19,`planEditor.exerciseCatalog.location`),` `),sE(3),Cl$4(` `,i.preview.workout,` `),sE(3),Cl$4(` `,LC(21,21,`planEditor.exerciseSwap.compatibility`),` `),sE(5),ig(LC(26,23,`planEditor.exerciseSwap.structureKind.label`)),sE(3),ig(s.formatExerciseSwapStructureKind(i.preview.structureKind)),sE(3),ig(s.formatPreviewKey(`category`)),sE(2),ig(s.formatPreviewKey(i.preview.compatibility.category)),sE(),pw((e=i.preview.compatibility.mode)?34:-1,e),sE(4),ig(LC(39,25,`planEditor.preview.before`)),sE(3),ig(i.preview.before),sE(3),ig(LC(45,27,`planEditor.preview.after`)),sE(3),ig(i.preview.after)}}function xs(n,t){n&1&&(Bi$3(0,`span`,153),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),Cl$4(` `,LC(2,1,`planEditor.exerciseReorder.moved`),` `))}function vs(n,t){if(n&1&&(Bi$3(0,`li`,150)(1,`span`,151),lC(2),vl$4(),Bi$3(3,`span`,152),lC(4),vl$4(),fw(5,xs,3,3,`span`,153),vl$4()),n&2){let e=t.$implicit,i=xw(2).$implicit,s=xw(4);Yh$3(`exercise-reorder-preview__item--moved`,s.isMovedExerciseReorderItem(i.preview,e)),sE(2),Cl$4(` `,e.position,` `),sE(2),Cl$4(` `,s.formatExerciseReorderItemLabel(e),` `),sE(),pw(s.isMovedExerciseReorderItem(i.preview,e)?5:-1)}}function Cs(n,t){n&1&&(Bi$3(0,`span`,153),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),Cl$4(` `,LC(2,1,`planEditor.exerciseReorder.moved`),` `))}function bs(n,t){if(n&1&&(Bi$3(0,`li`,150)(1,`span`,151),lC(2),vl$4(),Bi$3(3,`span`,152),lC(4),vl$4(),fw(5,Cs,3,3,`span`,153),vl$4()),n&2){let e=t.$implicit,i=xw(2).$implicit,s=xw(4);Yh$3(`exercise-reorder-preview__item--moved`,s.isMovedExerciseReorderItem(i.preview,e)),sE(2),Cl$4(` `,e.position,` `),sE(2),Cl$4(` `,s.formatExerciseReorderItemLabel(e),` `),sE(),pw(s.isMovedExerciseReorderItem(i.preview,e)?5:-1)}}function ys(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,143)(2,`div`,144)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,145),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),OC(11,`translate`),vl$4()(),Bi$3(12,`div`,137)(13,`div`,56),lC(14),OC(15,`translate`),vl$4(),Bi$3(16,`div`,138),lC(17),vl$4()(),Bi$3(18,`div`,146)(19,`div`,56),lC(20),OC(21,`translate`),vl$4(),Bi$3(22,`div`,147),lC(23),OC(24,`translate`),vl$4()(),Bi$3(25,`div`,123)(26,`section`,124)(27,`div`,125),lC(28),OC(29,`translate`),vl$4(),Bi$3(30,`ol`,148),mw(31,vs,6,5,`li`,149,un),vl$4()(),Bi$3(33,`section`,124)(34,`div`,125),lC(35),OC(36,`translate`),vl$4(),Bi$3(37,`ol`,148),mw(38,bs,6,5,`li`,149,un),vl$4()()()()()),n&2){let e=xw().$implicit;sE(5),Cl$4(` `,LC(6,9,`planEditor.proposal.operationPreview`),` `),sE(3),ig(e.preview.label),sE(2),Cl$4(` `,LC(11,11,`planEditor.exerciseCatalog.action.reorder`),` `),sE(4),Cl$4(` `,LC(15,13,`planEditor.exerciseCatalog.location`),` `),sE(3),Cl$4(` `,e.preview.workout,` `),sE(3),Cl$4(` `,LC(21,15,`planEditor.exerciseReorder.positionLabel`),` `),sE(3),Cl$4(` `,FC(24,17,`planEditor.exerciseReorder.positionSummary`,_C(24,tl,e.preview.beforePosition,e.preview.afterPosition)),` `),sE(5),ig(LC(29,20,`planEditor.preview.before`)),sE(3),yw(e.preview.before),sE(4),ig(LC(36,22,`planEditor.preview.after`)),sE(3),yw(e.preview.after)}}function ws(n,t){if(n&1&&lC(0),n&2){let e=xw(2).$implicit;Cl$4(` `,e.preview.beforeCount,` `)}}function Ss(n,t){if(n&1&&lC(0),n&2){let e=xw(2).$implicit;Cl$4(` `,xw(4).formatEnduranceIntervalSummaryValue(e.preview.field,e.preview.beforeValue),` `)}}function Ps(n,t){if(n&1&&lC(0),n&2){let e=xw(2).$implicit;Cl$4(` `,e.preview.afterCount,` `)}}function Es(n,t){if(n&1&&lC(0),n&2){let e=xw(2).$implicit;Cl$4(` `,xw(4).formatEnduranceIntervalSummaryValue(e.preview.field,e.preview.afterValue),` `)}}function Ms(n,t){if(n&1&&(Bi$3(0,`span`,159),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw(6);sE(),Cl$4(` `,i.formatEnduranceIntervalRowLabel(e),` `)}}
7375function ks(n,t){if(n&1&&(Bi$3(0,`span`,164),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw().$implicit,s=xw(2).$implicit,u=xw(4);Yh$3(`endurance-interval-preview__cell--changed`,u.isChangedEnduranceIntervalCell(s.preview,i,`before`,e)),sE(),Cl$4(` `,u.formatEnduranceIntervalRowValue(e,u.getEnduranceIntervalRowValue(i,e)),` `)}}function Os(n,t){if(n&1&&(Bi$3(0,`div`,161)(1,`span`,162),lC(2),vl$4(),mw(3,ks,2,3,`span`,163,gw),vl$4()),n&2){let e=t.$implicit,i=xw(2).$implicit,s=xw(4);Yh$3(`endurance-interval-preview__row--changed`,s.isChangedEnduranceIntervalRow(i.preview,e,`before`)),sE(2),Cl$4(` `,e.interval,` `),sE(),yw(s.enduranceIntervalRowFields)}}function Is(n,t){if(n&1&&(Bi$3(0,`span`,159),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw(6);sE(),Cl$4(` `,i.formatEnduranceIntervalRowLabel(e),` `)}}function Ts(n,t){if(n&1&&(Bi$3(0,`span`,164),lC(1),vl$4()),n&2){let e=t.$implicit,i=xw().$implicit,s=xw(2).$implicit,u=xw(4);Yh$3(`endurance-interval-preview__cell--changed`,u.isChangedEnduranceIntervalCell(s.preview,i,`after`,e)),sE(),Cl$4(` `,u.formatEnduranceIntervalRowValue(e,u.getEnduranceIntervalRowValue(i,e)),` `)}}function Ns(n,t){if(n&1&&(Bi$3(0,`div`,161)(1,`span`,162),lC(2),vl$4(),mw(3,Ts,2,3,`span`,163,gw),vl$4()),n&2){let e=t.$implicit,i=xw(2).$implicit,s=xw(4);Yh$3(`endurance-interval-preview__row--changed`,s.isChangedEnduranceIntervalRow(i.preview,e,`after`)),sE(2),Cl$4(` `,e.interval,` `),sE(),yw(s.enduranceIntervalRowFields)}}function Rs(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,154)(2,`div`,155)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,156),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),vl$4()(),Bi$3(11,`div`,137)(12,`div`,56),lC(13),OC(14,`translate`),vl$4(),Bi$3(15,`div`,138),lC(16),vl$4()(),Bi$3(17,`div`,123)(18,`section`,124)(19,`div`,125),lC(20),OC(21,`translate`),vl$4(),Bi$3(22,`span`,126),fw(23,ws,1,1)(24,Ss,1,1),vl$4()(),Bi$3(25,`section`,124)(26,`div`,125),lC(27),OC(28,`translate`),vl$4(),Bi$3(29,`span`,126),fw(30,Ps,1,1)(31,Es,1,1),vl$4()()(),Bi$3(32,`div`,123)(33,`section`,124)(34,`div`,125),lC(35),OC(36,`translate`),vl$4(),Bi$3(37,`div`,157)(38,`div`,158)(39,`span`,159),lC(40),OC(41,`translate`),vl$4(),mw(42,Ms,2,1,`span`,159,gw),vl$4(),mw(44,Os,5,3,`div`,160,Io),vl$4()(),Bi$3(46,`section`,124)(47,`div`,125),lC(48),OC(49,`translate`),vl$4(),Bi$3(50,`div`,157)(51,`div`,158)(52,`span`,159),lC(53),OC(54,`translate`),vl$4(),mw(55,Is,2,1,`span`,159,gw),vl$4(),mw(57,Ns,5,3,`div`,160,Io),vl$4()()()()()),n&2){let e=xw().$implicit,i=xw(4);sE(5),Cl$4(` `,LC(6,13,`planEditor.proposal.operationPreview`),` `),sE(3),ig(e.preview.label),sE(2),Cl$4(` `,i.formatEnduranceIntervalField(e.preview.field),` `),sE(3),Cl$4(` `,LC(14,15,`planEditor.exerciseCatalog.location`),` `),sE(3),Cl$4(` `,e.preview.workout,` `),sE(4),ig(LC(21,17,`planEditor.preview.before`)),sE(3),pw(i.hasEnduranceIntervalCountSummary(e.preview)?23:24),sE(4),ig(LC(28,19,`planEditor.preview.after`)),sE(3),pw(i.hasEnduranceIntervalCountSummary(e.preview)?30:31),sE(5),ig(LC(36,21,`planEditor.preview.before`)),sE(5),Cl$4(` `,LC(41,23,`clientProfile.interval`),` `),sE(2),yw(i.enduranceIntervalRowFields),sE(2),yw(e.preview.before),sE(4),ig(LC(49,25,`planEditor.preview.after`)),sE(5),Cl$4(` `,LC(54,27,`clientProfile.interval`),` `),sE(2),yw(i.enduranceIntervalRowFields),sE(2),yw(e.preview.after)}}function Ds(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,165)(2,`div`,166)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,167),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),vl$4()(),Bi$3(11,`p`,30),lC(12),vl$4(),Bi$3(13,`div`,123)(14,`section`,124)(15,`div`,125),lC(16),OC(17,`translate`),vl$4(),Bi$3(18,`span`,126),lC(19),vl$4()(),Bi$3(20,`section`,124)(21,`div`,125),lC(22),OC(23,`translate`),vl$4(),Bi$3(24,`span`,126),lC(25),vl$4()()()()()),n&2){let e=xw().$implicit,i=xw(4);sE(5),Cl$4(` `,LC(6,8,`planEditor.proposal.operationPreview`),` `),sE(3),Cl$4(` `,e.preview.label,` `),sE(2),Cl$4(` `,i.formatExercisePrescriptionField(e.preview.field),` `),sE(2),ig(e.preview.workout),sE(4),ig(LC(17,10,`planEditor.preview.before`)),sE(3),Cl$4(` `,i.formatExercisePrescriptionValue(e.preview.field,e.preview.before),` `),sE(3),ig(LC(23,12,`planEditor.preview.after`)),sE(3),Cl$4(` `,i.formatExercisePrescriptionValue(e.preview.field,e.preview.after),` `)}}function As(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,168)(2,`div`,169)(3,`div`)(4,`div`,56),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`div`,170),lC(8),vl$4()(),Bi$3(9,`span`,53),lC(10),vl$4()(),Bi$3(11,`p`,30),lC(12),vl$4(),Bi$3(13,`div`,123)(14,`section`,124)(15,`div`,125),lC(16),OC(17,`translate`),vl$4(),Bi$3(18,`span`,126),lC(19),vl$4()(),Bi$3(20,`section`,124)(21,`div`,125),lC(22),OC(23,`translate`),vl$4(),Bi$3(24,`span`,126),lC(25),vl$4()()()()()),n&2){let e=xw().$implicit,i=xw(4);sE(5),Cl$4(` `,LC(6,8,`planEditor.proposal.operationPreview`),` `),sE(3),ig(e.preview.label),sE(2),ig(i.formatSetEditField(e.preview.field)),sE(2),ig(e.preview.workout),sE(4),ig(LC(17,10,`planEditor.preview.before`)),sE(3),ig(i.formatSetEditValue(e.preview.field,e.preview.before)),sE(3),ig(LC(23,12,`planEditor.preview.after`)),sE(3),ig(i.formatSetEditValue(e.preview.field,e.preview.after))}}function Bs(n,t){if(n&1&&(Bi$3(0,`section`,133)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Ph$3(4,128),vl$4()),n&2){let e=xw().$implicit;xw(4);let i=jw(40);sE(2),Cl$4(` `,LC(3,3,`planEditor.proposal.operationPreview`),` `),sE(2),Ah$2(`ngTemplateOutlet`,i)(`ngTemplateOutletContext`,bC(5,Et,e.preview))}}function Fs(n,t){if(n&1&&(Bi$3(0,`article`,130)(1,`div`,131)(2,`div`)(3,`div`,132),lC(4),vl$4(),Bi$3(5,`p`),lC(6),vl$4()(),Bi$3(7,`span`,52),lC(8),vl$4()(),fw(9,gs,32,21,`section`,133)(10,_s,32,21,`section`,133)(11,hs,48,29,`section`,133)(12,ys,40,27,`section`,133)(13,Rs,59,29,`section`,133)(14,Ds,26,14,`section`,133)(15,As,26,14,`section`,133)(16,Bs,5,7,`section`,133),vl$4()),n&2){let e=t.$implicit,i=xw(4);sE(4),ig(i.formatPreviewKey(e.operationType)),sE(2),ig(e.summary),sE(2),ig(i.formatPreviewKey(e.targetType)),sE(),pw(i.isExerciseAddOperationPreview(e.targetType,e.operationType,e.preview)?9:i.isExerciseRemoveOperationPreview(e.targetType,e.operationType,e.preview)?10:i.isExerciseSwapOperationPreview(e.targetType,e.operationType,e.preview)?11:i.isExerciseReorderOperationPreview(e.targetType,e.operationType,e.preview)?12:i.isEnduranceIntervalOperationPreview(e.targetType,e.operationType,e.preview)?13:i.isExercisePrescriptionOperationPreview(e.targetType,e.operationType,e.preview)?14:i.isSetEditOperationPreview(e.targetType,e.preview)?15:i.hasPreview(e.preview)?16:-1)}}function Ls(n,t){if(n&1&&(Bi$3(0,`section`,103)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,129),mw(5,Fs,17,4,`article`,130,_n),vl$4()()),n&2){let e=xw(2);sE(2),ig(LC(3,1,`planEditor.proposal.operationsTitle`)),sE(3),yw(e.operations)}}function Vs(n,t){if(n&1&&(Bi$3(0,`div`,81),fw(1,ms,49,33),fw(2,us,5,7,`section`,103),fw(3,Ls,7,3,`section`,103),vl$4()),n&2){let e,i,s=xw(),u=xw();sE(),pw((e=u.batchAdjustmentProposalPreview(s))?1:-1,e),sE(),pw((i=u.filteredProposalPreview(s))?2:-1,i),sE(),pw(s.operations.length?3:-1)}}function Ws(n,t){n&1&&(Bi$3(0,`p`,30),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`planEditor.proposal.expired`)))}function Hs(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,82)(1,`button`,171),jh$3(`click`,function(){ld$2(e);return ud$1(xw(2).rejectProposal())}),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`button`,172),jh$3(`click`,function(){ld$2(e);return ud$1(xw(2).confirmProposal())}),lC(5),OC(6,`translate`),vl$4()()}if(n&2){let e=xw(2);sE(),Ah$2(`disabled`,e.isApplyingProposal()||e.isNarrowingProposal()),sE(),Cl$4(` `,LC(3,4,`planEditor.proposal.reject`),` `),sE(2),Ah$2(`disabled`,e.isApplyingProposal()||e.isNarrowingProposal()),sE(),Cl$4(` `,LC(6,6,`planEditor.proposal.confirm`),` `)}}function $s(n,t){if(n&1&&(Bi$3(0,`section`,18)(1,`div`,28)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`,53),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`section`,76)(9,`div`,56),lC(10),OC(11,`translate`),vl$4(),Bi$3(12,`p`,77),lC(13),vl$4()(),Bi$3(14,`div`,78)(15,`span`),lC(16),OC(17,`translate`),vl$4(),Bi$3(18,`span`),lC(19),OC(20,`date`),OC(21,`translate`),vl$4()(),fw(22,zl,1,1),fw(23,Ql,21,20,`section`,79),fw(24,Xl,6,4,`div`,80),fw(25,Vs,4,3,`div`,81),fw(26,Ws,3,3,`p`,30)(27,Hs,7,8,`div`,82),vl$4()),n&2){let e,i,s=t,u=xw();sE(3),ig(LC(4,13,`planEditor.proposal.title`)),sE(2),Xw(`status-chip status-chip--`+u.lifecycleTone(s.status)),sE(),Cl$4(` `,LC(7,15,`planEditor.proposal.status.`+s.status),` `),sE(4),ig(LC(11,17,`planEditor.proposal.summaryTitle`)),sE(3),ig(s.summary),sE(3),ig(FC(17,19,`planEditor.proposal.operationCount`,bC(28,le,
7375s.operations.length))),sE(3),ig(FC(21,25,`planEditor.proposal.expiresAt`,bC(30,Pt,FC(20,22,s.expiresAt,`short`)))),sE(3),pw((e=u.proposalHighlights(s))?22:-1,e),sE(),pw((i=u.semanticRemoveProposalPreview(s))?23:-1,i),sE(),pw(u.hasProposalDetails(s)?24:-1),sE(),pw(u.isProposalDetailsExpanded(s)?25:-1),sE(),pw(!u.isProposalActionable()&&(s.status===`expired`||u.isProposalExpired())?26:u.isProposalActionable()?27:-1)}}function zs(n,t){if(n&1&&(Bi$3(0,`section`,20)(1,`div`,28)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`,53),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`p`),lC(9),OC(10,`translate`),vl$4(),Bi$3(11,`p`,173),lC(12),vl$4()()),n&2){let e=t,i=xw();sE(3),ig(LC(4,6,`planEditor.lifecycle.title`)),sE(2),Xw(`status-chip status-chip--`+i.lifecycleTone(e.status)),sE(),Cl$4(` `,LC(7,8,`planEditor.lifecycle.status.`+e.status),` `),sE(3),ig(LC(10,10,`planEditor.lifecycle.description.`+e.status)),sE(3),ig(e.message)}}function Us(n,t){if(n&1&&(Bi$3(0,`span`),lC(1),OC(2,`date`),OC(3,`translate`),vl$4()),n&2){let e=xw();sE(),ig(FC(3,4,`planEditor.changeHistory.undoneAt`,bC(7,Pt,FC(2,1,e.undoneAt,`short`))))}}function js(n,t){if(n&1&&(Bi$3(0,`div`,30),lC(1),vl$4()),n&2){let e=xw().$implicit;sE(),ig(e.workoutLabel)}}function Ks(n,t){if(n&1&&(Bi$3(0,`span`,52),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw().$implicit;sE(),Cl$4(` `,FC(2,1,`planEditor.batch.setNumber`,bC(4,Do,e.setNumber)),` `)}}function qs(n,t){if(n&1&&(Bi$3(0,`p`,179),lC(1),vl$4()),n&2){let e=xw().$implicit;sE(),ig(e.summary)}}function Gs(n,t){if(n&1&&(Bi$3(0,`div`,121)(1,`div`,178)(2,`div`,122),lC(3),vl$4(),fw(4,Ks,3,6,`span`,52),vl$4(),fw(5,qs,2,1,`p`,179),Bi$3(6,`div`,123)(7,`section`,124)(8,`div`,125),lC(9),OC(10,`translate`),vl$4(),Bi$3(11,`span`,126),lC(12),vl$4()(),Bi$3(13,`section`,124)(14,`div`,125),lC(15),OC(16,`translate`),vl$4(),Bi$3(17,`span`,126),lC(18),vl$4()()()()),n&2){let e=t.$implicit,i=xw(4);sE(3),Cl$4(` `,i.formatChangeHistoryLabel(e),` `),sE(),pw(e.setNumber!==null&&e.setNumber!==void 0?4:-1),sE(),pw(i.shouldShowChangeHistorySummary(e)?5:-1),sE(4),ig(LC(10,7,`planEditor.preview.before`)),sE(3),Cl$4(` `,i.formatPreviewPrimitive(e.before),` `),sE(3),ig(LC(16,9,`planEditor.preview.after`)),sE(3),Cl$4(` `,i.formatPreviewPrimitive(e.after),` `)}}function Ys(n,t){if(n&1&&(Bi$3(0,`article`,176)(1,`div`,118)(2,`div`,177)(3,`div`,119),lC(4),vl$4(),fw(5,js,2,1,`div`,30),vl$4(),Bi$3(6,`span`,53),lC(7),OC(8,`translate`),vl$4()(),Bi$3(9,`div`,120),mw(10,Gs,19,11,`div`,121,hw),vl$4()()),n&2){let e=t.$implicit,i=xw(3);sE(4),ig(e.exerciseName),sE(),pw(e.workoutLabel?5:-1),sE(2),Cl$4(` `,FC(8,3,`planEditor.batch.operationCount`,bC(6,le,i.changeHistoryChanges(e).length)),` `),sE(3),yw(i.changeHistoryChanges(e))}}function Zs(n,t){if(n&1&&(Bi$3(0,`section`,103)(1,`div`,56),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`div`,175),mw(5,Ys,12,8,`article`,176,hw),vl$4()()),n&2){let e=xw(),i=xw();sE(2),ig(LC(3,1,`planEditor.changeHistory.detailsTitle`)),sE(3),yw(i.changeHistoryExercises(e))}}function Js(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,60)(1,`button`,180),jh$3(`click`,function(){ld$2(e);return ud$1(xw(2).undoLatestAction())}),lC(2),OC(3,`translate`),vl$4()()}if(n&2){let e=xw(2);sE(),Ah$2(`disabled`,e.isUndoing()||e.isSending()),sE(),Cl$4(` `,LC(3,2,`planEditor.changeHistory.undo`),` `)}}function Qs(n,t){if(n&1&&(Bi$3(0,`section`,21)(1,`div`,28)(2,`h3`),lC(3),OC(4,`translate`),vl$4(),Bi$3(5,`span`,53),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`section`,174)(9,`div`,56),lC(10),OC(11,`translate`),vl$4(),Bi$3(12,`p`,77),lC(13),vl$4()(),Bi$3(14,`div`,78)(15,`span`),lC(16),OC(17,`translate`),vl$4(),Bi$3(18,`span`),lC(19),OC(20,`date`),OC(21,`translate`),vl$4(),fw(22,Us,4,9,`span`),vl$4(),Bi$3(23,`section`,103)(24,`div`,56),lC(25),OC(26,`translate`),vl$4(),Bi$3(27,`p`,30),lC(28),OC(29,`translate`),vl$4()(),fw(30,Zs,7,3,`section`,103),fw(31,Js,4,4,`div`,60),vl$4()),n&2){let e=t,i=xw();sE(3),ig(LC(4,13,`planEditor.changeHistory.title`)),sE(2),Xw(`status-chip status-chip--`+i.changeHistoryTone(e.status)),sE(),Cl$4(` `,LC(7,15,`planEditor.changeHistory.status.`+e.status),` `),sE(4),ig(LC(11,17,`planEditor.changeHistory.summaryTitle`)),sE(3),ig(e.summary),sE(3),ig(FC(17,19,`planEditor.proposal.operationCount`,bC(32,le,e.operationCount))),sE(3),ig(FC(21,25,`planEditor.changeHistory.createdAt`,bC(34,Pt,FC(20,22,e.createdAt,`short`)))),sE(3),pw(e.undoneAt?22:-1),sE(3),ig(LC(26,28,`planEditor.changeHistory.coverageTitle`)),sE(3),ig(LC(29,30,`planEditor.changeHistory.coverage.`+e.coverageScope)),sE(2),pw(i.changeHistoryExercises(e).length?30:-1),sE(),pw(e.canUndo?31:-1)}}function Xs(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,184),jh$3(`click`,function(){let s=ld$2(e).$implicit;return ud$1(xw(3).chooseUnsupportedAlternative(s))}),Bi$3(1,`span`,48),lC(2),vl$4()()}if(n&2){let e=t.$implicit,i=xw(3);Ah$2(`disabled`,i.isSending()||i.isApplyingProposal()||i.isUndoing()),sE(2),ig(e)}}function ep(n,t){if(n&1&&(Bi$3(0,`div`,50),lC(1),OC(2,`translate`),vl$4(),Bi$3(3,`p`,30),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`div`,182),mw(7,Xs,3,2,`button`,183,gw),vl$4()),n&2){let e=xw(2);sE(),Cl$4(` `,LC(2,2,`planEditor.unsupported.alternativesTitle`),` `),sE(3),ig(LC(5,4,`planEditor.unsupported.alternativesHint`)),sE(3),yw(e.supportedUnsupportedAlternatives())}}function tp(n,t){if(n&1){let e=Cw();Bi$3(0,`section`,22)(1,`h3`),lC(2),vl$4(),Bi$3(3,`p`),lC(4),vl$4(),fw(5,ep,9,6),Bi$3(6,`p`,30),lC(7),OC(8,`translate`),vl$4(),Bi$3(9,`div`,60)(10,`button`,181),jh$3(`click`,function(){ld$2(e);return ud$1(xw().openCoachChat())}),lC(11),OC(12,`translate`),vl$4()()()}if(n&2){let e=xw();sE(2),ig(e.unsupportedScopeTitle()),sE(2),ig(t.explanation),sE(),pw(e.supportedUnsupportedAlternatives().length?5:-1),sE(2),ig(LC(8,5,`planEditor.unsupported.scopeHint`)),sE(4),Cl$4(` `,LC(12,7,`planEditor.unsupported.openCoachChat`),` `)}}function np(n,t){if(n&1&&(Bi$3(0,`section`,23)(1,`h3`),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`p`),lC(5),vl$4()()),n&2){let e=xw();sE(2),ig(LC(3,2,`planEditor.error.title`)),sE(3),ig(e.error())}}function ip(n,t){n&1&&Rh$3(0,`app-ai-quota-exhausted-panel`)}function ap(n,t){n&1&&(Bi$3(0,`p`,185),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),Cl$4(` `,LC(2,1,`planEditor.composerLocked`),` `))}function op(n,t){if(n&1){let e=Cw();fw(0,ap,3,3,`p`,185),Bi$3(1,`textarea`,186),dg(`ngModelChange`,function(s){ld$2(e);let u=xw();return gC(u.inputText,s)||(u.inputText=s),ud$1(s)}),jh$3(`keydown`,function(s){ld$2(e);return ud$1(xw().onComposerKeydown(s))}),vl$4(),WE(),Bi$3(2,`div`,187)(3,`span`,30),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`button`,188),jh$3(`click`,function(){ld$2(e);return ud$1(xw().send())}),lC(7),vl$4()()}if(n&2){let e=xw();pw(e.hasStableContext()?-1:0),sE(),ug(`ngModel`,e.inputText),Ah$2(`placeholder`,e.composerPlaceholder())(`disabled`,!e.hasStableContext()||e.isSending()||e.isApplyingProposal()||e.isUndoing()),zE(),sE(3),Cl$4(` `,e.hasStableContext()?e.composerHint():LC(5,7,`planEditor.composerLocked`),` `),sE(2),Ah$2(`disabled`,!e.canSend()||e.isApplyingProposal()||e.isUndoing()),sE(),Cl$4(` `,e.sendButtonLabel(),` `)}}function rp(n,t){if(n&1&&(Bi$3(0,`section`,124)(1,`div`,125),lC(2),vl$4(),Ph$3(3,128),vl$4()),n&2){let e=t.$implicit,i=xw(4),s=jw(40);sE(2),ig(i.formatPreviewKey(e.key)),sE(),Ah$2(`ngTemplateOutlet`,s)(`ngTemplateOutletContext`,bC(3,Et,e.value))}}function lp(n,t){if(n&1&&(Bi$3(0,`div`,123),mw(1,rp,4,5,`section`,124,ti),vl$4()),n&2){let e=xw(2).$implicit,i=xw();sE(),yw(i.previewEntries(e))}}function sp(n,t){if(n&1&&lC(0),n&2){let e=xw().$implicit;Cl$4(` `,xw(4).formatPreviewPrimitive(e.value),` `)}}function pp(n,t){if(n&1&&Ph$3(0,128),n&2){let e=xw().$implicit;xw(4);Ah$2(`ngTemplateOutlet`,jw(40))(`ngTemplateOutletContext`,bC(2,Et,e.value))}}function cp(n,t){if(n&1&&(Bi$3(0,`div`,106)(1,`dt`),lC(2),vl$4(),Bi$3(3,`dd`),fw(4,sp,1,1)(5,pp,1,4,`ng-container`,128),vl$4()()),n&2){let e=t.$implicit,i=xw(4);sE(2),ig(i.formatPreviewKey(e.key)),sE(2),pw(i.isPreviewPrimitive(e.value)?4:5)}}function dp(n,t){if(n&1&&(Bi$3(0,`dl`,105),mw(1,cp,6,2,`div`,106,ti),vl$4()),n&2){let e=xw(2).$implicit,i=xw();sE(),yw(i.previewEntries(e))}}function mp(n,t){if(n&1&&fw(0,lp,3,0,`div`,123)(1,dp,3,0,`dl`,105),n&2){let e=xw().$implicit;pw(xw().isBeforeAfterPreview(e)?0:1)}}function up(n,t){if(n&1&&lC(0),n&2){let e=xw().$implicit;Cl$4(` `,xw(3).formatPreviewPrimitive(e),` `)}}function gp(n,t){if(n&1&&Ph$3(0,128),n&2){let e=xw().$implicit;xw(3);Ah$2(`ngTemplateOutlet`,jw(40))(`ngTemplateOutletContext`,bC(2,Et,e))}}function _p(n,t){if(n&1&&(Bi$3(0,`div`,190),fw(1,up,1,1)(2,gp,1,4,`ng-container`,128),vl$4()),n&2){let e=t.$implicit,i=xw(3);sE(),pw(i.isPreviewPrimitive(e)?1:2)}}function fp(n,t){if(n&1&&(Bi$3(0,`div`,189),mw(1,_p,3,1,`div`,190,hw),vl$4()),n&2){let e=xw().$implicit;sE(),yw(e)}}function hp(n,t){if(n&1&&(Bi$3(0,`span`,126),lC(1),vl$4()),n&2){let e=xw().$implicit,i=xw();sE(),ig(i.formatPreviewPrimitive(e))}}function xp(n,t){if(n&1&&fw(0,mp,2,1)(1,fp,3,0,`div`,189)(2,hp,2,1,`span`,126),n&2){let e=t.$implicit,i=xw();pw(i.isPreviewObject(e)?0:i.isPreviewArray(e)?1:2)}}var gn=class n{chatState=E(Ln$5);clientDataService=E(E$2);trainingService=E(Se$3);translateService=E(Gr$5);aiQuotaService=E(f$2);athleteOptionsRequested=!1;loadedProgramAthleteIds=new Set;expandedProposalId=ni$3(null);lastSwapReview=null;programLoadSequence=0;planEditorState=E(gt$6);enduranceIntervalRowFields=[`duration`,`distance`,`recovery`,`heartRateZone`];messagesContainer;inputText=ni$3(``);context=this.planEditorState.context;messages=this.planEditorState.messages;clarification=this.planEditorState.clarification;changeHistory=this.planEditorState.changeHistory;proposal=this.planEditorState.proposal;swapReview=this.planEditorState.swapReview;proposalLifecycle=this.planEditorState.proposalLifecycle;unsupported=this.planEditorState.unsupported;history=this.planEditorState.history;error=this.planEditorState.error;isSending=this.planEditorState.isSending;isLoadingHistory=this.planEditorState.isLoadingHistory;isApplyingProposal=this.planEditorState.isApplyingProposal;isNarrowingProposal=this.planEditorState.isNarrowingProposal;isSelectingSwap=this.planEditorState.isSelectingSwap;isUndoing=this.planEditorState.isUndoing;hasStableContext=this.planEditorState.hasStableContext;latestUndoableAction=this.planEditorState.latestUndoableAction;isProposalExpired=this.planEditorState.isProposalExpired;isLoadingAthletes=ni$3(!1);isLoadingPrograms=ni$3(!1);semanticSwapSelections=ni$3({});isProposalActionable=$C(()=>{let t=this.proposal();
7375return!!t&&t.status===`pending`&&!this.isProposalExpired()});availableAthletes=$C(()=>[...this.clientDataService.clientsData().values()].map(t=>({id:t.id,name:t.clientName?.trim()||this.translateService.instant(`planEditor.context.athleteFallback`,{athleteId:t.id})})).sort((t,e)=>t.name.localeCompare(e.name,void 0,{sensitivity:`base`})));availablePrograms=$C(()=>{let t=this.context()?.athleteId;return t==null?[]:[...this.trainingService.workoutPrograms().get(t)??[]].sort((e,i)=>new Date(e.start).getTime()-new Date(i.start).getTime())});selectedAthleteName=$C(()=>{let t=this.context();return t?.athleteName?.trim()?t.athleteName.trim():t?.athleteId==null?null:this.availableAthletes().find(e=>e.id===t.athleteId)?.name??this.translateService.instant(`planEditor.context.athleteFallback`,{athleteId:t.athleteId})});selectedProgramName=$C(()=>{let t=this.context();if(t?.programName?.trim())return t.programName.trim();if(t?.programId==null)return null;let e=this.availablePrograms().find(i=>i.id===t.programId);return e?this.formatProgramOptionLabel(e):this.translateService.instant(`planEditor.context.programFallback`,{programId:t.programId})});unsupportedScopeTitle=$C(()=>this.translateService.instant(`planEditor.unsupported.scopeTitle`));supportedUnsupportedAlternatives=$C(()=>(this.unsupported()?.supportedAlternatives??[]).filter(t=>t.trim().length>0));canSend=$C(()=>this.inputText().trim().length>0&&!this.isSending()&&!this.isSelectingSwap()&&this.hasStableContext());composerPlaceholder=$C(()=>this.translateService.instant(`planEditor.placeholder`));composerHint=$C(()=>this.translateService.instant(`planEditor.composerHint`));sendButtonLabel=$C(()=>this.translateService.instant(`planEditor.send`));clarificationHasOptions=$C(()=>(this.clarification()?.options?.length??0)>0);clarificationNeedsExplicitContext=$C(()=>(this.clarification()?.requiredContext?.length??0)>0);canSubmitSemanticSwap=$C(()=>{let t=this.swapReview()?.targets??[],e=this.semanticSwapSelections();return t.length>0&&t.every(i=>(i.candidates??[]).some(s=>s.exerciseId===e[i.workoutExerciseId]))});closed=z1();constructor(){xd$2(()=>{let t=this.messages().length,e=this.isSending(),i=this.clarification(),s=this.proposal();(t>=0||e||i||s)&&this.scrollToBottom()}),xd$2(()=>{this.hasStableContext()||this.ensureAthletesLoaded()}),xd$2(()=>{let t=this.context()?.athleteId;t!=null?this.ensureProgramsLoaded(t):this.isLoadingPrograms.set(!1)}),xd$2(()=>{let t=this.swapReview();t!==this.lastSwapReview&&(this.lastSwapReview=t,this.semanticSwapSelections.set({}))})}send(){return ps$4(this,null,function*(){let t=this.inputText().trim();!t||!this.canSend()||(this.inputText.set(``),yield this.submitPrompt(t))})}chooseClarificationOption(t){return ps$4(this,null,function*(){let e=this.clarification()?.options?.find(i=>i.id===t);e&&(yield this.planEditorState.chooseClarificationOption(e))})}chooseUnsupportedAlternative(t){return ps$4(this,null,function*(){t.trim()&&(yield this.submitPrompt(t))})}confirmProposal(){return ps$4(this,null,function*(){yield this.planEditorState.confirmProposal()})}rejectProposal(){return ps$4(this,null,function*(){yield this.planEditorState.rejectProposal()})}selectSemanticSwapReplacement(t,e){let i=Number(e),s=(t.candidates??[]).some(u=>u.exerciseId===i);this.semanticSwapSelections.update(u=>{if(Number.isFinite(i)&&s)return W$4(q$1({},u),{[t.workoutExerciseId]:i});let v=q$1({},u);return delete v[t.workoutExerciseId],v})}semanticSwapSelection(t){return this.semanticSwapSelections()[t.workoutExerciseId]??``}submitSemanticSwapSelections(t){return ps$4(this,null,function*(){if(!this.canSubmitSemanticSwap()||this.isSelectingSwap())return;let e=(t.targets??[]).flatMap(i=>{let s=this.semanticSwapSelections()[i.workoutExerciseId];return s==null?[]:[{workoutExerciseId:i.workoutExerciseId,replacementExerciseId:s}]});yield this.planEditorState.selectSwapReplacements(e)})}discardSemanticSwapReview(){this.planEditorState.discardSwapReview()}deselectSemanticRemoveOperation(t,e){return ps$4(this,null,function*(){let i=this.semanticRemoveOperationIds(t).filter(s=>s!==e);i.length!==0&&(yield this.planEditorState.narrowProposal(i))})}undoLatestAction(){return ps$4(this,null,function*(){yield this.planEditorState.undoLatestAction()})}clearConversation(){this.inputText.set(``),this.planEditorState.clearConversation()}
7375close(){this.closed.emit()}selectAthlete(t){return ps$4(this,null,function*(){let e=Number(t);if(!Number.isFinite(e)){this.planEditorState.openWorkspace({source:this.context()?.source??`top-navigation`,athleteId:null,athleteName:null,programId:null,programName:null});return}let i=this.availableAthletes().find(s=>s.id===e);this.planEditorState.openWorkspace({source:this.context()?.source??`top-navigation`,athleteId:e,athleteName:i?.name??this.translateService.instant(`planEditor.context.athleteFallback`,{athleteId:e}),programId:null,programName:null}),yield this.ensureProgramsLoaded(e,!0)})}selectProgram(t){let e=Number(t);if(!Number.isFinite(e)){this.planEditorState.openWorkspace({source:this.context()?.source??`top-navigation`,athleteId:this.context()?.athleteId??null,athleteName:this.context()?.athleteName??null,programId:null,programName:null});return}let i=this.availablePrograms().find(s=>s.id===e);i&&this.planEditorState.openWorkspace({source:this.context()?.source??`top-navigation`,athleteId:this.context()?.athleteId??null,athleteName:this.context()?.athleteName??null,programId:i.id,programName:this.formatProgramOptionLabel(i)})}openCoachChat(){this.planEditorState.closeWorkspace(),this.chatState.openPanel()}onComposerKeydown(t){t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),this.send())}formatRequiredContext(t){switch(t){case`athleteId`:return this.translateService.instant(`planEditor.context.athlete`);case`programId`:return this.translateService.instant(`planEditor.context.program`);default:return t}}hasPreview(t){return this.isPreviewArray(t)?t.length>0:this.isPreviewObject(t)?Object.keys(t).length>0:t!=null&&t!==``}isPreviewArray(t){return Array.isArray(t)}isPreviewObject(t){return typeof t==`object`&&t!==null&&!Array.isArray(t)}isPreviewPrimitive(t){return!this.isPreviewArray(t)&&!this.isPreviewObject(t)}previewEntries(t){return Object.entries(t).filter(([,e])=>e!==void 0).sort(([e],[i])=>this.comparePreviewKeys(e,i)).map(([e,i])=>({key:e,value:i}))}filteredProposalPreview(t){if(!this.isPreviewObject(t.preview))return null;let e=this.previewEntries(t.preview).filter(({key:i})=>i!==`summary`&&i!==`operationCount`&&i!==`operations`&&i!==`batch`&&i!==`catalogExerciseId`&&i!==`beforeOrder`&&i!==`afterOrder`&&i!==`beforePosition`&&i!==`afterPosition`&&i!==`locator`);return e.length>0?Object.fromEntries(e.map(({key:i,value:s})=>[i,s])):null}hasProposalDetails(t){return this.batchProposalPreview(t)!=null||this.filteredProposalPreview(t)!=null||t.operations.length>0}isProposalDetailsExpanded(t){return this.expandedProposalId()===t.id}toggleProposalDetails(t){this.hasProposalDetails(t)&&this.expandedProposalId.update(e=>e===t.id?null:t.id)}proposalHighlights(t){let e=this.batchProposalPreview(t);return!e||!this.isBatchAdjustmentProposalPreview(e)?[]:[{key:`field`,label:this.translateService.instant(`planEditor.batch.field`),value:this.formatBatchField(e.fieldName)},{key:`affectedCount`,label:this.translateService.instant(`planEditor.batch.affectedCount`),value:this.formatBatchAffectedCount(e)},{key:`selector`,label:this.translateService.instant(`planEditor.batch.selector`),value:this.formatBatchSelectorSummary(e)},{key:`dateRange`,label:this.translateService.instant(`planEditor.batch.dateRange`),value:this.formatBatchDateRangeSummary(e)},{key:`adjustment`,label:this.translateService.instant(`planEditor.batch.adju
7375stment`),value:this.formatBatchAdjustmentSummary(e)}].filter(i=>i.value.trim().length>0)}batchProposalPreview(t){return Fr$3(t)}batchAdjustmentProposalPreview(t){let e=this.batchProposalPreview(t);return e&&this.isBatchAdjustmentProposalPreview(e)?e:null}semanticRemoveProposalPreview(t){return gi$3(t)}isBatchAdjustmentProposalPreview(t){return t.capabilityKey!==`batch_exercise_changes`}semanticRemoveOperationIds(t){return t.membership.workouts.flatMap(e=>e.remove.map(i=>i.operationId))}isSemanticRemoveDeselectDisabled(t){return this.isNarrowingProposal()||this.semanticRemoveOperationIds(t).length<=1}formatSemanticRemoveAttributes(t){return t.matchedAttributes.map(e=>this.formatPreviewKey(e)).join(` · `)}formatSemanticRemoveKeepReason(t){return this.formatBatchExclusionReason({reasonCode:t,count:0,examples:[]})}semanticRemoveExcludedCount(t){return t.exclusions.reduce((e,i)=>e+i.count,0)}semanticSwapTargets(t){return t.targets??[]}semanticSwapCandidates(t){return t.candidates??[]}semanticSwapExclusions(t){let e=[];for(let i of t.exclusions??[]){let s=i.reasonCode,u=i.count,v=i.examples;typeof s==`string`&&typeof u==`number`&&Array.isArray(v)&&v.every(S=>typeof S==`string`)&&e.push({reasonCode:s,count:u,examples:v})}return e}semanticSwapExcludedCount(t){return this.semanticSwapExclusions(t).reduce((e,i)=>e+i.count,0)}formatSemanticSwapAttributes(t){return(t.matchedAttributes??[]).map(e=>this.formatPreviewKey(e)).join(` · `)}formatSemanticSwapAvoidAttributes(t){return(t.avoidLoadAttributes??[]).map(e=>this.formatPreviewKey(e)).join(` · `)}formatSemanticSwapCandidate(t){return t.name?.trim()||this.translateService.instant(`planEditor.semanticSwap.candidateFallback`,{exerciseId:t.exerciseId})}formatSemanticSwapDateRange(t){return t.dateRange?this.translateService.instant(`planEditor.batch.dateRangeValue`,{start:t.dateRange.startDate,end:t.dateRange.endDate}):null}formatBatchSelectorSummary(t){let e=[t.selector.bodyRegion?this.formatPreviewKey(t.selector.bodyRegion):null,t.selector.movementPattern?this.formatPreviewKey(t.selector.movementPattern):null].filter(i=>!!i);return e.length?e.join(` · `):this.translateService.instant(`planEditor.batch.selectorFallback`)}shouldShowRequestedBatchStartDate(t){return typeof t.dateRange.requestedStartDate==`string`&&t.dateRange.requestedStartDate!==t.dateRange.startDate}formatBatchDateRangeSummary(t){let e=this.translateService.instant(`planEditor.batch.dateRangeValue`,{start:t.dateRange.startDate,end:t.dateRange.endDate});return this.shouldShowRequestedBatchStartDate(t)?`${e} \xB7 ${this.translateService.instant(`planEditor.batch.requestedStartDate`,{date:t.dateRange.requestedStartDate})}`:e}formatBatchAdjustmentSummary(t){if(t.adjustment.kind===`relative_percent`){let u=t.adjustment.percentDelta;return`${u>0?`+`:``}${u}%`}let e=t.adjustment.valueDelta,i=e>0?`+`:``,s=Math.abs(e);switch(t.fieldName){case`distance`:return`${i}${s} ${t.roundingRule.unitLabel??`m`}`;case`duration`:return`${i}${T$5(s)}`;case`rpe`:return`${i}${s} ${this.translateService.instant(`planEditor.exerciseEdit.field.rpe`)}`;default:return`${i}${s}`}}formatBatchExclusionReason(t){let e=`planEditor.batch.exclusionReason.${t.reasonCode}`,i=this.translateService.instant(e);return i===e?this.formatPreviewKey(t.reasonCode):i}formatBatchField(t){switch(t){case`rpe`:return this.translateService.instant(`planEditor.exerciseEdit.field.rpe`);case`weight`:return this.translateService.instant(`planEditor.setEdit.field.weight`);case`repetitions`:return this.translateService.instant(`planEditor.setEdit.field.repetitions`);case`distance`:return this.translateService.instant(`planEditor.setEdit.field.distance`);case`duration`:return this.translateService.instant(`planEditor.setEdit.field.duration`)}}formatBatchAffectedCount(t){let e=this.countBatchAffectedItems(t),i=t.fieldName===`rpe`?`planEditor.batch.affectedExercises`:`planEditor.batch.affectedSets`;return this.translateService.instant(i,{count:e})}formatBatchOperationCount(t){return this.translateService.instant(`planEditor.batch.operationCount`,{count:t})}changeHistoryTone(t){return t===`applied`?`success`:`warning`}formatChangeHistoryLabel(t){return typeof t.field==`string`&&t.field.trim().length>0?this.formatChangeHistoryField(t.field):typeof t.summary==`string`&&t.summary.trim().length>0?t.summary:this.translateService.instant(`planEditor.changeHistory.fieldFallback`)}shouldShowChangeHistorySummary(t){return typeof t.field==`string`&&t.field.trim().length>0&&typeof t.summary==`string`&&t.summary.trim().length>0}changeHistoryExercises(t){return t.exercises??[]}changeHistoryChanges(t){return t.changes??[]}formatChangeHistoryField(t){let e=this.normalizeExercisePrescriptionField(t);switch(e){case`weight`:case`load`:case`repetitions`:case`distance`:case`duration`:return this.formatSetEditField(e);case`rpe`:case`setRecovery`:case`heartRateZone`:return this.formatExercisePrescriptionField(e);case`intervalCount`:return this.formatEnduranceIntervalField(e);case`idx`:return this.translateService.instant(`planEditor.exerciseReorder.positionLabel`);default:return this.formatPreviewKey(t)}}formatBatchOperationValue(t,e){switch(t){case`duration`:return this.formatDurationClockValue(e);case`distance`:case`repetitions`:return this.formatBatchIntegerValue(e);case`rpe`:return this.formatRpeValue(e);default:return this.formatPreviewPrimitive(e)}}shouldShowBatchOperationLabel(t,e){return t.setNumber!=null||e>1&&!!t.label?.trim()}isBeforeAfterPreview(t){return`before`in t||`after`in t}
7375isSetEditOperationPreview(t,e){return t===`set`&&hi$3(e)}isExerciseAddOperationPreview(t,e,i){return t===`workout`&&e===`add_exercise`&&bi$2(i)}isExerciseRemoveOperationPreview(t,e,i){return t===`exercise`&&e===`remove_exercise`&&yi$3(i)}isExerciseSwapOperationPreview(t,e,i){return t===`exercise`&&e===`swap_exercise`&&vi$3(i)}isExerciseReorderOperationPreview(t,e,i){return t===`exercise`&&e===`update_exercise`&&_i$3(i)}isEnduranceIntervalOperationPreview(t,e,i){return(t===`exercise`&&e===`update_exercise`||t===`interval`&&e===`update_set`)&&Pi$3(i)}isExercisePrescriptionOperationPreview(t,e,i){return t===`exercise`&&e===`update_exercise`&&fi$3(i)}formatPreviewKey(t){switch(t){case`before`:return this.translateService.instant(`planEditor.preview.before`);case`after`:return this.translateService.instant(`planEditor.preview.after`);default:return t.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase())}}formatPreviewPrimitive(t){return t==null?`-`:typeof t==`boolean`?t?`Yes`:`No`:typeof t==`string`||typeof t==`number`?String(t):JSON.stringify(t)}formatSetEditValue(t,e){return t===`duration`?this.formatDurationClockValue(e):t===`distance`&&typeof e==`number`?`${e}`:t===`repetitions`&&typeof e==`number`?`${e}`:this.formatPreviewPrimitive(e)}formatSetEditField(t){switch(t){case`repetitions`:return this.translateService.instant(`planEditor.setEdit.field.repetitions`);case`weight`:case`load`:return this.translateService.instant(`planEditor.setEdit.field.weight`);case`duration`:return this.translateService.instant(`planEditor.setEdit.field.duration`);case`distance`:return this.translateService.instant(`planEditor.setEdit.field.distance`);default:return this.formatPreviewKey(t)}}formatExercisePrescriptionField(t){switch(this.normalizeExercisePrescriptionField(t)){case`rpe`:return this.translateService.instant(`planEditor.exerciseEdit.field.rpe`);case`setRecovery`:return this.translateService.instant(`planEditor.exerciseEdit.field.setRecovery`);case`heartRateZone`:return this.translateService.instant(`planEditor.exerciseEdit.field.heartRateZone`);default:return this.formatPreviewKey(t)}}formatEnduranceIntervalField(t){switch(t){case`intervalCount`:return this.translateService.instant(`planEditor.enduranceInterval.field.intervalCount`);case`duration`:return this.translateService.instant(`planEditor.setEdit.field.duration`);case`distance`:return this.translateService.instant(`planEditor.setEdit.field.distance`);case`setRecovery`:return this.translateService.instant(`planEditor.exerciseEdit.field.setRecovery`);case`heartRateZone`:return this.translateService.instant(`planEditor.exerciseEdit.field.heartRateZone`);default:return this.formatPreviewKey(t)}}formatExerciseSwapStructureKind(t){return t===`interval`?this.translateService.instant(`planEditor.exerciseSwap.structureKind.interval`):this.translateService.instant(`planEditor.exerciseSwap.structureKind.set`)}formatExerciseReorderItemLabel(t){return t.label?.trim()?t.label:this.translateService.instant(`planEditor.exerciseReorder.exerciseFallback`)}hasEnduranceIntervalCountSummary(t){return t.field===`intervalCount`}formatEnduranceIntervalSummaryValue(t,e){switch(t){case`duration`:case`setRecovery`:return this.formatDurationLikeValue(e);case`heartRateZone`:return this.formatHeartRateZoneValue(e);default:return this.formatPreviewPrimitive(e)}}formatEnduranceIntervalRowLabel(t){switch(t){case`duration`:return this.translateService.instant(`clientProfile.duration`);case`distance`:return this.translateService.instant(`clientProfile.distance`);case`recovery`:return this.translateService.instant(`clientProfile.setRecovery`);case`heartRateZone`:return this.translateService.instant(`planEditor.exerciseEdit.field.heartRateZone`)}}getEnduranceIntervalRowValue(t,e){return t[e]}formatEnduranceIntervalRowValue(t,e){switch(t){case`duration`:case`recovery`:return this.formatDurationLikeValue(e);case`heartRateZone`:return this.formatHeartRateZoneValue(e);default:return this.formatPreviewPrimitive(e)}}isChangedEnduranceIntervalRow(t,e,i){let s=this.findEnduranceIntervalCounterpart(t,e,i);return s?this.enduranceIntervalRowFields.some(u=>e[u]!==s[u]):!0}isChangedEnduranceIntervalCell(t,e,i,s){let u=this.findEnduranceIntervalCounterpart(t,e,i);return u?e[s]!==u[s]:!0}isMovedExerciseReorderItem(t,e){return e.workoutExerciseId===t.locator.workoutExerciseId}formatExercisePrescriptionValue(t,e){switch(this.normalizeExercisePrescriptionField(t)){case`rpe`:return this.formatRpeValue(e);case`setRecovery`:return this.formatRecoveryValue(e);case`heartRateZone`:return this.formatHeartRateZoneValue(e);default:return this.formatPreviewPrimitive(e)}}lifecycleTone(t){switch(t){case`confirmed`:return`success`;case`rejected`:case`expired`:case`stale`:case`failed`:return`warning`;default:return`neutral`}}formatProgramOptionLabel(t){return $t$3(t,this.translateService)}submitPrompt(t){return ps$4(this,null,function*(){yield this.planEditorState.sendMessage(t)})}scrollToBottom(){setTimeout(()=>{let t=this.messagesContainer?.nativeElement;t&&(t.scrollTop=t.scrollHeight)},50)}ensureAthletesLoaded(){return ps$4(this,null,function*(){if(!(this.availableAthletes().length>0||this.isLoadingAthletes()||this.athleteOptionsRequested)){this.athleteOptionsRequested=!0,this.isLoadingAthletes.set(!0);try{yield Promise.all([this.clientDataService.fetchTrainingGroupData(),this.clientDataService.fetchUngroupedClients()])}finally{this.isLoadingAthletes.set(!1)}}})}ensureProgramsLoaded(t,e=!1){return ps$4(this,null,function*(){if(!e&&(this.trainingService.workoutPrograms().has(t)||this.loadedProgramAthleteIds.has(t)))return;let i=++this.programLoadSequence;this.isLoadingPrograms.set(!0);try{yield this.trainingService.fetchWorkoutPrograms(t),this.loadedProgramAthleteIds.add(t)}finally{this.programLoadSequence===i&&this.isLoadingPrograms.set(!1)}})}comparePreviewKeys(t,e){let i=this.previewKeyPriority(t),s=this.previewKeyPriority(e);return i!==s?i-s:t.localeCompare(e)}previewKeyPriority(t){switch(t){case`before`:return 0;case`after`:return 1;default:return 2}}normalizeExercisePrescriptionField(t){switch(t){case`set_recovery`:return`setRecovery`;case`heart_rate_zone`:return`heartRateZone`;default:return t}}countBatchAffectedItems(t){return t.groupedByWeek.reduce((e,i)=>e+i.workouts.reduce((s,u)=>s+u.exercises.reduce((v,S)=>v+S.operations.length,0),0),0)}formatDurationClockValue(t){return typeof t==`number`?T$5(t):typeof t==`string`?t:this.formatPreviewPrimitive(t)}formatDurationLikeValue(t){if(t==null)return`-`;if(typeof t==`number`)return A$2(t);if(typeof t==`string`){let e=$$2(t);return e>0||t===`00:00:00`?A$2(e):t}return this.formatPreviewPrimitive(t)}formatRecoveryValue(t){return this.formatDurationLikeValue(t)}formatHeartRateZoneValue(t){if(t==null)return`-`;let e=typeof t==`string`?Number(t):t;return typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=5?this.translateService.instant(`heartRate.zone${e}`):this.formatPreviewPrimitive(t)}formatRpeValue(t){return typeof t==`number`?`${t} ${this.translateService.instant(`planEditor.exerciseEdit.field.rpe`)}`:this.formatPreviewPrimitive(t)}formatBatchIntegerValue(t){return typeof t==`number`?Number.isInteger(t)?`${t}`:this.formatPreviewPrimitive(t):this.formatPreviewPrimitive(t)}findEnduranceIntervalCounterpart(t,e,i){return(i===`before`?t.after:t.before).find(u=>u.interval===e.interval)}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-plan-editor-workspace`]],viewQuery:function(e,i){if(e&1&&$h$2(Qr,5),e&2){let s;Pw(s=Lw())&&(i.messagesContainer=s.first)}},outputs:{closed:`closed`},decls:41,vars:24,consts:[[`messagesContainer`,``],[`previewValue`,``],[`data-testid`,`plan-editor-workspace`,1,`workspace-shell`],[1,`workspace-header`],[1,`header-copy`],[1,`title-row`],[`data-testid`,`plan-editor-header-context`,1,`header-context`],[1,`header-actions`],[`mat-stroked-button`,``,`type`,`button`,3,`disabled`],[`mat-icon-button`,``,`type`,`button`,3,`click`],[1,`workspace-body`],[1,`conversation-panel`],[`role`,`log`,`aria-live`,`polite`,1,`messages`],[`data-testid`,`plan-editor-history-card`,1,`history-card`],[`data-testid`,`plan-editor-context-selection`,1,`selection-card`],[1,`empty-state`],[1,`message`,3,`message--user`],[1,`message`],[1,`response-card`],[`data-testid`,`plan-editor-semantic-swap-review`,1,`response-card`],[1,`response-card`,`response-card--status`],[`data-testid`,`plan-editor-change-history-card`,1,`response-card`],[1,`response-card`,`response-card--warning`],[1,`response-card`,`response-card--error`],[1,`composer`],[1,`header-context__item`],[`aria-hidden`,`true`,1,`header-context__separator`],[`mat-stroked-button`,``,`type`,`button`,3,`click`,`disabled`],[1,`section-header`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-history-undo`,3,`click`,`disabled`],[1,`panel-hint`],[1,`history-list`],[1,`history-item`],[1,`history-meta`],[1,`status`],[1,`selection-card__copy`],[1,`selection-grid`],[`for`,`plan-editor-athlete-select`,1,`selection-field`],[`id`,`plan-editor-athlete-select`,`data-testid`,`plan-editor-athlete-select`,3,`change`,`value`,`disabled`],[`value`,``],[3,`value`],[`for`,`plan-editor-program-select`,1,`selection-field`],[`id`,`plan-editor-program-select`,`data-testid`,`plan-editor-program-select`,3,`change`,`value`,`disabled`],[1,`message-role`],[1,`message-bubble`],[1,`message-bubble`,`message-bubble--loading`],[1,`option-list`],[1,`required-context`],[1,`option-label`],[1,`option-description`],[1,`required-context-title`],[1,`required-context-list`],[1,`required-context-chip`],[1,`status-chip`],[1,`semantic-swap-preview`],[1,`semantic-swap-preview__header`],[1,`preview-block-title`],[1,`status-chip`,`status-chip--warning`],[1,`semantic-swap-preview__targets`],[1,`semantic-swap-row`],[1,`response-actions`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-semantic-swap-reject`,3,`click`,`disabled`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`plan-editor-semantic-swap-submit`,3,`click`,`disabled`],[1,`semantic-swap-row__header`],[1,`semantic-swap-row__copy`],[1,`semantic-swap-row__label`],[1,`semantic-swap-row__detail`],[1,`semantic-swap-row__selector`],[3,`change`,`value`,`disabled`],[1,`semantic-swap-preview__exclusions`],[1,`semantic-swap-preview__exclusions-header`],[1,`batch-exclusions__list`],[1,`batch-exclusion-card`],[1,`batch-exclusion-card__header`],[1,`batch-exclusion-card__title`],[1,`batch-exclusion-card__examples`],[`data-testid`,`plan-editor-proposal-summary`,1,`proposal-summary`],[1,`proposal-summary__text`],[1,`proposal-meta`],[`data-testid`,`plan-editor-semantic-remove-preview`,1,`semantic-remove-preview`],[1,`proposal-details-toggle`],[`data-testid`,`plan-editor-proposal-details`,1,`proposal-details`],[1,`proposal-actions`],[`data-testid`,`plan-editor-proposal-highlights`,1,`proposal-highlights`],[1,`proposal-highlight-grid`],[1,`proposal-highlight`],[1,`proposal-highlight__label`],[1,`proposal-highlight__value`],[1,`semantic-remove-preview__header`],[1,`semantic-remove-preview__counts`],[1,`semantic-remove-preview__narrowed`],[1,`semantic-remove-preview__workouts`],[1,`semantic-remove-workout`],[1,`semantic-remove-preview__exclusions`],[1,`semantic-remove-workout__header`],[1,`semantic-remove-row`,`semantic-remove-row--remove`],[1,`semantic-remove-row`,`semantic-remove-row--keep`],[`type`,`checkbox`,`checked`,``,3,`change`,`disabled`],[1,`semantic-remove-row__copy`],[1,`semantic-remove-row__label`],[1,`semantic-remove-row__detail`],[1,`semantic-remove-preview__exclusions-header`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-proposal-details-toggle`,3,`click`],[1,`preview-block`],[`data-testid`,`plan-editor-batch-preview`,1,`preview-block`,`batch-preview`],[1,`preview-grid`],[1,`preview-row`],[1,`batch-grouped-preview`],[`data-testid`,`plan-editor-batch-exclusions`,1,`preview-block`,`batch-exclusions`],[1,`batch-grouped-preview__weeks`],[`data-testid`,`plan-editor-batch-week`,1,`batch-week-group`],[1,`batch-week-group__header`],[1,`batch-week-group__title`],[1,`batch-week-group__workouts`],[1,`batch-workout-group`],[1,`batch-workout-group__label`],[1,`batch-workout-group__exercises`],[1,`batch-exercise-group`],[1,`batch-exercise-group__header`],[1,`batch-exercise-group__label`],[1,`batch-exercise-group__operations`],[1,`batch-operation-row`],[1,`batch-operation-row__label`],[1,`preview-compare`],[1,`preview-compare-side`],[1,`preview-side-title`],[1,`preview-primitive`],[1,`batch-exclusions__header`],[3,`ngTemplateOutlet`,`ngTemplateOutletContext`],[1,`proposal-operations`],[1,`proposal-operation`],[1,`operation-header`],[1,`operation-type`],[1,`preview-block`,`preview-block--nested`],[1,`exercise-catalog-preview`],[1,`exercise-catalog-preview__meta`],[1,`exercise-catalog-preview__label`],[1,`exercise-catalog-preview__location`],[1,`exercise-catalog-preview__workout`],[1,`exercise-swap-preview`],[1,`exercise-swap-preview__meta`],[1,`exercise-swap-preview__label`],[1,`exercise-swap-preview__compatibility`],[1,`exercise-reorder-preview`],[1,`exercise-reorder-preview__meta`],[1,`exercise-reorder-preview__label`],[1,`exercise-reorder-preview__position`],[1,`exercise-reorder-preview__position-summary`],[1,`exercise-reorder-preview__list`],[1,`exercise-reorder-preview__item`,3,`exercise-reorder-preview__item--moved`],[1,`exercise-reorder-preview__item`],[1,`exercise-reorder-preview__position-index`],[1,`exercise-reorder-preview__item-label`],[1,`status-chip`,`status-chip--success`],[1,`endurance-interval-preview`],[1,`endurance-interval-preview__meta`],[1,`endurance-interval-preview__label`],[1,`endurance-interval-preview__table`],[1,`endurance-interval-preview__header`],[1,`endurance-interval-preview__header-cell`],[1,`endurance-interval-preview__row`,3,`endurance-interval-preview__row--changed`],[1,`endurance-interval-preview__row`],[1,`endurance-interval-preview__cell`,`endurance-interval-preview__cell--index`],[1,`endurance-interval-preview__cell`,3,`endurance-interval-preview__cell--changed`],[1,`endurance-interval-preview__cell`],[1,`exercise-prescription-preview`],[1,`exercise-prescription-preview__meta`],[1,`exercise-prescription-preview__label`],[1,`set-edit-preview`],[1,`set-edit-preview__meta`],[1,`set-edit-preview__label`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-proposal-reject`,3,`click`,`disabled`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`plan-editor-proposal-confirm`,3,`click`,`disabled`],[1,`status-message`],[`data-testid`,`plan-editor-change-history-summary`,1,`proposal-summary`],[1,`change-history__exercises`],[`data-testid`,`plan-editor-change-history-exercise`,1,`batch-exercise-group`,`change-history__exercise`],[1,`change-history__exercise-meta`],[1,`change-history__change-header`],[1,`panel-hint`,`change-history__change-summary`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-change-history-undo`,3,`click`,`disabled`],[`mat-stroked-button`,``,`type`,`button`,3,`click`],[1,`option-list`,`unsupported-option-list`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-unsupported-alternative`,3,`disabled`],[`mat-stroked-button`,``,`type`,`button`,`data-testid`,`plan-editor-unsupported-alternative`,3,`click`,`disabled`],[`data-testid`,`plan-editor-composer-context-required`,1,`panel-hint`],[`rows`,`3`,`data-testid`,`plan-editor-composer-input`,3,`ngModelChange`,`keydown`,`ngModel`,`placeholder`,`disabled`],[1,`composer-actions`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`plan-editor-send-button`,3,`click`,`disabled`],[1,`preview-array`],[1,`preview-array-item`]],template:function(e,i){if(e&1&&(Bi$3(0,`div`,2)(1,`header`,3)(2,`div`,4)(3,`div`,5)(4,`mat-icon`),lC(5,`edit_note`),vl$4(),Bi$3(6,`h2`),lC(7),OC(8,`translate`),vl$4()(),Bi$3(9,`p`),lC(10),OC(11,`translate`),vl$4(),fw(12,rl,3,2,`div`,6),vl$4(),Bi$3(13,`div`,7),fw(14,ll,3,4,`button`,8),Bi$3(15,`button`,9),OC(16,`translate`),jh$3(`click`,function(){return i.close()}),Bi$3(17,`mat-icon`),lC(18,`close`),vl$4()()()(),Bi$3(19,`div`,10)(20,`section`,11)(21,`div`,12,0),fw(23,dl,10,8,`section`,13),fw(24,xl,33,24,`section`,14)(25,vl,9,6,`div`,15),mw(26,Cl,6,6,`article`,16,St),fw(28,bl,7,6,`article`,17),fw(29,kl,8,6,`section`,18),fw(30,Wl,30,26,`section`,19),fw(31,$s,28,32,`section`,18),f
7375w(32,zs,13,12,`section`,20),fw(33,Qs,32,36,`section`,21),fw(34,tp,13,9,`section`,22),fw(35,np,6,4,`section`,23),vl$4(),Bi$3(36,`footer`,24),fw(37,ip,1,0,`app-ai-quota-exhausted-panel`)(38,op,8,9),vl$4()()()(),Th$2(39,xp,3,1,`ng-template`,null,1,jC)),e&2){let s,u,v,S,L,F;sE(7),ig(LC(8,18,`planEditor.title`)),sE(3),ig(LC(11,20,`planEditor.subtitle`)),sE(2),pw(i.hasStableContext()?12:-1),sE(2),pw(i.messages().length>0?14:-1),sE(),xh$2(`aria-label`,LC(16,22,`common.close`)),sE(8),pw(i.hasStableContext()&&(i.isLoadingHistory()||i.history().length>0)?23:-1),sE(),pw(i.hasStableContext()?i.messages().length===0&&!i.isSending()?25:-1:24),sE(2),yw(i.messages()),sE(2),pw(i.isSending()?28:-1),sE(),pw((s=i.clarification())?29:-1,s),sE(),pw((u=i.swapReview())?30:-1,u),sE(),pw((v=i.proposal())?31:-1,v),sE(),pw((S=i.proposalLifecycle())?32:-1,S),sE(),pw((L=i.changeHistory()?.detail)?33:-1,L),sE(),pw((F=i.unsupported())?34:-1,F),sE(),pw(i.error()?35:-1),sE(),Yh$3(`composer--locked`,!i.hasStableContext()),sE(),pw(i.aiQuotaService.exhausted()?37:38)}},dependencies:[Zi$3,Za$2,Jn$4,Xn$4,Yn$5,Qe$2,qn$5,fn$5,Ap$1,wp$2,xc$4,yt$7,wt$5,q,es$4,Xp$1],styles:[`[_nghost-%COMP%]{position:fixed;inset:24px;z-index:1200;display:block}.workspace-shell[_ngcontent-%COMP%]{--%NS%plan-editor-surface: var(--%NS%dialog-dark-background);--%NS%plan-editor-panel: color-mix( in srgb, var(--%NS%dialog-dark-background) 88%, var(--%NS%quinaryBlack) 12% );--%NS%plan-editor-raised: color-mix( in srgb, var(--%NS%dialog-dark-background) 76%, var(--%NS%quinaryBlack) 24% );height:100%;width:min(1200px,100%);margin:0 auto;display:flex;flex-direction:column;overflow:hidden;border-radius:20px;background:var(--%NS%plan-editor-surface);color:var(--%NS%text-color);box-shadow:0 24px 80px #00000073;border:1px solid var(--%NS%border-color)}.workspace-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px;border-bottom:1px solid var(--%NS%border-color);background:var(--%NS%plan-editor-surface)}.workspace-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:700}.workspace-header[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:4px 0 0;color:color-mix(in srgb,var(--%NS%text-color) 72%,transparent)}.title-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px}.title-row[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--%NS%primary)}.header-context[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:10px;font-size:.85rem;color:color-mix(in srgb,var(--%NS%text-color) 82%,transparent)}.header-context__item[_ngcontent-%COMP%]{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;border:1px solid var(--%NS%border-color);background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%);font-weight:600}
7375.header-context__separator[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%text-color) 55%,transparent)}.header-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.workspace-body[_ngcontent-%COMP%]{min-height:0;flex:1;display:flex;background:var(--%NS%plan-editor-surface)}.conversation-panel[_ngcontent-%COMP%]{min-height:0}.history-card[_ngcontent-%COMP%], .response-card[_ngcontent-%COMP%]{border:1px solid var(--%NS%border-color);border-radius:16px;padding:16px;background:var(--%NS%plan-editor-raised)}.response-card[_ngcontent-%COMP%]{margin:0}.response-card--error[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%warn) 45%,var(--%NS%border-color))}.response-card--status[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%primary) 25%,var(--%NS%border-color))}.response-card--warning[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%warn) 35%,var(--%NS%border-color))}.section-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.status[_ngcontent-%COMP%], .operation-type[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.panel-hint[_ngcontent-%COMP%]{margin:0;font-size:.9rem;color:color-mix(in srgb,var(--%NS%text-color) 72%,transparent)}.history-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;margin-top:12px}.history-item[_ngcontent-%COMP%], .proposal-operation[_ngcontent-%COMP%]{border-radius:12px;padding:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 82%,black 18%)}.history-item[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .proposal-operation[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:8px 0 0;white-space:pre-wrap}.status-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;font-size:.8rem;font-weight:700;border:1px solid var(--%NS%border-color);background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.status-chip--success[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%primary) 50%,var(--%NS%border-color));background:color-mix(in srgb,var(--%NS%primary) 18%,transparent)}.status-chip--warning[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%warn) 35%,var(--%NS%border-color));background:color-mix(in srgb,var(--%NS%warn) 10%,transparent)}.history-meta[_ngcontent-%COMP%], .proposal-meta[_ngcontent-%COMP%], .composer-actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.proposal-meta[_ngcontent-%COMP%]{flex-wrap:wrap}.conversation-panel[_ngcontent-%COMP%]{min-height:0;display:flex;flex:1;flex-direction:column;background:var(--%NS%plan-editor-surface)}.messages[_ngcontent-%COMP%]{min-height:0;flex:1;overflow-y:auto;padding:0 20px 20px;display:flex;flex-direction:column;gap:12px;background:var(--%NS%plan-editor-surface)}.empty-state[_ngcontent-%COMP%]{height:100%;min-height:240px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;text-align:center;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.empty-state[_ngcontent-%COMP%] h3[_ngcontent-%COMP%], .empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.empty-state[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:48px;height:48px;font-size:48px}.selection-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;margin-bottom:12px;padding:20px;border:1px solid color-mix(in srgb,var(--%NS%warn) 28%,var(--%NS%border-color));border-radius:16px;background:color-mix(in srgb,var(--%NS%warn) 8%,var(--%NS%plan-editor-raised))}.selection-card__copy[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.selection-card__copy[_ngcontent-%COMP%] h3[_ngcontent-%COMP%], .selection-card__copy[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.selection-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.selection-field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.selection-field[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.8rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.selection-field[_ngcontent-%COMP%] select[_ngcontent-%COMP%]{width:100%;min-height:44px;border-radius:14px;border:1px solid var(--%NS%border-color);background:color-mix(in srgb,var(--%NS%plan-editor-raised) 86%,black 14%);color:inherit;padding:0 14px;font:inherit}.selection-field[_ngcontent-%COMP%] select[_ngcontent-%COMP%]:focus{outline:2px solid color-mix(in srgb,var(--%NS%primary) 35%,transparent);border-color:var(--%NS%primary)}.message[_ngcontent-%COMP%]{max-width:80%;display:flex;flex-direction:column;gap:6px}.message--user[_ngcontent-%COMP%]{margin-left:auto;align-items:flex-end}.message--user[_ngcontent-%COMP%] .message-bubble[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--%NS%primary) 22%,var(--%NS%plan-editor-raised));border-color:color-mix(in srgb,var(--%NS%primary) 35%,var(--%NS%border-color))}.message-role[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.message-bubble[_ngcontent-%COMP%]{white-space:pre-wrap;padding:12px 14px;border-radius:14px;border:1px solid var(--%NS%border-color);background:color-mix(in srgb,var(--%NS%plan-editor-raised) 86%,black 14%)}.message-bubble--loading[_ngcontent-%COMP%]{color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.option-list[_ngcontent-%COMP%], .required-context-list[_ngcontent-%COMP%], .proposal-operations[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;margin-top:12px}.option-list[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{justify-content:flex-start;align-items:flex-start;text-align:left;white-space:normal}.option-label[_ngcontent-%COMP%]{font-weight:600}.option-description[_ngcontent-%COMP%]{display:block;font-size:.9rem;color:color-mix(in srgb,var(--%NS%text-color) 72%,transparent)}.required-context-title[_ngcontent-%COMP%]{font-weight:600;margin-top:16px}.required-context-list[_ngcontent-%COMP%]{flex-direction:row;flex-wrap:wrap}.unsupported-option-list[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{justify-content:flex-start;text-align:left;white-space:normal;height:auto;line-height:1.4;padding-block:10px}.required-context-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;border:1px solid var(--%NS%border-color);background:color-mix(in srgb,var(--%NS%plan-editor-raised) 82%,black 18%);font-size:.9rem}.preview-block[_ngcontent-%COMP%]{margin-top:16px;padding-top:16px;border-top:1px solid var(--%NS%border-color)}.preview-block--nested[_ngcontent-%COMP%]{margin-top:12px;padding-top:12px}.preview-block-title[_ngcontent-%COMP%], .preview-side-title[_ngcontent-%COMP%]{font-size:.8rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.proposal-summary[_ngcontent-%COMP%]{margin-top:16px;padding:14px 16px;border:1px solid color-mix(in srgb,var(--%NS%primary) 28%,var(--%NS%border-color));border-radius:14px;background:color-mix(in srgb,var(--%NS%primary) 10%,var(--%NS%plan-editor-raised))}.proposal-summary__text[_ngcontent-%COMP%]{margin:8px 0 0;font-weight:600;line-height:1.5}.proposal-highlights[_ngcontent-%COMP%]{margin-top:16px}.semantic-remove-preview[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;margin-top:16px;padding:16px;border:1px solid color-mix(in srgb,var(--%NS%warn) 45%,var(--%NS%border-color));border-radius:14px;background:color-mix(in srgb,var(--%NS%warn) 8%,var(--%NS%plan-editor-raised))}.semantic-remove-preview__header[_ngcontent-%COMP%], .semantic-remove-preview__exclusions-header[_ngcontent-%COMP%], .semantic-remove-workout__header[_ngcontent-%COMP%], .semantic-remove-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.semantic-remove-preview__header[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .semantic-remove-preview__exclusions-header[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .semantic-remove-preview__narrowed[_ngcontent-%COMP%]{margin:6px 0 0;color:color-mix(in srgb,var(--%NS%text-color) 78%,transparent)}.semantic-remove-preview__counts[_ngcontent-%COMP%], .semantic-remove-preview__workouts[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px}.semantic-remove-preview__counts[_ngcontent-%COMP%]{align-items:flex-end}.semantic-remove-workout[_ngcontent-%COMP%], .semantic-remove-preview__exclusions[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px}.semantic-remove-workout__header[_ngcontent-%COMP%]{padding:0 2px;font-size:.85rem;font-weight:700}.semantic-remove-row[_ngcontent-%COMP%]{align-items:center;padding:12px;border:1px solid var(--%NS%border-color);border-radius:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.semantic-remove-row--remove[_ngcontent-%COMP%]{cursor:pointer;border-color:color-mix(in srgb,var(--%NS%warn) 42%,var(--%NS%border-color))}.semantic-remove-row--keep[_ngcontent-%COMP%]{opacity:.78}.semantic-remove-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:18px;height:18px;accent-color:var(--%NS%warn)}.semantic-remove-row__copy[_ngcontent-%COMP%]{min-width:0;flex:1;display:flex;flex-direction:column;gap:4px}.semantic-remove-row__label[_ngcontent-%COMP%]{font-weight:700;word-break:break-word}.semantic-remove-row__detail[_ngcontent-%COMP%]{font-size:.85rem;color:color-mix(in srgb,var(--%NS%text-color) 72%,transparent);word-break:break-word}.semantic-swap-preview[_ngcontent-%COMP%]{margin-top:16px;border-block:1px solid color-mix(in srgb,var(--%NS%primary) 28%,var(--%NS%border-color))}.semantic-swap-preview__header[_ngcontent-%COMP%], .semantic-swap-preview__exclusions-header[_ngcontent-%COMP%], .semantic-swap-row__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.semantic-swap-preview__header[_ngcontent-%COMP%]{padding:14px 0}.semantic-swap-preview__header[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .semantic-swap-preview__exclusions-header[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:6px 0 0;color:color-mix(in srgb,var(--%NS%text-color) 78%,transparent)}.semantic-swap-preview__targets[_ngcontent-%COMP%]{border-top:1px solid var(--%NS%border-color)}.semantic-swap-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding:16px 0}.semantic-swap-row[_ngcontent-%COMP%] + .semantic-swap-row[_ngcontent-%COMP%]{border-top:1px solid var(--%NS%border-color)}.semantic-swap-row__copy[_ngcontent-%COMP%]{min-width:0;display:flex;flex-direction:column;gap:4px}.semantic-swap-row__label[_ngcontent-%COMP%]{font-weight:700;word-break:break-word}.semantic-swap-row__detail[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:.85rem;color:color-mix(in srgb,var(--%NS%text-color) 72%,transparent)}.semantic-swap-row__selector[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.semantic-swap-row__selector[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.8rem;font-weight:700;color:color-mix(in srgb,var(--%NS%text-color) 82%,transparent)}.semantic-swap-row__selector[_ngcontent-%COMP%] select[_ngcontent-%COMP%]{width:100%;min-height:44px;padding:0 12px;border:1px solid var(--%NS%border-color);border-radius:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 86%,black 14%);color:var(--%NS%text-color);font:inherit}.semantic-swap-row__selector[_ngcontent-%COMP%] select[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--%NS%primary);outline-offset:2px}.semantic-swap-row__selector[_ngcontent-%COMP%] select[_ngcontent-%COMP%]:disabled{cursor:not-allowed;opacity:.68}.semantic-swap-preview__exclusions[_ngcontent-%COMP%]{padding:16px 0 0;border-top:1px solid color-mix(in srgb,var(--%NS%warn) 35%,var(--%NS%border-color))}.semantic-swap-preview__exclusions[_ngcontent-%COMP%] .batch-exclusions__list[_ngcontent-%COMP%]{margin-top:12px}.proposal-highlight-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-top:12px}.proposal-highlight[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px;padding:12px;border:1px solid var(--%NS%border-color);border-radius:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.proposal-highlight__label[_ngcontent-%COMP%]{font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.proposal-highlight__value[_ngcontent-%COMP%]{font-weight:600;line-height:1.45;word-break:break-word}.proposal-details-toggle[_ngcontent-%COMP%]{margin-top:16px}.proposal-details-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px}.proposal-details[_ngcontent-%COMP%]{display:flex;flex-direction:column}.batch-preview[_ngcontent-%COMP%], .batch-grouped-preview[_ngcontent-%COMP%], .batch-exclusions[_ngcontent-%COMP%], .batch-grouped-preview__weeks[_ngcontent-%COMP%], .batch-week-group__workouts[_ngcontent-%COMP%], .batch-workout-group__exercises[_ngcontent-%COMP%], .batch-exercise-group__operations[_ngcontent-%COMP%], .batch-exclusions__list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.change-history__exercises[_ngcontent-%COMP%], .change-history__exercise-meta[_ngcontent-%COMP%]{display:flex;flex-direction:column}.change-history__exercises[_ngcontent-%COMP%]{gap:12px;margin-top:12px}.change-history__exercise-meta[_ngcontent-%COMP%]{gap:4px}.change-history__change-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.change-history__change-summary[_ngcontent-%COMP%]{margin:0}.batch-week-group[_ngcontent-%COMP%], .batch-workout-group[_ngcontent-%COMP%], .batch-exercise-group[_ngcontent-%COMP%], .batch-exclusion-card[_ngcontent-%COMP%]{border:1px solid var(--%NS%border-color);border-radius:14px;padding:14px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.batch-week-group[_ngcontent-%COMP%]{gap:12px}.batch-week-group__header[_ngcontent-%COMP%], .batch-exercise-group__header[_ngcontent-%COMP%], .batch-exclusions__header[_ngcontent-%COMP%], .batch-exclusion-card__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.batch-week-group__title[_ngcontent-%COMP%], .batch-workout-group__label[_ngcontent-%COMP%], .batch-exercise-group__label[_ngcontent-%COMP%], .batch-exclusion-card__title[_ngcontent-%COMP%], .batch-operation-row__label[_ngcontent-%COMP%]{font-weight:600}.batch-workout-group[_ngcontent-%COMP%], .batch-exercise-group[_ngcontent-%COMP%], .batch-exclusion-card[_ngcontent-%COMP%]{padding:12px}.batch-exercise-group__operations[_ngcontent-%COMP%]{margin-top:12px}.batch-operation-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding-top:10px;border-top:1px solid color-mix(in srgb,var(--%NS%border-color) 80%,transparent)}.batch-operation-row[_ngcontent-%COMP%]:first-child{padding-top:0;border-top:0}.batch-operation-row[_ngcontent-%COMP%] .preview-compare[_ngcontent-%COMP%]{margin-top:0}.batch-exclusion-card__examples[_ngcontent-%COMP%]{margin-top:12px}.batch-exclusion-card__examples[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:10px 0 0;padding-left:18px}.exercise-catalog-preview[_ngcontent-%COMP%], .endurance-interval-preview[_ngcontent-%COMP%], .exercise-swap-preview[_ngcontent-%COMP%], .exercise-reorder-preview[_ngcontent-%COMP%], .set-edit-preview[_ngcontent-%COMP%], .exercise-prescription-preview[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.exercise-catalog-preview__meta[_ngcontent-%COMP%], .endurance-interval-preview__meta[_ngcontent-%COMP%], .exercise-swap-preview__meta[_ngcontent-%COMP%], .exercise-reorder-preview__meta[_ngcontent-%COMP%], .set-edit-preview__meta[_ngcontent-%COMP%], .exercise-prescription-preview__meta[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.exercise-catalog-preview__label[_ngcontent-%COMP%], .endurance-interval-preview__label[_ngcontent-%COMP%], .exercise-swap-preview__label[_ngcontent-%COMP%], .exercise-reorder-preview__label[_ngcontent-%COMP%], .set
7375-edit-preview__label[_ngcontent-%COMP%], .exercise-prescription-preview__label[_ngcontent-%COMP%]{margin-top:6px;font-weight:600}.exercise-catalog-preview__location[_ngcontent-%COMP%], .exercise-swap-preview__compatibility[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.exercise-swap-preview__compatibility[_ngcontent-%COMP%] .preview-grid[_ngcontent-%COMP%]{margin-top:0}.exercise-reorder-preview__position[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.endurance-interval-preview__table[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;margin-top:12px;overflow-x:auto}.endurance-interval-preview__header[_ngcontent-%COMP%], .endurance-interval-preview__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(56px,.75fr) repeat(4,minmax(120px,1fr));gap:8px;align-items:center}.endurance-interval-preview__header[_ngcontent-%COMP%]{padding:0 4px}.endurance-interval-preview__header-cell[_ngcontent-%COMP%]{font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:color-mix(in srgb,var(--%NS%text-color) 70%,transparent)}.endurance-interval-preview__row[_ngcontent-%COMP%]{padding:10px 12px;border:1px solid var(--%NS%border-color);border-radius:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.endurance-interval-preview__row--changed[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%primary) 35%,var(--%NS%border-color));background:color-mix(in srgb,var(--%NS%primary) 12%,var(--%NS%plan-editor-raised))}.endurance-interval-preview__cell[_ngcontent-%COMP%]{min-width:0;word-break:break-word}.endurance-interval-preview__cell--index[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 8px;border:1px solid var(--%NS%border-color);border-radius:999px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 82%,black 18%);font-weight:700}.endurance-interval-preview__cell--changed[_ngcontent-%COMP%]{font-weight:700;color:color-mix(in srgb,var(--%NS%primary) 70%,white 30%)}.exercise-reorder-preview__position-summary[_ngcontent-%COMP%]{font-weight:600}.exercise-reorder-preview__list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none}.exercise-reorder-preview__item[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--%NS%border-color);border-radius:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.exercise-reorder-preview__item--moved[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--%NS%primary) 35%,var(--%NS%border-color));background:color-mix(in srgb,var(--%NS%primary) 12%,var(--%NS%plan-editor-raised))}.exercise-reorder-preview__position-index[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 8px;border:1px solid var(--%NS%border-color);border-radius:999px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 82%,black 18%);font-weight:700}.exercise-reorder-preview__item-label[_ngcontent-%COMP%]{min-width:0;font-weight:600;word-break:break-word}.exercise-reorder-preview__item[_ngcontent-%COMP%] .status-chip[_ngcontent-%COMP%]{justify-self:flex-end}.exercise-catalog-preview__workout[_ngcontent-%COMP%]{font-weight:600}.preview-grid[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;margin:12px 0 0}.preview-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(120px,180px) minmax(0,1fr);gap:10px}.preview-row[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{font-weight:600}.preview-row[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;min-width:0}.preview-compare[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-top:12px}.preview-compare-side[_ngcontent-%COMP%], .preview-array-item[_ngcontent-%COMP%]{border:1px solid var(--%NS%border-color);border-radius:12px;padding:12px;background:color-mix(in srgb,var(--%NS%plan-editor-raised) 84%,black 16%)}.preview-array[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;margin-top:12px}.batch-operation-row[_ngcontent-%COMP%] .preview-compare-side[_ngcontent-%COMP%]{min-width:0}.preview-primitive[_ngcontent-%COMP%]{white-space:pre-wrap;word-break:break-word}.operation-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.status-message[_ngcontent-%COMP%]{margin-bottom:0;font-weight:600}.response-actions[_ngcontent-%COMP%], .proposal-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;
7375gap:12px;margin-top:16px}.composer[_ngcontent-%COMP%]{border-top:1px solid var(--%NS%border-color);padding:20px;display:flex;flex-direction:column;gap:12px;background:var(--%NS%plan-editor-surface)}.composer--locked[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{opacity:.68;cursor:not-allowed}.composer[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{width:100%;resize:vertical;min-height:88px;border-radius:14px;border:1px solid var(--%NS%border-color);background:color-mix(in srgb,var(--%NS%plan-editor-raised) 86%,black 14%);color:inherit;padding:12px 14px;font:inherit}.composer[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]:focus{outline:2px solid color-mix(in srgb,var(--%NS%primary) 35%,transparent);border-color:var(--%NS%primary)}@media(max-width:960px){[_nghost-%COMP%]{inset:12px}}@media(max-width:760px){[_nghost-%COMP%]{inset:0}.workspace-shell[_ngcontent-%COMP%]{width:100%;border-radius:0}.workspace-header[_ngcontent-%COMP%], .messages[_ngcontent-%COMP%], .composer[_ngcontent-%COMP%], .response-card[_ngcontent-%COMP%]{margin:0}.workspace-header[_ngcontent-%COMP%], .composer[_ngcontent-%COMP%]{padding:16px}.messages[_ngcontent-%COMP%]{padding:0 16px 16px}.response-card[_ngcontent-%COMP%]{margin:0 16px 16px}.preview-row[_ngcontent-%COMP%]{grid-template-columns:1fr}.message[_ngcontent-%COMP%]{max-width:100%}.selection-grid[_ngcontent-%COMP%], .composer-actions[_ngcontent-%COMP%], .semantic-swap-preview__header[_ngcontent-%COMP%], .semantic-swap-preview__exclusions-header[_ngcontent-%COMP%], .semantic-swap-row__header[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch}.response-actions[_ngcontent-%COMP%]{flex-direction:column-reverse}}`]})};var vp=[`videoEl`];var Cp=(n,t)=>t.key;function bp(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,5)(1,`mat-icon`,6),lC(2,`check_circle`),vl$4(),Bi$3(3,`p`),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`button`,7),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().close())}),lC(7),OC(8,`translate`),vl$4()()}n&2&&(sE(4),ig(LC(5,2,`checklist.completionMessage`)),sE(3),Cl$4(` `,LC(8,4,`checklist.completionCta`),` `))}function yp(n,t){n&1&&(Bi$3(0,`div`,20)(1,`span`),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`span`),lC(5),OC(6,`translate`),vl$4()()),n&2&&(sE(2),ig(LC(3,2,`checklist.sectionTasks`)),sE(3),ig(LC(6,4,`checklist.sectionTasksDone`)))}function wp(n,t){if(n&1){let e=Cw();fw(0,yp,7,6,`div`,20),Bi$3(1,`div`,21),jh$3(`pointerup`,function(){let s=ld$2(e).$index;return ud$1(xw(2).playVideo(s+1))}),Bi$3(2,`button`,14),jh$3(`pointerup`,function(s){let u=ld$2(e).$index;return xw(2).playVideo(u+1),ud$1(s.stopPropagation())}),Bi$3(3,`mat-icon`,15),lC(4,`play_circle`),vl$4()(),Bi$3(5,`span`),lC(6),OC(7,`translate`),vl$4(),Bi$3(8,`mat-icon`,22),lC(9),vl$4()()}if(n&2){let e=t.$implicit,i=t.$index,s=xw(2);pw(i===0?0:-1),sE(),Yh$3(`active`,s.activeTaskIndex()===i+1)(`complete`,s.checklistService.isTaskComplete(e.key)),xh$2(`tabindex`,0)(`data-testid`,`checklist-task-`+e.key),sE(5),ig(LC(7,9,e.labelKey)),sE(3),Cl$4(` `,s.checklistService.isTaskComplete(e.key)?`check_circle`:`radio_button_unchecked`,` `)}}function Sp(n,t){n&1&&(Bi$3(0,`div`,17)(1,`div`,23)(2,`div`,24)(3,`mat-icon`,25),lC(4,`play_circle`),vl$4()()(),Bi$3(5,`p`,26),lC(6),OC(7,`translate`),vl$4(),Bi$3(8,`p`,27),lC(9),OC(10,`translate`),vl$4()()),n&2&&(sE(6),ig(LC(7,2,`checklist.noSelection.subtitle`)),sE(3),ig(LC(10,4,`checklist.noSelection.body`)))}function Pp(n,t){n&1&&(Bi$3(0,`div`,18),Rh$3(1,`video`,28,0),vl$4())}function Ep(n,t){if(n&1&&(Bi$3(0,`div`,19)(1,`mat-icon`,29),lC(2,`play_circle`),vl$4(),Bi$3(3,`p`),lC(4),vl$4()()),n&2){let e=xw(2);sE(4),Cl$4(`Video `,e.activeTaskIndex()+1)}}function Mp(n,t){if(n&1){let e=Cw();Bi$3(0,`p`,8),lC(1),OC(2,`translate`),vl$4(),Bi$3(3,`p`,9),lC(4),OC(5,`translate`),vl$4(),Bi$3(6,`div`,10)(7,`div`,11)(8,`p`,12),lC(9),OC(10,`translate`),vl$4(),Bi$3(11,`div`,13),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().playVideo(0))}),Bi$3(12,`button`,14),jh$3(`pointerup`,function(s){return ld$2(e),xw().playVideo(0),ud$1(s.stopPropagation())}),Bi$3(13,`mat-icon`,15),lC(14,`play_circle`),vl$4()(),Bi$3(15,`span`),lC(16),OC(17,`translate`),vl$4()(),mw(18,wp,10,11,null,null,Cp),vl$4(),Bi$3(20,`div`,16),fw(21,Sp,11,6,`div`,17)(22,Pp,3,0,`div`,18)(23,Ep,5,1,`div`,19),vl$4()()}if(n&2){let e=xw();sE(),ig(LC(2,8,`checklist.welcomeTitle`)),sE(3),ig(LC(5,10,`checklist.welcomeSubtitle`)),sE(5),ig(LC(10,12,`checklist.sectionIntro`)),sE(2),Yh$3(`active`,e.activeTaskIndex()===0),xh$2(`tabindex`,0),sE(5),ig(LC(17,14,`checklist.tasks.intro`)),sE(2),yw(e.tasks),sE(3),pw(e.playingTaskIndex()===null?21:e.activeVideoUrl()?22:23)}}var fn=class n{dialogRef=E(f$3);checklistService=E(Je$2);tasks=[{key:`add_client`,labelKey:`checklist.tasks.addClient`},{key:`publish_program`,labelKey:`checklist.tasks.publishProgram`},{key:`add_exercise`,labelKey:`checklist.tasks.addExercise`},{key:`create_workout_template`,labelKey:`checklist.tasks.createWorkoutTemplate`},{key:`add_workout_to_program`,labelKey:`checklist.tasks.addWorkoutToProgram`}];activeTaskIndex=ni$3(null);playingTaskIndex=ni$3(null);WELCOME_VIDEO_URL=`https://blokkivideostorage.blob.core.windows.net/vi
7375deos/welcome/welcome_master.m3u8`;activeVideoUrl=$C(()=>{let t=this.playingTaskIndex();if(t===null)return null;if(t===0)return this.WELCOME_VIDEO_URL;let e=this.tasks[t-1];return e?this.checklistService.videoUrlFor(e.key):null});videoEl=Y1(`videoEl`);hls=null;constructor(){xd$2(()=>{let t=this.activeVideoUrl();queueMicrotask(()=>this.loadVideo(t))})}ngAfterViewInit(){this.loadVideo(this.activeVideoUrl())}ngOnDestroy(){this.destroyHls()}loadVideo(t){this.destroyHls();let e=this.videoEl()?.nativeElement;!t||!e||(e.canPlayType(`application/vnd.apple.mpegurl`)?e.src=t:Yu$1.isSupported()&&(this.hls=new Yu$1,this.hls.loadSource(t),this.hls.attachMedia(e)))}destroyHls(){this.hls&&(this.hls.destroy(),this.hls=null)}selectTask(t){this.activeTaskIndex.set(t)}playVideo(t){this.activeTaskIndex.set(t),this.playingTaskIndex.set(t)}close(){this.dialogRef.close()}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-coach-checklist-dialog`]],viewQuery:function(e,i){e&1&&qh$2(i.videoEl,vp,5),e&2&&Fw()},decls:14,vars:7,consts:[[`videoEl`,``],[1,`checklist-dialog`],[1,`checklist-header`],[1,`checklist-header-title`],[`mat-icon-button`,``,3,`click`],[1,`checklist-complete`],[1,`complete-icon`],[`mat-flat-button`,``,`color`,`primary`,3,`pointerup`],[1,`checklist-subtitle`],[1,`checklist-subtitle`,`checklist-subtitle--sub`],[1,`checklist-body`],[1,`task-list`],[1,`task-section-label`],[`role`,`button`,`data-testid`,`checklist-task-intro`,1,`task-row`,3,`pointerup`],[`aria-label`,`Play`,1,`task-play-btn`,3,`pointerup`],[1,`task-icon`],[1,`video-panel`],[1,`video-empty-state`],[1,`video-embed-wrapper`],[1,`video-placeholder`],[1,`task-section-label`,`task-section-label--row`],[`role`,`button`,1,`task-row`,3,`pointerup`],[1,`task-check-icon`],[1,`video-empty-icon`],[1,`video-empty-icon__square`],[1,`video-empty-icon__play`],[1,`video-empty-subtitle`],[1,`video-empty-body`],[`controls`,``,`playsinline`,``,1,`video-embed`],[1,`video-icon`]],template:function(e,i){e&1&&(Bi$3(0,`div`,1)(1,`div`,2)(2,`div`,3)(3,`mat-icon`),lC(4,`menu_book`),vl$4(),Bi$3(5,`span`),lC(6),OC(7,`translate`),vl$4()(),Bi$3(8,`button`,4),OC(9,`translate`),jh$3(`click`,function(){return i.close()}),Bi$3(10,`mat-icon`),lC(11,`close`),vl$4()()(),fw(12,bp,9,6,`div`,5)(13,Mp,24,16),vl$4()),e&2&&(sE(6),ig(LC(7,3,`checklist.button`)),sE(2),xh$2(`aria-label`,LC(9,5,`common.close`)),sE(4),pw(i.checklistService.allComplete()?12:13))},dependencies:[Ap$1,wp$2,xc$4,yt$7,wt$5,Xp$1],styles:[`.checklist-dialog[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:1000px;max-width:95vw;max-height:85vh;overflow:hidden;background:var(--%NS%box-color, #fff);border-radius:12px}.checklist-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:16px 24px 12px;background:transparent;border-radius:12px 12px 0 0;flex-shrink:0}.checklist-header[_ngcontent-%COMP%] .checklist-header-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;font-size:1.1rem;font-weight:600;color:var(--%NS%text-color)}.checklist-header[_ngcontent-%COMP%] .checklist-header-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:22px;width:22px;height:22px;color:#e3f580}.checklist-header[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:var(--%NS%text-color)}.checklist-subtitle[_ngcontent-%COMP%]{margin:0 24px 4px;color:var(--%NS%text-secondary, #555);font-size:.95rem;flex-shrink:0}.checklist-subtitle--sub[_ngcontent-%COMP%]{margin-bottom:8px;font-size:.85rem;opacity:.8}.checklist-body[_ngcontent-%COMP%]{display:grid;grid-template-columns:400px 1fr;flex:1;overflow:hidden;border-top:1px solid rgba(0,0,0,.12)}.task-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;border-right:1px solid rgba(0,0,0,.12);overflow-y:auto;padding:10px 12px;gap:8px}.task-section-label[_ngcontent-%COMP%]{margin:4px 2px 0;padding-left:14px;padding-right:14px;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--%NS%text-secondary, #888)}.task-section-label--row[_ngcontent-%COMP%]{display:flex;align-items:center;margin:4px 0 0;padding-right:14px}.task-section-label--row[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{flex:1}.task-section-label--row[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{width:32px;flex-shrink:0;display:flex;justify-content:center;letter-spacing:0}.task-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:8px;border:1px solid var(--%NS%primary);background:var(--%NS%box-color);box-shadow:0 2px 6px #0000001f;
7375transition:box-shadow .15s ease,border-color .15s ease;color:var(--%NS%text-color, #1a1a1a)}.task-row[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;font-size:.9rem;line-height:1.4}.task-row[_ngcontent-%COMP%]:hover{box-shadow:0 4px 10px #0000002e;border-color:var(--%NS%primary-dark)}.task-row.active[_ngcontent-%COMP%]{border-color:var(--%NS%primary-dark);box-shadow:0 4px 10px #0003;font-weight:500}.task-play-btn[_ngcontent-%COMP%]{background:none;border:none;padding:0;margin:0;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--%NS%primary);border-radius:50%;transition:transform .15s ease,color .15s ease}.task-play-btn[_ngcontent-%COMP%]:hover{color:var(--%NS%primary-dark);transform:scale(1.15)}.task-play-btn[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--%NS%primary);outline-offset:2px}.task-icon[_ngcontent-%COMP%]{font-size:32px;width:32px;height:32px;display:block}.task-check-icon[_ngcontent-%COMP%]{font-size:32px;width:32px;height:32px;flex-shrink:0;color:var(--%NS%text-secondary, #ccc);margin-left:auto}.complete[_ngcontent-%COMP%] .task-check-icon[_ngcontent-%COMP%]{color:#e3f580!important}.video-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;background:transparent;padding:24px;overflow:hidden}.video-embed-wrapper[_ngcontent-%COMP%]{position:relative;width:100%;padding-top:56.25%}.video-embed[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;border:none;border-radius:8px;background:#000;object-fit:contain}.video-placeholder[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:#aaa;border:2px dashed #ccc;border-radius:8px;width:100%;aspect-ratio:16/9}.video-placeholder[_ngcontent-%COMP%] .video-icon[_ngcontent-%COMP%]{font-size:48px;width:48px;height:48px}.video-placeholder[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.9rem}.video-empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:40px 32px;text-align:center;max-width:360px}.video-empty-icon[_ngcontent-%COMP%]{margin-bottom:4px}.video-empty-icon__square[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:88px;height:88px;border-radius:20px;background:rgba(var(--%NS%primary-rgb, 33, 150, 243),.1);border:2px solid rgba(var(--%NS%primary-rgb, 33, 150, 243),.2);transform:rotate(15deg)}.video-empty-icon__play[_ngcontent-%COMP%]{font-size:44px;width:44px;height:44px;color:rgba(var(--%NS%primary-rgb, 33, 150, 243),.2);transform:rotate(-15deg)}.video-empty-subtitle[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600;color:var(--%NS%text-color)}.video-empty-body[_ngcontent-%COMP%]{margin:0;font-size:.875rem;line-height:1.5;color:var(--%NS%text-secondary, #777)}.checklist-complete[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:48px 32px;text-align:center}.checklist-complete[_ngcontent-%COMP%] .complete-icon[_ngcontent-%COMP%]{font-size:64px;width:64px;height:64px;color:#4caf50}.checklist-complete[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:1rem;color:var(--%NS%text-color, #1a1a1a);max-width:360px}`]})};var Mt=n=>({disabled:n});var kp=n=>[`/clients/profile`,n];var ni=(n,t)=>t.name;var Op=(n,t)=>t.id;function Ip(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,17,1),jh$3(`mouseenter`,function(){ld$2(e);let s=jw(1);return ud$1(xw(2).onClientsHoverEnter(s))})(`mouseleave`,function(){ld$2(e);return ud$1(xw(2).onClientsHoverLeave())}),Bi$3(2,`a`,18)(3,`button`,19)(4,`mat-icon`),lC(5),vl$4(),Bi$3(6,`span`,20),lC(7),OC(8,`translate`),vl$4()()()()}if(n&2){let e=xw().$implicit,i=xw();sE(2),Ah$2(`routerLink`,vC(e.link)),sE(),Ah$2(`ngClass`,bC(7,Mt,i.activeRoute()!==e.link)),sE(2),ig(e.icon),sE(2),ig(LC(8,5,e.name))}}function Tp(n,t){if(n&1&&(Bi$3(0,`a`,7)(1,`button`,19)(2,`mat-icon`),lC(3),vl$4(),Bi$3(4,`span`,20),lC(5),OC(6,`translate`),vl$4()()()),n&2){let e=xw().$implicit,i=xw();Ah$2(`routerLink`,vC(e.link)),sE(),Ah$2(`ngClass`,bC(7,Mt,i.activeRoute()!==e.link)),sE(2),ig(e.icon),sE(2),ig(LC(6,5,e.name))}}function Np(n,t){if(n&1&&fw(0,Ip,9,9,`div`,16)(1,Tp,7,9,`a`,7),n&2){let e=t.$implicit;pw(e.link===`clients`?0:1)}}function Rp(n,t){if(n&1&&(Bi$3(0,`a`,7)(1,`button`,19)(2,`mat-icon`),lC(3),vl$4(),Bi$3(4,`span`,20),lC(5),OC(6,`translate`),vl$4()()()),n&2){let e=t.$implicit,i=xw();Ah$2(`routerLink`,vC(e.link)),sE(),Ah$2(`ngClass`,bC(7,Mt,i.activeRoute()!==e.link)),sE(2),ig(e.icon),sE(2),ig(LC(6,5,e.name))}}function Dp(n,t){if(n&1&&(Bi$3(0,`span`,27),lC(1),vl$4()),n&2){let e=xw(2);sE(),ig(e.coachChecklistService.incompleteCount())}}function Ap(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,21),OC(1,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().openChecklist())}),Bi$3(2,`div`,22),Dd$1(),Bi$3(3,`svg`,23),Rh$3(4,`circle`,24)(5,`circle`,25),vl$4(),wd$1(),Bi$3(6,`span`,26),lC(7,`ð`),vl$4(),fw(8,Dp,2,1,`span`,27),vl$4(),Bi$3(9,`span`,20),lC(10),OC(11,`translate`),vl$4()()}if(n&2){let e=xw();xh$2(`aria-label`,LC(1,5,`checklist.button`)),sE(5),Zh$2(`stroke-dashoffset`,e.progressOffset()),sE(3),pw(e.coachChecklistService.incompleteCount()>0?8:-1),sE(2),ig(LC(11,7,`checklist.button`))}}function Bp(n,t){if(n&1&&(Bi$3(0,`a`,7)(1,`button`,19)(2,`mat-icon`),lC(3),vl$4(),Bi$3(4,`span`,20),lC(5),OC(6,`translate`),vl$4()()()),n&2){let e=t.$implicit,i=xw(2);Ah$2(`routerLink`,vC(e.link)),sE(),Ah$2(`ngClass`,bC(7,Mt,!i.activeRoute().startsWith(e.link))),sE(2),ig(e.icon),sE(2),ig(LC(6,5,e.name))}}
7375function Fp(n,t){if(n&1&&(Bi$3(0,`div`,9)(1,`span`,28),lC(2),OC(3,`translate`),vl$4(),mw(4,Bp,7,9,`a`,7,ni),Bi$3(6,`a`,29)(7,`button`,19)(8,`mat-icon`),lC(9,`groups`),vl$4(),Bi$3(10,`span`,20),lC(11),OC(12,`translate`),vl$4()()()()),n&2){let e=xw();sE(2),ig(LC(3,3,`manager.nav.section`)),sE(2),yw(e.managerPages),sE(3),Ah$2(`ngClass`,bC(7,Mt,!e.activeRoute().startsWith(`manager/groups`))),sE(4),ig(LC(12,5,`manager.nav.groups`))}}function Lp(n,t){if(n&1&&(Bi$3(0,`span`,14),lC(1),OC(2,`translate`),vl$4()),n&2){let e=xw();sE(),Cl$4(` `,LC(2,1,e.clientsFlyoutFilter()?`page.clientsFlyout.noResults`:`page.clientsFlyout.empty`),` `)}}function Vp(n,t){if(n&1){let e=Cw();Bi$3(0,`a`,30),jh$3(`click`,function(){ld$2(e);let s=xw(),u=jw(12);return ud$1(s.closeClientsFlyoutNow(u))}),lC(1),vl$4()}if(n&2){let e=t.$implicit,i=xw();Yh$3(`clients-flyout-item--active`,e.id===i.activeClientId()),Ah$2(`routerLink`,bC(5,kp,e.id)),xh$2(`aria-current`,e.id===i.activeClientId()?`page`:null),sE(),Cl$4(` `,i.clientDisplayName(e),` `)}}var hn=class n{router=E(G$4);profileService=E(ie$4);coachChecklistService=E(Je$2);clientDataService=E(E$2);dialog=E(pe$5);activeRoute=ni$3(``);activeClientId=ni$3(null);isAdmin=$C(()=>this.profileService.profile()?.role===`admin`);showClientsFlyout=ni$3(!1);clientsFlyoutPosition=ni$3({top:0,left:0});clientsFetchTriggered=!1;clientsFlyoutFilter=ni$3(``);sortedClientsFlyoutList=$C(()=>Array.from(this.clientDataService.clientsData().values()).sort((t,e)=>this.clientDisplayName(t).localeCompare(this.clientDisplayName(e))));clientsFlyoutList=$C(()=>{let t=this.clientsFlyoutFilter().trim().toLowerCase(),e=this.sortedClientsFlyoutList();return t?e.filter(i=>this.clientDisplayName(i).toLowerCase().includes(t)):e});onClientsFilterInput(t){this.clientsFlyoutFilter.set(t.target.value)}clientDisplayName(t){return t.lastName||t.firstName?`${t.lastName??``} ${t.firstName??``}`.trim():t.clientName}progressRingCircumference=2*Math.PI*18;progressOffset=$C(()=>{let t=this.coachChecklistService.totalCount()>0?this.coachChecklistService.completedCount()/this.coachChecklistService.totalCount():0;return this.progressRingCircumference*(1-t)});pagesTop=[{name:`page.dashboard`,link:`dashboard`,icon:`home`},{name:`page.clients`,link:`clients`,icon:`group`}];basePagesBottom=[{name:`page.trainingBank`,link:`training-bank`,icon:`search`},{name:`page.groupReports`,link:`group-reports`,icon:`insights`,requiresGroupReports:!0},{name:`page.support`,link:`support`,icon:`help`},{name:`page.settings`,link:`settings`,icon:`settings`}];pagesBottom=$C(()=>this.basePagesBottom.filter(t=>!(`requiresGroupReports`in t&&t.requiresGroupReports)||this.profileService.isCoach()||this.profileService.isManager()||this.profileService.isAdmin()));managerPages=[{name:`manager.nav.coaches`,link:`manager/coaches`,icon:`manage_accounts`},{name:`manager.nav.billing`,link:`manager/billing`,icon:`receipt_long`},{name:`manager.nav.organization`,link:`manager/organization`,icon:`business`}];showManagerSection=$C(()=>this.profileService.isAdminOrManager());ngOnInit(){this.updateActiveRouteState(),this.router.events.subscribe(()=>{this.updateActiveRouteState(),this.cancelClientsFlyoutClose(),this.showClientsFlyout.set(!1),this.clientsFlyoutFilter.set(``)})}updateActiveRouteState(){let t=this.router.url.split(`?`)[0].split(`/`);this.activeRoute.set((t[1]??``).trim()),this.activeClientId.set(t[1]===`clients`&&t[2]===`profile`&&t[3]?Number(t[3]):null)}onNavClick(t){t.detail!==0&&document.activeElement?.blur()}openChecklist(){this.dialog.open(fn,{panelClass:`dialog-checklist`,backdropClass:`dialog-backdrop`,maxWidth:`95vw`,disableClose:!1})}onClientsHoverEnter(t){if(Date.now()<this.suppressReopenUntil)return;this.cancelClientsFlyoutClose();let e=t.getBoundingClientRect(),i=t.closest(`.side-menu`)?.getBoundingClientRect()??e,s=this.getExpandedRailWidth(t);this.clientsFlyoutPosition.set({top:Math.min(e.top,Math.max(window.innerHeight-100,0)),left
7375:i.left+s+8}),this.showClientsFlyout.set(!0),this.clientsFetchTriggered||(this.clientsFetchTriggered=!0,this.clientDataService.fetchLicences(),this.clientDataService.fetchUngroupedClients(),this.clientDataService.fetchTrainingGroupData())}getExpandedRailWidth(t){let e=getComputedStyle(t).getPropertyValue(`--rail-width-expanded`).trim(),i=parseFloat(e);return Number.isFinite(i)?i:236}onClientsHoverLeave(){this.cancelClientsFlyoutClose(),this.clientsFlyoutCloseTimeoutId=setTimeout(()=>{this.showClientsFlyout.set(!1),this.clientsFlyoutFilter.set(``)},250)}closeClientsFlyoutNow(t){this.cancelClientsFlyoutClose(),t.style.transition=`none`,this.showClientsFlyout.set(!1),this.clientsFlyoutFilter.set(``),this.suppressReopenUntil=Date.now()+400,requestAnimationFrame(()=>{t.style.transition=``})}suppressReopenUntil=0;clientsFlyoutCloseTimeoutId=null;cancelClientsFlyoutClose(){this.clientsFlyoutCloseTimeoutId!==null&&(clearTimeout(this.clientsFlyoutCloseTimeoutId),this.clientsFlyoutCloseTimeoutId=null)}ngOnDestroy(){this.cancelClientsFlyoutClose()}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-side-navigation`]],decls:24,vars:25,consts:[[`clientsFlyout`,``],[`clientsNavItem`,``],[`aria-label`,`Main navigation`,1,`side-menu`,3,`click`],[`routerLink`,`/dashboard`,1,`side-logo`],[`aria-hidden`,`true`,1,`side-logo-icon`],[`src`,`assets/svg/logo-white-text.svg`,`alt`,`Blokki`,1,`nav-label`,`side-logo-text`],[1,`side-menu-scroll`],[1,`page-link`,3,`routerLink`],[`mat-flat-button`,``,`data-testid`,`checklist-btn`,1,`page-button`,`checklist-btn`],[1,`manager-section`],[`role`,`menu`,1,`clients-flyout`,3,`mouseenter`,`mouseleave`],[1,`clients-flyout-header`],[`type`,`text`,1,`clients-flyout-search`,3,`input`,`value`,`placeholder`],[1,`clients-flyout-scroll`],[1,`clients-flyout-empty`],[`role`,`menuitem`,1,`clients-flyout-item`,3,`clients-flyout-item--active`,`routerLink`],[1,`page-link`,`clients-nav-item`],[1,`page-link`,`clients-nav-item`,3,`mouseenter`,`mouseleave`],[1,`page-link-anchor`,3,`routerLink`],[`mat-flat-button`,``,1,`page-button`,3,`ngClass`],[1,`nav-label`],[`mat-flat-button`,``,`data-testid`,`checklist-btn`,1,`page-button`,`checklist-btn`,3,`pointerup`],[1,`rocket-progress-wrapper`],[`viewBox`,`0 0 44 44`,`width`,`36`,`height`,`36`,1,`progress-ring`],[`cx`,`22`,`cy`,`22`,`r`,`18`,1,`progress-ring__track`],[`cx`,`22`,`cy`,`22`,`r`,`18`,1,`progress-ring__bar`],[1,`rocket-emoji`],[1,`incomplete-badge`],[1,`manager-section-label`,`nav-label`],[`routerLink`,`manager/groups`,1,`page-link`],[`role`,`menuitem`,1,`clients-flyout-item`,3,`click`,`routerLink`]],template:function(e,i){e&1&&(Bi$3(0,`nav`,2),jh$3(`click`,function(u){return i.onNavClick(u)}),Bi$3(1,`a`,3),Rh$3(2,`span`,4)(3,`img`,5),vl$4(),Bi$3(4,`div`,6),mw(5,Np,2,1,null,null,ni),mw(7,Rp,7,9,`a`,7,ni),fw(9,Ap,12,9,`button`,8),fw(10,Fp,13,9,`div`,9),vl$4()(),Bi$3(11,`div`,10,0),OC(13,`translate`),jh$3(`mouseenter`,function(){return i.cancelClientsFlyoutClose()})(`mouseleave`,function(){return i.onClientsHoverLeave()}),Bi$3(14,`span`,11),lC(15),OC(16,`translate`),vl$4(),Bi$3(17,`input`,12),OC(18,`translate`),OC(19,`translate`),jh$3(`input`,function(u){return i.onClientsFilterInput(u)}),vl$4(),Bi$3(20,`div`,13),fw(21,Lp,3,3,`span`,14),mw(22,Vp,2,7,`a`,15,Op),vl$4()()),e&2&&(Yh$3(`rail-expanded`,i.showClientsFlyout()),sE(5),yw(i.pagesTop),sE(2),yw(i.pagesBottom()),sE(2),pw(!i.isAdmin()&&i.coachChecklistService.isVisible()?9:-1),sE(),pw(i.showManagerSection()?10:-1),sE(),Zh$2(`top`,i.clientsFlyoutPosition().top,`px`)(`left`,i.clientsFlyoutPosition().left,`px`),Yh$3(`clients-flyout--open`,i.showClientsFlyout()),xh$2(`aria-hidden`,!i.showClientsFlyout())(`aria-label`,LC(13,17,`page.clientsFlyout.title`)),sE(4),ig(LC(16,19,`page.clientsFlyout.title`)),sE(2),Ah$2(`value`,i.clientsFlyoutFilter())(`placeholder`,LC(18,21,`page.clientsFlyout.search`)),xh$2(`aria-label`,LC(19,23,`page.clientsFlyout.search`)),sE(4),pw(i.clientsFlyoutList().length===0?21:-1),sE(),yw(i.clientsFlyoutList()))},dependencies:[yt$7,wt$5,Ap$1,wp$2,ea$4,si$3,Zi$3,Ka$3,Me$3,Xp$1],styles:[`[_nghost-%COMP%]{display:block;position:absolute;top:0;left:0;height:100%;overflow:visible}.side-menu[_ngcontent-%COMP%]{height:100%;width:var(--%NS%rail-width, 64px);display:flex;flex-direction:column;background-color:transparent;border-radius:12px;overflow:hidden;transition:width .2s ease,background-color .2s ease,box-shadow .2s ease}@media(hover:hover)and (pointer:fine){.side-menu[_ngcontent-%COMP%]:hover{width:var(--%NS%rail-width-expanded, 236px);background-color:var(--%NS%dialog-dark-background);box-shadow:0 12px 30px #00000059;overflow:visible}.side-menu[_ngcontent-%COMP%]:hover .side-menu-scroll[_ngcontent-%COMP%]{overflow-y:auto}.side-menu[_ngcontent-%COMP%]:hover .nav-label[_ngcontent-%COMP%]{opacity:1}}.side-menu[_ngcontent-%COMP%]:focus-within, .side-menu.rail-expanded[_ngcontent-%COMP%]{width:var(--%NS%rail-width-expanded, 236px);background-color:var(--%NS%dialog-dark-background);box-shadow:0 12px 30px #00000059;overflow:visible}.side-menu[_ngcontent-%COMP%]:focus-within .side-menu-scroll[_ngcontent-%COMP%], .side-menu.rail-expanded[_ngcontent-%COMP%] .side-menu-scroll[_ngcontent-%COMP%]{overflow-y:auto}.side-menu[_ngcontent-%COMP%]:focus-within .nav-label[_ngcontent-%COMP%], .side-menu.rail-expanded[_ngcontent-%COMP%] .nav-label[_ngcontent-%COMP%]{opacity:1}.side-menu-scroll[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;flex-direction:column;gap:15px;overflow:hidden;padding:15px 6px 8px}@media(max-width:760px){.side-menu-scroll[_ngcontent-%COMP%]{overflow-y:auto}}.side-logo[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;gap:12px;height:70px;padding:0 0 0 14px;text-decoration:none;color:var(--%NS%primaryWhite)}.side-logo[_ngcontent-%COMP%] .side-logo-icon[_ngcontent-%COMP%]{height:28px;width:28px;flex-shrink:0;background-color:var(--%NS%primaryWhite);-webkit-mask-image:url(/assets/svg/logo-white.svg);mask-image:url(/assets/svg/logo-white.svg);-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center}.side-logo[_ngcontent-%COMP%] .side-logo-text[_ngcontent-%COMP%]{height:17px;width:auto}.nav-label[_ngcontent-%COMP%]{opacity:0;white-space:nowrap;transition:opacity .15s ease 60ms}.page-link[_ngcontent-%COMP%]{flex-shrink:0}.clients-nav-item[_ngcontent-%COMP%] .page-link-anchor[_ngcontent-%COMP%]{display:block}.clients-flyout[_ngcontent-%COMP%]{position:fixed;width:220px;max-height:70vh;display:flex;flex-direction:column;overflow:hidden;background-color:var(--%NS%dialog-dark-background);border-radius:12px;box-shadow:0 12px 30px #00000059;padding:10px 6px;z-index:30;opacity:0;transform:translate(-6px) scale(.98);transform-origin:left center;pointer-events:none;will-change:opacity,transform;transition:opacity .16s ease,transform .16s ease}.clients-flyout--open[_ngcontent-%COMP%]{opacity:1;transform:translate(0) scale(1);pointer-events:auto}.clients-flyout-header[_ngcontent-%COMP%]{flex-shrink:0;font-size:.7rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--%NS%gray-link-color);padding:4px 10px 8px}.clients-flyout-search[_ngcontent-%COMP%]{flex-shrink:0;margin:0 6px 8px;padding:6px 10px;border:1px solid var(--%NS%border-color);border-radius:8px;background-color:var(--%NS%dialog-dark-background);color:var(--%NS%primaryWhite);font-size:.85rem}
7375.clients-flyout-search[_ngcontent-%COMP%]::placeholder{color:var(--%NS%gray-link-color)}.clients-flyout-search[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--%NS%primary)}.clients-flyout-scroll[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:2px}.clients-flyout-empty[_ngcontent-%COMP%]{padding:8px 10px;color:var(--%NS%gray-link-color);font-size:.85rem}.clients-flyout-item[_ngcontent-%COMP%]{flex-shrink:0;padding:8px 10px;border-radius:8px;color:var(--%NS%primaryWhite);text-decoration:none;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background-color .15s ease}.clients-flyout-item[_ngcontent-%COMP%]:hover, .clients-flyout-item[_ngcontent-%COMP%]:focus-visible{background-color:var(--%NS%primary-dark)}.clients-flyout-item--active[_ngcontent-%COMP%]{background-color:var(--%NS%primary);color:var(--%NS%primaryBlack);font-weight:600}.clients-flyout-item--%NS%active[_ngcontent-%COMP%]:hover, .clients-flyout-item--%NS%active[_ngcontent-%COMP%]:focus-visible{background-color:var(--%NS%primary)}.page-button[_ngcontent-%COMP%]{width:100%;padding:0 0 0 14px;align-items:center;justify-content:flex-start;text-align:left;gap:12px;font-weight:600;transition:background-color .18s ease,color .18s ease}.page-button[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{margin:0;flex-shrink:0}.page-button.disabled[_ngcontent-%COMP%]{color:var(--%NS%gray-link-color)}.page-button.disabled[_ngcontent-%COMP%]:hover{background-color:var(--%NS%primary-dark);color:var(--%NS%primaryWhite)}.page-button[_ngcontent-%COMP%]:active{transform:translateY(1px);box-shadow:0 1px 2px #0003;background-color:color-mix(in srgb,var(--%NS%primary-dark) 80%,black)}.manager-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:15px;border-top:1px solid var(--%NS%border-color);padding-top:15px;margin-top:5px;flex-shrink:0}.manager-section-label[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--%NS%gray-link-color);padding-left:14px}.checklist-btn[_ngcontent-%COMP%]{--%NS%progress-ring-r: 18;--%NS%progress-ring-circumference: calc(2 * 3.14159 * var(--%NS%progress-ring-r) * 1px);--%NS%electric-blue: #1e5aff;background:linear-gradient(135deg,var(--%NS%primary),var(--%NS%purple))!important;color:var(--%NS%primaryBlack)!important;font-weight:600;overflow:visible!important;gap:10px;padding:0 4px 0 8px}.checklist-btn[_ngcontent-%COMP%] .mdc-button__label{display:flex;align-items:center;gap:10px;width:100%}.checklist-btn[_ngcontent-%COMP%] .rocket-progress-wrapper[_ngcontent-%COMP%]{position:relative;width:36px;height:36px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.checklist-btn[_ngcontent-%COMP%] .progress-ring[_ngcontent-%COMP%]{position:absolute;top:0;left:0;transform:rotate(-90deg)}.checklist-btn[_ngcontent-%COMP%] .progress-ring__track[_ngcontent-%COMP%]{fill:none;stroke:#4859634d;stroke-width:3}.checklist-btn[_ngcontent-%COMP%] .progress-ring__bar[_ngcontent-%COMP%]{fill:none;stroke:var(--%NS%electric-blue);stroke-width:3;stroke-linecap:round;stroke-dasharray:113.1;transition:stroke-dashoffset .4s ease}.checklist-btn[_ngcontent-%COMP%] .rocket-emoji[_ngcontent-%COMP%]{position:relative;font-size:1.1rem;line-height:1;z-index:1}.checklist-btn[_ngcontent-%COMP%] .incomplete-badge[_ngcontent-%COMP%]{position:absolute;top:-3px;right:-3px;background:var(--%NS%primaryRed);color:#fff;border-radius:50%;min-width:16px;height:16px;font-size:.6rem;font-weight:700;display:flex;align-items:center;justify-content:center;line-height:1;padding:0 2px;z-index:2}.checklist-btn[_ngcontent-%COMP%]:hover{background:linear-gradient(135deg,color-mix(in srgb,var(--%NS%primary) 85%,black),color-mix(in srgb,var(--%NS%purple) 85%,black))!important}.checklist-btn[_ngcontent-%COMP%]:active{transform:translateY(1px)}`]})};var Bo=mT(ce$5());var Wp=n=>({role:n});function Hp(n,t){if(n&1){let e=Cw();Bi$3(0,`app-icon-button`,19),jh$3(`pointerup`,function(){ld$2(e);let s=xw().$index;return ud$1(xw().removeEmailField(s))}),vl$4()}}function $p(n,t){n&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),Cl$4(` `,LC(2,1,`register.emailRequired`),` `))}function zp(n,t){n&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),Cl$4(` `,LC(2,1,`login.emailInvalid`),` `))}function Up(n,t){if(n&1&&(Bi$3(0,`mat-error`),lC(1),OC(2,`translate`),OC(3,`translate`),vl$4()),n&2){let e=xw(2);sE(),Cl$4(` `,FC(3,3,`validation.ownEmail`,bC(6,Wp,LC(2,1,e.ownEmailRoleKey))),` `)}}function jp(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,10)(1,`div`,15)(2,`mat-form-field`,16)(3,`input`,17),OC(4,`translate`),jh$3(`paste`,function(s){ld$2(e);return ud$1(xw().onEmailPaste(s))}
7375),vl$4(),WE(),vl$4(),fw(5,Hp,1,0,`app-icon-button`,18),vl$4(),fw(6,$p,3,3,`mat-error`),fw(7,zp,3,3,`mat-error`),fw(8,Up,4,8,`mat-error`),vl$4()}if(n&2){let e=t.$index,i=xw();sE(3),Ah$2(`formControlName`,e)(`placeholder`,LC(4,6,`dashboard.clients.email.placeholder`)),zE(),sE(2),pw(i.emailControls.length>1?5:-1),sE(),pw(i.emailControls[e].hasError(`required`)&&i.emailControls[e].touched?6:-1),sE(),pw(i.emailControls[e].hasError(`email`)?7:-1),sE(),pw(i.emailControls[e].hasError(`ownEmail`)?8:-1)}}var kt=class n{dialog=E(pe$5);dialogRef=E(f$3);data=E(de$3,{optional:!0});clientService=E(E$2);profileService=E(ie$4);inviteRole=this.data?.role??`coach`;titleKey=this.data?.titleKey??`dashboard.addCoach`;get ownEmailRoleKey(){return`clientProfile.role.${this.profileService.profile()?.role??`coach`}`}form=new P({emails:new be$4([this.createEmailControl()]),subsEnd:new $$1((0,Bo.default)().add(5,`year`).set(`hour`,12).toDate(),[ye$4.required])});get emailControls(){return this.form.get(`emails`).controls}ngOnInit(){let t=this.data?.initialEmails;if(t&&t.length>0){let e=this.form.get(`emails`);e.clear(),t.forEach(i=>{e.push(this.createEmailControl(i))})}}addEmailField(){this.form.get(`emails`).push(this.createEmailControl())}onEmailPaste(t){let e=this.form.get(`emails`),i=nt$6(t);e.removeAt(-1),i?.forEach(s=>{e.push(this.createEmailControl(s))})}removeEmailField(t){tt$1(this.form.get(`emails`),t)}createEmailControl(t=``){return new $$1(t,[ye$4.required,ye$4.email,this.notOwnEmailValidator()])}notOwnEmailValidator(){return t=>{let e=t.value?.trim()?.toLowerCase(),i=this.profileService.profile()?.email?.toLowerCase();return e&&i&&e===i?{ownEmail:!0}:null}}closeDialog(){this.dialogRef.close()}onSubmit(){let t=this.form.get(`emails`),e=this.form.get(`subsEnd`)?.value;if(et$2(t),!t.valid||!e)return;let i=rt$5(t);if(!i)return;let s=i.split(`,`).map(S=>S.trim()).filter(Boolean),u=this.clientService.addClients({emails:s,expiration:e,role:this.inviteRole});this.dialogRef.close();let v=this.inviteRole.charAt(0).toUpperCase()+this.inviteRole.slice(1);this.dialog.open(oe$2,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,maxWidth:`520px`,width:`520px`,minWidth:`auto`,disableClose:!0,data:{results$:u,onAddAnother:()=>this.openAddCoachDialog(),onRetry:S=>this.openAddCoachDialog(S),titleKey:this.titleKey,addingKey:`addClientResult.adding${v}`,notifKeys:{adding:`addClientResult.notif.adding${v}`,allSucceeded:`addClientResult.notif.allSucceeded${v}`,result:`addClientResult.notif.result${v}`}}})}openAddCoachDialog(t){this.dialog.open(n,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,data:{role:this.inviteRole,titleKey:this.titleKey,initialEmails:t}})}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-add-coach-dialog`]],decls:32,vars:17,consts:[[1,`container`,`mx-auto`,`p-4`],[1,`text-xl`,`pb-5`],[1,`close-button`,3,`closed`],[3,`ngSubmit`,`formGroup`],[1,`grid`,`grid-cols-1`,`md:grid-cols-3`,`gap-4`],[1,`col-span-1`,`md:col-span-2`],[1,`grid`,`grid-cols-1`,`gap-4`],[1,`emails-section`],[1,`block`,`mb-1`],[`formArrayName`,`emails`],[1,`email-row`,`flex`,`flex-col`,`items-center`,`gap-2`,`mb-3`],[`type`,`button`,`mat-stroked-button`,``,1,`add-email-button`,`mt-2`,3,`click`],[1,`col-span-1`,`flex`,`flex-col`,`gap-4`,`justify-center`],[`mat-flat-button`,``,`type`,`submit`,1,`save-button`,`w-full`,3,`disabled`],[`mat-flat-button`,``,1,`cancel-button`,`w-full`,`disabled`,3,`pointerup`],[1,`flex-1`,`flex`,`w-1/1`,`gap-2`],[`appearance`,`outline`,1,`flex-1`],[`matInput`,``,`type`,`email`,3,`paste`,`formControlName`,`placeholder`],[`icon`,`remove`,1,`remove-email-button`],[`icon`,`remove`,1,`remove-email-button`,3,`pointerup`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0)(1,`h2`,1),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`app-dialog-close-button`,2),jh$3(`closed`,function(){return i.closeDialog()}),vl$4(),Bi$3(5,`form`,3),jh$3(`ngSubmit`,function(){return i.onSubmit()}),Bi$3(6,`div`,4)(7,`div`,5)(8,`div`,6)(9,`div`,7)(10,`mat-label`,8),lC(11),OC(12,`translate`),vl$4(),Bi$3(13,`div`,9),mw(14,jp,9,8,`div`,10,gw),vl$4(),Bi$3(16,`button`,11),jh$3(`click`,function(){return i.addEmailField()}),Bi$3(17,`mat-icon`),lC(18,`add`),vl$4(),lC(19),OC(20,`translate`),vl$4()()()(),Bi$3(2
73751,`div`,12)(22,`button`,13)(23,`mat-icon`),lC(24,`person_add`),vl$4(),lC(25),OC(26,`translate`),vl$4(),Bi$3(27,`button`,14),jh$3(`pointerup`,function(){return i.closeDialog()}),Bi$3(28,`mat-icon`),lC(29,`delete`),vl$4(),lC(30),OC(31,`translate`),vl$4()()()()()),e&2&&(sE(2),ig(LC(3,7,i.titleKey)),sE(3),Ah$2(`formGroup`,i.form),sE(6),ig(LC(12,9,`person.email`)),sE(3),yw(i.emailControls),sE(5),Cl$4(` `,LC(20,11,`common.addMore`),` `),sE(3),Ah$2(`disabled`,i.form.invalid),sE(3),Cl$4(` `,LC(26,13,`common.save`),` `),sE(5),Cl$4(` `,LC(31,15,`common.cancel`),` `))},dependencies:[en$4,je$3,X$5,gt$7,Be$2,Pe$4,Qn$4,Zn$4,Qe$2,qn$5,$n$4,bn$4,Vn$4,bt$10,Ap$1,wp$2,yt$7,wt$5,b$3,X$4,Bn$3,L$3,Xp$1],encapsulation:2})};var bn=class n{dialogRef=E(f$3);closeDialog(){this.dialogRef.close()}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-settings-dialog`]],decls:7,vars:3,consts:[[1,`settings-dialog-container`,`p-4`],[1,`close-button`,3,`closed`],[1,`dialog-header`,`flex`,`justify-between`,`items-center`,`mb-4`],[1,`secondary-title`],[3,`restartRequested`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0)(1,`app-dialog-close-button`,1),jh$3(`closed`,function(){return i.closeDialog()}),vl$4(),Bi$3(2,`div`,2)(3,`h2`,3),lC(4),OC(5,`translate`),vl$4()(),Bi$3(6,`app-settings-tabs`,4),jh$3(`restartRequested`,function(){return i.closeDialog()}),vl$4()()),e&2&&(sE(4),ig(LC(5,1,`common.settings`)))},dependencies:[Ap$1,yt$7,X$4,nt,Xp$1],styles:[`.settings-dialog-container[_ngcontent-%COMP%]{max-height:80vh;overflow:auto}.dialog-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.12);padding-bottom:8px}.dialog-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-weight:500;margin:0}`]})};function Kp(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,34),OC(1,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().openAddCoach())}),Bi$3(2,`mat-icon`),lC(3,`group_add`),vl$4(),Bi$3(4,`span`,7),lC(5),OC(6,`translate`),vl$4()()}n&2&&(xh$2(`aria-label`,LC(1,2,`dashboard.addCoach`)),sE(5),ig(LC(6,4,`dashboard.addCoach`)))}function qp(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,35),OC(1,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().openAddManager())}),Bi$3(2,`mat-icon`),lC(3,`manage_accounts`),vl$4(),Bi$3(4,`span`,7),lC(5),OC(6,`translate`),vl$4()()}n&2&&(xh$2(`aria-label`,LC(1,2,`dashboard.addManager`)),sE(5),ig(LC(6,4,`dashboard.addManager`)))}function Gp(n,t){if(n&1){let e=Cw();Bi$3(0,`app-icon-button`,36),OC(1,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().navigateToAdmin())}),vl$4()}n&2&&Ah$2(`icon`,`admin_panel_settings`)(`ariaLabel`,LC(1,2,`admin.title`))}function Yp(n,t){if(n&1){let e=Cw();Bi$3(0,`app-icon-button`,37),OC(1,`translate`),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().openPlanEditor())}),vl$4()}n&2&&Ah$2(`icon`,`edit_note`)(`ariaLabel`,LC(1,2,`planEditor.launcher`))}function Zp(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,38),jh$3(`click`,function(){ld$2(e);return ud$1(xw().openAddCoach())}),Bi$3(1,`mat-icon`),lC(2,`group_add`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()}n&2&&(sE(4),ig(LC(5,1,`dashboard.addCoach`)))}function Jp(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,39),jh$3(`click`,function(){ld$2(e);return ud$1(xw().openAddManager())}),Bi$3(1,`mat-icon`),lC(2,`manage_accounts`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()}n&2&&(sE(4),ig(LC(5,1,`dashboard.addManager`)))}function Qp(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,40),jh$3(`click`,function(){ld$2(e);return ud$1(xw().navigateToAdmin())}),Bi$3(1,`mat-icon`),lC(2,`admin_panel_settings`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()}n&2&&(sE(4),ig(LC(5,1,`admin.title`)))}function Xp(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,41),jh$3(`click`,function(){ld$2(e);return ud$1(xw().openPlanEditor())}),Bi$3(1,`mat-icon`),lC(2,`edit_note`),vl$4(),Bi$3(3,`span`),lC(4),OC(5,`translate`),vl$4()()}n&2&&(sE(4),ig(LC(5,1,`planEditor.launcher`)))}var yn=class n{loginService=E(ne$3);chatState=E(Ln$5);planEditorState=E(gt$6);router=E(G$4);profileService=E(ie$4);notificationsService=E(ie$3);messagingService=E(O$3);toastService=E(ut$6);paymentRequiredService=E(ut$5);dialog=E(pe$5);version=lt$5.version;
7375isAdmin=$C(()=>this.profileService.profile()?.role===`admin`);isAdminOrManager=$C(()=>this.profileService.isAdminOrManager());canOpenPlanEditor=$C(()=>this.profileService.canAccessPlanEditor());locked=this.paymentRequiredService.locked;mobileMenuBadgeCount=$C(()=>this.messagingService.totalUnread()+this.notificationsService.unreadCount());openAddClient(){this.dialog.open(nt$3,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,maxWidth:`600px`,width:`600px`,minWidth:`auto`,disableClose:!1}).closed.subscribe(()=>{uu$2.log(`The dialog was closed`)})}openAddCoach(){this.dialog.open(kt,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`}).closed.subscribe(()=>{uu$2.log(`The dialog was closed`)})}openAddManager(){this.dialog.open(kt,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,data:{role:`manager`,titleKey:`dashboard.addManager`}}).closed.subscribe(()=>{uu$2.log(`The dialog was closed`)})}openAddTrainingGroup(){this.dialog.open(Z$3,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`,maxWidth:`600px`,width:`600px`,minWidth:`auto`}).closed.subscribe(e=>{e===`created`&&this.toastService.show(`trainingGroup.groupCreated`,`success`),uu$2.log(`The training group dialog was closed`)})}openMessaging(){this.router.navigate([`/messages`])}openNotifications(){this.notificationsService.togglePanel()}openAiChat(){this.chatState.openPanel()}openPlanEditor(){this.canOpenPlanEditor()&&(this.chatState.closePanel(),this.planEditorState.openWorkspace({source:`top-navigation`}))}openSettings(){this.dialog.open(bn,{panelClass:`dialog-styling`,backdropClass:`dialog-backdrop`}).closed.subscribe(()=>{uu$2.log(`The settings dialog was closed`)})}navigateToAdmin(){this.router.navigate([`/admin`])}logout(){this.loginService.logout()}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-top-navigation`]],decls:104,vars:84,consts:[[`menu`,`matMenu`],[`mobileMenu`,`matMenu`],[1,`flex`,`justify-end`,`items-center`,`gap-4`],[1,`content`,`flex`,`justify-end`,`items-center`,`gap-8`],[1,`desktop-nav`,`flex`,`justify-end`,`items-center`,`gap-8`],[1,`flex`,`items-center`,`justify-center`,`gap-5`],[`mat-flat-button`,``,`data-testid`,`add-client-btn`,1,`flex`,`items-center`,`justify-start`,3,`pointerup`],[1,`lg-screen`],[`mat-flat-button`,``,`data-testid`,`add-coach-btn`,1,`flex`,`items-center`,`justify-start`],[`mat-flat-button`,``,`data-testid`,`add-manager-btn`,1,`flex`,`items-center`,`justify-start`],[`mat-flat-button`,``,`data-testid`,`add-training-group-btn`,1,`flex`,`items-center`,`justify-start`,3,`pointerup`],[1,`right-column`,`flex`,`justify-center`,`lg:justify-end`,`items-center`,`gap-4`],[`data-testid`,`admin-btn`,3,`icon`,`ariaLabel`],[`data-testid`,`ai-chat-btn`,1,`ai-chat-gradient`,3,`pointerup`,`icon`,`ariaLabel`],[`data-testid`,`plan-editor-btn`,3,`icon`,`ariaLabel`],[`data-testid`,`messaging-btn`,3,`pointerup`,`icon`,`ariaLabel`,`badgeNumber`],[`data-testid`,`notifications-btn`,3,`pointerup`,`icon`,`ariaLabel`,`badgeNumber`],[1,`settings-menu-trigger`,3,`icon`,`matMenuTriggerFor`,`ariaLabel`],[`mat-menu-item`,``,3,`click`,`disabled`],[`mat-menu-item`,``,3,`click`],[1,`px-4`,`py-2`,`text-sm`,`text-gray-500`],[`data-testid`,`mobile-menu-btn`,1,`mobile-menu-trigger`,3,`icon`,`ariaLabel`,`matMenuTriggerFor`,`badgeNumber`],[`mat-menu-item`,``,`data-testid`,`mobile-add-client-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-add-coach-btn`],[`mat-menu-item`,``,`data-testid`,`mobile-add-manager-btn`],[`mat-menu-item`,``,`data-testid`,`mobile-add-training-group-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-admin-btn`],[`mat-menu-item`,``,`data-testid`,`mobile-ai-chat-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-plan-editor-btn`],[`mat-menu-item`,``,`data-testid`,`mobile-messaging-btn`,3,`click`],[`matBadgeSize`,`small`,3,`matBadge`,`matBadgeHidden`],[`mat-menu-item`,``,`data-testid`,`mobile-notifications-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-settings-btn`,3,`click`,`disabled`],[`mat-menu-item`,``,`data-testid`,`mobile-logout-btn`,3,`click`],[`mat-flat-button`,``,`data-testid`,`add-coach-btn`,1,`flex`,`items-center`,`justify-start`,3,`pointerup`],[`mat-flat-button`,``,`data-testid`,`add-manager-btn`,1,`flex`,`items-center`,`justify-start`,3,`pointerup`],[`data-testid`,`admin-btn`,3,`pointerup`,`icon`,`ariaLabel`],[`data-testid`,`plan-editor-btn`,3,`pointerup`,`icon`,`ariaLabel`],[`mat-menu-item`,``,`data-testid`,`mobile-add-coach-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-add-manager-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-admin-btn`,3,`click`],[`mat-menu-item`,``,`data-testid`,`mobile-plan-editor-btn`,3,`click`]],template:function(e,i){if(e&1&&(Bi$3(0,`div`,2)(1,`div`,3)(2,`div`,4)(3,`div`,5)(4,`button`,6),OC(5,`translate`),jh$3(`pointerup`,function(){return i.openAddClient()}),Bi$3(6,`mat-icon`),lC(7,`person_add`),vl$4(),Bi$3(8,`span`,7),lC(9),OC(10,`translate`),vl$4()(),fw(11,Kp,7,6,`button`,8),fw(12,qp,7,6,`button`,9),Bi$3(13,`button`,10),OC(14,`translate`),jh$3(`pointerup`,function(){return i.openAddTrainingGroup()}),Bi$3(15,`mat-icon`),lC(16,`group_add`),vl$4(),Bi$3(17,`span`,7),lC(18),OC(19,`translate`),vl$4()()(),Bi$3(20,`div`,11),fw(21,Gp,2,4,`app-icon-button`,12),Bi$3(22,`app-icon-button`,13),OC(23,`translate`),jh$3(`pointerup`,function(){return i.openAiChat()}),vl$4(),fw(24,Yp,2,4,`app-icon-button`,14),Bi$3(25,`app-icon-button`,15),OC(26,`translate`),jh$3(`pointerup`,function(){return i.openMessaging()}),vl$4(),Bi$3(27,`app-icon-button`,16),OC(28,`translate`),jh$3(`pointerup`,function(){return i.openNotifications()}),vl$4()()()(),Rh$3(29,`app-icon-button`,17),OC(30,`translate`),Bi$3(31,`mat-menu`,null,0)(33,`button`,18),jh$3(`click`,function(){return i.openSettings()}),Bi$3(34,`mat-icon`),lC(35,`settings`),vl$4(),Bi$3(36,`span`),lC(37),OC(38,`translate`),vl$4()(),Bi$3(39,`button`,19),jh$3(`click`,function(){return i.logout()}),Bi$3(40,`mat-icon`),lC(41,`logout`),vl$4(),Bi$3(42,`span`),lC(43),OC(44,`translate`),vl$4()(),Rh$3(45,`mat-divider`),Bi$3(46,`div`,20),lC(47),vl$4()(),Rh$3(48,`app-icon-button`,21),OC(49,`translate`),Bi$3(50,`mat-menu`,null,1)(52,`div`)(53,`button`,22),jh$3(`click`,function(){return i.openAddClient()}),Bi$3(54,`mat-icon`),lC(55,`person_add`),vl$4(),Bi$3(56,`span`),lC(57),OC(58,`translate`),vl$4()(),fw(59,Zp,6,3,`button`,23),fw(60,Jp,6,3,`button`,24),Bi$3(61,`button`,25),jh$3(`click`,function(){return i.openAddTrainingGroup()}),Bi$3(62,`mat-icon`),lC(63,`group_add`),vl$4(),Bi$3(64,`span`),lC(65),OC(66,`translate`),vl$4()(),Rh$3(67,`mat-divider`),fw(68,Qp,6,3,`button`,26),Bi$3(69,`button`,27),jh$3(`click`,function(){return i.openAiChat()}),Bi$3(70,`mat-icon`),lC(71,`smart_toy`),vl$4(),Bi$3(72,`span`),lC(73),OC(74,`translate`),vl$4()(),fw(75,Xp,6,3,`button`,28),Bi$3(76,`button`,29),jh$3(`click`,function(){return i.openMessaging()}),Bi$3(77,`mat-icon`,30),lC(78,`send`),vl$4(),Bi$3(79,`span`),lC(80),OC(81,`translate`),vl$4()(),Bi$3(82,`button`,31),jh$3(`click`,function(){return i.openNotifications()}),Bi$3(83,`mat-icon`,30),lC(84,`notifications`),vl$4(),Bi$3(85,`span`),lC(86),OC(87,`translate`),vl$4()()(),Rh$3(88,`mat-divider`),Bi$3(89,`button`,32),jh$3(`click`,function(){return i.openSettings()}),Bi$3(90,`mat-icon`),lC(91,`settings`),vl$4(),Bi$3(92,`span`),lC(93),OC(94,`translate`),vl$4()(),Bi$3(95,`button`,33),jh$3(`click`,function(){return i.logout()}),Bi$3(96,`mat-icon`),lC(97,`logout`),vl$4(),Bi$3(98,`span`),lC(99),OC(100,`translate`),vl$4()(),Rh$3(101,`mat-divider`),Bi$3(102,`div`,20),lC(103),vl$4()()()),e&2){let s=jw(32),u=jw(51);sE(),Yh$3(`nav-locked`,i.locked()),xh$2(`inert`,i.locked()?``:null),sE(3),xh$2(`aria-label`,LC(5,48,`dashboard.addClient`)),sE(5),ig(LC(10,50,`dashboard.addClient`)),sE(2),pw(i.isAdminOrManager()?11:-1),sE(),pw(i.isAdmin()?12:-1),sE(),xh$2(`aria-label`,LC(14,52,`dashboard.addTrainingGroup`)),sE(5),ig(LC(19,54,`dashboard.addTrainingGroup`)),sE(3),pw(i.isAdmin()?21:-1),sE(),Ah$2(`icon`,`smart_toy`)(`ariaLabel`,LC(23,56,`agent.supportLaunc
7375her`)),sE(2),pw(i.canOpenPlanEditor()?24:-1),sE(),Ah$2(`icon`,`send`)(`ariaLabel`,LC(26,58,`common.messages`))(`badgeNumber`,i.messagingService.totalUnread()),sE(2),Ah$2(`icon`,`notifications`)(`ariaLabel`,LC(28,60,`common.notifications`))(`badgeNumber`,i.notificationsService.unreadCount()),sE(2),Ah$2(`icon`,`menu`)(`matMenuTriggerFor`,s)(`ariaLabel`,LC(30,62,`common.menu`)),sE(4),Ah$2(`disabled`,i.locked()),sE(4),ig(LC(38,64,`common.settings`)),sE(6),ig(LC(44,66,`common.logout`)),sE(4),Cl$4(`Version `,i.version),sE(),Ah$2(`icon`,`menu`)(`ariaLabel`,LC(49,68,`common.menu`))(`matMenuTriggerFor`,u)(`badgeNumber`,i.mobileMenuBadgeCount()),sE(4),xh$2(`inert`,i.locked()?``:null),sE(5),ig(LC(58,70,`dashboard.addClient`)),sE(2),pw(i.isAdminOrManager()?59:-1),sE(),pw(i.isAdmin()?60:-1),sE(5),ig(LC(66,72,`dashboard.addTrainingGroup`)),sE(3),pw(i.isAdmin()?68:-1),sE(5),ig(LC(74,74,`agent.supportLauncher`)),sE(2),pw(i.canOpenPlanEditor()?75:-1),sE(2),Ah$2(`matBadge`,i.messagingService.totalUnread())(`matBadgeHidden`,!i.messagingService.totalUnread()),sE(3),ig(LC(81,76,`common.messages`)),sE(3),Ah$2(`matBadge`,i.notificationsService.unreadCount())(`matBadgeHidden`,!i.notificationsService.unreadCount()),sE(3),ig(LC(87,78,`common.notifications`)),sE(3),Ah$2(`disabled`,i.locked()),sE(4),ig(LC(94,80,`common.settings`)),sE(6),ig(LC(100,82,`common.logout`)),sE(4),Cl$4(`Version `,i.version)}},dependencies:[yt$7,wt$5,Ap$1,wp$2,en$4,Be$2,b$3,Me$3,en$3,L$4,oe$3,Jt$3,rn$4,sn$4,W$6,Q$1,Xp$1],styles:[`.content[_ngcontent-%COMP%] .page-button[_ngcontent-%COMP%]{width:max-content;padding:0 10px 0 20px;align-items:center;justify-content:flex-start}@media(max-width:760px){.content[_ngcontent-%COMP%] .desktop-nav[_ngcontent-%COMP%]{display:none}}.content.nav-locked[_ngcontent-%COMP%]{opacity:.5}.mobile-menu-trigger[_ngcontent-%COMP%]{display:none}@media(max-width:760px){.mobile-menu-trigger[_ngcontent-%COMP%]{display:inline-flex}.settings-menu-trigger[_ngcontent-%COMP%]{display:none}}.checklist-btn[_ngcontent-%COMP%]{font-weight:600;position:relative;white-space:nowrap;overflow:visible!important}.ai-chat-gradient[_ngcontent-%COMP%] button.icon-button{background:linear-gradient(135deg,var(--%NS%primaryYellow),var(--%NS%purple))!important;color:var(--%NS%primaryBlack)!important}.ai-chat-gradient[_ngcontent-%COMP%] button.icon-button:hover{background:linear-gradient(135deg,color-mix(in srgb,var(--%NS%primaryYellow) 85%,black),color-mix(in srgb,var(--%NS%purple) 85%,black))!important}.ai-chat-gradient[_ngcontent-%COMP%] button.icon-button:active{transform:translateY(1px)}`]})};var ii=`Service workers are disabled or not supported by this browser`;var _t=class{serviceWorker;worker;registration;events;constructor(t,e){if(this.serviceWorker=t,!t)this.worker=this.events=this.registration=new b$1(i=>i.error(new T$4(5601,!1)));else{let i=null,s=new ee$5;this.worker=new b$1(F=>(i!==null&&F.next(i),s.subscribe(ie=>F.next(ie))));let u=()=>{let{controller:F}=t;F!==null&&(i=F,s.next(i))};t.addEventListener(`controllerchange`,u),u(),this.registration=this.worker.pipe(Iu$2(()=>t.getRegistration().then(F=>{if(!F)throw new T$4(5601,!1);return F})));let v=new ee$5;this.events=v.asObservable();let S=F=>{let{data:ie}=F;ie?.type&&v.next(ie)};t.addEventListener(`message`,S),e?.get(Ur$4,null,{optional:!0})?.onDestroy(()=>{t.removeEventListener(`controllerchange`,u),t.removeEventListener(`message`,S)})}}postMessage(t,e){return new Promise(i=>{this.worker.pipe(_t$9(1)).subscribe(s=>{s.postMessage(q$1({action:t},e)),i()})})}postMessageWithOperation(t,e,i){let s=this.waitForOperationCompleted(i),u=this.postMessage(t,e);return Promise.all([u,s]).then(([,v])=>v)}generateNonce(){return Math.round(Math.random()*1e7)}eventsOfType(t){let e;return typeof t==`string`?e=i=>i.type===t:e=i=>t.includes(i.type),this.events.pipe(hn$4(e))}nextEventOfType(t){return this.eventsOfType(t).pipe(_t$9(1))}waitForOperationCompleted(t){return new Promise((e,i)=>{this.eventsOfType(`OPERATION_COMPLETED`).pipe(hn$4(s=>s.nonce===t),_t$9(1),Ae$3(s=>{if(s.result!==void 0)return s.result;throw new Error(s.error)})).subscribe({next:e,error:i})})}get isEnabled(){return!!this.serviceWorker}};var ec=(()=>{class n{sw;messages;
7375notificationClicks;notificationCloses;pushSubscriptionChanges;subscription;get isEnabled(){return this.sw.isEnabled}pushManager=null;subscriptionChanges=new ee$5;constructor(e){if(this.sw=e,!e.isEnabled){this.messages=Mm,this.notificationClicks=Mm,this.notificationCloses=Mm,this.pushSubscriptionChanges=Mm,this.subscription=Mm;return}this.messages=this.sw.eventsOfType(`PUSH`).pipe(Ae$3(s=>s.data)),this.notificationClicks=this.sw.eventsOfType(`NOTIFICATION_CLICK`).pipe(Ae$3(s=>s.data)),this.notificationCloses=this.sw.eventsOfType(`NOTIFICATION_CLOSE`).pipe(Ae$3(s=>s.data)),this.pushSubscriptionChanges=this.sw.eventsOfType(`PUSH_SUBSCRIPTION_CHANGE`).pipe(Ae$3(s=>s.data)),this.pushManager=this.sw.registration.pipe(Ae$3(s=>s.pushManager));let i=this.pushManager.pipe(Iu$2(s=>s.getSubscription()));this.subscription=new b$1(s=>{let u=i.subscribe(s),v=this.subscriptionChanges.subscribe(s);return()=>{u.unsubscribe(),v.unsubscribe()}})}requestSubscription(e){if(!this.sw.isEnabled||this.pushManager===null)return Promise.reject(new Error(ii));let i={userVisibleOnly:!0},s=this.decodeBase64(e.serverPublicKey.replace(/_/g,`/`).replace(/-/g,`+`)),u=new Uint8Array(new ArrayBuffer(s.length));for(let v=0;v<s.length;v++)u[v]=s.charCodeAt(v);return i.applicationServerKey=u,new Promise((v,S)=>{this.pushManager.pipe(Iu$2(L=>L.subscribe(i)),_t$9(1)).subscribe({next:L=>{this.subscriptionChanges.next(L),v(L)},error:S})})}unsubscribe(){if(!this.sw.isEnabled)return Promise.reject(new Error(ii));let e=i=>{if(i===null)throw new T$4(5602,!1);return i.unsubscribe().then(s=>{if(!s)throw new T$4(5603,!1);this.subscriptionChanges.next(null)})};return new Promise((i,s)=>{this.subscription.pipe(_t$9(1),Iu$2(e)).subscribe({next:i,error:s})})}decodeBase64(e){return atob(e)}static ɵfac=function(i){return new(i||n)(Le$3(_t))};static ɵprov=ue$3({token:n,factory:n.ɵfac})}return n})();var ai=(()=>{class n{sw;versionUpdates;unrecoverable;get isEnabled(){return this.sw.isEnabled}ongoingCheckForUpdate=null;constructor(e){if(this.sw=e,!e.isEnabled){this.versionUpdates=Mm,this.unrecoverable=Mm;return}this.versionUpdates=this.sw.eventsOfType([`VERSION_DETECTED`,`VERSION_INSTALLATION_FAILED`,`VERSION_READY`,`NO_NEW_VERSION_DETECTED`]),this.unrecoverable=this.sw.eventsOfType(`UNRECOVERABLE_STATE`)}checkForUpdate(){if(!this.sw.isEnabled)return Promise.reject(new Error(ii));if(this.ongoingCheckForUpdate)return this.ongoingCheckForUpdate;let e=this.sw.generateNonce();return this.ongoingCheckForUpdate=this.sw.postMessageWithOperation(`CHECK_FOR_UPDATES`,{nonce:e},e).finally(()=>{this.ongoingCheckForUpdate=null}),this.ongoingCheckForUpdate}activateUpdate(){if(!this.sw.isEnabled)return Promise.reject(new T$4(5601,!1));let e=this.sw.generateNonce();return this.sw.postMessageWithOperation(`ACTIVATE_UPDATE`,{nonce:e},e)}static ɵfac=function(i){return new(i||n)(Le$3(_t))};static ɵprov=ue$3({token:n,factory:n.ɵfac})}return n})();var Lo=new N$2(``);function tc(){let n=E(Ot);if(!(`serviceWorker`in navigator&&n.enabled!==!1))return;let t=E(Lo),e=E(Z$4),i=E(Ur$4);e.runOutsideAngular(()=>{let s=navigator.serviceWorker,u=()=>s.controller?.postMessage({action:`INITIALIZE`});s.addEventListener(`controllerchange`,u),i.onDestroy(()=>{s.removeEventListener(`controllerchange`,u)})}),e.runOutsideAngular(()=>{let s,{registrationStrategy:u}=n;if(typeof u==`function`)s=new Promise(v=>u().subscribe(()=>v()));else{let[v,...S]=(u||`registerWhenStable:30000`).split(`:`);switch(v){case`registerImmediately`:s=Promise.resolve();break;case`registerWithDelay`:s=Fo(+S[0]||0);break;case`registerWhenStable`:s=Promise.race([i.whenStable(),Fo(+S[0])]);break;default:throw new T$4(5600,!1)}}s.then(()=>{i.destroyed||navigator.serviceWorker.register(t,{scope:n.scope,updateViaCache:n.updateViaCache,type:n.type}).catch(v=>console.error(or$5(5604,!1)))})})}function Fo(n){return new Promise(t=>setTimeout(t,n))}function nc(){let n=E(Ot),t=E(we$4);return new _t(n.enabled!==!1?navigator.serviceWorker:void 0,t)}var Ot=class{enabled;updateViaCache;type;scope;registrationStrategy};function Vo(n,t={}){return Bo$5([ec,ai,{provide:Lo,useValue:n},{provide:Ot,useValue:t},{provide:_t,useFactory:nc},UD(tc)])}var ic=600*1e3;var wn=class n{swUpdate=E(ai);snackBar=E(ht$8);translate=E(Gr$5);
7375showUpdateSnackbar(t){Dm([this.translate.get(`appUpdate.newVersionAvailable`),this.translate.get(`appUpdate.reload`)]).subscribe(([e,i])=>{this.snackBar.open(e,i,{duration:t,horizontalPosition:`right`,verticalPosition:`top`,panelClass:[`toast`,`toast-info`]}).onAction().subscribe(()=>document.location.reload())})}init(){if(!this.swUpdate.isEnabled){cj()||uu$2.log(`[AppUpdateService] Service worker not enabled â skipping update checks.`);return}this.swUpdate.versionUpdates.pipe(hn$4(t=>t.type===`VERSION_READY`)).subscribe(()=>{uu$2.log(`[AppUpdateService] New version ready â activating and reloading.`),this.swUpdate.activateUpdate().then(()=>this.showUpdateSnackbar(0))}),bm(ic).subscribe(()=>this.checkForUpdate())}checkForUpdate(){this.swUpdate.isEnabled&&this.swUpdate.checkForUpdate().catch(t=>uu$2.error(`[AppUpdateService] checkForUpdate failed:`,t))}static ɵfac=function(e){return new(e||n)};static ɵprov=ue$3({token:n,factory:n.ɵfac,providedIn:`root`})};var Sn=`input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([disabled]), select:not([disabled]), mat-select:not(.mat-mdc-select-disabled), [data-dialog-nav-item]`;var ac=`input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([disabled]), select:not([disabled]), [data-dialog-nav-item]`;var oc=`${Sn}, textarea:not([disabled])`;var rc=`[data-dialog-primary-action]:not([disabled])`;function Pn(n,t){return Array.from(n.querySelectorAll(t)).filter(e=>e.offsetParent!==null)}function Ho(n){n.focus(),n instanceof HTMLInputElement&&n.select()}function $o(n){return Pn(n,rc)[0]??null}function Wo(n,t){let e=Pn(n,Sn),i=e[e.indexOf(t)+1];if(i)return Ho(i),!0;let s=$o(n);return s?(s.focus(),!0):!1}function oi(n){let[t]=Pn(n,oc);t&&Ho(t)}function zo(n){let t=!1,e=()=>{t=!0},i=()=>{t=!1};document.addEventListener(`keydown`,e,!0),document.addEventListener(`pointerdown`,i,!0);let s=v=>{let S=v.target;if(v.key===`Enter`){if(!S.matches(ac))return;Wo(n,S)&&v.preventDefault();return}if(v.key===`Tab`&&!v.shiftKey){if(!S.matches(Sn))return;let L=Pn(n,Sn);if(L.indexOf(S)!==L.length-1)return;let F=$o(n);if(!F)return;v.preventDefault(),F.focus()}};n.addEventListener(`keydown`,s);let u=new MutationObserver(v=>{for(let{target:S}of v)!(S instanceof HTMLElement)||S.tagName!==`MAT-SELECT`||S.getAttribute(`aria-expanded`)!==`false`||document.activeElement!==S||requestAnimationFrame(()=>{document.activeElement===S&&t&&Wo(n,S)})});return u.observe(n,{attributes:!0,attributeFilter:[`aria-expanded`],subtree:!0}),()=>{n.removeEventListener(`keydown`,s),document.removeEventListener(`keydown`,e,!0),document.removeEventListener(`pointerdown`,i,!0),u.disconnect()}}var En=class n{dialog=E(pe$5);constructor(){this.dialog.afterOpened.subscribe(t=>{let e=t.overlayRef.overlayElement;if(!e.classList.contains(`dialog-styling`))return;let i=zo(e);t.closed.subscribe(i);let s=t.containerInstance._focusTrapped;s?s.pipe(_t$9(1)).subscribe(()=>oi(e)):oi(e)})}static ɵfac=function(e){return new(e||n)};static ɵprov=ue$3({token:n,factory:n.ɵfac,providedIn:`root`})};var lc=[`*`];var Mn=class n{static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-page-content-container`]],ngContentSelectors:lc,decls:2,vars:0,consts:[[1,`page-content`]],template:function(e,i){e&1&&(Rw(),Il$4(0,`div`,0),kw(1),El$4())},styles:[`[_nghost-%COMP%]{display:block;height:100%;min-height:0;overflow:hidden}.page-content[_ngcontent-%COMP%]{width:100%;height:100%;max-height:100%;min-height:0;position:relative;overflow-y:auto;overflow-x:hidden;box-sizing:border-box;padding-right:12px}`]})};var sc=(n,t)=>({simple:n,"admin-route":t});function pc(n,t){n&1&&Rh$3(0,`app-side-navigation`,2)}function cc(n,t){n&1&&Rh$3(0,`app-app-logo`,3)}function dc(n,t){n&1&&Rh$3(0,`app-top-navigation`,4)}function mc(n,t){if(n&1){let e=Cw();Bi$3(0,`app-ai-chat-panel`,8),jh$3(`closed`,function(){ld$2(e);return ud$1(xw().chatState.closePanel())}),vl$4()}}function uc(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,9),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().planEditorState.closeWorkspace())}),vl$4(),Bi$3(1,`app-plan-editor-workspace`,8),jh$3(`closed`,function(){ld$2(e);return ud$1(xw().planEditorState.closeWorkspace())}),vl$4()}}function gc(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,10),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().notificationsService.closePanel())}),vl$4(),Bi$3(1,`app-notifications-panel`,8),jh$3(`closed`,function(){ld$2(e);return ud$1(xw().notificationsService.closePanel())}),vl$4()}}It.default.extend(jo.default);It.default.extend(qo.default);It.default.extend(Uo.default);It.default.extend(Ko.default);var kn=class n{showSidebar=ni$3(!1);router=E(G$4);settingsService=E(A$3);chatState=E(Ln$5);planEditorState=E(gt$6);notificationsService=E(ie$3);profileService=E(ie$4);coachChecklistService=E(Je$2);appUpdateService=E(wn);paymentRequiredService=E(ut$5);dialogFieldNavigationService=E(En);dialog=E(pe$5);isBillingRoute=ni$3(!1);isPublicRoute=ni$3(!1);lockDialogRef=null;constructor(){this.settingsService.initLanguage(),this.appUpdateService.init(),xd$2(()=>{let t=this.paymentRequiredService.locked()&&!this.isBillingRoute()&&!this.isPublicRoute();if(t&&!this.lockDialogRef){let e=this.dialog.open(this.profileService.isManager()?mr$4:nr$4,{panelClass:[`dialog-styling`,`dialog-compact`],backdropClass:`dialog-backdrop`,width:`min(440px, 90vw)`,disableClose:!0});this.lockDialogRef=e,e.closed.subscribe(()=>{this.lockDialogRef===e&&(this.lockDialogRef=null)})}else!t&&this.lockDialogRef&&this.lockDialogRef.close()})}isAdminRoute=ni$3(!1);checklistLoaded=!1;publicRoutes=[`login`,`register`,`forgot-password`,`reset-password`,`pagenotfound`];ngOnInit(){this.router.events.pipe(hn$4(t=>t instanceof $$4)).subscribe(t=>{let e=t.urlAfterRedirects.split(`/`),i=e[1].split(`?`)[0],s=this.publicRoutes.includes(i);this.showSidebar.set(!s),this.isAdminRoute.set(i===`admin`),this.isBillingRoute.set(i===`manager`&&e[2]?.split(`?`)[0]===`billing`),this.isPublicRoute.set(s),this.appUpdateService.checkForUpdate(),!s&&!this.checklistLoaded&&(this.checklistLoaded=!0,this.coachChecklistService.loadState())})}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-root`]],decls:12,vars:9,consts:[[1,`main`],[1,`main-grid`,3,`ngClass`],[1,`side-nav`],[1,`logo`],[1,`top-nav`],[1,`page`],[1,`route-anim-wrapper`],[`aria-hidden`,`true`],[3,`closed`],[`aria-hidden`,`true`,1,`workspace-backdrop`,3,`pointerup`],[`aria-hidden`,`true`,1,`panel-backdrop`,3,`pointerup`]],template:function(e,i){e&1&&(Bi$3(0,`main`,0)(1,`div`,1),fw(2,pc,1,0,`app-side-navigation`,2)(3,cc,1,0,`app-app-logo`,3),fw(4,dc,1,0,`app-top-navigation`,4),Bi$3(5,`app-page-content-container`,5)(6,`div`,6),Rh$3(7,`router-outlet`),vl$4()()()(),fw(8,mc,1,0,`app-ai-chat-panel`),fw(9,uc,2,0),fw(10,gc,2,0),Rh$3(11,`app-version-watermark`,7)),e&2&&(sE(),Ah$2(`ngClass`,_C(6,sc,!i.showSidebar(),i.isAdminRoute())),sE(),pw(i.showSidebar()&&!i.isAdminRoute()?2:i.isAdminRoute()?3:-1),sE(2),pw(i.showSidebar()?4:-1),sE(4),pw(i.chatState.isPanelOpen()?8:-1),sE(),pw(i.planEditorState.isOpen()&&i.profileService.canAccessPlanEditor()?9:-1),sE(),pw(i.notificationsService.isPanelOpen()?10:-1))},dependencies:[mr$5,hn,Zi$3,Ka$3,yn,rr$3,Mn,dn,gn,mn,gr$4],styles:[`.main[_ngcontent-%COMP%]{height:100%}.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%]{--%NS%grid-gap: var(--%NS%shell-gap);width:100%;height:100%;display:grid;grid-template-columns:var(--%NS%rail-width) calc(100% - var(--%NS%rail-width) - var(--%NS%grid-gap));grid-template-rows:var(--%NS%shell-header-height) calc(100% - var(--%NS%shell-header-height) - var(--%NS%grid-gap));gap:var(--%NS%grid-gap)}@media(max-width:760px){.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%]{--%NS%grid-gap: 4px}}.main[_ngcontent-%COMP%] .main-grid.simple[_ngcontent-%COMP%]{display:flex}.main[_ngcontent-%COMP%] .main-grid.simple[_ngcontent-%COMP%] .page[_ngcontent-%COMP%]{width:100%}.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%]{grid-column:1;grid-row:1;display:flex;align-items:center;position:relative;overflow:visible;z-index:25;justify-self:start}.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%] .side-nav[_ngcontent-%COMP%]{width:100%;min-width:0;position:relative;overflow:visible;grid-column:1;grid-row:1/-1;z-index:20}
7375.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%] .top-nav[_ngcontent-%COMP%]{grid-column:2;grid-row:1;align-content:center;min-width:0;padding-right:calc(12px + var(--%NS%scrollbar-width, 5px))}.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%] .page[_ngcontent-%COMP%]{grid-column:2;grid-row:2;min-height:0;height:100%;overflow:hidden}.main[_ngcontent-%COMP%] .main-grid[_ngcontent-%COMP%] .route-anim-wrapper[_ngcontent-%COMP%]{position:relative;width:100%;height:100%}.main[_ngcontent-%COMP%] .main-grid.admin-route[_ngcontent-%COMP%] .page[_ngcontent-%COMP%]{grid-column:1/-1;grid-row:2}@media(max-width:760px){.main[_ngcontent-%COMP%] .main-grid.admin-route[_ngcontent-%COMP%]{grid-template-columns:1fr}.main[_ngcontent-%COMP%] .main-grid.admin-route[_ngcontent-%COMP%] .top-nav[_ngcontent-%COMP%]{grid-column:1}}.panel-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;background:#00000080;z-index:999;animation:backdropIn .25s ease-out}.workspace-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;background:#0000009e;z-index:1190;animation:backdropIn .25s ease-out}`]})};var _c=`@`;var fc=(()=>{class n{doc;delegate;zone;animationType;moduleImpl;_rendererFactoryPromise=null;
7375scheduler=null;injector=E(we$4);loadingSchedulerFn=E(hc,{optional:!0});_engine;constructor(e,i,s,u,v){this.doc=e,this.delegate=i,this.zone=s,this.animationType=u,this.moduleImpl=v}ngOnDestroy(){this._engine?.flush()}loadImpl(){let e=()=>this.moduleImpl??import(`./chunk-BsJg6VuS.js`).then(s=>s),i;return this.loadingSchedulerFn?i=this.loadingSchedulerFn(e):i=e(),i.catch(s=>{throw new T$4(5300,!1)}).then(({ɵcreateEngine:s,ɵAnimationRendererFactory:u})=>{this._engine=s(this.animationType,this.doc);let v=new u(this.delegate,this._engine,this.zone);return this.delegate=v,v})}createRenderer(e,i){let s=this.delegate.createRenderer(e,i);if(s.ɵtype===0)return s;typeof s.throwOnSyntheticProps==`boolean`&&(s.throwOnSyntheticProps=!1);let u=new ri(s);return i?.data?.animation&&!this._rendererFactoryPromise&&(this._rendererFactoryPromise=this.loadImpl()),this._rendererFactoryPromise?.then(v=>{let S=v.createRenderer(e,i);u.use(S),this.scheduler??=this.injector.get(Te$6,null,{optional:!0}),this.scheduler?.notify(10)}).catch(v=>{u.use(s)}),u}begin(){this.delegate.begin?.()}end(){this.delegate.end?.()}whenRenderingDone(){return this.delegate.whenRenderingDone?.()??Promise.resolve()}componentReplaced(e){this._engine?.flush(),this.delegate.componentReplaced?.(e)}static ɵfac=function(i){XE()};static ɵprov=ue$3({token:n,factory:n.ɵfac})}return n})();var ri=class{delegate;replay=[];ɵtype=1;constructor(t){this.delegate=t}use(t){if(this.delegate=t,this.replay!==null){for(let e of this.replay)e(t);this.replay=null}}get data(){return this.delegate.data}destroy(){this.replay=null,this.delegate.destroy()}createElement(t,e){return this.delegate.createElement(t,e)}createComment(t){return this.delegate.createComment(t)}createText(t){return this.delegate.createText(t)}get destroyNode(){return this.delegate.destroyNode}appendChild(t,e){this.delegate.appendChild(t,e)}insertBefore(t,e,i,s){this.delegate.insertBefore(t,e,i,s)}removeChild(t,e,i,s){this.delegate.removeChild(t,e,i,s)}selectRootElement(t,e){return this.delegate.selectRootElement(t,e)}parentNode(t){return this.delegate.parentNode(t)}nextSibling(t){return this.delegate.nextSibling(t)}setAttribute(t,e,i,s){this.delegate.setAttribute(t,e,i,s)}removeAttribute(t,e,i){this.delegate.removeAttribute(t,e,i)}addClass(t,e){this.delegate.addClass(t,e)}removeClass(t,e){this.delegate.removeClass(t,e)}setStyle(t,e,i,s){this.delegate.setStyle(t,e,i,s)}removeStyle(t,e,i){this.delegate.removeStyle(t,e,i)}setProperty(t,e,i){this.shouldReplay(e)&&this.replay.push(s=>s.setProperty(t,e,i)),this.delegate.setProperty(t,e,i)}setValue(t,e){this.delegate.setValue(t,e)}listen(t,e,i,s){return this.shouldReplay(e)&&this.replay.push(u=>u.listen(t,e,i,s)),this.delegate.listen(t,e,i,s)}shouldReplay(t){return this.replay!==null&&t.startsWith(_c)}};var hc=new N$2(``);function Go(n=`animations`){return pe$3(`NgAsyncAnimations`),Bo$5([{provide:Rr$5,useFactory:()=>new fc(E(ti$3),E(hr$5),E(Z$4),n)},{provide:Ny,useValue:n===`noop`?`NoopAnimations`:`BrowserAnimations`}])}var Zo=new N$2(`TRANSLATE_HTTP_LOADER_CONFIG`);var xc=(()=>{class n{http;config;constructor(){this.config=q$1({resources:[],enforceLoading:!1,useHttpBackend:!1},E(Zo)),this.http=this.config.useHttpBackend?new yo$5(E(Dr$5)):E(yo$5)}getTranslation(e){let i=this.config.enforceLoading?`?enforceLoading=${Date.now()}`:``,s=this.config.resources.map(u=>{let v=typeof u==`string`?`${u}${e}.json`:`${u.prefix}${e}${u.suffix??`.json`}`,S=this.http.get(`${v}${i}`);return this.config.failOnError?S:S.pipe(Ms$4(L=>(console.warn(`@ngx-translate/http-loader: error loading translation for ${e}:`,L),um({}))))});return s.length===0?um({}):Tm(s).pipe(Ae$3(u=>u.reduce((v,S)=>Kr$5(v,S),{})))}static ɵfac=function(i){return new(i||n)};static ɵprov=ue$3({token:n,factory:n.ɵfac})}return n})();function Jo(n={}){if(`resources`in n&&n.resources)return Yo(n);let t=n;return Yo({enforceLoading:t.enforceLoading??!1,useHttpBackend:t.useHttpBackend??!1,failOnError:t.failOnError??!1,resources:[{prefix:t.prefix??`/assets/i18n/`,suffix:t.suffix??`.json`}]})}function Yo(n={}){return[{provide:Zo,useValue:q$1({resources:[`/assets/i18n/`]},n)},{provide:kt$6,useClass:xc}]}var X=()=>ps$4(null,null,function*(){let n=E(p$2),t=E(ie$4),e=E(G$4),i=t.profile()?.role;if(i!==`coach`&&i!==`manager`)return!0;let s=yield n.getStatus({allowUnavailable:!0});return!s||s.completed?!0:e.createUrlTree([`/onboarding`])});var Qo=()=>{let n=E(ie$4),t=E(G$4);return n.profile()?.role!==`admin`?t.createUrlTree([`/`,`dashboard`]):!0};var Z=()=>ps$4(null,null,function*(){let n=E(ne$3),t=E(G$4);return n.tokenExpired()?(yield n.refreshAccessToken())?!0:(n.logout(),t.createUrlTree([`/`,`login`])):n.shouldRefreshToken()&&!(yield n.refreshAccessToken())?(n.logout(),t.createUrlTree([`/`,`login`])):!0});var li=()=>{let n=E(ie$4),t=E(G$4);return n.isCoach()||n.isManager()||n.isAdmin()?!0:t.createUrlTree([`/`,`dashboard`])};var ft=()=>{let n=E(ie$4),t=E(G$4);return n.isAdminOrManager()?!0:t.createUrlTree([`/`,`dashboard`])};var Xo=()=>{let n=E(ie$4),t=E(G$4);return n.canAccessReports()?!0:t.createUrlTree([`/`,`dashboard`])};function vc(n,t){n&1&&(Bi$3(0,`mat-error`,17)(1,`mat-icon`,20),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.emailRequired`),` `))}function Cc(n,t){n&1&&(Bi$3(0,`mat-error`,17)(1,`mat-icon`,20),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.emailInvalid`),` `))}function bc(n,t){if(n&1&&(Bi$3(0,`mat-error`,18)(1,`mat-icon`,20),lC(2,`error`),vl$4(),lC(3),vl$4()),n&2){let e=xw(2);sE(3),Cl$4(` `,e.error(),` `)}}function yc(n,t){if(n&1){let e=Cw();Bi$3(0,`form`,13),jh$3(`ngSubmit`,function(){ld$2(e);return ud$1(xw().onSubmit())}),Bi$3(1,`div`,14)(2,`mat-form-field`,15)(3,`mat-label`),lC(4),OC(5,`translate`),vl$4(),Rh$3(6,`input`,16),WE(),fw(7,vc,5,3,`mat-error`,17),fw(8,Cc,5,3,`mat-error`,17),vl$4(),fw(9,bc,4,1,`mat-error`,18),Bi$3(10,`button`,19),lC(11),OC(12,`translate`),vl$4()()()}if(n&2){let e=xw();Ah$2(`formGroup`,e.form),sE(4),ig(LC(5,7,`common.email`)),sE(2),zE(),sE(),pw(e.form.get(`email`)?.touched&&e.form.get(`email`)?.hasError(`required`)?7:-1),sE(),pw(e.form.get(`email`)?.touched&&e.form.get(`email`)?.hasError(`email`)?8:-1),sE(),pw(e.error()?9:-1),sE(),Ah$2(`disabled`,e.loading()),sE(),Cl$4(` `,LC(12,9,`forgotPassword.sendCode`),` `)}}function wc(n,t){n&1&&(Bi$3(0,`div`,10)(1,`div`,21)(2,`mat-icon`),lC(3,`check_circle`),vl$4(),Bi$3(4,`span`,22),lC(5),OC(6,`translate`),vl$4()(),Bi$3(7,`p`,23),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`a`,24),lC(11),OC(12,`translate`),vl$4()()),n&2&&(sE(5),ig(LC(6,3,`forgotPassword.successTitle`)),sE(3),ig(LC(9,5,`forgotPassword.successDescription`)),sE(3),Cl$4(` `,LC(12,7,`forgotPassword.continueToReset`),` `))}var On=class n{api=E(E$1);translate=E(Gr$5);submitted=ni$3(!1);loading=ni$3(!1);error=ni$3(null);form=new P({email:new $$1(``,[ye$4.required,ye$4.email])});onSubmit(){return ps$4(this,null,function*(){if(this.form.invali
7375d){this.form.markAllAsTouched();return}this.loading.set(!0),this.error.set(null);try{yield this.api.post(`/forgotten_password`,{email:this.form.value.email,language:this.translate.getCurrentLang()??`en`}),this.submitted.set(!0)}catch(t){uu$2.error(`Forgot password request failed:`,t),this.error.set(this.translate.instant(`forgotPassword.error`))}finally{this.loading.set(!1)}})}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-forgot-password`]],decls:20,vars:12,consts:[[1,`forgot-password-page-content`],[1,`p-4`,`max-w-7xl`,`mx-auto`],[`appearance`,`outlined`,1,`md:min-w-2xl`],[1,`grid`,`md:grid-cols-2`,`gap-6`],[1,`flex`,`flex-col`,`gap-4`,`p-4`],[3,`logoOnly`],[1,`text-3xl`],[1,`mt-6`],[1,`flex`,`flex-col`,`gap-4`,`p-4`,`md:mt-12`],[3,`formGroup`],[`data-testid`,`forgot-password-success`,1,`flex`,`flex-col`,`gap-4`],[`align`,`end`],[`mat-button`,``,`routerLink`,`/login`,`data-testid`,`forgot-password-back`],[3,`ngSubmit`,`formGroup`],[1,`flex`,`flex-col`,`gap-2`],[1,`w-full`],[`matInput`,``,`type`,`email`,`formControlName`,`email`,`data-testid`,`forgot-password-email`],[`data-testid`,`forgot-password-email-error`],[`data-testid`,`forgot-password-error`,1,`text-sm`],[`mat-flat-button`,``,`type`,`submit`,`data-testid`,`forgot-password-submit`,1,`w-full`,`mt-2`,3,`disabled`],[1,`form-field-error-icon`],[1,`flex`,`items-center`,`gap-2`,`text-green-600`],[1,`font-medium`],[1,`text-sm`],[`mat-flat-button`,``,`routerLink`,`/reset-password`,`data-testid`,`forgot-password-continue`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0)(1,`div`,1)(2,`mat-card`,2)(3,`mat-card-content`)(4,`div`,3)(5,`div`,4),Rh$3(6,`app-app-logo`,5),Bi$3(7,`h1`,6),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`p`,7),lC(11),OC(12,`translate`),vl$4()(),Bi$3(13,`div`,8),fw(14,yc,13,11,`form`,9),fw(15,wc,13,9,`div`,10),vl$4()()(),Bi$3(16,`mat-card-actions`,11)(17,`a`,12),lC(18),OC(19,`translate`),vl$4()()()()()),e&2&&(sE(6),Ah$2(`logoOnly`,!0),sE(2),ig(LC(9,6,`forgotPassword.title`)),sE(3),ig(LC(12,8,`forgotPassword.description`)),sE(3),pw(i.submitted()?-1:14),sE(),pw(i.submitted()?15:-1),sE(3),Cl$4(` `,LC(19,10,`forgotPassword.backToLogin`),` `))},dependencies:[_t$8,yt$6,Vs$4,vt$6,en$4,je$3,X$5,gt$7,Be$2,Pe$4,Qn$4,Zn$4,Qe$2,qn$5,$n$4,bn$4,Vn$4,Ap$1,wp$2,yt$7,wt$5,rr$3,ea$4,si$3,Xp$1],styles:[`.forgot-password-page-content[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.forgot-password-page-content[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper{display:block!important}`]})};function Sc(n,t){n&1&&(Bi$3(0,`mat-error`,12)(1,`mat-icon`,22),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.emailRequired`)))}function Pc(n,t){n&1&&(Bi$3(0,`mat-error`,12)(1,`mat-icon`,22),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.emailInvalid`),` `))}function Ec(n,t){n&1&&(Bi$3(0,`mat-error`,14)(1,`mat-icon`,22),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.passwordRequired`)))}function Mc(n,t){n&1&&(Bi$3(0,`mat-error`,14)(1,`mat-icon`,22),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.passwordShort`),` `))}function kc(n,t){if(n&1&&(Bi$3(0,`mat-error`,15)(1,`mat-icon`,22),lC(2,`error`),vl$4(),lC(3),vl$4()),n&2){let e=xw();sE(3),Cl$4(` `,e.loginError(),` `)}}var pi=class n{data=E(bt$4);static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-athlete-login-error-dialog`]],decls:8,vars:3,consts:[[`mat-dialog-title`,``],[`align`,`end`],[`mat-flat-button`,``,3,`mat-dialog-close`]],template:function(e,i){e&1&&(Bi$3(0,`h2`,0),lC(1),vl$4(),Bi$3(2,`mat-dialog-content`)(3,`p`),lC(4),vl$4()(),Bi$3(5,`mat-dialog-actions`,1)(6,`button`,2),lC(7),vl$4()()),e&2&&(sE(),ig(i.data.title),sE(3),ig(i.data.message),sE(3),ig(i.data.ok))},dependencies:[Ap$1,wp$2,Wt$2,Vt$1,Gt$2,qt$4,Ht$1],encapsulation:2})};var In=class n{loginService=E(ne$3);profileService=E(ie$4);dialog=E(O$1);overlay=E(Ue$2);translate=E(Gr$5);router=E(G$4);route=E(V$2);toast=E(ut$6);isLoading=this.loginService.isLoading;form=new P({email:new $$1(``,[ye$4.required,ye$4.email]),password:new $$1(``,[ye$4.required,ye$4.minLength(8)])});version=lt$5.version;loginError=ni$3(null);
7375onSubmit(){if(this.form.valid){this.loginError.set(null);let t=this.form.value;this.loginService.login(t).then(e=>ps$4(this,null,function*(){e?this.isAthleteRole()?(yield this.loginService.logout({skipNavigation:!0}),this.openAthleteErrorDialog()):this.redirectToMainPage():this.loginError.set(`Login failed. Please check your credentials.`)}))}else this.form.markAllAsTouched(),this.toast.show(`Enter a valid email and password (min 8 chars).`,`warning`)}ngAfterViewInit(){this.loginService.tokenExpired()||(this.isAthleteRole()?this.loginService.logout({skipNavigation:!0}).then(()=>{this.openAthleteErrorDialog()}):this.redirectToMainPage());let t=this.route.snapshot.queryParamMap.get(`email`);t&&this.form.patchValue({email:t})}login(t){this.loginService.login(t.value).then(e=>ps$4(this,null,function*(){e&&(this.isAthleteRole()?(yield this.loginService.logout({skipNavigation:!0}),this.openAthleteErrorDialog()):this.redirectToMainPage())}))}redirectToMainPage(){uu$2.log(`login success`),this.router.navigateByUrl(`/dashboard`)}isAthleteRole(){return this.profileService.profile()?.role===`athlete`}openAthleteErrorDialog(){this.dialog.open(pi,{scrollStrategy:this.overlay.scrollStrategies.noop(),data:{title:this.translate.instant(`login.athleteRoleRequiredTitle`),message:this.translate.instant(`login.athleteRoleRequired`),ok:this.translate.instant(`common.ok`)}})}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-login-index`]],decls:43,vars:30,consts:[[`passwordInput`,``],[1,`login-page-content`],[1,`p-4`,`max-w-7xl`,`mx-auto`,3,`ngSubmit`,`formGroup`],[`appearance`,`outlined`,1,`md:min-w-2xl`],[1,`grid`,`md:grid-cols-2`,`gap-6`],[1,`flex`,`flex-col`,`gap-4`,`p-4`],[3,`logoOnly`],[1,`text-3xl`],[1,`mt-6`],[1,`flex`,`flex-col`,`gap-2`,`p-4`,`md:mt-12`],[1,`w-full`],[`matInput`,``,`type`,`email`,`formControlName`,`email`,`data-testid`,`login-email`,3,`keydown.enter`],[`data-testid`,`email-error`],[`matInput`,``,`type`,`password`,`formControlName`,`password`,`data-testid`,`login-password`],[`data-testid`,`password-error`],[`data-testid`,`login-error`,1,`text-sm`,`mt-2`],[1,`density-3`,`forgot-email-container`],[`mat-button`,``,`tabindex`,`0`,`routerLink`,`/forgot-password`,`data-testid`,`forgot-password-link`],[`align`,`end`],[`mat-button`,``,`tabindex`,`0`,`routerLink`,`/register`,`data-testid`,`create-account-link`],[`mat-flat-button`,``,`tabindex`,`0`,`type`,`submit`,`data-testid`,`login-submit`,3,`disabled`],[1,`fixed`,`bottom-4`,`right-4`,`text-sm`,`text-gray-500`],[1,`form-field-error-icon`]],template:function(e,i){if(e&1){let s=Cw();Bi$3(0,`div`,1)(1,`form`,2),jh$3(`ngSubmit`,function(){return i.onSubmit()}),Bi$3(2,`mat-card`,3)(3,`mat-card-content`)(4,`div`,4)(5,`div`,5),Rh$3(6,`app-app-logo`,6),Bi$3(7,`h1`,7),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`p`,8),lC(11),OC(12,`translate`),vl$4()(),Bi$3(13,`div`,9)(14,`mat-form-field`,10)(15,`mat-label`),lC(16),OC(17,`translate`),vl$4(),Bi$3(18,`input`,11),jh$3(`keydown.enter`,function(v){ld$2(s);let S=jw(26);return v.preventDefault(),ud$1(S.focus())}),vl$4(),WE(),fw(19,Sc,5,3,`mat-error`,12),fw(20,Pc,5,3,`mat-error`,12),vl$4(),Bi$3(2
73751,`mat-form-field`,10)(22,`mat-label`),lC(23),OC(24,`translate`),vl$4(),Rh$3(25,`input`,13,0),WE(),fw(27,Ec,5,3,`mat-error`,14),fw(28,Mc,5,3,`mat-error`,14),vl$4(),fw(29,kc,4,1,`mat-error`,15),Bi$3(30,`div`,16)(31,`a`,17),lC(32),OC(33,`translate`),vl$4()()()()(),Bi$3(34,`mat-card-actions`,18)(35,`a`,19),lC(36),OC(37,`translate`),vl$4(),Bi$3(38,`button`,20),lC(39),OC(40,`translate`),vl$4()()()(),Bi$3(41,`div`,21),lC(42),vl$4()()}e&2&&(sE(),Ah$2(`formGroup`,i.form),sE(5),Ah$2(`logoOnly`,!0),sE(2),ig(LC(9,16,`login.signIn`)),sE(3),ig(LC(12,18,`login.continue`)),sE(5),ig(LC(17,20,`common.email`)),sE(2),zE(),sE(),pw((i.form.get(`email`)?.touched||i.form.get(`email`)?.dirty)&&i.form.get(`email`)?.hasError(`required`)?19:-1),sE(),pw((i.form.get(`email`)?.touched||i.form.get(`email`)?.dirty)&&i.form.get(`email`)?.hasError(`email`)?20:-1),sE(3),ig(LC(24,22,`common.password`)),sE(2),zE(),sE(2),pw((i.form.get(`password`)?.touched||i.form.get(`password`)?.dirty)&&i.form.get(`password`)?.hasError(`required`)?27:-1),sE(),pw((i.form.get(`password`)?.touched||i.form.get(`password`)?.dirty)&&i.form.get(`password`)?.hasError(`minlength`)?28:-1),sE(),pw(i.loginError()?29:-1),sE(3),ig(LC(33,24,`login.forgotPassword`)),sE(4),ig(LC(37,26,`login.createAccount`)),sE(2),Ah$2(`disabled`,i.isLoading()),sE(),Cl$4(` `,LC(40,28,`login.signIn`),` `),sE(3),Cl$4(`v`,i.version))},dependencies:[_t$8,yt$6,Vs$4,vt$6,en$4,je$3,X$5,gt$7,Be$2,Pe$4,Jn$4,Zn$4,Qe$2,qn$5,$n$4,Ap$1,wp$2,Qn$4,bn$4,Vn$4,yt$7,wt$5,Wt$2,rr$3,ea$4,si$3,Xp$1],styles:[`.login-page-content[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.login-page-content[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper{display:block!important}`]})};var ht=class{static mustMatch(t,e){return i=>{let s=i,u=s.controls[t],v=s.controls[e];if(v.errors&&!v.errors.mustMatch)return null;if(u.value!==v.value)v.setErrors(W$4(q$1({},v.errors),{mustMatch:!0}));else{let S=q$1({},v.errors);delete S.mustMatch,v.setErrors(Object.keys(S).length?S:null)}return v.errors}}};function Oc(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,33),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().openUserTypeSelection())}),Bi$3(1,`p`,34),lC(2),OC(3,`translate`),Bi$3(4,`strong`),lC(5),OC(6,`translate`),vl$4()()()}if(n&2){let e=xw();sE(2),Cl$4(` `,LC(3,2,`register.registrationFor`),`: `),sE(3),ig(LC(6,4,`register.`+e.selectedUserType))}}function Ic(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.emailRequired`),` `))}function Tc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.emailInvalid`),` `))}function Nc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.firstNameRequired`),` `))}function Rc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.lastNameRequired`),` `))}function Dc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.licenceCodeRequired`),` `))}function Ac(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.passwordRequired`),` `))}function Bc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.passwordShort`),` `))}function Fc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.confirmPasswordRequired`),` `))}function Lc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.passwordsMustMatch`),` `))}function Vc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.companyNameRequired`),` `))}function Wc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.businessIdRequired`),` `))}function Hc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.addressRequired`),` `))}function $c(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.postcodeRequired`),` `))}function zc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.cityRequired`),` `))}function Uc(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,35),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`register.vatNumberRequired`),` `))}function jc(n,t){if(n&1){let e=Cw();Bi$3(0,`div`,22),yi$4(function(s){ld$2(e);return ud$1(xw().onManagerFieldsEnter(s))}),wc$4(function(s){ld$2(e);return ud$1(xw().onManagerFieldsLeave(s))}),Bi$3(1,`h3`,36),lC(2),OC(3,`translate`),vl$4(),Bi$3(4,`mat-form-field`,11)(5,`mat-label`),lC(6),OC(7,`translate`),vl$4(),Rh$3(8,`input`,37),WE(),fw(9,Vc,5,3,`mat-error`),vl$4(),Bi$3(10,`mat-form-field`,11)(11,`mat-label`),lC(12),OC(13,`translate`),vl$4(),Rh$3(14,`input`,38),WE(),fw(15,Wc,5,3,`mat-error`),vl$4(),Bi$3(16,`mat-form-field`,11)(17,`mat-label`),lC(18),OC(19,`translate`),vl$4(),Rh$3(20,`input`,39),WE(),fw(21,Hc,5,3,`mat-error`),vl$4(),Bi$3(22,`div`,40)(23,`mat-form-field`,11)(24,`mat-label`),lC(25),OC(26,`translate`),vl$4(),Rh$3(27,`input`,41),WE(),fw(28,$c,5,3,`mat-error`),vl$4(),Bi$3(29,`mat-form-field`,11)(30,`mat-label`),lC(31),OC(32,`translate`),vl$4(),Rh$3(33,`input`,42),WE(),fw(34,zc,5,3,`mat-error`),vl$4()(),Bi$3(35,`mat-form-field`,11)(36,`mat-label`),lC(37),OC(38,`translate`),vl$4(),Rh$3(39,`input`,43),WE(),fw(40,Uc,5,3,`mat-error`),vl$4()()}if(n&2){let e=xw();sE(2),Cl$4(` `,LC(3,13,`register.companyInformation`),` `),sE(4),ig(LC(7,15,`register.companyName`)),sE(2),zE(),sE(),pw(e.form.get(`companyName`)?.touched&&e.form.get(`companyName`)?.hasError(`required`)?9:-1),sE(3),ig(LC(13,17,`register.businessId`)),sE(2),zE(),sE(),pw(e.form.get(`businessId`)?.touched&&e.form.get(`businessId`)?.hasError(`required`)?15:-1),sE(3),ig(LC(19,19,`register.address`)),sE(2),zE(),sE(),pw(e.form.get(`address`)?.touched&&e.form.get(`address`)?.hasError(`required`)?21:-1),sE(4),ig(LC(26,21,`register.postcode`)),sE(2),zE(),sE(),pw(e.form.get(`postcode`)?.touched&&e.form.get(`postcode`)?.hasError(`required`)?28:-1),sE(3),ig(LC(32,23,`register.city`)),sE(2),zE(),sE(),pw(e.form.get(`city`)?.touched&&e.form.get(`city`)?.hasError(`required`)?34:-1),sE(3),ig(LC(38,25,`register.vatNumber`)),sE(2),zE(),sE(),pw(e.form.get(`vatNumber`)?.touched&&e.form.get(`vatNumber`)?.hasError(`required`)?40:-1)}}function Kc(n,t){if(n&1){let e=Cw();Bi$3(0,`mat-checkbox`,24)(1,`span`,27),lC(2),OC(3,`translate`),Bi$3(4,`button`,44),jh$3(`click`,function(s){ld$2(e);return ud$1(xw().openTerms(s))}),lC(5),OC(6,`translate`),vl$4(),lC(7),OC(8,`translate`),Bi$3(9,`button`,44),jh$3(`click`,function(s){ld$2(e);return ud$1(xw().openPrivacy(s))}),lC(10),OC(11,`translate`),vl$4(),lC(12),OC(13,`translate`),Bi$3(14,`button`,44),jh$3(`click`,function(s){ld$2(e);return ud$1(xw().openDataAnnex(s))}),lC(15),OC(16,`translate`),vl$4(),Bi$3(17,`span`,45),lC(18,` *`),vl$4()()(),WE()}n&2&&(zE(),sE(2),Cl$4(` `,LC(3,6,`register.acceptTermsPre`),` `),sE(3),ig(LC(6,8,`register.termsLink`)),sE(2),Cl$4(``,LC(8,10,`register.acceptTermsMid`),` `),sE(3),ig(LC(11,12,`register.privacyLink`)),sE(2),Cl$4(` `,LC(13,14,`register.acceptTermsManagerAnd`),` `),sE(3),ig(LC(16,16,`register.dataAnnexLink`)))}function qc(n,t){if(n&1){let e=Cw();Bi$3(0,`mat-checkbox`,24)(1,`span`,27),lC(2),OC(3,`translate`),Bi$3(4,`button`,44),jh$3(`click`,function(s){ld$2(e);return ud$1(xw().openPrivacy(s))}),lC(5),OC(6,`translate`),vl$4(),Bi$3(7,`span`,45),lC(8,` *`),vl$4()()(),WE()}n&2&&(zE(),sE(2),Cl$4(` `,LC(3,2,`register.acceptTermsPre`),` `),sE(3),ig(LC(6,4,`register.privacyLink`)))}function Gc(n,t){n&1&&(Bi$3(0,`mat-error`,25),lC(1),OC(2,`translate`),vl$4()),n&2&&(sE(),ig(LC(2,1,`register.acceptTermsRequired`)))}function Yc(n,t){if(n&1&&(Bi$3(0,`div`,28)(1,`mat-error`,46)(2,`mat-icon`,35),lC(3,`error`),vl$4(),lC(4),vl$4()()),n&2){let e=xw();sE(4),Cl$4(` `,e.registrationError(),` `)}}function Zc(n,t){n&1&&Rh$3(0,`mat-spinner`,47)}
7375function Jc(n,t){n&1&&(lC(0),OC(1,`translate`)),n&2&&Cl$4(` `,LC(1,1,`register.signUp`),` `)}function Qc(n,t){if(n&1&&(Bi$3(0,`button`,31),fw(1,Zc,1,0,`mat-spinner`,47)(2,Jc,2,3),vl$4()),n&2){let e=xw();Ah$2(`disabled`,e.isLoading()||e.form.invalid),sE(),pw(e.isLoading()?1:2)}}function Xc(n,t){n&1&&Rh$3(0,`mat-spinner`,47)}function ed(n,t){n&1&&(lC(0),OC(1,`translate`)),n&2&&Cl$4(` `,LC(1,1,`register.ready`),` `)}function td(n,t){if(n&1){let e=Cw();Bi$3(0,`button`,48),jh$3(`pointerup`,function(){ld$2(e);return ud$1(xw().onFinalSubmit())}),fw(1,Xc,1,0,`mat-spinner`,47)(2,ed,2,3),vl$4()}if(n&2){let e=xw();Ah$2(`disabled`,e.isLoading()||e.form.invalid),sE(),pw(e.isLoading()?1:2)}}var Tn=class n{static API_ERROR_KEYS={"Licence not found":`register.errorLicenceNotFound`};loginService=E(ne$3);router=E(G$4);config=E(kR);sanitizer=E(Er$5);termsUrl=this.sanitizer.bypassSecurityTrustUrl(this.config.config().apiUrl+`/general_terms_and_conditions`);privacyUrl=this.sanitizer.bypassSecurityTrustUrl(this.config.config().apiUrl+`/privacy_policy`);dataAnnexUrl=this.sanitizer.bypassSecurityTrustUrl(this.config.config().apiUrl+`/data_annex`);rawTermsUrl=this.config.config().apiUrl+`/general_terms_and_conditions`;rawPrivacyUrl=this.config.config().apiUrl+`/privacy_policy`;rawDataAnnexUrl=this.config.config().apiUrl+`/data_annex`;openTerms(t){t.stopPropagation(),window.open(this.rawTermsUrl,`_blank`,`noopener,noreferrer`)}openPrivacy(t){t.stopPropagation(),window.open(this.rawPrivacyUrl,`_blank`,`noopener,noreferrer`)}openDataAnnex(t){t.stopPropagation(),window.open(this.rawDataAnnexUrl,`_blank`,`noopener,noreferrer`)}isLoading=this.loginService.isLoading;registrationError=ni$3(null);form=new P({});dialog=E(pe$5);cdr=E(ej);selectedUserType=`coach`;showManagerFields=!1;translate=E(Gr$5);route=E(V$2);ngOnInit(){this.form=new P({email:new $$1(``,[ye$4.required,ye$4.email]),password:new $$1(``,[ye$4.required,ye$4.minLength(8)]),licenceCode:new $$1(``,[ye$4.required]),confirmPassword:new $$1(``,[ye$4.required]),firstName:new $$1(``,[ye$4.required]),lastName:new $$1(``,[ye$4.required]),birthday:new $$1(null),birthyear:new $$1(null),companyName:new $$1(``),businessId:new $$1(``),address:new $$1(``),postcode:new $$1(``),city:new $$1(``),vatNumber:new $$1(``),acceptTerms:new $$1(!1,[ye$4.requiredTrue]),marketingPermission:new $$1(!1)},[ht.mustMatch(`password`,`confirmPassword`)]),this.form.get(`birthyear`)?.disable(),this.applyQueryParams();let t=this.form.get(`email`)?.value,e=String(this.form.get(`licenceCode`)?.value??``);t&&e.length>=6&&this.callLicencePreview(t,e)}onLicencePreviewBlur(){let t=this.form.get(`email`),e=this.form.get(`licenceCode`),i=t.value,s=String(e.value??``);t.valid&&s.length>=6&&this.callLicencePreview(i,s)}callLicencePreview(t,e){return ps$4(this,null,function*(){try{let i=`${this.config.config().apiUrl}/api/v3/licences/preview?email=${encodeURIComponent(t)}&code=${encodeURIComponent(e)}`,s=yield fetch(i);if(!s.ok)return;let u=yield s.json();if(u.is_activated){this.router.navigate([`/login`],{queryParams:{email:t}});return}let v=u.role;(v===`coach`||v===`manager`)&&this.toggleUsertypeFields(v)}catch(i){}})}applyQueryParams(){let t=this.route.snapshot.queryParamMap,e=t.get(`role`);(e===`coach`||e===`manager`)&&this.toggleUsertypeFields(e);let i={};for(let u of[`email`,`firstName`,`lastName`,`licenceCode`,`companyName`,`businessId`,`address`,`postcode`,`city`,`vatNumber`]){let v=t.get(u);v!==null&&(i[u]=v)}Object.keys(i).length>0&&this.form.patchValue(i)}openUserTypeSelection(){let t=[{value:`coach`,title:this.translate.instant(`register.coach`),description:this.translate.instant(`register.coachDescription`),icon:`fitness_center`},{value:`manager`,title:this.translate.instant(`register.manager`),description:this.translate.instant(`register.managerDescription`),icon:`business_center`}],e={title:this.translate.instant(`register.chooseUserType`),description:this.translate.instant(`register.selectAccountType`),options:t,gridColumns:2};this.dialog.open(pr$4,{data:e,panelClass:`dialog-styling`,disableClose:!0,width:`auto`,height:`auto`,minWidth:`300px`,minHeight:`200px`,backdropClass:`dialog-backdrop`}).closed.subscribe(s=>{s&&(this.toggleUsertypeFields(s),this.cdr.detectChanges())})}onManagerFieldsEnter(t){let e=t.target;e.classList.add(`business-fields-enter`),setTimeout(()=>{e.classList.remove(`business-fields-enter`),t.animationComplete()},320)}onManagerFieldsLeave(t){t.target.classList.add(`business-fields-leave`),setTimeout(()=>t.animationComplete(),220)}toggleUsertypeFields(t){this.selectedUserType=t,this.showManagerFields=t===`manager`,this.form.get(`acceptTerms`)?.setValue(!1),this.form.get(`acceptTerms`)?.markAsUntouched(),t===`manager`?this.addManagerValidators():this.removeManagerValidators()}addManagerValidators(){this.form.get(`companyName`)?.setValidators([ye$4.required]),this.form.get(`businessId`)?.setValidators([ye$4.required]),this.form.get(`address`)?.setValidators([ye$4.required]),this.form.get(`postcode`)?.setValidators([ye$4.required]),this.form.get(`city`)?.setValidators([ye$4.required]),this.form.get(`companyName`)?.updateValueAndValidity(),this.form.get(`businessId`)?.updateValueAndValidity(),this.form.get(`address`)?.updateValueAndValidity(),this.form.get(`postcode`)?.updateValueAndValidity(),this.form.get(`city`)?.updateValueAndValidity()}removeManagerValidators(){this.form.get(`companyName`)?.clearValidators(),this.form.get(`businessId`)?.clearValidators(),this.form.get(`address`)?.clearValidators(),this.form.get(`postcode`)?.clearValidators(),this.form.get(`city`)?.clearValidators(),this.form.get(`companyName`)?.updateValueAndValidity(),this.form.get(`businessId`)?.updateValueAndValidity(),this.form.get(`address`)?.updateValueAndValidity(),this.form.get(`postcode`)?.updateValueAndValidity(),this.form.get(`city`)?.updateValueAndValidity()}onSubmit(){this.performRegistration()}onFinalSubmit(){this.selectedUserType&&this.performRegistration()}
7375performRegistration(){if(this.form.invalid){uu$2.error(`Form is invalid`,this.form.errors);return}let t={email:this.form.value.email,password:this.form.value.password,firstName:this.form.value.firstName,lastName:this.form.value.lastName,licenceCode:this.form.value.licenceCode,birthday:this.form.value.birthday?P$1(this.form.value.birthday.toISOString()):``,marketingPermission:this.form.value.marketingPermission??!1};this.selectedUserType===`manager`&&(t.company={company_name:this.form.value.companyName??``,business_id:this.form.value.businessId??``,address:this.form.value.address??``,postcode:this.form.value.postcode??``,city:this.form.value.city??``,vat_number:this.form.value.vatNumber??``});let e=W$4(q$1({},t),{licenceCode:parseInt(t.licenceCode,10)});this.registrationError.set(null),this.loginService.register(e).then(()=>{uu$2.log(`Registration successful`),this.redirectToMainPage()}).catch(i=>{let s=i instanceof Error?i.message:``,u=n.API_ERROR_KEYS[s],v=u?this.translate.instant(u):s||this.translate.instant(`register.signUpError`);uu$2.error(`Registration failed:`,i),this.registrationError.set(v)})}setYear(t,e){this.form.patchValue({birthday:t,birthyear:t.getFullYear().toString()}),e.close()}redirectToMainPage(){uu$2.log(`login success`),this.router.navigateByUrl(`/dashboard`)}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-register`]],decls:79,vars:53,consts:[[`birthyearPicker`,``],[1,`register-page-content`],[1,`p-4`,`mx-auto`,3,`ngSubmit`,`formGroup`],[`appearance`,`outlined`,1,`md:min-w-2xl`],[1,`grid`,`md:grid-cols-2`,`gap-6`,`items-start`],[1,`flex`,`flex-col`,`gap-4`,`p-4`],[3,`logoOnly`],[1,`text-3xl`],[1,`mt-6`],[1,`mt-4`,`p-3`,`bg-gray-400`,`rounded-lg`,`cursor-pointer`,`hover:bg-gray-500`],[1,`flex`,`flex-col`,`gap-2`,`p-4`,`md:mt-3`],[1,`w-full`],[`matInput`,``,`type`,`email`,`formControlName`,`email`,3,`blur`],[`matInput`,``,`type`,`text`,`formControlName`,`firstName`],[`matInput`,``,`type`,`text`,`formControlName`,`lastName`],[`formControlName`,`birthyear`,`readonly`,``],[`matInput`,``,`formControlName`,`birthday`,`readonly`,``,2,`display`,`none`,3,`matDatepicker`],[`matSuffix`,``,3,`for`],[`startView`,`multi-year`,3,`yearSelected`],[`matInput`,``,`type`,`text`,`formControlName`,`licenceCode`,3,`blur`],[`matInput`,``,`type`,`password`,`formControlName`,`password`],[`matInput`,``,`type`,`password`,`formControlName`,`confirmPassword`],[1,`business-fields`,`flex`,`flex-col`,`mt-4`,`gap-2`],[1,`consent-section`,`px-6`,`pb-2`,`flex`,`flex-col`,`gap-2`],[`formControlName`,`acceptTerms`,`data-testid`,`accept-terms`],[1,`text-xs`,`ml-6`],[`formControlName`,`marketingPermission`,`data-testid`,`marketing-permission`],[1,`text-sm`],[1,`px-4`,`pb-2`],[`align`,`end`],[`mat-button`,``,`routerLink`,`/login`],[`mat-flat-button`,``,`type`,`submit`,`data-testid`,`register-submit`,1,`px-5`,`min-w-24`,3,`disabled`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`register-final-submit`,1,`px-5`,`min-w-24`,3,`disabled`],[1,`mt-4`,`p-3`,`bg-gray-400`,`rounded-lg`,`cursor-pointer`,`hover:bg-gray-500`,3,`pointerup`],[1,`text-sm`,`text-black`],[1,`form-field-error-icon`],[1,`text-lg`,`font-medium`,`mb-1`,`text-gray-700`],[`matInput`,``,`type`,`text`,`formControlName`,`companyName`],[`matInput`,``,`type`,`text`,`formControlName`,`businessId`],[`matInput`,``,`type`,`text`,`formControlName`,`address`],[1,`grid`,`grid-cols-2`,`gap-2`],[`matInput`,``,`type`,`text`,`formControlName`,`postcode`],[`matInput`,``,`type`,`text`,`formControlName`,`city`],[`matInput`,``,`type`,`text`,`formControlName`,`vatNumber`],[`type`,`button`,1,`terms-link`,3,`click`],[`aria-hidden`,`true`,1,`text-red-500`],[`data-testid`,`register-error`,1,`text-sm`,`flex`,`items-center`,`gap-1`],[`diameter`,`18`],[`mat-flat-button`,``,`type`,`button`,`data-testid`,`register-final-submit`,1,`px-5`,`min-w-24`,3,`pointerup`,`disabled`]],template:function(e,i){if(e&1){let s=Cw();Bi$3(0,`div`,1)(1,`form`,2),jh$3(`ngSubmit`,function(){return i.onSubmit()}),Bi$3(2,`mat-card`,3)(3,`mat-card-content`)(4,`div`,4)(5,`div`,5),Rh$3(6,`app-app-logo`,6),Bi$3(7,`h1`,7),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`p`,8),lC(11),OC(12,`translate`),vl$4(),fw(13,Oc,7,6,`div`,9),vl$4(),Bi$3(14,`div`,10)(15,`mat-form-field`,11)(16,`mat-label`),lC(17),OC(18,`translate`),vl$4(),Bi$3(19,`input`,12),jh$3(`blur`,function(){return i.onLicencePreviewBlur()}),vl$4(),WE(),fw(20,Ic,5,3,`mat-error`),fw(21,Tc,5,3,`mat-error`),vl$4(),Bi$3(22,`mat-form-field`,11)(23,`mat-label`),lC(24),OC(25,`translate`),vl$4(),Rh$3(26,`input`,13),WE(),fw(27,Nc,5,3,`mat-error`),vl$4(),Bi$3(28,`mat-form-field`,11)(29,`mat-label`),lC(30),OC(31,`translate`),vl$4(),Rh$3(32,`input`,14),WE(),fw(33,Rc,5,3,`mat-error`),vl$4(),Bi$3(34,`mat-form-field`,11)(35,`mat-label`),lC(36),OC(37,`translate`),vl$4(),Rh$3(38,`input`,15),WE(),Rh$3(39,`input`,16),WE(),Rh$3(40,`mat-datepicker-toggle`,17),Bi$3(41,`mat-datepicker`,18,0),jh$3(`yearSelected`,function(v){ld$2(s);let S=jw(42);return ud$1(i.setYear(v,S))}),vl$4()(),Bi$3(43,`mat-form-field`,11)(44,`mat-label`),lC(45),OC(46,`translate`),vl$4(),Bi$3(47,`input`,19),jh$3(`blur`,function(){return i.onLicencePreviewBlur()}),vl$4(),WE(),fw(48,Dc,5,3,`mat-error`),vl$4(),Bi$3(49,`mat-form-field`,11)(50,`mat-label`),lC(51),OC(52,`translate`),vl$4(),Rh$3(53,`input`,20),WE(),fw(54,Ac,5,3,`mat-error`),fw(55,Bc,5,3,`mat-error`),vl$4(),Bi$3(56,`mat-form-field`,11)(57,`mat-label`),lC(58),OC(59,`translate`),vl$4(),Rh$3(60,`input`,21),WE(),fw(61,Fc,5,3,`mat-error`),fw(62,Lc,5,3,`mat-error`),vl$4(),fw(63,jc,41,27,`div`,22),vl$4()()(),Bi$3(64,`div`,23),fw(65,Kc,19,18,`mat-checkbox`,24)(66,qc,9,6,`mat-checkbox`,24),fw(67,Gc,3,3,`mat-error`,25),Bi$3(68,`mat-checkbox`,26)(69,`span`,27),lC(70),OC(71,`translate`),vl$4()(),WE(),vl$4(),fw(72,Yc,5,1,`div`,28),Bi$3(73,`mat-card-actions`,29)(74,`a`,30),lC(75),OC(76,`translate`),vl$4(),fw(77,Qc,3,2,`button`,31),fw(78,td,3,2,`button`,32),vl$4()()()()}if(e&2){let s=jw(42);sE(),Ah$2(`formGroup`,i.form),sE(5),Ah$2(`logoOnly`,!0),sE(2),ig(LC(9,31,`register.signUp`)),sE(3),ig(LC(12,33,`register.continue`)),sE(2),pw(i.selectedUserType?13:-1),sE(4),ig(LC(18,35,`common.email`)),sE(2),zE(),sE(),pw(i.form.get(`email`)?.touched&&i.form.get(`email`)?.hasError(`required`)?20:-1),sE(),pw(i.form.get(`email`)?.touched&&i.form.get(`email`)?.hasError(`email`)?21:-1),sE(3),ig(LC(25,37,`register.firstName`)),sE(2),zE(),sE(),pw(i.form.get(`firstName`)?.touched&&i.form.get(`firstName`)?.hasError(`required`)?27:-1),sE(3),ig(LC(31,39,`register.lastName`)),sE(2),zE(),sE(),pw(i.form.get(`lastName`)?.touched&&i.form.get(`lastName`)?.hasError(`required`)?33:-1),sE(3),ig(LC(37,41,`register.birthyear`)),sE(2),zE(),sE(),Ah$2(`matDatepicker`,s),zE(),sE(),Ah$2(`for`,s),sE(5),ig(LC(46,43,`register.licenceCode`)),sE(2),zE(),sE(),pw(i.form.get(`licenceCode`)?.touched&&i.form.get(`licenceCode`)?.hasError(`required`)?48:-1),sE(3),ig(LC(52,45,`common.password`)),sE(2),zE(),sE(),pw(i.form.get(`password`)?.touched&&i.form.get(`password`)?.hasError(`required`)?54:-1),sE(),pw(i.form.get(`password`)?.touched&&i.form.get(`password`)?.hasError(`minlength`)?55:-1),sE(3),ig(LC(59,47,`register.confirmPassword`)),sE(2),zE(),sE(),pw(i.form.get(`confirmPassword`)?.touched&&i.form.get(`confirmPassword`)?.hasError(`required`)?61:-1),sE(),pw(i.form.get(`confirmPassword`)?.touched&&i.form.get(`confirmPassword`)?.hasError(`mustMatch`)?62:-1),sE(),pw(i.showManagerFields?63:-1),sE(2),pw(i.showManagerFields?65:66),sE(2),pw(i.form.get(`acceptTerms`)?.touched&&i.form.get(`acceptTerms`)?.hasError(`required`)?67:-1),sE(),zE(),sE(2),ig(LC(71,49,`register.marketingPermission`)),sE(2),pw(i.registrationError()?72:-1),sE(3),ig(LC(76,51,`register.alreadyHaveAccount`)),sE(2),pw(i.showManagerFields?-1:77),sE(),pw(i.showManagerFields?78:-1)}},dependencies:[_t$8,yt$6,Vs$4,vt$6,en$4,je$3,X$5,gt$7,xt$5,rr$3,yt$7,wt$5,Jn$4,Zn$4,Qe$2,qn$5,$n$4,Qn$4,bn$4,Vn$4,Be$2,Pe$4,Ap$1,wp$2,ea$4,si$3,Bn$3,On$4,ua$3,qa$1,L$3,pe$2,ce$4,J$1,Z$2,Xp$1],styles:[`.register-page-content[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:flex-start;width:100%;min-height:100%;overflow-y:auto;padding:2rem 0}@keyframes _ngcontent-%COMP%_business-expand{0%{max-height:0;opacity:0;overflow:hidden}to{max-height:900px;opacity:1;overflow:hidden}}@keyframes _ngcontent-%COMP%_business-collapse{0%{max-height:900px;opacity:1;overflow:hidden}to{max-height:0;opacity:0;overflow:hidden}}.business-fields-enter[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_business-expand .32s ease-out both}.business-fields-leave[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_business-collapse .22s ease-in both}.business-fields[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{color:#555}.form-field-error-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;margin-right:4px}.terms-link[_ngcontent-%COMP%]{color:var(--%NS%primary);text-decoration:underline;background:none;border:none;padding:0;font:inherit;cursor:pointer}.terms-link[_ngcontent-%COMP%]:hover{opacity:.8}@media(max-width:768px){.business-fields[_ngcontent-%COMP%] .grid[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:.5rem}.register-page-content[_ngcontent-%COMP%]{height:auto}}`]})};
7375function nd(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.emailRequired`),` `))}function id(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.emailInvalid`),` `))}function ad(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`resetPassword.codeRequired`),` `))}function od(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`resetPassword.newPasswordRequired`),` `))}function rd(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`login.passwordShort`),` `))}function ld(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`resetPassword.confirmPasswordRequired`),` `))}function sd(n,t){n&1&&(Bi$3(0,`mat-error`)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),OC(4,`translate`),vl$4()),n&2&&(sE(3),Cl$4(` `,LC(4,1,`resetPassword.passwordsMustMatch`),` `))}function pd(n,t){if(n&1&&(Bi$3(0,`mat-error`,14)(1,`mat-icon`,18),lC(2,`error`),vl$4(),lC(3),vl$4()),n&2){let e=xw();sE(3),Cl$4(` `,e.error(),` `)}}var Nn=class n{api=E(E$1);router=E(G$4);toast=E(ut$6);translate=E(Gr$5);loading=ni$3(!1);error=ni$3(null);form=new P({email:new $$1(``,[ye$4.required,ye$4.email]),code:new $$1(``,[ye$4.required]),password:new $$1(``,[ye$4.required,ye$4.minLength(8)]),confirmPassword:new $$1(``,[ye$4.required])},[ht.mustMatch(`password`,`confirmPassword`)]);onSubmit(){return ps$4(this,null,function*(){if(this.form.invalid){this.form.markAllAsTouched();return}this.loading.set(!0),this.error.set(null);try{yield this.api.post(`/reset_password`,{email:this.form.value.email,code:this.form.value.code,password:this.form.value.password}),this.toast.show(this.translate.instant(`resetPassword.success`),`success`),this.router.navigateByUrl(`/login`)}catch(t){uu$2.error(`Password reset failed:`,t),this.error.set(this.translate.instant(`resetPassword.error`))}finally{this.loading.set(!1)}})}static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-reset-password`]],decls:49,vars:35,consts:[[1,`reset-password-page-content`],[1,`p-4`,`max-w-7xl`,`mx-auto`,3,`ngSubmit`,`formGroup`],[`appearance`,`outlined`,1,`md:min-w-2xl`],[1,`grid`,`md:grid-cols-2`,`gap-6`],[1,`flex`,`flex-col`,`gap-4`,`p-4`],[3,`logoOnly`],[1,`text-3xl`],[1,`mt-6`],[1,`flex`,`flex-col`,`gap-2`,`p-4`,`md:mt-12`],[1,`w-full`],[`matInput`,``,`type`,`email`,`formControlName`,`email`,`data-testid`,`reset-password-email`],[`matInput`,``,`type`,`text`,`formControlName`,`code`,`data-testid`,`reset-password-code`],[`matInput`,``,`type`,`password`,`formControlName`,`password`,`data-testid`,`reset-password-password`],[`matInput`,``,`type`,`password`,`formControlName`,`confirmPassword`,`data-testid`,`reset-password-confirm`],[`data-testid`,`reset-password-error`,1,`text-sm`,`mt-2`],[`align`,`end`],[`mat-button`,``,`routerLink`,`/login`,`data-testid`,`reset-password-back`],[`mat-flat-button`,``,`type`,`submit`,`data-testid`,`reset-password-submit`,3,`disabled`],[1,`form-field-error-icon`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0)(1,`form`,1),jh$3(`ngSubmit`,function(){return i.onSubmit()}),Bi$3(2,`mat-card`,2)(3,`mat-card-content`)(4,`div`,3)(5,`div`,4),Rh$3(6,`app-app-logo`,5),Bi$3(7,`h1`,6),lC(8),OC(9,`translate`),vl$4(),Bi$3(10,`p`,7),lC(11),OC(12,`translate`),vl$4()(),Bi$3(13,`div`,8)(14,`mat-form-field`,9)(15,`mat-label`),lC(16),OC(17,`translate`),vl$4(),Rh$3(18,`input`,10),WE(),fw(19,nd,5,3,`mat-error`),fw(20,id,5,3,`mat-error`),vl$4(),Bi$3(2
73751,`mat-form-field`,9)(22,`mat-label`),lC(23),OC(24,`translate`),vl$4(),Rh$3(25,`input`,11),WE(),fw(26,ad,5,3,`mat-error`),vl$4(),Bi$3(27,`mat-form-field`,9)(28,`mat-label`),lC(29),OC(30,`translate`),vl$4(),Rh$3(31,`input`,12),WE(),fw(32,od,5,3,`mat-error`),fw(33,rd,5,3,`mat-error`),vl$4(),Bi$3(34,`mat-form-field`,9)(35,`mat-label`),lC(36),OC(37,`translate`),vl$4(),Rh$3(38,`input`,13),WE(),fw(39,ld,5,3,`mat-error`),fw(40,sd,5,3,`mat-error`),vl$4(),fw(41,pd,4,1,`mat-error`,14),vl$4()()(),Bi$3(42,`mat-card-actions`,15)(43,`a`,16),lC(44),OC(45,`translate`),vl$4(),Bi$3(46,`button`,17),lC(47),OC(48,`translate`),vl$4()()()()()),e&2&&(sE(),Ah$2(`formGroup`,i.form),sE(5),Ah$2(`logoOnly`,!0),sE(2),ig(LC(9,19,`resetPassword.title`)),sE(3),ig(LC(12,21,`resetPassword.description`)),sE(5),ig(LC(17,23,`common.email`)),sE(2),zE(),sE(),pw(i.form.get(`email`)?.touched&&i.form.get(`email`)?.hasError(`required`)?19:-1),sE(),pw(i.form.get(`email`)?.touched&&i.form.get(`email`)?.hasError(`email`)?20:-1),sE(3),ig(LC(24,25,`resetPassword.code`)),sE(2),zE(),sE(),pw(i.form.get(`code`)?.touched&&i.form.get(`code`)?.hasError(`required`)?26:-1),sE(3),ig(LC(30,27,`resetPassword.newPassword`)),sE(2),zE(),sE(),pw(i.form.get(`password`)?.touched&&i.form.get(`password`)?.hasError(`required`)?32:-1),sE(),pw(i.form.get(`password`)?.touched&&i.form.get(`password`)?.hasError(`minlength`)?33:-1),sE(3),ig(LC(37,29,`resetPassword.confirmPassword`)),sE(2),zE(),sE(),pw(i.form.get(`confirmPassword`)?.touched&&i.form.get(`confirmPassword`)?.hasError(`required`)?39:-1),sE(),pw(i.form.get(`confirmPassword`)?.touched&&i.form.get(`confirmPassword`)?.hasError(`mustMatch`)?40:-1),sE(),pw(i.error()?41:-1),sE(3),Cl$4(` `,LC(45,31,`resetPassword.backToLogin`),` `),sE(2),Ah$2(`disabled`,i.loading()),sE(),Cl$4(` `,LC(48,33,`resetPassword.submit`),` `))},dependencies:[_t$8,yt$6,Vs$4,vt$6,en$4,je$3,X$5,gt$7,Be$2,Pe$4,Qn$4,Zn$4,Qe$2,qn$5,$n$4,bn$4,Vn$4,Ap$1,wp$2,yt$7,wt$5,rr$3,ea$4,si$3,Xp$1],styles:[`.reset-password-page-content[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.reset-password-page-content[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper{display:block!important}`]})};var Rn=class n{loginService=E(ne$3);redirectLink=$C(()=>this.loginService.tokenExpired()?`/login`:`/dashboard`);static ɵfac=function(e){return new(e||n)};static ɵcmp=PD({type:n,selectors:[[`app-page-not-found`]],decls:15,vars:4,consts:[[1,`content`],[`id`,`not-found`],[1,`circles`],[1,`circle`,`big`],[1,`circle`,`med`],[1,`circle`,`small`],[1,`actions`],[`mat-flat-button`,``,`data-testid`,`page-not-found-redirect`,3,`routerLink`]],template:function(e,i){e&1&&(Bi$3(0,`div`,0)(1,`section`,1)(2,`div`,2)(3,`p`),lC(4,` 404`),Rh$3(5,`br`),Bi$3(6,`small`),lC(7,`PAGE NOT FOUND`),vl$4()(),Rh$3(8,`span`,3)(9,`span`,4)(10,`span`,5),vl$4(),Bi$3(11,`div`,6)(12,`a`,7),lC(13),OC(14,`translate`),vl$4()()()()),e&2&&(sE(12),Ah$2(`routerLink`,i.redirectLink()),sE(),Cl$4(` `,LC(14,2,i.redirectLink()===`/login`?`pageNotFound.backToLogin`:`pageNotFound.goToDashboard`),` `))},dependencies:[Ap$1,wp$2,si$3,Xp$1],styles:[`.content[_ngcontent-%COMP%]{width:100%;height:100%;background:var(--%NS%box-color);font-family:var(--%NS%global-font);font-weight:300;margin:0;padding:0;position:absolute;display:flex;justify-content:center;align-items:center}.content[_ngcontent-%COMP%] #not-found[_ngcontent-%COMP%]{width:100%}.content[_ngcontent-%COMP%] .actions[_ngcontent-%COMP%]{position:relative;z-index:9;text-align:center;margin-top:24px}.content[_ngcontent-%COMP%] #title[_ngcontent-%COMP%]{text-align:center;font-size:40px;margin-top:40px;margin-bottom:-40px;position:relative;color:#fff}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%]:after{content:"";display:inline-block;width:100%;height:105px;background:#000;position:absolute;top:-50px;left:0;transform:skewY(-4deg);-webkit-transform:skewY(-4deg)}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%]{background:#000;text-align:center;position:relative;margin-top:-60px;box-shadow:inset -1px -4px 4px #0003}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:240px;color:#fff;padding-top:60px;position:relative;z-index:9;line-height:100%}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] p[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:40px;line-height:100%;vertical-align:top}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.small[_ngcontent-%COMP%]{width:140px;height:140px;border-radius:50%;background:var(--%NS%primary-dark);position:absolute;z-index:1;top:80px;left:50%;animation:7s _ngcontent-%COMP%_smallmove infinite cubic-bezier(1,.22,.71,.98);-webkit-animation:7s _ngcontent-%COMP%_smallmove infinite cubic-bezier(1,.22,.71,.98);animation-delay:1.2s;-webkit-animation-delay:1.2s}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.med[_ngcontent-%COMP%]{width:200
7375px;height:200px;border-radius:50%;background:var(--%NS%primary-dark);position:absolute;z-index:1;top:0;left:10%;animation:7s _ngcontent-%COMP%_medmove infinite cubic-bezier(.32,.04,.15,.75);-webkit-animation:7s _ngcontent-%COMP%_medmove infinite cubic-bezier(.32,.04,.15,.75);animation-delay:.4s;-webkit-animation-delay:.4s}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.big[_ngcontent-%COMP%]{width:400px;height:400px;border-radius:50%;background:var(--%NS%primary-dark);position:absolute;z-index:1;top:200px;right:0;animation:8s _ngcontent-%COMP%_bigmove infinite;-webkit-animation:8s _ngcontent-%COMP%_bigmove infinite;animation-delay:3s;-webkit-animation-delay:1s}@-webkit-keyframes _ngcontent-%COMP%_smallmove{0%{top:10px;left:45%;opacity:1}25%{top:300px;left:40%;opacity:.7}50%{top:240px;left:55%;opacity:.4}75%{top:100px;left:40%;opacity:.6}to{top:10px;left:45%;opacity:1}}@keyframes _ngcontent-%COMP%_smallmove{0%{top:10px;left:45%;opacity:1}25%{top:300px;left:40%;opacity:.7}50%{top:240px;left:55%;opacity:.4}75%{top:100px;left:40%;opacity:.6}to{top:10px;left:45%;opacity:1}}@-webkit-keyframes _ngcontent-%COMP%_medmove{0%{top:0;left:20%;opacity:1}25%{top:300px;left:80%;opacity:.7}50%{top:240px;left:55%;opacity:.4}75%{top:100px;left:40%;opacity:.6}to{top:0;left:20%;opacity:1}}@keyframes _ngcontent-%COMP%_medmove{0%{top:0;left:20%;opacity:1}25%{top:300px;left:80%;opacity:.7}50%{top:240px;left:55%;opacity:.4}75%{top:100px;left:40%;opacity:.6}to{top:0;left:20%;opacity:1}}@-webkit-keyframes _ngcontent-%COMP%_bigmove{0%{top:0;right:4%;opacity:.5}25%{top:100px;right:40%;opacity:.4}50%{top:240px;right:45%;opacity:.8}75%{top:100px;right:35%;opacity:.6}to{top:0;right:4%;opacity:.5}}@keyframes _ngcontent-%COMP%_bigmove{0%{top:0;right:4%;opacity:.5}25%{top:100px;right:40%;opacity:.4}50%{top:240px;right:45%;opacity:.8}75%{top:100px;right:35%;opacity:.6}to{top:0;right:4%;opacity:.5}}@media(max-width:768px){.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:120px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] p[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:20px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.small[_ngcontent-%COMP%]{width:100px;height:100px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.med[_ngcontent-%COMP%]{width:150px;height:150px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.big[_ngcontent-%COMP%]{width:300px;height:300px}}@media(max-width:480px){.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:80px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] p[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:16px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.small[_ngcontent-%COMP%]{width:70px;height:70px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.med[_ngcontent-%COMP%]{width:100px;height:100px}.content[_ngcontent-%COMP%] .circles[_ngcontent-%COMP%] .circle.big[_ngcontent-%COMP%]{width:200px;height:200px}}`]})};var er=[{path:`onboarding/analysis`,canActivate:[Z],data:{animation:`onboarding-analysis`},loadComponent:()=>import(`./chunk-Bkcp3Ty1.js`).then(n=>n.OnboardingAnalysisLoadingComponent)},{path:`onboarding`,canActivate:[Z],data:{animation:`onboarding`},loadComponent:()=>import(`./chunk-vxNt_Kk92.js`).then(n=>n.OnboardingSurveyComponent)},{path:`dashboard`,canActivate:[Z,X],data:{animation:`dashboard`},loadComponent:()=>import(`./chunk-BKvWVl2O2.js`).then(n=>n.DashboardIndexComponent)},{path:`clients`,loadComponent:()=>import(`./chunk-BV9BTCkC2.js`).then(n=>n.ClientsIndexComponent),canActivate:[Z,X],data:{animation:`clients`},pathMatch:`full`},{path:`clients/profile/:id`,loadComponent:()=>import(`./chunk-BkiHGAcq.js`).then(n=>n.ClientProfileIndexComponent),canActivate:[Z,X]},{path:`settings`,loadComponent:()=>import(`./chunk-DFW_duYz2.js`).then(n=>n.SettingsIndexComponent),canActivate:[Z,X],data:{animation:`settings`}},{path:`stats`,loadComponent:()=>import(`./chunk-VjwDpFAS.js`).then(n=>n.StatsIndexComponent),canActivate:[Z,X]}
7375,{path:`support`,loadComponent:()=>import(`./chunk-CeqG8vyK.js`).then(n=>n.SupportIndexComponent),canActivate:[Z,X]},{path:`training-bank`,loadComponent:()=>import(`./chunk-Btx3n0bE.js`).then(n=>n.TrainingBankIndexComponent),canActivate:[Z,X],data:{animation:`training-bank`}},{path:`reports`,loadComponent:()=>import(`./chunk-92rFKnfR.js`).then(n=>n.ReportsIndexComponent),canActivate:[Z,X,Xo],data:{animation:`reports`}},{path:`group-reports`,loadComponent:()=>import(`./chunk-UidxPxGm.js`).then(n=>n.GroupReportIndexComponent),canActivate:[Z,X,li],data:{animation:`group-reports`}},{path:`group-reports/:groupId`,loadComponent:()=>import(`./chunk-UidxPxGm.js`).then(n=>n.GroupReportIndexComponent),canActivate:[Z,X,li],data:{animation:`group-reports`}},{path:`admin`,canActivate:[Z,X,Qo],loadComponent:()=>import(`./chunk-SWS5UpXa2.js`).then(n=>n.AdminLayoutComponent),children:[{path:``,loadComponent:()=>import(`./chunk-Br3uEtc_.js`).then(n=>n.AdminDashboardComponent)},{path:`prompt-editor`,loadComponent:()=>import(`./chunk-DpTe6d742.js`).then(n=>n.PromptEditorIndexComponent)},{path:`prompt-editor/:key`,loadComponent:()=>import(`./chunk-DmTOzHmn.js`).then(n=>n.PromptEditorDetailComponent)},{path:`prompt-analytics`,loadComponent:()=>import(`./chunk-dFj0euCB.js`).then(n=>n.PromptAnalyticsIndexComponent)},{path:`email-templates`,loadComponent:()=>import(`./chunk-BeTLrVK72.js`).then(n=>n.AdminEmailTemplatesIndexComponent)},{path:`email-templates/:name`,loadComponent:()=>import(`./chunk-T7COneB32.js`).then(n=>n.AdminEmailTemplatesDetailComponent)},{path:`strength-adaptation`,loadComponent:()=>import(`./chunk-B1a41gyP.js`).then(n=>n.StrengthAdaptationIndexComponent)},{path:`endurance-adaptation`,loadComponent:()=>import(`./chunk-BcusrM1Y.js`).then(n=>n.EnduranceAdaptationIndexComponent)},{path:`synthetic-data`,loadComponent:()=>import(`./chunk-6hhaSS3m2.js`).then(n=>n.SyntheticDataIndexComponent)},{path:`chat-history`,loadComponent:()=>import(`./chunk-CWH6GEjY2.js`).then(n=>n.AdminChatHistoryListComponent)},{path:`chat-history/:id`,loadComponent:()=>import(`./chunk-CjKNQNCu.js`).then(n=>n.AdminChatHistoryDetailComponent)},{path:`exercises`,loadComponent:()=>import(`./chunk-DYiNujpF2.js`).then(n=>n.AdminExercisesIndexComponent)},{path:`ai-profiles/coaches`,loadComponent:()=>import(`./chunk-CGwZIQrT.js`).then(n=>n.AdminCoachProfilesListComponent)},{path:`ai-profiles/athletes`,loadComponent:()=>import(`./chunk-B5vIAgux.js`).then(n=>n.AdminAthleteProfilesListComponent)},{path:`stripe`,loadComponent:()=>import(`./chunk-6kraOIML.js`).then(n=>n.AdminStripeIndexComponent)},{path:`company-billing`,loadComponent:()=>import(`./chunk-DalsH8M0.js`).then(n=>n.AdminCompanyBillingIndexComponent)},{path:`company-billing/:companyId`,loadComponent:()=>import(`./chunk-DalsH8M0.js`).then(n=>n.AdminCompanyBillingIndexComponent)},{path:`coach-dashboard`,loadComponent:()=>import(`./chunk-DajpiXNv.js`).then(n=>n.AdminCoachDashboardIndexComponent)},{path:`user-search`,loadComponent:()=>import(`./chunk-D9J7b_Dd2.js`).then(n=>n.AdminUserSearchIndexComponent)}]},{path:`manager/coaches`,canActivate:[Z,X,ft],loadComponent:()=>import(`./chunk-CgCCFLPk2.js`).then(n=>n.CoachManagementComponent)},{path:`manager/billing`,canActivate:[Z,X,ft],loadComponent:()=>import(`./chunk-a0qvu3HH2.js`).then(n=>n.BillingComponent)},{path:`manager/billing/checkout`,canActivate:[Z,X,ft],loadComponent:()=>import(`./chunk-Cp2h1FtP.js`).then(n=>n.BillingCheckoutComponent)},{path:`manager/billing/cancel`,redirectTo:`/manager/billing?checkout=cancelled`},{path:`manager/billing/success`,redirectTo:({queryParamMap:n})=>{let t=n.get(`session_id`);return t?`/manager/billing?checkout=success&session_id=${encodeURIComponent(t)}`:`/manager/billing?checkout=success`}},{path:`manager/organization`,canActivate:[Z,X,ft],loadComponent:()=>import(`./chunk-vQyMQFIV.js`).then(n=>n.OrganizationSettingsComponent)},{path:`manager/groups`,canActivate:[Z,X,ft],loadComponent:()=>import(`./chunk-fMb2W--F2.js`).then(n=>n.GroupAccessComponent)},{path:`messages`,canActivate:[Z,X],loadComponent:()=>import(`./chunk-BleMgLRn.js`).then(n=>n.MessagingPageComponent)},{path:`messages/groups/:groupId/athletes/:athleteId`,canActivate:[Z],loadComponent:()=>import(`./chunk-BleMgLRn.js`).then(n=>n.MessagingPageComponent)},{path:`messages/groups/:groupId`,canActivate:[Z],loadComponent:()=>import(`./chunk-BleMgLRn.js`).then(n=>n.MessagingPageComponent)},{path:`messages/:userId`,canActivate:[Z,X],loadComponent:()=>import(`./chunk-BleMgLRn.js`).then(n=>n.MessagingPageComponent)},{path:`register`,component:Tn,data:{animation:`register`}},{path:`login`,component:In,data:{animation:`login`}},{path:`forgot-password`,component:On},{path:`reset-password`,component:Nn},{path:`pagenotfound`,component:Rn},{path:``,redirectTo:`/dashboard`,pathMatch:`full`},{path:`**`,redirectTo:`pagenotfound`}];var tr=(n,t)=>{let i=E(kR).getConfig()().appVersion;return t(i?n.clone({setHeaders:{"X-App-Version":i,"X-Platform":`Web`}}):n)};var nr=(n,t)=>{let e=E(ne$3),i=E(kR);
7375if(n.url.startsWith(`http`))try{if(new URL(n.url).origin!==new URL(i.getConfig()().apiUrl).origin)return t(n)}catch(Ne){}let s=[`/login`,`/signup`,`/token`,`/token/refresh`,`/logout`],v=(n.url.startsWith(`http`)?new URL(n.url).pathname:n.url).split(`?`)[0];if(s.some(Ne=>v===Ne||v.startsWith(`${Ne}/`)))return t(n);let L=n.headers.has(`X-Retry`),F=document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]*)/),ie=F?decodeURIComponent(F[1]):``,Ae=[`POST`,`PUT`,`PATCH`,`DELETE`].includes(n.method.toUpperCase()),xt=q$1({},Ae&&ie?{"X-XSRF-TOKEN":ie}:{}),Be=t(n.clone(q$1({withCredentials:!0},Object.keys(xt).length?{setHeaders:xt}:{})));return L?Be:Be.pipe(Ms$4(Ne=>Ne.status!==401?dm(()=>Ne):(e.isRefreshing?ke$5(e.waitForRefresh()):ke$5(e.refreshAccessToken())).pipe(Iu$2(vt=>{if(!vt)return e.logout(),dm(()=>Ne);let di=document.cookie.match(/(?:^|;\s*)XSRF-TOKEN=([^;]*)/),mi=di?decodeURIComponent(di[1]):``,rr=q$1({"X-Retry":`1`},Ae&&mi?{"X-XSRF-TOKEN":mi}:{});return t(n.clone({withCredentials:!0,setHeaders:rr}))}),Ms$4(vt=>(vt instanceof Re$2&&vt.status===401&&e.logout(),dm(()=>vt))))))};var ir=(n,t)=>t(n).pipe(Du$2(e=>{if(!(e instanceof At$4)||!e.headers.get(`Deprecation`))return;let s=e.headers.get(`Sunset`)??`unknown`,v=(e.headers.get(`Link`)??``).match(/<([^>]+)>/)?.[1]??`unknown`;uu$2.warn(`[DEPRECATED] ${n.method} ${n.url} \u2014 sunset: ${s}, successor: ${v}`)}));var ar=(n,t)=>{let e=E(ut$5),i=E(f$2);return t(n).pipe(Ms$4(s=>{if(s.status===402){let u=R$3(s.error);u!==`ai_quota_exhausted`?e.lock(u):i.markExhausted()}return dm(()=>s)}))};function cd(n,t){return()=>ps$4(null,null,function*(){uu$2.log(`[APP_INITIALIZER] Config loaded, App Insights:`,n.config().appInsightsConnectionString?`enabled`:`disabled`),yield t.ensureTokenValid()})}var or={providers:[tj({eventCoalescing:!0}),Xo$4(er,yi$5()),Go(),Ws$4(Zs$4([nr,ar,ir,tr]),Ys$4({cookieName:`XSRF-TOKEN`,headerName:`X-XSRF-TOKEN`})),v(),{provide:gl$4,useFactory:cd,deps:[kR,ne$3],multi:!0},{provide:m$3,useFactory:n=>n.getLocale(),deps:[A$3]},{provide:Tl$4,useFactory:n=>n.getLocale(),deps:[A$3]},{provide:Wi$3,useFactory:()=>({timezone:Intl.DateTimeFormat().resolvedOptions().timeZone})},{provide:et$3,useValue:{fontSet:`material-symbols-outlined`}},xd$1(bd$1()),Vo(`ngsw-worker.js`,{enabled:!cj(),registrationStrategy:`registerWhenStable:30000`}),Jp$1({fallbackLang:`en`,loader:Jo({prefix:`/assets/i18n/`,suffix:`.json`,useHttpBackend:!0})})]};ui$1.register(...Zo$2);_d$2(bo);_d$2(yo);_d$2(Co);ws$4(kn,or).catch(n=>console.error(n));export{oe$3 as $,qt$4 as A,st$6 as At,On$4 as B,at$1 as C,is$4 as Ct,O$1 as D,or$4 as Dt,Ht$1 as E,ne$3 as Et,Z$2 as F,ua$3 as G,Qa$3 as H,te$2 as I,T$3 as J,L$3 as K,we$3 as L,$t$3 as M,vt$6 as Mt,nt$3 as N,yt$6 as Nt,Wt$2 as O,qs$4 as Ot,J$1 as P,en$3 as Q,Bn$3 as R,_d$1 as S,ir$4 as St,Gt$2 as T,na$4 as Tt,Yn$3 as U,Pn$4 as V,qa$1 as W,Jt$3 as X,Je$2 as Y,L$4 as Z,d$1 as _,dr$4 as _t,ye as a,Ct$4 as at,Nd as b,gt$6 as bt,fn$1 as c,Nt$5 as ct,xn as d,Vs$4 as dt,rn$4 as et,l as f,_t$8 as ft,D$1 as g,ct$8 as gt,q as h,cr$4 as ht,ke as i,$s$3 as it,Yu$1 as j,ur$4 as jt,d$2 as k,ra$4 as kt,gn$1 as l,Se$3 as lt,a as m,bt$7 as mt,cn$1 as n,ce$4 as nt,Fe as o,Gs$3 as ot,d as p,br$4 as pt,T$2 as q,dn$1 as r,pe$2 as rt,Oe as s,Jn$3 as st,nt as t,Z$3 as tt,un$1 as u,Us$3 as ut,Dd as v,er$4 as vt,st$2 as w,lr$3 as wt,Od as x,hr$4 as xt,Eh as y,ft$8 as yt,Ln$3 as z};
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.