"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[7883],{87883:(t,e,n)=>{n.r(e),n.d(e,{Actions:()=>h,CourseEditorActions:()=>h});var r=n(5010),o=n(25730);function c(t,e,n,r,o,c,s){try{var i=t[c](s),u=i.value}catch(t){return void n(t)}i.done?e(u):Promise.resolve(u).then(r,o)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}},i(t,e,n||t)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function a(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t,e){return f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},f(t,e)}var l=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}(l,t);var e,n,r=(e=l,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=u(e);if(n){var o=u(this).constructor;t=Reflect.construct(r,arguments,o)}else t=r.apply(this,arguments);return a(this,t)});function l(){var t;return s(this,l),(t=r.apply(this,arguments)).doctype="none",t}var h=l.prototype;return h._raw_default_frame_tree=function(){return{type:"course_students"}},h._init2=function(){this.init_course_actions_and_store(),this.init_changes_state()},h.close=function(){this.close_course_actions_and_store(),i(u(l.prototype),"close",this).call(this)},h.init_changes_state=function(){var t=this,e=this.course_actions.syncdb;e.on("has-uncommitted-changes",(function(e){return t.setState({has_uncommitted_changes:e})})),e.on("has-unsaved-changes",(function(e){t.setState({has_unsaved_changes:e})}))},h.init_course_actions_and_store=function(){this.course_actions=(0,o.LM)({redux:this.redux,path:this.path,project_id:this.project_id})},h.close_course_actions_and_store=function(){(0,o.ex)({redux:this.redux,path:this.path,project_id:this.project_id})},h.save=function(){var t,e=this;return(t=function(){var t;return function(t,e){var n,r,o,c,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=e.call(t,s)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}(this,(function(n){switch(n.label){case 0:if(null==e.course_actions||null==e.course_actions.syncdb||!e.course_actions.syncdb.has_unsaved_changes())return[2];n.label=1;case 1:return n.trys.push([1,3,4,5]),e.setState({is_saving:!0}),[4,e.course_actions.save()];case 2:return n.sent(),[3,5];case 3:return t=n.sent(),console.warn("save_to_disk",e.path,"ERROR",t),"closed"==e._state?[2]:(e.set_error("error saving file to disk -- ".concat(t)),[3,5]);case 4:return e.setState({is_saving:!1}),[7];case 5:return[2]}}))},function(){var e=this,n=arguments;return new Promise((function(r,o){var s=t.apply(e,n);function i(t){c(s,r,o,i,u,"next",t)}function u(t){c(s,r,o,i,u,"throw",t)}i(void 0)}))})()},h.exit_undo_mode=function(){this.course_actions.syncdb.exit_undo_mode()},h.undo=function(t){this.course_actions.syncdb.undo(),this.course_actions.syncdb.commit()},h.redo=function(t){this.course_actions.syncdb.redo(),this.course_actions.syncdb.commit()},l}(r.e)}}]);