"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[33865],{33865:(e,o,n)=>{n.r(o),n.d(o,{CoreCourseDownloadModuleMainFileDirective:()=>c});var r=n(10467),i=n(44682),t=n(94247),l=n(33014),d=n(25572),u=n(79555),s=n(54438);let c=(()=>{var e;class CoreCourseDownloadModuleMainFileDirective{constructor(e){this.options={},this.element=e.nativeElement}ngOnInit(){var e=this;this.element.addEventListener("click",function(){var o=(0,r.A)((function*(o){if(!e.module&&!e.moduleId)return;o.preventDefault(),o.stopPropagation();const n=yield l.CoreLoadings.show(),r=e.courseId?Number(e.courseId):void 0;try{if(!e.module){const o=Number(e.moduleId);if(!o)return;e.module=yield i.CoreCourse.getModule(o,r)}const o=e.componentId?Number(e.componentId):e.module.id;yield t.CoreCourseHelper.downloadModuleAndOpenFile(e.module,null!=r?r:e.module.course,e.component,o,e.files,void 0,e.options)}catch(e){d.CoreAlerts.showError(e,{default:u.HT.instant("core.errordownloading")})}finally{n.dismiss()}}));return function(e){return o.apply(this,arguments)}}())}}return(e=CoreCourseDownloadModuleMainFileDirective).ɵfac=function CoreCourseDownloadModuleMainFileDirective_Factory(o){return new(o||e)(s.rXU(s.aKT))},e.ɵdir=s.FsC({type:e,selectors:[["","core-course-download-module-main-file",""]],inputs:{module:"module",moduleId:"moduleId",courseId:"courseId",component:"component",componentId:"componentId",files:"files",options:"options"},standalone:!0}),CoreCourseDownloadModuleMainFileDirective})()}}]);