|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[34741,79462],{78988: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 s(e,n,t){var a;return function(){var i=this,r=arguments,s=function(){a=null,t||e.apply(i,r)},c=t&&!a;clearTimeout(a),a=setTimeout(s,n),c&&e.apply(i,r)}}t.d(n,{Ax:function(){return r},Ds:function(){return s},KI:function(){return c},SI:function(){return i},f1:function(){return a}});var c=t(91689).Z.API_SERVER},10615:function(e,n,t){t.d(n,{Z:function(){return x}});var a=t(82242),i=t.n(a),r=t(7557),s=t.n(r),c=t(41498),l=t.n(c),o=t(79800),u=t.n(o),d=t(59301),p=t(17574),f="folderWrapper___G__0a",h="folderIcon___oTG6c",m=t(73631),_=t(5623),v=t(32701),g=t(37712),x=function(e){var n=e.value,t=e.onChange,a=e.scrollId,r=(0,d.useState)([]),c=u()(r,2),o=c[0],x=c[1];(0,d.useEffect)((function(){y()}),[]);var y=function(){var e=l()(s()().mark((function e(){var n,t;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.NZ)({});case 2:null!=(n=e.sent)&&n.data&&(t=[{title:"根目录",value:0,key:0,icon:(0,g.jsx)("img",{src:m,className:h}),isLeaf:!1,children:b(n.data||[])}],x(t));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=function e(n){return n.map((function(n){return{title:n.name,key:n.group_id,icon:(0,g.jsx)("img",{src:m,className:h}),isLeaf:0===n.children.length,children:e(n.children)}}))},j=function e(n,t,a){return n.map((function(n){return n.key===t?i()(i()({},n),{},{icon:a?(0,g.jsx)("img",{src:_,className:h}):(0,g.jsx)("img",{src:m,className:h})}):n.children?i()(i()({},n),{},{children:e(n.children,t,a)}):void 0}))},k=n?{selectedKeys:n,defaultExpandedKeys:n}:{};return o.length>0&&(0,g.jsx)("div",{id:a||"",children:(0,g.jsx)(p.Z,i()({showLine:{showLeafIcon:!1},showIcon:!0,treeData:o,className:f,onSelect:t,onExpand:function(e,n){x((function(e){return j(e,n.node.key,n.expanded)}))}},k))})}},52058:function(e,n,t){t.d(n,{N:function(){return C}});var a=t(7557),i=t.n(a),r=t(41498),s=t.n(r),c=t(37205),l=t.n(c),o=t(79800),u=t.n(o),d=t(59301),p=t(57809),f=t(43418),h=t(95237),m=t(43604),_=t(10249),v=t(8591),g=t(94171),x="wrap___F7E3F",y="selectWrapper____kESB",b="tips___aHjQY",j="linkBtn___uggVr",k="mainText____S1I0",S=t(87169),w=t(37712),N=p.default.Option,C=function(e){var n=e.subId,t=e.value,a=e.selectvalues,r=e.disabled,c=e.knowledgeOptions,o=void 0===c?[]:c,C=e.onChange,A=void 0===C?function(){}:C,Z=e.onAddKnowledgeFinish,I=void 0===Z?function(){}:Z,T=(0,d.useRef)(),E=(0,d.useState)([]),F=u()(E,2),P=F[0],L=F[1];t=t||[];(0,d.useEffect)((function(){(null==a?void 0:a.length)>0&&(L(l()(a)),A(l()(a)))}),[o]),(0,d.useEffect)((function(){var e;(null===(e=t)||void 0===e?void 0:e.length)>0&&A(l()(t))}),[o]);return(0,w.jsxs)(h.Z,{wrap:!1,align:"middle",className:x,children:[(0,w.jsx)(m.Z,{children:(0,w.jsx)(p.default,{disabled:!n||r,className:y,placeholder:"请选择知识点",onChange:function(e,n){e?(L([n.key]),A([n.key])):(L([]),A([]))},style:{width:490},showSearch:!0,allowClear:!0,value:null==o?void 0:o.filter((function(e){return(null==P?void 0:P.includes(null==e?void 0:e.id))||(null==P?void 0:P.includes((null==e?void 0:e.id)+""))})).map((function(e){return e.name})),children:null==o?void 0:o.map((function(e){return(0,w.jsx)(N,{value:e.name,children:(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,w.jsx)("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:e.name}),(0,w.jsx)("span",{children:"personal"===e.type?"(自用)":""})]})},e.id)}))})}),n&&(0,w.jsxs)(m.Z,{className:"ml20",children:[(0,w.jsx)("span",{className:b,children:"没有合适的知识点?"}),(0,w.jsx)("span",{className:j,onClick:function(e){e.preventDefault(),T.current="",f.Z.confirm({centered:!0,width:640,okText:"确定",cancelText:"取消",icon:null,title:"新建知识点",className:"custom-modal-divider",content:(0,w.jsxs)("div",{className:"font14",children:[(0,w.jsxs)(h.Z,{className:"mb20",children:[(0,w.jsx)(m.Z,{children:(0,w.jsx)(S.Z,{style:{color:"#FF8C29"}})}),(0,w.jsxs)(m.Z,{className:"ml10 ".concat(k),children:["新建的知识点仅本人可见,平台审核列入公开知识点后,对所有用户可见。",(0,w.jsx)("br",{}),"平台有权删除不合适的知识点,请认真填写知识点名称。"]})]}),(0,w.jsx)(_.Z,{maxLength:20,size:"middle",showCount:!0,placeholder:"请输入知识点名称",defaultValue:T.current,onChange:function(e){T.current=e.target.value}})]}),onOk:function(){return new Promise(function(){var e=s()(i()().mark((function e(t,a){var r,s;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(T.current){e.next=3;break}return v.ZP.warning("请输入知识点名称"),e.abrupt("return",a());case 3:if(!(T.current.length>20)){e.next=6;break}return v.ZP.warning("请输入不超过20字的知识点名称"),e.abrupt("return",a());case 6:return e.next=8,(0,g.ZP)("/api/tag_disciplines.json",{method:"post",body:{name:T.current,sub_discipline_id:n}});case 8:return 0===(null==(r=e.sent)?void 0:r.status)&&(I({id:r.tag_discipline_id,name:T.current,type:"personal"}),(s=[]).push(r.tag_discipline_id),A([].concat(s)),L([r.tag_discipline_id]),A([].concat(s))),e.abrupt("return",t());case 11:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}())}})},children:"新建知识点"})]})]})}},58605:function(e,n,t){t.d(n,{h:function(){return p},x:function(){return f}});var a=t(82242),i=t.n(a),r=t(39647),s=t.n(r),c=t(59081),l=t(69092),o=(t(59301),t(71212)),u=t(37712),d=["value","onChange","scrollId"],p=function(e){var n=e.value,t=e.onChange,a=e.scrollId,r=s()(e,d);return(0,u.jsx)("div",{id:a||"",children:(0,u.jsx)(c.Z,i()(i()({},r),{},{hidetoolBar:!0,defaultValue:n,onChange:function(e,n){console.log("a:",e,n),null!=n&&n.length?t(e,n):t(e)}}))})},f=function(e){var n=e.value,t=e.onChange,a=e.placeholder,i=e.height,r=void 0===i?140:i;return e.isEdit?(0,u.jsx)(c.Z,{watch:!0,isFocus:!0,height:r,placeholder:a,defaultValue:n,onChange:t}):(0,u.jsx)("div",{style:{cursor:"pointer"},children:n?(0,u.jsx)(o.Z,{className:l.Z.inputBorder,value:n}):(0,u.jsx)("div",{className:"".concat(l.Z.inputBorder," ").concat(l.Z.placeholder),children:a})})}},71212:function(e,n,t){t.d(n,{Z:function(){return H}});var a=t(82242),i=t.n(a),r=t(37205),s=t.n(r),c=t(91232),l=t.n(c),o=t(79800),u=t.n(o),d=t(59301),p=(t(88831),t(32834)),f=t.n(p),h=t(11690);var m=[],_=["<ul>"],v=new(f().Renderer),g=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function x(){m.length=0,_=["<ul>"]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(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=b(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=b(e,n,t,a)}function j(){return b(m,0,0,_),_.push("</ul>"),_.join("")}var k={heading:function(e){var n=g.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(),s=a;a=r,C[r]={type:"block",expression:s}}return{type:"code",raw:t,lang:i,text:a}}}},S=/(?:\${2})([^\n`]+?)(?:\${2})/gi,w=0,N=function(){return"__special_katext_id_".concat(w++,"__")},C={};function A(){return C}function Z(){w=0,C={}}function I(e){return e=e.replace(S,(function(e,n){var t=N();return C[t]={type:"inline",expression:n},t}))}var T=v.listitem;v.listitem=function(e){return T(I(e))};var E=v.paragraph;v.paragraph=function(e){return E(I(e))};var F=v.tablecell;v.tablecell=function(e,n){return F(I(e),n)},v.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>"},v.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:v});var P=f(),L=(t(64018),t(44523)),R=t(91689),B=t(15342),V=t(1012),O=t(32831),D=t(37712),M="@▁@",W=/<pre[^>]*>/g;var H=function(e){var n=e.value,t=void 0===n?"":n,a=e.className,r=e.showTextOnly,c=e.showLines,o=e.style,p=void 0===o?{}:o,f=e.stylesPrev,h=void 0===f?{}:f,m=e.highlightKeywords,_=e.showProgramFill,v=(e.isProgramFill,e.disabledFill),g=void 0!==v&&v,b=e.programFillValue,k=e.onFillChange,S=void 0===k?function(e){}:k,w=e.onFillBlur,N=void 0===w?function(){}:w,C=String(t),I=(0,d.useState)(""),T=u()(I,2),E=T[0],F=T[1],H=(0,d.useState)("office"),z=u()(H,2),q=z[0],U=z[1],G=(0,d.useState)([]),Y=u()(G,2),K=Y[0],J=Y[1],Q=(0,d.useRef)("a"+(0,V.Z)()),X={},$=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(Q.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,"("+R.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+R.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+R.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(_){var e=-1;return C=C.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,(function(n,t,a){return function(e,n){var t=document.createElement(e===M?"input":"textarea");t.style.width="100%",t.style.height=e===M?"40px":"151px",t.rows=5,t.spellcheck=!1,t.name="edu-program-fill",t.placeholder="请输入",t.dataset.id=n;var a=Object.keys(X).length;return X[a]=t,'<span class="edu-program-fill-wrap '.concat(e===M?"":"show",'" style="width:').concat(e===M?"200px":"100%",'"><span>').concat(t.outerHTML,'<span class="edu-program-fill-score"></span></span></span>')}(n,++e)})),'<pre style="background:#fff;padding:4px">'.concat($(C||""),"</pre>")}var n=P(C);n=$(n);var t=A();C.match(/\[TOC\]/)&&(n=n.replace("<p>[TOC]</p>",j()),x()),n=n.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var a=t[n],i=a.type,r=a.expression;return(0,B.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,"▁▁▁"),Z();var a=document.createElement("div");return a.innerHTML=n,m?(ae(a,m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a.innerHTML):r?a.innerText:(setTimeout((function(){return se()}),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}))}),[K]),(0,d.useEffect)((function(){if(null!=b&&b.length){var e,n=ie.current.querySelectorAll(".edu-program-fill-score"),t=ie.current.querySelectorAll('[name="edu-program-fill"]'),a=l()(t.entries());try{for(a.s();!(e=a.n()).done;){var i,r=u()(e.value,2),s=r[0],c=r[1];c.value=null===(i=b[s])||void 0===i?void 0:i.value,"warning"===b[s].type?c.className="program-fill-warning":"success"===b[s].type?c.className="program-fill-success":c.className=""}}catch(e){a.e(e)}finally{a.f()}var o,d=l()(n.entries());try{for(d.s();!(o=d.n()).done;){var p,f,h=u()(o.value,2),m=h[0];h[1].innerHTML=null!==(p=b[m])&&void 0!==p&&p.score?"".concat(null===(f=b[m])||void 0===f?void 0:f.score,"分"):""}}catch(e){d.e(e)}finally{d.f()}J(b)}}),[b]);var ne=function(e){K[e.target.dataset.id]=K[e.target.dataset.id]||{},K[e.target.dataset.id].value=e.target.value,J(s()(K)),S(K,e.target.dataset.id)},te=function(e){K[e.target.dataset.id]=K[e.target.dataset.id]||{},K[e.target.dataset.id].value=e.target.value,J(s()(K)),N(K,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(),F(t),U("office");else if(t.indexOf("application/pdf")>-1)e.preventDefault(),F(t),U("pdf");else if(t.indexOf("text/html")>-1)e.preventDefault(),F(t),U("html");else if(t.startsWith("#")){e.preventDefault();var a=document.getElementById(t.replace("#",""));a&&a.scrollIntoView(!0)}}}y.WebkitLineClamp=c,c&&(p=i()(i()({},p),y));var se=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(L.ZP.isSupported()){var n=new L.ZP;n.loadSource(e.src),n.attachMedia(e)}}))};return(0,d.useEffect)((function(){if(ie.current&&ee&&ee.match(W)&&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),Z(),x()}}),[ee,ie.current,re]),(0,D.jsxs)(D.Fragment,{children:[r&&(0,D.jsx)("div",{ref:ie,children:ee}),!r&&(0,D.jsx)("div",{ref:ie,style:i()({},p),className:"".concat(a||""," ").concat(g?"disabled-fill":""," markdown-body ").concat(Q.current),dangerouslySetInnerHTML:{__html:ee}}),(0,D.jsx)(O.Z,{close:!0,data:E,type:null!=E&&E.length?q:"",style:i()({},h),onClose:function(){return F("")}})]})}},17124:function(e,n,t){t.d(n,{h:function(){return v}});var a=t(82242),i=t.n(a),r=t(79800),s=t.n(r),c=t(59301),l=t(57809),o=t(78241),u=t(3113),d=t(89780),p=t.n(d),f=(t(66543),t(59598),t(37712)),h=l.default.Option,m={labelCol:{span:4},wrapperCol:{span:20}},_={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 v(e){var n=e.value,t=e.onChange,a=e.mode,r=e.options,l=void 0===r?{}:r,o=(0,c.useRef)(),u=(0,c.useState)(),d=s()(u,2),h=d[0],m=d[1];return(0,c.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,c.useEffect)((function(){h&&h.setOption("mode",a)}),[h,a]),(0,c.useEffect)((function(){h&&(n===h.getValue()&&""!==n||setTimeout((function(){h.setValue(n||"")}),300))}),[h,n]),(0,c.useEffect)((function(){if(o.current&&!h){var e=p().fromTextArea(o.current,i()({mode:a,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},l));m(e)}}),[o.current,h]),(0,f.jsx)("div",{className:"my-codemirror-container",children:(0,f.jsx)("textarea",{ref:o})})}n.Z=function(e){var n=e.callback,t=e.onCancel,a=(0,c.useState)("python"),r=s()(a,2),d=r[0],p=r[1];return(0,f.jsxs)(o.Z,i()(i()({},m),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){n(e)},children:[(0,f.jsx)(o.Z.Item,{label:"代码语言",name:"language",children:(0,f.jsx)(l.default,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(_[e][1])},children:Object.keys(_).map((function(e){return(0,f.jsx)(h,{value:e,children:_[e][0]},e)}))})}),(0,f.jsx)(o.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(v,{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:"取消"})]})]}))}},59081:function(e,n,t){t.d(n,{Z:function(){return le}});var a=t(91232),i=t.n(a),r=t(7557),s=t.n(r),c=t(41498),l=t.n(c),o=t(79800),u=t.n(o),d=t(85573),p=t.n(d),f=t(59301),h=t(89780),m=t.n(h),_=t(76374),v=(t(66543),t(6313),t(25717),t(99498),t(25419),t(67549),t(71212)),g=t(37712),x=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,g.jsx)(g.Fragment,{children:(0,g.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})})},y=t(82242),b=t.n(y),j=[{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,s=void 0===r?"":r,c=e.children;return(0,g.jsxs)("a",{title:t,className:s,onClick:function(){n(i)},children:[(0,g.jsx)("i",{className:"md-iconfont ".concat(a)}),c]})}var S=function(e){var n=e.watch,t=e.showNullButton,a=e.showNullProgramButton,i=e.onActionCallback,r=e.fullScreen,s=e.insertTemp,c=e.hidetoolBar,l=[].concat(j,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,g.jsxs)("ul",{className:"markdown-toolbar-container",children:[!c&&l.map((function(e,n){return(0,g.jsx)("li",{children:e.actionName?(0,g.jsx)(k,b()(b()({},e),{},{onActionCallback:i})):(0,g.jsx)("span",{className:"v-line"})},n)})),t?(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,s&&(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(s),onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,g.jsx)("li",{className:"btn-full-screen",children:(0,g.jsx)(k,{icon:"".concat(r?"icon-shrink":"icon-enlarge"),title:r?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},w=t(82255),N=t(78241),C=t(10249),A=t(3113),Z={labelCol:{span:4},wrapperCol:{span:20}},I=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(N.Z,b()(b()({},Z),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,g.jsx)(N.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,g.jsx)(C.Z,{})}),(0,g.jsx)(N.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,g.jsx)(C.Z,{})}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(A.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(A.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},T=t(17124),E=t(8591),F=t(78988),P=N.Z.useForm,L={width:280,marginRight:10},R={labelCol:{span:5},wrapperCol:{span:19}},B=function(e){var n=e.callback,t=e.onCancel,a=P(),i=u()(a,1)[0],r=(0,f.useRef)();function s(e,n){-1!==e.status?i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):E.ZP.error(e.message)}return(0,g.jsxs)(N.Z,b()(b()({form:i},R),{},{className:"upload-image-panel",onFinish:function(e){n(b()(b()({},e),{},{name:r.current}))},style:{width:470,overflow:"hidden"},children:[(0,g.jsx)(N.Z.Item,{label:"图片地址",required:!0,children:(0,g.jsxs)("div",{className:"flex-container",children:[(0,g.jsx)(N.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,g.jsx)(C.Z,{style:L})}),(0,g.jsx)(V,{onFileChange:function(e){var n=e.target.files[0];r.current=n.name,O(n,s)}})]})}),(0,g.jsx)(N.Z.Item,{label:"图片描述",name:"alt",children:(0,g.jsx)(C.Z,{style:{width:264}})}),(0,g.jsxs)(N.Z.Item,{style:{textAlign:"right"},children:[(0,g.jsx)(A.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(A.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function V(e){var n=e.onFileChange;return(0,g.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,g.jsx)("input",{type:"file",onChange:n})]})}function O(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(F.KI,"/api/attachments.json")),a.send(t)}var D=t(5112),M=t(5871),W=D.ZP.Group,H={margin:"0 8px"},z=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(N.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,g.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,g.jsx)("span",{style:H,children:"单元格数:"}),(0,g.jsx)("span",{style:H,children:"行数"}),(0,g.jsx)(N.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,g.jsx)(M.Z,{})}),(0,g.jsx)("span",{style:H,children:"列数"}),(0,g.jsx)(N.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,g.jsx)(M.Z,{})})]}),(0,g.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,g.jsx)("span",{style:H,children:"对齐方式:"}),(0,g.jsx)(N.Z.Item,{name:"align",children:(0,g.jsxs)(W,{children:[(0,g.jsx)(D.ZP,{value:"default",children:(0,g.jsx)("i",{className:"fa fa-align-justify"})}),(0,g.jsx)(D.ZP,{value:"left",children:(0,g.jsx)("i",{className:"fa fa-align-left"})}),(0,g.jsx)(D.ZP,{value:"center",children:(0,g.jsx)("i",{className:"fa fa-align-center"})}),(0,g.jsx)(D.ZP,{value:"right",children:(0,g.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(A.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(A.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},q=t(91689),U=t(94171),G=t(1012),Y=t(43418),K="link",J="upload-image",Q="code-block",X="add-table",$="------------",ee={default:$,left:":".concat($),center:":".concat($,":"),right:"".concat($,":")},ne=t(22336);var te="@▁▁@";function ae(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",re=["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"],se=p()(p()({},ie+"-B","bold"),ie+"-I","italic"),ce=p()(p()(p()(p()({},K,"添加链接"),Q,"添加代码块"),J,"添加文件"),X,"添加表格"),le=function(e){var n=e.defaultValue,t=void 0===n?"":n,a=e.onChange,r=e.width,c=void 0===r?"100%":r,o=e.height,d=void 0===o?400:o,h=e.miniToolbar,y=void 0!==h&&h,b=e.isFocus,j=void 0!==b&&b,k=e.watch,N=e.insertTemp,C=e.mode,A=void 0===C?"markdown":C,Z=e.id,F=void 0===Z?"markdown-editor-id":Z,P=e.showResizeBar,L=void 0!==P&&P,R=e.noStorage,V=void 0!==R&&R,D=e.showNullButton,M=void 0!==D&&D,W=e.showNullProgramButton,H=void 0!==W&&W,$=e.hidetoolBar,ie=void 0!==$&&$,le=e.fullScreen,oe=void 0!==le&&le,ue=e.onBlur,de=e.onCMBeforeChange,pe=e.onFullScreen,fe=e.className,he=void 0===fe?"":fe,me=e.disablePaste,_e=void 0!==me&&me,ve=e.disabled,ge=void 0!==ve&&ve,xe=e.disabledFill,ye=void 0!==xe&&xe,be=e.placeholder,je=void 0===be?"":be,ke=e.values,Se=void 0===ke?"":ke,we=(0,f.useState)(null),Ne=u()(we,2),Ce=Ne[0],Ae=Ne[1],Ze=(0,f.useState)(t),Ie=u()(Ze,2),Te=Ie[0],Ee=Ie[1],Fe=(0,f.useState)(k),Pe=u()(Fe,2),Le=Pe[0],Re=Pe[1],Be=(0,f.useState)(oe),Ve=u()(Be,2),Oe=Ve[0],De=Ve[1],Me=(0,f.useState)(""),We=u()(Me,2),He=We[0],ze=We[1],qe=(0,f.useState)(0),Ue=u()(qe,2),Ge=Ue[0],Ye=Ue[1],Ke=(0,f.useState)(d),Je=u()(Ke,2),Qe=Je[0],Xe=Je[1],$e=(0,f.useState)(!1),en=u()($e,2),nn=(en[0],en[1]),tn=(0,f.useRef)((0,G.Z)()),an=(0,f.useRef)(!1),rn=(0,f.useRef)(),sn=(0,f.useRef)(),cn=(0,f.useRef)(),ln=(0,f.useRef)(),on=(0,f.useRef)(),un=function(){var e=l()(s()().mark((function e(){var n,t;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,U.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,sn),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(q.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Ce.replaceSelection('<a href="'.concat(q.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(q.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;Ee(Se),null==Ce||Ce.setValue(Se),window.scrollTo(0,e)}),[Se]),(0,f.useEffect)((function(){null==pe||pe(Oe)}),[Oe]),(0,f.useEffect)((function(){if(sn.current){var e=function(e,t){if(!_e){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"==A)return;try{var s,c=r[1];"file"===(null===(s=r[0])||void 0===s?void 0:s.kind)&&(c=r[0]);var l=c.getAsFile(),o=l.name.split(".").pop();O(l,(function(e){var t,a,i;e.id?(null==l||null===(t=l.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection(".concat(e.content_type,")")):(null==l||null===(a=l.type)||void 0===a?void 0:a.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==l||null===(i=l.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(l.type,'&disposition=inline" target="_blank">').concat(l.name,"</a>")):re.includes(o)?n.replaceSelection('<a href="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(l.name,"</a>")):n.replaceSelection("[".concat(l.name,"](").concat(q.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){E.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=m().fromTextArea(sn.current,{mode:A,lineNumbers:!y,lineWrapping:!0,value:t,autoCloseTags:!H,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",je):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),s=i.lastIndexOf("@▁@",a.ch),c=i.lastIndexOf("@▁▁@",a.ch),l=s>c?s:c,o=s>c?3:4;if(-1===te.indexOf(r))return null;if(console.log("change1:",n,e,i,a,l,s,c,r),l>=0&&a.ch-l<5){var u=l+o;return t.replaceRange("",{line:a.line,ch:l},{line:a.line,ch:u}),{line:a.line,ch:u}}return null}(e);t&&n.preventDefault()}})),j&&n.focus(),n.on("paste",e),n.on("dragleave",(function(e,n){cn.current.classList.remove("mouse-hover-md")})),n.on("dragover",(function(e,n){cn.current.classList.add("mouse-hover-md")})),n.on("drop",(function(e,t){var a;if(cn.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();O(e,(function(a){var i,r,s;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(q.Z.API_SERVER,"/api/attachments/").concat(a.id,'"></video>')):(null==e||null===(s=e.type)||void 0===s?void 0:s.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):re.includes(t)?n.replaceSelection('<a href="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(a.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(q.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()}})),ge&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ae(n),function(){n.off("paste",e)}}}),[]);var dn=(0,f.useCallback)((function(){cn.current}),[Qe,cn,Oe]);(0,f.useEffect)((function(){if(Ce){var e=function(){var e=new _.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(sn.current.parentElement),e}();return function(){var n,t;null!==(n=sn.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=sn.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],s=p()({},i,(function(){pn(r)}));e.push(s),Ce.addKeyMap(s)},t=0,a=Object.entries(se);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(){oe!==Oe&&De(oe)}),[oe]),(0,ne.Z)((function(){if(!V&&Ge>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(F);e>=Ge+1e4&&(!n||n!==Te)&&(window.sessionStorage.setItem(F,Te),nn(!0))}}),1e4),(0,f.useEffect)((function(){Re(k)}),[Ce,k]),(0,f.useEffect)((function(){Ce&&j&&Ce.focus()}),[Ce,j]),(0,f.useEffect)((function(){if(Le&&Ce){var e=function(e){var n=e.target;if(on.current){var t=n.scrollTop/n.scrollHeight;on.current.scrollTop=on.current.scrollHeight*t}},n=Ce.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Ce,Le]),(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();Ee(t),Ye((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),a&&(H?a(t,vn(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(""),Ee("");else{var e=window.scrollY||window.pageYOffset;t!==Ce.getValue()&&(Ce.setValue(t),Ee(t),Ce.setCursor(ge?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(te),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 Re(!Le),Ce.focus();case"trigger-full-screen":return De(!Oe),Ce.focus();case K:return void ze(K);case Q:return void ze(Q);case J:return void ze(J);case X:return void ze(X);default:throw new Error}}),[Ce,Le,Oe]),fn=(0,f.useCallback)((function(e){switch(ze(""),He){case K: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 J:var r=e.src,s=e.alt;return s?Ce.replaceSelection(".concat(r,' "').concat(s,'" )')):Ce.replaceSelection("")),Ce.focus();case X:for(var c=e.row,l=e.col,o=e.align,u="\n",d=0;d<c;d++){for(var p=[],f=[],h=0;h<l;h++)1===d&&f.push(ee[o]),p.push(" ");1===d&&(u+="| ".concat(f.join(" | ")," |\n")),u+="| ".concat(p.join(1===l?"":" | ")," |\n")}return Ce.replaceSelection(u+"\n"),Ce.focus();default:throw new Error}}),[Ce,He]),hn=(0,f.useMemo)((function(){switch(He){case K:return(0,g.jsx)(I,{callback:fn,onCancel:mn});case Q:return(0,g.jsx)(T.Z,{callback:fn,onCancel:mn});case J:return(0,g.jsx)(B,{callback:fn,onCancel:mn});case X:return(0,g.jsx)(z,{callback:fn,onCancel:mn});default:return null}}),[He]);function mn(){ze("")}(0,f.useEffect)((function(){if(ln.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),Xe(d+n+"px")}},a=ln.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,ln]),(0,f.useEffect)((function(){Xe(d)}),[d]);var _n={width:ae(c),height:ae(Qe)},vn=((0,f.useMemo)((function(){if(Ge){var e=new Date(Ge),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}),[Ge]),function(e){var n=[];if(H){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,a){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,g.jsxs)(f.Fragment,{children:[(0,g.jsx)("div",{className:"markdown-editor-wrapper",ref:cn,children:(0,g.jsxs)("div",{className:"markdown-editor-container ".concat(he," ").concat(Le?"on-preview":""," ").concat(y?"mini":""," ").concat(Oe?"full-screen":""),style:_n,children:[(0,g.jsx)(S,{insertTemp:N,watch:Le,fullScreen:Oe,showNullButton:M,showNullProgramButton:H,onActionCallback:pn,hidetoolBar:ie,uuid:tn.current,setOpenPhones:function(){an.current=!0}}),(0,g.jsxs)("div",{className:"markdown-editor-body",children:[(0,g.jsx)("div",{className:"codemirror-container",children:(0,g.jsx)("textarea",{ref:sn,placeholder:je})}),Le?(0,g.jsxs)("div",{ref:on,className:"preview-container",children:["stex"===A&&(0,g.jsx)(x,{value:Te}),"stex"!==A&&(0,g.jsx)(v.Z,{disabledFill:ye,showProgramFill:H,value:Te})]}):null]})]})}),L?(0,g.jsx)("a",{ref:ln,className:"editor-resize"}):null,(0,g.jsx)(w.Z,{children:ce[He]?(0,g.jsx)(Y.Z,{centered:!0,title:ce[He],open:!0,onCancel:mn,footer:null,className:"markdown-popup-form",children:hn}):null})]})}},82255:function(e,n,t){t.d(n,{Z:function(){return f}});var a=t(82100),i=t.n(a),r=t(29186),s=t.n(r),c=t(80619),l=t.n(c),o=t(47074),u=t.n(o),d=t(59301),p=t(4676),f=function(e){l()(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 s()(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)},86048:function(e,n,t){t(59301),t(45298);var a=t(57809),i=t(78673),r=t(37712),s=a.default.Option;n.Z=function(e){var n=e.isTheoretical,t=e.onFontSizeChange,c=e.cmFontSize,l=e.cmCodeMode,o=(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.default,{bordered:!1,size:"small",value:l,onChange:o,children:[(0,r.jsx)(s,{value:"vs",children:"白色背景"}),(0,r.jsx)(s,{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.default,{bordered:!1,size:"small",value:c,onChange:t,children:[(0,r.jsx)(s,{value:12,children:"12px"}),(0,r.jsx)(s,{value:14,children:"14px"}),(0,r.jsx)(s,{value:16,children:"16px"}),(0,r.jsx)(s,{value:18,children:"18px"}),(0,r.jsx)(s,{value:20,children:"20px"}),(0,r.jsx)(s,{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]})]})}},22336:function(e,n,t){t.d(n,{Z:function(){return i}});var a=t(59301);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])}},92745:function(e,n,t){t.d(n,{Z:function(){return v}});var a=t(79800),i=t.n(a),r=t(82242),s=t.n(r),c=t(59301),l=t(43428),o=t(63631),u=t(86048),d=t(82255),p=t(34407),f=t(37712),h={theme:(0,p.G)("cmCodeMode","vs-dark"),fontSize:(0,p.G)("cmFontSize",14),showEditorSetting:!1,tabToSpace:(0,p.G)("cmTabToSpace",!0)},m=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}(m||{});function _(e,n){switch(n.type){case m.set_show_editor_setting:return s()(s()({},e),{},{showEditorSetting:n.payload});case m.set_theme:return s()(s()({},e),{},{theme:n.payload});case m.set_font_size:return s()(s()({},e),{},{fontSize:n.payload});case m.on_tab_to_space:return s()(s()({},e),{},{tabToSpace:n.payload});default:throw new Error}}var v=function(e){var n=e.isLoading,t=e.value,a=e.onChange,r=e.language,v=e.onUpdateCode,x=e.ActionBarRender,y=void 0===x?function(e){return(0,f.jsx)(g,{onShowCodeSetting:e})}:x,b=(0,c.useReducer)(_,h),j=i()(b,2),k=j[0],S=j[1],w=k.theme,N=k.fontSize,C=k.showEditorSetting,A=k.tabToSpace,Z=(0,c.useRef)(),I=(0,c.useRef)(),T={onFontSizeChange:function(e){S({type:m.set_font_size,payload:e}),(0,p.t)("cmFontSize",e)},tabToSpace:A,cmFontSize:N,className:"oj",cmCodeMode:w,onTabToSpace:function(e){S({type:m.on_tab_to_space,payload:e}),(0,p.t)("cmTabToSpace",e)},onCodeModeChange:function(e){S({type:m.set_theme,payload:e}),(0,p.t)("cmCodeMode",e)}};var E={value:t,language:r,theme:w,height:"calc(100% - 56px)",options:{fontSize:N,insertSpaces:A},onChange:function(e){a(e),I.current=e,clearTimeout(Z.current),Z.current=setTimeout((function(){v(I.current)}),1e4)},onEditBlur:function(e){I.current&&v(I.current)}};return(0,f.jsxs)(c.Fragment,{children:[(0,f.jsxs)("div",{className:"code-panel-container",children:[y((function(){S({type:m.set_show_editor_setting,payload:!0})})),!n&&(0,f.jsx)(o.ZP,s()({},E))]}),(0,f.jsx)(d.Z,{children:(0,f.jsx)(l.Z,{rootClassName:"oj",title:null,placement:"right",closable:!1,open:C,onClose:function(){S({type:m.set_show_editor_setting,payload:!1})},children:(0,f.jsx)(u.Z,s()({},T))})})]})};function g(e){var n=e.onShowCodeSetting;return(0,f.jsxs)("div",{className:"action-bar",children:[(0,f.jsx)("span",{children:"学员初始代码文件"}),(0,f.jsx)("a",{onClick:n,children:(0,f.jsx)("i",{className:"iconfont icon-shezhi"})})]})}},10114:function(e,n,t){t.d(n,{Z:function(){return b}});var a=t(79800),i=t.n(a),r=t(82242),s=t.n(r),c=t(59301),l=t(43428),o=t(63631),u=t(86048),d=t(82255),p=t(34407),f="code-panel-container___RFtv_",h="action-oj-bar___ByFmZ",m="active___s9gT5",_=t(89392),v=t(37712),g={theme:(0,p.G)("cmCodeMode","vs-dark"),fontSize:(0,p.G)("cmFontSize",14),showEditorSetting:!1,tabToSpace:(0,p.G)("cmTabToSpace",!0)},x=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}(x||{});function y(e,n){switch(n.type){case x.set_show_editor_setting:return s()(s()({},e),{},{showEditorSetting:n.payload});case x.set_theme:return s()(s()({},e),{},{theme:n.payload});case x.set_font_size:return s()(s()({},e),{},{fontSize:n.payload});case x.on_tab_to_space:return s()(s()({},e),{},{tabToSpace:n.payload});default:throw new Error}}var b=function(e){var n,t=e.isLoading,a=e.value,r=void 0===a?[]:a,h=e.onChange,m=(0,c.useReducer)(y,g),b=i()(m,2),k=b[0],S=b[1],w=k.theme,N=k.fontSize,C=k.showEditorSetting,A=k.tabToSpace,Z=(0,c.useState)("c"),I=i()(Z,2),T=I[0],E=I[1],F=(0,c.useRef)([]);(0,c.useEffect)((function(){null!=r&&r.length&&(F.current=(0,_.cloneDeep)(r))}),[r]);var P={onFontSizeChange:function(e){S({type:x.set_font_size,payload:e}),(0,p.t)("cmFontSize",e)},tabToSpace:A,cmFontSize:N,className:"oj",cmCodeMode:w,onTabToSpace:function(e){S({type:x.on_tab_to_space,payload:e}),(0,p.t)("cmTabToSpace",e)},onCodeModeChange:function(e){S({type:x.set_theme,payload:e}),(0,p.t)("cmCodeMode",e)}};var L={key:T,value:null==r||null===(n=r.find((function(e){return e.language===T})))||void 0===n?void 0:n.code,language:T,onChange:function(e){var n,t=null===(n=F.current)||void 0===n?void 0:n.map((function(n){return n.language===T?(n.code=e,n):n}));F.current=(0,_.cloneDeep)(t),h(t)},theme:w,height:"calc(100% - 56px)",options:{fontSize:N,insertSpaces:A}};return(0,v.jsxs)(c.Fragment,{children:[(0,v.jsxs)("div",{className:f,children:[(0,v.jsx)(j,{languageItems:r,onLanguage:function(e){return E(e)},language:T,onShowCodeSetting:function(){S({type:x.set_show_editor_setting,payload:!0})}}),!t&&(0,v.jsx)(o.ZP,s()({},L))]}),(0,v.jsx)(d.Z,{children:(0,v.jsx)(l.Z,{rootClassName:"oj",title:null,placement:"right",closable:!1,open:C,onClose:function(){S({type:x.set_show_editor_setting,payload:!1})},children:(0,v.jsx)(u.Z,s()({},P))})})]})};function j(e){var n=e.languageItems,t=e.language,a=e.onShowCodeSetting,i=e.onLanguage;return(0,v.jsxs)("div",{className:h,children:[(0,v.jsx)("span",{children:"学员初始代码文件"}),null==n?void 0:n.map((function(e){return(0,v.jsx)("div",{className:t===(null==e?void 0:e.language)?m:"",onClick:function(){return i(null==e?void 0:e.language)},children:null==e?void 0:e.language},null==e?void 0:e.language)})),(0,v.jsx)("a",{onClick:a,children:(0,v.jsx)("i",{className:"iconfont icon-shezhi"})})]})}},74408:function(e,n,t){t.r(n),t.d(n,{Types:function(){return le},default:function(){return ue}});var a=t(91232),i=t.n(a),r=t(37205),s=t.n(r),c=t(7557),l=t.n(c),o=t(41498),u=t.n(o),d=t(79800),p=t.n(d),f=t(82242),h=t.n(f),m=t(59301),_={bg:"bg___HduZ7",header:"header___KbUo2",avatar:"avatar___UDYJ4",title:"title___OP1JL",exitBtn:"exitBtn___E3w1m",contentWrapper:"contentWrapper___IeO8M",tabWrapper:"tabWrapper___qc2MC",buttonFixed:"buttonFixed___jzejH",cancelBtn:"cancelBtn___c5OpP",saveBtn:"saveBtn___UhxvN",challengeBtn:"challengeBtn___h9r2O",baseInfoWrapper:"baseInfoWrapper___jei0F",baseLineHeight:"baseLineHeight___v1JXM",folderLineHeight:"folderLineHeight___tF8xb",uploadBtnWrapper:"uploadBtnWrapper___ICJS3",baseFormItem:"baseFormItem___sca4N",radioBtnWrapper:"radioBtnWrapper___VIxZD",difficultyRadio:"difficultyRadio___isD54",easy:"easy___gparw",medium:"medium___wRzjL",hard:"hard___sWxqC",testCaseTypeRadio:"testCaseTypeRadio___oiSFl",cascaderPopup:"cascaderPopup___OADQu",collapseWrapper:"collapseWrapper___saVIT",panelHeader:"panelHeader___hRptX",rateInput:"rateInput____HzUM",operationWrapper:"operationWrapper___YJRMc",open:"open___zkYQ_",close:"close___q9p81",add:"add___NB0_y",remove:"remove___xa9jD",codePanelWrapper:"codePanelWrapper___oacDD",uploadTableWrapper:"uploadTableWrapper___iMDly",unfold:"unfold___TdtCA"},v=t(78241),g=t(8591),x=t(43418),y=t(71418),b=t(99313),j=t(3113),k=t(42190),S=t(49389),w=t(24334),N=t(13119),C=t(94280),A=t(92745),Z=t(10114),I=t(94171),T=t(83287),E=t(91689),F=t(17477),P=t(97183),L=t(70236),R=t.n(L),B=t(10249),V=t(36381),O=t(5871),D=t(19842),M=t(24905),W=t(57809),H=t(5112),z=t(95237),q=t(43604),U=t(78673),G=t(14478),Y=t(32134),K=t(12893),J=t(59081),Q=t(10615),X=t(52058),$=t(82887),ee=t(58605),ne=t(37712),te=B.Z.TextArea,ae=V.Z.Panel;var ie=function(e){var n,t,a=e.form,i=e.onAddTestCases,r=e.handleAddKnowledgeFinish,c=e.formValue,l=e.knowledgeOptions,o=e.categorys,u=e.hack,d=e.callback_url,f=e.onChangeAverage,g=e.onChangeScore,x=e.onChangeFile,y=e.onAddTestCase,b=e.onRemoveTestCase,S=e.onChangeSubDiscipline,w=e.onChangeLanguage,N=e.uploadData,C=e.setUploadData,A=e.handleUploadRatio,Z=e.isshows,I=e.isProgram,T=e.addUploadFnc,E=e.activeKey,F=e.setActiveKey,P=(0,m.useState)(!1),L=p()(P,2),ie=L[0],re=L[1],se=(null===(n=location)||void 0===n||null===(n=n.search)||void 0===n?void 0:n.includes("select"))||!1,ce=(0,m.useState)(Z),le=p()(ce,2),oe=le[0],ue=le[1],de=u.test_set_average,pe=u.test_set_score,fe=(0,m.useState)(!1),he=p()(fe,2),me=he[0],_e=he[1],ve=(0,m.useState)(!1),ge=p()(ve,2),xe=ge[0],ye=ge[1];function be(e){e.stopPropagation()}return(0,ne.jsxs)("div",{className:_.baseInfoWrapper,children:[(0,ne.jsx)(v.Z.Item,{label:"试题名称",name:["hack","name"],rules:[{required:!0,message:"请输入试题名称"}],className:"".concat(_.baseLineHeight),children:(0,ne.jsx)(B.Z,{className:_.baseFormItem,maxLength:60,placeholder:"请输入试题名称"})}),(0,ne.jsx)(v.Z.Item,{label:"试题描述",name:["hack","description"],valuePropName:"defaultValue",rules:[{required:!0,message:"请输入描述内容"}],className:"".concat(_.baseLineHeight),children:(0,ne.jsx)(J.Z,{miniToolbar:!0,id:"moop_cases_content",noStorage:!0,height:200})}),(0,ne.jsx)(v.Z.Item,{label:"参考答案",name:["hack","answer_text"],valuePropName:"defaultValue",className:"".concat(_.baseLineHeight),children:(0,ne.jsx)(J.Z,{miniToolbar:!0,noStorage:!0,height:200})}),(0,ne.jsx)("div",{onClick:function(){return re(!0)},children:(0,ne.jsx)(v.Z.Item,{label:"题目解析",name:["hack","analysis"],className:"".concat(_.baseLineHeight),children:(0,ne.jsx)(ee.x,{placeholder:"请编辑题目解析(非必填)",isEdit:ie})})}),d&&(0,ne.jsxs)(v.Z.Item,{label:"分值",className:"".concat(_.baseLineHeight),required:!0,children:[(0,ne.jsx)(v.Z.Item,{name:["hack","score"],rules:[{required:!0,message:"请输入分数"}],noStyle:!0,children:(0,ne.jsx)(O.Z,{disabled:se,min:1,max:100,className:_.baseFormItem,style:{width:176}})}),(0,ne.jsx)("span",{className:"ml10 font14",children:"分"})]}),(0,ne.jsx)(v.Z.Item,{label:"方向&课程",name:["hack","sub_discipline_id"],rules:[{required:!0,message:"请选择课程"}],className:"".concat(_.baseLineHeight),children:(0,ne.jsx)(D.Z,{className:_.baseFormItem,disabled:se,allowClear:!1,options:o,placeholder:"请选择",onChange:S,popupClassName:_.cascaderPopup,dropdownMenuColumnStyle:{padding:"8px 12px",fontSize:14}})}),I?(0,ne.jsx)(v.Z.Item,{label:"编程语言",style:{paddingBottom:16},name:["hack","languages"],rules:[{required:!0,message:"请选择编程语言"}],children:(0,ne.jsxs)(M.Z.Group,{children:[(0,ne.jsx)(M.Z,{value:"C",children:"C"}),(0,ne.jsx)(M.Z,{value:"C++",children:"C++"}),(0,ne.jsx)(M.Z,{value:"Java",children:"Java"}),(0,ne.jsx)(M.Z,{value:"Python",children:"Python"})]})}):(0,ne.jsx)(v.Z.Item,{label:"编程语言",name:["hack_codes","language"],rules:[{required:!0,message:"请选择编程语言"}],className:_.baseLineHeight,children:(0,ne.jsx)(W.default,{className:_.baseFormItem,onChange:w,children:(0,k.jw)(k.R8.language)})}),(0,ne.jsxs)(v.Z.Item,{label:(0,ne.jsxs)("div",{style:{lineHeight:"22px"},children:[(0,ne.jsx)("div",{children:"单个测试集"}),(0,ne.jsx)("div",{children:"最大评测时长"})]}),required:!0,className:_.baseLineHeight,children:[(0,ne.jsx)(v.Z.Item,{name:["hack","time_limit"],rules:[{required:!0,message:"请输入单个测试集评测时长限制"},{type:"number",min:3,message:"最小限制时间是3秒"}],noStyle:!0,children:(0,ne.jsx)(O.Z,{max:10,min:3,className:_.baseFormItem,style:{width:316}})}),(0,ne.jsx)("span",{className:"ml10 font14",children:"秒"})]}),(0,ne.jsx)(v.Z.Item,{label:"评测得分规范",name:["hack","test_set_score"],rules:[{required:!0}],children:(0,ne.jsxs)(H.ZP.Group,{onChange:g,children:[(0,ne.jsx)(H.ZP,{value:!0,children:"通过全部测试集才能获得奖励"}),(0,ne.jsx)(H.ZP,{value:!1,children:"通过部分测试集即可获得奖励"})]})}),(0,ne.jsxs)(z.Z,{align:"middle",className:"mb30",children:[(0,ne.jsx)(q.Z,{style:{marginLeft:200},children:(0,ne.jsx)(v.Z.Item,{name:["hack","hide_actual_output"],valuePropName:"checked",noStyle:!0,children:(0,ne.jsx)(U.Z,{})})}),(0,ne.jsx)(q.Z,{className:"ml10",children:"隐藏学员评测实际输出结果,仅展示评测是否通过"})]}),!u.test_set_score&&(0,ne.jsx)(v.Z.Item,{name:["hack","test_set_average"],label:"系统评分占比",rules:[{required:!0}],children:(0,ne.jsxs)(H.ZP.Group,{onChange:f,children:[(0,ne.jsx)(H.ZP,{value:!0,children:"均分比例"}),(0,ne.jsx)(H.ZP,{value:!1,children:"自定义比例"})]})}),!u.test_set_score&&(0,ne.jsxs)(z.Z,{align:"middle",className:"mb20",children:[(0,ne.jsx)(q.Z,{style:{marginLeft:200},children:(0,ne.jsx)(U.Z,{onChange:function(e){ue(e),a.setFieldsValue({hack:{code_compile_score:0}}),u.test_set_average&&(u.is_file?A(N):i())},checked:oe})}),(0,ne.jsxs)(q.Z,{className:"ml10",children:["启用编译通过即可得分",(0,ne.jsx)("span",{style:{color:"#E99237"},children:"(若没有编译过程,将无法获得编译得分)"})]})]}),oe&&!u.test_set_score&&(0,ne.jsxs)(z.Z,{align:"middle",className:"mb30",children:[(0,ne.jsx)(q.Z,{style:{marginLeft:200},children:(0,ne.jsx)(v.Z.Item,{rules:[{required:!0,message:"请输入编译得分"}],name:["hack","code_compile_score"],style:{marginBottom:0},children:(0,ne.jsx)(O.Z,{className:_.baseFormItem,onChange:function(){u.test_set_average&&(u.is_file?A(N):i())},parser:function(e){return isNaN(parseInt(e))?"":parseInt(e)},min:0,max:100})})}),(0,ne.jsx)(q.Z,{className:"ml10",children:"%"})]}),(0,ne.jsx)(v.Z.Item,{className:_.radioBtnWrapper,name:["hack","is_file"],label:"用例类型",rules:[{required:!0}],children:(0,ne.jsx)(H.ZP.Group,{onChange:x,optionType:"button",className:_.testCaseTypeRadio,options:[{label:"文本",value:!1},{label:"文件",value:!0}]})}),(0,ne.jsx)(v.Z.Item,{label:"测试用例",required:!0,children:(0,ne.jsxs)("div",{className:_.uploadBtnWrapper,children:[!u.is_file&&(0,ne.jsx)(j.ZP,{type:"primary",onClick:y,children:"添加"}),(0,ne.jsx)(j.ZP,{className:"ml20",type:"primary",onClick:function(){return ye(!0)},children:"批量上传"})]})}),(0,ne.jsx)("div",{className:_.upBtn,children:(null==u?void 0:u.is_file)&&(0,ne.jsx)($.Y2,{className:_.uploadTableWrapper,disabled:null==u?void 0:u.test_set_average,inputChange:function(e,n){var t=N.map((function(t,a){return a===n?h()(h()({},t),{},{score:e.target.value?Number(e.target.value):0}):t}));C(t)},showScore:!u.test_set_score,data:N,onRemove:function(e,n){var t=s()(N);t.splice(n,1),de?A(t):C(t)}})}),!u.is_file&&(0,ne.jsx)(v.Z.List,{name:"hack_sets",children:function(e,n){return R()(n),(0,ne.jsx)(V.Z,{accordion:!0,bordered:!1,activeKey:E,onChange:F,className:_.collapseWrapper,expandIcon:function(e){var n=e.isActive;return(0,ne.jsx)("i",{className:"iconfont icon-weizhankai ".concat(n?_.open:_.close),style:{fontSize:14,transition:"all .2s"}})},children:e.map((function(e,n){return(0,ne.jsxs)(ae,{id:"scroll-key-".concat(e.key),header:(0,ne.jsxs)(z.Z,{align:"middle",justify:"space-between",wrap:!1,children:[(0,ne.jsx)(q.Z,{className:_.panelHeader,children:(0,ne.jsxs)("span",{children:["测试用例",n+1]})}),(0,ne.jsx)(q.Z,{flex:1,children:(0,ne.jsxs)(z.Z,{align:"middle",justify:"end",wrap:!1,children:[!pe&&(0,ne.jsxs)(q.Z,{className:_.rateInput,children:[(0,ne.jsx)("span",{className:"mr20",children:"评分占比"}),(0,ne.jsx)("div",{onClick:be,children:(0,ne.jsx)(v.Z.Item,{name:[e.name,"score"],rules:[{required:!0,message:"请输入测试集".concat(n+1,"评分")}],noStyle:!0,children:(0,ne.jsx)(O.Z,{className:_.baseFormItem,min:0,max:100,disabled:de})})}),(0,ne.jsx)("span",{className:"ml10",children:"%"})]}),(0,ne.jsx)(q.Z,{flex:"78px",className:_.operationWrapper,children:n>0&&(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(Y.Z,{className:_.add,onClick:function(e){be(e),y()}}),(0,ne.jsx)(G.Z,{okText:"确定",cancelText:"取消",title:"确定删除测试集"+(n+1),onCancel:be,onConfirm:function(e){be(e),b(n)},children:(0,ne.jsx)(K.Z,{className:"".concat(_.remove," ml20"),onClick:be})})]})})]})})]}),children:[(0,ne.jsx)(v.Z.Item,{label:"输入",labelCol:{span:24},name:[e.name,"input"],children:(0,ne.jsx)(te,{rows:4})}),(0,ne.jsx)(v.Z.Item,{label:"输出",labelCol:{span:24},name:[e.name,"output"],rules:[{required:!0,message:"请输入输出内容"}],children:(0,ne.jsx)(te,{rows:4})})]},e.key)}))})}}),(0,ne.jsx)("div",{className:_.unfold,children:(0,ne.jsxs)("div",{onClick:function(){return _e(!me)},children:["更多设置",me?(0,ne.jsx)("i",{className:"iconfont icon-xialajiantou1"}):(0,ne.jsx)("i",{className:"iconfont icon-xialajiantoubeifen"})]})}),(0,ne.jsxs)("div",{style:{display:me?"block":"none"},children:[(0,ne.jsx)(v.Z.Item,{label:"难度",name:["hack","difficult"],className:_.radioBtnWrapper,rules:[{required:!0,message:"请选择难度"}],children:(0,ne.jsxs)(H.ZP.Group,{optionType:"button",className:_.difficultyRadio,children:[(0,ne.jsx)(H.ZP.Button,{value:1,className:_.easy,children:"简单"}),(0,ne.jsx)(H.ZP.Button,{value:2,className:_.medium,children:"适中"}),(0,ne.jsx)(H.ZP.Button,{value:3,className:_.hard,children:"困难"})]})}),(0,ne.jsx)(v.Z.Item,{label:"知识点",name:["hack","tag_discipline_ids"],className:_.baseLineHeight,children:(0,ne.jsx)(X.N,{selectvalues:(null==u?void 0:u.tag_discipline_id)||(null==u?void 0:u.tag_discipline_ids),disabled:se,subId:null==c||null===(t=c.hack)||void 0===t||null===(t=t.sub_discipline_id)||void 0===t?void 0:t[1],knowledgeOptions:l,onAddKnowledgeFinish:r})}),!se&&(0,ne.jsx)(v.Z.Item,{className:_.folderLineHeight,label:"放入文件夹",name:["hack","item_banks_group_ids"],children:(0,ne.jsx)(Q.Z,{scrollId:"item_banks_group_ids"})})]}),(0,ne.jsx)($.ZP,{rootIdentifier:null,visible:xe,onClose:function(){return ye(!1)},onOK:function(e){if(null!=e&&e.length){if(null!=e&&e[0].is_file){T(e,!0)();var n=N.concat(e);u.test_set_average?A(n):C(n)}null!=e&&e[0].is_file||T(e)}},multiple:!0,defaultMultipleValue:null==u?void 0:u.is_file})]})},re=t(89392);function se(){return(new Date).getTime()}var ce={loading:!0,user:null,disciplines:[],dicts:null,status:0,data:void 0,lastedUpdateTime:0},le=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 oe(e,n){switch(n.type){case le.SET_INITAL_DATA:return h()(h()({},e),n.payload);case le.SET_LOADING:return h()(h()({},e),{},{loading:n.payload});case le.SET_STATUS:return h()(h()({},e),{},{status:n.payload});default:throw new Error}}var ue=function(){var e,n,t=(0,S.useSearchParams)(),a=p()(t,1)[0],r=(0,S.useParams)().id,c=v.Z.useForm(),o=p()(c,1)[0],d=(0,m.useState)(),f=p()(d,2),L=f[0],R=f[1],B=(0,m.useState)([]),V=p()(B,2),O=V[0],D=V[1],M=(0,m.useState)([]),W=p()(M,2),H=W[0],z=W[1],q=(0,m.useReducer)(oe,ce),U=p()(q,2),G=U[0],Y=U[1],K=G.loading,J=G.data,Q=G.user,X=G.disciplines,$=G.dicts,ee=G.status,te=null==J?void 0:J.hack_sets,ae=null==J||null===(e=J.hack)||void 0===e?void 0:e.test_set_average,ue=(0,T.oP)(),de=ue.callback_url,pe=ue.express_id,fe=ue.score,he=ue.question_id,me=ue.type,_e=(0,m.useState)([]),ve=p()(_e,2),ge=ve[0],xe=ve[1],ye=(0,m.useState)(!1),be=p()(ye,2),je=be[0],ke=be[1],Se="1"===me,we=(0,m.useMemo)((function(){var e=[];return X&&(0,k.D0)(X,e),e}),[X]),Ne=(0,m.useCallback)(u()(l()().mark((function e(){var n,t,a,i,s,c,u,d,f,m,_,v,g,x,y,b,j,S,C,A,Z,I,E,F,P,L,B,V,O,D,M,W,H,q,U,G,K,J,Q,$,ee,ne,te,ae,ie,re,se,ce,oe,ue,de,pe,he,me=arguments;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=me.length>0&&void 0!==me[0]?me[0]:0,0!==(t=X).length){e.next=7;break}return e.next=5,(0,N.d1)("new_question");case 5:a=e.sent,t=a.disciplines;case 7:if(!r){e.next=15;break}return i={disciplines:t},e.next=11,(0,N.fu)(r);case 11:(s=e.sent).message?"401"===s.status&&(document.location.href="/user/login"):(c=s.category,u=s.user,d=s.code,f=s.language,m=s.hack_sets,_=s.description,v=s.difficult,g=s.name,x=s.open_or_not,y=s.sub_discipline_id,s.tag_discipline_id,b=s.analysis,j=s.time_limit,S=s.test_set_average,C=s.test_set_score,A=s.status,Z=s.tag_discipline_ids,I=s.item_banks_group_id,E=s.is_file,F=void 0!==E&&E,P=s.hide_actual_output,L=s.code_compile_score,B=s.languages,V=s.is_my,O=s.codes,D=s.answer_text,M=(0,k.y3)(t,y),W=p()(M,2),H=W[0],q=W[1],U=F?[{input:"",output:"",score:100,position:1}]:m,F?(z(m),o.setFieldsValue({hack_sets:U})):z([]),G=(0,T.oP)(),K=G.lastedUpdateTime,J=null==O?void 0:O.map((function(e){return h()(h()({},e),{},{code:w.Base64.decode(null==e?void 0:e.code)})})),i=h()(h()({},i),{},{loading:!1,user:u,dicts:q,status:A,lastedUpdateTime:n||(K||0),data:{hack_codes:{language:f,code:w.Base64.decode(d)},hack:{category:c,difficult:v,name:g,description:_,open_or_not:x,time_limit:j,test_set_average:S,test_set_score:C,sub_discipline_id:H,tag_discipline_ids:Z,languages:B,score:fe||1,item_banks_group_ids:I,is_file:F,is_my:V,code_compile_score:L,hide_actual_output:P,analysis:b,answer_text:D},hack_sets:U,tags:Z,codes:J}}),parseInt(L)>0&&ke(!0),Y({type:le.SET_INITAL_DATA,payload:i}),R({hack:{category:c,difficult:v,name:g,description:_,open_or_not:x,time_limit:j,test_set_average:S,test_set_score:C,sub_discipline_id:H,tag_discipline_ids:Z,score:fe||1,item_banks_group_ids:I,is_file:F,analysis:b,answer_text:D},codes:J}),Ce(null==H?void 0:H[0],null==H?void 0:H[1],t)),e.next=26;break;case 15:return e.next=17,(0,N.PR)();case 17:ee=e.sent,ne=ee.user,te=(0,T.oP)(),ae=te.sub_discipline_id,ie=te.tag_discipline_id,re=te.tagIds,se=te.banksIds,ce=2,oe=(0,k.y3)(t,parseInt(ae,10)),ue=p()(oe,2),de=ue[0],pe=ue[1],he=[Number(se)],Y({type:le.SET_INITAL_DATA,payload:{loading:!1,user:ne,disciplines:t,status:0,dicts:pe,data:{hack_codes:{language:"C",code:""},hack:{category:null,difficult:ce,time_limit:3,description:"",test_set_score:!0,test_set_average:!0,open_or_not:!0,sub_discipline_id:de,tag_discipline_id:re&&(null==re||null===(Q=re.split(","))||void 0===Q?void 0:Q.map((function(e){return Number(e)}))),name:"",item_banks_group_ids:he,is_file:!1,answer_text:""},tags:ie?null==ie?void 0:ie.split(",").map((function(e){return parseInt(e,10)})):[],hack_sets:[{input:"",output:"",score:100,position:1}]}}}),R({hack:{category:null,difficult:ce,time_limit:3,description:"",test_set_average:!0,open_or_not:!0,sub_discipline_id:de,tag_discipline_id:re&&(null==re||null===($=re.split(","))||void 0===$?void 0:$.map((function(e){return Number(e)}))),name:"",item_banks_group_id:he,is_file:!1,answer_text:""}}),Ce(null==de?void 0:de[0],null==de?void 0:de[1],t);case 26:case"end":return e.stop()}}),e)}))),[r,X]);(0,m.useEffect)((function(){try{Ne()}catch(e){console.log(e,"----")}}),[]),(0,m.useEffect)((function(){function e(){return e=u()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,I.U2)("item_banks_groups/mine.json");case 2:n=e.sent,xe(n);case 4:case"end":return e.stop()}}),e)}))),e.apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]);var Ce=function(e,n,t){var a;null==t||null===(a=t.find((function(n){return n.id===e})))||void 0===a||null===(a=a.sub_disciplines)||void 0===a||null===(a=a.find((function(e){return e.id===n})))||void 0===a||a.tag_disciplines};function Ae(e,n,t){return Ze.apply(this,arguments)}function Ze(){return Ze=u()(l()().mark((function e(n,t,s){var c,o,d,p,f,m,_,v,y,b,j,k,C,A,Z,I,T,E,L;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=h()({},n),o=c.hack_sets,d=c.hack_codes,p=c.hack,f=c.tags,m=c.codes,_=[],v=[],y=0,b=null!=p&&p.is_file?H.map((function(e,n){return h()(h()({},e),{},{position:n+1})})):o.map((function(e){return h()(h()({},e),{},{is_file:!1})})),j=i()(b);try{for(j.s();!(k=j.n()).done;)C=k.value,y+=C.score,C.id&&C.id>=0?_.push(C):v.push(C)}catch(e){j.e(e)}finally{j.f()}if(null!=b&&b.length){e.next=10;break}return g.ZP.error("测试集不能为空"),e.abrupt("return");case 10:if(100===(y+=parseInt(p.code_compile_score||0))||p.test_set_score){e.next=14;break}return g.ZP.error("测试集的评分占比之和必须等于100"),e.abrupt("return");case 14:if(null==b||!b.some((function(e){return!e.output}))){e.next=17;break}return g.ZP.error("测试集输出不能为空"),e.abrupt("return");case 17:if(A={},Se?null==m||m.forEach((function(e){A[e.language]=null!=e&&e.code?w.Base64.encode(null==e?void 0:e.code):""})):d.code=w.Base64.encode(null==d?void 0:d.code),p.sub_discipline_id=p.sub_discipline_id[1],Y({type:le.SET_LOADING,payload:!0}),de||(p.score=100*p.difficult),!r){e.next=50;break}return e.next=25,(0,N.l_)(r,{hack:p,hack_codes:d,hack_sets:v,update_hack_sets:_,tags:f,is_cover:s,languages:p.languages,codes:A});case 25:if(!de){e.next=44;break}return e.next=28,(0,N.j2)(r);case 28:if(!de.includes("paperlibrary")){e.next=34;break}return e.next=31,(0,F.oF)({id:pe,question_id:he,item_type:P.c.Program,name:p.name,question_score:p.score,difficulty:p.difficult,sub_discipline_id:p.sub_discipline_id,tag_discipline_ids:p.tag_discipline_ids,item_banks_group_ids:p.item_banks_group_ids,analysis:p.analysis});case 31:return 0===e.sent.status&&S.history.replace(a.get("callback_url")),e.abrupt("return");case 34:return e.next=36,(0,N.GM)(he,{question_type:6,question_score:p.score,question_title:p.name,description:p.description,sub_discipline_id:p.sub_discipline_id,tag_discipline_ids:p.tag_discipline_ids,item_banks_group_ids:p.item_banks_group_ids,identifier:r,analysis:p.analysis});case 36:if(Z=e.sent,0!==Z.status){e.next=42;break}if("start"!==t){e.next=41;break}return e.abrupt("return");case 41:S.history.replace(a.get("callback_url"));case 42:e.next=47;break;case 44:g.ZP.success("保存成功"),S.history.replace("/problemset"),Ne(se());case 47:Y({type:le.SET_LOADING,payload:!1}),e.next=80;break;case 50:return e.next=52,(0,N.zQ)({hack:p,hack_codes:d,hack_sets:b,tags:f,examination_bank_id:pe||null});case 52:if(I=e.sent,T=I.identifier,E=I.exam_identifier,Y({type:le.SET_LOADING,payload:!1}),"start"!==t){e.next=58;break}return e.abrupt("return");case 58:if(!T){e.next=80;break}if(de){e.next=63;break}x.Z.confirm({icon:null,title:"提示",width:452,centered:!0,content:(0,ne.jsx)("div",{children:"编程题已保存!目前外于未发布状态,发布后即可应用到自己管理的课堂,是否立即发布?"}),cancelText:"稍后再说",okText:"立即发布",onCancel:function(){S.history.replace("/problemset")},onOk:function(){var e=u()(l()().mark((function e(){return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie(T);case 2:S.history.replace("/problemset");case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}),e.next=80;break;case 63:return e.next=65,(0,N.j2)(T);case 65:if(r){e.next=79;break}if(!de.includes("paperlibrary")){e.next=72;break}return e.next=69,(0,F.oF)({id:pe,item_type:P.c.Program,name:p.name,question_score:p.score,difficulty:p.difficult,sub_discipline_id:p.sub_discipline_id,tag_discipline_ids:p.tag_discipline_ids,identifier:E,analysis:p.analysis});case 69:return 0===e.sent.status&&S.history.replace(a.get("callback_url")),e.abrupt("return");case 72:return e.next=74,(0,N.MK)(parseInt(pe,10),{question_type:6,question_score:p.score,question_title:p.name,identifier:T,tag_discipline_ids:p.tag_discipline_ids,analysis:p.analysis});case 74:L=e.sent,0===L.status&&S.history.replace(a.get("callback_url")),e.next=80;break;case 79:S.history.replace(a.get("callback_url"));case 80:case"end":return e.stop()}}),e)}))),Ze.apply(this,arguments)}function Ie(e){return Te.apply(this,arguments)}function Te(){return(Te=u()(l()().mark((function e(n){var t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,N.j2)(n);case 2:0===(t=e.sent).status?(g.ZP.success("发布成功"),Y({type:le.SET_STATUS,payload:1})):g.ZP.info(t.message);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(){return(Ee=u()(l()().mark((function e(){return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ae(o.getFieldsValue(),"start"),setTimeout(u()(l()().mark((function e(){var n,t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,N.uE)(r);case 2:n=e.sent,t=n.identifier,window.location.href=Se?"/myproblems/".concat(t,"?type=1"):"/myproblems/".concat(t);case 5:case"end":return e.stop()}}),e)}))),400);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){if(de)console.log("---",a.get("callback_url")),S.history.replace(a.get("callback_url"));else if(Se){var e,n=null===(e=localStorage.getItem("program_homework"))||void 0===e?void 0:e.split(",");S.history.push("/classrooms/".concat(null==n?void 0:n[0],"/program_homework/").concat(null==n?void 0:n[1],"/detail"))}else S.history.replace("/problemset")}var Pe=function(e){var n=parseInt(o.getFieldValue("hack").code_compile_score)||0,t=Math.floor((100-n)/e.length),a=t+(100-n)%e.length,i=e.map((function(n,i){return i===e.length-1?h()(h()({},n),{},{score:a}):h()(h()({},n),{},{score:t})}));z(i)};(0,m.useEffect)((function(){if(ae){var e=parseInt(o.getFieldValue("hack").code_compile_score)||0,n=null==te?void 0:te.length,t=Math.floor((100-e)/n),a=(100-e)%n;null==te||te.map((function(e,i){return e.score=t,e.position=i+1,i===n-1&&(e.score=t+a),e})),Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_sets:te})}}),o.setFieldsValue({hack_sets:te})}}),[ae]);(0,m.useEffect)((function(){var e,n;null!=J&&null!==(e=J.hack)&&void 0!==e&&null!==(e=e.sub_discipline_id)&&void 0!==e&&e[1]&&Le(null==J||null===(n=J.hack)||void 0===n||null===(n=n.sub_discipline_id)||void 0===n?void 0:n[1])}),[null==J||null===(n=J.hack)||void 0===n?void 0:n.sub_discipline_id]);var Le=function(){var e=u()(l()().mark((function e(n){var t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.YY)({sub_discipline_id:n});case 2:t=e.sent,D(t.tag_disciplines);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();var Re=function(){var e=u()(l()().mark((function e(){var n,t,i,r;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.validateFields();case 3:if(n=o.getFieldsValue(),!a.get("exercise")||de.includes("paperlibrary")){e.next=7;break}return x.Z.confirm({title:"保存提示",content:"此题目已存在试题库中,是否将修改后的试题覆盖试题库的原题?",okText:"覆盖原题",cancelText:"不覆盖",onOk:function(){return Ae(n,"",1)},onCancel:function(){return Ae(n,"",0)}}),e.abrupt("return");case 7:Ae(n,"",1),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(0),o.scrollToField(null===e.t0||void 0===e.t0||null===(t=e.t0.errorFields)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.name,{behavior:"smooth",block:"start"}),r=null===e.t0||void 0===e.t0||null===(i=e.t0.errorFields)||void 0===i||null===(i=i[0])||void 0===i||null===(i=i.errors)||void 0===i?void 0:i[0],g.ZP.error(r);case 15:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}(),Be=(0,m.useState)(),Ve=p()(Be,2),Oe=Ve[0],De=Ve[1],Me=(0,m.useState)(!1),We=p()(Me,2),He=We[0],ze=We[1];return(0,m.useEffect)((function(){if(He){var e=document.getElementById("scroll-key-".concat(Oe));null==e||e.scrollIntoView({behavior:"smooth"}),ze(!1)}}),[Oe,He]),(0,ne.jsx)(y.Z,{spinning:K,delay:500,children:J?(0,ne.jsxs)("div",{className:_.bg,children:[(0,ne.jsxs)("header",{className:_.header,children:[(0,ne.jsxs)("div",{className:_.avatar,children:[(0,ne.jsx)("img",{src:"".concat(E.Z.IMG_SERVER,"/images/").concat(null==Q?void 0:Q.image_url),alt:"user"}),(0,ne.jsx)("span",{children:null==Q?void 0:Q.name})]}),(0,ne.jsxs)("div",{className:_.title,children:[" ",(null==J?void 0:J.hack.name)||"编程题"," "]}),(0,ne.jsxs)("div",{className:_.exitBtn,onClick:Fe,children:[(0,ne.jsx)("i",{className:"icon iconfont icon-tuichu1"}),(0,ne.jsx)("span",{children:"退出"})]})]}),(0,ne.jsx)(v.Z,{colon:!1,form:o,initialValues:J,onValuesChange:function(e){var n;if(null!=e&&null!==(n=e.hack)&&void 0!==n&&n.sub_discipline_id){var t,a,i,r=null==e||null===(t=e.hack)||void 0===t?void 0:t.sub_discipline_id,s=p()(r,2),c=s[0],l=s[1],u=(null==X||null===(a=X.find((function(e){return e.id===c})))||void 0===a||null===(a=a.sub_disciplines)||void 0===a||null===(a=a.find((function(e){return e.id===l})))||void 0===a||a.tag_disciplines,h()(h()({},o.getFieldsValue()),{},{hack:h()(h()({},null===(i=o.getFieldsValue())||void 0===i?void 0:i.hack),{},{tag_discipline_ids:[]})}));o.setFieldsValue(u),R(u)}else R(h()({},o.getFieldsValue()))},labelCol:{flex:"200px"},children:(0,ne.jsx)("div",{className:_.contentWrapper,children:(0,ne.jsx)(b.Z,{className:_.tabWrapper,tabBarGutter:180,centered:!0,items:[{label:"基础信息",key:"1",children:(0,ne.jsx)(ie,{onAddTestCases:function(){var e=o.getFieldValue("hack_sets"),n=parseInt(o.getFieldValue("hack").code_compile_score)||0,t=e.length,a=Math.floor((100-n)/t),i=(100-n)%t;e.map((function(n,t){return ae&&(n.score=a,t===e.length-1&&(n.score=a+i)),n.position=t+1,n})),o.setFieldsValue({hack_sets:e}),Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_sets:e})}})},form:o,handleAddKnowledgeFinish:function(e){D([].concat(s()(O),[h()({},e)]))},MyGroup:ge,formValue:L,knowledgeOptions:O,onChangeLanguage:function(e){Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_codes:h()(h()({},J.hack_codes),{},{language:e})})}})},onChangeSubDiscipline:function(e){var n=e[1],t=(0,k.y3)(X,n),a=p()(t,2)[1];o.setFieldsValue({tags:[]}),Y({type:le.SET_INITAL_DATA,payload:{dicts:a,data:h()(h()({},J),{},{hack:h()(h()({},J.hack),{},{sub_discipline_id:e}),tags:[]})}})},onRemoveTestCase:function(e){var n=o.getFieldValue("hack_sets"),t=parseInt(o.getFieldValue("hack").code_compile_score)||0,a=(null==n?void 0:n.length)-1,i=Math.floor((100-t)/a),r=(100-t)%a;n.splice(e,1),null==n||n.map((function(e,n){return ae&&(e.score=i,n===a-1&&(e.score=i+r)),e.position=n+1,e})),Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_sets:n})}}),o.setFieldsValue({hack_sets:n})},onAddTestCase:function(){var e=o.getFieldValue("hack_sets"),n=parseInt(o.getFieldValue("hack").code_compile_score)||0,t=e.length+1,a=Math.floor((100-n)/t),i=(100-n)%t;e.map((function(e,n){return ae&&(e.score=a),e.position=n+1,e})),e.push({input:"",output:"",position:t,score:ae?a+i:0}),o.setFieldsValue({hack_sets:e}),Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_sets:e})}}),De(e.length-1),ze(!0)},dicts:$,categorys:we,callback_url:de,hack:J.hack,onChangeScore:function(e){e.target.value||Pe(H),Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack:h()(h()({},J.hack),{},{test_set_score:e.target.value})})}})},onChangeAverage:function(e){var n=e.target.value;n&&Pe(H);var t=o.getFieldValue("hack_sets");Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_sets:t,hack:h()(h()({},J.hack),{},{test_set_average:n})})}})},onChangeFile:function(e){Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack:h()(h()({},J.hack),{},{is_file:e.target.value})})}})},uploadData:H,setUploadData:z,handleUploadRatio:Pe,isshows:je,isProgram:Se,addUploadFnc:function(e){var n,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return function(){Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack:h()(h()({},J.hack),{},{is_file:!0})})}}),o.setFieldsValue({hack:{is_file:!0}})};var a=null==e?void 0:e.map((function(e){return{input:e.input,output:e.output,score:0,position:1}})),i=null===(n=o.getFieldValue("hack_sets"))||void 0===n||null===(n=n.filter((function(e){return e.input||e.output})))||void 0===n?void 0:n.concat(a),r=parseInt(o.getFieldValue("hack").code_compile_score)||0,s=null==i?void 0:i.length,c=Math.floor((100-r)/s),l=(100-r)%s;null==i||i.map((function(e,n){return ae&&(e.score=c,n===s-1&&(e.score=c+l)),e.position=n+1,e})),Y({type:le.SET_INITAL_DATA,payload:{data:h()(h()({},J),{},{hack_sets:i,hack:h()(h()({},J.hack),{},{is_file:!1})})}}),o.setFieldsValue({hack_sets:i,hack:{is_file:!1}})},activeKey:Oe,setActiveKey:De})},{label:"学员初始代码",key:"2",forceRender:!0,children:(0,ne.jsx)("div",{className:_.codePanelWrapper,children:Se?(0,ne.jsx)(v.Z.Item,{name:"codes",noStyle:!0,children:(0,ne.jsx)(Z.Z,{})}):(0,ne.jsx)(v.Z.Item,{name:["hack_codes","code"],noStyle:!0,children:(0,ne.jsx)(A.Z,{language:J.hack_codes.language})})})}]})})}),(0,ne.jsx)("div",{className:_.buttonFixed,children:r?(0,ne.jsxs)(m.Fragment,{children:[(0,ne.jsx)("div",{className:_.cancelBtn,onClick:Fe,children:"取消"}),(0,ne.jsx)(j.ZP,{className:"".concat(_.saveBtn," ml20"),loading:K,type:"primary",onClick:(0,re.throttle)(Re,1e3),children:"保存"}),(0,ne.jsx)(j.ZP,{type:"primary",className:"".concat(_.challengeBtn," ml20"),onClick:(0,re.throttle)((function(){return Ee.apply(this,arguments)}),1e3),icon:(0,ne.jsx)("i",{className:"icon iconfont icon-kaishitiaozhan1 mr5 font14"}),children:ee?"开始挑战":"模拟挑战"})]}):(0,ne.jsxs)(m.Fragment,{children:[(0,ne.jsx)("div",{className:_.cancelBtn,onClick:Fe,children:"取消"}),(0,ne.jsx)(j.ZP,{className:"".concat(_.saveBtn," ml20"),loading:K,type:"primary",onClick:(0,re.throttle)(Re,1e3),children:"保存"})]})})]}):(0,ne.jsx)("div",{className:"vh100"})})}},13119:function(e,n,t){t.d(n,{GM:function(){return u},MK:function(){return o},PR:function(){return i},ZS:function(){return p},d1:function(){return r},fu:function(){return s},j2:function(){return d},l_:function(){return c},uE:function(){return f},zQ:function(){return l}});var a=t(94171);function i(){return(0,a.U2)("problems/new.json")}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"question";return(0,a.U2)("disciplines.json",{source:e})}function s(e){return(0,a.U2)("problems/".concat(e,"/edit.json"))}function c(e,n){return(0,a.gz)("problems/".concat(e,".json"),n)}function l(e){return(0,a.v_)("problems.json",e)}function o(e,n){return(0,a.v_)("exercises/".concat(e,"/exercise_questions.json"),n)}function u(e,n){return(0,a.gz)("exercise_questions/".concat(e,".json"),n)}function d(e){return(0,a.v_)("problems/".concat(e,"/publish.json"))}function p(e){return(0,a.v_)("problems/".concat(e,"/cancel_publish.json"))}function f(e){return(0,a.U2)("problems/".concat(e,"/start.json"))}},42190:function(e,n,t){t.d(n,{D0:function(){return d},R8:function(){return l},jw:function(){return u},y3:function(){return p}});var a=t(85573),i=t.n(a),r=t(57809),s=(t(59301),t(37712)),c=r.default.Option,l=function(e){return e[e.language=0]="language",e[e.difficult=1]="difficult",e[e.category=2]="category",e[e.openOrNot=3]="openOrNot",e}({}),o=i()(i()(i()(i()({},l.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"}]),l.difficult,[{title:"简单",key:1},{title:"中等",key:2},{title:"困难",key:3}]),l.category,[{title:"程序设计",key:1},{title:"算法",key:2}]),l.openOrNot,[{title:"公开",key:1},{title:"私有",key:0}]);function u(e){return o[e].map((function(e){return(0,s.jsxs)(c,{value:e.key,children:[" ",e.title," "]},e.title)}))}function d(e,n){e.map((function(e){var t=e.id,a=e.name,i=e.sub_disciplines,r={value:t,label:a};n.push(r),i&&i.length>0&&(r.children=[],d(i,r.children))}))}function p(e,n){for(var t=[],a=0;a<e.length;a++){var i,r=e[a];if((null===(i=r.sub_disciplines)||void 0===i?void 0:i.length)>0){t[0]=r.id;for(var s=0;s<r.sub_disciplines.length;s++){var c=r.sub_disciplines[s];if(c.id===n)return t[1]=c.id,[t,c.tag_disciplines||c.sub_disciplines||[]]}}}return[t,[]]}},97183:function(e,n,t){t.d(n,{c:function(){return a}});var a=function(e){return e[e.Single=0]="Single",e[e.Multiple=1]="Multiple",e[e.Judge=2]="Judge",e[e.Fill=3]="Fill",e[e.Subjective=4]="Subjective",e[e.Shixun=5]="Shixun",e[e.Program=6]="Program",e[e.Combine=7]="Combine",e}({})},34407:function(e,n,t){t.d(n,{G:function(){return s},t:function(){return r}});var a=t(7062),i=t.n(a);function r(e,n){var t=i().get("__ec");t||(t={}),t[e]=n,i().set("__ec",t)}function s(e,n){var t=i().get("__ec");return t?void 0===t[e]?n:t[e]:n}},69092:function(e,n){n.Z={wrap:"wrap___ilWvf",deleteIcon:"deleteIcon___JBDG8",keywordTag:"keywordTag___iieCb",questionTitleEditorWrap:"questionTitleEditorWrap___MHB5s",choiceWrap:"choiceWrap___QFkTc",choiceIndex:"choiceIndex___Mr2YO",judgementIndex:"judgementIndex___fUVWK",setAnswerBtn:"setAnswerBtn___Whox5",activeAnswer:"activeAnswer___fGU6Y",activeJudgementAnswer:"activeJudgementAnswer___wJv8P",actionWrapper:"actionWrapper___ERQ7k",addIcon:"addIcon___L9TE0",inputBorder:"inputBorder___Q5tRE",placeholder:"placeholder___p9sFY",blankWrapper:"blankWrapper___nC45e",blankInput:"blankInput___pEHsx",blankInputNumberWrapper:"blankInputNumberWrapper___uEHb0",addBtn:"addBtn___WR5ZI",blankIndex:"blankIndex___x9Pny",baseInputWrapper:"baseInputWrapper___eVsG7",collapseWrapper:"collapseWrapper___ZTysU",panelHeader:"panelHeader___QSN9g",open:"open___B6FU9",close:"close___QX19r",hide:"hide___mn25n"}},45298:function(){},73631:function(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAZxJREFUOBGtlL1Ow0AMgH2XUIkOLFXVASgTsDHxBIAEzAwMPBQjT8AATGVBgEBCYmHmFcICYmBogCbNYSe52HUTVZWwFJ3PP599Z+WMcy6Af5SwYkWnLYifTyBzq5XNK8YNwbbvYP381ZuaVlN1+HJwAc4d1QYaA+gDsHYANrhGHTdCMtSDMILtwSMDn7ZiANPKwyjeQ0Reo4r1gEoEwRkDb7spdPcBeocMk1Cv00oii5L+fgPwcR/zHfb3AJY2sEpUVLOUhB/l+w7I1iS9TYDFrM3AzhqGDstPZ3li2Z12U2WLvk4fGJh+F0elYN8ZrbWiA7igAP4WR6sFzDAKPgPHP0VnlMsFS5IyyIGoeAamCKybYI5UQLWVE2fgGI/s72wqQXRd9jyxiHgGJtihFxGQm8Qd5XvtF3fEQOrQH9mDm1Z9hyJuEphXIq9uSWSQqv8a4RbAUTFdcs7gifwplYGjT3wzbPFz6Q70EZv8WZoxMP66ApMc86inirNBA8njcFIuvOTXhowPyzuQJiukzi3hQgS7b+I9nJtQn/AHsLGsvlcPPWsAAAAASUVORK5CYII="},5623:function(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAedJREFUOBGtVDtLA0EQ/jY5z7dgEBVJLHyAitpYWQqKjVZa5BfEKpWlWPgrLG0UEdTexkILRUQiSBBBCAhGUINFHia53Dm7ufXcvfgIOHA3O69vvtnbPeY4ThD/KIF/xBJQhg/wbmkZtj0KMKbEGNIweg4xuPmq+DWDKSOfz2/AqaxpOVWzip8HC2xTsydfjoMHhMd2VMDjkSswTPqSucOhh3PmupaIediBOnL52UTLENC7QCV1bC9vkjkF3i4WVUDeORIF2sf5ymOk7mY1pr87hoHEhekHDLYQOfck8c6c6OeYfPHN3LyOxEB2KwQru0LrBvTPdaGRipj7ISUzqUWJ/moiRyc1tUXAQP42Tsa6sEIRCtwDRXqESDYS8RuG5iyRMEWFAat4CbvsAmgFmukmeYofJYeSAimab0L4DfQNHiF1laFAyMv840o2zN3Q1FMuIOIWStF9OtAxH4xkIC8NZyN9SnIOsNISkLRd3EWlFBP0lQJtDzVTyc8mBKB3U65nUnBYmDaFAr98BFGqvYKtwOMZHRsp1vsedVxV8bQRJXu5BbKWa6sAmK1lj2FiOoLcS5LYNX/N+3ktp+GapFJMeoDccdI9gEJ2nW5HhJjKuXmktih7yjJoC8VVwNpldXnr+KX8DfcD09mnwzz7SXEAAAAASUVORK5CYII="}}]); |