"use strict";(self.webpackChunklernplattform_frontend=self.webpackChunklernplattform_frontend||[]).push([[38118],{865447:function(e,t,i){i.r(t),i.d(t,{ActivityTrackingService:function(){return l}});var r,s,c,a,n=i("aurelia-framework"),o=i(729769),u=i(961056),h=i(727806),v=i(106723),g=i(33396),p=i(792812),f=i(23159);let l=r=class{constructor(e,t,i){this.storeService=e,this.pageActiveService=t,this.activityService=i,this.pageTracker=null,this.quizSessionTracker=null,this.questionTracker=null,this.pageInteractions=new Set}startTrackingPage(e,t){this.pageTracker&&this.pageTracker.getAccessCodeId()===e&&this.pageTracker.getPageId()===t||(this.stopTrackingPage(),this.pageTracker=new h.J(this.storeService,this.pageActiveService,e,t,u.ActivityType.PageRead),this.pageTracker.start(),window.setTimeout((()=>{this.stopTrackingPage()}),60*r.MAX_TRACKING_TIME_IN_MIN*1e3))}startPageInteraction(e){(0!==this.pageInteractions.size||this.switchPageTrackingMode(u.ActivityType.PageInteraction))&&this.pageInteractions.add(e)}stopPageInteraction(e){this.pageInteractions.delete(e),0===this.pageInteractions.size&&this.switchPageTrackingMode(u.ActivityType.PageRead)}switchPageTrackingMode(e){if(!this.pageTracker)return!1;const t=this.pageTracker.getAccessCodeId(),i=this.pageTracker.getPageId();return!!i&&(this.stopTrackingPage(),this.pageTracker=new h.J(this.storeService,this.pageActiveService,t,i,e),this.pageTracker.start(),!0)}stopTrackingPage(){this.pageTracker&&(this.pageInteractions.clear(),this.pageTracker.stop(),this.pageTracker=null)}startTrackingQuizSession(e,t,i){this.quizSessionTracker&&this.quizSessionTracker.getQuizSessionId()===t||(this.stopTrackingQuizSession(),this.quizSessionTracker=new g.J(this.storeService,this.pageActiveService,e,t,i),this.quizSessionTracker.start())}stopTrackingQuizSession(){this.quizSessionTracker&&(this.quizSessionTracker.stop(),this.quizSessionTracker=null)}startTrackingQuestion(e,t,i){this.questionTracker&&this.questionTracker.getQuestionId()===t||(this.stopTrackingQuestion(),this.questionTracker=new v.K(this.storeService,this.pageActiveService,this.activityService,e,t,i),this.questionTracker.start())}stopTrackingQuestion(){this.questionTracker&&(this.questionTracker.stop(),this.questionTracker=null)}stopTrackingAndUploadAllQuestionActivities(){var e,t,i,r,s,c;return i=this,r=void 0,c=function*(){null===(e=this.questionTracker)||void 0===e||e.stop(),yield null===(t=this.questionTracker)||void 0===t?void 0:t.uploadAll()},new((s=void 0)||(s=Promise))((function(e,t){function a(e){try{o(c.next(e))}catch(e){t(e)}}function n(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(a,n)}o((c=c.apply(i,r||[])).next())}))}};l.MAX_TRACKING_TIME_IN_MIN=10,l=r=function(e,t,i,r){var s,c=arguments.length,a=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(a=(c<3?s(a):c>3?s(t,i,a):s(t,i))||a);return c>3&&a&&Object.defineProperty(t,i,a),a}([(0,n.autoinject)(),function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}("design:paramtypes",["function"==typeof(s=void 0!==o.StoreService&&o.StoreService)?s:Object,"function"==typeof(c=void 0!==p.PageActiveService&&p.PageActiveService)?c:Object,"function"==typeof(a=void 0!==f.ActivityService&&f.ActivityService)?a:Object])],l)},903025:function(e,t,i){var r,s,c,a,n,o,u=this&&this.__decorate||function(e,t,i,r){var s,c=arguments.length,a=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(a=(c<3?s(a):c>3?s(t,i,a):s(t,i))||a);return c>3&&a&&Object.defineProperty(t,i,a),a},h=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.AuthHelperService=void 0;const v=i("aurelia-framework"),g=i(718776),p=i(729769),f=i(369566),l=i(540286),d=i(23159),S=i(813735),T=i(616414),k=i(859754);let y=class{constructor(e,t,i,r,s,c){this.storeService=e,this.courseService=t,this.userSettingsService=i,this.activityService=r,this.router=s,this.courseCacheService=c}async afterLoginTasks(e=!0,t=!0){var i;if(await this.userSettingsService.updateUserSettings(),e){const e=await this.userSettingsService.getContactDetails();await this.storeService.dispatch(l.setSetupContactDetailsComplete,!(!e.birthdate||!(null===(i=e.address)||void 0===i?void 0:i.state)))}if((await this.courseService.getAndUpdateCourses()).length){const{currentAccessCodeId:e}=await this.storeService.getState();if(null!=e){const t=await this.activityService.getLastPageReadPageId(e);this.storeService.dispatch(f.updateLastVisitedLearnPageId,t),this.courseCacheService.clearCallPreventions()}this.router.navigate("/course")}else t&&this.router.navigate("setup/course")}};y=u([(0,v.autoinject)(),h("design:paramtypes",["function"==typeof(r=void 0!==p.StoreService&&p.StoreService)?r:Object,"function"==typeof(s=void 0!==S.CourseService&&S.CourseService)?s:Object,"function"==typeof(c=void 0!==T.UserSettingsService&&T.UserSettingsService)?c:Object,"function"==typeof(a=void 0!==d.ActivityService&&d.ActivityService)?a:Object,"function"==typeof(n=void 0!==g.Router&&g.Router)?n:Object,"function"==typeof(o=void 0!==k.CourseCacheService&&k.CourseCacheService)?o:Object])],y),t.AuthHelperService=y}}]);