You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
52 KiB
14 lines
52 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[123],{"7ahc":function(Ne,J,i){"use strict";i.d(J,"a",function(){return Be});var ce=i("k1fw"),Re=i("0Owb"),Te=i("+L6B"),F=i("2/Rp"),ae=i("y8nQ"),_=i("Vl3Y"),u=i("tJVT"),w=i("OaEy"),N=i("2fM7"),g=i("q1tI"),C=i.n(g),H=i("VrN/"),ve=i.n(H),ee=i("p77/"),ye=i.n(ee),Ve=i("c5Ni"),Je=i.n(Ve),De=N.a.Option,Ie={labelCol:{span:4},wrapperCol:{span:20}},Se={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};J.b=function(Ee){var be=Ee.callback,we=Ee.onCancel,Me=Object(g.useState)("python"),le=Object(u.a)(Me,2),Xe=le[0],Z=le[1];function m(p){Z(Se[p][1])}function j(p){be(p)}return C.a.createElement(_.a,Object(Re.a)({},Ie,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:j}),C.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},C.a.createElement(N.a,{onChange:m},Object.keys(Se).map(function(p){return C.a.createElement(De,{key:p,value:p},Se[p][0])}))),C.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},C.a.createElement(Be,{mode:Xe})),C.a.createElement("div",{className:"flex-container flex-end"},C.a.createElement(F.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),C.a.createElement(F.a,{type:"ghost",onClick:we},"\u53D6\u6D88")))};function Be(Ee){var be=Ee.value,we=Ee.onChange,Me=Ee.mode,le=Ee.options,Xe=le===void 0?{}:le,Z=Object(g.useRef)(),m=Object(g.useState)(),j=Object(u.a)(m,2),p=j[0],S=j[1];return Object(g.useEffect)(function(){if(p){var X=function(V){var h=V.getValue();we&&we(h)};return p.on("change",X),function(){p.off("change",X)}}},[p,we]),Object(g.useEffect)(function(){p&&p.setOption("mode",Me)},[p,Me]),Object(g.useEffect)(function(){p&&((be!==p.getValue()||be==="")&&setTimeout(function(){p.setValue(be||" ")},300))},[p,be]),Object(g.useEffect)(function(){if(Z.current&&!p){var X=ve.a.fromTextArea(Z.current,Object(ce.a)({mode:Me,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},Xe));S(X)}},[Z.current,p]),C.a.createElement("div",{className:"my-codemirror-container"},C.a.createElement("textarea",{ref:Z}))}},"9Bee":function(Ne,J,i){"use strict";var ce=i("q1tI"),Re=i.n(ce),Te=i("vg9a"),F=i("tJVT"),ae=i("DlQD"),_=i.n(ae),u=i("rUJ1");function w(h,l){var b=h.match(/^(\s+)(?:```)/);if(b===null)return l;var c=b[1];return l.split(`
|
|
`).map(function(v){var M=v.match(/^\s+/);if(M===null)return v;var O=Object(F.a)(M,1),P=O[0];return P.length>=c.length?v.slice(c.length):v}).join(`
|
|
`)}var N=[],g=["<ul>"],C=new _.a.Renderer,H=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function ve(){N.length=0,g=["<ul>"]}function ee(h,l,b,c){if(l>=h.length||h[l].level<=b)return l;var v=h[l];c.push("<li><a href='#"+v.anchor+"'>"+v.text+"</a>"),l++;var M=[];return l=ee(h,l,v.level,M),M.length>0&&(c.push("<ul>"),M.forEach(function(O){c.push(O)}),c.push("</ul>")),c.push("</li>"),l=ee(h,l,b,c),l}function ye(){return ee(N,0,0,g),g.push("</ul>"),g.join("")}var Ve={heading:function(l){var b=H.exec(l);if(b)return{type:"heading",raw:b[0],depth:b[1].length,text:b[2]}},fences:function(l){var b=this.rules.block.fences.exec(l);if(b){var c=b[0],v=w(c,b[3]||""),M=b[2]?b[2].trim():b[2];if(["latex","katex","math"].indexOf(M)>=0){var O=Ie(),P=v;v=O,Se[O]={type:"block",expression:P}}return{type:"code",raw:c,lang:M,text:v}}}},Je=/(?:\${2})([^\n`]+?)(?:\${2})/gi,De=0,Ie=function(){return"__special_katext_id_".concat(De++,"__")},Se={};function Be(){return Se}function Ee(){De=0,Se={}}function be(h){return h=h.replace(Je,function(l,b){var c=Ie();return Se[c]={type:"inline",expression:b},c}),h}var we=C.listitem;C.listitem=function(h){return we(be(h))};var Me=C.paragraph;C.paragraph=function(h){return Me(be(h))};var le=C.tablecell;C.tablecell=function(h,l){return le(be(h),l)},C.code=function(h,l,b){var c=(l||"").match(/\S*/)[0];return c?["latex","katex","math"].indexOf(c)>=0?"<p class='editormd-tex'>".concat(h,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(b?h:Object(u.escape)(h,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(b?h:Object(u.escape)(h,!0))+"</code></pre>"},C.heading=function(h,l,b){var c=this.options.headerPrefix+b.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return N.push({anchor:c,level:l,text:h}),"<h"+l+' id="'+c+'">'+h+"</h"+l+">"},_.a.setOptions({silent:!0,smartypants:!0,gfm:!0,pedantic:!1}),_.a.use({tokenizer:Ve,renderer:C});var Xe=_.a,Z=i("SJMd"),m=i("m3rI"),j=i("Oy/b"),p=i("Xjjk"),S=i.n(p),X=/<pre[^>]*>/g;function G(h){var l=document.createElement("div");return l.innerHTML=h,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var V=J.a=function(h){var l=h.value,b=l===void 0?"":l,c=h.className,v=h.style,M=v===void 0?{}:v,O=String(b),P=Object(ce.useMemo)(function(){try{var A=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,T=/\"\/api\/attachments\/|\"\/attachments\/download\//g,D=/\(\s+\/files\/uploads\/|\(\/files\/uploads\//g;O=O.replace(A,"("+m.a.API_SERVER+"/api/attachments/").replace(T,'"'+m.a.API_SERVER+"/api/attachments/").replace(D,'"'+m.a.API_SERVER+"/files/uploads/")}catch(_e){}var $={whiteList:{a:["href","title","target","script","img"]}};O=S()(O);var q=Xe(O),oe=Be();return O.match(/\[TOC\]/)&&(q=q.replace("<p>[TOC]</p>",ye()),ve()),q=q.replace(/(__special_katext_id_\d+__)/g,function(_e,te){var ie=oe[te],de=ie.type,re=ie.expression;return Object(j.renderToString)(G(re)||"",{displayMode:de==="block",throwOnError:!1,output:"html"})}),q=q.replace(/▁/g,"\u2581\u2581\u2581"),Ee(),q},[O]),Y=Object(ce.useRef)();function I(A){var T=A.target;if(T.tagName.toUpperCase()==="A"){var D=T.getAttribute("href");if(D.startsWith("#")){A.preventDefault();var $=document.getElementById(D.replace("#",""));$&&$.scrollIntoView(!0)}}}return Object(ce.useEffect)(function(){if(Y.current&&P&&(P.match(X)&&window.PR.prettyPrint()),Y.current)return Y.current.addEventListener("click",I),function(){Y.current.removeEventListener("click",I),Ee(),ve()}},[P,Y.current,I]),Re.a.createElement("div",{ref:Y,style:M,className:"".concat(c||""," markdown-body"),dangerouslySetInnerHTML:{__html:P}})}},"9VGf":function(Ne,J,i){"use strict";i.d(J,"a",function(){return Te});var ce=i("q1tI"),Re=i.n(ce);function Te(F,ae){var _=Object(ce.useRef)();Object(ce.useEffect)(function(){_.current=F}),Object(ce.useEffect)(function(){function u(){_.current()}if(ae!==null){var w=setInterval(u,ae);return function(){return clearInterval(w)}}},[ae])}},"9ivq":function(Ne,J,i){},BjJ7:function(Ne,J,i){"use strict";i.d(J,"d",function(){return Re}),i.d(J,"c",function(){return Te}),i.d(J,"e",function(){return F}),i.d(J,"b",function(){return ae}),i.d(J,"a",function(){return u});var ce=i("m3rI");function Re(w){var N=!0;if(w.length>0){for(var g=0;g<w.length;g++)if(w[g].compile_success==0||!w[g].compile_success){N=!1;break}}else N=!1;return N}function Te(w){for(var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",g=[],C=0;C<w.length;C++){var H=w[C],ve=N?"".concat(N,"/").concat(H.name):"".concat(H.name);g.push({title:H.name,isLeaf:!(H.type==="tree"),key:ve})}return g}function F(w,N,g){for(var C=0;C<w.length;C++){var H=w[C];if(H.key===N){H.children=g;break}H.children&&F(H.children,N,g)}return w}function ae(w,N,g){var C;return function(){var H=this,ve=arguments,ee=function(){C=null,g||w.apply(H,ve)},ye=g&&!C;clearTimeout(C),C=setTimeout(ee,N),ye&&w.apply(H,ve)}}var _=!0,u=ce.a.API_SERVER},"C+DQ":function(Ne,J,i){},HmJG:function(Ne,J,i){},M8RZ:function(Ne,J,i){"use strict";i.d(J,"a",function(){return N});var ce=i("fWQN"),Re=i("mtLc"),Te=i("yKVA"),F=i("879j"),ae=i("q1tI"),_=i.n(ae),u=i("i8i4"),w=i.n(u),N=function(g){Object(Te.a)(H,g);var C=Object(F.a)(H);function H(ve){var ee;Object(ce.a)(this,H),ee=C.call(this,ve);var ye=window.document;return ee.node=ye.createElement("div"),ye.body.appendChild(ee.node),ee}return Object(Re.a)(H,[{key:"render",value:function(){var ee=this.props.children;return Object(u.createPortal)(ee,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),H}(_.a.Component)},Ot1p:function(Ne,J,i){"use strict";var ce=i("2qtc"),Re=i("kLXV"),Te=i("rAM+"),F=i("tJVT"),ae=i("jrin"),_=i("q1tI"),u=i.n(_),w=i("VrN/"),N=i.n(w),g=i("bdgK"),C=i("p77/"),H=i("Bd2K"),ve=i("ELLl"),ee=i("19Vz"),ye=i("lZu9"),Ve=i("kSUc"),Je=i("9Bee"),De=i("0Owb"),Ie=i("dejd"),Se=i("C+DQ"),Be=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function Ee(d){var ue=d.onActionCallback,K=d.title,Q=d.icon,se=d.actionName,Ae=d.className,fe=Ae===void 0?"":Ae,Ue=d.children;function xe(){ue(se)}return u.a.createElement("a",{title:K,className:fe,onClick:xe},u.a.createElement("i",{className:"md-iconfont ".concat(Q)}),Ue)}var be=function(d){var ue=d.watch,K=d.showNullButton,Q=d.onActionCallback,se=d.fullScreen,Ae=[].concat(Be,[{title:"".concat(ue?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ue?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return u.a.createElement("ul",{className:"markdown-toolbar-container"},Ae.map(function(fe,Ue){return u.a.createElement("li",{key:Ue},fe.actionName?u.a.createElement(Ee,Object(De.a)({},fe,{onActionCallback:Q})):u.a.createElement("span",{className:"v-line"}))}),K?u.a.createElement("li",null,u.a.createElement(Ee,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Q},u.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,u.a.createElement("li",{className:"btn-full-screen"},u.a.createElement(Ee,{icon:"".concat(se?"icon-shrink":"icon-enlarge"),title:se?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Q})))},we=i("M8RZ"),Me=i("+L6B"),le=i("2/Rp"),Xe=i("y8nQ"),Z=i("Vl3Y"),m=i("5NDa"),j=i("5rEg"),p={labelCol:{span:4},wrapperCol:{span:20}},S=function(d){var ue=d.callback,K=d.onCancel;function Q(se){ue(se)}return u.a.createElement(Z.a,Object(De.a)({},p,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Q}),u.a.createElement(Z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},u.a.createElement(j.a,null)),u.a.createElement(Z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},u.a.createElement(j.a,null)),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(le.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),u.a.createElement(le.a,{type:"ghost",onClick:K},"\u53D6\u6D88")))},X=i("7ahc"),G=i("HmJG"),V=i("BjJ7"),h=Z.a.useForm,l={width:280,marginRight:10},b={labelCol:{span:5},wrapperCol:{span:19}},c=function(d){var ue=d.callback,K=d.onCancel,Q=h(),se=Object(F.a)(Q,1),Ae=se[0];function fe(Le){ue(Le)}function Ue(Le){Ae.setFieldsValue({src:"/api/attachments/".concat(Le.id)})}function xe(Le){var Pe=Le.target.files[0];M(Pe,Ue)}return u.a.createElement(Z.a,Object(De.a)({form:Ae},b,{className:"upload-image-panel",onFinish:fe}),u.a.createElement(Z.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},u.a.createElement("div",{className:"flex-container"},u.a.createElement(Z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},u.a.createElement(j.a,{style:l})),u.a.createElement(v,{onFileChange:xe}))),u.a.createElement(Z.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},u.a.createElement(j.a,{style:{width:264}})),u.a.createElement(Z.a.Item,{style:{textAlign:"right"}},u.a.createElement(le.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),u.a.createElement(le.a,{type:"ghost",onClick:K},"\u53D6\u6D88")))};function v(d){var ue=d.onFileChange;return u.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",u.a.createElement("input",{type:"file",accept:"image/*",onChange:ue}))}function M(d,ue){if(!d)throw new String("\u6CA1\u6709\u6587\u4EF6");var K=new FormData;K.append("editormd-image-file",d),K.append("file_param_name","editormd-image-file"),K.append("byxhr","true");var Q=new window.XMLHttpRequest;Q.withCredentials=!0,Q.addEventListener("load",function(se){ue(JSON.parse(se.target.responseText))},!1),Q.addEventListener("error",function(se){console.error(se)},!1),Q.open("POST","".concat(V.a,"/api/attachments.json")),Q.send(K)}var O=i("giR+"),P=i("fyUT"),Y=i("7Kak"),I=i("9yH6"),A=I.a.Group,T={margin:"0 8px"},D=function(d){var ue=d.callback,K=d.onCancel;function Q(se){ue(se)}return u.a.createElement(Z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Q},u.a.createElement("div",{className:"flex-container"},u.a.createElement("span",{style:T},"\u5355\u5143\u683C\u6570\uFF1A"),u.a.createElement("span",{style:T},"\u884C\u6570"),u.a.createElement(Z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},u.a.createElement(P.a,null)),u.a.createElement("span",{style:T},"\u5217\u6570"),u.a.createElement(Z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},u.a.createElement(P.a,null))),u.a.createElement("div",{className:"flex-container",style:{marginTop:12}},u.a.createElement("span",{style:T},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),u.a.createElement(Z.a.Item,{name:"align"},u.a.createElement(A,null,u.a.createElement(I.a,{value:"default"},u.a.createElement("i",{className:"fa fa-align-justify"})),u.a.createElement(I.a,{value:"left"},u.a.createElement("i",{className:"fa fa-align-left"})),u.a.createElement(I.a,{value:"center"},u.a.createElement("i",{className:"fa fa-align-center"})),u.a.createElement(I.a,{value:"right"},u.a.createElement("i",{className:"fa fa-align-right"}))))),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(le.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),u.a.createElement(le.a,{type:"ghost",onClick:K},"\u53D6\u6D88")))},$="link",q="upload-image",oe="code-block",_e="add-table",te="------------",ie={default:te,left:":".concat(te),center:":".concat(te,":"),right:"".concat(te,":")},de=i("9VGf"),re,r;function e(){}var t=0,n=1e4,o="\u2581";function a(d){return/^\d+$/.test(d)?"".concat(d,"px"):d}var f=navigator.platform.toUpperCase().indexOf("MAC")>=0,E=f?"Cmd":"Ctrl",y=(re={},Object(ae.a)(re,E+"-B","bold"),Object(ae.a)(re,E+"-I","italic"),re),x=(r={},Object(ae.a)(r,$,"\u6DFB\u52A0\u94FE\u63A5"),Object(ae.a)(r,oe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(ae.a)(r,q,"\u6DFB\u52A0\u56FE\u7247"),Object(ae.a)(r,_e,"\u6DFB\u52A0\u8868\u683C"),r),k=J.a=function(d){var ue=d.defaultValue,K=ue===void 0?"":ue,Q=d.onChange,se=d.width,Ae=se===void 0?"100%":se,fe=d.height,Ue=fe===void 0?400:fe,xe=d.miniToolbar,Le=xe===void 0?!1:xe,Pe=d.isFocus,$e=Pe===void 0?!1:Pe,Ke=d.watch,ot=d.id,Ye=ot===void 0?"markdown-editor-id":ot,it=d.showResizeBar,ht=it===void 0?!1:it,me=d.noStorage,je=me===void 0?!1:me,B=d.showNullButton,We=B===void 0?!1:B,Qe=d.fullScreen,Fe=Qe===void 0?!1:Qe,Ge=d.onBlur,ut=d.onCMBeforeChange,he=d.className,ke=he===void 0?"":he,st=d.placeholder,et=st===void 0?"":st,bt=d.values,pt=bt===void 0?"":bt,kt=Object(_.useState)(null),Ot=Object(F.a)(kt,2),s=Ot[0],Bt=Ot[1],Xt=Object(_.useState)(K),Lt=Object(F.a)(Xt,2),vt=Lt[0],lt=Lt[1],Ft=Object(_.useState)(Ke),Rt=Object(F.a)(Ft,2),He=Rt[0],Ut=Rt[1],Gt=Object(_.useState)(Fe),Pt=Object(F.a)(Gt,2),ze=Pt[0],jt=Pt[1],Vt=Object(_.useState)(""),Ct=Object(F.a)(Vt,2),Ze=Ct[0],qe=Ct[1],$t=Object(_.useState)(0),Nt=Object(F.a)($t,2),tt=Nt[0],Et=Nt[1],Kt=Object(_.useState)(Ue),St=Object(F.a)(Kt,2),_t=St[0],wt=St[1],Wt=Object(_.useState)(!1),At=Object(F.a)(Wt,2),Qt=At[0],gt=At[1],rt=Object(_.useRef)(),nt=Object(_.useRef)(),ct=Object(_.useRef)(),dt=Object(_.useRef)();Object(_.useEffect)(function(){lt(pt),s==null||s.setValue(pt)},[pt]),Object(_.useEffect)(function(){if(rt.current){var L=function(W,z){var ne=z.clipboardData;if(ne){var pe=ne.types.toString(),Oe=ne.items;if(pe==="text/html,Files"||pe==="Files"){var ge=Oe[1];pe==="Files"&&(ge=Oe[0]),ge.kind==="file"&&ge.type.match(/^image\//i)&&M(ge.getAsFile(),function(Ce){Ce.id?R.replaceSelection("")):(Ce==null?void 0:Ce.status)===401&&(document.location.href="/user/login")})}else return!0}return!0},R=N.a.fromTextArea(rt.current,{mode:"markdown",inputStyle:"contenteditable",lineNumbers:!Le,lineWrapping:!0,value:K,autoCloseTags:!0,autoCloseBrackets:!0});return R.on("paste",L),Bt(R),function(){R.off("paste",L)}}},[]);var Tt=Object(_.useCallback)(function(){if(nt.current)try{var L=nt.current.getElementsByClassName("markdown-toolbar-container")[0].offsetHeight,R=nt.current.getElementsByClassName("markdown-editor-body")[0];ze?R.style.height="calc(100vh - ".concat(L,"px)"):R.style.height="".concat(_t-L,"px")}catch(U){console.log(U,"---- to set md editor body height")}},[_t,nt,ze]);Object(_.useEffect)(function(){function L(){var U=new g.default(function(W){var z=Object(Te.a)(W),ne;try{for(z.s();!(ne=z.n()).done;){var pe=ne.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&(Tt(),s.setSize("100%","100%"),s.refresh())}}catch(Oe){z.e(Oe)}finally{z.f()}});return U.observe(rt.current.parentElement),U}if(s){var R=L();return function(){R.unobserve(rt.current.parentElement)}}},[s,Tt]),Object(_.useEffect)(function(){if(s){for(var L=[],R=function(){var pe=W[U];z=Object(F.a)(pe,2);var Oe=z[0],ge=z[1],Ce=Object(ae.a)({},Oe,function(){Dt(ge)});L.push(Ce),s.addKeyMap(Ce)},U=0,W=Object.entries(y);U<W.length;U++){var z;R()}return function(){for(var ne=0,pe=L;ne<pe.length;ne++){var Oe=pe[ne];s.removeKeyMap(Oe)}}}},[s]),Object(_.useEffect)(function(){Fe!==ze&&jt(Fe)},[Fe]),Object(de.a)(function(){if(!je&&tt>0){var L=new Date().getTime(),R=window.sessionStorage.getItem(Ye);L>=tt+n&&(!R||R!==vt)&&(window.sessionStorage.setItem(Ye,vt),gt(!0))}},n),Object(_.useEffect)(function(){Ut(Ke)},[s,Ke]),Object(_.useEffect)(function(){s&&($e&&s.focus())},[s,$e]),Object(_.useEffect)(function(){if(He&&s){var L=function(W){var z=W.target;if(dt.current){var ne=z.scrollTop/z.scrollHeight;dt.current.scrollTop=dt.current.scrollHeight*ne}},R=s.getScrollerElement();return R.addEventListener("scroll",L),function(){R.removeEventListener("scroll",L)}}},[s,He]),Object(_.useEffect)(function(){if(s&&ut){var L=function(U,W){ut(U,W)};return s.on("beforeChange",L),function(){s.off("beforeChange",L)}}},[s,ut]),Object(_.useEffect)(function(){if(s&&Ge){var L=function(){Ge(s.getValue())};return s.on("blur",L),function(){s.off("blur",L)}}},[s,Ge]),Object(_.useEffect)(function(){if(s){var L=function(U){var W=U.getValue();lt(W),Et(new Date().getTime()),U.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Q&&Q(W)};return s.on("change",L),function(){s.off("change",L)}}},[s,Q]),Object(_.useEffect)(function(){s&&(K==null?(s.setValue(""),lt("")):K!==s.getValue()&&(s.setValue(K),lt(K)))},[s,K]);var Dt=Object(_.useCallback)(function(L){var R=s.getCursor(),U=s.getSelection(),W=U.split(`
|
|
`);switch(L){case"bold":return s.replaceSelection("**"+U+"**"),U===""&&s.setCursor(R.line,R.ch+2),s.focus();case"italic":return s.replaceSelection("*"+U+"*"),U===""&&s.setCursor(R.line,R.ch+1),s.focus();case"code":return s.replaceSelection("`"+U+"`"),U===""&&s.setCursor(R.line,R.ch+1),s.focus();case"inline-latex":return s.replaceSelection("`$$"+U+"$$`"),U===""&&s.setCursor(R.line,R.ch+3),s.focus();case"latex":return s.replaceSelection("```latex\n"+U+"\n```"),s.setCursor(R.line+1,U.length+1),s.focus();case"line-break":return s.replaceSelection(`<br/>
|
|
`),s.focus();case"list-ul":return U===""?s.replaceSelection("- "+U):s.replaceSelection(W.map(function(z){return z===""?"":"- ".concat(z)}).join(`
|
|
`)),s.focus();case"list-ol":return U===""?s.replaceSelection("1. "+U):s.replaceSelection(W.map(function(z,ne){return z===""?"":"".concat(ne+1,". ").concat(z)}).join(`
|
|
`)),s.focus();case"add-null-ch":return U===""&&s.setCursor(R.line,R.ch+1),s.replaceSelection(o),s.focus();case"eraser":return s.setValue(""),s.focus();case"trigger-watch":return Ut(!He),s.focus();case"trigger-full-screen":return jt(!ze),s.focus();case $:qe($);return;case oe:qe(oe);return;case q:qe(q);return;case _e:qe(_e);return;default:throw new Error}},[s,He,ze]),ft=Object(_.useCallback)(function(L){qe("");switch(Ze){case $:var R=L.title,U=L.link;return s.replaceSelection("[".concat(R,"](").concat(U,")")),s.focus();case oe:var W=L.language,z=L.content;return s.replaceSelection(["```"+W,z,"```"].join(`
|
|
`)),s.focus();case q:var ne=L.src,pe=L.alt;return s.replaceSelection(".concat(ne,' "').concat(pe,'" )')),s.focus();case _e:for(var Oe=L.row,ge=L.col,Ce=L.align,yt=`
|
|
`,mt=0;mt<Oe;mt++){for(var Mt=[],It=[],xt=0;xt<ge;xt++)mt===1&&It.push(ie[Ce]),Mt.push(" ");mt===1&&(yt+="| ".concat(It.join(" | "),` |
|
|
`)),yt+="| ".concat(Mt.join(ge===1?"":" | "),` |
|
|
`)}return s.replaceSelection(yt+`
|
|
`),s.focus();default:throw new Error}},[s,Ze]),Ht=Object(_.useMemo)(function(){switch(Ze){case $:return u.a.createElement(S,{callback:ft,onCancel:at});case oe:return u.a.createElement(X.b,{callback:ft,onCancel:at});case q:return u.a.createElement(c,{callback:ft,onCancel:at});case _e:return u.a.createElement(D,{callback:ft,onCancel:at});default:return null}},[Ze]);function at(){qe("")}Object(_.useEffect)(function(){if(ct.current){var L=function(Oe){z=!0,ne=Oe.pageY},R=function(){z=!1},U=function(Oe){if(z){var ge=Oe.pageY-ne;ge<0&&(ge=0),ge>300&&(ge=300);var Ce=Ue+ge+"px";wt(Ce)}},W=ct.current,z=!1,ne=0;return W.addEventListener("mousedown",L),document.addEventListener("mousemove",U),document.addEventListener("mouseup",R),function(){W.removeEventListener("mousedown",L),document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",R)}}},[s,ct]),Object(_.useEffect)(function(){wt(Ue)},[Ue]);var zt=a(Ae),Jt=a(_t),Yt={width:zt,height:Jt},Zt=Object(_.useMemo)(function(){if(tt){var L=new Date(tt),R=L.getHours(),U=L.getMinutes(),W=L.getSeconds();return R=R<10?"0"+R:R,U=U<10?"0"+U:U,W=W<10?"0"+W:W,"".concat(R,":").concat(U,":").concat(W)}return 0},[tt]);function qt(){window.sessionStorage.removeItem(Ye),gt(!1),Et(0)}function er(){gt(!1),Et(0),s.setValue(window.sessionStorage.getItem(Ye))}return u.a.createElement(_.Fragment,null,u.a.createElement("div",{className:"markdown-editor-wrapper",ref:nt},u.a.createElement("div",{className:"markdown-editor-container ".concat(ke," ").concat(He?"on-preview":""," ").concat(Le?"mini":""," ").concat(ze?"full-screen":""),style:Yt},u.a.createElement(be,{watch:He,fullScreen:ze,showNullButton:We,onActionCallback:Dt}),u.a.createElement("div",{className:"markdown-editor-body"},u.a.createElement("div",{className:"codemirror-container"},u.a.createElement("textarea",{ref:rt,placeholder:et})),He?u.a.createElement("div",{ref:dt,className:"preview-container"},u.a.createElement(Je.a,{value:vt})):null))),ht?u.a.createElement("a",{ref:ct,className:"editor-resize"}):null,u.a.createElement(we.a,null,x[Ze]?u.a.createElement(Re.a,{centered:!0,title:x[Ze],visible:!0,onCancel:at,footer:null},Ht):null))}},axZZ:function(Ne,J,i){"use strict";i.r(J);var ce=i("DZo9"),Re=i("8z0m"),Te=i("+L6B"),F=i("2/Rp"),ae=i("miYZ"),_=i("tsqr"),u=i("9og8"),w=i("tJVT"),N=i("q1tI"),g=i.n(N),C=i("5NDa"),H=i("5rEg"),ve=i("Ot1p"),ee=i("ErOA");function ye(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ye=function(){return m};var m={},j=Object.prototype,p=j.hasOwnProperty,S=Object.defineProperty||function(r,e,t){r[e]=t.value},X=typeof Symbol=="function"?Symbol:{},G=X.iterator||"@@iterator",V=X.asyncIterator||"@@asyncIterator",h=X.toStringTag||"@@toStringTag";function l(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{l({},"")}catch(r){l=function(t,n,o){return t[n]=o}}function b(r,e,t,n){var o=e&&e.prototype instanceof M?e:M,a=Object.create(o.prototype),f=new ie(n||[]);return S(a,"_invoke",{value:q(r,t,f)}),a}function c(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(n){return{type:"throw",arg:n}}}m.wrap=b;var v={};function M(){}function O(){}function P(){}var Y={};l(Y,G,function(){return this});var I=Object.getPrototypeOf,A=I&&I(I(de([])));A&&A!==j&&p.call(A,G)&&(Y=A);var T=P.prototype=M.prototype=Object.create(Y);function D(r){["next","throw","return"].forEach(function(e){l(r,e,function(t){return this._invoke(e,t)})})}function $(r,e){function t(o,a,f,E){var y=c(r[o],r,a);if(y.type!=="throw"){var x=y.arg,k=x.value;return k&&typeof k=="object"&&p.call(k,"__await")?e.resolve(k.__await).then(function(d){t("next",d,f,E)},function(d){t("throw",d,f,E)}):e.resolve(k).then(function(d){x.value=d,f(x)},function(d){return t("throw",d,f,E)})}E(y.arg)}var n;S(this,"_invoke",{value:function(a,f){function E(){return new e(function(y,x){t(a,f,y,x)})}return n=n?n.then(E,E):E()}})}function q(r,e,t){var n="suspendedStart";return function(o,a){if(n==="executing")throw new Error("Generator is already running");if(n==="completed"){if(o==="throw")throw a;return re()}for(t.method=o,t.arg=a;;){var f=t.delegate;if(f){var E=oe(f,t);if(E){if(E===v)continue;return E}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(n==="suspendedStart")throw n="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);n="executing";var y=c(r,e,t);if(y.type==="normal"){if(n=t.done?"completed":"suspendedYield",y.arg===v)continue;return{value:y.arg,done:t.done}}y.type==="throw"&&(n="completed",t.method="throw",t.arg=y.arg)}}}function oe(r,e){var t=e.method,n=r.iterator[t];if(n===void 0)return e.delegate=null,t==="throw"&&r.iterator.return&&(e.method="return",e.arg=void 0,oe(r,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),v;var o=c(n,r.iterator,e.arg);if(o.type==="throw")return e.method="throw",e.arg=o.arg,e.delegate=null,v;var a=o.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function _e(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function te(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function ie(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(_e,this),this.reset(!0)}function de(r){if(r){var e=r[G];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var t=-1,n=function o(){for(;++t<r.length;)if(p.call(r,t))return o.value=r[t],o.done=!1,o;return o.value=void 0,o.done=!0,o};return n.next=n}}return{next:re}}function re(){return{value:void 0,done:!0}}return O.prototype=P,S(T,"constructor",{value:P,configurable:!0}),S(P,"constructor",{value:O,configurable:!0}),O.displayName=l(P,h,"GeneratorFunction"),m.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return!!e&&(e===O||(e.displayName||e.name)==="GeneratorFunction")},m.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,P):(r.__proto__=P,l(r,h,"GeneratorFunction")),r.prototype=Object.create(T),r},m.awrap=function(r){return{__await:r}},D($.prototype),l($.prototype,V,function(){return this}),m.AsyncIterator=$,m.async=function(r,e,t,n,o){o===void 0&&(o=Promise);var a=new $(b(r,e,t,n),o);return m.isGeneratorFunction(e)?a:a.next().then(function(f){return f.done?f.value:a.next()})},D(T),l(T,h,"Generator"),l(T,G,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),m.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function o(){for(;t.length;){var a=t.pop();if(a in e)return o.value=a,o.done=!1,o}return o.done=!0,o}},m.values=de,ie.prototype={constructor:ie,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(te),!e)for(var t in this)t.charAt(0)==="t"&&p.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(x,k){return f.type="throw",f.arg=e,t.next=x,k&&(t.method="next",t.arg=void 0),!!k}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],f=a.completion;if(a.tryLoc==="root")return n("end");if(a.tryLoc<=this.prev){var E=p.call(a,"catchLoc"),y=p.call(a,"finallyLoc");if(E&&y){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(E){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!y)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&p.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&(e==="break"||e==="continue")&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var f=a?a.completion:{};return f.type=e,f.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(f)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),te(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if(o.type==="throw"){var a=o.arg;te(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:de(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=void 0),v}},m}function Ve(m){var j=m.setIscreate,p=m.init,S=m.UpdateItem,X=Object(N.useState)(""),G=Object(w.a)(X,2),V=G[0],h=G[1],l=Object(N.useState)(""),b=Object(w.a)(l,2),c=b[0],v=b[1];Object(N.useEffect)(function(){if(!S)return;h(S&&S.name),v(S&&S.description)},[S]);function M(){return O.apply(this,arguments)}function O(){return O=Object(u.a)(ye().mark(function I(){var A;return ye().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:if(V){D.next=3;break}return _.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),D.abrupt("return");case 3:if(c){D.next=6;break}return _.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),D.abrupt("return");case 6:if(!S){D.next=9;break}return P(),D.abrupt("return");case 9:return D.next=11,Object(ee.a)("/api/hpc_courses.json",{method:"post",body:{name:V,description:c,container_type:window.location.pathname.split("/")[1]}});case 11:A=D.sent,A&&(_.b.info("\u521B\u5EFA\u6210\u529F"),j(!1),p("add"));case 13:case"end":return D.stop()}},I)})),O.apply(this,arguments)}function P(){return Y.apply(this,arguments)}function Y(){return Y=Object(u.a)(ye().mark(function I(){var A;return ye().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return D.next=2,Object(ee.a)("/api/hpc_courses/".concat(S.id,".json"),{method:"put",body:{name:V,description:c,container_type:window.location.pathname.split("/")[1]}});case 2:A=D.sent,A&&(_.b.info("\u7F16\u8F91\u6210\u529F"),j(!1),p(""));case 4:case"end":return D.stop()}},I)})),Y.apply(this,arguments)}return g.a.createElement("div",null,g.a.createElement(H.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:V,maxLength:60,addonAfter:String(V.length)+"/60",onChange:function(A){return h(A.target.value)}}),g.a.createElement(ve.a,{id:"courseContentMD",defaultValue:c,onChange:function(A){return v(A)}}),g.a.createElement("div",{className:"clearfix mt30 mb30"},g.a.createElement(F.a,{type:"primary",onClick:function(){return M()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),g.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return j(!1)}},"\u53D6\u6D88")))}var Je=Ve,De=i("9Bee");function Ie(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ie=function(){return m};var m={},j=Object.prototype,p=j.hasOwnProperty,S=Object.defineProperty||function(r,e,t){r[e]=t.value},X=typeof Symbol=="function"?Symbol:{},G=X.iterator||"@@iterator",V=X.asyncIterator||"@@asyncIterator",h=X.toStringTag||"@@toStringTag";function l(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{l({},"")}catch(r){l=function(t,n,o){return t[n]=o}}function b(r,e,t,n){var o=e&&e.prototype instanceof M?e:M,a=Object.create(o.prototype),f=new ie(n||[]);return S(a,"_invoke",{value:q(r,t,f)}),a}function c(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(n){return{type:"throw",arg:n}}}m.wrap=b;var v={};function M(){}function O(){}function P(){}var Y={};l(Y,G,function(){return this});var I=Object.getPrototypeOf,A=I&&I(I(de([])));A&&A!==j&&p.call(A,G)&&(Y=A);var T=P.prototype=M.prototype=Object.create(Y);function D(r){["next","throw","return"].forEach(function(e){l(r,e,function(t){return this._invoke(e,t)})})}function $(r,e){function t(o,a,f,E){var y=c(r[o],r,a);if(y.type!=="throw"){var x=y.arg,k=x.value;return k&&typeof k=="object"&&p.call(k,"__await")?e.resolve(k.__await).then(function(d){t("next",d,f,E)},function(d){t("throw",d,f,E)}):e.resolve(k).then(function(d){x.value=d,f(x)},function(d){return t("throw",d,f,E)})}E(y.arg)}var n;S(this,"_invoke",{value:function(a,f){function E(){return new e(function(y,x){t(a,f,y,x)})}return n=n?n.then(E,E):E()}})}function q(r,e,t){var n="suspendedStart";return function(o,a){if(n==="executing")throw new Error("Generator is already running");if(n==="completed"){if(o==="throw")throw a;return re()}for(t.method=o,t.arg=a;;){var f=t.delegate;if(f){var E=oe(f,t);if(E){if(E===v)continue;return E}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(n==="suspendedStart")throw n="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);n="executing";var y=c(r,e,t);if(y.type==="normal"){if(n=t.done?"completed":"suspendedYield",y.arg===v)continue;return{value:y.arg,done:t.done}}y.type==="throw"&&(n="completed",t.method="throw",t.arg=y.arg)}}}function oe(r,e){var t=e.method,n=r.iterator[t];if(n===void 0)return e.delegate=null,t==="throw"&&r.iterator.return&&(e.method="return",e.arg=void 0,oe(r,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),v;var o=c(n,r.iterator,e.arg);if(o.type==="throw")return e.method="throw",e.arg=o.arg,e.delegate=null,v;var a=o.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function _e(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function te(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function ie(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(_e,this),this.reset(!0)}function de(r){if(r){var e=r[G];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var t=-1,n=function o(){for(;++t<r.length;)if(p.call(r,t))return o.value=r[t],o.done=!1,o;return o.value=void 0,o.done=!0,o};return n.next=n}}return{next:re}}function re(){return{value:void 0,done:!0}}return O.prototype=P,S(T,"constructor",{value:P,configurable:!0}),S(P,"constructor",{value:O,configurable:!0}),O.displayName=l(P,h,"GeneratorFunction"),m.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return!!e&&(e===O||(e.displayName||e.name)==="GeneratorFunction")},m.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,P):(r.__proto__=P,l(r,h,"GeneratorFunction")),r.prototype=Object.create(T),r},m.awrap=function(r){return{__await:r}},D($.prototype),l($.prototype,V,function(){return this}),m.AsyncIterator=$,m.async=function(r,e,t,n,o){o===void 0&&(o=Promise);var a=new $(b(r,e,t,n),o);return m.isGeneratorFunction(e)?a:a.next().then(function(f){return f.done?f.value:a.next()})},D(T),l(T,h,"Generator"),l(T,G,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),m.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function o(){for(;t.length;){var a=t.pop();if(a in e)return o.value=a,o.done=!1,o}return o.done=!0,o}},m.values=de,ie.prototype={constructor:ie,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(te),!e)for(var t in this)t.charAt(0)==="t"&&p.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(x,k){return f.type="throw",f.arg=e,t.next=x,k&&(t.method="next",t.arg=void 0),!!k}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],f=a.completion;if(a.tryLoc==="root")return n("end");if(a.tryLoc<=this.prev){var E=p.call(a,"catchLoc"),y=p.call(a,"finallyLoc");if(E&&y){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(E){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!y)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&p.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&(e==="break"||e==="continue")&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var f=a?a.completion:{};return f.type=e,f.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(f)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),te(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if(o.type==="throw"){var a=o.arg;te(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:de(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=void 0),v}},m}function Se(m){var j=m.CourseItem,p=m.userId,S=m.init,X=m.ItemUpdate,G=m.setSee,V=m.UserInfo;function h(){return l.apply(this,arguments)}function l(){return l=Object(u.a)(Ie().mark(function c(){var v;return Ie().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return O.next=2,Object(ee.a)("/api/hpc_courses/".concat(j.id,".json"),{method:"delete"});case 2:v=O.sent,v&&(_.b.info("\u5220\u9664\u6210\u529F"),S("delete"),G(!1));case 4:case"end":return O.stop()}},c)})),l.apply(this,arguments)}function b(){X(j)}return g.a.createElement("div",null,p===299635||p===301458||(V==null?void 0:V.admin)||(V==null?void 0:V.business)?g.a.createElement("div",{style:{textAlign:"right"}},g.a.createElement(F.a,{onClick:function(){return b()}},"\u7F16\u8F91"),g.a.createElement(F.a,{onClick:function(){return h()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,g.a.createElement("h1",null,j==null?void 0:j.name),g.a.createElement(De.a,{value:j==null?void 0:j.description}))}var Be=Se,Ee=i("9ivq"),be=i("m3rI"),we=i("Ty5D"),Me=i("9kvl");function le(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */le=function(){return m};var m={},j=Object.prototype,p=j.hasOwnProperty,S=Object.defineProperty||function(r,e,t){r[e]=t.value},X=typeof Symbol=="function"?Symbol:{},G=X.iterator||"@@iterator",V=X.asyncIterator||"@@asyncIterator",h=X.toStringTag||"@@toStringTag";function l(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{l({},"")}catch(r){l=function(t,n,o){return t[n]=o}}function b(r,e,t,n){var o=e&&e.prototype instanceof M?e:M,a=Object.create(o.prototype),f=new ie(n||[]);return S(a,"_invoke",{value:q(r,t,f)}),a}function c(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(n){return{type:"throw",arg:n}}}m.wrap=b;var v={};function M(){}function O(){}function P(){}var Y={};l(Y,G,function(){return this});var I=Object.getPrototypeOf,A=I&&I(I(de([])));A&&A!==j&&p.call(A,G)&&(Y=A);var T=P.prototype=M.prototype=Object.create(Y);function D(r){["next","throw","return"].forEach(function(e){l(r,e,function(t){return this._invoke(e,t)})})}function $(r,e){function t(o,a,f,E){var y=c(r[o],r,a);if(y.type!=="throw"){var x=y.arg,k=x.value;return k&&typeof k=="object"&&p.call(k,"__await")?e.resolve(k.__await).then(function(d){t("next",d,f,E)},function(d){t("throw",d,f,E)}):e.resolve(k).then(function(d){x.value=d,f(x)},function(d){return t("throw",d,f,E)})}E(y.arg)}var n;S(this,"_invoke",{value:function(a,f){function E(){return new e(function(y,x){t(a,f,y,x)})}return n=n?n.then(E,E):E()}})}function q(r,e,t){var n="suspendedStart";return function(o,a){if(n==="executing")throw new Error("Generator is already running");if(n==="completed"){if(o==="throw")throw a;return re()}for(t.method=o,t.arg=a;;){var f=t.delegate;if(f){var E=oe(f,t);if(E){if(E===v)continue;return E}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(n==="suspendedStart")throw n="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);n="executing";var y=c(r,e,t);if(y.type==="normal"){if(n=t.done?"completed":"suspendedYield",y.arg===v)continue;return{value:y.arg,done:t.done}}y.type==="throw"&&(n="completed",t.method="throw",t.arg=y.arg)}}}function oe(r,e){var t=e.method,n=r.iterator[t];if(n===void 0)return e.delegate=null,t==="throw"&&r.iterator.return&&(e.method="return",e.arg=void 0,oe(r,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),v;var o=c(n,r.iterator,e.arg);if(o.type==="throw")return e.method="throw",e.arg=o.arg,e.delegate=null,v;var a=o.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function _e(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function te(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function ie(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(_e,this),this.reset(!0)}function de(r){if(r){var e=r[G];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var t=-1,n=function o(){for(;++t<r.length;)if(p.call(r,t))return o.value=r[t],o.done=!1,o;return o.value=void 0,o.done=!0,o};return n.next=n}}return{next:re}}function re(){return{value:void 0,done:!0}}return O.prototype=P,S(T,"constructor",{value:P,configurable:!0}),S(P,"constructor",{value:O,configurable:!0}),O.displayName=l(P,h,"GeneratorFunction"),m.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return!!e&&(e===O||(e.displayName||e.name)==="GeneratorFunction")},m.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,P):(r.__proto__=P,l(r,h,"GeneratorFunction")),r.prototype=Object.create(T),r},m.awrap=function(r){return{__await:r}},D($.prototype),l($.prototype,V,function(){return this}),m.AsyncIterator=$,m.async=function(r,e,t,n,o){o===void 0&&(o=Promise);var a=new $(b(r,e,t,n),o);return m.isGeneratorFunction(e)?a:a.next().then(function(f){return f.done?f.value:a.next()})},D(T),l(T,h,"Generator"),l(T,G,function(){return this}),l(T,"toString",function(){return"[object Generator]"}),m.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function o(){for(;t.length;){var a=t.pop();if(a in e)return o.value=a,o.done=!1,o}return o.done=!0,o}},m.values=de,ie.prototype={constructor:ie,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(te),!e)for(var t in this)t.charAt(0)==="t"&&p.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(x,k){return f.type="throw",f.arg=e,t.next=x,k&&(t.method="next",t.arg=void 0),!!k}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],f=a.completion;if(a.tryLoc==="root")return n("end");if(a.tryLoc<=this.prev){var E=p.call(a,"catchLoc"),y=p.call(a,"finallyLoc");if(E&&y){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(E){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!y)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&p.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&(e==="break"||e==="continue")&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var f=a?a.completion:{};return f.type=e,f.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(f)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),te(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if(o.type==="throw"){var a=o.arg;te(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:de(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=void 0),v}},m}function Xe(m){var j,p,S,X,G,V,h,l,b,c=m.user,v=m.dispatch,M=Object(N.useState)(1),O=Object(w.a)(M,2),P=O[0],Y=O[1],I=Object(N.useState)(100),A=Object(w.a)(I,2),T=A[0],D=A[1],$=Object(N.useState)([]),q=Object(w.a)($,2),oe=q[0],_e=q[1],te=Object(N.useState)(!1),ie=Object(w.a)(te,2),de=ie[0],re=ie[1],r=Object(N.useState)(!1),e=Object(w.a)(r,2),t=e[0],n=e[1],o=Object(N.useState)(""),a=Object(w.a)(o,2),f=a[0],E=a[1],y=Object(N.useState)(""),x=Object(w.a)(y,2),k=x[0],d=x[1],ue=Object(N.useState)(""),K=Object(w.a)(ue,2),Q=K[0],se=K[1],Ae=Object(we.m)(),fe=Ae.itemname,Ue=Object(N.useState)(""),xe=Object(w.a)(Ue,2),Le=xe[0],Pe=xe[1];Object(N.useEffect)(function(){v({type:"globalSetting/headerToggle",payload:!1}),P&&$e("")},[P]);function $e(me){return Ke.apply(this,arguments)}function Ke(){return Ke=Object(u.a)(le().mark(function me(je){var B,We,Qe,Fe,Ge;return le().wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return he.next=2,Object(ee.a)("/api/hpc_courses.json",{method:"get",params:{page:P,per_page:T,container_type:window.location.pathname.split("/")[1]}});case 2:if(B=he.sent,!B){he.next=24;break}if(We=B.data.hpc_courses.length,_e(B.data.hpc_courses),se(B.data.file_url),d(""),We){he.next=10;break}return he.abrupt("return");case 10:if(Le){he.next=14;break}fe?(Ge=0,B==null||((Qe=B.data)===null||Qe===void 0||((Fe=Qe.hpc_courses)===null||Fe===void 0))||Fe.map(function(ke,st){var et;(fe==null?void 0:fe.toLocaleLowerCase())===(ke==null||((et=ke.name)===null||et===void 0)?void 0:et.toLocaleLowerCase())&&(Ge=st)}),E(B.data.hpc_courses[Ge]),n(!0),Pe(B.data.hpc_courses[Ge].id),(fe==null?void 0:fe.toLocaleLowerCase())==="resources"&&(E(B.data.hpc_courses.filter(function(ke){return ke.id===15})[0]),n(!0),Pe(15))):(E(B.data.hpc_courses[0]),n(!0),Pe(B.data.hpc_courses[0].id)),he.next=24;break;case 14:if(!(je==="delete")){he.next=23;break}if(!(We===0)){he.next=18;break}return n(!1),he.abrupt("return");case 18:E(B.data.hpc_courses[0]),n(!0),Pe(B.data.hpc_courses[0].id),he.next=24;break;case 23:je==="add"?(E(B.data.hpc_courses[We-1]),n(!0),Pe(B.data.hpc_courses[We-1].id)):(E(B.data.hpc_courses.filter(function(ke){return ke.id===Le})[0]),n(!0),Pe(Le));case 24:case"end":return he.stop()}},me)})),Ke.apply(this,arguments)}function ot(me){re(!1),n(!0),E(me),Pe(me.id)}function Ye(me){d(me),re(!0),n(!1)}function it(){d(""),re(!0),n(!1)}var ht={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(je){var B=je.file.status;B!=="uploading",B==="done"?(_.b.success("".concat(je.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),$e("")):B==="error"&&_.b.error("".concat(je.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(je){var B=je.size/1024/1024<150;return B||_.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),B}};return g.a.createElement("div",{style:{marginBottom:"40px"}},g.a.createElement("img",{style:{width:"100%"},src:be.a.IMG_SERVER+"/".concat(Q)}),g.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},g.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},oe&&oe.map(function(me,je){return g.a.createElement("p",{key:je,onClick:function(){return ot(me)},className:Le===me.id?"menuitemselect":"menuitem task-hide"},me.name)}),(c==null||((j=c.userInfo)===null||j===void 0)?void 0:j.user_id)===299635||(c==null||((p=c.userInfo)===null||p===void 0)?void 0:p.user_id)===301458||(c==null||((S=c.userInfo)===null||S===void 0)?void 0:S.admin)||(c==null||((X=c.userInfo)===null||X===void 0)?void 0:X.business)?g.a.createElement("p",{onClick:function(){return it()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},g.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),g.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},de?g.a.createElement(Je,{UpdateItem:k,setIscreate:re,init:$e}):null,t?g.a.createElement(Be,{UserInfo:c==null?void 0:c.userInfo,setSee:n,userId:c==null||((G=c.userInfo)===null||G===void 0)?void 0:G.user_id,ItemUpdate:Ye,CourseItem:f,init:$e}):null)),(c==null||((V=c.userInfo)===null||V===void 0)?void 0:V.user_id)===299635||(c==null||((h=c.userInfo)===null||h===void 0)?void 0:h.user_id)===301458||(c==null||((l=c.userInfo)===null||l===void 0)?void 0:l.admin)||(c==null||((b=c.userInfo)===null||b===void 0)?void 0:b.business)?g.a.createElement(Re.a,ht,g.a.createElement(F.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var Z=J.default=Object(Me.a)(function(m){var j=m.user;return{user:j}})(Xe)},dejd:function(Ne,J,i){},kSUc:function(Ne,J,i){}}]);
|