You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Classrooms__Lists__Gradu...

1 line
54 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[68882,50872,42802],{79661: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],c=n?"".concat(n,"/").concat(i.name):"".concat(i.name);t.push({title:i.name,isLeaf:"tree"!==i.type,key:c})}return t}function c(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&&c(i.children,n,t)}return e}function r(e,n,t){var a;return function(){var i=this,c=arguments,r=function(){a=null,t||e.apply(i,c)},s=t&&!a;clearTimeout(a),a=setTimeout(r,n),s&&e.apply(i,c)}}t.d(n,{Ax:function(){return c},Ds:function(){return r},KI:function(){return s},SI:function(){return i},f1:function(){return a}});var s=t(84666).Z.API_SERVER},53070:function(e,n,t){var a=t(82242),i=t.n(a),c=(t(59301),t(19779)),r=t(3113),s=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,a=void 0===t?{}:t,l=e.styles,o=void 0===l?{}:l,u=e.customText,d=e.ButtonText,p=e.ButtonClick,f=e.Buttonclass,m=e.ButtonTwo,h=e.imgStyles,x=e.loading,g=void 0!==x&&x;return(0,s.jsxs)("section",{className:"tc animated fadeIn",style:i()(i()({},{color:"#999",margin:"100px auto",visibility:g?"hidden":"visible"}),o),children:[(0,s.jsx)("img",{src:n||c,style:i()({width:288,height:200},h)}),(0,s.jsx)("p",{className:"mt20 font14",children:u||"暂时还没有相关数据哦!"}),d&&(0,s.jsx)(r.ZP,i()(i()({className:f,onClick:p},a),{},{children:d})),m&&m]})}},31013:function(e,n,t){t.d(n,{Z:function(){return b}});var a=t(82242),i=t.n(a),c=t(7557),r=t.n(c),s=t(41498),l=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=t(3113),m=t(22441),h=t(97704),x=t(6848),g=t(16739),v=t(75278),j=t(53070),y=t(84666),_=t(37712),b=function(e){var n,t,a,c,s,o,b,k=e.editOffice,w=void 0===k?"view":k,N=e.data,Z=(e.theme,e.type),S=e.filename,C=e.monacoEditor,E=e.className,T=e.style,P=e.close,I=e.onClose,R=e.hasMask,L=e.disabledDownload,A=e.onImgDimensions,O=e.showNodata,V=(0,d.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),F=u()(V,2),D=(F[0],F[1],(0,d.useState)("")),M=u()(D,2),B=(M[0],M[1]),H=(0,d.useState)(),z=u()(H,2),W=z[0],q=z[1],$="build"===window.ENV?"/react/build":"",J=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER,Y=(0,d.useRef)();null!==(n=N)&&void 0!==n&&n.startsWith("/api")&&"txt"!==Z&&(N=y.Z.API_SERVER+N),S&&(C.filename=S),(0,d.useEffect)((function(){var e,n=null===(e=document.cookie)||void 0===e||null===(e=e.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==n||n.map((function(e){var n=e.split("=");"_educoder_session"===n[0]&&B(n[1])}))}),[]),(0,d.useEffect)((function(){"office"===Z&&K()}),[Z,N]);var K=function(){var e=l()(r()().mark((function e(){var n,t,a;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=N,N.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=5,(0,v.gJ)({attachment_id:t});case 5:a=e.sent,q(a);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),U=function(){N.startsWith("http")||N.startsWith("blob:")?G():(0,g.Sv)(S||"educoder",N,S)},G=function(){(0,g.Nd)(S||"educoder",decodeURIComponent(N))};return(0,_.jsxs)("div",{style:i()({},T||{}),className:"".concat(R&&p.bgBlack," ").concat(Z?p.wrp:"hide"),children:[P&&(0,_.jsxs)("div",{className:p.close,ref:Y,children:[!!A&&(0,_.jsx)(x.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return Y.current},children:(0,_.jsx)("span",{onClick:function(){I(),A()},children:(0,_.jsx)("i",{className:"icon-yulanpizhu"})})}),!L&&(0,_.jsx)(x.Z,{title:"点击下载此文件",getPopupContainer:function(){return Y.current},children:(0,_.jsx)("span",{onClick:G,children:(0,_.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,_.jsx)(x.Z,{title:"关闭",getPopupContainer:function(){return Y.current},children:(0,_.jsx)("span",{className:"",onClick:I,children:(0,_.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,_.jsx)("div",{className:"".concat(p[E]," ").concat(E," ").concat(p.monaco," ").concat("txt"===Z?"show":"hide"),children:"txt"===Z&&(0,_.jsx)(h.ZP,i()({},C))}),"audio"===Z&&(0,_.jsx)("audio",{src:(null===(t=N)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(a=N)&&void 0!==a&&a.startsWith("/api")?N:"data:image/png;base64,".concat(N),autoPlay:!0}),"video"===Z&&(0,_.jsx)(_.Fragment,{children:(null===(c=N)||void 0===c?void 0:c.indexOf("http"))>-1||null!==(s=N)&&void 0!==s&&s.startsWith("/api")?(0,_.jsx)("video",{controls:!0,src:"".concat(N),autoPlay:!0}):(0,_.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(N),autoPlay:!0})}),"office"===Z&&W&&(0,_.jsx)("iframe",{src:"".concat($,"/office.html?key=").concat(W.key,"&url=").concat(J+W.url,"&callbackUrl=").concat(J+W.callbackUrl,"&fileType=").concat(W.fileType,"&title=").concat(W.title,"&model=").concat(w,"&officeServer=").concat(y.Z.ONLYOFFICE,"&disabledDownload=").concat(!!L)}),"html"===Z&&(0,_.jsx)("iframe",{src:N+"&disposition=inline"}),"pdf"===Z&&(0,_.jsx)("iframe",{src:"".concat($,"/js/pdfview/index.html?url=").concat(N,"&disabledDownload=").concat(!!L)}),"image"===Z&&(0,_.jsx)("img",{src:(null===(o=N)||void 0===o?void 0:o.indexOf("http"))>-1||null!==(b=N)&&void 0!==b&&b.startsWith("/api")?N:"data:image/png;base64,".concat(N)}),("other"===Z||"download"===Z)&&(0,_.jsx)(_.Fragment,{children:O?(0,_.jsx)(j.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,_.jsx)(f.ZP,{icon:(0,_.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:U,children:"下载"})}):(0,_.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:U,children:[(0,_.jsx)(m.Z,{}),"点击下载"]})})]})}},50872:function(e,n,t){t.d(n,{Z:function(){return z}});var a=t(82242),i=t.n(a),c=t(37205),r=t.n(c),s=t(91232),l=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p=(t(59611),t(32834)),f=t.n(p),m=t(11690);var h=[],x=["<ul>"],g=new(f().Renderer),v=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function j(){h.length=0,x=["<ul>"]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function _(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 c=[];return n=_(e,++n,i.level,c),c.length>0&&(a.push("<ul>"),c.forEach((function(e){a.push(e)})),a.push("</ul>")),a.push("</li>"),n=_(e,n,t,a)}function b(){return _(h,0,0,x),x.push("</ul>"),x.join("")}var k={heading:function(e){var n=v.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 c=Z(),r=a;a=c,S[c]={type:"block",expression:r}}return{type:"code",raw:t,lang:i,text:a}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,N=0,Z=function(){return"__special_katext_id_".concat(N++,"__")},S={};function C(){return S}function E(){N=0,S={}}function T(e){return e=e.replace(w,(function(e,n){var t=Z();return S[t]={type:"inline",expression:n},t}))}var P=g.listitem;g.listitem=function(e){return P(T(e))};var I=g.paragraph;g.paragraph=function(e){return I(T(e))};var R=g.tablecell;g.tablecell=function(e,n){return R(T(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,m.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(t?e:(0,m.escape)(e,!0))+"</code></pre>"},g.heading=function(e,n,t){var a=this.options.headerPrefix+t.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.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(),A=(t(64018),t(6419)),O=t(84666),V=t(15342),F=t(1012),D=t(31013),M=t(37712),B="@▁@",H=/<pre[^>]*>/g;var z=function(e){var n=e.value,t=void 0===n?"":n,a=e.className,c=e.showTextOnly,s=e.showLines,o=e.style,p=void 0===o?{}:o,f=e.stylesPrev,m=void 0===f?{}:f,h=e.highlightKeywords,x=e.showProgramFill,g=(e.isProgramFill,e.disabledFill),v=void 0!==g&&g,_=e.programFillValue,k=e.onFillChange,w=void 0===k?function(e){}:k,N=e.onFillBlur,Z=void 0===N?function(){}:N,S=String(t),T=(0,d.useState)(""),P=u()(T,2),I=P[0],R=P[1],z=(0,d.useState)("office"),W=u()(z,2),q=W[0],$=W[1],J=(0,d.useState)([]),Y=u()(J,2),K=Y[0],U=Y[1],G=(0,d.useRef)("a"+(0,F.Z)()),X={},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(G.current," ").concat(e))})),"<style>".concat(a.join("}"),"</style>")}))},ee=(0,d.useMemo)((function(){try{S=S.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+O.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+O.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+O.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(x){var e=-1;return S=S.replaceAll("<","&lt;").replaceAll(">","&gt;").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(X).length;return X[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(S||""),"</pre>")}var n=L(S);n=Q(n);var t=C();S.match(/\[TOC\]/)&&(n=n.replace("<p>[TOC]</p>",b()),j()),n=n.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var a=t[n],i=a.type,c=a.expression;return(0,V.renderToString)(function(e){var n=document.createElement("div");return n.innerHTML=e,0===n.childNodes.length?"":n.childNodes[0].nodeValue}(c)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})})),n=n.replace(/▁/g,"▁▁▁"),E();var a=document.createElement("div");return a.innerHTML=n,h?(ae(a,h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a.innerHTML):c?a.innerText:(setTimeout((function(){return re()}),500),a.innerHTML)}),[S,h]);(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!=_&&_.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,c=u()(e.value,2),r=c[0],s=c[1];s.value=null===(i=_[r])||void 0===i?void 0:i.value,"warning"===_[r].type?s.className="program-fill-warning":"success"===_[r].type?s.className="program-fill-success":s.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,m=u()(o.value,2),h=m[0];m[1].innerHTML=null!==(p=_[h])&&void 0!==p&&p.score?"".concat(null===(f=_[h])||void 0===f?void 0:f.score,"分"):""}}catch(e){d.e(e)}finally{d.f()}U(_)}}),[_]);var ne=function(e){K[e.target.dataset.id]=K[e.target.dataset.id]||{},K[e.target.dataset.id].value=e.target.value,U(r()(K)),w(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,U(r()(K)),Z(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 ce(e){var n=e.target;if("A"===n.tagName.toUpperCase()){var t=n.getAttribute("href");if(t.indexOf("office")>-1)e.preventDefault(),R(t),$("office");else if(t.indexOf("application/pdf")>-1)e.preventDefault(),R(t),$("pdf");else if(t.indexOf("text/html")>-1)e.preventDefault(),R(t),$("html");else if(t.startsWith("#")){e.preventDefault();var a=document.getElementById(t.replace("#",""));a&&a.scrollIntoView(!0)}}}y.WebkitLineClamp=s,s&&(p=i()(i()({},p),y));var re=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(A.ZP.isSupported()){var n=new A.ZP;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",ce),function(){var e;null===(e=ie.current)||void 0===e||e.removeEventListener("click",ce),E(),j()}}),[ee,ie.current,ce]),(0,M.jsxs)(M.Fragment,{children:[c&&(0,M.jsx)("div",{ref:ie,children:ee}),!c&&(0,M.jsx)("div",{ref:ie,style:i()({},p),className:"".concat(a||""," ").concat(v?"disabled-fill":""," markdown-body ").concat(G.current),dangerouslySetInnerHTML:{__html:ee}}),(0,M.jsx)(D.Z,{close:!0,data:I,type:null!=I&&I.length?q:"",style:i()({},m),onClose:function(){return R("")}})]})}},7435:function(e,n,t){t.d(n,{h:function(){return g}});var a=t(82242),i=t.n(a),c=t(79800),r=t.n(c),s=t(59301),l=t(57809),o=t(78241),u=t(3113),d=t(89780),p=t.n(d),f=(t(80577),t(82612),t(37712)),m=l.default.Option,h={labelCol:{span:4},wrapperCol:{span:20}},x={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,c=e.options,l=void 0===c?{}:c,o=(0,s.useRef)(),u=(0,s.useState)(),d=r()(u,2),m=d[0],h=d[1];return(0,s.useEffect)((function(){if(m){var e=function(e){var n=e.getValue();t&&t(n)};return m.on("change",e),function(){m.off("change",e)}}}),[m,t]),(0,s.useEffect)((function(){m&&m.setOption("mode",a)}),[m,a]),(0,s.useEffect)((function(){m&&(n===m.getValue()&&""!==n||setTimeout((function(){m.setValue(n||"")}),300))}),[m,n]),(0,s.useEffect)((function(){if(o.current&&!m){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));h(e)}}),[o.current,m]),(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,s.useState)("python"),c=r()(a,2),d=c[0],p=c[1];return(0,f.jsxs)(o.Z,i()(i()({},h),{},{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(x[e][1])},children:Object.keys(x).map((function(e){return(0,f.jsx)(m,{value:e,children:x[e][0]},e)}))})}),(0,f.jsx)(o.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:"取消"})]})]}))}},10302:function(e,n,t){t.d(n,{Z:function(){return le}});var a=t(91232),i=t.n(a),c=t(7557),r=t.n(c),s=t(41498),l=t.n(s),o=t(79800),u=t.n(o),d=t(85573),p=t.n(d),f=t(59301),m=t(89780),h=t.n(m),x=t(76374),g=(t(80577),t(6313),t(25717),t(99498),t(25419),t(67549),t(50872)),v=t(37712),j=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,v.jsx)(v.Fragment,{children:(0,v.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})})},y=t(82242),_=t.n(y),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,c=e.className,r=void 0===c?"":c,s=e.children;return(0,v.jsxs)("a",{title:t,className:r,onClick:function(){n(i)},children:[(0,v.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,c=e.fullScreen,r=e.insertTemp,s=e.hidetoolBar,l=[].concat(b,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,v.jsxs)("ul",{className:"markdown-toolbar-container",children:[!s&&l.map((function(e,n){return(0,v.jsx)("li",{children:e.actionName?(0,v.jsx)(k,_()(_()({},e),{},{onActionCallback:i})):(0,v.jsx)("span",{className:"v-line"})},n)})),t?(0,v.jsx)("li",{children:(0,v.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:i,children:(0,v.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,a?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("li",{children:(0,v.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:i,children:(0,v.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,v.jsx)("li",{children:(0,v.jsx)(k,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:i,children:(0,v.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,r&&(0,v.jsx)("li",{children:(0,v.jsx)(k,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(r),onActionCallback:i,children:(0,v.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,v.jsx)("li",{className:"btn-full-screen",children:(0,v.jsx)(k,{icon:"".concat(c?"icon-shrink":"icon-enlarge"),title:c?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},N=t(39205),Z=t(78241),S=t(24650),C=t(3113),E={labelCol:{span:4},wrapperCol:{span:20}},T=function(e){var n=e.callback,t=e.onCancel;return(0,v.jsxs)(Z.Z,_()(_()({},E),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,v.jsx)(Z.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,v.jsx)(S.Z,{})}),(0,v.jsx)(Z.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,v.jsx)(S.Z,{})}),(0,v.jsxs)("div",{className:"flex-container flex-end",children:[(0,v.jsx)(C.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,v.jsx)(C.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},P=t(7435),I=t(8591),R=t(79661),L=Z.Z.useForm,A={width:280,marginRight:10},O={labelCol:{span:5},wrapperCol:{span:19}},V=function(e){var n=e.callback,t=e.onCancel,a=L(),i=u()(a,1)[0],c=(0,f.useRef)();function r(e,n){-1!==e.status?i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):I.ZP.error(e.message)}return(0,v.jsxs)(Z.Z,_()(_()({form:i},O),{},{className:"upload-image-panel",onFinish:function(e){n(_()(_()({},e),{},{name:c.current}))},style:{width:470,overflow:"hidden"},children:[(0,v.jsx)(Z.Z.Item,{label:"图片地址",required:!0,children:(0,v.jsxs)("div",{className:"flex-container",children:[(0,v.jsx)(Z.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,v.jsx)(S.Z,{style:A})}),(0,v.jsx)(F,{onFileChange:function(e){var n=e.target.files[0];c.current=n.name,D(n,r)}})]})}),(0,v.jsx)(Z.Z.Item,{label:"图片描述",name:"alt",children:(0,v.jsx)(S.Z,{style:{width:264}})}),(0,v.jsxs)(Z.Z.Item,{style:{textAlign:"right"},children:[(0,v.jsx)(C.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,v.jsx)(C.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function F(e){var n=e.onFileChange;return(0,v.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,v.jsx)("input",{type:"file",onChange:n})]})}function D(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(R.KI,"/api/attachments.json")),a.send(t)}var M=t(5112),B=t(94001),H=M.ZP.Group,z={margin:"0 8px"},W=function(e){var n=e.callback,t=e.onCancel;return(0,v.jsxs)(Z.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,v.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,v.jsx)("span",{style:z,children:"单元格数:"}),(0,v.jsx)("span",{style:z,children:"行数"}),(0,v.jsx)(Z.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,v.jsx)(B.Z,{})}),(0,v.jsx)("span",{style:z,children:"列数"}),(0,v.jsx)(Z.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,v.jsx)(B.Z,{})})]}),(0,v.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,v.jsx)("span",{style:z,children:"对齐方式:"}),(0,v.jsx)(Z.Z.Item,{name:"align",children:(0,v.jsxs)(H,{children:[(0,v.jsx)(M.ZP,{value:"default",children:(0,v.jsx)("i",{className:"fa fa-align-justify"})}),(0,v.jsx)(M.ZP,{value:"left",children:(0,v.jsx)("i",{className:"fa fa-align-left"})}),(0,v.jsx)(M.ZP,{value:"center",children:(0,v.jsx)("i",{className:"fa fa-align-center"})}),(0,v.jsx)(M.ZP,{value:"right",children:(0,v.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,v.jsxs)("div",{className:"flex-container flex-end",children:[(0,v.jsx)(C.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,v.jsx)(C.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},q=t(84666),$=t(67444),J=t(1012),Y=t(43418),K="link",U="upload-image",G="code-block",X="add-table",Q="------------",ee={default:Q,left:":".concat(Q),center:":".concat(Q,":"),right:"".concat(Q,":")},ne=t(6487);var te="@▁▁@";function ae(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",ce=["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"],re=p()(p()({},ie+"-B","bold"),ie+"-I","italic"),se=p()(p()(p()(p()({},K,"添加链接"),G,"添加代码块"),U,"添加文件"),X,"添加表格"),le=function(e){var n=e.defaultValue,t=void 0===n?"":n,a=e.onChange,c=e.width,s=void 0===c?"100%":c,o=e.height,d=void 0===o?400:o,m=e.miniToolbar,y=void 0!==m&&m,_=e.isFocus,b=void 0!==_&&_,k=e.watch,Z=e.insertTemp,S=e.mode,C=void 0===S?"markdown":S,E=e.id,R=void 0===E?"markdown-editor-id":E,L=e.showResizeBar,A=void 0!==L&&L,O=e.noStorage,F=void 0!==O&&O,M=e.showNullButton,B=void 0!==M&&M,H=e.showNullProgramButton,z=void 0!==H&&H,Q=e.hidetoolBar,ie=void 0!==Q&&Q,le=e.fullScreen,oe=void 0!==le&&le,ue=e.onBlur,de=e.onCMBeforeChange,pe=e.onFullScreen,fe=e.className,me=void 0===fe?"":fe,he=e.disablePaste,xe=void 0!==he&&he,ge=e.disabled,ve=void 0!==ge&&ge,je=e.disabledFill,ye=void 0!==je&&je,_e=e.placeholder,be=void 0===_e?"":_e,ke=e.values,we=void 0===ke?"":ke,Ne=(0,f.useState)(null),Ze=u()(Ne,2),Se=Ze[0],Ce=Ze[1],Ee=(0,f.useState)(t),Te=u()(Ee,2),Pe=Te[0],Ie=Te[1],Re=(0,f.useState)(k),Le=u()(Re,2),Ae=Le[0],Oe=Le[1],Ve=(0,f.useState)(oe),Fe=u()(Ve,2),De=Fe[0],Me=Fe[1],Be=(0,f.useState)(""),He=u()(Be,2),ze=He[0],We=He[1],qe=(0,f.useState)(0),$e=u()(qe,2),Je=$e[0],Ye=$e[1],Ke=(0,f.useState)(d),Ue=u()(Ke,2),Ge=Ue[0],Xe=Ue[1],Qe=(0,f.useState)(!1),en=u()(Qe,2),nn=(en[0],en[1]),tn=(0,f.useRef)((0,J.Z)()),an=(0,f.useRef)(!1),cn=(0,f.useRef)(),rn=(0,f.useRef)(),sn=(0,f.useRef)(),ln=(0,f.useRef)(),on=(0,f.useRef)(),un=function(){var e=l()(r()().mark((function e(){var n,t;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,$.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:",Se,rn),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?Se.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):e.content_type.indexOf("video")>-1?Se.replaceSelection('<video width="100%" controls src="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Se.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>")):Se.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;Ie(we),null==Se||Se.setValue(we),window.scrollTo(0,e)}),[we]),(0,f.useEffect)((function(){null==pe||pe(De)}),[De]),(0,f.useEffect)((function(){if(rn.current){var e=function(e,t){if(!xe){var a=t.clipboardData;if(a){var i=a.types.toString(),c=a.items;if("Files"===i||a.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==C)return;try{var r,s=c[1];"file"===(null===(r=c[0])||void 0===r?void 0:r.kind)&&(s=c[0]);var l=s.getAsFile(),o=l.name.split(".").pop();D(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("![,](/api/attachments/".concat(e.id,"?type=").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>")):ce.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){I.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=h().fromTextArea(rn.current,{mode:C,lineNumbers:!y,lineWrapping:!0,value:t,autoCloseTags:!z,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),c=i.charAt(a.ch-1),r=i.lastIndexOf("@▁@",a.ch),s=i.lastIndexOf("@▁▁@",a.ch),l=r>s?r:s,o=r>s?3:4;if(-1===te.indexOf(c))return null;if(console.log("change1:",n,e,i,a,l,r,s,c),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()}})),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[c],t=e.name.split(".").pop();D(e,(function(a){var i,c,r;a.id?(null==e||null===(i=e.type)||void 0===i?void 0:i.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(a.id,"?type=").concat(a.content_type,")")):(null==e||null===(c=e.type)||void 0===c?void 0:c.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(q.Z.API_SERVER,"/api/attachments/").concat(a.id,'"></video>')):(null==e||null===(r=e.type)||void 0===r?void 0:r.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>")):ce.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")}))},c=0;c<a.length;c++)i()}})),ve&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ce(n),function(){n.off("paste",e)}}}),[]);var dn=(0,f.useCallback)((function(){sn.current}),[Ge,sn,De]);(0,f.useEffect)((function(){if(Se){var e=function(){var e=new x.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(),Se.setSize("100%","100%"),Se.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(rn.current.parentElement),e}();return function(){var n,t;null!==(n=rn.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=rn.current)||void 0===t?void 0:t.parentElement)}}}),[Se,dn]),(0,f.useEffect)((function(){if(Se){for(var e=[],n=function(){var n=u()(a[t],2),i=n[0],c=n[1],r=p()({},i,(function(){pn(c)}));e.push(r),Se.addKeyMap(r)},t=0,a=Object.entries(re);t<a.length;t++)n();return cn.current=setInterval((function(){an.current&&un()}),4e3),function(){clearInterval(cn.current);for(var n=0,t=e;n<t.length;n++){var a=t[n];Se.removeKeyMap(a)}}}}),[Se]),(0,f.useEffect)((function(){oe!==De&&Me(oe)}),[oe]),(0,ne.Z)((function(){if(!F&&Je>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(R);e>=Je+1e4&&(!n||n!==Pe)&&(window.sessionStorage.setItem(R,Pe),nn(!0))}}),1e4),(0,f.useEffect)((function(){Oe(k)}),[Se,k]),(0,f.useEffect)((function(){Se&&b&&Se.focus()}),[Se,b]),(0,f.useEffect)((function(){if(Ae&&Se){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=Se.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Se,Ae]),(0,f.useEffect)((function(){if(Se&&de){var e=function(e,n){de(e,n)};return Se.on("beforeChange",e),function(){Se.off("beforeChange",e)}}}),[Se,de]),(0,f.useEffect)((function(){if(Se&&ue){var e=function(){ue(Se.getValue())};return Se.on("blur",e),function(){Se.off("blur",e)}}}),[Se,ue]),(0,f.useEffect)((function(){if(Se){var e=function(e,n){var t=e.getValue();Ie(t),Ye((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),a&&(z?a(t,gn(t)):a(t))};return Se.on("change",e),function(){Se.off("change",e)}}}),[Se,a]),(0,f.useEffect)((function(){if(Se)if(null==t)Se.setValue(""),Ie("");else{var e=window.scrollY||window.pageYOffset;t!==Se.getValue()&&(Se.setValue(t),Ie(t),Se.setCursor(ve?1:Se.lineCount(),0),window.scrollTo(0,e))}}),[Se,t]);var pn=(0,f.useCallback)((function(e){var n=Se.getCursor(),t=Se.getSelection(),a=t.split("\n");switch(e){case"bold":return Se.replaceSelection("**"+t+"**"),""===t&&Se.setCursor(n.line,n.ch+2),Se.focus();case"italic":return Se.replaceSelection("*"+t+"*"),""===t&&Se.setCursor(n.line,n.ch+1),Se.focus();case"code":return Se.replaceSelection("`"+t+"`"),""===t&&Se.setCursor(n.line,n.ch+1),Se.focus();case"inline-latex":return Se.replaceSelection("`$$"+t+"$$`"),""===t&&Se.setCursor(n.line,n.ch+3),Se.focus();case"latex":return Se.replaceSelection("```latex\n"+t+"\n```"),Se.setCursor(n.line+1,t.length+1),Se.focus();case"line-break":return Se.replaceSelection("<br/>\n"),Se.focus();case"list-ul":return""===t?Se.replaceSelection("- "+t):Se.replaceSelection(a.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Se.focus();case"list-ol":return""===t?Se.replaceSelection("1. "+t):Se.replaceSelection(a.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),Se.focus();case"add-null-ch":return""===t&&Se.setCursor(n.line,n.ch),Se.replaceSelection("▁"),Se.focus();case"add-signal":return""===t&&Se.setCursor(n.line,n.ch),Se.replaceSelection("@▁@"),Se.focus();case"add-multiple":return""===t&&Se.setCursor(n.line,n.ch),Se.replaceSelection(te),Se.focus();case"inster-template-1":return""===t&&Se.setCursor(n.line,n.ch),Se.replaceSelection("\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作"),Se.focus();case"eraser":return Se.setValue(""),Se.focus();case"trigger-watch":return Oe(!Ae),Se.focus();case"trigger-full-screen":return Me(!De),Se.focus();case K:return void We(K);case G:return void We(G);case U:return void We(U);case X:return void We(X);default:throw new Error}}),[Se,Ae,De]),fn=(0,f.useCallback)((function(e){switch(We(""),ze){case K:var n=e.title,t=e.link;return Se.replaceSelection("[".concat(n,"](").concat(t,")")),Se.focus();case G:var a=e.language,i=e.content;return Se.replaceSelection(["```"+a,i,"```"].join("\n")),Se.focus();case U:var c=e.src,r=e.alt;return r?Se.replaceSelection("![ ".concat(r," ]( ").concat(c,' "').concat(r,'" )')):Se.replaceSelection("![,](".concat(c,")")),Se.focus();case X:for(var s=e.row,l=e.col,o=e.align,u="\n",d=0;d<s;d++){for(var p=[],f=[],m=0;m<l;m++)1===d&&f.push(ee[o]),p.push(" ");1===d&&(u+="| ".concat(f.join(" | ")," |\n")),u+="| ".concat(p.join(1===l?"":" | ")," |\n")}return Se.replaceSelection(u+"\n"),Se.focus();default:throw new Error}}),[Se,ze]),mn=(0,f.useMemo)((function(){switch(ze){case K:return(0,v.jsx)(T,{callback:fn,onCancel:hn});case G:return(0,v.jsx)(P.Z,{callback:fn,onCancel:hn});case U:return(0,v.jsx)(V,{callback:fn,onCancel:hn});case X:return(0,v.jsx)(W,{callback:fn,onCancel:hn});default:return null}}),[ze]);function hn(){We("")}(0,f.useEffect)((function(){if(ln.current){var e=function(e){i=!0,c=e.pageY},n=function(){i=!1},t=function(e){if(i){var n=e.pageY-c;n<0&&(n=0),n>300&&(n=300),Xe(d+n+"px")}},a=ln.current,i=!1,c=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)}}}),[Se,ln]),(0,f.useEffect)((function(){Xe(d)}),[d]);var xn={width:ae(s),height:ae(Ge)},gn=((0,f.useMemo)((function(){if(Je){var e=new Date(Je),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}),[Je]),function(e){var n=[];if(z){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,a){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,v.jsxs)(f.Fragment,{children:[(0,v.jsx)("div",{className:"markdown-editor-wrapper",ref:sn,children:(0,v.jsxs)("div",{className:"markdown-editor-container ".concat(me," ").concat(Ae?"on-preview":""," ").concat(y?"mini":""," ").concat(De?"full-screen":""),style:xn,children:[(0,v.jsx)(w,{insertTemp:Z,watch:Ae,fullScreen:De,showNullButton:B,showNullProgramButton:z,onActionCallback:pn,hidetoolBar:ie,uuid:tn.current,setOpenPhones:function(){an.current=!0}}),(0,v.jsxs)("div",{className:"markdown-editor-body",children:[(0,v.jsx)("div",{className:"codemirror-container",children:(0,v.jsx)("textarea",{ref:rn,placeholder:be})}),Ae?(0,v.jsxs)("div",{ref:on,className:"preview-container",children:["stex"===C&&(0,v.jsx)(j,{value:Pe}),"stex"!==C&&(0,v.jsx)(g.Z,{disabledFill:ye,showProgramFill:z,value:Pe})]}):null]})]})}),A?(0,v.jsx)("a",{ref:ln,className:"editor-resize"}):null,(0,v.jsx)(N.Z,{children:se[ze]?(0,v.jsx)(Y.Z,{centered:!0,title:se[ze],open:!0,onCancel:hn,footer:null,className:"markdown-popup-form",children:mn}):null})]})}},39205:function(e,n,t){t.d(n,{Z:function(){return f}});var a=t(82100),i=t.n(a),c=t(29186),r=t.n(c),s=t(80619),l=t.n(s),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 c=window.document;return a.node=c.createElement("div"),c.body.appendChild(a.node),a}return r()(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)},6487: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])}},64906:function(e,n,t){t.r(n),t.d(n,{default:function(){return J}});var a=t(82242),i=t.n(a),c=t(79800),r=t.n(c),s=t(59301),l=t(33936),o=t(66104),u=t(99313),d=t(40362),p=t(16739),f=t(7557),m=t.n(f),h=t(41498),x=t.n(h),g=t(10302),v=t(84666),j=t(50872),y=t(43418),_=t(8591),b=t(37712),k=(0,l.connect)((function(e){return{shixunHomeworks:e.shixunHomeworks}}))((function(e){var n=e.shixunHomeworks,t=e.dispatch;(0,l.useParams)();return(0,b.jsx)(y.Z,{centered:!0,title:"提示",open:"删除"===n.actionTabs.key,okText:"确定",cancelText:"取消",onOk:x()(m()().mark((function e(){return m()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t({type:"shixunHomeworks/deleteReply",payload:{object_id:n.actionTabs.selectArr.id,object_type:"journals_for_message"}});case 2:0===e.sent.status&&(_.ZP.success("删除成功"),t({type:"shixunHomeworks/setActionTabs",payload:{}}),t({type:"shixunHomeworks/getReplyList",payload:i()({},n.actionTabs.params)}));case 4:case"end":return e.stop()}}),e)}))),onCancel:function(){t({type:"shixunHomeworks/setActionTabs",payload:{}})},children:(0,b.jsx)("p",{children:"确定要删除该条回复吗?"})})})),w=t(61186),N=t.n(w),Z=t(95237),S=t(43604),C=t(24650),E=t(3113),T=t(6848),P=t(86859),I=t(37064),R=t(92187),L={flex_box_center:"flex_box_center___XZOIk",flex_space_between:"flex_space_between___Yg4Dl",flex_box_vertical_center:"flex_box_vertical_center___uGbSz",flex_box_center_end:"flex_box_center_end___y3xze",flex_box_column:"flex_box_column___uiCa0",listItem:"listItem___ZZCkK",description:"description___WfCjN",liked:"liked___mHx4H",likedActive:"likedActive___zTpzg",reply:"reply___H7MjG",replyList:"replyList___Aweik",comment:"comment___ej0Vc"};N().locale("ZH-cn");var A=(0,l.connect)((function(e){var n=e.graduation,t=e.classroomList,a=e.loading;return{graduation:n,globalSetting:e.globalSetting,classroomList:t,loading:a.effects}}))((function(e){var n,t=e.graduation,a=e.classroomList,c=(e.globalSetting,e.loading,e.dispatch),o=(0,s.useState)(i()({},(0,l.useParams)())),u=r()(o,2),d=u[0],p=(u[1],(0,s.useState)(!1)),f=r()(p,2),h=f[0],y=f[1],w=(0,s.useState)(-1),A=r()(w,2),O=A[0],V=A[1],F=(0,s.useState)(""),D=r()(F,2),M=D[0],B=D[1],H=(a.detailLeftMenus,t.graduationDetail,t.replyList),z=t.detail,W=t.tasksDetail;return d.page_size=10,(0,s.useEffect)((function(){c({type:"graduation/getReplyList",payload:i()({},d)}),c({type:"graduation/getTopisDetail",payload:i()({},d)})}),[d.categoryId]),(0,b.jsxs)("section",{className:L.bg,children:[(0,b.jsxs)("section",{className:" edu-container",children:[(0,b.jsxs)("aside",{className:[L.desc,"c-black","font14","bg-white"].join(" "),children:[(0,b.jsx)("h1",{className:L.description,children:z.description}),(0,b.jsx)("div",{className:"mt30",children:(0,b.jsxs)("ul",{className:L.listItem,children:[(0,b.jsxs)("li",{children:[(0,b.jsx)("span",{className:"c-light-black",children:"课题类型:"}),(0,b.jsx)("span",{children:{1:"设计",2:"论文",3:"创作"}[null==z?void 0:z.topic_type]||"--"})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("span",{className:"c-light-black",children:"课题来源:"}),(0,b.jsx)("span",{children:{1:"生产/社会实际",2:"结合科研",3:"其它"}[null==z?void 0:z.topic_source]||"--"})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("span",{className:"c-light-black",children:"课题性质1"}),(0,b.jsx)("span",{children:{1:"真题",2:"模拟题"}[null==z?void 0:z.topic_property_first]||"--"})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("span",{className:"c-light-black",children:"课题性质2"}),(0,b.jsx)("span",{children:{1:"纵向课题",2:"横向课题",3:"自选"}[null==z?void 0:z.topic_property_second]||"--"})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("span",{className:"c-light-black",children:"课题重复情况:"}),(0,b.jsx)("span",{children:{1:"新题",2:"往届题,有新要求",3:"往届题,无新要求"}[null==z?void 0:z.topic_repeat]||"--"})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("span",{className:"c-light-black",children:"调研或实习地点:"}),(0,b.jsx)("span",{children:z.city||"--"})]}),(0,b.jsxs)("li",{className:"fl with50",children:[(0,b.jsx)("span",{className:"c-light-black",children:"课题来源单位:"}),(0,b.jsx)("span",{children:z.source_unit||"--"})]})]})}),(0,b.jsx)("div",{className:"pl30",children:null==W||null===(n=W.attachments)||void 0===n?void 0:n.map((function(e,n){return(0,b.jsx)("div",{children:(0,b.jsxs)("a",{href:"".concat(v.Z.API_SERVER).concat(e.url),children:[(0,b.jsx)("span",{className:"iconfont icon-fujian c-green font14"}),(0,b.jsx)("span",{className:"ml10 c-black",children:e.title}),(0,b.jsx)("span",{className:"c-light-black ml20 font12",children:e.filesize})]})})}))})]}),(0,b.jsxs)("aside",{className:[L.reply,"bg-white","mt20"].join(" "),children:[h&&(0,b.jsx)(g.Z,{onChange:function(e){B(e)},height:200,isFocus:!0,watch:!0}),(0,b.jsxs)(Z.Z,{onClick:function(){y(!0)},children:[(0,b.jsx)(S.Z,{flex:"1",children:!h&&(0,b.jsx)(C.Z,{size:"middle",className:"current",placeholder:"说点什么",disabled:!0})}),(0,b.jsx)(S.Z,{children:(0,b.jsx)(E.ZP,{type:"primary",size:"middle",onClick:x()(m()().mark((function e(){return m()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==M){e.next=4;break}_.ZP.error("请输入内容"),e.next=8;break;case 4:return e.next=6,c({type:"graduation/createReply",payload:{journals_for_message:{jour_id:d.categoryId,jour_type:"HomeworkCommon",reply_id:1,notes:M}}});case 6:0===e.sent.status&&(_.ZP.success("发布成功"),c({type:"graduation/getReplyList",payload:i()({},d)}),y(!1));case 8:case"end":return e.stop()}}),e)}))),children:"发表"})})]})]}),(null==H?void 0:H.comments)&&""!=H.comments&&(0,b.jsx)("aside",{className:[L.replyList,"bg-white"].join(" "),children:null==H?void 0:H.comments.map((function(e,n){var t,a;return(0,b.jsxs)(Z.Z,{gutter:[12,12],children:[(0,b.jsx)(S.Z,{flex:"40px",children:(0,b.jsx)("img",{width:"40",src:"".concat(v.Z.IMG_SERVER,"/images/").concat(null==e||null===(t=e.author)||void 0===t?void 0:t.image_url)})}),(0,b.jsx)(S.Z,{flex:"1",children:(0,b.jsxs)(Z.Z,{align:"middle",children:[(0,b.jsxs)(S.Z,{span:24,children:[(0,b.jsx)("span",{className:"c-light-black",children:null==e||null===(a=e.author)||void 0===a?void 0:a.name}),(0,b.jsxs)("span",{className:"c-light-black ml10",children:[N()(null==e?void 0:e.created_on).fromNow()," 发布"]})]}),(0,b.jsx)(S.Z,{span:24,children:(0,b.jsx)(j.Z,{value:e.content})}),e.children&&(0,b.jsx)("aside",{className:L.comment,children:e.children.map((function(n,t){return(0,b.jsxs)(Z.Z,{children:[(0,b.jsx)(S.Z,{span:24,children:(0,b.jsxs)(Z.Z,{children:[(0,b.jsxs)(S.Z,{flex:"1",children:[n.author.name,(0,b.jsx)("span",{className:"c-light-black ml10",children:N()(null==n?void 0:n.created_on).fromNow()})]}),(0,b.jsx)(S.Z,{children:(0,b.jsx)(T.Z,{title:"删除",children:(0,b.jsx)(I.Z,{className:"current",onClick:function(){c({type:"graduation/setActionTabs",payload:{key:"删除",params:d,selectArr:e}})}})})})]})}),(0,b.jsx)(S.Z,{children:(0,b.jsx)("strong",{children:(0,b.jsx)(j.Z,{value:n.content})})})]},t)}))}),(0,b.jsxs)(S.Z,{span:24,className:"mt5 c-light-black",children:[O===n&&(0,b.jsxs)("aside",{children:[(0,b.jsx)(g.Z,{onChange:function(e){B(e)},height:150,isFocus:!0}),(0,b.jsx)(Z.Z,{children:(0,b.jsx)(S.Z,{span:24,className:"tr",children:(0,b.jsx)(E.ZP,{type:"primary",size:"middle",onClick:x()(m()().mark((function n(){return m()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(""!==M){n.next=4;break}_.ZP.error("请输入内容"),n.next=9;break;case 4:return n.next=6,c({type:"graduation/createReply",payload:{journals_for_message:{jour_id:d.categoryId,jour_type:"HomeworkCommon",m_parent_id:e.id,reply_id:1,notes:M}}});case 6:c({type:"graduation/getReplyList",payload:i()({},d)}),_.ZP.success("发布成功"),V(-1);case 9:case"end":return n.stop()}}),n)}))),children:"发表"})})})]}),O!==n&&(0,b.jsxs)("div",{className:"tr",children:[(0,b.jsx)("span",{className:"iconfont icon-huifu1 mr5 ml30",onClick:function(){return V(n)}}),e.liked&&(0,b.jsxs)("span",{className:"c-orange",children:[(0,b.jsx)(R.Z,{className:"mr5 ml30",onClick:x()(m()().mark((function n(){return m()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,c({type:"graduation/replyUnLike",payload:{object_id:e.id,object_type:"message"}});case 2:c({type:"graduation/getReplyList",payload:i()({},d)});case 3:case"end":return n.stop()}}),n)})))}),e.praises_count]}),!e.liked&&(0,b.jsxs)("span",{children:[(0,b.jsx)(R.Z,{className:"mr5 ml30",onClick:x()(m()().mark((function n(){return m()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,c({type:"graduation/replyLike",payload:{object_id:e.id,object_type:"message"}});case 2:c({type:"graduation/getReplyList",payload:i()({},d)});case 3:case"end":return n.stop()}}),n)})))}),e.praises_count]})]})]})]})})]},n)}))})]}),(0,b.jsx)("aside",{className:"tc mt30 pb30",children:(0,b.jsx)(P.Z,{defaultCurrent:1,total:null==H?void 0:H.total_count,hideOnSinglePage:!0,current:d.page||1,onChange:function(e){d.page=e,c({type:"graduation/getReplyList",payload:i()({},d)})}})}),(0,b.jsx)(k,{})]})})),O=t(78241),V=t(51945),F=t(39647),D=t.n(F),M=["graduation","dispatch"],B=(0,l.connect)((function(e){return{graduation:e.graduation}}))((function(e){var n=e.graduation,t=e.dispatch,a=(D()(e,M),(0,l.useParams)());return(0,b.jsx)(y.Z,{centered:!0,title:"提示",open:"拒绝"===n.actionTabs.key,okText:"确定",cancelText:"取消",onOk:x()(m()().mark((function e(){return m()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t({type:"graduation/refuseTopic",payload:i()({student_graduation_topic:n.actionTabs.selectArrs.id},a)});case 2:0===e.sent.status&&(_.ZP.success("拒绝成功"),t({type:"graduation/setActionTabs",payload:{}}),t({type:"graduation/getTopisDetailList",payload:i()({},n.actionTabs.params)}));case 4:case"end":return e.stop()}}),e)}))),onCancel:function(){t({type:"graduation/setActionTabs",payload:{}})},children:(0,b.jsx)("p",{children:"是否确认拒绝学生选题?"})})})),H=t(57809),z=["graduation","dispatch"],W=(0,l.connect)((function(e){return{graduation:e.graduation}}))((function(e){var n,t=e.graduation,a=e.dispatch,c=(D()(e,z),(0,l.useParams)()),s=t.detailList,o=O.Z.useForm(),u=r()(o,1)[0];return(0,b.jsxs)(y.Z,{centered:!0,title:"同意选题",open:"同意"===t.actionTabs.key,okText:"确定",cancelText:"取消",onOk:x()(m()().mark((function e(){var n,r;return m()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.validateFields();case 2:return r=u.getFieldsValue(),e.next=5,a({type:"graduation/agreeTopic",payload:i()({group_id:r.group_id,course_group_name:null==s||null===(n=s.group_list)||void 0===n?void 0:n.filter((function(e){return e.group_id==r.group_id}))[0].group_name,student_graduation_topic:t.actionTabs.selectArrs.id},c)});case 5:0===e.sent.status&&(_.ZP.success("同意成功"),a({type:"graduation/setActionTabs",payload:{}}),a({type:"graduation/getTopisDetailList",payload:i()({},t.actionTabs.params)}));case 7:case"end":return e.stop()}}),e)}))),onCancel:function(){a({type:"graduation/setActionTabs",payload:{}})},children:[(0,b.jsx)("p",{children:"确认同意学生的选题,将学生加入我的分班"}),(0,b.jsx)(O.Z,{form:u,children:(0,b.jsx)(O.Z.Item,{name:"group_id",label:"选择:",rules:[{required:!0,message:"请选择分班"}],children:(0,b.jsx)(H.default,{placeholder:"请选择分班",size:"middle",children:null==s||null===(n=s.group_list)||void 0===n?void 0:n.map((function(e,n){return(0,b.jsx)(H.default.Option,{value:e.group_id,children:e.group_name})}))})})})]})})),q=(0,l.connect)((function(e){return{graduation:e.graduation,loading:e.loading.effects}}))((function(e){var n=e.graduation,t=e.loading,a=e.dispatch,c=(0,s.useState)(i()({},(0,l.useParams)())),o=r()(c,2),u=o[0],d=(o[1],(0,l.useLocation)(),n.detailList),p=(0,s.useState)({}),f=r()(p,2),m=(f[0],f[1],O.Z.useForm()),h=(r()(m,1)[0],[{title:"序号",dataIndex:"name",width:200,align:"center",render:function(e,n,t){return t+1}},{title:"姓名",dataIndex:"student_name"},{title:"学号",dataIndex:"student_id"},{title:"分班",dataIndex:"class_group_name"},{title:"选题时间",dataIndex:"selected_time"},{title:"确认结果",dataIndex:"result",render:function(e){return"已拒绝"===e?(0,b.jsx)("span",{className:"c-orange",children:"已拒绝"}):e}},{title:"操作",dataInex:"action",render:function(e,n){return(0,b.jsxs)("div",{children:[("待确认"===n.result||"已同意"===n.result)&&(0,b.jsx)("span",{className:"current",onClick:function(){a({type:"graduation/setActionTabs",payload:{key:"拒绝",selectArrs:n,params:u}})},children:"拒绝"}),"待确认"===n.result&&(0,b.jsx)("span",{className:"current ml20 c-blue",onClick:function(){a({type:"graduation/setActionTabs",payload:{key:"同意",selectArrs:n,params:u}})},children:"同意"})]})}}]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("section",{className:"minH500 bg-white ",children:[(0,b.jsx)(V.Z,{loading:t["graduation/getTopisDetailList"],pagination:!1,dataSource:d.users_list,columns:h}),(0,b.jsx)(B,{}),(0,b.jsx)(W,{})]}),(0,b.jsx)("aside",{className:"tc mb50 mt30",children:(0,b.jsx)(P.Z,{hideOnSinglePage:!0,showSizeChanger:!1,onChange:function(e,n){u.page=e,u.limit=20,a({type:"graduation/getTopisDetailList",payload:i()({},u)})},defaultCurrent:u.page||1,current:u.page||1,defaultPageSize:15,total:n.users_count})})]})})),$={flex_box_center:"flex_box_center___ZPOJ5",flex_space_between:"flex_space_between___GmCrk",flex_box_vertical_center:"flex_box_vertical_center___XpcAN",flex_box_center_end:"flex_box_center_end___krRXE",flex_box_column:"flex_box_column___DLzSN",title:"title___KDcLT",menuTabs:"menuTabs___nxQqE",rightMenu:"rightMenu___MVID9",shixunDetail:"shixunDetail___NvT9l"},J=(0,l.connect)((function(e){var n=e.graduation,t=e.loading;return{graduation:n,globalSetting:e.globalSetting,loading:t.effects}}))((function(e){var n=e.graduation,t=(e.globalSetting,e.loading,e.dispatch),a=(0,l.useParams)(),c=(0,l.useSearchParams)(),f=r()(c,1)[0],m=((0,l.useLocation)(),(0,s.useState)([])),h=r()(m,2),x=(h[0],h[1],(0,s.useState)(f.get("tabs")||0)),g=r()(x,2),v=g[0],j=(g[1],n.detailTaskList);n.tasksDetail;a.category=f.get("category_id"),(0,s.useEffect)((function(){t({type:"graduation/getTasksDetail",payload:i()({},a)}),t({type:"graduation/getTasksListDetail",payload:i()({},a)})}),[a.coursesId]);var y=[{name:"任务列表",id:0,compontent:(0,b.jsx)(q,{})},{name:"任务描述",id:1,compontent:(0,b.jsx)(A,{})}];return(0,b.jsx)("section",{children:(0,b.jsxs)("div",{className:"edu-container",children:[j.course_name&&(0,b.jsxs)("section",{className:"animated fadeIn",children:[(0,b.jsx)("aside",{className:"mt10",children:(0,b.jsxs)(o.Z,{separator:">",children:[(0,b.jsx)(o.Z.Item,{children:(0,b.jsx)(l.Link,{to:"/classrooms/".concat(j.course_id,"/shixun_homework"),children:j.course_name})}),(0,b.jsx)(o.Z.Item,{children:(0,b.jsx)(l.Link,{to:"/classrooms/".concat(j.course_id,"/graduation_tasks"),children:"毕设任务"})}),(0,b.jsx)(o.Z.Item,{children:"任务详情"})]})}),(0,b.jsxs)("aside",{className:[$.title,"mt20"].join(" "),children:[(0,b.jsx)(l.Link,{to:"/classrooms/".concat(j.course_id,"/graduation_tasks"),children:(0,b.jsx)(d.Z,{className:"font16 c-black"})}),(0,b.jsx)("strong",{className:"font20 ml5",children:j.task_name}),(0,b.jsx)(p.VV,{status:[j.status_name]})]})]}),(0,b.jsxs)("aside",{className:"mt30 relative",children:[(0,b.jsx)("aside",{className:$.rightMenu,children:(0,b.jsxs)(l.Link,{className:$.shixunDetail,to:"/classrooms/".concat(a.coursesId,"/graduation_tasks/").concat(a.categoryId,"/edit"),children:[(0,b.jsx)("span",{className:"iconfont icon-shixunxiangqing"}),"编辑任务"]})}),(0,b.jsx)(u.Z,{defaultActiveKey:v,className:$.menuTabs,children:y.map((function(e,n){return(0,b.jsx)(u.Z.TabPane,{tab:e.name,children:e.compontent},e.id)}))})]})]})})}))}}]);