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