"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[1479],{69024:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var r=n(67557),o=n(21716),a=n(53059),i=n(83798),l="".concat(900,"px"),c=n(35115),s=n(83444),u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function f(e){var t=e.id,n=e.actions,f=e.font_size,d=e.value,p=e.editor_state,v=(0,s.useFileContext)(),h=i.React.useRef(null);function _(e){return t=this,n=void 0,a=function(){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return e?[4,(0,o.delay)(e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return void 0!==(t=p.get("scroll"))&&$(i.ReactDOM.findDOMNode(h.current)).scrollTop(t),[2]}}))},new((r=Promise)||(r=Promise))((function(e,o){function i(e){try{c(a.next(e))}catch(e){o(e)}}function l(e){try{c(a.throw(e))}catch(e){o(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(i,l)}c((a=a.apply(t,n||[])).next())}));var t,n,r,a}return i.React.useEffect((function(){var e,t;try{for(var n=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}([0,200,500]),r=n.next();!r.done;r=n.next())_(r.value)}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}}),[]),(0,r.jsx)("div",u({style:{overflowY:"auto",width:"100%",fontSize:"".concat(f,"px")},ref:h,onScroll:(0,a.throttle)((function(){return function(){var e=i.ReactDOM.findDOMNode(h.current);if(null!=e){var r=$(e).scrollTop();n.save_editor_state(t,{scroll:r})}}()}),250),className:"cocalc-editor-div"},{children:(0,r.jsx)("div",u({style:{maxWidth:l,margin:"10px auto",padding:"0 10px"}},{children:(0,r.jsx)(s.FileContext.Provider,u({value:u(u({},v),{noSanitize:!1})},{children:(0,r.jsx)(c.Z,{value:null!=d?d:""})}))}))}))}},18737:(e,t,n)=>{n.d(t,{l:()=>i,v:()=>l});var r=n(26131),o=n(89368),a=n(62799);function i(e){var t=(0,r.path_split)(e),n=(0,r.separate_file_extension)(t.tail);return{directory:t.head,base:n.name,filename:t.tail}}function l(e,t){var n=(0,r.encode_path)(t);return(0,o.join)(a.appBasePath,e,"raw",n)}},41919:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Editor=void 0;var o=n(73317),a=n(26131),i=r(n(69024)),l=n(33026),c=n(37685),s=n(4930),u=n(43774),f=n(44990),d={cm:{short:"Code",name:"Source Code",icon:"code",component:c.CodemirrorEditor,buttons:(0,a.set)(["print","decrease_font_size","increase_font_size","save","time_travel","replace","find","goto_line","cut","paste","copy","undo","redo","format"])},iframe:{short:"HTML",name:"HTML IFrame",icon:"compass",component:l.IFrameHTML,buttons:(0,a.set)(["print","save","time_travel","reload","decrease_font_size","increase_font_size","set_zoom"])},preview:{short:"Preview",name:"Sanitized Preview",icon:"html5",component:i.default,buttons:(0,a.set)(["print","decrease_font_size","increase_font_size","set_zoom","save","time_travel","reload"])},terminal:u.terminal,settings:s.SETTINGS_SPEC,time_travel:f.time_travel};t.Editor=(0,o.createEditor)({format_bar:!0,editor_spec:d,display_name:"HTMLEditor"})}}]);