1import{a as nt}from"./chunk-FKLYEOBN.js";import{a as tt,b as it,c as st}from"./chunk-4OHFYAYO.js";import{a as ot}from"./chunk-FENYEKMZ.js";import{$a as x,$b as ze,$d as et,Ad as Ye,Bd as Xe,C as we,Ec as Ve,Id as Ze,Lc as Qe,N as Pe,Oa as Ae,Ra as Le,Wa as Ne,Xa as Oe,Ya as Ue,Za as He,_a as K,ab as Ge,gb as je,hb as Je,md as qe,nd as Ke,oe as $,pb as We,sb as Be,zd as $e}from"./chunk-X3UW4FV3.js";import"./chunk-3KUWIZFM.js";import{Kb as xe,Z as C,fa as ae,ga as Fe,ja as ce,oa as Q,t as ke,yb as q,za as _e}from"./chunk-QTYJNS4L.js";import{Ab as A,Bb as L,Cb as B,Ga as M,Gb as N,Gc as z,I as k,Ib as v,Kb as f,La as ge,Ob as ne,Pb as oe,Qb as re,Ua as Te,Ub as D,Ue as Re,Va as ve,Vb as G,Ve as De,Wa as l,X as se,Xa as W,Xc as Me,Yb as m,_b as _,a as me,b as pe,bb as c,db as F,ha as p,i as d,ic as Ce,id as be,kc as j,m as J,n as fe,nb as Ie,pb as S,qa as Se,qd as Ee,rb as g,sc as ye,sd as V,wb as T,xb as u,ya as P,yb as h,za as R,zb as E,zc as O}from"./chunk-NFWLLSTH.js";var U=(()=>{let s=class s{constructor(){this.currentStageSignal=M(null),this.currentStage=this.currentStageSignal.asReadonly(),this.currentStageSubject=new fe(null),this.currentStage$=this.currentStageSubject.asObservable(),this.stageEnteredSubject=ne
1w J,this.stageEntered$=this.stageEnteredSubject.asObservable()}setCurrentStage(e){this.currentStageSignal()!==e&&(this.currentStageSignal.set(e),this.currentStageSubject.next(e))}enterStage(e){this.setCurrentStage(e.currentStage),this.stageEnteredSubject.next(e)}reset(){this.currentStageSignal()!==null&&(this.currentStageSignal.set(null),this.currentStageSubject.next(null))}};s.\u0275fac=function(t){return new(t||s)},s.\u0275prov=Se({token:s,factory:s.\u0275fac});let n=s;return n})();function Rt(n,s){n&1&&m(0," Welcome! ")}function Dt(n,s){n&1&&m(0," \u{1F44B} Check-in ")}function At(n,s){n&1&&m(0," \u{1F3AF} Focus ")}function Lt(n,s){n&1&&m(0," \u{1F64C} Check-out ")}function Nt(n,s){if(n&1&&m(0),n&2){let r=f();_(" Session starts in ",r.timerDisplay," ")}}function Ot(n,s){n&1&&m(0," Finished! ")}function Ut(n,s){if(n&1&&m(0),n&2){let r=f();_(" Ends in ",r.timerDisplay," ")}}var Ht=" until start - Focusmate",Gt="Finished! - Focusmate",jt=" \xB7 Check-in - Focusmate",Jt=" \xB7 Focus - Focusmate",Wt=" \xB7 Check-out - Focusmate",at=300*1e3,Bt=10*1e3,zt=650,X=10,le=80,Vt=10,ct=(()=>{let s=class s{constructor(e,t,i,o,a,I,y){this.utilsService=e,this.timeUtilitiesService=t,this.titleService=i,this.router=o,this.serverTimeService=a,this.cdr=I,this.groupSessionStageService=y,this.sessionTime=0,this.sessionDuration=0,this.sessionExternalId="",this.checkInDurationMs=at,this.checkOutDurationMs=at,this.focusStartMs=0,this.timerDisplay="",this.tabHeading="",this.currentStage="before-session",this.checkInSegmentWeight=X,this.focusSegmentWeight=le,this.checkOutSegmentWeight=Vt,this.shouldAnimateTimelineResize=!1,this.checkInProgressPercent=0,this.focusProgressPercent=0,this.checkOutProgressPercent=0,this.tickSubscription=null,this.countdownTargetMs=null,this.timerRunning=!1,this.activeSessionKey=null,this.lastObservedStage=null,this.timelineResizeTimeout=null}ngOnInit(){this.initializeSessionStatusTimer()}ngOnChanges(e){let t=!!e.focusStartMs,i=!!e.sessionTime||!!e.sessionDuration||!!e.checkInDurationMs||t;if((e.sessionTime||e.sessionDuration||e.sessionExternalId||e.checkInDurationMs||e.checkOutDurationMs)&&this.resetTimerStateForSession(),i){let o=t&&!e.focusStartMs.firstChange&&this.timerRunning&&this.currentStage==="check-in"&&this.isLiveEarlyFocusTransition();this.updateTimelineSegmentWeights(o)}if(t&&this.timerRunning){this.checkSessionTime();return}this.initializeSessionStatusTimer()}ngOnDestroy(){this.clearTimelineResizeTimeout(),this.stopCountdown(),this.tabHeading=this.utilsService.getPageTitleFromRoute(this.router.url),this.titleService.setTitle(this.tabHeading)}resetTimerStateForSession(){let e=[this.sessionTime,this.sessionDuration,this.sessionExternalId,this.checkInDurationMs,this.checkOutDurationMs].join("-");this.activeSessionKey!==e&&(this.activeSessionKey=e,this.lastObservedStage=null,this.clearTimelineResizeTimeout(),this.shouldAnimateTimelineResize=!1,this.groupSessionStageService.reset(),this.timerRunning=!1,this.stopCountdown())}initializeSessionStatusTimer(){return d(this,null,function*(){yield this.serverTimeService.getSyncedTimeMs(),this.timerRunning||this.checkSessionTime()})}checkSessionTime(){let e=this.timeUtilitiesService.syncedNowMs();this.updateSessionStage(e),this.updateTimelineProgress(e),this.timerRunning=!0;let t=this.getStageAt(e);if(t==="before-session"){this.tabHeading=Ht,this.countDownToTarget(this.sessionTime),this.cdr.markForCheck();return}if(t==="completed"){this.timerDisplay="",this.tabHeading=Gt,this.titleService.setTitle(this.tabHeading),this.timerRunning=!1,this.stopCountdown(),this.cdr.markForCheck();return}this.tabHeading=this.getStageTabHeading(t),this.countDownToTarget(this.getStageEndMs(t)),this.cdr.markForCheck()}countDownToTarget(e){this.countdownTargetMs=e,this.tickSubscription||(this.tickSubscription=this.timeUtilitiesService.onSecondStart().subscribe(()=>this.updateCountdownDisplay())),this.updateCountdownDisplay()}updateCountdownDisplay(){if(this.countdownTargetMs===null)return;let e=this.timeUtilitiesService.syncedNowMs();this.updateSessionStage(e),this.updateTimelineProgress(e);let t=this.countdownTargetMs-e,i=this.timeUtilitiesService.getCountdownDisplay(t);this.titleService.setTitle(i+this.tabHeading),this.timerDisplay=i,this.cdr.markForCheck(),t<=0&&this.checkSessionTime()}stopCountdown(){this.countdownTargetMs=null,this.tickSubscription&&(this.tickSubscription.unsubscribe(),this.tickSubscription=null)}updateTimelineProgress(e){if(!this.sessionTime||!this.sessionDuration||this.sessionDuration<=0){this.checkInProgressPercent=0,this.focusProgressPercent=0,this.checkOutProgressPercent=0;return}let t=this.getStageBoundaries();this.checkInProgressPercent=this.getStageProgressPercent(e,t.sessionStartMs,t.focu
1sStartMs),this.focusProgressPercent=this.getStageProgressPercent(e,t.focusStartMs,t.checkoutStartMs),this.checkOutProgressPercent=this.getStageProgressPercent(e,t.checkoutStartMs,t.sessionEndMs)}updateTimelineSegmentWeights(e){if(this.clearTimelineResizeTimeout(),!this.sessionTime||!this.sessionDuration||this.sessionDuration<=0){this.shouldAnimateTimelineResize=!1,this.checkInSegmentWeight=X,this.focusSegmentWeight=le;return}let t=this.getStageBoundaries(),i=Math.min(Math.max(0,this.checkInDurationMs||0),Math.max(0,this.sessionDuration||0)),o=Math.max(0,t.focusStartMs-t.sessionStartMs),a=i?Math.min(1,o/i):0;this.shouldAnimateTimelineResize=e,this.checkInSegmentWeight=X*a,this.focusSegmentWeight=le+(X-this.checkInSegmentWeight),e&&(this.timelineResizeTimeout=setTimeout(()=>{this.shouldAnimateTimelineResize=!1,this.timelineResizeTimeout=null,this.cdr.markForCheck()},zt))}isLiveEarlyFocusTransition(){let e=this.getStageBoundaries(),t=e.sessionStartMs+Math.min(Math.max(0,this.checkInDurationMs||0),Math.max(0,this.sessionDuration||0)),i=this.timeUtilitiesService.syncedNowMs()-e.focusStartMs;return e.focusStartMs<t&&i>=0&&i<=Bt}clearTimelineResizeTimeout(){this.timelineResizeTimeout!==null&&(clearTimeout(this.timelineResizeTimeout),this.timelineResizeTimeout=null)}updateSessionStage(e){if(!this.sessionTime||!this.sessionDuration||this.sessionDuration<=0)return;let t=this.getStageAt(e);if(this.currentStage=t,this.groupSessionStageService.setCurrentStage(t),this.lastObservedStage===null){this.lastObservedStage=t;return}let i=this.getStageIndex(this.lastObservedStage),o=this.getStageIndex(t);if(o<=i)return;let a=["before-session","check-in","focus","check-out","completed"],I=this.lastObservedStage;for(let y=i+1;y<=o;y++){let b=a[y],w={previousStage:I,currentStage:b,occurredAtMs:this.getStageEnteredAtMs(b)};this.groupSessionStageService.enterStage(w),I=b}this.lastObservedStage=t}getStageAt(e){let t=this.getStageBoundaries();return e<t.sessionStartMs?"before-session":e<t.focusStartMs?"check-in":e<t.checkoutStartMs?"focus":e<t.sessionEndMs?"check-out":"completed"}getStageBoundaries(){let e=Math.max(0,this.sessionDuration||0),t=Math.min(Math.max(0,this.checkInDurationMs||0),e),i=Math.max(0,this.checkOutDurationMs||0),o=this.sessionTime,a=o+t,I=Number.isFinite(this.focusStartMs)&&this.focusStartMs>0?this.focusStartMs:a,y=Math.min(Math.max(I,o),a),b=o+e,w=b+i;return{sessionStartMs:o,focusStartMs:y,checkoutStartMs:b,sessionEndMs:w}}getStageProgressPercent(e,t,i){if(i<=t)return e>=i?100:0;let o=(e-t)/(i-t)*100;return Math.max(0,Math.min(100,o))}getStageIndex(e){return["before-session","check-in","focus","check-out","completed"].indexOf(e)}getStageEndMs(e){let t=this.getStageBoundaries();switch(e){case"check-in":return t.focusStartMs;case"focus":return t.checkoutStartMs;default:return t.sessionEndMs}}getStageTabHeading(e){switch(e){case"check-in":return jt;case"focus":return Jt;default:return Wt}}getStageEnteredAtMs(e){let t=this.getStageBoundaries();switch(e){case"check-in":return t.sessionStartMs;case"focus":return t.focusStartMs;case"check-out":return t.checkoutStartMs;case"completed":return t.sessionEndMs;default:return t.sessionStartMs}}};s.\u0275fac=function(t){return new(t||s)(c(Q),c(q),c(be),c(V),c(et),c(z),c(U))},s.\u0275cmp=F({type:s,selectors:[["app-fm-group-timer"]],inputs:{sessionTime:"sessionTime",sessionDuration:"sessionDuration",sessionExternalId:"sessionExternalId",checkInDurationMs:"checkInDurationMs",checkOutDurationMs:"checkOutDurationMs",focusStartMs:"focusStartMs"},features:[ge],decls:17,vars:34,consts:[[1,"flex","h-full","w-full","flex-col","items-center","justify-center","gap-0.5","rounded-lg","bg-white","px-2","font-inter"],[1,"whitespace-nowrap","text-center","text-15","font-medium","leading-[normal]","text-bluegrey"],[1,"flex","h-[18px]","w-full","items-center","gap-[2px]","py-[2px]"],[1,"timer-segment","h-[14px]","min-w-0","overflow-hidden","rounded-[4px]","bg-primary-100"],[1,"timer-fill","h-full","rounded-l-[4px]"],[1,"whitespace-nowrap","text-center","text-15","font-medium","leading-[normal]","text-bluegrey","[font-variant-numeric:tabular-nums]"]],template:function(t,i){if(t&1&&(A(0,"div",0)(1,"div",1),S(2,Rt,1,0)(3,Dt,1,0)(4,At,1,0)(5,Lt,1,0),L(),A(6,"div",2)(7,"div",3),B(8,"div",4),L(),A(9,"div",3),B(10,"div",4),L(),A(11,"div",3),B(12,"div",4),L()(),A(13,"div",5),S(14,Nt,1,1)(15,Ot,1,0)(16,Ut,1,1),L()()),t&2){let o;
1l(2),g((o=i.currentStage)==="before-session"?2:o==="check-in"?3:o==="focus"?4:5),l(4),G("animate-timeline-resize",i.shouldAnimateTimelineResize),l(),D("flex-basis",0,"px")("flex-grow",i.checkInSegmentWeight),l(),D("width",i.checkInProgressPercent,"%"),G("bg-primary-600",i.currentStage==="check-in")("bg-primary-300",i.currentStage==="focus"||i.currentStage==="check-out"||i.currentStage==="completed"),l(),D("flex-basis",0,"px")("flex-grow",i.focusSegmentWeight),l(),D("width",i.focusProgressPercent,"%"),G("bg-primary-600",i.currentStage==="focus")("bg-primary-300",i.currentStage==="check-out"||i.currentStage==="completed"),l(),D("flex-basis",0,"px")("flex-grow",i.checkOutSegmentWeight),l(),D("width",i.checkOutProgressPercent,"%"),G("bg-primary-600",i.currentStage==="check-out")("bg-primary-300",i.currentStage==="completed"),l(2),g(i.currentStage==="before-session"?14:i.currentStage==="completed"?15:16)}},styles:[`.animate-timeline-resize[_ngcontent-%COMP%] .timer-segment[_ngcontent-%COMP%], .animate-timeline-resize[_ngcontent-%COMP%] .timer-fill[_ngcontent-%COMP%]{transition-duration:.65s;transition-timing-function:cubic-bezier(.22,1,.36,1)}.animate-timeline-resize[_ngcontent-%COMP%] .timer-segment[_ngcontent-%COMP%]{transition-property:flex-grow}.animate-timeline-resize[_ngcontent-%COMP%] .timer-fill[_ngcontent-%COMP%]{transition-property:width,background-color}@media(prefers-reduced-motion:reduce){.animate-timeline-resize[_ngcontent-%COMP%] .timer-segment[_ngcontent-%COMP%], .animate-timeline-resize[_ngcontent-%COMP%] .timer-fill[_ngcontent-%COMP%]{transition:none}} 2/*# sourceMappingURL=fm-group-timer.component-SAPRQPQ2.css.map */`],changeDetection:0});let n=s;return n})();var lt=(()=>{let s=class s{constructor(){this.sessionExternalId="",this.focusStartMs=0,this.onLeaveClicked=new W}leaveMeeting(e){this.onLeaveClicked.emit(e)}};s.\u0275fac=function(t){return new(t||s)},s.\u0275cmp=F({type:s,selectors:[["app-group-in-session-controls"]],inputs:{sessionTime:"sessionTime",sessionDuration:"sessionDuration",sessionExternalId:"sessionExternalId",focusStartMs:"focusStartMs",meetingRoom:"meetingRoom"},outputs:{onLeaveClicked:"onLeaveClicked"},decls:6,vars:7,consts:[[1,"flex","h-full"],["aria-hidden","true",1,"h-full","w-px","shrink-0","bg-[#E2E8F0]","lg:hidden"],[1,"flex","h-full","w-full","min-w-0","items-center","justify-end","overflow-hidden","rounded-0","lg:rounded-lg","bg-white","font-inter"],[1,"block","h-full","shrink-0","flex-1",3,"sessionTime","sessionDuration","sessionExternalId","focusStartMs"],["aria-hidden","true",1,"h-full","w-px","shrink-0","bg-[#E2E8F0]"],[1,"block","shrink-0","h-full",3,"onLeaveClicked","sessionTime","meetingRoom","enableHelpUserActions"]],template:function(t,i){t&1&&(u(0,"div",0),E(1,"div",1),u(2,"div",2),E(3,"app-fm-group-timer",3)(4,"div",4),u(5,"app-in-session-actions",5),v("onLeaveClicked",function(a){return i.leaveMeeting(a)}),h()()()),t&2&&(l(3),T("sessionTime",i.sessionTime)("sessionDuration",i.sessionDuration)("sessionExternalId",i.sessionExternalId)("focusStartMs",i.focusStartMs),l(2),T("sessionTime",i.sessionTime)("meetingRoom",i.meetingRoom)("enableHelpUserActions",!1))},dependencies:[ct,it],encapsulation:2});let n=s;return n})();var ut=(()=>{let s=class s{constructor(e){this.dialogService=e,this.title="",this.description=null,this.facilitatorPhoto=null,this.isHostless=!1,this.sessionTime=0,this.sessionDuration=3e3*1e3,this.sessionExternalId="",this.focusStartMs=0,this.meetingRoom="",this.leave=new W}onSessionInfoClick(){this.dialogService.openGroupInSessionInfoDialog(this.title,this.description)}onLeave(){this.leave.emit()}};s.\u0275fac=function(t){return new(t||s)(c($))},s.\u0275cmp=F({type:s,selectors:[["fm-group-session-toolbar"]],inputs:{title:"title",description:"description",facilitatorPhoto:"facilitatorPhoto",isHostless:"isHostless",sessionTime:"sessionTime",sessionDuration:"sessionDuration",sessionExternalId:"sessionExternalId",focusStartMs:"focusStartMs",meetingRoom:"meetingRoom"},outputs:{leave:"leave"},decls:8,vars:12,consts:[[1,"relative","flex","h-[60px]","w-full","items-center","justify-between","bg-white","p-0","lg:h-[82px]","lg:bg-[#121a24]","lg:p-1.5"],["type","button","aria-label","View group session details",1,"flex","h-full","w-auto","max-w-[102px]","min-w-0","flex-none","cursor-pointer","items-center","gap-1","overflow-hidden","border-0","bg-white","py-[4.25px]","text-left","font-inter","text-[#334155]","hover:bg-[#
2E2E8F0]","focus-visible:outline-none","focus-visible:ring-2","focus-visible:ring-blurple","min-[380px]:max-w-[128px]","min-[400px]:max-w-[148px]","min-[480px]:max-w-[240px]","lg:rounded-lg","lg:px-2",3,"click"],[1,"flex","h-10","w-10","shrink-0","items-center","justify-center"],["shape","flower",1,"h-9","w-9",3,"sizePx","placeholderEmoji","avatarLocation"],[1,"hidden","min-w-0","flex-1","overflow-hidden","text-ellipsis","text-13","lg:text-14","font-medium","leading-[normal]","min-[361px]:line-clamp-2"],[1,"absolute","left-1/2","top-[32px]","-ml-[88px]","hidden","lg:block",3,"color","fontSize"],[1,"h-full","min-w-0","flex-1","min-[361px]:w-[300px]","min-[361px]:flex-none","min-[361px]:shrink-0","min-[380px]:w-[278px]","min-[480px]:w-[332px]","lg:w-[309px]",3,"onLeaveClicked","sessionTime","sessionDuration","sessionExternalId","focusStartMs","meetingRoom"]],template:function(t,i){t&1&&(u(0,"div",0)(1,"button",1),v("click",function(){return i.onSessionInfoClick()}),u(2,"span",2),E(3,"fm-avatar",3),h(),u(4,"span",4),m(5),h()(),E(6,"fm-logo-wordmark",5),u(7,"app-group-in-session-controls",6),v("onLeaveClicked",function(){return i.onLeave()}),h()()),t&2&&(l(),Ie("title",i.title||"Facilitated group session"),l(2),T("sizePx",36)("placeholderEmoji",i.isHostless?"\u{1F33C}":null)("avatarLocation",i.facilitatorPhoto||"assets/images/blank_profile.png"),l(2),_(" ",i.title||"Facilitated group session"," "),l(),T("color","#ffffff")("fontSize","34px"),l(),T("sessionTime",i.sessionTime)("sessionDuration",i.sessionDuration)("sessionExternalId",i.sessionExternalId)("focusStartMs",i.focusStartMs)("meetingRoom",i.meetingRoom))},dependencies:[Qe,Ve,ze,lt],encapsulation:2});let n=s;return n})();var Z=class{constructor(){this.sessionExternalId=null,this.collectiveExpanded=!0,this.joinedParticipantIds=new Set,this.eligibleParticipantIds=new Set,this.expandedParticipantIds=M(new Set),this.presentParticipantIds=M(new Set),this.areAllPresentParticipantsExpanded=O(()=>{let s=this.presentParticipantIds(),r=this.expandedParticipantIds();return s.size>0&&Array.from(s).every(e=>r.has(e))}),this.canToggleParticipantTasks=O(()=>this.presentParticipantIds().size>0)}sync({sessionExternalId:s,currentUserId:r,participantIds:e,presentUserIds:t}){if(!s||!r)return;this.sessionExternalId!==s&&this.reset(s),this.eligibleParticipantIds=new Set(e);let i=new Set(Array.from(t).filter(a=>this.eligibleParticipantIds.has(a))),o=new Set(this.expandedParticipantIds());for(let a of i)this.joinedParticipantIds.has(a)||(this.joinedParticipantIds.add(a),this.collectiveExpanded?o.add(a):o.delete(a));this.presentParticipantIds.set(i),this.expandedParticipantIds.set(o)}isParticipantExpanded(s){return this.presentParticipantIds().has(s)&&this.expandedParticipantIds().has(s)}toggleParticipant(s){if(!this.presentParticipantIds().has(s))return;let r=new Set(this.expandedParticipantIds());r.has(s)?r.delete(s):r.add(s),this.expandedParticipantIds.set(r)}toggleCollectiveExpansion(){if(this.presentParticipantIds().size===0)return;let s=!this.areAllPresentParticipantsExpanded(),r=s?new Set(Array.from(this.joinedParticipantIds).filter(e=>this.eligibleParticipantIds.has(e))):new Set;this.collectiveExpanded=s,this.expandedParticipantIds.set(r)}reset(s){this.sessionExternalId=s,this.collectiveExpanded=!0,this.joinedParticipantIds=new Set,this.eligibleParticipantIds=new Set,this.expandedParticipantIds.set(new Set),this.presentParticipantIds.set(new Set)}};var Xt=["dailyFrameHost"],Zt=["sessionFeedback"],ei=()=>[],ti=()=>({}),ii=(n,s,r,e,t,i,o,a,I,y,b,w,ee,te)=>({mode:"group",sessionExternalId:n,sessionTime:s,durationMs:r,meetingRoom:e,groupParticipantConfigs:t,groupParticipants:i,currentUserId:o,presentUserIds:a,participantMediaStates:I,participantTaskExpansionState:y,canStartFocusTime:b,isStartingFocusTime:w,startFocusTimeTooltip:ee,startFocusTime:te}),ht=()=>({autofocus:!1});function si(n,s){if(n&1){let r=N();u(0,"fm-group-session-header-banner",13),v("dismiss",function(){P(r);let t=f();return R(t.isQuietModeNoticeDismissed.set(!0))}),m(1," Quiet Mode is on \u2014 you\u2019ll join muted. "),h()}}function ni(n,s){if(n&1){let r=N();
2u(0,"fm-group-session-header-banner",13),v("dismiss",function(){P(r);let t=f();return R(t.showFocusStartedWhileJoiningNotice.set(!1))}),m(1," Focus time started while you were joining \u2014 you\u2019ve been muted. Share your goals in the Task Manager. "),h()}}function oi(n,s){if(n&1&&(u(0,"span",15),m(1," Task for this session "),h(),u(2,"span",16),m(3),h()),n&2){let r=f(2);l(3),_(" ",r.topSessionTask.title," ")}}function ri(n,s){n&1&&(u(0,"span",15),m(1," Add task to this session "),h(),u(2,"span",17),m(3," Tap to attach a task "),h())}function ai(n,s){if(n&1){let r=N();u(0,"button",14),v("click",function(){P(r);let t=f();return R(t.openInSessionTaskDrawer())}),S(1,oi,4,1)(2,ri,4,0),h()}if(n&2){let r=f();l(),g(r.topSessionTask?1:2)}}function ci(n,s){if(n&1&&E(0,"app-in-session-task-panel",7),n&2){let r=f();T("context",ye(3,ii,[(r.launchInfo==null||r.launchInfo.meeting==null?null:r.launchInfo.meeting.id)||"",r.sessionTime,r.sessionDuration,r.meetingRoom,(r.launchInfo==null||r.launchInfo.meeting==null?null:r.launchInfo.meeting.participantConfigs)||j(1,ei),(r.launchInfo==null?null:r.launchInfo.participants)||j(2,ti),(r.user==null?null:r.user.userId)||"",r.presentUserIds,r.participantMediaStates,r.participantTaskExpansionState,r.canStartFocusTime,r.isStartingFocusTime,r.startFocusTimeTooltip,r.startFocusTimeAction]))}}function li(n,s){n&1&&(u(0,"div",10)(1,"div",18),m(2," Connecting video... "),h()())}function ui(n,s){n&1&&(u(0,"div",20),m(1," Loading session... "),h(),u(2,"div",21),m(3," Fetching your group session details. "),h())}function hi(n,s){if(n&1){let r=N();u(0,"div",20),m(1," Unable to launch this group session "),h(),u(2,"div",21),m(3),h(),u(4,"div",22)(5,"p-button",23),v("onClick",function(){P(r);let t=f(2);return R(t.onClickRetry())}),h(),u(6,"p-button",24),v("onClick",function(){P(r);let t=f(2);return R(t.onClickLeave())}),h()()}if(n&2){let r=f(2);l(3),_(" ",r.errorMessage," "),l(2),T("buttonProps",j(3,ht)),l(),T("buttonProps",j(4,ht))}}function di(n,s){if(n&1&&(u(0,"div",11)(1,"div",19),S(2,ui,4,0),S(3,hi,7,5),h()()),n&2){let r=f();l(2),g(r.launchState==="loading"?2:-1),l(),g(r.launchState==="error"?3:-1)}}var mi="?disableCameraNetworkQualityMute=t",pi="&preferH264ForCam=t",fi="&preferH264ForScreenSharing=t",Si=3e4,gi=500,Ti=100,vi=4e3,Ii=1e3,Ci=300*1e3,dt=60*1e3,yi=300*1e3,Mi=4,ue=30*1e3,mt=60*1e3,bi=5*1e3,Ei=3*1e3,ki=5*1e3,Fi={colors:{accent:"#555fd0",accentText:"#ffffff",background:"#131a24",backgroundAccent:"#2f3150",baseText:"#f2f3fe",border:"#131a24",mainAreaBg:"#16202d",mainAreaBgAccent:"#555fd0",mainAreaText:"#2f3150",supportiveText:"#bfbfc1"}},he=["waitingNoHost","waitingForHost","claimPrompt","autoHostCheckIn","autoHostFocus","autoHostCheckOut","noHostCheckIn","noHostCheckOut","hostDroppedCheckIn","hostDroppedCheckOut"],_i={autoHostCheckIn:"check-in",noHostCheckIn:"check-in",hostDroppedCheckIn:"check-in",hostJoinedCheckIn:"check-in",hostCheckInUnderWay:"check-in",autoHostFocus:"focus",hostFocusUnderWay:"focus"},pt=["before-session","check-in","focus","check-out","completed"],Hs=(()=>{let s=class s{constructor(e,t,i,o,a,I,y,b,w,ee,te,ft,St,gt,Tt,vt,It,Ct,yt,Mt,bt,Et,kt,Ft,_t,xt){this.route=e,this.router=t,this.cdr=i,this.meetingsService=o,this.utilsService=a,this.dialogService=I,this.groupSessionFeedbackPromptService=y,this.deviceDetectionService=b,this.bookSessionsService=w,this.featureCheckService=ee,this.timeUtilitiesService=te,this.inSessionModalService=ft,this.partnerTasksService=St,this.dailyAppMessageService=gt,this.toastService=Tt,this.viewportService=vt,this.contentStackService=It,this.taskService=Ct,this.taskRolloverService=yt,this.groupMeetingCancellationNoticeService=Mt,this.groupSessionStageService=bt,this.playToneService=Et,this.analyticsService=kt,this.realtimeService=Ft,this.groupLateJoinAckService=_t,this.dateFormat=xt,this.user=new ke,this.sessionTime=0,this.sessionDuration=3e3*1e3,this.meetingTitle="Facilitated Group Session",this.meetingDescription=null,this.meetingRoom="",this.facilitator=null,this.participantCount=0,this.capacity=null,this.launchState="loading",this.errorMessage="",this.lastReceivedErrorMsg=null,this.launchInfo=null,this.callFrame=null,this.presentUserIds=new Set,this.participantMediaStates={},this.participantTaskExpansionState=new Z,this.focusStartMs=M(0),this.isStartingFocusTime=M(!1),this.focusMeetingExter
2nalId=M(null),this.canStartFocusTime=O(()=>{let H=this.focusMeetingExternalId(),ie=this.focusStartMs(),de=this.timeUtilitiesService.nowMsSig()();return!!H&&this.isCurrentUserFacilitator()&&!this.isStartingFocusTime()&&this.groupSessionStageService.currentStage()==="check-in"&&ie===this.getScheduledFocusStartMs()&&de>=this.sessionTime+dt&&de<ie}),this.startFocusTimeTooltip=O(()=>{if(this.canStartFocusTime())return"Start Focus time if you finish check-in early";let H=this.groupSessionStageService.currentStage();return H===null||H==="before-session"||H==="check-in"&&this.timeUtilitiesService.nowMsSig()()<this.sessionTime+dt?"Available 1 minute after session starts":"Focus time has already started"}),this.startFocusTimeAction=()=>{this.onStartFocusTime()},this.showFocusStartedWhileJoiningNotice=M(!1),this.isQuietModeNoticeDismissed=M(!1),this.lateJoinPromptOpen=!1,this.destroyed=!1,this.isTaskManagerEnabled=!1,this.ngUnsubscribe=new J,this.startTimeRefreshTimeoutId=null,this.hasRefreshedAtSessionStart=!1,this.unexpectedParticipantRefreshInFlight=!1,this.sessionResyncTimeoutId=null,this.sessionResyncPromise=null,this.sessionResyncQueued=!1,this.focusStatePollTimeoutId=null,this.focusStateRefreshTimeoutId=null,this.focusStateRefreshInFlight=!1,this.focusStateRefreshQueued=!1,this.bufferedFocusStates=new Map,this.sessionTasksSub=null,this.taskMeetingId=null,this.forcedCancellationExitInProgress=!1,this.hostChangeGateOpen=!1,this.joinWindowExitInProgress=!1,this.leaveInProgress=!1,this.participantJoinTonePlayedUserIds=new Set,this.topSessionTask=null,this.localJoinedAtMs=null,this.hostLastSeenAtMs=null,this.lastHostPresence=null,this.autoHostPromptedStage=null,this.sideDialog=null,this.newHostNoticeTimeoutId=null,this.claimPromptSettled=!1,this.inRoomClaimInFlight=!1}ngOnInit(){return d(this,null,function*(){if(this.bookSessionsService.joinedSession(),this.user=this.route.snapshot.data.currentUser,this.isTaskManagerEnabled=this.featureCheckService.isTaskManagerEnabled(this.user),!this.initializeSessionTimeFromRoute()){this.router.navigate(["/dashboard"]);return}if(!this.deviceDetectionService.isSupportedBrowserDaily()){this.showBrowserWarningAndExit();return}this.groupMeetingCancellationNoticeService.setActiveGroupMeetingSession(this.sessionTime,{isInCall:()=>this.launchState==="joining"||this.launchState==="inCall",onHostChangeGateOpened:()=>{this.hostChangeGateOpen=!0},needsLateJoinConsent:()=>this.needsLateJoinConsent(),onHostChangeGateJoin:e=>this.continueJoinAfterHostChangeNotice(e)}),this.subscribeToFocusStateUpdates(),this.subscribeToFacilitatorClaimed(),this.subscribeToHostChangeNotices(),this.scheduleStartTimeLaunchInfoRefresh(),this.subscribeToCancellationForcedExit(),this.subscribeToDailyAppMessages(),this.timeUtilitiesService.onSecondStart().pipe(p(this.ngUnsubscribe)).subscribe(()=>{this.evaluateInRoomTimeline()}),this.timeUtilitiesService.onMinuteStart().pipe(p(this.ngUnsubscribe)).subscribe(()=>{this.reconcileLaunchState()}),this.groupSessionStageService.currentStage$.pipe(p(this.ngUnsubscribe)).subscribe(e=>{this.syncFocusStatePolling(),!(!e||this.launchState==="joining"||this.launchState==="inCall")&&this.reconcileLaunchState()}),this.groupSessionStageService.stageEntered$.pipe(p(this.ngUnsubscribe)).subscribe(e=>{switch(this.closeSideDialogFromStagesBefore(e.currentStage),e.currentStage){case"focus":e.previousStage==="check-in"&&this.isCurrentUserFacilitator()&&this.playFocusTimeStartedTone();break;case"check-out":this.showFocusStartedWhileJoiningNotice.set(!1),this.playSessionEndedTone();break}}),this.registerForOpenFeedbackFormEvent(),yield this.loadSessionLaunchInfo()})}ngOnDestroy(){this.destroyed=!0,this.ngUnsubscribe.next(),this.ngUnsubscribe.complete(),this.startTimeRefreshTimeoutId&&(clearTimeout(this.startTimeRefreshTimeoutId),this.startTimeRefreshTimeoutId=null),this.sessionResyncTimeoutId&&(clearTimeout(this.sessionResyncTimeoutId),this.sessionResyncTimeoutId=null),this.clearFocusStateTimers(),this.bufferedFocusStates.clear(),this.closeSideDialog(),this.clearNewHostNoticeTimeout(),this.sessionTasksSub?.unsubscribe(),this.sessionTasksSub=null,this.partnerTasksService.setSessionContext(null),this.partnerTasksService.setCallFrame(null),this.dailyAppMessageService.setCallFrame(null),this.groupMeetingCancellationNoticeService.clearActiveGroupMeetingSession(this.sessionTime),this.destroyCallFrame()}onClickRetry(){return d(this,null,function*(){yield this.loadSessionLaunchInfo()})}onClickLeave(){return d(this,null,function*(){this.leaveInProgress||(this.leaveInProgress=!0,yield this.destroyCallFrame(),yield this.router.navigate(["/dashboard"]),this.promptForFeedbackOnLeave())})}
2promptForFeedbackOnLeave(){let e=this.launchInfo?.meeting?.id;if(!e||this.utilsService.getCurrentTimestamp()<this.sessionTime)return;if(this.groupSessionStageService.currentStage()==="completed"||this.utilsService.getCurrentTimestamp()>=this.sessionTime+this.sessionDuration){this.groupSessionFeedbackPromptService.promptAfterMeetingEnded(e);return}this.groupSessionFeedbackPromptService.promptOnLeave(e)}openInSessionTaskDrawer(){let e=this.buildInSessionTaskPanelContext();e&&this.contentStackService.pushInSessionTaskPanelToDynamicPanel(e)}buildInSessionTaskPanelContext(){let e=this.launchInfo?.meeting;return e?.id?{mode:"group",sessionExternalId:e.id,sessionTime:this.sessionTime,durationMs:this.sessionDuration,meetingRoom:this.meetingRoom,groupParticipantConfigs:e.participantConfigs||[],groupParticipants:this.launchInfo?.participants||{},currentUserId:this.user?.userId||"",presentUserIds:this.presentUserIds,participantMediaStates:this.participantMediaStates,participantTaskExpansionState:this.participantTaskExpansionState,canStartFocusTime:this.canStartFocusTime,isStartingFocusTime:this.isStartingFocusTime,startFocusTimeTooltip:this.startFocusTimeTooltip,startFocusTime:this.startFocusTimeAction}:null}syncInSessionTaskDrawerContext(){let e=this.buildInSessionTaskPanelContext();e&&this.contentStackService.updateInSessionTaskPanelContext(e)}initializeSessionTimeFromRoute(){let e=this.route.snapshot.params.id,t=Number(e);return!(!Number.isFinite(t)||t<=0||(this.sessionTime=t*1e3,this.focusStartMs.set(this.getScheduledFocusStartMs()),this.sessionTime/6e4%5!==0))}loadSessionLaunchInfo(){return d(this,null,function*(){this.launchState="loading",this.errorMessage="",this.lastReceivedErrorMsg=null,this.cdr.markForCheck();try{if(this.launchInfo=yield k(this.meetingsService.getGroupSessionLaunchInfoByStartTime(this.sessionTime)),this.applyLaunchInfoMetadata(this.launchInfo),this.processLaunchInfoNotices(this.launchInfo))return;yield this.reconcileLaunchState()}catch(e){this.handleGroupSessionLaunchInfoError(e)||(this.launchState="error",this.errorMessage="We could not load this group session right now.",this.lastReceivedErrorMsg=this.errorMessage,C(e,{tags:{"fm.errorDomain":"groupSessionLaunchInfo"}}))}this.cdr.markForCheck()})}scheduleStartTimeLaunchInfoRefresh(){if(this.hasRefreshedAtSessionStart)return;this.startTimeRefreshTimeoutId&&(clearTimeout(this.startTimeRefreshTimeoutId),this.startTimeRefreshTimeoutId=null);let e=this.utilsService.getCurrentTimestamp();if(e>=this.sessionTime)return;let t=this.sessionTime-e;this.startTimeRefreshTimeoutId=setTimeout(()=>{this.startTimeRefreshTimeoutId=null,this.refreshLaunchInfoAtSessionStart()},t)}refreshLaunchInfoAtSessionStart(){return d(this,null,function*(){if(!this.hasRefreshedAtSessionStart){this.hasRefreshedAtSessionStart=!0;try{let e=yield k(this.meetingsService.getGroupSessionLaunchInfoByStartTime(this.sessionTime));if(!this.isValidStartTimeLaunchInfo(e)){yield this.handleInvalidStartTimeRefreshResult();return}if(this.launchInfo=e,this.applyLaunchInfoMetadata(e),this.processLaunchInfoNotices(e))return;this.cdr.markForCheck()}catch{yield this.handleInvalidStartTimeRefreshResult()}}})}isValidStartTimeLaunchInfo(e){if(!e?.meeting?.id||!Array.isArray(e.meeting.participantConfigs))return!1;let t=this.user?.userId;return t?e.meeting.participantConfigs.some(i=>i.id===t):!1}handleInvalidStartTimeRefreshResult(){return d(this,null,function*(){if(this.callFrame!==null||this.launchState==="joining"||this.launchState==="inCall"){yield this.destroyCallFrame(),this.router.navigate(["/dashboard"]);return}this.launchState="error",this.errorMessage="This group session is no longer available.",this.lastReceivedErrorMsg=this.errorMessage,this.cdr.markForCheck()})}applyLaunchInfoMetadata(e){let t=e.meeting;this.setActiveFocusMeeting(t.id),e.sessionState&&this.mergeFocusState(e.sessionState),this.partnerTasksService.setSessionContext(t.id||null,"group_meeting"),this.initializeSessionTasks(),this.sessionDuration=t.durationMs||this.sessionDuration,this.meetingTitle=t.title||this.meetingTitle,this.meetingDescription=t.description||null,this.meetingRoom=t.meetingRoom||"",this.capacity=t.capacity,this.participantCount=t.participantConfigs?.length||0;let i=t.participantConfigs?.find(o=>o.role==="facilitator");this.facilitator=i&&e.participants?.[i.id]||null,this.syncParticipantTaskExpansionState(),this.syncInSessionTaskDrawerContext(),this.evaluateInRoomTimeline()}reconcileLaunchState(){return d(this,null,function*(){if(!this.lau
2nchInfo||this.launchState==="inCall"||this.launchState==="joining"||this.hostChangeGateOpen)return;let e=this.utilsService.getCurrentTimestamp();if(e<this.sessionTime-ce){this.exitForJoinWindow("tooEarly");return}if(e>this.sessionTime+this.sessionDuration+ce){this.exitForJoinWindow("tooLate");return}if(!this.groupSessionStageService.currentStage()){this.launchState="loading",this.cdr.markForCheck();return}yield this.joinMeeting()})}exitForJoinWindow(e){this.joinWindowExitInProgress||(this.joinWindowExitInProgress=!0,e==="tooEarly"?this.dialogService.openJoinedTooEarlyDialog(this.sessionTime,"group"):this.dialogService.openJoinedTooLateDialog(this.sessionTime,"group"),this.router.navigate(["/dashboard"]))}confirmLateJoinIfFocusInProgress(){return d(this,null,function*(){if(!this.needsLateJoinConsent())return!0;if(this.lateJoinPromptOpen)return!1;this.lateJoinPromptOpen=!0;try{let e=yield new Promise(t=>{this.dialogService.openGroupMeetingLateJoinDialog(t,"groupSessionPage")});return this.destroyed?!1:e?(this.groupLateJoinAckService.acknowledgeGroupLateJoin(this.sessionTime),!0):(yield this.router.navigate(["/dashboard"]),!1)}finally{this.lateJoinPromptOpen=!1}})}joinMeeting(){return d(this,null,function*(){if(!this.launchInfo)return;
2let e=this.launchInfo.daily?.token||"";if(!this.meetingRoom||!e){this.launchState="error",this.errorMessage="This group session is not ready to join yet. Please retry shortly.",this.lastReceivedErrorMsg=this.errorMessage,this.cdr.markForCheck();return}if(!(yield this.confirmLateJoinIfFocusInProgress())||this.hostChangeGateOpen)return;this.launchState="joining",this.errorMessage="",this.cdr.markForCheck(),yield this.recordGroupSessionLifecycleEvent("join_attempt");let t=this.getEffectiveStageAt(this.timeUtilitiesService.syncedNowMs());try{yield this.destroyCallFrame();let i=this.getDailyJoinSettings();this.callFrame=ae.createFrame(this.dailyFrameHost.nativeElement),this.addDailyEventListeners(),this.partnerTasksService.setCallFrame(this.callFrame),this.dailyAppMessageService.setCallFrame(this.callFrame),yield this.joinDailyMeetingWithTimeout(e,i),this.muteLocalAudioIfFocusStartedDuringJoin(),t!=="focus"&&this.getEffectiveStageAt(this.timeUtilitiesService.syncedNowMs())==="focus"&&this.showFocusStartedWhileJoiningNotice.set(!0),this.launchState="inCall",this.groupLateJoinAckService.acknowledgeGroupLateJoin(this.sessionTime),this.onEnteredCall(),this.syncCallParticipantsState()}catch(i){this.launchState="error",this.errorMessage="We could not connect to video. Please retry. If this keeps happening, return to your dashboard and rejoin.",this.lastReceivedErrorMsg=this.errorMessage,C(i,{tags:{"fm.errorDomain":"groupSessionJoin"}}),yield this.destroyCallFrame()}this.cdr.markForCheck()})}joinDailyMeetingWithTimeout(e,t){return d(this,null,function*(){if(!this.callFrame)throw new Error("Daily call frame not initialized");let i=null;try{yield Promise.race([this.callFrame.join({url:this.buildDailyMeetingUrl(),token:e,showLeaveButton:!1,showFullscreenButton:!(this.deviceDetectionService.isMobile()&&this.deviceDetectionService.isSafari()),iframeStyle:{},showUserNameChangeUI:!1,showParticipantsBar:!1,theme:Fi,activeSpeakerMode:!1,startAudioOff:!t.mic,startVideoOff:!t.camera}),new Promise((o,a)=>{i=setTimeout(()=>{a(new Error("Timed out while joining Daily meeting"))},Si)})])}finally{this.callFrame.setPlayNewParticipantSound(!1),i&&clearTimeout(i)}})}addDailyEventListeners(){this.callFrame&&this.callFrame.on("joined-meeting",()=>{this.partnerTasksService.requestSendSnapshot(),this.syncCallParticipantsState()}).on("participant-joined",e=>{this.partnerTasksService.requestSendSnapshot(),this.syncCallParticipantsState();let t=e?.participant?.user_id;this.playParticipantJoinedToneOnce(t),this.refreshLaunchInfoIfUnexpectedParticipantJoined(t)}).on("participant-left",()=>{this.syncCallParticipantsState()}).on("participant-updated",e=>{this.syncCallParticipantsState(),e?.participant?.user_id===this.user.userId&&this.saveLatestSessionSettings(!!e.participant.audio,!!e.participant.video)}).on("left-meeting",()=>{this.launchState==="inCall"&&this.onClickLeave()}).on("error",e=>{typeof e?.errorMsg=="string"&&e.errorMsg.length>0&&(this.lastReceivedErrorMsg=e.errorMsg),C(e,{tags:{"fm.errorDomain":"groupSessionDailyError"}})})}syncCallParticipantsState(){if(!this.callFrame){this.presentUserIds=new Set,this.participantMediaStates={},this.syncParticipantTaskExpansionState(),this.cdr.markForCheck();return}let e=new Set,t={},i=this.callFrame.participants?.();if(i&&typeof i=="object")for(let o of Object.values(i)){let a=o?.user_id;typeof a=="string"&&a.length>0&&(e.add(a),t[a]={micOn:!!o?.audio,cameraOn:!!o?.video})}this.presentUserIds=e,this.participantMediaStates=t,this.syncParticipantTaskExpansionState(),this.syncInSessionTaskDrawerContext(),this.evaluateInRoomTimeline(),this.cdr.markForCheck()}
2syncParticipantTaskExpansionState(){let e=this.launchInfo?.meeting;!e?.id||!this.user?.userId||this.participantTaskExpansionState.sync({sessionExternalId:e.id,currentUserId:this.user.userId,participantIds:(e.participantConfigs||[]).map(t=>t.id),presentUserIds:this.presentUserIds})}refreshLaunchInfoIfUnexpectedParticipantJoined(e){return d(this,null,function*(){if(!(!e||this.isExpectedParticipant(e))&&!this.unexpectedParticipantRefreshInFlight){this.unexpectedParticipantRefreshInFlight=!0;try{let t=yield k(this.meetingsService.getGroupSessionLaunchInfoByStartTime(this.sessionTime));this.applyRefreshedLaunchInfo(t)}catch(t){x(t)||C(t,{tags:{"fm.errorDomain":"groupSessionParticipantRefresh"}})}finally{this.unexpectedParticipantRefreshInFlight=!1}}})}recordGroupSessionLifecycleEvent(e){return d(this,null,function*(){try{yield k(this.meetingsService.recordGroupSessionLifecycleEvent(this.sessionTime,e))}catch(t){x(t)||C(t,{tags:{"fm.errorDomain":"groupSessionLifecycleEvent"},extra:{eventType:e,sessionTime:this.sessionTime}})}})}subscribeToCancellationForcedExit(){this.groupMeetingCancellationNoticeService.forceExitGroupSession$.pipe(p(this.ngUnsubscribe)).subscribe(e=>{e===this.sessionTime&&this.forceExitForCancellationNotice()})}subscribeToFocusStateUpdates(){this.realtimeService.onEventType(Ue).pipe(p(this.ngUnsubscribe)).subscribe(e=>{this.receiveFocusState(e.data)}),this.realtimeService.onStateRefresh.pipe(p(this.ngUnsubscribe)).subscribe(()=>{this.shouldPollFocusState()&&this.requestFocusStateRefresh()})}receiveFocusState(e){let t=this.focusMeetingExternalId();if(!t){let i=this.bufferedFocusStates.get(e.groupMeetingExternalId);for((!i||e.focusStartMs<i.focusStartMs)&&this.bufferedFocusStates.set(e.groupMeetingExternalId,e);this.bufferedFocusStates.size>Mi;){let o=this.bufferedFocusStates.keys().next().value;if(!o)break;this.bufferedFocusStates.delete(o)}return}t===e.groupMeetingExternalId&&this.mergeFocusState(e)}setActiveFocusMeeting(e){if(e){if(this.focusMeetingExternalId()!==e){let t=this.bufferedFocusStates.get(e);this.bufferedFocusStates.clear(),this.focusMeetingExternalId.set(e),this.focusStartMs.set(this.getScheduledFocusStartMs()),t&&this.mergeFocusState(t)}this.syncFocusStatePolling()}}mergeFocusState(e){if(e.groupMeetingExternalId!==this.focusMeetingExternalId()||e.startMs!==this.sessionTime)return;let t=this.getScheduledFocusStartMs(),i=Math.min(Math.max(e.focusStartMs,this.sessionTime),t),o=this.focusStartMs(),a=Math.min(o||t,i);a!==o&&this.focusStartMs.set(a),this.syncFocusStatePolling()}getScheduledFocusStartMs(){return this.sessionTime+Ci}getEffectiveStageAt(e){let t=this.focusStartMs()||this.getScheduledFocusStartMs(),i=this.sessionTime+this.sessionDuration,o=i+yi;return e<this.sessionTime?"before-session":e<t?"check-in":e<i?"focus":e<o?"check-out":"completed"}onStartFocusTime(){return d(this,null,function*(){let e=this.focusMeetingExternalId();if(!(!e||!this.canStartFocusTime())){this.analyticsService.logGroupMeetingClick("startFocusTime","session: task panel host controls"),this.isStartingFocusTime.set(!0);try{let t=yield k(this.meetingsService.startGroupMeetingFocus(e));this.mergeFocusState(t),this.dailyAppMessageService.broadcast({type:"session-resync",reason:"focus-started"})}catch(t){this.toastService.openErrorToast(K(t,"Unable to start Focus time. Please try again.","update")),x(t)||C(t,{tags:{"fm.errorDomain":"groupSessionStartFocus"}})}finally{this.isStartingFocusTime.set(!1)}}})}syncFocusStatePolling(){if(this.shouldPollFocusState()){this.scheduleFocusStatePoll();return}this.focusStatePollTimeoutId&&(clearTimeout(this.focusStatePollTimeoutId),this.focusStatePollTimeoutId=null)}shouldPollFocusState(){return!!this.focusMeetingExternalId()&&this.getEffectiveStageAt(this.timeUtilitiesService.syncedNowMs())==="check-in"&&!this.forcedCancellationExitInProgress}scheduleFocusStatePoll(){if(this.focusStatePollTimeoutId||!this.shouldPollFocusState())return;let e=vi+Math.floor(Math.random()*Ii);this.focusStatePollTimeoutId=setTimeout(()=>{this.focusStatePollTimeoutId=null,this.shouldPollFocusState()&&(this.requestFocusStateRefresh(),this.scheduleFocusStatePoll
2())},e)}requestFocusStateRefresh(){!this.shouldPollFocusState()||this.focusStateRefreshTimeoutId||(this.focusStateRefreshTimeoutId=setTimeout(()=>{this.focusStateRefreshTimeoutId=null,this.refreshFocusState()},Ti))}refreshFocusState(){return d(this,null,function*(){let e=this.focusMeetingExternalId();if(!(!e||!this.shouldPollFocusState())){if(this.focusStateRefreshInFlight){this.focusStateRefreshQueued=!0;return}this.focusStateRefreshInFlight=!0;try{let t=yield k(this.meetingsService.getGroupMeetingSessionState(e));this.focusMeetingExternalId()===e&&this.mergeFocusState(t)}catch(t){x(t)||C(t,{tags:{"fm.errorDomain":"groupSessionFocusStateRefresh"}})}finally{this.focusStateRefreshInFlight=!1,this.focusStateRefreshQueued&&(this.focusStateRefreshQueued=!1,this.requestFocusStateRefresh())}}})}clearFocusStateTimers(){this.focusStatePollTimeoutId&&(clearTimeout(this.focusStatePollTimeoutId),this.focusStatePollTimeoutId=null),this.focusStateRefreshTimeoutId&&(clearTimeout(this.focusStateRefreshTimeoutId),this.focusStateRefreshTimeoutId=null),this.focusMeetingExternalId.set(null)}subscribeToDailyAppMessages(){this.dailyAppMessageService.messages$.pipe(p(this.ngUnsubscribe)).subscribe(({message:e,senderUserId:t})=>{e.type==="session-resync"?this.requestLaunchInfoResync():e.type==="session-moderation"&&this.handleSessionModeration(e,t)})}handleSessionModeration(e,t){if(this.callFrame&&!(!t||!this.isFacilitatorUserId(t)))switch(e.action){case"mute-audio":e.targetUserId===this.user?.userId&&this.muteLocalAudioForModeration(t);break;case"mute-all-audio":this.muteLocalAudioForModeration(t);break;case"disable-video":e.targetUserId===this.user?.userId&&this.callFrame.localVideo()&&(this.callFrame.setLocalVideo(!1),this.toastService.openSuccessToast("The host turned off your camera."));break;default:break}}muteLocalAudioForModeration(e){this.callFrame?.localAudio()&&(this.callFrame.setLocalAudio(!1),e!==this.user?.userId&&this.toastService.openSuccessToast("The host muted your microphone."))}isFacilitatorUserId(e){let t=this.launchInfo?.meeting?.participantConfigs;return Array.isArray(t)?t.some(i=>i.id===e&&i.role==="facilitator"):!1}isCurrentUserFacilitator(){let e=this.user?.userId;return!!e&&this.isFacilitatorUserId(e)}playParticipantJoinedToneOnce(e){!e||e===this.user?.userId||!this.isCurrentUserFacilitator()||this.participantJoinTonePlayedUserIds.has(e)||(this.participantJoinTonePlayedUserIds.add(e),this.playToneService.playParticipantJoinedTone().catch(()=>{}))}playFocusTimeStartedTone(){return d(this,null,function*(){try{yield this.playToneService.playFocusTimeStartedTone()}catch{}})}playSessionEndedTone(){return d(this,null,function*(){let e=!0;try{yield this.playToneService.playEndSessionTone()}catch{e=!1}this.analyticsService.logDailySessionInfoEvent({type:"timerEnded",playedTone:e})})}requestLaunchInfoResync(){this.sessionResyncTimeoutId===null&&(this.sessionResyncTimeoutId=setTimeout(()=>{this.sessionResyncTimeoutId=null,this.resyncLaunchInfo()},gi))}resyncLaunchInfo(){return this.forcedCancellationExitInProgress?Promise.resolve():this.sessionResyncPromise?(this.sessionResyncQueued=!0,this.sessionResyncPromise):(this.sessionResyncPromise=this.runLaunchInfoResyncPass().finally(()=>{this.sessionResyncPromise=null}),this.sessionResyncPromise)}runLaunchInfoResyncPass(){return d(this,null,function*(){do this.sessionResyncQueued=!1,yield this.fetchAndApplyLaunchInfo();while(this.sessionResyncQueued&&!this.destroyed&&!this.forcedCancellationExitInProgress)})}fetchAndApplyLaunchInfo(){return d(this,null,function*(){try{let e=yield k(this.meetingsService.getGroupSessionLaunchInfoByStartTime(this.sessionTime));this.applyRefreshedLaunchInfo(e)}catch(e){x(e)||C(e,{tags:{"fm.errorDomain":"groupSessionResync"}})}})}applyRefreshedLaunchInfo(e){this.destroyed||this.groupMeetingCancellationNoticeService.processLaunchInfoNotices(e.groupMeetingCancellationNotices??[])||(e?.meeting?.id&&Array.isArray(e.meeting.participantConfigs)&&(this.launchInfo=e,this.applyLaunchInfoMetadata(e),this.cdr.markForCheck()),this.groupMeetingCancellationNoticeService.processLaunchInfoHostChangeNotices(e.groupMeetingHostChangeNotices??[],e.meeting))}processLaunchInfoNotices(e){return this.groupMeetingCancellationNoticeService.processLaunchInfoNotices(e.groupMeetingCancellationNotices??[])?!0:this.groupMeetingCancellationNoticeService.processLaunchInfoHostChangeNotices(e.groupMeetingHostChangeNotices??[],e.meeting)}continueJoinAfterHostChangeNotice(e){this.hostChangeGateOpen=!1,e&&this.groupLateJoinAckService.acknowledgeGroupLateJoin(this.sessionTime),!(this.destroyed||this.launchState==="inCall"||this.launchState==="joining")&&this.reconcileLaunchState()}needsLateJoinConsent(){return this.getEffectiveStageAt(this.timeUtilitiesService.syncedNowMs())==="focus"&&!this.groupLateJoinAckService.hasAcknowledgedGroupLateJoin(this.sessionTime)}forceExitForCancellationNotice(){return d(this,null,function*(){this.forcedCancellationExitInProgress||(this.forcedCancellationExitInProgress=!0,yield this.destroyCallFrame(),this.router.navigate(["/dashboard"]))})}getFacilitatorUserId(){return this.launchInfo?.meeting?.participantConfigs?.find(t=>t.role==="facilitator")?.id??null}
2canClaimHostlessInRoom(){return!!this.launchInfo?.meeting?.claimable&&!this.claimPromptSettled}getHostPresence(e){let t=this.getFacilitatorUserId();return t?this.isCurrentUserFacilitator()||this.presentUserIds.has(t)?(this.hostLastSeenAtMs=e,"present"):this.localJoinedAtMs===null?"pending":this.hostLastSeenAtMs===null?e-this.localJoinedAtMs>=bi?"absent":"pending":e-this.hostLastSeenAtMs>=Ei?"absent":"pending":"hostless"}evaluateInRoomTimeline(){if(this.launchState!=="inCall"||!this.launchInfo?.meeting?.id||this.inRoomClaimInFlight)return;let e=this.timeUtilitiesService.syncedNowMs(),t=this.getEffectiveStageAt(e);if(t==="before-session"){this.getHostPresence(e)==="hostless"&&this.canClaimHostlessInRoom()?this.showClaimPrompt(this.sessionTime+ue):this.closeSideDialog(he);return}if(t==="completed"){this.closeSideDialog(he);return}let i=this.getHostPresence(e);if(i==="pending")return;let o=this.lastHostPresence;if(i!=="hostless"&&(this.lastHostPresence=i),i==="present"){let I=this.autoHostPromptedStage;this.autoHostPromptedStage=null,this.closeSideDialog(he),!this.isCurrentUserFacilitator()&&o==="absent"&&I===t&&this.showHostTransitionNotice("joined",t);return}let a=e-this.sessionTime;if(i==="hostless"){if(a<ue){this.canClaimHostlessInRoom()?this.showClaimPrompt(this.sessionTime+ue):this.showSideNotice("waitingNoHost");return}}else{if(a<mt){this.showSideNotice("waitingForHost");return}if(o==="present"){this.autoHostPromptedStage=t,this.showHostTransitionNotice("dropped",t);return}}this.promptAutoHostForStage(t,i==="hostless")}promptAutoHostForStage(e,t){if(this.autoHostPromptedStage!==e)switch(this.autoHostPromptedStage=e,e){case"check-in":this.showSideNotice(t?"noHostCheckIn":"autoHostCheckIn");break;case"focus":this.showSideNotice("autoHostFocus");break;case"check-out":this.showSideNotice(t?"noHostCheckOut":"autoHostCheckOut");break}}showHostTransitionNotice(e,t){t==="check-in"?this.showSideNotice(e==="joined"?"hostJoinedCheckIn":"hostDroppedCheckIn"):t==="check-out"&&this.showSideNotice(e==="joined"?"hostJoinedCheckOut":"hostDroppedCheckOut")}noticeHostOnArrival(e){switch(this.getEffectiveStageAt(e)){case"check-in":e-this.sessionTime>=mt&&this.showSideNotice("hostCheckInUnderWay");break;case"focus":this.showSideNotice("hostFocusUnderWay",null,this.formatClockTime(this.sessionTime+this.sessionDuration));break;case"check-out":this.showSideNotice("hostCheckOutUnderWay");break}}onEnteredCall(){let e=this.timeUtilitiesService.syncedNowMs();this.localJoinedAtMs=e,this.hostLastSeenAtMs=null,this.lastHostPresence=null,this.autoHostPromptedStage=this.getEffectiveStageAt(e)==="focus"?"focus":null,this.isCurrentUserFacilitator()&&this.noticeHostOnArrival(e)}formatClockTime(e){let t=this.user?.timeZone??"UTC",i=this.user?.settings?.timeFormat??"12hr",o=this.dateFormat.format(e,"h:mma",t,i);return i==="12hr"?o.replace(/:00/g,""):o}showSideNotice(e,t=null,i=null){this.showSideDialog(e,()=>this.dialogService.openGroupSessionSideNoticeDialog(e,t,i))}showClaimPrompt(e){this.showSideDialog("claimPrompt",()=>this.dialogService.openGroupSessionClaimPromptDialog(e,t=>{t==="accept"?(this.claimPromptSettled=!0,this.claimFromRoom()):(t==="decline"||t==="expired")&&(this.claimPromptSettled=!0,this.evaluateInRoomTimeline())}))}showSideDialog(e,t){if(this.sideDialog?.kind===e)return;this.closeSideDialog();let i=t();i&&(this.sideDialog={kind:e,ref:i},i.onDestroy.subscribe(()=>{this.sideDialog?.ref===i&&(this.sideDialog=null)}))}closeSideDialogFromStagesBefore(e){let t=this.sideDialog?.kind,i=t?_i[t]:void 0;!t||!i||pt.indexOf(i)<pt.indexOf(e)&&this.closeSideDialog([t])}closeSideDialog(e){if(!this.sideDialog||e&&!e.includes(this.sideDialog.kind))return;let{ref:t}=this.sideDialog;this.sideDialog=null,t.close()}
2claimFromRoom(){return d(this,null,function*(){let e=this.launchInfo?.meeting?.id;if(!(!e||this.inRoomClaimInFlight)){this.inRoomClaimInFlight=!0;try{yield k(this.meetingsService.claimGroupMeeting(e,!1)),this.toastService.openSuccessToast("You\u2019re now hosting this session.")}catch(t){this.toastService.openErrorToast(K(t,"Could not host this session. Please try again.","claim")),x(t)||C(t,{tags:{"fm.errorDomain":"groupSessionClaim"}})}try{yield this.resyncLaunchInfo()}finally{this.inRoomClaimInFlight=!1}this.evaluateInRoomTimeline()}})}subscribeToFacilitatorClaimed(){this.realtimeService.onEventType(Oe).pipe(p(this.ngUnsubscribe)).subscribe(e=>{e.data.groupMeetingExternalId===this.launchInfo?.meeting?.id&&this.handleFacilitatorClaimed(e.data.facilitatorUserId)})}subscribeToHostChangeNotices(){this.realtimeService.onEventType(Ne).pipe(p(this.ngUnsubscribe)).subscribe(e=>{e.data.groupMeetingExternalId===this.launchInfo?.meeting?.id&&this.requestLaunchInfoResync()})}handleFacilitatorClaimed(e){return d(this,null,function*(){if(yield this.resyncLaunchInfo(),this.destroyed||this.launchState!=="inCall"||e===this.user?.userId||this.getFacilitatorUserId()!==e)return;let t=this.launchInfo?.participants?.[e];this.showSideNotice("newHost",{name:t?.displayName?.trim()||"Your new Host",photo:t?.photo||null}),this.clearNewHostNoticeTimeout(),this.newHostNoticeTimeoutId=setTimeout(()=>{this.newHostNoticeTimeoutId=null,this.closeSideDialog(["newHost"])},ki)})}clearNewHostNoticeTimeout(){this.newHostNoticeTimeoutId&&(clearTimeout(this.newHostNoticeTimeoutId),this.newHostNoticeTimeoutId=null)}handleGroupSessionLaunchInfoError(e){let t=He(e);return t===64||t===62?(this.router.navigate(["/group-meetings"]),!0):t===69?(this.exitForJoinWindow("tooEarly"),!0):t===68?(this.exitForJoinWindow("tooLate"),!0):x(e)?(this.launchState="error",this.errorMessage=K(e,"We could not load this group session right now.","join"),this.lastReceivedErrorMsg=this.errorMessage,!0):!1}isExpectedParticipant(e){let t=this.launchInfo?.meeting?.participantConfigs;return Array.isArray(t)?t.some(i=>i.id===e):!1}registerForOpenFeedbackFormEvent(){this.inSessionModalService.openFeedbackForm$.pipe(p(this.ngUnsubscribe)).subscribe(e=>{e&&this.feedbackForm.openForm(!0)})}destroyCallFrame(){return d(this,null,function*(){if(this.callFrame){yield this.callFrame.destroy(),this.callFrame=null;return}let e=ae.getCallInstance();e&&(yield e.destroy())})}buildDailyMeetingUrl(){let e=`https://focusmate.daily.co/${this.meetingRoom}${mi}`;return this.user?.features?.preferH264Enabled&&(e+=pi+fi),e}getDailyJoinSettings(){let e=this.getLatestSessionSettings();return this.getEffectiveStageAt(this.timeUtilitiesService.syncedNowMs())==="focus"?pe(me({},e),{mic:!1}):e}muteLocalAudioIfFocusStartedDuringJoin(){this.getEffectiveStageAt(this.timeUtilitiesService.syncedNowMs())==="focus"&&this.callFrame?.localAudio()&&this.callFrame.setLocalAudio(!1)}getLatestSessionSettings(){let e=null;try{e=JSON.parse(localStorage.getItem("latestSessionSettings"))}catch(t){C(t,{tags:{"fm.errorDomain":"groupSessionLocalStorage"}})}if(!e||e.sessionTime!==this.sessionTime){let t=this.user?.settings?.muteByDefault===!0,i=!!this.launchInfo?.meeting?.quietMode;e={sessionTime:this.sessionTime,mic:!(t||i),camera:!0}}return e}saveLatestSessionSettings(e,t){try{localStorage.setItem("latestSessionSettings",JSON.stringify({sessionTime:this.sessionTime,mic:e,camera:t}))}catch(i){C(i,{tags:{"fm.errorDomain":"groupSessionLocalStorage"}})}}showBrowserWarningAndExit(){setTimeout(()=>{this.dialogService.openSafariWarning((this.sessionTime/1e3).toString())},250),this.router.navigate(["/dashboard"])}
2tryJoinTimeAutoRolloverGroup(){let e=this.launchInfo?.meeting?.id;e&&this.taskRolloverService.tryJoinTimeAutoRollover({taskManagerEnabled:this.isTaskManagerEnabled,autoRollEnabledByUserSetting:this.user?.settings?.autoRolloverEnabled===!0,attachment:{type:"group_meeting",externalId:e}})}initializeSessionTasks(){if(!this.launchInfo?.meeting?.id||!this.isTaskManagerEnabled)return;let e=this.launchInfo.meeting.id;if(this.taskMeetingId===e&&this.sessionTasksSub)return;this.sessionTasksSub?.unsubscribe(),this.sessionTasksSub=null,this.taskMeetingId=e,this.topSessionTask=null,this.taskService.fetchTasksByGroupMeeting(e).pipe(se(1),p(this.ngUnsubscribe)).subscribe({next:()=>this.tryJoinTimeAutoRolloverGroup()});let t=this.taskService.sortedTaskForAttachment$({type:"group_meeting",externalId:e});this.sessionTasksSub=t.pipe(p(this.ngUnsubscribe)).subscribe(i=>{let o=i.find(a=>!a.completedAt);this.topSessionTask=o??null,this.cdr.markForCheck()})}refreshFocusStateWhenVisible(){document.visibilityState==="visible"&&this.shouldPollFocusState()&&this.requestFocusStateRefresh()}refreshGroupMeetingTasksOnWindowFocus(){if(!this.isTaskManagerEnabled||this.launchState!=="inCall")return;
2let e=this.launchInfo?.meeting?.id;e&&this.taskService.fetchTasksByGroupMeeting(e).pipe(se(1)).subscribe({next:()=>this.cdr.markForCheck(),error:()=>this.cdr.markForCheck()})}};s.\u0275fac=function(t){return new(t||s)(c(Ee),c(V),c(z),c(we),c(Q),c($),c(Ke),c(Fe),c(Le),c(Pe),c(q),c(Be),c(Ye),c($e),c(Ge),c(_e),c(Ze),c(We),c(st),c(ot),c(U),c(Ae),c(xe),c(Je),c(qe),c(je))},s.\u0275cmp=F({type:s,selectors:[["fm-group-session-launch-container"]],viewQuery:function(t,i){if(t&1&&(ne(Xt,7),ne(Zt,7)),t&2){let o;oe(o=re())&&(i.dailyFrameHost=o.first),oe(o=re())&&(i.feedbackForm=o.first)}},hostBindings:function(t,i){t&1&&v("visibilitychange",function(){return i.refreshFocusStateWhenVisible()},ve)("focus",function(){return i.refreshGroupMeetingTasksOnWindowFocus()},Te)},features:[Ce([U])],decls:15,vars:24,consts:[["dailyFrameHost",""],["sessionFeedback",""],[1,"launch","normalize-box-sizing","fm-global-styles","h-dvh","flex","flex-col","bg-[#131a24]","text-[#f2f3fe]"],[1,"shrink-0","border-b","border-solid","border-[#121a24]"],[3,"leave","title","description","facilitatorPhoto","isHostless","sessionTime","sessionDuration","sessionExternalId","focusStartMs","meetingRoom"],["type","button",1,"lg:hidden","w-full","text-left","cursor-pointer","touch-manipulation","bg-white","border-t","border-gray-300","px-3","py-1.5","min-h-[28px]","flex","flex-col","justify-center","gap-0.5","active:opacity-95"],[1,"flex","min-h-0","min-w-0","flex-1","overflow-hidden"],[1,"hidden","bp908:block",3,"context"],[1,"relative","flex-1","min-h-0","min-w-0"],[1,"absolute","inset-0"],[1,"pointer-events-none","absolute","inset-x-0","top-4","z-10","flex","justify-center","px-4"],[1,"absolute","inset-0","flex","items-center","justify-center","p-4"],[3,"isTestSession","sessionTime","timezone","roomId","loadAttemptFailedCount","networkQualityLowCount","networkQualityVeryLowCount","networkQualityGoodCount","lastReceivedErrorMsg"],[3,"dismiss"],["type","button",1,"lg:hidden","w-full","text-left","cursor-pointer","touch-manipulation","bg-white","border-t","border-gray-300","px-3","py-1.5","min-h-[28px]","flex","flex-col","justify-center","gap-0.5","active:opacity-95",3,"click"],[1,"text-[10px]","uppercase","tracking-[0.05em]","text-gray-500"],[1,"text-[13px]","font-semibold","text-gray-900"],[1,"text-[13px]","font-medium","text-gray-900"],[1,"rounded-full","border","border-[#2f3150]","bg-[#16202d]/95","px-4","py-2","text-13","text-[#bfbfc1]"],[1,"w-full","max-w-[520px]","rounded-2xl","border","border-[#2f3150]","bg-[#16202d]","p-5","text-center"],[1,"text-16","font-semibold"],[1,"mt-2","text-13","text-[#bfbfc1]"],[1,"mt-4","flex","flex-wrap","items-center","justify-center","gap-2"],["severity","primary","label","Retry","styleClass","!rounded",3,"onClick","buttonProps"],["severity","secondary","label","Back to dashboard","styleClass","!rounded",3,"onClick","buttonProps"]],template:function(t,i){if(t&1){let o=N();u(0,"div",2)(1,"header",3)(2,"fm-group-session-toolbar",4),v("leave",function(){return P(o),R(i.onClickLeave())}),h(),S(3,si,2,0,"fm-group-session-header-banner"),S(4,ni,2,0,"fm-group-session-header-banner"),h(),S(5,ai,3,1,"button",5),u(6,"main",6),S(7,ci,1,18,"app-in-session-task-panel",7),u(8,"div",8),E(9,"div",9,0),S(11,li,3,0,"div",10),S(12,di,4,2,"div",11),h()(),E(13,"app-feedback",12,1),h()}t&2&&(l(2),T("title",i.meetingTitle)("description",i.meetingDescription)("facilitatorPhoto",(i.facilitator==null?null:i.facilitator.photo)||null)("isHostless",!i.facilitator)("sessionTime",i.sessionTime)("sessionDuration",i.sessionDuration)("sessionExternalId",(i.launchInfo==null||i.launchInfo.meeting==null?null:i.launchInfo.meeting.id)||"")("focusStartMs",i.focusStartMs())("meetingRoom",i.meetingRoom),l(),g(!(i.launchInfo==null||i.launchInfo.meeting==null)&&i.launchInfo.meeting.quietMode&&!i.isQuietModeNoticeDismissed()?3:-1),l(),g(i.showFocusStartedWhileJoiningNotice()?4:-1),l(),g(i.isTaskManagerEnabled&&(!(i.launchInfo==null||i.launchInfo.meeting==null)&&i.launchInfo.meeting.id)&&i.viewportService.isMobile()?5:-1),l(2),g(i.launchState==="inCall"&&i.isTaskManagerEnabled&&(!(i.launchInfo==null||i.launchInfo.meeting==null)&&i.launchInfo.meeting.id)?7:-1),l(4),g(i.launchState==="joining"?11:-1),l(),g(i.launchState==="loading"||i.launchState==="error"?12:-1),l(),T("isTestSession",!1)("sessionTime",i.sessionTime)("timezone",i.user.timeZone)("roomId",i.meetingRoom)("loadAttemptFailedCount",0)("networkQualityLowCount",0)("networkQualityVeryLowCount",0)("networkQualityGoodCount",0)("lastReceivedErrorMsg",i.lastReceivedErrorMsg))},dependencies:[Me,De,Re,tt,nt,ut,Xe],encapsulation:2,changeDetection:0});let n=s;return n})();export{Hs as GroupSessionLaunchContainerComponent}; 3//# sourceMappingURL=chunk-NEDP7R3W.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.