|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[86913,66390],{96403:function(e,n,t){function a(e){var n=!0;if(e.length>0){for(var t=0;t<e.length;t++)if(0==e[t].compile_success||!e[t].compile_success){n=!1;break}}else n=!1;return n}function i(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",t=[],a=0;a<e.length;a++){var i=e[a],r=n?"".concat(n,"/").concat(i.name):"".concat(i.name);t.push({title:i.name,isLeaf:"tree"!==i.type,key:r})}return t}function r(e,n,t){for(var a=0;a<e.length;a++){var i=e[a];if(i.key===n){i.children=t;break}i.children&&r(i.children,n,t)}return e}function c(e,n,t){var a;return function(){var i=this,r=arguments,c=function(){a=null,t||e.apply(i,r)},s=t&&!a;clearTimeout(a),a=setTimeout(c,n),s&&e.apply(i,r)}}t.d(n,{Ax:function(){return r},Ds:function(){return c},KI:function(){return s},SI:function(){return i},f1:function(){return a}});var s=t(59758).Z.API_SERVER},12768:function(e,n,t){t.d(n,{Z:function(){return q}});var a=t(42122),i=t.n(a),r=t(861),c=t.n(r),s=t(74704),o=t.n(s),l=t(27424),u=t.n(l),d=t(67294),p=(t(81897),t(47084)),f=t.n(p),h=t(90621);var m=[],v=["<ul>"],g=new(f().Renderer),x=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function _(){m.length=0,v=["<ul>"]}var j={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(e,n,t,a){if(n>=e.length||e[n].level<=t)return n;var i=e[n];a.push("<li><a href='#"+i.anchor+"'>"+i.text+"</a>");var r=[];return n=y(e,++n,i.level,r),r.length>0&&(a.push("<ul>"),r.forEach((function(e){a.push(e)})),a.push("</ul>")),a.push("</li>"),n=y(e,n,t,a)}function b(){return y(m,0,0,v),v.push("</ul>"),v.join("")}var k={heading:function(e){var n=x.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[1].length,text:n[2]}},fences:function(e){var n=this.rules.block.fences.exec(e);if(n){var t=n[0],a=function(e,n){var t=e.match(/^(\s+)(?:```)/);if(null===t)return n;var a=t[1];return n.split("\n").map((function(e){var n=e.match(/^\s+/);return null===n?e:u()(n,1)[0].length>=a.length?e.slice(a.length):e})).join("\n")}(t,n[3]||""),i=n[2]?n[2].trim():n[2];if(["latex","katex","math"].indexOf(i)>=0){var r=N(),c=a;a=r,C[r]={type:"block",expression:c}}return{type:"code",raw:t,lang:i,text:a}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,S=0,N=function(){return"__special_katext_id_".concat(S++,"__")},C={};function Z(){return C}function T(){S=0,C={}}function E(e){return e=e.replace(w,(function(e,n){var t=N();return C[t]={type:"inline",expression:n},t}))}var P=g.listitem;g.listitem=function(e){return P(E(e))};var A=g.paragraph;g.paragraph=function(e){return A(E(e))};var I=g.tablecell;g.tablecell=function(e,n){return I(E(e),n)},g.code=function(e,n,t){var a=(n||"").match(/\S*/)[0];return a?["latex","katex","math"].indexOf(a)>=0?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(n,'">').concat(t?e:(0,h.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(t?e:(0,h.escape)(e,!0))+"</code></pre>"},g.heading=function(e,n,t){var a=this.options.headerPrefix+t.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return m.push({anchor:a,level:n,text:e}),"<h"+n+' id="'+a+'">'+e+"</h"+n+">"},f().setOptions({silent:!0,gfm:!0,pedantic:!1}),f().use({tokenizer:k,renderer:g});var L=f(),R=(t(11771),t(67631)),O=t.n(R),F=t(59758),D=t(20527),M=t(25934),V=t(36579),z=t(85893),B="@▁@",H=/<pre[^>]*>/g;var q=function(e){var n=e.value,t=void 0===n?"":n,a=e.className,r=e.showTextOnly,s=e.showLines,l=e.style,p=void 0===l?{}:l,f=e.stylesPrev,h=void 0===f?{}:f,m=e.highlightKeywords,v=e.showProgramFill,g=(e.isProgramFill,e.disabledFill),x=void 0!==g&&g,y=e.programFillValue,k=e.onFillChange,w=void 0===k?function(e){}:k,S=e.onFillBlur,N=void 0===S?function(){}:S,C=String(t),E=(0,d.useState)(""),P=u()(E,2),A=P[0],I=P[1],R=(0,d.useState)("office"),q=u()(R,2),G=q[0],K=q[1],X=(0,d.useState)([]),Y=u()(X,2),U=Y[0],$=Y[1],J=(0,d.useRef)("a"+(0,M.Z)()),W={},Q=function(e){return e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,(function(e,n){var t=n.replace(/(\n|\r)/g,"").split("}"),a=[];return t.map((function(e){""!=e&&a.push(".".concat(J.current," ").concat(e))})),"<style>".concat(a.join("}"),"</style>")}))},ee=(0,d.useMemo)((function(){try{C=C.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+F.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+F.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+F.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,"\n")}catch(e){}if(v){var e=-1;return C=C.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,(function(n,t,a){return function(e,n){var t=document.createElement(e===B?"input":"textarea");t.style.width="100%",t.style.height=e===B?"40px":"151px",t.rows=5,t.spellcheck=!1,t.name="edu-program-fill",t.placeholder="请输入",t.dataset.id=n;var a=Object.keys(W).length;return W[a]=t,'<span class="edu-program-fill-wrap '.concat(e===B?"":"show",'" style="width:').concat(e===B?"200px":"100%",'"><span>').concat(t.outerHTML,'<span class="edu-program-fill-score"></span></span></span>')}(n,++e)})),'<pre style="background:#fff;padding:4px">'.concat(Q(C||""),"</pre>")}var n=L(C);n=Q(n);var t=Z();C.match(/\[TOC\]/)&&(n=n.replace("<p>[TOC]</p>",b()),_()),n=n.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var a=t[n],i=a.type,r=a.expression;return(0,D.renderToString)(function(e){var n=document.createElement("div");return n.innerHTML=e,0===n.childNodes.length?"":n.childNodes[0].nodeValue}(r)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})})),n=n.replace(/▁/g,"▁▁▁"),T();var a=document.createElement("div");return a.innerHTML=n,m?(ae(a,m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a.innerHTML):r?a.innerText:(setTimeout((function(){return ce()}),500),a.innerHTML)}),[C,m]);(0,d.useEffect)((function(){ie.current&&ie.current.querySelectorAll(["input","textarea"]).forEach((function(e){e.oninput=ne,e.onblur=te}))}),[U]),(0,d.useEffect)((function(){if(null!=y&&y.length){var e,n=ie.current.querySelectorAll(".edu-program-fill-score"),t=ie.current.querySelectorAll('[name="edu-program-fill"]'),a=o()(t.entries());try{for(a.s();!(e=a.n()).done;){var i,r=u()(e.value,2),c=r[0],s=r[1];s.value=null===(i=y[c])||void 0===i?void 0:i.value,"warning"===y[c].type?s.className="program-fill-warning":"success"===y[c].type?s.className="program-fill-success":s.className=""}}catch(e){a.e(e)}finally{a.f()}var l,d=o()(n.entries());try{for(d.s();!(l=d.n()).done;){var p,f,h=u()(l.value,2),m=h[0];h[1].innerHTML=null!==(p=y[m])&&void 0!==p&&p.score?"".concat(null===(f=y[m])||void 0===f?void 0:f.score,"分"):""}}catch(e){d.e(e)}finally{d.f()}$(y)}}),[y]);var ne=function(e){U[e.target.dataset.id]=U[e.target.dataset.id]||{},U[e.target.dataset.id].value=e.target.value,$(c()(U)),w(U,e.target.dataset.id)},te=function(e){U[e.target.dataset.id]=U[e.target.dataset.id]||{},U[e.target.dataset.id].value=e.target.value,$(c()(U)),N(U,e.target.dataset.id)};function ae(e,n){return e.childNodes.forEach((function(e){if(e.childNodes.length>0)ae(e,n);else if("IMG"!==e.nodeName)if(e.innerHTML){var t;e.innerHTML=null===(t=e.innerHTML)||void 0===t?void 0:t.replace(new RegExp(n,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>')}else{var a=document.createElement("span");a.innerHTML=e.textContent.replace(new RegExp(n,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),e.replaceWith(a)}}))}var ie=(0,d.useRef)();function re(e){var n=e.target;if("A"===n.tagName.toUpperCase()){var t=n.getAttribute("href");if(t.indexOf("office")>-1)e.preventDefault(),I(t),K("office");else if(t.indexOf("application/pdf")>-1)e.preventDefault(),I(t),K("pdf");else if(t.indexOf("text/html")>-1)e.preventDefault(),I(t),K("html");else if(t.startsWith("#")){e.preventDefault();var a=document.getElementById(t.replace("#",""));a&&a.scrollIntoView(!0)}}}j.WebkitLineClamp=s,s&&(p=i()(i()({},p),j));var ce=function(){var e,n=null===(e=ie.current)||void 0===e?void 0:e.querySelectorAll("video");null==n||n.forEach((function(e){if(e.oncontextmenu=function(){return!1},e.src.indexOf(".m3u8")>-1)if(e.canPlayType("application/vnd.apple.mpegurl"));else if(O().isSupported()){var n=new(O());n.loadSource(e.src),n.attachMedia(e)}}))};return(0,d.useEffect)((function(){if(ie.current&&ee&&ee.match(H)&&window.PR.prettyPrint(),ie.current)return ie.current.addEventListener("click",re),function(){var e;null===(e=ie.current)||void 0===e||e.removeEventListener("click",re),T(),_()}}),[ee,ie.current,re]),(0,z.jsxs)(z.Fragment,{children:[r&&(0,z.jsx)("div",{ref:ie,children:ee}),!r&&(0,z.jsx)("div",{ref:ie,style:i()({},p),className:"".concat(a||""," ").concat(x?"disabled-fill":""," markdown-body ").concat(J.current),dangerouslySetInnerHTML:{__html:ee}}),(0,z.jsx)(V.Z,{close:!0,data:A,type:null!=A&&A.length?G:"",style:i()({},h),onClose:function(){return I("")}})]})}},76695:function(e,n,t){t.d(n,{Z:function(){return s}});var a=t(27424),i=t.n(a),r=t(67294),c=t(85893),s=function(e){var n=e.defaultX,t=void 0===n?"40%":n,a=e.leftChild,s=e.rightChild,o=e.className,l=e.hideResize,u=void 0!==l&&l,d=(0,r.useState)(t),p=i()(d,2),f=p[0],h=p[1],m=(0,r.useRef)();(0,r.useEffect)((function(){function e(e){m.current&&h(e.pageX)}function n(){m.current=!1}return window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),function(){window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)}}),[]);var v="number"==typeof f&&.01!==f?"".concat(f,"px"):t,g="calc(100% - ".concat(u?"0px":"4px"," - ").concat(v,")");return(0,c.jsxs)("div",{className:"split-panel-container ".concat(o),children:[(0,c.jsx)("section",{style:{width:v,display:.01===f?"none":""},children:a}),(0,c.jsx)("section",{className:"resize-x-bar",onMouseDown:function(){m.current=!0},children:(0,c.jsx)("a",{className:"btn-resize",children:(0,c.jsx)("svg",{width:"16",height:"13",viewBox:"0 0 16 13",children:(0,c.jsx)("path",{d:"M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"})})})}),(0,c.jsx)("section",{style:{width:g},children:s})]})}},97501:function(e,n,t){t.d(n,{h:function(){return g}});var a=t(42122),i=t.n(a),r=t(27424),c=t.n(r),s=t(67294),o=t(96101),l=t(91773),u=t(71577),d=t(4631),p=t.n(d),f=(t(71749),t(30483),t(85893)),h=o.Z.Option,m={labelCol:{span:4},wrapperCol:{span:20}},v={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"]};function g(e){var n=e.value,t=e.onChange,a=e.mode,r=e.options,o=void 0===r?{}:r,l=(0,s.useRef)(),u=(0,s.useState)(),d=c()(u,2),h=d[0],m=d[1];return(0,s.useEffect)((function(){if(h){var e=function(e){var n=e.getValue();t&&t(n)};return h.on("change",e),function(){h.off("change",e)}}}),[h,t]),(0,s.useEffect)((function(){h&&h.setOption("mode",a)}),[h,a]),(0,s.useEffect)((function(){h&&(n===h.getValue()&&""!==n||setTimeout((function(){h.setValue(n||"")}),300))}),[h,n]),(0,s.useEffect)((function(){if(l.current&&!h){var e=p().fromTextArea(l.current,i()({mode:a,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},o));m(e)}}),[l.current,h]),(0,f.jsx)("div",{className:"my-codemirror-container",children:(0,f.jsx)("textarea",{ref:l})})}n.Z=function(e){var n=e.callback,t=e.onCancel,a=(0,s.useState)("python"),r=c()(a,2),d=r[0],p=r[1];return(0,f.jsxs)(l.Z,i()(i()({},m),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){n(e)},children:[(0,f.jsx)(l.Z.Item,{label:"代码语言",name:"language",children:(0,f.jsx)(o.Z,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(v[e][1])},children:Object.keys(v).map((function(e){return(0,f.jsx)(h,{value:e,children:v[e][0]},e)}))})}),(0,f.jsx)(l.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(g,{mode:d})}),(0,f.jsxs)("div",{className:"flex-container flex-end",children:[(0,f.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,f.jsx)(u.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))}},55373:function(e,n,t){t.d(n,{Z:function(){return ue}});var a=t(74704),i=t.n(a),r=t(17061),c=t.n(r),s=t(17156),o=t.n(s),l=t(27424),u=t.n(l),d=t(38416),p=t.n(d),f=t(67294),h=t(4631),m=t.n(h),v=t(91033),g=(t(71749),t(57341),t(82801),t(88386),t(49047),t(80785),t(12768)),x=t(85893),_=function(e){var n=e.value,t=void 0===n?"":n,a=(e.className,e.showTextOnly,e.showLines,e.style,(0,f.useMemo)((function(){return""}),[t]));return(0,x.jsx)(x.Fragment,{children:(0,x.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})})},j=t(42122),y=t.n(j),b=[{title:"粗体",icon:"icon-bold",actionName:"bold"},{title:"斜体",icon:"icon-italic",actionName:"italic"},"|",{title:"无序列表",icon:"icon-unorder-list",actionName:"list-ul"},{title:"有序列表",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"行内代码",icon:"icon-code",actionName:"code"},{title:"代码块(多语言风格)",icon:"icon-file-code",actionName:"code-block"},{title:"链接",icon:"icon-link",actionName:"link"},"|",{title:"行内公式",icon:"icon-sum",actionName:"inline-latex"},{title:"多行公式",icon:"icon-formula",actionName:"latex"},"|",{title:"添加图片",icon:"icon-picture",actionName:"upload-image"},{title:"表格",icon:"icon-table",actionName:"add-table"},"|",{title:"换行",icon:"icon-minus",actionName:"line-break"},{title:"清空",icon:"icon-eraser",actionName:"eraser"}];function k(e){var n=e.onActionCallback,t=e.title,a=e.icon,i=e.actionName,r=e.className,c=void 0===r?"":r,s=e.children;return(0,x.jsxs)("a",{title:t,className:c,onClick:function(){n(i)},children:[(0,x.jsx)("i",{className:"md-iconfont ".concat(a)}),s]})}var w=function(e){var n=e.watch,t=e.showNullButton,a=e.showNullProgramButton,i=e.onActionCallback,r=e.fullScreen,c=e.insertTemp,s=e.hidetoolBar,o=[].concat(b,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,x.jsxs)("ul",{className:"markdown-toolbar-container",children:[!s&&o.map((function(e,n){return(0,x.jsx)("li",{children:e.actionName?(0,x.jsx)(k,y()(y()({},e),{},{onActionCallback:i})):(0,x.jsx)("span",{className:"v-line"})},n)})),t?(0,x.jsx)("li",{children:(0,x.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:i,children:(0,x.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,a?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("li",{children:(0,x.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:i,children:(0,x.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,x.jsx)("li",{children:(0,x.jsx)(k,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:i,children:(0,x.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,c&&(0,x.jsx)("li",{children:(0,x.jsx)(k,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(c),onActionCallback:i,children:(0,x.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,x.jsx)("li",{className:"btn-full-screen",children:(0,x.jsx)(k,{icon:"".concat(r?"icon-shrink":"icon-enlarge"),title:r?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},S=t(12264),N=t(91773),C=t(11486),Z=t(71577),T={labelCol:{span:4},wrapperCol:{span:20}},E=function(e){var n=e.callback,t=e.onCancel;return(0,x.jsxs)(N.Z,y()(y()({},T),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,x.jsx)(N.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,x.jsx)(C.Z,{})}),(0,x.jsx)(N.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,x.jsx)(C.Z,{})}),(0,x.jsxs)("div",{className:"flex-container flex-end",children:[(0,x.jsx)(Z.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,x.jsx)(Z.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},P=t(97501),A=t(2453),I=t(96403),L=N.Z.useForm,R={width:280,marginRight:10},O={labelCol:{span:5},wrapperCol:{span:19}},F=function(e){var n=e.callback,t=e.onCancel,a=L(),i=u()(a,1)[0],r=(0,f.useRef)();function c(e,n){-1!==e.status?i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):A.ZP.error(e.message)}return(0,x.jsxs)(N.Z,y()(y()({form:i},O),{},{className:"upload-image-panel",onFinish:function(e){n(y()(y()({},e),{},{name:r.current}))},style:{width:470,overflow:"hidden"},children:[(0,x.jsx)(N.Z.Item,{label:"图片地址",required:!0,children:(0,x.jsxs)("div",{className:"flex-container",children:[(0,x.jsx)(N.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,x.jsx)(C.Z,{style:R})}),(0,x.jsx)(D,{onFileChange:function(e){var n=e.target.files[0];r.current=n.name,M(n,c)}})]})}),(0,x.jsx)(N.Z.Item,{label:"图片描述",name:"alt",children:(0,x.jsx)(C.Z,{style:{width:264}})}),(0,x.jsxs)(N.Z.Item,{style:{textAlign:"right"},children:[(0,x.jsx)(Z.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,x.jsx)(Z.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function D(e){var n=e.onFileChange;return(0,x.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,x.jsx)("input",{type:"file",onChange:n})]})}function M(e,n){if(!e)throw new String("没有文件");var t=new FormData;t.append("editormd-image-file",e),t.append("file_param_name","editormd-image-file"),t.append("byxhr","true");var a=new window.XMLHttpRequest;a.withCredentials=!0,a.addEventListener("load",(function(t){n(JSON.parse(t.target.responseText),e)}),!1),a.addEventListener("error",(function(e){console.error(e)}),!1),a.open("POST","".concat(I.KI,"/api/attachments.json")),a.send(t)}var V,z,B=t(78045),H=t(4082),q=B.ZP.Group,G={margin:"0 8px"},K=function(e){var n=e.callback,t=e.onCancel;return(0,x.jsxs)(N.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,x.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,x.jsx)("span",{style:G,children:"单元格数:"}),(0,x.jsx)("span",{style:G,children:"行数"}),(0,x.jsx)(N.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,x.jsx)(H.Z,{})}),(0,x.jsx)("span",{style:G,children:"列数"}),(0,x.jsx)(N.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,x.jsx)(H.Z,{})})]}),(0,x.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,x.jsx)("span",{style:G,children:"对齐方式:"}),(0,x.jsx)(N.Z.Item,{name:"align",children:(0,x.jsxs)(q,{children:[(0,x.jsx)(B.ZP,{value:"default",children:(0,x.jsx)("i",{className:"fa fa-align-justify"})}),(0,x.jsx)(B.ZP,{value:"left",children:(0,x.jsx)("i",{className:"fa fa-align-left"})}),(0,x.jsx)(B.ZP,{value:"center",children:(0,x.jsx)("i",{className:"fa fa-align-center"})}),(0,x.jsx)(B.ZP,{value:"right",children:(0,x.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,x.jsxs)("div",{className:"flex-container flex-end",children:[(0,x.jsx)(Z.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,x.jsx)(Z.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},X=t(59758),Y=t(84519),U=t(25934),$=t(14446),J="link",W="upload-image",Q="code-block",ee="add-table",ne="------------",te={default:ne,left:":".concat(ne),center:":".concat(ne,":"),right:"".concat(ne,":")},ae=t(61891);var ie="@▁▁@";function re(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ce=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",se=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],oe=(V={},p()(V,ce+"-B","bold"),p()(V,ce+"-I","italic"),V),le=(z={},p()(z,J,"添加链接"),p()(z,Q,"添加代码块"),p()(z,W,"添加文件"),p()(z,ee,"添加表格"),z),ue=function(e){var n=e.defaultValue,t=void 0===n?"":n,a=e.onChange,r=e.width,s=void 0===r?"100%":r,l=e.height,d=void 0===l?400:l,h=e.miniToolbar,j=void 0!==h&&h,y=e.isFocus,b=void 0!==y&&y,k=e.watch,N=e.insertTemp,C=e.mode,Z=void 0===C?"markdown":C,T=e.id,I=void 0===T?"markdown-editor-id":T,L=e.showResizeBar,R=void 0!==L&&L,O=e.noStorage,D=void 0!==O&&O,V=e.showNullButton,z=void 0!==V&&V,B=e.showNullProgramButton,H=void 0!==B&&B,q=e.hidetoolBar,G=void 0!==q&&q,ne=e.fullScreen,ce=void 0!==ne&&ne,ue=e.onBlur,de=e.onCMBeforeChange,pe=e.onFullScreen,fe=e.className,he=void 0===fe?"":fe,me=e.disablePaste,ve=void 0!==me&&me,ge=e.disabled,xe=void 0!==ge&&ge,_e=e.disabledFill,je=void 0!==_e&&_e,ye=e.placeholder,be=void 0===ye?"":ye,ke=e.values,we=void 0===ke?"":ke,Se=(0,f.useState)(null),Ne=u()(Se,2),Ce=Ne[0],Ze=Ne[1],Te=(0,f.useState)(t),Ee=u()(Te,2),Pe=Ee[0],Ae=Ee[1],Ie=(0,f.useState)(k),Le=u()(Ie,2),Re=Le[0],Oe=Le[1],Fe=(0,f.useState)(ce),De=u()(Fe,2),Me=De[0],Ve=De[1],ze=(0,f.useState)(""),Be=u()(ze,2),He=Be[0],qe=Be[1],Ge=(0,f.useState)(0),Ke=u()(Ge,2),Xe=Ke[0],Ye=Ke[1],Ue=(0,f.useState)(d),$e=u()(Ue,2),Je=$e[0],We=$e[1],Qe=(0,f.useState)(!1),en=u()(Qe,2),nn=(en[0],en[1]),tn=(0,f.useRef)((0,U.Z)()),an=(0,f.useRef)(!1),rn=(0,f.useRef)(),cn=(0,f.useRef)(),sn=(0,f.useRef)(),on=(0,f.useRef)(),ln=(0,f.useRef)(),un=function(){var e=o()(c()().mark((function e(){var n,t;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,Y.ZP)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:null!=(t=e.sent)&&null!==(n=t.attachments)&&void 0!==n&&n.length&&(console.log("cm:",Ce,cn),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?Ce.replaceSelection(".concat(e.content_type,")")):e.content_type.indexOf("video")>-1?Ce.replaceSelection('<video width="100%" controls src="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Ce.replaceSelection('<a href="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):Ce.replaceSelection("[".concat(e.name,"](").concat(X.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")"))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,f.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ae(we),null==Ce||Ce.setValue(we),window.scrollTo(0,e)}),[we]),(0,f.useEffect)((function(){null==pe||pe(Me)}),[Me]),(0,f.useEffect)((function(){if(cn.current){var e=function(e,t){if(!ve){var a=t.clipboardData;if(a){var i=a.types.toString(),r=a.items;if("Files"===i||a.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==Z)return;try{var c,s=r[1];"file"===(null===(c=r[0])||void 0===c?void 0:c.kind)&&(s=r[0]);var o=s.getAsFile(),l=o.name.split(".").pop();M(o,(function(e){var t,a,i;e.id?(null==o||null===(t=o.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection(".concat(e.content_type,")")):(null==o||null===(a=o.type)||void 0===a?void 0:a.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==o||null===(i=o.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(o.type,'&disposition=inline" target="_blank">').concat(o.name,"</a>")):se.includes(l)?n.replaceSelection('<a href="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(o.name,"</a>")):n.replaceSelection("[".concat(o.name,"](").concat(X.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))}catch(t){A.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=m().fromTextArea(cn.current,{mode:Z,lineNumbers:!j,lineWrapping:!0,value:t,autoCloseTags:!H,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",be):n.setOption("placeholder",null))})),n.on("keydown",(function(e,n){if(8===n.keyCode){var t=function(e,n){var t=e.getDoc(),a=t.getCursor(),i=t.getLine(a.line),r=i.charAt(a.ch-1),c=i.lastIndexOf("@▁@",a.ch),s=i.lastIndexOf("@▁▁@",a.ch),o=c>s?c:s,l=c>s?3:4;if(-1===ie.indexOf(r))return null;if(console.log("change1:",n,e,i,a,o,c,s,r),o>=0&&a.ch-o<5){var u=o+l;return t.replaceRange("",{line:a.line,ch:o},{line:a.line,ch:u}),{line:a.line,ch:u}}return null}(e);t&&n.preventDefault()}})),b&&n.focus(),n.on("paste",e),n.on("dragleave",(function(e,n){sn.current.classList.remove("mouse-hover-md")})),n.on("dragover",(function(e,n){sn.current.classList.add("mouse-hover-md")})),n.on("drop",(function(e,t){var a;if(sn.current.classList.add("mouse-hover-md"),(a=t.dataTransfer.files).length>0){t.preventDefault(),t.stopPropagation();for(var i=function(){var e=a[r],t=e.name.split(".").pop();M(e,(function(a){var i,r,c;a.id?(null==e||null===(i=e.type)||void 0===i?void 0:i.indexOf("image"))>-1?n.replaceSelection(".concat(a.content_type,")")):(null==e||null===(r=e.type)||void 0===r?void 0:r.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(a.id,'"></video>')):(null==e||null===(c=e.type)||void 0===c?void 0:c.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):se.includes(t)?n.replaceSelection('<a href="'.concat(X.Z.API_SERVER,"/api/attachments/").concat(a.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(X.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(a.content_type,")")):401===(null==a?void 0:a.status)&&(document.location.href="/user/login")}))},r=0;r<a.length;r++)i()}})),xe&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ze(n),function(){n.off("paste",e)}}}),[]);var dn=(0,f.useCallback)((function(){sn.current}),[Je,sn,Me]);(0,f.useEffect)((function(){if(Ce){var e=function(){var e=new v.Z((function(e){var n,t=i()(e);try{for(t.s();!(n=t.n()).done;){var a=n.value;(a.target.offsetHeight>0||a.target.offsetWidth>0)&&(dn(),Ce.setSize("100%","100%"),Ce.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(cn.current.parentElement),e}();return function(){var n,t;null!==(n=cn.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=cn.current)||void 0===t?void 0:t.parentElement)}}}),[Ce,dn]),(0,f.useEffect)((function(){if(Ce){for(var e=[],n=function(){var n=u()(a[t],2),i=n[0],r=n[1],c=p()({},i,(function(){pn(r)}));e.push(c),Ce.addKeyMap(c)},t=0,a=Object.entries(oe);t<a.length;t++)n();return rn.current=setInterval((function(){an.current&&un()}),4e3),function(){clearInterval(rn.current);for(var n=0,t=e;n<t.length;n++){var a=t[n];Ce.removeKeyMap(a)}}}}),[Ce]),(0,f.useEffect)((function(){ce!==Me&&Ve(ce)}),[ce]),(0,ae.Z)((function(){if(!D&&Xe>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(I);e>=Xe+1e4&&(!n||n!==Pe)&&(window.sessionStorage.setItem(I,Pe),nn(!0))}}),1e4),(0,f.useEffect)((function(){Oe(k)}),[Ce,k]),(0,f.useEffect)((function(){Ce&&b&&Ce.focus()}),[Ce,b]),(0,f.useEffect)((function(){if(Re&&Ce){var e=function(e){var n=e.target;if(ln.current){var t=n.scrollTop/n.scrollHeight;ln.current.scrollTop=ln.current.scrollHeight*t}},n=Ce.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Ce,Re]),(0,f.useEffect)((function(){if(Ce&&de){var e=function(e,n){de(e,n)};return Ce.on("beforeChange",e),function(){Ce.off("beforeChange",e)}}}),[Ce,de]),(0,f.useEffect)((function(){if(Ce&&ue){var e=function(){ue(Ce.getValue())};return Ce.on("blur",e),function(){Ce.off("blur",e)}}}),[Ce,ue]),(0,f.useEffect)((function(){if(Ce){var e=function(e,n){var t=e.getValue();Ae(t),Ye((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),a&&(H?a(t,gn(t)):a(t))};return Ce.on("change",e),function(){Ce.off("change",e)}}}),[Ce,a]),(0,f.useEffect)((function(){if(Ce)if(null==t)Ce.setValue(""),Ae("");else{var e=window.scrollY||window.pageYOffset;t!==Ce.getValue()&&(Ce.setValue(t),Ae(t),Ce.setCursor(xe?1:Ce.lineCount(),0),window.scrollTo(0,e))}}),[Ce,t]);var pn=(0,f.useCallback)((function(e){var n=Ce.getCursor(),t=Ce.getSelection(),a=t.split("\n");switch(e){case"bold":return Ce.replaceSelection("**"+t+"**"),""===t&&Ce.setCursor(n.line,n.ch+2),Ce.focus();case"italic":return Ce.replaceSelection("*"+t+"*"),""===t&&Ce.setCursor(n.line,n.ch+1),Ce.focus();case"code":return Ce.replaceSelection("`"+t+"`"),""===t&&Ce.setCursor(n.line,n.ch+1),Ce.focus();case"inline-latex":return Ce.replaceSelection("`$$"+t+"$$`"),""===t&&Ce.setCursor(n.line,n.ch+3),Ce.focus();case"latex":return Ce.replaceSelection("```latex\n"+t+"\n```"),Ce.setCursor(n.line+1,t.length+1),Ce.focus();case"line-break":return Ce.replaceSelection("<br/>\n"),Ce.focus();case"list-ul":return""===t?Ce.replaceSelection("- "+t):Ce.replaceSelection(a.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ce.focus();case"list-ol":return""===t?Ce.replaceSelection("1. "+t):Ce.replaceSelection(a.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),Ce.focus();case"add-null-ch":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection("▁"),Ce.focus();case"add-signal":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection("@▁@"),Ce.focus();case"add-multiple":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection(ie),Ce.focus();case"inster-template-1":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Ce.focus();case"eraser":return Ce.setValue(""),Ce.focus();case"trigger-watch":return Oe(!Re),Ce.focus();case"trigger-full-screen":return Ve(!Me),Ce.focus();case J:return void qe(J);case Q:return void qe(Q);case W:return void qe(W);case ee:return void qe(ee);default:throw new Error}}),[Ce,Re,Me]),fn=(0,f.useCallback)((function(e){switch(qe(""),He){case J:var n=e.title,t=e.link;return Ce.replaceSelection("[".concat(n,"](").concat(t,")")),Ce.focus();case Q:var a=e.language,i=e.content;return Ce.replaceSelection(["```"+a,i,"```"].join("\n")),Ce.focus();case W:var r=e.src,c=e.alt;return c?Ce.replaceSelection(".concat(r,' "').concat(c,'" )')):Ce.replaceSelection("")),Ce.focus();case ee:for(var s=e.row,o=e.col,l=e.align,u="\n",d=0;d<s;d++){for(var p=[],f=[],h=0;h<o;h++)1===d&&f.push(te[l]),p.push(" ");1===d&&(u+="| ".concat(f.join(" | ")," |\n")),u+="| ".concat(p.join(1===o?"":" | ")," |\n")}return Ce.replaceSelection(u+"\n"),Ce.focus();default:throw new Error}}),[Ce,He]),hn=(0,f.useMemo)((function(){switch(He){case J:return(0,x.jsx)(E,{callback:fn,onCancel:mn});case Q:return(0,x.jsx)(P.Z,{callback:fn,onCancel:mn});case W:return(0,x.jsx)(F,{callback:fn,onCancel:mn});case ee:return(0,x.jsx)(K,{callback:fn,onCancel:mn});default:return null}}),[He]);function mn(){qe("")}(0,f.useEffect)((function(){if(on.current){var e=function(e){i=!0,r=e.pageY},n=function(){i=!1},t=function(e){if(i){var n=e.pageY-r;n<0&&(n=0),n>300&&(n=300),We(d+n+"px")}},a=on.current,i=!1,r=0;return a.addEventListener("mousedown",e),document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),function(){a.removeEventListener("mousedown",e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}}}),[Ce,on]),(0,f.useEffect)((function(){We(d)}),[d]);var vn={width:re(s),height:re(Je)},gn=((0,f.useMemo)((function(){if(Xe){var e=new Date(Xe),n=e.getHours(),t=e.getMinutes(),a=e.getSeconds();return t=t<10?"0"+t:t,a=a<10?"0"+a:a,"".concat(n=n<10?"0"+n:n,":").concat(t,":").concat(a)}return 0}),[Xe]),function(e){var n=[];if(H){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,a){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,x.jsxs)(f.Fragment,{children:[(0,x.jsx)("div",{className:"markdown-editor-wrapper",ref:sn,children:(0,x.jsxs)("div",{className:"markdown-editor-container ".concat(he," ").concat(Re?"on-preview":""," ").concat(j?"mini":""," ").concat(Me?"full-screen":""),style:vn,children:[(0,x.jsx)(w,{insertTemp:N,watch:Re,fullScreen:Me,showNullButton:z,showNullProgramButton:H,onActionCallback:pn,hidetoolBar:G,uuid:tn.current,setOpenPhones:function(){an.current=!0}}),(0,x.jsxs)("div",{className:"markdown-editor-body",children:[(0,x.jsx)("div",{className:"codemirror-container",children:(0,x.jsx)("textarea",{ref:cn,placeholder:be})}),Re?(0,x.jsxs)("div",{ref:ln,className:"preview-container",children:["stex"===Z&&(0,x.jsx)(_,{value:Pe}),"stex"!==Z&&(0,x.jsx)(g.Z,{disabledFill:je,showProgramFill:H,value:Pe})]}):null]})]})}),R?(0,x.jsx)("a",{ref:on,className:"editor-resize"}):null,(0,x.jsx)(S.Z,{children:le[He]?(0,x.jsx)($.Z,{centered:!0,title:le[He],open:!0,onCancel:mn,footer:null,className:"markdown-popup-form",children:hn}):null})]})}},12264:function(e,n,t){t.d(n,{Z:function(){return f}});var a=t(56690),i=t.n(a),r=t(89728),c=t.n(r),s=t(61655),o=t.n(s),l=t(26389),u=t.n(l),d=t(67294),p=t(73935),f=function(e){o()(t,e);var n=u()(t);function t(e){var a;i()(this,t),a=n.call(this,e);var r=window.document;return a.node=r.createElement("div"),r.body.appendChild(a.node),a}return c()(t,[{key:"render",value:function(){var e=this.props.children;return(0,p.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),t}(d.Component)},77696:function(e,n,t){t(67294),t(12867);var a=t(96101),i=t(47897),r=t(85893),c=a.Z.Option;n.Z=function(e){var n=e.isTheoretical,t=e.onFontSizeChange,s=e.cmFontSize,o=e.cmCodeMode,l=(e.autoFormat,e.onCodeModeChange),u=e.onTabToSpace,d=(e.onAutoFormat,e.formatDocument),p=e.className,f=void 0===p?"":p,h=e.tabToSpace,m=e.children;return(0,r.jsxs)("div",{className:"tpi-code-setting ".concat(f),children:[(0,r.jsx)("h3",{children:"代码格式"}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"显示模式"}),(0,r.jsxs)(a.Z,{bordered:!1,size:"small",value:o,onChange:l,children:[(0,r.jsx)(c,{value:"vs",children:"白色背景"}),(0,r.jsx)(c,{value:"vs-dark",children:"黑色背景"})]})]}),!n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"字体大小"}),(0,r.jsxs)(a.Z,{bordered:!1,size:"small",value:s,onChange:t,children:[(0,r.jsx)(c,{value:12,children:"12px"}),(0,r.jsx)(c,{value:14,children:"14px"}),(0,r.jsx)(c,{value:16,children:"16px"}),(0,r.jsx)(c,{value:18,children:"18px"}),(0,r.jsx)(c,{value:20,children:"20px"}),(0,r.jsx)(c,{value:22,children:"22px"})]})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"Tab转换"}),(0,r.jsx)(i.Z,{checked:h,onChange:u})]}),(0,r.jsx)("div",{className:"file-item",onClick:d,children:(0,r.jsx)("b",{style:{cursor:"pointer"},children:"格式化代码"})})]})]}),!n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h3",{children:"快捷键"}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"保存代码"}),(0,r.jsx)("span",{children:"Ctrl + S"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"唤出快捷键列表"}),(0,r.jsx)("span",{children:"F1 / Alt + F1"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"左右缩进"}),(0,r.jsx)("span",{children:"Ctrl + ]/["})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"跳到匹配的括号"}),(0,r.jsx)("span",{children:"Ctrl + Shift + \\"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"转到行首"}),(0,r.jsx)("span",{children:"Home"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"转到行尾"}),(0,r.jsx)("span",{children:"End"})]})]}),m]})]})}},61891:function(e,n,t){t.d(n,{Z:function(){return i}});var a=t(67294);function i(e,n){var t=(0,a.useRef)();(0,a.useEffect)((function(){t.current=e})),(0,a.useEffect)((function(){if(null!==n){var e=setInterval((function(){t.current()}),n);return function(){return clearInterval(e)}}}),[n])}},16347:function(e,n,t){t.r(n),t.d(n,{Types:function(){return Je},default:function(){return Qe}});var a,i=t(13012),r=t.n(i),c=t(861),s=t.n(c),o=t(74704),l=t.n(o),u=t(17061),d=t.n(u),p=t(17156),f=t.n(p),h=t(27424),m=t.n(h),v=t(42122),g=t.n(v),x=t(67294),_="header___N_IdR",j="field___XG_dh",y="oj-form-container___syYzK",b="oj-left-panel___L082x",k="oj-form-info___q0IU5",w="footer___pGCM2",S="result___LM9Ms",N="passText___nUoL4",C="noPassText___ECHHG",Z="pass___tDubp",T="noPass___ilYvg",E="test-case-name___MI_KD",P="btn-remove-case___OiaTQ",A="btn_back___FyaSY",I="testJi___NDviK",L="upBtn___FiZX4",R="oj-problems___xb70g",O="row___v036E",F="a___yRaYH",D="b___gWQyu",M="inputTwo___IZ9og",V="inputOne____NmcT",z="cusModal___fJ5gm",B="oj-custom-large-spin___Aar0g",H="MdEditor___hgoes",q=t(11486),G=t(14446),K=t(47221),X=t(91773),Y=t(2453),U=t(71230),$=t(15746),J=t(57953),W=t(71577),Q=t(76661),ee=t(96101),ne=t(4082),te=t(78045),ae=t(84567),ie=t(93421),re=t(86738),ce=t(38416),se=t.n(ce),oe=t(85893),le=ee.Z.Option,ue=function(e){return e[e.language=0]="language",e[e.difficulty=1]="difficulty",e[e.category=2]="category",e[e.openOrNot=3]="openOrNot",e}({}),de=(a={},se()(a,ue.language,[{title:"C",key:"C"},{title:"C++",key:"C++"},{title:"Python",key:"Python"},{title:"Java",key:"Java"},{title:"JavaScript",key:"JavaScript"},{title:"Ruby",key:"Ruby"}]),se()(a,ue.difficulty,[{title:"简单",key:1},{title:"适中",key:2},{title:"困难",key:3}]),se()(a,ue.category,[{title:"程序设计",key:1},{title:"算法",key:2}]),se()(a,ue.openOrNot,[{title:"公开",key:1},{title:"私有",key:0}]),a);var pe=t(88275),fe=t(19575),he=t(81088),me=t(18429),ve=t(55373),ge=t(84519);function xe(e){return(0,ge.v_)("practices.json",e)}function _e(e){return(0,ge.U2)("practices/".concat(e,"/edit.json"))}function je(e,n){return(0,ge.gz)("practices/".concat(e),n)}var ye=t(76695),be=t(72565),ke=t(8691),we=t(77696),Se=t(12264),Ne=t(63778),Ce="code-panel-container___BZjjl",Ze="action-oj-bar___xbXpK",Te="active___EMVKI",Ee={theme:(0,Ne.G)("cmCodeMode","vs-dark"),fontSize:(0,Ne.G)("cmFontSize",14),showEditorSetting:!1,tabToSpace:(0,Ne.G)("cmTabToSpace",!0)},Pe=function(e){return e[e.set_font_size=0]="set_font_size",e[e.set_theme=1]="set_theme",e[e.on_tab_to_space=2]="on_tab_to_space",e[e.set_show_editor_setting=3]="set_show_editor_setting",e}(Pe||{});function Ae(e,n){switch(n.type){case Pe.set_show_editor_setting:return g()(g()({},e),{},{showEditorSetting:n.payload});case Pe.set_theme:return g()(g()({},e),{},{theme:n.payload});case Pe.set_font_size:return g()(g()({},e),{},{fontSize:n.payload});case Pe.on_tab_to_space:return g()(g()({},e),{},{tabToSpace:n.payload});default:throw new Error}}var Ie=function(e){var n=e.value,t=e.onChange,a=e.language,i=e.onLanguage,r=e.languageItems,c=e.ActionBarRender,s=void 0===c?function(e){return(0,oe.jsx)(Le,{languageItems:r,onLanguage:i,language:a,onShowCodeSetting:e})}:c,o=(0,x.useReducer)(Ae,Ee),l=m()(o,2),u=l[0],d=l[1],p=u.theme,f=u.fontSize,h=u.showEditorSetting,v=u.tabToSpace;console.log(n,a,"value");var _={onFontSizeChange:function(e){d({type:Pe.set_font_size,payload:e}),(0,Ne.t)("cmFontSize",e)},tabToSpace:v,cmFontSize:f,className:"oj",cmCodeMode:p,onTabToSpace:function(e){d({type:Pe.on_tab_to_space,payload:e}),(0,Ne.t)("cmTabToSpace",e)},onCodeModeChange:function(e){d({type:Pe.set_theme,payload:e}),(0,Ne.t)("cmCodeMode",e)}};var j={value:n,language:a,onChange:t,theme:p,height:"calc(100% - 56px)",options:{fontSize:f,insertSpaces:v}};return(0,oe.jsxs)(x.Fragment,{children:[(0,oe.jsxs)("div",{className:Ce,children:[s((function(){d({type:Pe.set_show_editor_setting,payload:!0})})),(0,oe.jsx)(ke.ZP,g()({},j),a)]}),(0,oe.jsx)(Se.Z,{children:(0,oe.jsx)(be.Z,{rootClassName:"oj",title:null,placement:"right",closable:!1,open:h,onClose:function(){d({type:Pe.set_show_editor_setting,payload:!1})},children:(0,oe.jsx)(we.Z,g()({},_))})})]})};function Le(e){var n=e.languageItems,t=e.language,a=e.onShowCodeSetting,i=e.onLanguage;return(0,oe.jsxs)("div",{className:Ze,children:[null==n?void 0:n.map((function(e){return(0,oe.jsx)("div",{className:t===(null==e?void 0:e.language)?Te:"",onClick:function(){return i(null==e?void 0:e.language)},children:null==e?void 0:e.language},null==e?void 0:e.language)})),(0,oe.jsx)("a",{onClick:a,children:(0,oe.jsx)("i",{className:"iconfont icon-shezhi"})})]})}var Re=t(36182),Oe="wrap___xTL91",Fe="in___eSY86",De="btns___UdEGI",Me="customModal___CL0OL",Ve=function(e){var n=e.visible,t=e.onOK,a=e.onCancel,i=(0,x.useState)(!1),r=m()(i,2),c=r[0],s=r[1],o=(0,x.useState)(!1),l=m()(o,2),u=l[0],p=l[1],h=(0,x.useState)("1"),v=m()(h,2),g=v[0],_=v[1],j=(0,x.useState)(""),y=m()(j,2),b=y[0],k=y[1],w=(0,x.useState)([]),S=m()(w,2),N=S[0],C=S[1],Z=function(){var e=f()(d()().mark((function e(){var a;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b){e.next=3;break}return Y.ZP.warning("题目".concat(E,"不能为空")),e.abrupt("return");case 3:return p(!0),e.next=6,(0,ge.ZP)("/api/tag_disciplines.json",{method:"post",body:{target:n,name:b}});case 6:if(0!==(null==(a=e.sent)?void 0:a.status)){e.next=10;break}return t(),e.abrupt("return");case 10:p(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T=function(){var e=f()(d()().mark((function e(){var t,a,i=arguments;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"",s(!0),e.next=4,(0,ge.ZP)("/api/tag_disciplines.json",{method:"get",params:{target:n,search:t}});case 4:a=e.sent,C(a.tag_disciplines||[]),s(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),E="practice"===n?"知识点":"来源";return(0,oe.jsx)(G.Z,{afterClose:function(){p(!1),s(!1),k(""),_("1"),C([])},centered:!0,keyboard:!1,width:600,title:"".concat(E,"管理"),open:!!n,className:Me,footer:null,onCancel:a,children:(0,oe.jsx)("section",{className:Oe,children:(0,oe.jsxs)(Re.Z,{activeKey:g,onChange:function(e){k(""),_(e),T()},children:[(0,oe.jsxs)(Re.Z.TabPane,{tab:"新增".concat(E),children:[(0,oe.jsx)(q.Z,{value:b,onChange:function(e){return k(e.target.value)},className:Fe,placeholder:"输入".concat(E,"名称,不超过20个字"),maxLength:20}),(0,oe.jsxs)("div",{className:De,children:[(0,oe.jsx)(W.ZP,{onClick:a,className:"mr20",children:"取消 "}),(0,oe.jsx)(W.ZP,{loading:u,onClick:Z,type:"primary",children:"确认新建"})]})]},"1"),(0,oe.jsxs)(Re.Z.TabPane,{tab:"已有".concat(E),children:[(0,oe.jsx)(q.Z.Search,{allowClear:!0,onSearch:function(e){T(e)},value:b,onChange:function(e){return k(e.target.value)},className:Fe,placeholder:"输入".concat(E,"名称进行查询")}),(0,oe.jsx)(Q.Z,{dataSource:N,bordered:!1,loading:c,scroll:N.length>7?{y:300}:{},style:{padding:"0 0px 20px 0px"},columns:[{title:"".concat(E,"名称"),dataIndex:"name",ellipsis:!0},{title:"操作",dataIndex:"action",width:120,render:function(e,t){return(0,oe.jsxs)("span",{children:[(0,oe.jsx)("span",{onClick:function(){return function(e){var n,t=e.name;G.Z.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"重命名",content:(0,oe.jsx)("div",{children:(0,oe.jsx)(q.Z,{defaultValue:t,placeholder:"请输入".concat(E,"名称,不超过20个字"),maxLength:20,onChange:function(e){t=e.target.value}})}),okText:"确认",cancelText:"取消",onOk:(n=f()(d()().mark((function n(){var a;return d()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t){n.next=3;break}return Y.ZP.warning("题目".concat(E,"不能为空")),n.abrupt("return",Promise.reject());case 3:return n.next=5,(0,ge.ZP)("/api/tag_disciplines/".concat(e.id,"/rename.json"),{method:"post",body:{id:e.id,name:t}});case 5:0===(null==(a=n.sent)?void 0:a.status)&&T();case 7:case"end":return n.stop()}}),n)}))),function(){return n.apply(this,arguments)})})}(t)},className:"current mr10 c-light-primary",children:"重命名"}),(0,oe.jsx)("span",{onClick:function(){return function(e){var t;G.Z.confirm({icon:null,className:"custom-modal-divider",centered:!0,width:570,title:"删除",content:"practice"===n?(0,oe.jsxs)("div",{children:["确认将题目来源“",(0,oe.jsx)("span",{className:"c-light-primary",children:e.name}),"”删除吗?",(0,oe.jsx)("br",{}),"删除后,会将相关题目中的来源进行清除。"]}):(0,oe.jsxs)("div",{children:["确认将题目知识点“",(0,oe.jsx)("span",{className:"c-light-primary",children:e.name}),"”删除吗?",(0,oe.jsx)("br",{}),"删除后,会将相关题目中的知识点进行清除。"]}),okText:"确认",cancelText:"取消",onOk:(t=f()(d()().mark((function n(){var t;return d()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,ge.ZP)("/api/tag_disciplines/".concat(e.id,".json"),{method:"delete",body:{id:e.id}});case 2:0===(null==(t=n.sent)?void 0:t.status)&&T();case 4:case"end":return n.stop()}}),n)}))),function(){return t.apply(this,arguments)})})}(t)},className:"current c-grey-666",children:"删除"})]})}}],pagination:!1})]},"2")]})})})},ze=t(59758),Be=t(29201),He=t(27484),qe=t.n(He),Ge=t(29427),Ke=t(12768),Xe=t(7),Ye=q.Z.TextArea,Ue=(G.Z.confirm,K.Z.Panel),$e={loading:!0,user:null,status:0,data:void 0,lastedUpdateTime:0},Je=function(e){return e[e.SET_INITAL_DATA=0]="SET_INITAL_DATA",e[e.SET_LOADING=1]="SET_LOADING",e[e.SET_STATUS=2]="SET_STATUS",e}({});function We(e,n){switch(n.type){case Je.SET_INITAL_DATA:return g()(g()({},e),n.payload);case Je.SET_LOADING:return g()(g()({},e),{},{loading:n.payload});case Je.SET_STATUS:return g()(g()({},e),{},{status:n.payload});default:throw new Error}}var Qe=function(){(0,pe.useLocation)();var e,n,t,a=(0,pe.useParams)().id,i=X.Z.useForm(),r=m()(i,1)[0],c=(0,x.useState)(),s=m()(c,2),o=s[0],u=s[1],p=(0,x.useState)(!1),h=m()(p,2),v=h[0],j=h[1],b=(0,x.useState)([]),k=m()(b,2),E=k[0],P=k[1],I=(0,x.useState)([]),L=m()(I,2),O=L[0],F=L[1],D=(0,x.useState)([]),M=m()(D,2),V=M[0],q=M[1],K=(0,x.useState)([]),ee=m()(K,2),ne=ee[0],te=ee[1],ae=(0,x.useState)([]),ie=m()(ae,2),re=ie[0],ce=ie[1],se=(0,x.useState)("C"),le=m()(se,2),ue=le[0],de=le[1],me=(0,x.useReducer)(We,$e),be=m()(me,2),ke=be[0],we=be[1],Se=ke.loading,Ne=ke.data,Ce=ke.user,Ze=(ke.status,null==Ne?void 0:Ne.hack_sets),Te=null==Ne||null===(e=Ne.hack)||void 0===e?void 0:e.test_set_average,Ee=(0,x.useState)(!1),Pe=m()(Ee,2),Ae=Pe[0],Le=Pe[1],Re=(0,x.useRef)([]),Oe=(0,x.useState)(!1),Fe=m()(Oe,2),De=Fe[0],Me=Fe[1],Ve=(0,x.useState)(!1),Be=m()(Ve,2),He=Be[0],Xe=Be[1],Ye=(0,x.useRef)(!0),Ue=(0,x.useState)({}),Qe=m()(Ue,2),nn=Qe[0],tn=Qe[1];(0,x.useEffect)((function(){return(0,pe.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!1}),(0,pe.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),function(){(0,pe.getDvaApp)()._store.dispatch({type:"globalSetting/headerFooterToggle",payload:!0}),(0,pe.getDvaApp)()._store.dispatch({type:"globalSetting/onlyShowBackTopToggle",payload:!1})}}),[]),(0,x.useEffect)((function(){setTimeout((function(){document.title="在线刷题"}),400)}));var an=function(){var e=f()(d()().mark((function e(){var n,t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,ge.ZP)("/api/tag_disciplines.json",{method:"get",params:{target:"practice"}});case 2:return n=e.sent,e.next=5,(0,ge.ZP)("/api/tag_disciplines.json",{method:"get",params:{target:"practice_source"}});case 5:t=e.sent,F(n.tag_disciplines||[]),q(t.tag_disciplines||[]);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),rn=[{language:"C",code:""},{language:"C++",code:""},{language:"Java",code:""},{language:"Python",code:""}],cn=(0,x.useCallback)(f()(d()().mark((function e(){var n,t,i,c,s,o,l,p,f,h,m,v,x,_,j,y,b,k,w,S,N,C,Z,T;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(we({type:Je.SET_LOADING,payload:!0}),!a){e.next=19;break}return e.next=4,_e(a);case 4:n=e.sent,t=n.user,n.language,i=n.practice_sets,c=n.practice_codes,s=n.description,o=n.difficulty,l=n.name,p=n.open_or_not,f=n.time_limit,h=n.test_set_average,m=n.test_set_score,v=n.status,x=n.tag_discipline_ids,_=n.source_discipline_ids,n.item_banks_group_id,j=n.is_file,y=void 0!==j&&j,b=n.hide_actual_output,k=n.review_privilege,w=n.review_description,tn({review_privilege:k,status:v,review_description:w,name:l}),Le(b),S=y?[{input:"",output:"",score:100,position:1}]:i,y?(P(i),r.setFieldsValue({hack_sets:S})):P([]),N={loading:!0,user:t,status:v,data:{hack:{difficulty:o,name:l,description:s,open_or_not:p,time_limit:f,test_set_average:h,test_set_score:m,tag_discipline_ids:x,source_discipline_ids:_,is_file:y},hack_sets:S}},we({type:Je.SET_INITAL_DATA,payload:N}),u({hack:{difficulty:o,name:l,description:s,open_or_not:p,time_limit:f,test_set_average:h,test_set_score:m,tag_discipline_ids:x,source_discipline_ids:_,is_file:y}}),C=null==c?void 0:c.map((function(e){return g()(g()({},e),{},{code:fe.Base64.decode(null==e?void 0:e.code)})})),ce(C),Re.current=C,e.next=27;break;case 19:return e.next=21,(0,ge.U2)("problems/new.json");case 21:Z=e.sent,T=Z.user,we({type:Je.SET_INITAL_DATA,payload:{loading:!0,status:0,user:T,data:{hack:{difficulty:"",time_limit:3,description:"#### 题目描述\n现有一个整型数组 `nums`,请编写程序将数组 `nums` 中的所有 `$$0$$` 移动到数组的末尾,但不改变非零元素在数组中的相对位置。请在原数组 `nums` 上进行操作。\n#### 输入输出格式\n**输入格式**\n第一行有一个整数 `numsSize`,表示数组 `nums` 的大小;\n第二行有 `numsSize` 个整数,表示数组 `nums` 的所有元素,每个整数用一个空格隔开。\n**输出格式**\n一行输出数组 `nums` 的所有元素,有 `numsSize` 个整数,每个整数用一个空格隔开。\n#### 输入输出样例1\n**输入**\n`4`\n`0 1 2 3`\n**输出**\n`1 2 3 0`\n**解释(可选)**\nXXXXX\n#### 输入输出样例2\n**输入**\n`5`\n`1 1 0 1 0`\n**输出**\n`1 1 1 0 0`\n**解释(可选)**\nXXXXX\n#### 说明提示\n-`1≤n≤100`",test_set_score:!0,test_set_average:!0,open_or_not:!0,name:"",is_file:!1},hack_sets:[{input:"",output:"",score:100,position:1}]}}}),u({hack:{difficulty:"",time_limit:3,description:"",test_set_average:!0,open_or_not:!0,name:"",is_file:!1}}),ce(rn),Re.current=rn;case 27:we({type:Je.SET_LOADING,payload:!1});case 28:case"end":return e.stop()}}),e)}))),[a]);function sn(){return sn=f()(d()().mark((function e(n,t){var i,r,c,s,o,u,p,f,h,m,v,x,_,y,b,k,w,S;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=g()({},n),c=r.hack_sets,(s=r.hack).hide_actual_output=Ae,o=[],u=[],p=0,f=null!=s&&s.is_file?E.map((function(e,n){return g()(g()({},e),{},{position:n+1})})):c.map((function(e){return g()(g()({},e),{},{is_file:!1})})),h=l()(f);try{for(h.s();!(m=h.n()).done;)v=m.value,p+=v.score,v.id&&v.id>=0?o.push(v):u.push(v)}catch(e){h.e(e)}finally{h.f()}if(null!=f&&f.length){e.next=11;break}return Y.ZP.error("测试集不能为空"),e.abrupt("return");case 11:if(100===p||s.test_set_score){e.next=14;break}return Y.ZP.error("测试集的评分占比之和必须等于100"),e.abrupt("return");case 14:if(null==f||!f.some((function(e){return!e.output}))){e.next=17;break}return Y.ZP.error("测试集输出不能为空"),e.abrupt("return");case 17:if(Ye.current?Me(!0):Xe(!0),_=null==re?void 0:re.map((function(e){return g()(g()({},e),{},{code:fe.Base64.encode(null==e?void 0:e.code)})})),!a){e.next=25;break}return e.next=22,je(a,{practice:s,practice_codes:_,practice_sets:u,update_practice_sets:o});case 22:x=e.sent,e.next=28;break;case 25:return e.next=27,xe({practice:s,practice_codes:_,practice_sets:f,publish:!Ye.current});case 27:x=e.sent;case 28:if(Me(!1),Xe(!1),0!==(null===(i=x)||void 0===i?void 0:i.status)){e.next=46;break}if(null===(y=x)||void 0===y||null===(b=y.similar_practice)||void 0===b||!b.length){e.next=35;break}return j(!0),te(null===(k=x)||void 0===k?void 0:k.similar_practice),e.abrupt("return");case 35:if(!a){e.next=44;break}if(Y.ZP.success("保存成功"),Ye.current){e.next=42;break}return e.next=40,(0,ge.ZP)("/api/practices/".concat(a,"/start"),{method:"get"});case 40:0===(null==(w=e.sent)?void 0:w.status)&&pe.history.push("/problems/".concat(null==w?void 0:w.identifier,"/oj/").concat(a));case 42:e.next=46;break;case 44:Y.ZP.success("新建成功"),pe.history.replace("/problems/".concat(null===(S=x)||void 0===S?void 0:S.identifier,"/ojedit"));case 46:case"end":return e.stop()}}),e)}))),sn.apply(this,arguments)}function on(){pe.history.replace("/problems")}(0,x.useEffect)((function(){try{cn(),an()}catch(e){console.log(e,"----")}}),[]);var ln=function(e){var n=Math.floor(100/e.length),t=n+100%e.length;e=e.map((function(a,i){return i===e.length-1?g()(g()({},a),{},{score:t}):g()(g()({},a),{},{score:n})})),P(e)};(0,x.useEffect)((function(){if(Te){var e=null==Ze?void 0:Ze.length,n=Math.floor(100/e),t=100%e;null==Ze||Ze.map((function(a,i){return a.score=n,a.position=i+1,i===e-1&&(a.score=n+t),a})),we({type:Je.SET_INITAL_DATA,payload:{data:g()(g()({},Ne),{},{hack_sets:Ze})}}),r.setFieldsValue({hack_sets:Ze})}}),[Te]);var un=function(){var e=f()(d()().mark((function e(n){var t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,ge.ZP)("/api/practices/".concat(n,"/start"),{method:"get"});case 2:0===(null==(t=e.sent)?void 0:t.status)&&(0,Ge.xg)("/problems/".concat(null==t?void 0:t.identifier,"/oj/").concat(n));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),dn=function(){var e=f()(d()().mark((function e(){var n,t,i,r,c;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_e(a);case 2:n=e.sent,t=n.name,i=n.status,r=n.review_privilege,c=n.review_description,tn({review_privilege:r,status:i,review_description:c,name:t});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),pn=function(){var e=f()(d()().mark((function e(){return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:G.Z.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"提示",content:"确认将题目《".concat(null==nn?void 0:nn.name,"》的审核通过吗?"),okText:"确认",cancelText:"取消",onOk:function(){var e=f()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,ge.ZP)("/api/practices/".concat(a,"/review.json"),{method:"post",body:{op:"pass"}});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(Y.ZP.success("提交成功"),dn());case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,oe.jsxs)(J.Z,{spinning:Se,size:"large",className:B,children:[Ne?(0,oe.jsxs)(x.Fragment,{children:[(0,oe.jsxs)("header",{className:_,children:[(0,oe.jsxs)("div",{children:[(0,oe.jsx)("img",{src:"".concat(ze.Z.IMG_SERVER,"/images/").concat(null==Ce?void 0:Ce.image_url),alt:"user",width:30}),(0,oe.jsx)("span",{children:null==Ce?void 0:Ce.name})]}),(0,oe.jsxs)("h2",{children:[" ",null==Ne||null===(n=Ne.hack)||void 0===n?void 0:n.name," "]}),a?(0,oe.jsxs)("a",{className:A,onClick:on,children:[" ",(0,oe.jsx)(he.Z,{}),"退出"]}):null]}),(0,oe.jsxs)(X.Z,{form:r,initialValues:Ne,layout:"vertical",className:y,onValuesChange:function(e){u(g()({},r.getFieldsValue()))},onFinish:function(e,n){return sn.apply(this,arguments)},children:[(0,oe.jsx)(ye.Z,{hideResize:!0,className:R,leftChild:(0,oe.jsx)(en,{formValue:o,onRemoveTestCase:function(e){var n=r.getFieldValue("hack_sets"),t=(null==n?void 0:n.length)-1,a=Math.ceil(100/t),i=100%t;n.splice(e,1),null==n||n.map((function(e,n){return Te&&(e.score=a,n===t-1&&(e.score=a+i)),e.position=n+1,e})),we({type:Je.SET_INITAL_DATA,payload:{data:g()(g()({},Ne),{},{hack_sets:n})}}),r.setFieldsValue({hack_sets:n})},onAddTestCase:function(){var e=r.getFieldValue("hack_sets"),n=e.length+1,t=Math.floor(100/n),a=100%n;e.map((function(e,n){return Te&&(e.score=t),e.position=n+1,e})),e.push({input:"",output:"",position:n,score:Te?t+a:0}),r.setFieldsValue({hack_sets:e}),we({type:Je.SET_INITAL_DATA,payload:{data:g()(g()({},Ne),{},{hack_sets:e})}})},hack:Ne.hack,onChangeScore:function(e){e.target.value||ln(E),we({type:Je.SET_INITAL_DATA,payload:{data:g()(g()({},Ne),{},{hack:g()(g()({},Ne.hack),{},{test_set_score:e.target.value})})}})},onChangehide:function(e){Le(e.target.checked)},onChangeAverage:function(e){var n=e.target.value;n&&ln(E),we({type:Je.SET_INITAL_DATA,payload:{data:g()(g()({},Ne),{},{hack:g()(g()({},Ne.hack),{},{test_set_average:n})})}})},onChangeFile:function(e){we({type:Je.SET_INITAL_DATA,payload:{data:g()(g()({},Ne),{},{hack:g()(g()({},Ne.hack),{},{is_file:e.target.value})})}})},uploadData:E,setUploadData:P,handleUploadRatio:ln,ischecked:Ae,pointData:O,sourceData:V,getPointData:an}),rightChild:(0,oe.jsx)(Ie,{value:null==re||null===(t=re.find((function(e){return e.language===ue})))||void 0===t?void 0:t.code,onChange:function(e){var n,t=null===(n=Re.current)||void 0===n?void 0:n.findIndex((function(e){return e.language===ue}));Re.current[t].code=e,ce(Re.current)},onLanguage:function(e){de(e)},languageItems:re,language:ue})}),(0,oe.jsxs)("div",{className:w,children:[!!a&&(0,oe.jsxs)("div",{className:S,children:[(0,oe.jsx)("span",{children:"审核结果:"}),null!=nn&&nn.review_privilege?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)("div",{onClick:pn,className:Z,children:"通过"}),(0,oe.jsx)("div",{onClick:function(){var e,n="";G.Z.confirm({icon:null,width:700,className:"custom-modal-divider",centered:!0,title:"不通过原因",content:(0,oe.jsx)("div",{className:"mt20",children:(0,oe.jsx)(ve.Z,{className:H,defaultValue:n,onChange:function(e){n=e}})}),okText:"确认",cancelText:"取消",onOk:(e=f()(d()().mark((function e(){var t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=3;break}return Y.ZP.warning("不通过原因不能为空"),e.abrupt("return",Promise.reject());case 3:return e.next=5,(0,ge.ZP)("/api/practices/".concat(a,"/review.json"),{method:"post",body:{op:"fail",description:n}});case 5:0===(null==(t=e.sent)?void 0:t.status)&&(Y.ZP.success("提交成功"),dn());case 7:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})},className:T,children:"不通过"})]}):(0,oe.jsxs)(oe.Fragment,{children:[0===(null==nn?void 0:nn.status)&&(0,oe.jsxs)("div",{className:N,children:[(0,oe.jsx)("i",{className:"iconfont icon-tongguo"}),"未发布"]}),1===(null==nn?void 0:nn.status)&&(0,oe.jsxs)("div",{className:N,children:[(0,oe.jsx)("i",{className:"iconfont icon-tongguo"}),"已公开"]}),2===(null==nn?void 0:nn.status)&&(0,oe.jsxs)("div",{className:N,children:[(0,oe.jsx)("i",{className:"iconfont icon-tongguo"}),"未审批"]}),3===(null==nn?void 0:nn.status)&&(0,oe.jsxs)("div",{className:N,children:[(0,oe.jsx)("i",{className:"iconfont icon-tongguo"}),"审核中"]}),4===(null==nn?void 0:nn.status)&&(0,oe.jsxs)("div",{className:N,children:[(0,oe.jsx)("i",{className:"iconfont icon-tongguo"}),"审核完成待公开"]}),5===(null==nn?void 0:nn.status)&&(0,oe.jsxs)("div",{className:C,children:[(0,oe.jsx)("i",{className:"iconfont icon-weitongguo1"}),"审核不通过",(0,oe.jsx)("span",{onClick:function(){var e=G.Z.confirm({icon:null,width:700,className:"".concat(z," custom-modal-divider"),centered:!0,title:(0,oe.jsxs)(U.Z,{children:[(0,oe.jsx)($.Z,{flex:"1",children:"不通过原因"}),(0,oe.jsx)($.Z,{children:(0,oe.jsx)("span",{className:"iconfont icon-guanbi7 font12 current c-grey-c",onClick:function(){return e.destroy()}})})]}),content:(0,oe.jsx)("div",{children:(0,oe.jsx)(Ke.Z,{className:"mt20",value:(null==nn?void 0:nn.review_description)||""})})})},children:"查看原因"})]})]})]}),(0,oe.jsx)(W.ZP,{type:"primary",ghost:!0,onClick:on,children:"退出编辑"}),(0,oe.jsx)(W.ZP,{disabled:He,loading:De,type:"primary",onClick:function(){Ye.current=!0,r.submit()},children:"保存 "}),a?(0,oe.jsx)(W.ZP,{disabled:De,loading:He,style:{background:"#2FC25B",border:0},type:"primary",onClick:function(){Ye.current=!1,r.submit()},children:"立即体验"}):(0,oe.jsx)(W.ZP,{disabled:De,loading:He,type:"primary",onClick:function(){Ye.current=!1,r.submit()},children:"保存并发布审核"})]})]})]}):null,(0,oe.jsx)(G.Z,{centered:!0,destroyOnClose:!0,footer:null,open:v,onCancel:function(){return j(!1)},title:"相似性检测",width:"600px",children:(0,oe.jsxs)("div",{children:[(0,oe.jsx)("p",{className:"font14",children:"经系统检测发现,本题目与系统中已创建的题目高度雷同,请调整题目后再进行保存"}),(0,oe.jsx)(Q.Z,{dataSource:ne,bordered:!1,scroll:ne.length>7?{y:300}:{},columns:[{title:"相似题题目",dataIndex:"name",ellipsis:!0,render:function(e,n){return(0,oe.jsx)("span",{onClick:function(){return un(null==n?void 0:n.identifier)},style:{textDecorationLine:"underline"},className:"current c-light-primary",children:e})}},{title:"创建时间",dataIndex:"create_time",width:170,render:function(e){var n;return null===(n=qe()(e))||void 0===n?void 0:n.format("YYYY-MM-DD HH:mm")}}],pagination:!1})]})})]})};function en(e){var n,t,a,i=e.ischecked,c=e.formValue,o=e.hack,l=e.onChangeAverage,u=e.onChangeScore,p=e.onChangehide,h=e.onChangeFile,v=e.onAddTestCase,_=e.onRemoveTestCase,y=e.uploadData,w=e.setUploadData,S=e.handleUploadRatio,N=e.pointData,C=e.sourceData,Z=e.getPointData,T=o.test_set_average,A=o.test_set_score,R=(0,x.useState)(!1),z=m()(R,2),B=z[0],H=z[1],Y=(0,x.useState)(!1),U=m()(Y,2),$=U[0],J=U[1];function Q(e){e.stopPropagation()}return(0,oe.jsxs)("div",{className:b,children:[(0,oe.jsxs)("div",{className:k,children:[(0,oe.jsx)(X.Z.Item,{label:"题目名称",name:["hack","name"],rules:[{required:!0,message:"请输入题目名称"}],className:V,children:(0,oe.jsx)(q.Z,{bordered:!1,maxLength:60,placeholder:"请输入题目名称",suffix:(0,oe.jsxs)("span",{children:[(null==c||null===(n=c.hack)||void 0===n||null===(t=n.name)||void 0===t?void 0:t.length)||0,"/",(0,oe.jsx)("span",{className:"c-grey-999",children:"60"})]})})}),(0,oe.jsx)(X.Z.Item,{name:["hack","description"],valuePropName:"defaultValue",rules:[{required:!0,message:"请输入描述内容"}],children:(0,oe.jsx)(ve.Z,{placeholder:"请输入题目描述…",miniToolbar:!0,id:"moop_cases_content",noStorage:!0,height:200})}),(0,oe.jsxs)("div",{className:O,children:[(0,oe.jsx)("div",{className:F,children:(0,oe.jsx)(X.Z.Item,{label:"难易度",name:["hack","difficulty"],rules:[{required:!0,message:"请选择难易度"}],children:(0,oe.jsx)(ee.Z,{children:(a=ue.difficulty,de[a].map((function(e){return(0,oe.jsxs)(le,{value:e.key,children:[" ",e.title," "]},e.title)})))})})}),(0,oe.jsxs)("div",{className:D,children:[(0,oe.jsx)(X.Z.Item,{label:"题目来源",name:["hack","source_discipline_ids"],children:(0,oe.jsx)(ee.Z,{placeholder:"选择题目来源",showSearch:!1,mode:"multiple",showArrow:!0,getPopupContainer:function(e){return e.parentNode},children:C.map((function(e){return(0,oe.jsx)(ee.Z.Option,{value:e.id,children:e.name},e.id)}))})}),(0,oe.jsx)(W.ZP,{style:{padding:"0 18px"},type:"primary",ghost:!0,onClick:function(){return function(){if((0,Xe.Ny)())J("practice_source");else{var e,n="";G.Z.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"新建来源",content:(0,oe.jsx)("div",{children:(0,oe.jsx)(q.Z,{placeholder:"请输入来源名称,不超过20个字",maxLength:20,onChange:function(e){n=e.target.value}})}),okText:"确认",cancelText:"取消",onOk:(e=f()(d()().mark((function e(){var t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,ge.ZP)("/api/tag_disciplines.json",{method:"post",body:{target:"practice_source",name:n}});case 2:0===(null==(t=e.sent)?void 0:t.status)&&Z();case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})}}()},children:(0,Xe.Ny)()?"来源管理":"新建来源"})]})]}),(0,oe.jsx)("div",{className:O,children:(0,oe.jsxs)("div",{className:D,style:{width:"100%",marginLeft:0},children:[(0,oe.jsx)(X.Z.Item,{label:"知识点",rules:[{required:!0,message:"请选择知识点"}],name:["hack","tag_discipline_ids"],children:(0,oe.jsx)(ee.Z,{placeholder:"选择知识点",showSearch:!1,mode:"multiple",showArrow:!0,getPopupContainer:function(e){return e.parentNode},children:N.map((function(e){return(0,oe.jsx)(ee.Z.Option,{value:e.id,children:e.name},e.id)}))})}),(0,oe.jsx)(W.ZP,{type:"primary",ghost:!0,onClick:function(){return function(){if((0,Xe.Ny)())J("practice");else{var e,n="";G.Z.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"新建知识点",content:(0,oe.jsx)("div",{children:(0,oe.jsx)(q.Z,{placeholder:"请输入知识点名称,不超过20个字",maxLength:20,onChange:function(e){n=e.target.value}})}),okText:"确认",cancelText:"取消",onOk:(e=f()(d()().mark((function e(){var t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,ge.ZP)("/api/tag_disciplines.json",{method:"post",body:{target:"practice",name:n}});case 2:0===(null==(t=e.sent)?void 0:t.status)&&Z();case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})}}()},children:(0,Xe.Ny)()?"知识点管理":"新建知识点"})]})}),(0,oe.jsx)("div",{className:j,children:(0,oe.jsx)(X.Z.Item,{label:"单个测试集评测时长限制",name:["hack","time_limit"],rules:[{required:!0,message:"请输入单个测试集评测时长限制"},{type:"number",min:3,message:"最小限制时间是3秒"}],className:M,extra:(0,oe.jsxs)("span",{style:{position:"absolute",left:200,top:11,color:"#333"},children:["秒",(0,oe.jsx)("span",{className:"ml5 c-grey-999",children:"(代码执行所允许的最大时长)"})]}),children:(0,oe.jsx)(ne.Z,{style:{width:185},min:3})})}),(0,oe.jsxs)("div",{className:"tst-case-info",children:[(0,oe.jsxs)("h3",{className:"flex-container",style:{justifyContent:"space-between"},children:[" ","测试用例与系统评分规则",!o.is_file&&(0,oe.jsx)(W.ZP,{style:{height:40},type:"primary",ghost:!0,onClick:v,children:"添加测试用例"})]}),(0,oe.jsx)(X.Z.Item,{name:["hack","test_set_score"],children:(0,oe.jsxs)(te.ZP.Group,{onChange:u,children:[(0,oe.jsxs)(te.ZP,{value:!0,children:["通过全部测试集",(0,oe.jsxs)("span",{className:"tip",children:[" ","(学员评测,仅当所有测试集都正确时,才获得一次性奖励)"]})]}),(0,oe.jsxs)(te.ZP,{value:!1,children:["通过部分测试集",(0,oe.jsxs)("span",{className:"tip",children:[" ","(学员评测,通过测试集即可获得对应奖励)"]})]})]})}),(0,oe.jsx)(ae.Z,{style:{marginBottom:"5px"},checked:i,onChange:p,children:"隐藏实际输出 (选中,则在学生做题过程中无法看到实际输出结果,仅展示是否评测是否通过)"}),(0,oe.jsx)(X.Z.Item,{className:I,name:["hack","is_file"],label:"用例类型:",children:(0,oe.jsx)(te.ZP.Group,{onChange:h,children:(0,oe.jsxs)(ie.Z,{direction:"horizontal",children:[(0,oe.jsx)(te.ZP,{value:!1,children:"文本"}),(0,oe.jsx)(te.ZP,{value:!0,children:"文件"})]})})}),!o.test_set_score&&(0,oe.jsx)(X.Z.Item,{name:["hack","test_set_average"],label:"系统评分占比",children:(0,oe.jsxs)(te.ZP.Group,{onChange:l,children:[(0,oe.jsx)(te.ZP,{value:!0,children:"均分比例"}),(0,oe.jsx)(te.ZP,{value:!1,children:"自定义比例"})]})}),o.is_file&&(0,oe.jsxs)("div",{className:L,children:[(0,oe.jsx)(W.ZP,{ghost:!0,type:"primary",className:"mb20",onClick:function(){return H(!0)},children:"批量上传测试用例"}),(0,oe.jsx)(Be.Y2,{disabled:null==o?void 0:o.test_set_average,inputChange:function(e,n){console.log(e,n);var t=y.map((function(t,a){return a===n?g()(g()({},t),{},{score:e.target.value?Number(e.target.value):0}):t}));w(t)},showScore:!o.test_set_score,data:y,onRemove:function(e,n){var t=s()(y);t.splice(n,1),T?S(t):w(t)}})]}),!o.is_file&&(0,oe.jsx)(X.Z.List,{name:"hack_sets",children:function(e,n){return r()(n),(0,oe.jsx)(K.Z,{accordion:!0,children:e.map((function(e,n){return(0,oe.jsxs)(Ue,{header:(0,oe.jsxs)("a",{className:E,children:[(0,oe.jsxs)("span",{children:["测试用例",n+1]}),A?null:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(X.Z.Item,{name:[e.name,"score"],fieldKey:[e.fieldKey,"score"],rules:[{required:!0,message:"请输入测试集".concat(n+1,"评分")}],children:(0,oe.jsx)(ne.Z,{onClick:Q,min:0,max:100,disabled:T})}),(0,oe.jsx)("span",{children:"%"})]})]}),extra:n>0?(0,oe.jsx)("div",{onClick:Q,children:(0,oe.jsx)(re.Z,{okText:"确定",cancelText:"取消",title:"确定删除测试集\b"+(n+1),onConfirm:function(){_(n)},children:(0,oe.jsx)(me.Z,{className:P})})}):null,children:[(0,oe.jsx)(X.Z.Item,{label:"输入",name:[e.name,"input"],fieldKey:[e.fieldKey,"input"],children:(0,oe.jsx)(Ye,{})}),(0,oe.jsx)(X.Z.Item,{label:"输出",name:[e.name,"output"],fieldKey:[e.fieldKey,"output"],rules:[{required:!0,message:"请输入输出内容"}],children:(0,oe.jsx)(Ye,{})})]},"".concat(e.key,"--").concat(n))}))})}})]})]}),(0,oe.jsx)(Be.ZP,{rootIdentifier:null,visible:B,onClose:function(){return H(!1)},onOK:function(e){var n=y.concat(e);o.test_set_average?S(n):w(n)}}),(0,oe.jsx)(Ve,{visible:$,onCancel:function(){J(!1),Z()},onOK:function(){J(!1),Z()}})]})}},63778:function(e,n,t){t.d(n,{G:function(){return c},t:function(){return r}});var a=t(58971),i=t.n(a);function r(e,n){var t=i().get("__ec");t||(t={}),t[e]=n,i().set("__ec",t)}function c(e,n){var t=i().get("__ec");return t?void 0===t[e]?n:t[e]:n}},12867:function(){}}]); |