"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[1100],{75781:(t,s,e)=>{e.d(s,{l:()=>h,v:()=>a});var i=e(80643),r=e(91702),n=e(19036);function h(t){const s=(0,i.path_split)(t),e=(0,i.separate_file_extension)(s.tail);return{directory:s.head,base:e.name,filename:s.tail}}function a(t,s){const e=(0,i.encode_path)(s);return(0,r.join)(n.appBasePath,t,"raw",e)}},31100:(t,s,e)=>{e.r(s),e.d(s,{Actions:()=>c});var i=e(34904),r=e(26616),n=e(91367),h=e(83838),a=e(80643);var _=e(75781),l=(t,s,e)=>new Promise(((i,r)=>{var n=t=>{try{a(e.next(t))}catch(t){r(t)}},h=t=>{try{a(e.throw(t))}catch(t){r(t)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(n,h);a((e=e.apply(t,s)).next())}));class c extends r.e{constructor(){super(...arguments),this._last_rst_hash=""}_init2(){this.is_public?this._init_value():(this._init_syncstring_value(),this._init_spellcheck(),this._init_rst2html())}_init_rst2html(){this.run_rst2html=(0,i.reuseInFlight)(this._run_rst2html.bind(this)),this._syncstring.on("save-to-disk",(0,i.reuseInFlight)((()=>l(this,null,(function*(){if(null==this._syncstring)return;const t=this._syncstring.hash_of_saved_version();this._last_rst_hash!=t&&(this._last_rst_hash=t,yield this.run_rst2html())}))))),this._syncstring.once("ready",this.run_rst2html.bind(this))}_run_rst2html(t){return l(this,null,(function*(){this.set_status("Running rst2html...");try{yield function(t,s,e){return i=this,r=function*(){return(0,h.GL)({command:"rst2html",args:[s,(0,a.aux_file)(s,"html")],project_id:t,err_on_exit:!0,aggregate:e})},new Promise(((t,s)=>{var e=t=>{try{h(r.next(t))}catch(t){s(t)}},n=t=>{try{h(r.throw(t))}catch(t){s(t)}},h=s=>s.done?t(s.value):Promise.resolve(s.value).then(e,n);h((r=r.apply(i,null)).next())}));var i,r}(this.project_id,this.path,t)}catch(t){this.set_error(t)}finally{this.set_status("")}this.set_reload("rst")}))}_raw_default_frame_tree(){return this.is_public?{type:"cm"}:{direction:"col",type:"node",first:{type:"cm"},second:{type:"rst"}}}reload(t,s){const e=this._get_frame_node(t);e&&("cm"===e.get("type")?this._run_rst2html():(s=s||(new Date).getTime(),this.set_reload("rst",s)))}print(t){const s=this._get_frame_node(t);if(!s)return;const e=s.get("type");if("cm"!==e)if("rst"===e)try{(0,n.kX)({src:(0,_.v)(this.project_id,(0,a.aux_file)(this.path,"html"))})}catch(t){this.set_error(t)}else this.set_error("printing of #{type} not implemented");else super.print(t)}}}}]);