(window.webpackJsonp=window.webpackJsonp||[]).push([[125],{"6xWC":function(nt,ue,l){"use strict";l.r(ue);var C=l("tJVT"),c=l("q1tI"),S=l.n(c);function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t=0)continue;n[o]=e[o]}return n}function se(e,t){if(e==null)return{};var n=He(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function Be(e,t){return Oe(e)||ze(e,t)||z(e,t)||Ee()}function Oe(e){if(Array.isArray(e))return e}function ze(e,t){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var u=e[Symbol.iterator](),m;!(r=(m=u.next()).done)&&!(n.push(m.value),t&&n.length===t);r=!0);}catch(g){o=!0,i=g}finally{try{!r&&u.return!=null&&u.return()}finally{if(o)throw i}}return n}function z(e,t){if(!e)return;if(typeof e=="string")return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return le(e,t)}function le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?e.apply(this,o):function(){for(var u=arguments.length,m=new Array(u),g=0;g1&&arguments[1]!==void 0?arguments[1]:{};B.initial(e),B.handler(t);var n={current:e},r=y(ye)(n,t),o=y(je)(n),i=y(B.changes)(e),u=y(_e)(n);function m(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(T){return T};return B.selector(V),V(n.current)}function g(V){L(r,o,i,u)(V)}return[m,g]}function _e(e,t){return s(t)?t(e.current):t}function je(e,t){return e.current=I(I({},e.current),t),t}function ye(e,t,n){return s(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var K={create:re},W=K,U={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/min/vs"}},X=U;function Q(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i=e.length?e.apply(this,o):function(){for(var u=arguments.length,m=new Array(u),g=0;g2&&arguments[2]!==void 0?arguments[2]:!0,r=Object(c.useRef)(!0);Object(c.useEffect)(r.current||!n?function(){r.current=!1}:e,t)}var x=Nt;function ie(){}function Ze(e,t,n,r){return Rt(e,r)||Ut(e,t,n,r)}function Rt(e,t){return e.editor.getModel($e(e,t))}function Ut(e,t,n,r){return e.editor.createModel(t,n,r&&$e(e,r))}function $e(e,t){return e.Uri.parse(t)}function xt(e){return e===void 0}function Pe(e){var t=e.original,n=e.modified,r=e.language,o=e.originalLanguage,i=e.modifiedLanguage,u=e.originalModelPath,m=e.modifiedModelPath,g=e.keepCurrentOriginalModel,V=e.keepCurrentModifiedModel,T=e.theme,$=e.loading,A=e.options,Se=e.height,Le=e.width,Ne=e.className,Re=e.wrapperClassName,Ue=e.beforeMount,xe=e.onMount,Ie=Object(c.useState)(!1),q=Object(C.a)(Ie,2),_=q[0],ke=q[1],pe=Object(c.useState)(!0),h=Object(C.a)(pe,2),ge=h[0],We=h[1],w=Object(c.useRef)(null),M=Object(c.useRef)(null),he=Object(c.useRef)(null),j=Object(c.useRef)(xe),d=Object(c.useRef)(Ue);De(function(){var p=ae.init();return p.then(function(E){return(M.current=E)&&We(!1)}).catch(function(E){return(E==null?void 0:E.type)!=="cancelation"&&console.error("Monaco initialization: error:",E)}),function(){return w.current?Ve():p.cancel()}}),x(function(){var p=w.current.getModifiedEditor();p.getOption(M.current.editor.EditorOption.readOnly)?p.setValue(n):n!==p.getValue()&&(p.executeEdits("",[{range:p.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),p.pushUndoStop())},[n],_),x(function(){w.current.getModel().original.setValue(t)},[t],_),x(function(){var p=w.current.getModel(),E=p.original,G=p.modified;M.current.editor.setModelLanguage(E,o||r),M.current.editor.setModelLanguage(G,i||r)},[r,o,i],_),x(function(){M.current.editor.setTheme(T)},[T],_),x(function(){w.current.updateOptions(A)},[A],_);var ce=Object(c.useCallback)(function(){d.current(M.current);var p=M.current.editor.createModel(t,o||r,u&&M.current.Uri.parse(u)),E=M.current.editor.createModel(n,i||r,m&&M.current.Uri.parse(m));w.current.setModel({original:p,modified:E})},[r,n,i,t,o,u,m]),ve=Object(c.useCallback)(function(){w.current=M.current.editor.createDiffEditor(he.current,Object(Z.a)({automaticLayout:!0},A)),ce(),M.current.editor.setTheme(T),ke(!0)},[A,T,ce]);Object(c.useEffect)(function(){_&&j.current(w.current,M.current)},[_]),Object(c.useEffect)(function(){!ge&&!_&&ve()},[ge,_,ve]);function Ve(){var p=w.current.getModel();if(!g){var E;(E=p.original)===null||E===void 0||E.dispose()}if(!V){var G;(G=p.modified)===null||G===void 0||G.dispose()}w.current.dispose()}return S.a.createElement(Qe,{width:Le,height:Se,isEditorReady:_,loading:$,_ref:he,className:Ne,wrapperClassName:Re})}Pe.propTypes={original:a.a.string,modified:a.a.string,language:a.a.string,originalLanguage:a.a.string,modifiedLanguage:a.a.string,originalModelPath:a.a.string,modifiedModelPath:a.a.string,keepCurrentOriginalModel:a.a.bool,keepCurrentModifiedModel:a.a.bool,theme:a.a.string,loading:a.a.oneOfType([a.a.element,a.a.string]),options:a.a.object,width:a.a.oneOfType([a.a.number,a.a.string]),height:a.a.oneOfType([a.a.number,a.a.string]),className:a.a.string,wrapperClassName:a.a.string,beforeMount:a.a.func,onMount:a.a.func},Pe.defaultProps={theme:"light",loading:"Loading...",options:{},keepCurrentOriginalModel:!1,keepCurrentModifiedModel:!1,width:"100%",height:"100%",beforeMount:ie,onMount:ie};var It=Pe,kt=Object(c.memo)(It),$t=kt;function Wt(){var e=Object(c.useState)(ae.__getMonacoInstance()),t=Object(C.a)(e,2),n=t[0],r=t[1];return De(function(){var o;return n||(o=ae.init(),o.then(function(i){r(i)})),function(){var i;return(i=o)===null||i===void 0?void 0:i.cancel()}}),n}var qt=Wt;function Vt(e){var t=Object(c.useRef)();return Object(c.useEffect)(function(){t.current=e},[e]),t.current}var Ht=Vt,Bt=W.create({backup:null}),qe=Object(C.a)(Bt,2),et=qe[0],zt=qe[1],me=new Map;function Ae(e){var t=e.defaultValue,n=e.defaultLanguage,r=e.defaultPath,o=e.value,i=e.language,u=e.path,m=e.theme,g=e.line,V=e.loading,T=e.options,$=e.overrideServices,A=e.saveViewState,Se=e.keepCurrentModel,Le=e.width,Ne=e.height,Re=e.className,Ue=e.wrapperClassName,xe=e.beforeMount,Ie=e.onMount,q=e.onChange,_=e.onValidate,ke=Object(c.useState)(!1),pe=Object(C.a)(ke,2),h=pe[0],ge=pe[1],We=Object(c.useState)(!0),w=Object(C.a)(We,2),M=w[0],he=w[1],j=Object(c.useRef)(null),d=Object(c.useRef)(null),ce=Object(c.useRef)(null),ve=Object(c.useRef)(Ie),Ve=Object(c.useRef)(xe),p=Object(c.useRef)(null),E=Object(c.useRef)(o),G=Ht(u);De(function(){var v=ae.init();return v.then(function(b){return(j.current=b)&&he(!1)}).catch(function(b){return(b==null?void 0:b.type)!=="cancelation"&&console.error("Monaco initialization: error:",b)}),function(){return d.current?Zt():v.cancel()}}),x(function(){var v=Ze(j.current,t||o,n||i,u);v!==d.current.getModel()&&(A&&me.set(G,d.current.saveViewState()),d.current.setModel(v),A&&d.current.restoreViewState(me.get(u)))},[u],h),x(function(){d.current.updateOptions(T)},[T],h),x(function(){d.current.getOption(j.current.editor.EditorOption.readOnly)?d.current.setValue(o):o!==d.current.getValue()&&(d.current.executeEdits("",[{range:d.current.getModel().getFullModelRange(),text:o,forceMoveMarkers:!0}]),d.current.pushUndoStop())},[o],h),x(function(){j.current.editor.setModelLanguage(d.current.getModel(),i)},[i],h),x(function(){xt(g)||d.current.revealLine(g)},[g],h),x(function(){j.current.editor.setTheme(m)},[m],h);var tt=Object(c.useCallback)(function(){Ve.current(j.current);var v=u||r,b=Ze(j.current,o||t,n||i,v);d.current=j.current.editor.create(ce.current,Object(Z.a)({model:b,automaticLayout:!0},T),$),A&&d.current.restoreViewState(me.get(v)),j.current.editor.setTheme(m),et().backup||zt({backup:j.current.editor.setModelMarkers}),ge(!0)},[t,n,r,o,i,u,T,$,A,m]);Object(c.useEffect)(function(){h&&ve.current(d.current,j.current)},[h]),Object(c.useEffect)(function(){!M&&!h&&tt()},[M,h,tt]),E.current=o,Object(c.useEffect)(function(){if(h&&q){var v,b;(v=p.current)===null||v===void 0||v.dispose(),p.current=(b=d.current)===null||b===void 0?void 0:b.onDidChangeModelContent(function(be){var ee=d.current.getValue();E.current!==ee&&q(ee,be)})}},[h,q]),Object(c.useEffect)(function(){h&&(j.current.editor.setModelMarkers=function(v,b,be){var ee;(ee=et().backup)===null||ee===void 0||ee.call(j.current.editor,v,b,be),_==null||_(be)})},[h,_]);function Zt(){var v;if((v=p.current)===null||v===void 0||v.dispose(),Se)A&&me.set(u,d.current.saveViewState());else{var b;(b=d.current.getModel())===null||b===void 0||b.dispose()}d.current.dispose()}return S.a.createElement(Qe,{width:Le,height:Ne,isEditorReady:h,loading:V,_ref:ce,className:Re,wrapperClassName:Ue})}Ae.propTypes={defaultValue:a.a.string,defaultPath:a.a.string,defaultLanguage:a.a.string,value:a.a.string,language:a.a.string,path:a.a.string,theme:a.a.string,line:a.a.number,loading:a.a.oneOfType([a.a.element,a.a.string]),options:a.a.object,overrideServices:a.a.object,saveViewState:a.a.bool,keepCurrentModel:a.a.bool,width:a.a.oneOfType([a.a.number,a.a.string]),height:a.a.oneOfType([a.a.number,a.a.string]),className:a.a.string,wrapperClassName:a.a.string,beforeMount:a.a.func,onMount:a.a.func,onChange:a.a.func,onValidate:a.a.func},Ae.defaultProps={theme:"light",loading:"Loading...",options:{},overrideServices:{},saveViewState:!0,keepCurrentModel:!1,width:"100%",height:"100%",beforeMount:ie,onMount:ie,onValidate:ie};var Kt=Ae,Ft=Object(c.memo)(Kt),Jt=Ft,Xt=l("9kvl"),Gt=l("Dqnf"),Yt=l("dhSg");ae.config({"vs/nls":{availableLanguages:{"*":"zh-cn"}}});var Qt=function(t){var n=t.index,r=t.loading,o=t.dispatch,i=Object(c.useState)("// type your cod222e..."),u=Object(C.a)(i,2),m=u[0],g=u[1],V={selectOnLineNumbers:!0},T=function(){},$=function(){};return Object(c.useEffect)(function(){setTimeout(function(){Yt.a.publish("create-socket",1)},500)},[]),S.a.createElement("div",null,S.a.createElement(Gt.a,{sshConfigData:{host:"106.75.231.63",port:"2021",ws_url:"wss://pre-webssh.educoder.net/ws",username:"root",password:"123123",game_id:4799882,webssh_url:"http://172.16.94.254:8890/bridge",secret:"Dron_123123",width:1004,height:603,rows:33,columns:104},sid:1}),S.a.createElement(Jt,{width:800,height:400,language:"javascript",theme:"hc-black",value:m,options:V,onChange:T,editorDidMount:$}))},en=ue.default=Object(Xt.a)(function(e){var t=e.index,n=e.loading;return{index:t,loading:n.models.index}})(Qt)},Dqnf:function(nt,ue,l){"use strict";var C=l("k1fw"),c=l("tJVT"),S=l("rAM+"),H=l("q1tI"),te=l.n(H),ne=l("J66h"),He=l.n(ne),se=l("/POA"),Be=l.n(se),Oe=l("q7KB"),ze=l.n(Oe),z=l("dhSg"),le=l("bdgK");function Ee(I,L,y){var k=y._core._renderService.dimensions.actualCellWidth||9.5,N=y._core._renderService.dimensions.actualCellHeight||18,s=Math.floor(L/N),D=Math.floor(I/k);return[D,s]}function Me(I,L){var y=new le.default(function(k){var N=Object(S.a)(k),s;try{for(N.s();!(s=N.n()).done;){var D=s.value;if(D.target.offsetHeight>0||D.target.offsetWidth>0){var R=Ee(D.target.offsetWidth,D.target.offsetHeight,I),F=Object(c.a)(R,2),J=F[0],P=F[1];console.log("cols, rows",J,P),I.resize(J,P),z.a.publish("ssh-xterm-resize",{columns:J,rows:P,width:D.target.offsetWidth,height:D.target.offsetHeight})}}}catch(f){N.e(f)}finally{N.f()}});return y.observe(L),y}var de=3e4;ue.a=function(I){var L=I.sshConfigData,y=I.sid,k=Object(H.useState)(null),N=Object(c.a)(k,2),s=N[0],D=N[1],R=L.ws_url,F=L.password,J=L.port,P=Object(H.useRef)(),f=Object(H.useRef)(),Y=Object(H.useRef)(!1);return Object(H.useEffect)(function(){if(P.current&&R){var O=new se.Terminal({fontSize:16,rendererType:"dom"});O.open(P.current),O.onData(function(re){f.current&&(f.current.readyState===1&&(f.current.send(JSON.stringify({tp:"client",data:re})),z.a.publish("on-operating-ssh")))}),O.write("Connecting..."),D(O);var B=Me(O,P.current);return function(){O.dispose(),B.unobserve(P.current)}}},[R,P.current]),Object(H.useEffect)(function(){if(s&&R){var O=function(){var W=new WebSocket(R);f.current=W,W.onopen=function(){var U=s.element.parentElement;if(U){var X=U.offsetWidth,Q=U.offsetHeight;console.log("init",{tp:"init",data:Object(C.a)(Object(C.a)({},L),{},{secret:F,width:X,height:Q,rows:s.rows,columns:s.cols})}),W.send(JSON.stringify({tp:"init",data:Object(C.a)(Object(C.a)({},L),{},{secret:F,width:X,height:Q,rows:s.rows,columns:s.cols})}))}s.focus()},W.onerror=function(U){console.log("------in socket error----",U,W,R)},W.onmessage=function(U){Y.current||(s.write("\r"),setTimeout(function(){},1e3)),Y.current=!0,console.log("event:",U);var X=ne.Base64.decode(U.data.toString()),Q=s._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",X,Q,s),s.write(X)},W.onclose=function(U){B&&clearInterval(B),s.write(`\r connection closed`)}},B=setInterval(function(){f.current&&f.current.send(JSON.stringify({tp:"h"}))},de),re=z.a.subscribe("create-socket",function(K){y==K&&(f.current&&f.current.readyState===1?s.focus():O(),s.focus())}),_e=z.a.subscribe("close-socket",function(K){y===K&&(f.current&&(f.current.close(),Y.current=!1,s.clear()),f.current=null)}),je=z.a.subscribe("ssh-xterm-resize",function(K){f.current&&f.current.readyState===1&&f.current.send(JSON.stringify({tp:"resize",data:Object(C.a)({},K)}))}),ye=z.a.subscribe("ssh-add-connect-time",function(){f.current&&f.current.readyState===1&&f.current.send(JSON.stringify({tp:"overtime"}))});return function(){_e(),re(),je(),ye(),f.current&&(f.current.close(),Y.current=!1)}}},[s,R,J]),te.a.createElement("div",{ref:P,className:"xterm-panel"},R?null:te.a.createElement("p",{style:{color:"#fff"}},"\u6B63\u5728\u8FDE\u63A5\u547D\u4EE4\u884C\u670D\u52A1..."))}}}]);