"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[7817],{7817:(t,e,n)=>{n.r(e),n.d(e,{Actions:()=>p,TerminalActions:()=>p});var r=n(95788),o=n(5010),c=n(97891);function i(t,e,n,r,o,c,i){try{var a=t[c](i),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,o)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function l(t,e){return!e||"object"!==s(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 s=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var p=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)}(s,t);var e,n,o=(e=s,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 l(this,t)});function s(){var t;return a(this,s),(t=o.apply(this,arguments)).doctype="none",t}var p=s.prototype;return p._init2=function(){},p._raw_default_frame_tree=function(){return{type:"terminal"}},p.get_terminal=function(t){return this.terminals.get(t)},p.run_command=function(t,e){var n=e.run,r=void 0===n||n,o=e.cleanup,c=void 0===o||o,i=e.userarg,a=void 0!==i&&i,u=e.special,l=this._get_most_recent_active_frame_id_of_type("terminal");if(null!=l){this.unset_frame_full(),this.focus(l),this.set_active_id(l);var f=this.terminals.get(l);if(null==f)return;switch(u){case"up":f.conn_write("[A");break;case"down":f.conn_write("[B");break;case"tab":f.conn_write("\t");break;case"ctrl-c":f.conn_write("");break;default:var s=r&&!a?"\n":a?"":" ",p=c?"":"",h=a?" ''[D":"";f.conn_write("".concat(p).concat(t).concat(h).concat(s))}}},p.help=function(){(0,c.open_new_tab)("https://doc.cocalc.com/terminal.html")},p.guide=function(){var t,e=this;return(t=function(){var t;return function(t,e){var n,r,o,c,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function a(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i;)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 i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}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,a])}}}(this,(function(n){switch(n.label){case 0:return t=e.show_focused_frame_of_type("commands_guide","col",!1,3/4),[4,(0,r.delay)(0)];case 1:return n.sent(),"closed"===e._state||e.set_active_id(t,!0),[2]}}))},function(){var e=this,n=arguments;return new Promise((function(r,o){var c=t.apply(e,n);function a(t){i(c,r,o,a,u,"next",t)}function u(t){i(c,r,o,a,u,"throw",t)}a(void 0)}))})()},s}(o.e)}}]);