UNPKG

@cocalc/static

Version:

CoCalc's static frontend Webpack-based build system and framework

1 lines 55.9 kB
"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[8247,872],{78470:(t,e,r)=>{r.d(e,{Z:()=>i});var n=r(75025),o=r.n(n)()((function(t){return t[1]}));o.push([t.id,".cocalc-history-diff-delete{background-color:#ffecec}.cocalc-history-diff-insert{background-color:#eaffea}.cocalc-history-diff-divide{border-bottom:1px solid gray}.cocalc-history-diff-gutter{width:12em}.cocalc-history-diff-number{color:#999;padding-left:10px;white-space:pre}",""]);const i=o},73902:(t,e,r)=>{r.r(e),r.d(e,{default:()=>s});var n=r(75701),o=r.n(n),i=r(78470);o()(i.Z,{insert:"head",singleton:!1});const s=i.Z.locals||{}},38247:(t,e,r)=>{r.r(e),r.d(e,{TimeTravel:()=>Ye});var n=r(60799),o=r(34408),i=r(50386),s=r(32295),c=r(19990),u=r(85460),a=r(33258),l=r(63505);function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(t,e){return!e||"object"!==y(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 d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}var y=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var v=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&&d(t,e)}(o,t);var e,r,n=(e=o,r=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,n=f(e);if(r){var o=f(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return h(this,t)});function o(){return p(this,o),n.apply(this,arguments)}var i=o.prototype;return i.render_body=function(){return l.createElement(a.w,{id:this.props.id,actions:this.props.actions,path:this.props.path,project_id:this.props.project_id,font_size:this.props.font_size,cursors:(0,u.fromJS)({}),editor_state:(0,u.fromJS)({}),read_only:!0,is_current:!0,is_public:!0,value:this.props.doc,misspelled_words:(0,u.fromJS)([]),resize:0,gutters:[],gutter_markers:(0,u.fromJS)({}),editor_settings:this.props.editor_settings})},i.render=function(){return l.createElement("div",{className:"smc-vfill",style:{overflowY:"auto"}},this.render_body())},o}(s.Component),_=r(20812),m=r(33638),b=r(11359),g=r(8407),w=r(42188),O=r(24620);function E(t,e,r){var n=function(t,e){var r=new O.StringCharMapping;return function(t,e){var r=[],n=[],o={},i=[],s=[],c=0,u=!0,a=!1,l=void 0;try{for(var p,f=t[Symbol.iterator]();!(u=(p=f.next()).done);u=!0){var h=p.value,d=h.start1,y=h.start2;d+=c,c+=h.length1-h.length2;var v=void 0,_=void 0,m=!0,b=!1,g=void 0;try{for(var w,O=h.diffs[Symbol.iterator]();!(m=(w=O.next()).done);m=!0){var E=w.value,j=!0,R=!1,x=void 0;try{for(var P,S=E[1][Symbol.iterator]();!(j=(P=S.next()).done);j=!0){var k=P.value;if(-1===E[0])v="-",_=["".concat(d+=1),""];else if(1===E[0])v="+",_=["","".concat(y+=1)];else{v=" ",y+=1;var C="".concat(d+=1,"-").concat(y);if(o[C])continue;_=["".concat(d),"".concat(y)],o[C]=!0}r.push(e[k]),s.push("".concat(_[0].padStart(6)," ").concat(_[1].padStart(6)," ").concat(v)),n.push(E[0])}}catch(t){R=!0,x=t}finally{try{j||null==S.return||S.return()}finally{if(R)throw x}}}}catch(t){b=!0,g=t}finally{try{m||null==O.return||O.return()}finally{if(b)throw g}}i.push(r.length-1)}}catch(t){a=!0,l=t}finally{try{u||null==f.return||f.return()}finally{if(a)throw l}}return{lines:r,type:n,gutter:s,chunk_boundaries:i}}((0,w.patch_make)(r.to_string(t.split("\n")),r.to_string(e.split("\n"))),r._to_string)}(e,r),o=n.lines,i=n.type,s=n.gutter,c=n.chunk_boundaries,u=o.join("\n");t.setValue(u),t.setOption("theme","default"),t.setOption("lineNumbers",!1),t.setOption("showTrailingSpace",!1),t.setOption("gutters",["cocalc-history-diff-gutter"]);for(var a=0;a<i.length;a++){switch(i[a]){case-1:t.addLineClass(a,"wrap","cocalc-history-diff-delete"),t.removeLineClass(a,"wrap","cocalc-history-diff-insert");break;case 1:t.addLineClass(a,"wrap","cocalc-history-diff-insert"),t.removeLineClass(a,"wrap","cocalc-history-diff-delete");break;case 0:t.removeLineClass(a,"wrap"),t.removeLineClass(a,"wrap")}var l=document.createElement("span");l.innerHTML=s[a],l.setAttribute("class","cocalc-history-diff-number"),t.setGutterMarker(a,"cocalc-history-diff-gutter",l)}var p=!0,f=!1,h=void 0;try{for(var d,y=c[Symbol.iterator]();!(p=(d=y.next()).done);p=!0){var v=d.value;t.addLineClass(v,"wrap","cocalc-history-diff-divide")}}catch(t){f=!0,h=t}finally{try{p||null==y.return||y.return()}finally{if(f)throw h}}}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}function x(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 P(t,e){return P=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},P(t,e)}r(73902);var S=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var k=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&&P(t,e)}(o,t);var e,r,n=(e=o,r=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,n=R(e);if(r){var o=R(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return x(this,t)});function o(){var t;return j(this,o),(t=n.apply(this,arguments)).textarea_ref=s.React.createRef(),t}var i=o.prototype;return i.init_codemirror=function(){var t=this,e=this.textarea_ref.current;if(null!=e){var r=(0,b.C)(this.props.use_json?"a.js":this.props.path,this.props.editor_settings);r.readOnly=!0,this.cm=m.fromTextArea(e,r),(0,g.L)(this.cm),E(this.cm,this.props.v0,this.props.v1),this.update=(0,_.debounce)((function(e,r){null!=t.cm&&E(t.cm,e,r)}),300)}},i.componentDidMount=function(){this.init_codemirror()},i.componentWillUnmount=function(){null!=this.cm&&($(this.cm.getWrapperElement()).remove(),delete this.cm)},i.UNSAFE_componentWillReceiveProps=function(t){var e;t.v0==this.props.v0&&t.v1==this.props.v1||this.update(t.v0,t.v1),null===(e=this.cm)||void 0===e||e.refresh()},i.render=function(){return s.React.createElement("div",{className:"smc-vfill",style:{fontSize:"".concat(this.props.font_size,"px"),overflow:"auto"}},s.React.createElement("textarea",{ref:this.textarea_ref,style:{display:"none"}}))},o}(s.Component),C=r(63505);function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function B(t,e){return!e||"object"!==A(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 N(t,e){return N=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},N(t,e)}var A=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var L=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&&N(t,e)}(o,t);var e,r,n=(e=o,r=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,n=z(e);if(r){var o=z(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return B(this,t)});function o(){return T(this,o),n.apply(this,arguments)}return o.prototype.render=function(){var t=this,e=this.props,r=e.version0,n=e.version1,o=e.max;return C.createElement(i.ButtonGroup,null,C.createElement(i.Button,{title:"First version",onClick:function(){return t.props.actions.step(t.props.id,-r)},disabled:null!=r&&r<=0},C.createElement(c.Icon,{name:"backward"})),C.createElement(i.Button,{title:"Previous version",onClick:function(){return t.props.actions.step(t.props.id,-1)},disabled:null!=r&&r<=0},C.createElement(c.Icon,{name:"step-backward"})),C.createElement(i.Button,{title:"Next version",onClick:function(){return t.props.actions.step(t.props.id,1)},disabled:null!=n&&n>=o},C.createElement(c.Icon,{name:"step-forward"})),C.createElement(i.Button,{title:"Most recent version",onClick:function(){return t.props.actions.step(t.props.id,o-n)},disabled:null!=n&&n>=o},C.createElement(c.Icon,{name:"forward"})))},o}(s.Component),I=r(63505);function M(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function D(t){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},D(t)}function U(t,e){return!e||"object"!==W(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 W=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var J=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)}(o,t);var e,r,n=(e=o,r=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,n=D(e);if(r){var o=D(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return U(this,t)});function o(){return M(this,o),n.apply(this,arguments)}var i=o.prototype;return i.handle_change=function(t){this.props.actions.set_version(this.props.id,parseInt(t.target.value))},i.render=function(){var t=this.props,e=t.version,r=t.max;return null==e?I.createElement("div",null):I.createElement("input",{style:{cursor:"pointer"},type:"range",min:0,max:r,value:e,onChange:this.handle_change.bind(this)})},o}(s.Component),Z=r(54498),q=r(63505);function H(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function V(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Y(){return Y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Y.apply(this,arguments)}function G(t){return G=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},G(t)}function X(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){V(t,e,r[e])}))}return t}function K(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}function Q(t,e){return!e||"object"!==et(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 tt(t,e){return tt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},tt(t,e)}var et=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var rt=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&&tt(t,e)}(o,t);var e,r,n=(e=o,r=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,n=G(e);if(r){var o=G(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Q(this,t)});function o(){return H(this,o),n.apply(this,arguments)}var i=o.prototype;return i.handle_change=function(t){if(null==t[0]||null==t[1])throw Error("invalid values");this.props.actions.set_versions(this.props.id,t[0],t[1])},i.render_thumb=function(t){var e=t.index,r=t.props,n=t.isDragged,o=0==e?this.props.version0:this.props.version1;if(null!=o){var i=this.props.versions.get(o);if(null!=i)return q.createElement("div",Y({},r,{style:K(X({},r.style),{opacity:.8,height:"42px",width:"90px",borderRadius:"4px",backgroundColor:"#FFF",display:"flex",justifyContent:"center",alignItems:"center",boxShadow:"0px 2px 6px #AAA"})}),q.createElement("div",{style:{position:"absolute",top:"-28px",color:"#fff",fontWeight:"bold",fontSize:"11px",overflowX:"hidden",fontFamily:"Arial,Helvetica Neue,Helvetica,sans-serif",padding:"4px",borderRadius:"4px",backgroundColor:"rgb(66, 139, 202)"}},q.createElement(c.TimeAgo,{date:i})),q.createElement("div",{style:{height:"16px",width:"5px",backgroundColor:n?"rgb(66, 139, 202)":"#CCC"}}))}},i.render_track=function(t){var e=t.props,r=t.children;return q.createElement("div",Y({},e,{style:K(X({},e.style),{height:"6px",width:"100%",backgroundColor:"#ccc"})}),r)},i.render=function(){return null==this.props.version0||null==this.props.version1||this.props.max<0||this.props.version0<0||this.props.version1>this.props.max?q.createElement("div",null):q.createElement("div",{style:{height:"72px",paddingTop:"48px",width:"90%",margin:"auto"}},q.createElement(Z.Range,{min:0,max:this.props.max,values:[this.props.version0,this.props.version1],onChange:this.handle_change.bind(this),renderThumb:this.render_thumb.bind(this),renderTrack:this.render_track.bind(this)}))},o}(s.Component),nt=r(63505);function ot(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}function st(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&&ut(t,e)}function ct(t,e){return!e||"object"!==at(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 ut(t,e){return ut=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ut(t,e)}var at=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function lt(t){var e=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}}();return function(){var r,n=it(t);if(e){var o=it(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ct(this,r)}}var pt=function(t){st(r,t);var e=lt(r);function r(){return ot(this,r),e.apply(this,arguments)}var n=r.prototype;return n.render_time=function(){return nt.createElement("span",{style:{fontWeight:"bold",fontSize:"12pt",color:"#666",whiteSpace:"nowrap"}},nt.createElement(c.TimeAgo,{date:this.props.date}))},n.render_number=function(){return nt.createElement("span",{style:{whiteSpace:"nowrap"}},"revision ",this.props.number," (of ",this.props.max,")")},n.render=function(){return 0==this.props.max?nt.createElement("span",null):nt.createElement("span",null,this.render_time(),", ",this.render_number())},r}(s.Component),ft=function(t){st(r,t);var e=lt(r);function r(){return ot(this,r),e.apply(this,arguments)}return r.prototype.render=function(){return 0==this.props.max?nt.createElement("span",null):nt.createElement("span",{style:{whiteSpace:"nowrap"}},"Versions ",this.props.version0+1," to ",this.props.version1+1," (of"," ",this.props.max,")")},r}(s.Component),ht=r(63505);function dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yt(t){return yt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},yt(t)}function vt(t,e){return!e||"object"!==mt(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 _t(t,e){return _t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_t(t,e)}var mt=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var bt=r(872).User,gt=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&&_t(t,e)}(o,t);var e,r,n=(e=o,r=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,n=yt(e);if(r){var o=yt(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return vt(this,t)});function o(){return dt(this,o),n.apply(this,arguments)}var i=o.prototype;return i.render_user=function(t){return ht.createElement(bt,{account_id:t,user_map:this.props.user_map,key:t})},i.render_project=function(){return ht.createElement("span",{title:"File changed on disk or by the project",key:"project"},"The Project")},i.render_unknown=function(){return ht.createElement("span",{title:"You are no longer a collaborator with this user",key:"unknown"},"Unknown User")},i.render_author=function(t){return null!=this.props.user_map&&this.props.user_map.has(t)?this.render_user(t):t==this.props.actions.project_id?this.render_project():this.render_unknown()},i.render_content=function(){if(null==this.props.user_map)return ht.createElement(c.Loading,null);var t=[],e=!0,r=!1,n=void 0;try{for(var o,i=this.props.actions.get_account_ids(this.props.version0,this.props.version1)[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var s=o.value;t.push(this.render_author(s))}}catch(t){r=!0,n=t}finally{try{e||null==i.return||i.return()}finally{if(r)throw n}}return 0==t.length?this.render_unknown():(0,c.r_join)(t)},i.render=function(){return ht.createElement("span",null,this.render_content())},o.reduxProps=function(){return{users:{user_map:s.rtypes.immutable.Map}}},o}(s.Component),wt=(0,s.rclass)(gt),Ot=r(63505);function Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},jt(t)}function Rt(t,e){return!e||"object"!==Pt(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 xt(t,e){return xt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},xt(t,e)}var Pt=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var St=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&&xt(t,e)}(o,t);var e,r,n=(e=o,r=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,n=jt(e);if(r){var o=jt(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Rt(this,t)});function o(){return Et(this,o),n.apply(this,arguments)}return o.prototype.render=function(){var t=this;return Ot.createElement(i.Button,{onClick:function(){return t.props.actions.load_full_history()},title:"Load the complete edit history for this file."},Ot.createElement(c.Icon,{name:"file-archive"})," Load All")},o}(s.Component),kt=r(63505);function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tt(t){return Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Tt(t)}function zt(t,e){return!e||"object"!==Nt(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 Bt(t,e){return Bt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Bt(t,e)}var Nt=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var At=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&&Bt(t,e)}(o,t);var e,r,n=(e=o,r=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,n=Tt(e);if(r){var o=Tt(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return zt(this,t)});function o(){return Ct(this,o),n.apply(this,arguments)}return o.prototype.render=function(){var t=this;return kt.createElement(i.Button,{onClick:function(){return t.props.actions.open_file()},title:"Open the file whose history you are viewing"},kt.createElement(c.Icon,{name:"file-code"})," Open")},o}(s.Component),Lt=r(63505);function It(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(t){return Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Mt(t)}function Dt(t,e){return!e||"object"!==Ft(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 Ut(t,e){return Ut=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ut(t,e)}var Ft=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var Wt=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&&Ut(t,e)}(o,t);var e,r,n=(e=o,r=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,n=Mt(e);if(r){var o=Mt(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Dt(this,t)});function o(){return It(this,o),n.apply(this,arguments)}return o.prototype.render=function(){var t=this;return Lt.createElement(i.Button,{title:"Revert file to the displayed version (this makes a new version, so nothing is lost)",onClick:function(){null!=t.props.version&&t.props.actions.revert(t.props.version)},disabled:null==this.props.version},Lt.createElement(c.Icon,{name:"undo"})," Revert")},o}(s.Component),Jt=r(63505);function Zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $t(t){return $t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$t(t)}function qt(t,e){return!e||"object"!==Vt(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 Ht(t,e){return Ht=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ht(t,e)}var Vt=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var Yt=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&&Ht(t,e)}(s,t);var e,r,i=(e=s,r=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,n=$t(e);if(r){var o=$t(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return qt(this,t)});function s(){return Zt(this,s),i.apply(this,arguments)}var c=s.prototype;return c.toggle=function(){this.props.actions.set_changes_mode(this.props.id,!this.props.changes_mode)},c.render=function(){return Jt.createElement(n.Z,{placement:"top",title:"Toggle whether or not to show the changes from one point in time to another",mouseEnterDelay:1},Jt.createElement(o.Z,{disabled:this.props.disabled,onChange:this.toggle.bind(this),checked:!this.props.disabled&&this.props.changes_mode},"Changes"))},s}(s.Component),Gt=r(63505);function Xt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kt(t){return Kt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Kt(t)}function Qt(t,e){return!e||"object"!==ee(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 te(t,e){return te=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},te(t,e)}var ee=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var re=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&&te(t,e)}(o,t);var e,r,n=(e=o,r=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,n=Kt(e);if(r){var o=Kt(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Qt(this,t)});function o(){return Xt(this,o),n.apply(this,arguments)}return o.prototype.render=function(){var t=this;return Gt.createElement(i.Button,{onClick:function(){return t.props.actions.open_snapshots()},title:"Open the filesystem snapshots of this project, which may also be helpful in recovering past versions."},Gt.createElement(c.Icon,{name:"life-ring"})," Backups")},o}(s.Component),ne=r(63505);function oe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ie(t){return ie=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ie(t)}function se(t,e){return!e||"object"!==ue(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 ce(t,e){return ce=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ce(t,e)}var ue=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var ae=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&&ce(t,e)}(o,t);var e,r,n=(e=o,r=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,n=ie(e);if(r){var o=ie(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return se(this,t)});function o(){return oe(this,o),n.apply(this,arguments)}return o.prototype.render=function(){var t=this;return ne.createElement(i.Button,{onClick:function(){return t.props.actions.export()},title:"Export information about edit history to a JSON file"},ne.createElement(c.Icon,{name:"file-export"})," Export")},o}(s.Component),le=r(63510),pe=r.n(le),fe=r(47874);function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var de={fontSize:"12pt",color:"#666",padding:"5px 15px",borderBottom:"1px solid lightgrey"},ye=function(t){var e,r,n=t.syncdb,o=t.version,i=t.font_size,a=(e=(0,s.useState)(!1),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,c=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(c)throw o}}return i}}(e,r)||function(t,e){if(t){if("string"==typeof t)return he(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?he(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=a[0],p=a[1],f=n.version(o);return s.React.createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflowY:"hidden"}},s.React.createElement("div",{onClick:function(){return p(!l)},style:de},s.React.createElement(c.Icon,{name:l?"check-square-o":"square-o"})," Show done tasks"),null==f?s.React.createElement("span",null,"Unknown version"):function(t){var e=(0,u.Map)(),r=[];t.get().forEach((function(t){var n=t.get("task_id");e=e.set(n,t),!l&&t.get("done")||t.get("deleted")||r.push([t.get("last_edited"),n])})),r.sort((function(t,e){return-(0,O.cmp)(t[0],e[0])}));var o=(0,u.fromJS)(r.map((function(t){return t[1]})));return s.React.createElement(fe.a,{path:n.get_path(),project_id:n.get_project_id(),tasks:e,visible:o,read_only:!0,font_size:i})}(f))},ve=r(99815);function _e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},me(t)}function be(t,e){return!e||"object"!==we(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 ge(t,e){return ge=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ge(t,e)}var we=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var Oe=r(54177).codemirror_editor,Ee=r(56677).SynchronizedWorksheet,je=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&&ge(t,e)}(o,t);var e,r,n=(e=o,r=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,n=me(e);if(r){var o=me(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return be(this,t)});function o(){var t;return _e(this,o),(t=n.apply(this,arguments)).div_ref=s.React.createRef(),t}var i=o.prototype;return i.init_sagews=function(){var t=this,e=this.div_ref.current;if(null!=e){this.view_doc=Oe(this.props.project_id,this.props.path,{mode:"sagews",read_only:!0}),this.cm=this.view_doc.codemirror,$(this.view_doc.element).appendTo($(e)),$(this.view_doc.codemirror1.getWrapperElement()).remove(),this.worksheet=new Ee(this.view_doc,{allow_javascript_eval:!1,static_viewer:!0});var r=function(e){null!=t.view_doc&&(t.cm.setValueNoJump(e),t.worksheet.process_sage_updates())};r(this.props.content),this.update=(0,_.debounce)(r,100)}},i.componentDidMount=function(){this.init_sagews()},i.componentWillUnmount=function(){null!=this.view_doc&&(this.view_doc.remove(),delete this.view_doc,delete this.worksheet)},i.UNSAFE_componentWillReceiveProps=function(t){t.content!=this.props.content&&this.update(t.content),t.font_size!=this.props.font_size&&this.view_doc.set_font_size(this.cm,t.font_size),this.cm.refresh()},i.render=function(){return s.React.createElement("div",{className:"smc-vfill",style:{overflow:"auto"}},s.React.createElement("div",{ref:this.div_ref}))},o}(s.Component);function Re(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xe(t){return xe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},xe(t)}function Pe(t,e){return!e||"object"!==ke(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 Se(t,e){return Se=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Se(t,e)}var ke=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var Ce=r(54177).codemirror_editor,Te=r(56677).SynchronizedWorksheet,ze=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&&Se(t,e)}(o,t);var e,r,n=(e=o,r=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,n=xe(e);if(r){var o=xe(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Pe(this,t)});function o(){var t;return Re(this,o),(t=n.apply(this,arguments)).div_ref=s.React.createRef(),t}var i=o.prototype;return i.init_sagews=function(){var t=this,e=this.div_ref.current;if(null!=e){this.view_doc=Ce(this.props.project_id,this.props.path,{mode:"sagews",read_only:!0}),this.cm=this.view_doc.codemirror,this.view_doc.set_font_size(this.cm,this.props.font_size),$(this.view_doc.element).appendTo($(e)),$(this.view_doc.codemirror1.getWrapperElement()).remove(),this.worksheet=new Te(this.view_doc,{allow_javascript_eval:!1,static_viewer:!0});var r=function(e,r){null!=t.view_doc&&(E(t.cm,e,r),t.worksheet.process_sage_updates())};r(this.props.v0,this.props.v1),this.update=(0,_.debounce)(r,300)}},i.componentDidMount=function(){this.init_sagews()},i.componentWillUnmount=function(){null!=this.view_doc&&(this.view_doc.remove(),delete this.view_doc,delete this.worksheet)},i.UNSAFE_componentWillReceiveProps=function(t){t.v0==this.props.v0&&t.v1==this.props.v1||this.update(t.v0,t.v1),t.font_size!=this.props.font_size&&this.view_doc.set_font_size(this.cm,t.font_size),this.cm.refresh()},i.render=function(){return s.React.createElement("div",{className:"smc-vfill",style:{overflow:"auto"}},s.React.createElement("div",{ref:this.div_ref}))},o}(s.Component),Be=r(64677),Ne=r(50330),Ae=r(54822),Le=r(572),Ie=r(63505),Me=r(63505);function De(t){var e,r,n=t.syncdb,o=t.version,i=t.font_size,s=(0,Ae.s)(),c=s.id,a=s.isFocused,l=s.desc,p=s.actions,f=(0,Ie.useRef)(null),h=n.version(o).get(),d=(0,u.Map)(),y=!0,v=!1,_=void 0;try{for(var m,b=h[Symbol.iterator]();!(y=(m=b.next()).done);y=!0){var g=m.value;d=d.set(g.get("id"),g)}}catch(t){v=!0,_=t}finally{try{y||null==b.return||b.return()}finally{if(v)throw _}}(0,Ie.useEffect)((function(){var t=1;d.forEach((function(e){var r,n;(null!==(r=e.get("page"))&&void 0!==r?r:1)>t&&(t=null!==(n=e.get("page"))&&void 0!==n?n:1)})),(null==l.get("pages")||l.get("pages")<t)&&p.setPages(c,t),null==l.get("page")&&p.setPage(c,1)}),[d]);var w,O,E=(0,Ie.useMemo)((function(){var t,e=null!==(t=l.get("page"))&&void 0!==t?t:1,r=[];return d.forEach((function(t){var n;(null!==(n=t.get("page"))&&void 0!==n?n:1)==e&&r.push(t.toJS())})),r}),[d,null!==(r=l.get("page"))&&void 0!==r?r:1]),j=null!==(w=l.get("selectedTool"))&&void 0!==w?w:"hand";return Me.createElement("div",{className:"smc-vfill",ref:f,style:{position:"relative"}},a&&Me.createElement(Me.Fragment,null,Me.createElement(Le.ZP,{selectedTool:j,readOnly:!0}),Me.createElement(Ne.Z,{fontSize:i,elements:E,whiteboardDivRef:f})),Me.createElement(Be.Z,{elementsMap:d,elements:E,font_size:i,margin:50,readOnly:!0,selectedTool:j,selection:"select"==j?new Set(null!==(O=null===(e=l.get("selection"))||void 0===e?void 0:e.toJS())&&void 0!==O?O:[]):void 0}))}var Ue=r(85755),Fe=r(63505);function We(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Je(t){return Je=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Je(t)}function Ze(t,e){return!e||"object"!==qe(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 $e(t,e){return $e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},$e(t,e)}var qe=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var He=new Set(["tasks","ipynb","sagews","board","md"]),Ve=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&&$e(t,e)}(a,t);var e,r,u=(e=a,r=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,n=Je(e);if(r){var o=Je(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Ze(this,t)});function a(){return We(this,a),u.apply(this,arguments)}var l=a.prototype;return l.get_version=function(){if(null!=this.props.desc&&null!=this.props.versions){var t=this.props.desc.get("version"),e=this.props.versions.get(t);return null!=e?e:this.props.versions.get(-1)}},l.render_version=function(){if(null!=this.props.desc&&null!=this.props.versions){if(this.props.desc.get("changes_mode")){var t=this.props.desc.get("version0"),e=this.props.desc.get("version1");return Fe.createElement(ft,{version0:t,version1:e,max:this.props.versions.size})}var r=this.get_version(),n=this.props.desc.get("version");if(null!=r&&null!=n)return Fe.createElement(pt,{date:r,number:n+1,max:this.props.versions.size})}},l.get_doc=function(t){if(null==t)t=this.get_version();else if("number"==typeof t){if(null==this.props.versions)return;t=this.props.versions.get(t)}if(null!=t)return this.props.actions.get_doc(t)},l.render_document=function(){if(null!=this.props.docpath&&null!=this.props.docext&&null!=this.props.desc&&!this.props.desc.get("changes_mode")){var t=this.get_version();if(null!=t){var e=this.props.actions.syncdoc;if(null!=e){if(this.props.desc.get("text_mode"))return this.render_document_codemirror();switch(this.props.docext){case"tasks":return this.render_document_tasks(e,t);case"ipynb":return this.render_document_jupyter_notebook(e,t);case"sagews":return this.render_document_sagews();case"md":var r,n;return Fe.createElement("div",{style:{overflow:"auto",padding:"50px 70px"}},Fe.createElement(Ue.Z,{value:null!==(n=null===(r=this.get_doc())||void 0===r?void 0:r.to_str())&&void 0!==n?n:"Loading..."}));case"board":return Fe.createElement(De,{syncdb:e,version:t,font_size:this.props.font_size});default:return this.render_document_codemirror()}}}}},l.render_document_tasks=function(t,e){return Fe.createElement(ye,{font_size:this.props.font_size,syncdb:t,version:e})},l.render_document_jupyter_notebook=function(t,e){return Fe.createElement(ve.HistoryViewer,{font_size:this.props.font_size,syncdb:t,version:e})},l.render_document_sagews=function(){if(null!=this.props.docpath&&null!=this.props.project_id){var t=this.get_doc();if(null!=t)return Fe.createElement(je,{content:t.to_str(),path:this.props.docpath,project_id:this.props.project_id,font_size:this.props.font_size,editor_settings:this.props.editor_settings})}},l.render_document_codemirror=function(){if(null!=this.props.docpath){var t=this.get_doc();if(null!=t)return Fe.createElement(v,{actions:this.props.actions,id:this.props.id,doc:t.to_str(),path:null==t.value?"a.js":this.props.docpath,project_id:this.props.project_id,font_size:this.props.font_size,editor_settings:this.props.editor_settings})}},l.get_diff_values=function(){if(null!=this.props.docpath&&null!=this.props.desc&&null!=this.props.versions&&this.props.desc.get("changes_mode")){if("ipynb"==this.props.docext){var t=this.props.actions.syncdoc;if(null==t)return;var e=this.props.versions.get(this.props.desc.get("version0"));if(null==e)return;var r=this.props.versions.get(this.props.desc.get("version1"));if(null==r)return;return{v0:pe()((0,ve.to_ipynb)(t,e),{space:1}),v1:pe()((0,ve.to_ipynb)(t,r),{space:1}),use_json:!0}}var n=this.get_doc(this.props.desc.get("version0"));if(null!=n){var o=n.to_str(),i=null==n.value,s=this.get_doc(this.props.desc.get("version1"));if(null!=s)return{v0:o,v1:s.to_str(),use_json:i}}}},l.render_diff=function(){if(null!=this.props.docpath&&null!=this.props.desc&&1==this.props.desc.get("changes_mode")){var t=this.get_diff_values();if(null==t)return this.render_loading();var e=t.v0,r=t.v1,n=t.use_json;return"sagews"==this.props.docext?Fe.createElement(ze,{v0:e,v1:r,path:this.props.docpath,project_id:this.props.project_id,font_size:this.props.font_size,editor_settings:this.props.editor_settings}):Fe.createElement(k,{v0:e,v1:r,path:this.props.docpath,font_size:this.props.font_size,editor_settings:this.props.editor_settings,use_json:n})}},l.render_navigation_buttons=function(){var t,e;if(null!=this.props.desc&&null!=this.props.versions&&(this.props.desc.get("changes_mode")?(t=this.props.desc.get("version0"),e=this.props.desc.get("version1")):t=e=this.props.desc.get("version"),null!=t&&null!=e))return Fe.createElement(L,{id:this.props.id,actions:this.props.actions,version0:t,version1:e,max:this.props.versions.size-1})},l.render_navigation_slider=function(){if(null!=this.props.desc&&null!=this.props.versions&&!this.props.desc.get("changes_mode"))return Fe.createElement(J,{id:this.props.id,actions:this.props.actions,version:this.props.desc.get("version"),max:this.props.versions.size-1})},l.render_range_slider=function(){if(null!=this.props.desc&&null!=this.props.versions&&this.props.desc.get("changes_mode"))return Fe.createElement(rt,{id:this.props.id,actions:this.props.actions,max:this.props.versions.size-1,versions:this.props.versions,version0:this.props.desc.get("version0"),version1:this.props.desc.get("version1")})},l.render_author=function(){var t,e;if(null!=this.get_version()&&null!=this.props.desc&&(this.props.desc.get("changes_mode")?(t=this.props.desc.get("version0"),e=this.props.desc.get("version1")):t=e=this.props.desc.get("version"),null!=t&&null!=e))return Fe.createElement(wt,{actions:this.props.actions,version0:t,version1:e})},l.render_load_full_history=function(){if(!this.props.has_full_history)return Fe.createElement(St,{actions:this.props.actions})},l.render_open_file=function(){if(!this.props.is_subframe)return Fe.createElement(At,{actions:this.props.actions})},l.render_open_snapshots=function(){if(!this.props.is_subframe)return Fe.createElement(re,{actions:this.props.actions})},l.render_revert_file=function(){if(null!=this.props.desc&&!this.props.desc.get("changes_mode"))return Fe.createElement(Wt,{actions:this.props.actions,version:this.get_version()})},l.render_changes_mode=function(){if(null!=this.props.versions)return Fe.createElement(Yt,{id:this.props.id,actions:this.props.actions,disabled:this.props.versions.size<=1,changes_mode:null!=this.props.desc&&this.props.desc.get("changes_mode",!1)})},l.render_export=function(){if("kiosk"!=s.redux.getStore("page").get("fullscreen"))return Fe.createElement(ae,{actions:this.props.actions})},l.render_controls=function(){var t,e=this;return Fe.createElement("div",{style:{background:this.props.is_current?"#fafafa":"#ddd",borderBottom:"1px solid #ccc",marginLeft:"5px"}},this.render_changes_mode(),He.has(null!==(t=this.props.docext)&&void 0!==t?t:"")&&Fe.createElement(n.Z,{title:"Display underlying file as text"},Fe.createElement(o.Z,{defaultChecked:!!this.props.desc.get("text_mode"),onChange:function(t){return e.props.actions.setTextMode(e.props.id,t.target.checked)}},"Text")),this.render_navigation_buttons(),Fe.createElement(i.ButtonGroup,{style:{margin:"0 10px"}},this.render_load_full_history(),this.render_open_file(),this.render_revert_file(),this.render_open_snapshots(),this.render_export()),this.render_version(),", ",this.render_author())},l.render_time_select=function(){return Fe.createElement(Fe.Fragment,null,this.render_navigation_slider(),this.render_range_slider())},l.render_loading=function(){return Fe.createElement(c.Loading,{theme:"medium"})},l.render_view=function(){return Fe.createElement(Fe.Fragment,null,this.render_document(),this.render_diff())},l.render=function(){return this.props.loading?this.render_loading():Fe.createElement("div",{className:"smc-vfill"},this.render_controls(),this.render_time_select(),this.render_view())},a.reduxProps=function(t){var e,r,n;return e={},r=t.name,n={versions:s.rtypes.immutable.List,loading:s.rtypes.bool,has_full_history:s.rtypes.bool,docpath:s.rtypes.string,docext:s.rtypes.string},r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e},a}(s.Component),Ye=(0,s.rclass)(Ve)},99815:(t,e,r)=>{r.r(e),r.d(e,{HistoryViewer:()=>v,jupyter_history_viewer_jquery_shim:()=>m,to_ipynb:()=>_});var n=r(85460),o=r(32295),i=r(24620),s=r(14471),c=r(38403),u=r(19428),a=r(19990),l=r(60005),p=r(92990),f=r(63510),h=r.n(f),d=r(63505);function y(t,e){var r=(0,n.Map)(),o=t.version(e).get({type:"cell"});null!=o&&o.forEach((function(t){return r=r.set(t.get("id"),t)}));var i=s.kr(r);return{cells:r,cell_list:i}}var v=function(t){var e,r,s=t.syncdb,p=t.version,f=t.font_size,h=null!==(r=(0,o.useTypedRedux)("account","font_size"))&&void 0!==r?r:14,v=s.get_project_id(),_=(0,i.path_split)(s.get_path()).head,m=y(s,p),b=m.cells,g=m.cell_list,w=(0,n.fromJS)({markdown:void 0,options:(0,u.C)()}),O=null===(e=s.version(p).get_one({type:"settings"}))||void 0===e?void 0:e.get("kernel_error");return d.createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflowY:"hidden"}},O&&d.createElement(a.ErrorDisplay,{bsStyle:"warning",error:O,style:l.m}),d.createElement(c.R,{cell_list:g,cells:b,font_size:null!=f?f:h,mode:"escape",cm_options:w,project_id:v,directory:_,trust:!1}))};function _(t,e){return(0,p.m)(y(t,e))}function m(t){var e=$("<div class='smc-vfill'></div>");return{element:e,show:function(){return e.show()},hide:function(){return e.hide()},remove:function(){return o.ReactDOM.unmountComponentAtNode(e[0])},set_version:function(r){return o.ReactDOM.render(d.createElement(o.Redux,null,d.createElement(v,{syncdb:t,version:r})),e[0])},to_str:function(e){var r=_(t,e);return h()(r,{space:1})}}}},14471:(t,e,r)=>{r.d(e,{A9:()=>i,Yw:()=>c,kr:()=>s,tg:()=>u,wo:()=>a});var n=r(85460),o=r(24620);function i(t,e,r){var n,o,i;null!=t&&null!=e&&t>e&&(t=(i=[e,t])[0],e=i[1]),null==t?null==e?(o=0,n=1):(o=e-r,n=1):null==e?(o=t+1,n=1):o=t+(n=(e-t)/(r+1));for(var s=[],c=0,u=r,a=0<=u;a?c<u:c>u;a?c++:c--)s.push(o),o+=n;return s}function s(t){return null==t?(0,n.List)([]):t.map((function(t,e){return{id:e,pos:t.get("pos",-1)}})).filter((function(t){return null!=t.id})).sort((0,o.field_cmp)("pos")).map((function(t){return t.id})).toList()}function c(t){if(null!=t){var e={},r=!0;if(t.forEach((function(t){var n=t