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__Problemset__NewItem__ind...

1 line
114 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([[41953,23599,61876],{680:function(e,n,t){t.d(n,{Z:function(){return c}});var r=t(19973),i=t(59301),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},l=t(22589),s=function(e,n){return i.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:a}))};var c=i.forwardRef(s)},18468:function(e,n,t){function r(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=[],r=0;r<e.length;r++){var i=e[r],a=n?"".concat(n,"/").concat(i.name):"".concat(i.name);t.push({title:i.name,isLeaf:"tree"!==i.type,key:a})}return t}function a(e,n,t){for(var r=0;r<e.length;r++){var i=e[r];if(i.key===n){i.children=t;break}i.children&&a(i.children,n,t)}return e}function l(e,n,t){var r;return function(){var i=this,a=arguments,l=function(){r=null,t||e.apply(i,a)},s=t&&!r;clearTimeout(r),r=setTimeout(l,n),s&&e.apply(i,a)}}t.d(n,{Ax:function(){return a},Ds:function(){return l},KI:function(){return s},SI:function(){return i},f1:function(){return r}});var s=t(15309).Z.API_SERVER},56559:function(e,n,t){t.d(n,{Z:function(){return b}});var r=t(82242),i=t.n(r),a=t(7557),l=t.n(a),s=t(41498),c=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p=t(97334),f="folderWrapper___G__0a",m="folderIcon___oTG6c",h=t(73631),v=t(5623),x=t(66997),g=t(37712),b=function(e){var n=e.value,t=e.onChange,r=e.scrollId,a=(0,d.useState)([]),s=u()(a,2),o=s[0],b=s[1];(0,d.useEffect)((function(){j()}),[]);var j=function(){var e=c()(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,x.NZ)({});case 2:null!=(n=e.sent)&&n.data&&(t=[{title:"根目录",value:0,key:0,icon:(0,g.jsx)("img",{src:h,className:m}),isLeaf:!1,children:y(n.data||[])}],b(t));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function e(n){return n.map((function(n){return{title:n.name,key:n.group_id,icon:(0,g.jsx)("img",{src:h,className:m}),isLeaf:0===n.children.length,children:e(n.children)}}))},_=function e(n,t,r){return n.map((function(n){return n.key===t?i()(i()({},n),{},{icon:r?(0,g.jsx)("img",{src:v,className:m}):(0,g.jsx)("img",{src:h,className:m})}):n.children?i()(i()({},n),{},{children:e(n.children,t,r)}):void 0}))},k=n?{selectedKeys:n,defaultExpandedKeys:n}:{};return o.length>0&&(0,g.jsx)("div",{id:r||"",children:(0,g.jsx)(p.Z,i()({showLine:{showLeafIcon:!1},showIcon:!0,treeData:o,className:f,onSelect:t,onExpand:function(e,n){b((function(e){return _(e,n.node.key,n.expanded)}))}},k))})}},10094:function(e,n,t){t.d(n,{N:function(){return N}});var r=t(7557),i=t.n(r),a=t(41498),l=t.n(a),s=t(37205),c=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p=t(57809),f=t(43418),m=t(95237),h=t(43604),v=t(73782),x=t(8591),g=t(79311),b="wrap___F7E3F",j="selectWrapper____kESB",y="tips___aHjQY",_="linkBtn___uggVr",k="mainText____S1I0",w=t(680),Z=t(37712),C=p.default.Option,N=function(e){var n=e.subId,t=e.value,r=e.selectvalues,a=e.disabled,s=e.knowledgeOptions,o=void 0===s?[]:s,N=e.onChange,E=void 0===N?function(){}:N,I=e.onAddKnowledgeFinish,S=void 0===I?function(){}:I,P=(0,d.useRef)(),A=(0,d.useState)([]),O=u()(A,2),T=O[0],R=O[1];t=t||[];(0,d.useEffect)((function(){(null==r?void 0:r.length)>0&&(R(c()(r)),E(c()(r)))}),[o]),(0,d.useEffect)((function(){var e;(null===(e=t)||void 0===e?void 0:e.length)>0&&E(c()(t))}),[o]);return(0,Z.jsxs)(m.Z,{wrap:!1,align:"middle",className:b,children:[(0,Z.jsx)(h.Z,{children:(0,Z.jsx)(p.default,{disabled:!n||a,className:j,placeholder:"请选择知识点",onChange:function(e,n){e?(R([n.key]),E([n.key])):(R([]),E([]))},style:{width:490},showSearch:!0,allowClear:!0,value:null==o?void 0:o.filter((function(e){return(null==T?void 0:T.includes(null==e?void 0:e.id))||(null==T?void 0:T.includes((null==e?void 0:e.id)+""))})).map((function(e){return e.name})),children:null==o?void 0:o.map((function(e){return(0,Z.jsx)(C,{value:e.name,children:(0,Z.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,Z.jsx)("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:e.name}),(0,Z.jsx)("span",{children:"personal"===e.type?"(自用)":""})]})},e.id)}))})}),n&&(0,Z.jsxs)(h.Z,{className:"ml20",children:[(0,Z.jsx)("span",{className:y,children:"没有合适的知识点?"}),(0,Z.jsx)("span",{className:_,onClick:function(e){e.preventDefault(),P.current="",f.Z.confirm({centered:!0,width:640,okText:"确定",cancelText:"取消",icon:null,title:"新建知识点",className:"custom-modal-divider",content:(0,Z.jsxs)("div",{className:"font14",children:[(0,Z.jsxs)(m.Z,{className:"mb20",children:[(0,Z.jsx)(h.Z,{children:(0,Z.jsx)(w.Z,{style:{color:"#FF8C29"}})}),(0,Z.jsxs)(h.Z,{className:"ml10 ".concat(k),children:["新建的知识点仅本人可见,平台审核列入公开知识点后,对所有用户可见。",(0,Z.jsx)("br",{}),"平台有权删除不合适的知识点,请认真填写知识点名称。"]})]}),(0,Z.jsx)(v.Z,{maxLength:20,size:"middle",showCount:!0,placeholder:"请输入知识点名称",defaultValue:P.current,onChange:function(e){P.current=e.target.value}})]}),onOk:function(){return new Promise(function(){var e=l()(i()().mark((function e(t,r){var a,l;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(P.current){e.next=3;break}return x.ZP.warning("请输入知识点名称"),e.abrupt("return",r());case 3:if(!(P.current.length>20)){e.next=6;break}return x.ZP.warning("请输入不超过20字的知识点名称"),e.abrupt("return",r());case 6:return e.next=8,(0,g.ZP)("/api/tag_disciplines.json",{method:"post",body:{name:P.current,sub_discipline_id:n}});case 8:return 0===(null==(a=e.sent)?void 0:a.status)&&(S({id:a.tag_discipline_id,name:P.current,type:"personal"}),(l=[]).push(a.tag_discipline_id),E([].concat(l)),R([a.tag_discipline_id]),E([].concat(l))),e.abrupt("return",t());case 11:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}())}})},children:"新建知识点"})]})]})}},13261:function(e,n,t){var r=t(82242),i=t.n(r),a=(t(59301),t(19779)),l=t(3113),s=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,r=void 0===t?{}:t,c=e.styles,o=void 0===c?{}:c,u=e.customText,d=e.ButtonText,p=e.ButtonClick,f=e.Buttonclass,m=e.ButtonTwo,h=e.imgStyles,v=e.loading,x=void 0!==v&&v;return(0,s.jsxs)("section",{className:"tc animated fadeIn",style:i()(i()({},{color:"#999",margin:"100px auto",visibility:x?"hidden":"visible"}),o),children:[(0,s.jsx)("img",{src:n||a,style:i()({width:288,height:200},h)}),(0,s.jsx)("p",{className:"mt20 font14",children:u||"暂时还没有相关数据哦!"}),d&&(0,s.jsx)(l.ZP,i()(i()({className:f,onClick:p},r),{},{children:d})),m&&m]})}},13282:function(e,n,t){t.d(n,{Z:function(){return _}});var r=t(82242),i=t.n(r),a=t(7557),l=t.n(a),s=t(41498),c=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(38827),h=t(83743),v=t(6848),x=t(27627),g=t(91810),b=t(13261),j=t(15309),y=t(37712),_=function(e){var n,t,r,a,s,o,_,k=e.editOffice,w=void 0===k?"view":k,Z=e.data,C=(e.theme,e.type),N=e.filename,E=e.monacoEditor,I=e.className,S=e.style,P=e.close,A=e.onClose,O=e.hasMask,T=e.disabledDownload,R=e.onImgDimensions,F=e.showNodata,B=(0,d.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),L=u()(B,2),M=(L[0],L[1],(0,d.useState)("")),V=u()(M,2),D=(V[0],V[1]),W=(0,d.useState)(),q=u()(W,2),U=q[0],H=q[1],z="build"===window.ENV?"/react/build":"",K=location.host.startsWith("localhost")?j.Z.PROXY_SERVER:j.Z.API_SERVER,G=(0,d.useRef)();null!==(n=Z)&&void 0!==n&&n.startsWith("/api")&&"txt"!==C&&(Z=j.Z.API_SERVER+Z),N&&(E.filename=N),(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]&&D(n[1])}))}),[]),(0,d.useEffect)((function(){"office"===C&&X()}),[C,Z]);var X=function(){var e=c()(l()().mark((function e(){var n,t,r;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Z,Z.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=5,(0,g.gJ)({attachment_id:t});case 5:r=e.sent,H(r);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),J=function(){Z.startsWith("http")||Z.startsWith("blob:")?Y():(0,x.Sv)(N||"educoder",Z,N)},Y=function(){(0,x.Nd)(N||"educoder",decodeURIComponent(Z))};return(0,y.jsxs)("div",{style:i()({},S||{}),className:"".concat(O&&p.bgBlack," ").concat(C?p.wrp:"hide"),children:[P&&(0,y.jsxs)("div",{className:p.close,ref:G,children:[!!R&&(0,y.jsx)(v.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return G.current},children:(0,y.jsx)("span",{onClick:function(){A(),R()},children:(0,y.jsx)("i",{className:"icon-yulanpizhu"})})}),!T&&(0,y.jsx)(v.Z,{title:"点击下载此文件",getPopupContainer:function(){return G.current},children:(0,y.jsx)("span",{onClick:Y,children:(0,y.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,y.jsx)(v.Z,{title:"关闭",getPopupContainer:function(){return G.current},children:(0,y.jsx)("span",{className:"",onClick:A,children:(0,y.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,y.jsx)("div",{className:"".concat(p[I]," ").concat(I," ").concat(p.monaco," ").concat("txt"===C?"show":"hide"),children:"txt"===C&&(0,y.jsx)(h.ZP,i()({},E))}),"audio"===C&&(0,y.jsx)("audio",{src:(null===(t=Z)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(r=Z)&&void 0!==r&&r.startsWith("/api")?Z:"data:image/png;base64,".concat(Z),autoPlay:!0}),"video"===C&&(0,y.jsx)(y.Fragment,{children:(null===(a=Z)||void 0===a?void 0:a.indexOf("http"))>-1||null!==(s=Z)&&void 0!==s&&s.startsWith("/api")?(0,y.jsx)("video",{controls:!0,src:"".concat(Z),autoPlay:!0}):(0,y.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(Z),autoPlay:!0})}),"office"===C&&U&&(0,y.jsx)("iframe",{src:"".concat(z,"/office.html?key=").concat(U.key,"&url=").concat(K+U.url,"&callbackUrl=").concat(K+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(w,"&officeServer=").concat(j.Z.ONLYOFFICE,"&disabledDownload=").concat(!!T)}),"html"===C&&(0,y.jsx)("iframe",{src:Z+"&disposition=inline"}),"pdf"===C&&(0,y.jsx)("iframe",{src:"".concat(z,"/js/pdfview/index.html?url=").concat(Z,"&disabledDownload=").concat(!!T)}),"image"===C&&(0,y.jsx)("img",{src:(null===(o=Z)||void 0===o?void 0:o.indexOf("http"))>-1||null!==(_=Z)&&void 0!==_&&_.startsWith("/api")?Z:"data:image/png;base64,".concat(Z)}),("other"===C||"download"===C)&&(0,y.jsx)(y.Fragment,{children:F?(0,y.jsx)(b.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,y.jsx)(f.ZP,{icon:(0,y.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:J,children:"下载"})}):(0,y.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:J,children:[(0,y.jsx)(m.Z,{}),"点击下载"]})})]})}},53921:function(e,n,t){t.d(n,{t:function(){return A}});var r=t(39647),i=t.n(r),a=t(91232),l=t.n(a),s=t(85573),c=t.n(s),o=t(82242),u=t.n(o),d=t(79800),p=t.n(d),f=t(59301),m=t(73782),h=t(78673),v=t(78241),x=t(95237),g=t(43604),b=t(94001),j=t(57809),y=t(60950),_=t(65363),k=t(98887),w=t(43346),Z=t(37712),C=["key","name"],N=m.Z.TextArea,E=[{title:"C",key:"C"},{title:"C++",key:"C++"},{title:"Python",key:"Python"},{title:"Java",key:"Java"},{title:"JavaScript",key:"JavaScript"},{title:"Ruby",key:"Ruby"}],I=function(e){var n=e.value,t=e.onChange;return(0,Z.jsx)(h.Z,{checked:n,onChange:function(e){t(e)}})},S="@▁@",P="@▁▁@",A=function(e){var n=e.questionTitlePlaceholder,t=e.form,r=e.scoreByBlank,a=void 0!==r&&r,s=e.hackidentifier,o=e.answerKey,d=(0,f.useState)(!1),h=p()(d,2),A=h[0],O=h[1],T=(0,f.useState)(!1),R=p()(T,2),F=(R[0],R[1],(0,_.useParams)().type,function(e,n){for(var t=n.line,r=0,i=0;i<t;i++)r+=e.getLine(i).split(S).length-1;for(var a=0;a<t;a++)r+=e.getLine(a).split(P).length-1;var l=e.getLine(t).substring(0,n.ch);return r+=l.split(S).length-1,r+=l.split(P).length-1}),B=function(){var e=t.getFieldValue(o);t.setFieldsValue(c()({},o,e.map((function(e,n){return u()(u()({},e),{},{position:n+1})}))))},L=(0,f.useRef)(),M=function(e,n){for(var t=0;t<e;t++)L.current({position:null,answer_text:""},n+t);B()},V=(0,f.useRef)(),D=function(e){V.current(e),B()},W=v.Z.useWatch(o,t);return(0,Z.jsxs)("div",{className:k.Z.wrap,children:[(0,Z.jsx)(v.Z.Item,{label:"试题描述",name:["hack","description"],style:{display:"table"},className:"w100",labelCol:{span:24},rules:[{required:!0}],children:(0,Z.jsx)(y.h,{scrollId:"name",watch:!0,height:140})}),(0,Z.jsx)("div",{className:k.Z.questionTitleEditorWrap,children:(0,Z.jsx)(v.Z.Item,{label:"程序代码",name:["hack_codes","code"],labelCol:{span:24},rules:[{required:!0}],children:(0,Z.jsx)(y.h,{scrollId:"name",watch:!0,height:400,showNullProgramButton:!0,onChange:function(e,n){var r=t.getFieldValue(o);console.log("--preAnswerData",r,n),t.setFieldsValue(c()({},o,null==r?void 0:r.map((function(e,t){var r;return u()(u()({},e),{},{position:t+1,multi_line:null==n||null===(r=n[t])||void 0===r?void 0:r.multiLine})}))))},placeholder:n,onCMBeforeChange:function(e,n){!function(e,n,t,r){var i=e.getRange(n.from,n.to),a=0;if(n.text.forEach((function(e){a+=e.split(S).length-1})),n.text.forEach((function(e){a+=e.split(P).length-1})),"setValue"!==n.origin)if(!i||-1===i.indexOf(S)&&-1===i.indexOf(P)){if(a>0){var l=F(e,n.from);console.log("新增".concat(a,"个,之前有").concat(l,"个")),t(a,l)}}else{var s=i.split(S).length-1+i.split(P).length-1,c=F(e,n.from);console.log("删除".concat(s,"个, 前面有").concat(c,"个,新增").concat(a,"个")),r(s>1?Array.from({length:s},(function(e,n){return c+n})):c)}}(e,n,M,D)}})})}),(0,Z.jsx)(v.Z.List,{name:o,rules:[{validator:function(e,n){if(0===(null==n?void 0:n.length))return Promise.reject(new Error("答案不能为空"));var t,r=l()(n);try{for(r.s();!(t=r.n()).done;){var i=(t.value||{}).answer_text;if(0===(null==i?void 0:i.length))return Promise.reject(new Error("填空项答案不能为空"))}}catch(e){r.e(e)}finally{r.f()}return Promise.resolve()}}],children:function(e,n,t){var r=n.add,l=n.remove;t.errors;return L.current=r,V.current=l,(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v.Z.Item,{label:"填空项答案",required:!0,labelCol:{span:24}}),e.map((function(e,n){var t,r,l=e.key,s=e.name,c=i()(e,C);return(0,Z.jsxs)(x.Z,{className:"mb20",align:"middle",wrap:!1,children:[(0,Z.jsxs)(g.Z,{flex:"0 0 auto",className:"".concat(k.Z.blankIndex),children:["填空项",n+1]}),(0,Z.jsx)(g.Z,{flex:1,children:(0,Z.jsxs)(x.Z,{align:"top",justify:"space-between",wrap:!1,children:[(0,Z.jsx)(g.Z,{children:(0,Z.jsx)(v.Z.Item,u()(u()({},c),{},{name:[s,"answer_text"],noStyle:!0,children:null!=W&&null!==(t=W[s])&&void 0!==t&&t.multi_line||null!=W&&null!==(r=W[s])&&void 0!==r&&r.multiLine?(0,Z.jsx)(N,{spellCheck:!1,style:{marginLeft:10,width:550}}):(0,Z.jsx)(m.Z,{style:{marginLeft:10,width:550},className:k.Z.blankInput,size:"large",maxLength:1e3,onBlur:function(e){}})}))}),a&&(0,Z.jsx)(g.Z,{flex:"224px",children:(0,Z.jsx)(v.Z.Item,u()(u()({},c),{},{name:[s,"score"],label:"分值",rules:[{required:!0}],children:(0,Z.jsx)(b.Z,{size:"large",className:k.Z.blankInput,min:.1,max:100,precision:1,style:{width:"100%"},placeholder:"按空给分请输入分值"})}))})]})})]},l)}))]})}}),(0,Z.jsx)("div",{onClick:function(){return O(!0)},children:(0,Z.jsx)(v.Z.Item,{name:["hack","analysis"],label:"题目解析",labelCol:{span:24},children:(0,Z.jsx)(y.x,{placeholder:"请编辑题目解析(非必填)",isEdit:A})})}),(0,Z.jsx)(v.Z.Item,{label:"编程语言",style:{marginTop:30},name:["hack_codes","language"],labelCol:{span:24},rules:[{required:!0,message:"请选择编程语言"}],children:(0,Z.jsx)(j.default,{size:"large",children:E.map((function(e){return(0,Z.jsxs)(j.default.Option,{value:e.key,children:[" ",e.title]},e.title)}))})}),(0,Z.jsxs)(v.Z.Item,{label:"最大评测时长(秒)",style:{marginTop:30},labelCol:{span:24},required:!0,children:[(0,Z.jsx)(v.Z.Item,{name:["hack","time_limit"],rules:[{required:!0,message:"请输入单个测试集评测时长限制"},{type:"number",min:3,message:"最小限制时间是3秒"}],noStyle:!0,children:(0,Z.jsx)(b.Z,{precision:0,max:10,min:3,size:"large",style:{width:"97%"}})}),(0,Z.jsx)("span",{className:"ml10 font14",children:"秒"})]}),(0,Z.jsxs)(x.Z,{align:"middle",style:{marginTop:30},children:[(0,Z.jsx)(v.Z.Item,{name:["hack","allow_student_debug"],children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(g.Z,{className:"ml10",children:"允许学生答题时进行代码调试"})]}),(0,Z.jsx)(v.Z.Item,{label:"测试用例",required:!0}),(0,Z.jsxs)("div",{style:{background:"#F6F7F9",padding:15},children:[(0,Z.jsx)(v.Z.Item,{label:"输入",labelCol:{span:24},name:["hack_sets","input"],children:(0,Z.jsx)(N,{rows:4})}),(0,Z.jsx)(v.Z.Item,{label:"输出",labelCol:{span:24},name:["hack_sets","output"],rules:[{required:!0,message:"请输入输出内容"}],children:(0,Z.jsx)(N,{rows:4})})]}),(0,Z.jsx)(w.Z,{answerKey:o,hackidentifier:s,ButtonText:"自测运行",ButtonProps:{ghost:!0,icon:(0,Z.jsx)("i",{className:"iconfont icon-ceshi"}),style:{background:"rgba(55,173,131,0.05)",borderRadius:19,border:"1px solid #37AD83",width:116,height:38,display:"inline-flex",fontSize:14,alignItems:"center",justifyContent:"center",marginTop:20,cursor:"pointer",color:"#37AD83"}},form:t})]})}},43346:function(e,n,t){var r=t(82242),i=t.n(r),a=t(7557),l=t.n(a),s=t(41498),c=t.n(s),o=t(79800),u=t.n(o),d=t(65363),p=t(59301),f=t(8591),m=t(3113),h=t(43418),v=t(24334),x=t(79311),g=t(9187),b=t(55662),j=t(61186),y=t.n(j),_=t(37712);n.Z=function(e){var n=e.ButtonProps,t=e.ButtonText,r=e.form,a=e.answerKey,s=e.hackidentifier,o=void 0===s?"":s,j=e.items,k=void 0===j?{}:j,w=(0,p.useState)(!1),Z=u()(w,2),C=Z[0],N=Z[1],E=(0,p.useState)(""),I=u()(E,2),S=I[0],P=I[1],A=(0,d.useParams)(),O=(0,p.useState)({}),T=u()(O,2),R=T[0],F=T[1],B="edit"===A.type;window.location.href.includes("problemset");function L(e,n){return M.apply(this,arguments)}function M(){return(M=c()(l()().mark((function e(n,t){var i,s,c,o,u;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=r.getFieldValue("hack_codes"),c=r.getFieldValue(a),s.code){e.next=5;break}return f.ZP.info("程序代码不能为空!"),e.abrupt("return");case 5:if(s.language){e.next=8;break}return f.ZP.info("编程语言不能为空!"),e.abrupt("return");case 8:if(!(c.length>0&&(null===(i=c.filter((function(e){return!e.answer_text})))||void 0===i?void 0:i.length)>0)){e.next=11;break}return f.ZP.info("填空项不能为空!"),e.abrupt("return");case 11:return o=s.code,c.length>0&&(null==c||c.map((function(e){o=e.multi_line?o.substring(0,o.indexOf("@▁▁@"))+e.answer_text+o.substring(o.indexOf("@▁▁@")+4):o.substring(0,o.indexOf("@▁@"))+e.answer_text+o.substring(o.indexOf("@▁@")+3)}))),e.next=15,(0,g.n4)(t,n||{code:v.Base64.encode(o),language:s.language});case 15:return u=e.sent,e.abrupt("return",u);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(e,n){return D.apply(this,arguments)}function D(){return(D=c()(l()().mark((function e(n,t){var r,i,a,s;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=k.userAnswer,a=v.Base64.decode(k.code),!(i.length>0&&(null===(r=i.filter((function(e){return!e.value})))||void 0===r?void 0:r.length)>0)){e.next=6;break}return f.ZP.info("填空项不能为空!"),e.abrupt("return");case 6:return i.length>0&&(null==i||i.map((function(e){a=e.multi_line?a.substring(0,a.indexOf("@▁▁@"))+e.value+a.substring(a.indexOf("@▁▁@")+4):a.substring(0,a.indexOf("@▁@"))+e.value+a.substring(a.indexOf("@▁@")+3)}))),e.next=9,(0,g.n4)(t,n||{code:v.Base64.encode(a),language:k.language});case 9:return s=e.sent,e.abrupt("return",s);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(new Date).getTime()}return(0,p.useEffect)((function(){(B||o)&&P(o||A.id)}),[A]),(0,p.useEffect)((function(){return function(){sessionStorage.removeItem("projectFill")}}),[]),(0,_.jsxs)("div",{children:[(0,_.jsx)(m.ZP,i()(i()({loading:C},n),{},{onClick:c()(l()().mark((function e(){var n,a,s,o,u,d,p,m,b,j,y,_,k,w;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("运行调试"!==t){e.next=20;break}if(N(!0),!C){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,(0,x.ZP)("/api/problems/".concat(S,"/start.json"),{method:"get"});case 6:return n=e.sent,e.next=9,V(null,null==n?void 0:n.identifier);case 9:if(0!==(null==(a=e.sent)?void 0:a.status)){e.next=18;break}return s=function(){var e=c()(l()().mark((function e(){var t,r,i,a,c;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,g.rX)(null==n?void 0:n.identifier,"submit");case 2:if(t=e.sent,r=t.status,t.message,i=t.data,a=W(),c=a-o>6e3,0===r||c||setTimeout(s,1e3),!c){e.next=13;break}return h.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"}),N(!1),e.abrupt("return");case 13:0===r&&(N(!1),F(i),2===i.status&&(N(!1),h.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"})));case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),o=W(),e.next=15,(0,g.bM)(null==n?void 0:n.identifier,{});case 15:s(),e.next=19;break;case 18:N(!1);case 19:return e.abrupt("return");case 20:return u=!0,e.next=23,r.validateFields().then((function(){u=!1}),(function(e){var n,t;e.errorFields[0].name.includes("standard_answers")?f.ZP.error("填空项答案不能为空"):f.ZP.error(e.errorFields[0].errors[0]),0===(null===(n=e.errorFields)||void 0===n?void 0:n.length)&&(u=!1),r.scrollToField(null==e||null===(t=e.errorFields)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.name,{behavior:"smooth",block:"center"}),u=!0}));case 23:if(!u){e.next=25;break}return e.abrupt("return");case 25:if(N(!0),!C){e.next=28;break}return e.abrupt("return");case 28:if(d="",p=r.getFieldsValue(),S){e.next=39;break}return e.next=33,(0,x.ZP)("/api/problems.json",{method:"post",body:i()(i()({},p),{},{hack:i()(i()({},null==p?void 0:p.hack),{},{sub_discipline_id:null==p||null===(m=p.hack)||void 0===m||null===(m=m.sub_discipline_id)||void 0===m?void 0:m[1],difficult:p.difficulty,item_banks_group_id:p.item_banks_group_id}),hack_codes:i()(i()({},p.hack_codes),{},{code:v.Base64.encode(p.hack_codes.code)}),hack_sets:[i()({},p.hack_sets)],is_blank:!0})});case 33:d=e.sent,S=null===(b=d)||void 0===b?void 0:b.identifier,sessionStorage.projectFill=S,P(S),e.next=42;break;case 39:return e.next=41,(0,x.ZP)("/api/problems/".concat(S,".json"),{method:"put",body:i()(i()({},p),{},{hack:i()(i()({},null==p?void 0:p.hack),{},{sub_discipline_id:null==p||null===(j=p.hack)||void 0===j||null===(j=j.sub_discipline_id)||void 0===j?void 0:j[1],difficult:p.difficulty,item_banks_group_id:p.item_banks_group_id}),hack_codes:i()(i()({},p.hack_codes),{},{code:v.Base64.encode(p.hack_codes.code)}),update_hack_sets:[i()({},p.hack_sets)],is_blank:!0})});case 41:d=e.sent;case 42:return e.next=44,(0,x.ZP)("/api/problems/".concat(S,"/start.json"),{method:"get"});case 44:return y=e.sent,e.next=47,L(null,null==y?void 0:y.identifier);case 47:if(0!==(null==(_=e.sent)?void 0:_.status)){e.next=56;break}return k=function(){var e=c()(l()().mark((function e(){var n,t,r,i,a;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,g.rX)(null==y?void 0:y.identifier,"submit");case 2:if(n=e.sent,t=n.status,n.message,r=n.data,i=W(),a=i-w>1e3*(p.hack.time_limit+3),0===t||a||setTimeout(k,1e3),!a){e.next=13;break}return h.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"}),N(!1),e.abrupt("return");case 13:0===t&&(N(!1),F(r),2===r.status&&(N(!1),h.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"})));case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),w=W(),e.next=53,(0,g.bM)(null==y?void 0:y.identifier,{});case 53:k(),e.next=57;break;case 56:N(!1);case 57:case"end":return e.stop()}}),e)}))),children:t})),(null==R?void 0:R.id)&&2!==R.status&&(0,_.jsx)(h.Z,{open:(null==R?void 0:R.id)&&2!==R.status,title:"运行结果",width:1100,footer:!1,onOk:function(){F({})},onCancel:function(){F({})},children:(0,_.jsxs)("div",{style:{maxHeight:600,overflow:"auto",marginBottom:15},children:[(0,_.jsxs)("div",{style:{marginBottom:20,display:"flex",justifyContent:"space-between",fontSize:14},children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{style:{color:"#666666"},children:"状态"}),(0,_.jsx)("span",{style:{marginLeft:12,color:0!==R.status&&"#E30000"},children:b.Im[R.status]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{style:{color:"#666666"},children:"提交时间"}),(0,_.jsx)("span",{style:{marginLeft:12},children:y()(R.created_at).format("YYYY-MM-DD HH:mm:ss")})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{style:{color:"#666666"},children:"语言"}),(0,_.jsx)("span",{style:{marginLeft:12},children:R.language})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("span",{style:{color:"#666666"},children:"执行用时"}),(0,_.jsxs)("span",{style:{marginLeft:12},children:[R.execute_time,"ms"]})]})]}),(0,_.jsx)(b.Y4,i()({},R))]})})]})}},3410:function(e,n,t){t.d(n,{u:function(){return w}});var r=t(39647),i=t.n(r),a=t(79800),l=t.n(a),s=t(85573),c=t.n(s),o=t(82242),u=t.n(o),d=t(59301),p=t(95237),f=t(43604),m=t(6848),h=t(78241),v=t(98887),x=t(45532),g=t(52103),b=t(60950),j=t(37712),y=["key","name"],_=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],k=function(e){var n=e.value,t=e.onChange,r=e.choiceTextKey,i=e.answerKey,a=e.index,l=e.isEdit,s=e.setInputActive,o=e.form,d=e.choiceOptionsPath,h=e.allowChangeMode,y=e.showAddIcon,k=e.addItem,w=e.deleteItem,Z=1===(null==n?void 0:n[i]),C=function(){var e;Z?t(u()(u()({},n),{},c()({},i,0))):(h||(e=o.getFieldValue(d),o.setFieldValue(d,e.map((function(e){return u()(u()({},e),{},c()({},i,0))})))),t(u()(u()({},n),{},c()({},i,1))))};return(0,j.jsxs)(p.Z,{className:v.Z.choiceWrap,align:"middle",wrap:!1,children:[(0,j.jsx)(f.Z,{onClick:C,className:"".concat(v.Z.choiceIndex," ").concat(Z?v.Z.activeAnswer:""),children:_[a]}),(0,j.jsx)(f.Z,{flex:1,className:"".concat(v.Z.editorWrap," ml15"),onClick:s,children:(0,j.jsx)(b.x,{height:155,placeholder:"请您输入选项",isEdit:l,value:null==n?void 0:n[r],onChange:function(e){t(u()(u()({},n),{},c()({},r,e)))}})}),(0,j.jsx)(f.Z,{flex:"0 0 auto",className:"ml15",children:(0,j.jsx)("div",{onClick:C,className:"".concat(v.Z.setAnswerBtn," ").concat(Z?v.Z.activeAnswer:""),children:Z?"正确答案":"设为答案"})}),(0,j.jsxs)(f.Z,{className:v.Z.actionWrapper,children:[(0,j.jsx)(m.Z,{title:"新增参考答案",children:(0,j.jsx)(x.Z,{className:v.Z.addIcon,onClick:k,style:{visibility:y?"visible":"hidden"}})}),(0,j.jsx)(m.Z,{title:"删除",children:(0,j.jsx)(g.Z,{className:v.Z.deleteIcon,onClick:w,style:{visibility:a>1?"visible":"hidden"}})})]})]})},w=function(e){var n=e.questionTitlePlaceholder,t=e.titleKey,r=e.choiceKey,a=e.analysisKey,s=e.choiceTextKey,o=e.answerKey,p=e.choiceOptionsPath,f=e.allowChangeMode,m=void 0===f||f,x=e.form,g=e.showAnalysis,w=void 0===g||g,Z=(0,d.useState)(),C=l()(Z,2),N=C[0],E=C[1],I=(0,d.useState)(!1),S=l()(I,2),P=S[0],A=S[1];return(0,j.jsxs)("div",{className:v.Z.wrap,children:[(0,j.jsx)("div",{className:v.Z.questionTitleEditorWrap,children:(0,j.jsx)(h.Z.Item,{label:"题干",name:t,labelCol:{span:24},rules:[{required:!0}],children:(0,j.jsx)(b.h,{scrollId:Array.isArray(t)?t.join("_"):"".concat(t),watch:!0,height:140,placeholder:n})})}),(0,j.jsx)(h.Z.Item,{label:"答案选项",required:!0,labelCol:{span:24}}),(0,j.jsx)(h.Z.List,{name:r,rules:[{validator:function(e,n){var t=n.some((function(e){return 1===e[o]})),r=n.findIndex((function(e){var n;return(null===(n=e[s])||void 0===n?void 0:n.length)<=0}));return-1!==r?Promise.reject(new Error("请先输入".concat(_[r],"选项的内容"))):t?Promise.resolve():Promise.reject(new Error("请设置正确答案"))}}],children:function(e,n){var t=n.add,r=n.remove;return(0,j.jsxs)("div",{id:Array.isArray(p)?p.join("_"):"".concat(p),children:[e.map((function(n,a){var l=n.key,f=n.name,v=i()(n,y),g=N===l,b=a<7&&a===e.length-1;return(0,d.createElement)(h.Z.Item,u()(u()({},v),{},{key:l,name:f,noStyle:!0}),(0,j.jsx)(k,{choiceTextKey:s,answerKey:o,index:a,isEdit:g,setInputActive:function(){E(l)},form:x,choiceOptionsPath:p,allowChangeMode:m,showAddIcon:b,addItem:function(){return t(c()(c()({},s,""),o,0))},deleteItem:function(){return r(f)}}))})),e.length<8&&(0,j.jsx)("div",{className:"".concat(v.Z.addBtn," mb30"),onClick:function(){return t(c()(c()({},s,""),o,0))},children:"添加选项"})]})}}),w&&(0,j.jsx)("div",{onClick:function(){return A(!0)},children:(0,j.jsx)(h.Z.Item,{name:a,label:"题目解析",labelCol:{span:24},children:(0,j.jsx)(b.x,{placeholder:"请编辑题目解析(非必填)",isEdit:P})})})]})}},56949:function(e,n,t){t.d(n,{r:function(){return b}});var r=t(82242),i=t.n(r),a=t(39647),l=t.n(a),s=(t(59301),t(36381)),c=t(78241),o=t(95237),u=t(94001),d=t(6848),p=t(98887),f=t(52103),m=t(60950),h=t(3410),v=t(37712),x=["key","name"],g=s.Z.Panel,b=function(e){var n=e.questionTitlePlaceholder,t=(e.choiceKey,e.form),r=e.withScore;return(0,v.jsxs)("div",{className:p.Z.wrap,children:[(0,v.jsx)("div",{className:p.Z.questionTitleEditorWrap,children:(0,v.jsx)(c.Z.Item,{label:"题干",name:"name",labelCol:{span:24},rules:[{required:!0}],children:(0,v.jsx)(m.h,{scrollId:"name",watch:!0,height:140,placeholder:n})})}),(0,v.jsx)(c.Z.Item,{label:"小题",required:!0,labelCol:{span:24}}),(0,v.jsx)(c.Z.List,{name:"sub_item_banks",rules:[{validator:function(e,n){return n?Promise.resolve():Promise.reject(new Error("请添加小题"))}}],children:function(e,n){var a=n.add,m=n.remove;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(s.Z,{className:e.length>0?p.Z.collapseWrapper:"",bordered:!1,expandIcon:function(e){var n=e.isActive;return(0,v.jsx)("i",{className:"iconfont icon-weizhankai ".concat(n?p.Z.open:p.Z.close),style:{fontSize:14,transition:"all .2s"}})},children:e.map((function(e,n){var a=e.key,s=e.name,b=l()(e,x);return(0,v.jsx)(g,{className:p.Z.panel,forceRender:!0,header:(0,v.jsxs)("div",{className:p.Z.panelHeader,children:["第",n+1,"小题",(0,v.jsx)("span",{children:"(单选题)"})]}),extra:(0,v.jsxs)(o.Z,{align:"middle",onClick:function(e){return e.stopPropagation()},children:[r&&(0,v.jsx)(c.Z.Item,i()(i()({},b),{},{rules:[{required:!0,message:"请输入小题分值"}],label:"分值",name:[s,"question_score"],className:p.Z.blankInputNumberWrapper,children:(0,v.jsx)(u.Z,{className:p.Z.blankInput,placeholder:"请输入当前小题分数",min:.1,precision:1,max:100,style:{width:150}})})),(0,v.jsx)(d.Z,{title:"删除",children:(0,v.jsx)(f.Z,{className:"".concat(p.Z.deleteIcon," ml40"),onClick:function(){return m(s)}})})]}),children:(0,v.jsx)(c.Z.Item,i()(i()({},b),{},{name:s,children:(0,v.jsx)(h.u,{questionTitlePlaceholder:"请编辑选择题题干内容",allowChangeMode:!1,form:t,choiceKey:[s,"choices"],titleKey:[s,"name"],analysisKey:[s,"analysis"],choiceOptionsPath:["sub_item_banks",s,"choices"],choiceTextKey:"choice_text",answerKey:"is_answer"})}))},a)}))}),e.length<20&&(0,v.jsx)("div",{className:"".concat(p.Z.addBtn),onClick:function(){return a({name:"",choices:Array.from({length:4},(function(){return{choice_text:"",is_answer:0}})),analysis:""})},children:"添加小题"})]})}})]})}},89531:function(e,n,t){t.d(n,{u:function(){return A}});var r=t(39647),i=t.n(r),a=t(91232),l=t.n(a),s=t(85573),c=t.n(s),o=t(82242),u=t.n(o),d=t(79800),p=t.n(d),f=t(37205),m=t.n(f),h=t(59301),v=t(43418),x=t(95237),g=t(43604),b=t(73782),j=t(6848),y=t(78673),_=t(78241),k=t(94001),w=t(60950),Z=t(52103),C=t(98887),N=t(37712),E=["key","name"],I=function(e){var n=e.value,t=e.onChange;return(0,N.jsxs)(x.Z,{align:"middle",className:"ml20",gutter:[40,20],children:[null==n?void 0:n.map((function(e,r){return(0,N.jsxs)(g.Z,{className:C.Z.blankWrapper,children:[(0,N.jsx)(b.Z,{className:C.Z.blankInput,defaultValue:e,maxLength:1e3,onBlur:function(e){var i=m()(n),a=e.target.value.trim();i[r]=a,t(i)}}),(0,N.jsx)(j.Z,{title:"删除",children:(0,N.jsx)(Z.Z,{className:C.Z.deleteIcon,style:{marginLeft:15,visibility:r>0?"visible":"hidden"},onClick:function(){return function(e){v.Z.confirm({centered:!0,okText:"确定",cancelText:"取消",title:"提示",content:"确认要删除这个参考答案吗?",className:C.Z.modal,onOk:function(){var r=m()(n);r.splice(e,1),t(r)}})}(r)}})})]},"".concat(e,"_").concat(r))})),(0,N.jsx)(g.Z,{children:(0,N.jsx)("div",{className:"".concat(C.Z.addBtn),onClick:function(){var e;(e=m()(n)).push(""),t(e)},children:"新增答案"})})]})},S=function(e){var n=e.value,t=void 0===n||n,r=e.onChange;return(0,N.jsx)(y.Z,{checked:!t,onChange:function(e){r(!e)}})},P="▁",A=function(e){var n=e.questionTitlePlaceholder,t=e.form,r=e.scoreByBlank,a=void 0!==r&&r,s=e.answerKey,o=(0,h.useState)(!1),d=p()(o,2),f=d[0],m=d[1],v=function(e,n){for(var t=n.line,r=0,i=0;i<t;i++)r+=e.getLine(i).split(P).length-1;return r+=e.getLine(t).substring(0,n.ch).split(P).length-1},j=function(){var e=t.getFieldValue(s);t.setFieldsValue(c()({},s,e.map((function(e,n){return u()(u()({},e),{},{position:n+1})}))))},y=(0,h.useRef)(),Z=function(e,n){for(var t=0;t<e;t++)y.current({position:null,answer_text:[""]},n+t);j()},A=(0,h.useRef)(),O=function(e){A.current(e),j()},T=_.Z.useWatch(s,t);return(0,N.jsxs)("div",{className:C.Z.wrap,children:[(0,N.jsx)("div",{className:C.Z.questionTitleEditorWrap,children:(0,N.jsx)(_.Z.Item,{label:"题干",name:"name",labelCol:{span:24},rules:[{required:!0}],children:(0,N.jsx)(w.h,{scrollId:"name",watch:!0,height:140,placeholder:n,showNullButton:!0,onCMBeforeChange:function(e,n){!function(e,n,t,r){var i=e.getRange(n.from,n.to),a=0;if(n.text.forEach((function(e){a+=e.split(P).length-1})),"setValue"!==n.origin)if(i&&-1!==i.indexOf(P)){var l=i.split(P).length-1,s=v(e,n.from);console.log("删除".concat(l,"个, 前面有").concat(s,"个,新增").concat(a,"个")),r(l>1?Array.from({length:l},(function(e,n){return s+n})):s)}else if(a>0){var c=v(e,n.from);console.log("新增".concat(a,"个,之前有").concat(c,"个")),t(a,c)}}(e,n,Z,O)}})})}),(0,N.jsx)(_.Z.List,{name:s,rules:[{validator:function(e,n){if(0===(null==n?void 0:n.length))return Promise.reject(new Error("答案不能为空"));var t,r=l()(n);try{for(r.s();!(t=r.n()).done;){var i=(t.value||{}).answer_text;if(null!=i&&i.some((function(e){return 0===(null==e?void 0:e.length)})))return Promise.reject(new Error("填空项答案不能为空"))}}catch(e){r.e(e)}finally{r.f()}return Promise.resolve()}}],children:function(e,n,t){var r=n.add,l=n.remove;t.errors;return y.current=r,A.current=l,(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(_.Z.Item,{label:"答案选项",required:!0,labelCol:{span:24}}),e.map((function(e,n){var t=e.key,r=e.name,l=i()(e,E);return(0,N.jsxs)(x.Z,{className:"mb20",align:"middle",wrap:!1,children:[(0,N.jsxs)(g.Z,{flex:"0 0 auto",className:"".concat(C.Z.blankIndex),children:["填空项",n+1]}),(0,N.jsxs)(g.Z,{flex:1,children:[(0,N.jsxs)(x.Z,{align:"top",justify:"space-between",wrap:!1,children:[(0,N.jsx)(g.Z,{children:(0,N.jsx)(_.Z.Item,u()(u()({},l),{},{name:[r,"answer_text"],noStyle:!0,children:(0,N.jsx)(I,{})}))}),a&&(0,N.jsx)(g.Z,{flex:"224px",children:(0,N.jsx)(_.Z.Item,u()(u()({},l),{},{name:[r,"score"],label:"分值",rules:[{required:!0}],className:C.Z.blankInputNumberWrapper,children:(0,N.jsx)(k.Z,{className:C.Z.blankInput,min:.1,max:100,precision:1,style:{width:"100%"},placeholder:"按空给分请输入分值"})}))})]}),(0,N.jsx)(_.Z.Item,u()(u()({},l),{},{name:[r,"position"],noStyle:!0,children:(0,N.jsx)(b.Z,{type:"hidden"})}))]})]},t)}))]})}}),(null==T?void 0:T.length)>1&&(0,N.jsxs)(x.Z,{align:"middle",className:(null==T?void 0:T.length)>1?"mb30":"".concat(C.Z.hide),children:[(0,N.jsx)(_.Z.Item,{name:"is_ordered",children:(0,N.jsx)(S,{})}),(0,N.jsx)(g.Z,{className:"ml10",children:"允许学生每个填空的答案与标准答案的顺序不一致"})]}),(0,N.jsx)("div",{onClick:function(){return m(!0)},children:(0,N.jsx)(_.Z.Item,{name:"analysis",label:"题目解析",labelCol:{span:24},children:(0,N.jsx)(w.x,{placeholder:"请编辑题目解析(非必填)",isEdit:f})})})]})}},19343:function(e,n,t){t.d(n,{Z:function(){return y}});var r=t(39647),i=t.n(r),a=t(79800),l=t.n(a),s=t(82242),c=t.n(s),o=t(85573),u=t.n(o),d=t(59301),p=t(95237),f=t(43604),m=t(78241),h=t(98887),v=t(60950),x=t(37712),g=["key","name"],b=u()(u()({},"正确","T"),"错误","F"),j=function(e){var n=e.value,t=e.onChange,r=e.form,i=1===(null==n?void 0:n.is_answer),a=null==n?void 0:n.choice_text,l=function(){var e=r.getFieldsValue().choices.map((function(e){return{choice_text:e.choice_text,is_answer:0}}));r.setFieldsValue({choices:e}),t(c()(c()({},n),{},{is_answer:1}))};return(0,x.jsxs)(p.Z,{className:h.Z.choiceWrap,align:"middle",wrap:!1,children:[(0,x.jsx)(f.Z,{onClick:l,className:"".concat(h.Z.choiceIndex," ").concat(h.Z.judgementIndex," ").concat(i?h.Z.activeAnswer:""),children:b[a]}),(0,x.jsx)(f.Z,{flex:1,className:"".concat(h.Z.editorWrap," ml15"),children:(0,x.jsx)("div",{className:"".concat(h.Z.inputBorder," ").concat(h.Z.placeholder," ").concat(i?h.Z.activeJudgementAnswer:""),children:a})}),(0,x.jsx)(f.Z,{flex:"0 0 auto",className:"ml15",children:(0,x.jsx)("div",{onClick:l,className:"".concat(h.Z.setAnswerBtn," ").concat(i?h.Z.activeAnswer:""),children:i?"正确答案":"设为答案"})})]})},y=function(e){var n=e.questionTitlePlaceholder,t=(e.choiceKey,e.form),r=(0,d.useState)(!1),a=l()(r,2),s=a[0],o=a[1];return(0,x.jsxs)("div",{className:h.Z.wrap,children:[(0,x.jsx)("div",{className:h.Z.questionTitleEditorWrap,children:(0,x.jsx)(m.Z.Item,{label:"题干",name:"name",labelCol:{span:24},rules:[{required:!0}],children:(0,x.jsx)(v.h,{scrollId:"name",watch:!0,height:140,placeholder:n})})}),(0,x.jsx)(m.Z.Item,{label:"答案选项",required:!0,labelCol:{span:24},children:(0,x.jsx)(m.Z.List,{name:"choices",rules:[{validator:function(e,n){return n.some((function(e){return 1===(null==e?void 0:e.is_answer)}))?Promise.resolve():Promise.reject(new Error("请设置正确答案"))}}],children:function(e){return(0,x.jsx)("div",{id:"choices",children:e.map((function(e){var n=e.key,r=e.name,a=i()(e,g);return(0,d.createElement)(m.Z.Item,c()(c()({},a),{},{key:n,name:r,noStyle:!0}),(0,x.jsx)(j,{form:t}))}))})}})}),(0,x.jsx)("div",{onClick:function(){return o(!0)},children:(0,x.jsx)(m.Z.Item,{name:"analysis",label:"题目解析",labelCol:{span:24},children:(0,x.jsx)(v.x,{placeholder:"请编辑题目解析(非必填)",isEdit:s})})})]})}},60950:function(e,n,t){t.d(n,{h:function(){return p},x:function(){return f}});var r=t(82242),i=t.n(r),a=t(39647),l=t.n(a),s=t(33987),c=t(98887),o=(t(59301),t(23599)),u=t(37712),d=["value","onChange","scrollId"],p=function(e){var n=e.value,t=e.onChange,r=e.scrollId,a=l()(e,d);return(0,u.jsx)("div",{id:r||"",children:(0,u.jsx)(s.Z,i()(i()({},a),{},{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,r=e.placeholder,i=e.height,a=void 0===i?140:i;return e.isEdit?(0,u.jsx)(s.Z,{watch:!0,isFocus:!0,height:a,placeholder:r,defaultValue:n,onChange:t}):(0,u.jsx)("div",{style:{cursor:"pointer"},children:n?(0,u.jsx)(o.Z,{className:c.Z.inputBorder,value:n}):(0,u.jsx)("div",{className:"".concat(c.Z.inputBorder," ").concat(c.Z.placeholder),children:r})})}},85628:function(e,n,t){t.d(n,{W:function(){return S}});var r=t(91232),i=t.n(r),a=t(79800),l=t.n(a),s=t(82242),c=t.n(s),o=t(39647),u=t.n(o),d=t(59301),p=t(8591),f=t(12563),m=t(78241),h=t(78673),v=t(95237),x=t(43604),g=t(6848),b=t(73782),j=t(94001),y=t(98887),_=t(60950),k=t(33987),w=t(39248),Z=t(37712),C=["value","onChange"],N=["key","name"],E=function(e){var n=e.value,t=e.onChange,r=u()(e,C);return(0,Z.jsx)(k.Z,c()(c()({},r),{},{defaultValue:null==n?void 0:n[0],onChange:function(e){t([e])}}))},I=function(e){var n=e.value,t=void 0===n?[]:n,r=e.onClose;return(0,Z.jsx)(f.Z,{closable:!0,onClose:r,className:y.Z.keywordTag,children:null==t?void 0:t.join(" 或 ")})},S=function(e){var n=e.questionTitlePlaceholder,t=e.form,r=e.showKeywords,a=e.isMustKeyWords,s=void 0===a?r:a,o=(0,d.useState)(!1),f=l()(o,2),k=f[0],C=f[1],S=(0,d.useState)(""),P=l()(S,2),A=P[0],O=P[1],T=m.Z.useWatch("use_keywords",t),R=m.Z.useWatch("question_score",t);return(0,Z.jsxs)("div",{className:y.Z.wrap,children:[(0,Z.jsx)("div",{className:y.Z.questionTitleEditorWrap,children:(0,Z.jsx)(m.Z.Item,{label:"题干",name:"name",labelCol:{span:24},rules:[{required:!0}],children:(0,Z.jsx)(_.h,{scrollId:"name",watch:!0,height:140,placeholder:n})})}),(0,Z.jsx)(m.Z.Item,{label:"参考答案",name:"answer_texts",labelCol:{span:24},children:(0,Z.jsx)(E,{watch:!0,height:140,placeholder:"请编辑参考答案(非必填)"})}),r&&!s&&(0,Z.jsx)(m.Z.Item,{hidden:!0,name:"use_keywords",valuePropName:"checked",children:(0,Z.jsx)(h.Z,{defaultChecked:!0})}),r&&s&&(0,Z.jsxs)(v.Z,{align:"middle",className:"mb30",children:[(0,Z.jsx)(m.Z.Item,{name:"use_keywords",valuePropName:"checked",children:(0,Z.jsx)(h.Z,{})}),(0,Z.jsx)(x.Z,{className:"ml10",children:"开启关键词自动判分"}),(0,Z.jsx)(x.Z,{children:(0,Z.jsx)(g.Z,{placement:"right",title:"选中后,需要设置每个关键词的分值,系统会根据设置的关键词进行自动判分; 所有关键词分值之和必须小于等于小题分值。",children:(0,Z.jsx)(w.Z,{style:{color:"#3061D0",marginLeft:6,cursor:"pointer"}})})})]}),(T||!s)&&(0,Z.jsx)(m.Z.List,{name:"keywords",rules:[{validator:function(e,n){return s?null!=n&&n.length?(null==n?void 0:n.reduce((function(e,n){return e+n.score}),0))>parseFloat(R)?Promise.reject(new Error("所有关键词的分值之和必须小于等于该小题的分值")):Promise.resolve():Promise.reject(new Error("请输入关键词")):Promise.resolve()}}],children:function(e,n){var r=n.add,a=n.remove;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("div",{className:"".concat(y.Z.title," mb10"),children:s?"关键词":(0,Z.jsx)("span",{style:{color:"#9096A3"},children:"判分关键词"})}),(0,Z.jsxs)(v.Z,{align:"middle",className:"font14 mb30",children:[(0,Z.jsx)(x.Z,{flex:1,children:(0,Z.jsx)(b.Z,{value:A,onChange:function(e){O(e.target.value)},maxLength:50,allowClear:!0,onPressEnter:function(e){var n,a,l,s,c,o="".concat(null===(n=e.target)||void 0===n?void 0:n.value).replaceAll(" ",""),u=null==o||null===(a=o.split("|"))||void 0===a?void 0:a.filter((function(e){return!!e})),d=t.getFieldValue("keywords"),f=(null==d||null===(l=d.map((function(e){return null==e?void 0:e.keyword})))||void 0===l?void 0:l.flat())||[],m=i()(u);try{for(m.s();!(s=m.n()).done;){var h=s.value;if(f.includes(h))return void p.ZP.error("为避免判分错误,请勿设置相同的关键词")}}catch(e){m.e(e)}finally{m.f()}(c=o)&&(new RegExp("[ `~!@#$^&*()={}':;,\\[\\].<>/?~@#¥……&*—【】”“。「」『』_\\+\\-·%《》]|[\\\\/]"),"|"!==c||(p.ZP.warning("关键词不能只输入一个“|”字符!"),0))&&(r({keyword:u,score:1}),O(""))},className:y.Z.inputBorder,placeholder:"支持设置多个关键词;并列关键词(或的关系)请用“|”分隔开"})}),(0,Z.jsx)(x.Z,{flex:"148px",style:{textAlign:"right",color:"#9096A3"},children:"“回车键”保存关键词"})]}),e.map((function(e){var n=e.key,t=e.name,r=u()(e,N);return(0,Z.jsx)(v.Z,{className:"mb20",style:{marginRight:148},children:(0,Z.jsx)(x.Z,{flex:1,children:(0,Z.jsxs)(v.Z,{align:"middle",justify:"space-between",children:[(0,Z.jsx)(m.Z.Item,c()(c()({},r),{},{name:[t,"keyword"],children:(0,Z.jsx)(I,{onClose:function(){return a(t)}})})),s&&(0,Z.jsx)(m.Z.Item,c()(c()({},r),{},{name:[t,"score"],label:"分值",rules:[{required:!0}],className:y.Z.blankInputNumberWrapper,children:(0,Z.jsx)(j.Z,{className:y.Z.blankInput,min:.1,max:100,precision:1,style:{width:"100%"},placeholder:"请输入关键词分数"})}))]})})},n)}))]})}}),(0,Z.jsx)("div",{onClick:function(){return C(!0)},children:(0,Z.jsx)(m.Z.Item,{name:"analysis",label:"题目解析",labelCol:{span:24},children:(0,Z.jsx)(_.x,{placeholder:"请编辑题目解析(非必填)",isEdit:k})})})]})}},63927:function(e,n,t){t.d(n,{Wk:function(){return l.W},ZZ:function(){return i.Z},rL:function(){return s.r},tc:function(){return c.t},u8:function(){return a.u},uh:function(){return r.u}});var r=t(3410),i=t(19343),a=t(89531),l=t(85628),s=t(56949),c=t(53921)},23599:function(e,n,t){t.d(n,{Z:function(){return q}});var r=t(82242),i=t.n(r),a=t(37205),l=t.n(a),s=t(91232),c=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p=(t(86622),t(32834)),f=t.n(p),m=t(11690);var h=[],v=["<ul>"],x=new(f().Renderer),g=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function b(){h.length=0,v=["<ul>"]}var j={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(e,n,t,r){if(n>=e.length||e[n].level<=t)return n;var i=e[n];r.push("<li><a href='#"+i.anchor+"'>"+i.text+"</a>");var a=[];return n=y(e,++n,i.level,a),a.length>0&&(r.push("<ul>"),a.forEach((function(e){r.push(e)})),r.push("</ul>")),r.push("</li>"),n=y(e,n,t,r)}function _(){return y(h,0,0,v),v.push("</ul>"),v.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],r=function(e,n){var t=e.match(/^(\s+)(?:```)/);if(null===t)return n;var r=t[1];return n.split("\n").map((function(e){var n=e.match(/^\s+/);return null===n?e:u()(n,1)[0].length>=r.length?e.slice(r.length):e})).join("\n")}(t,n[3]||""),i=n[2]?n[2].trim():n[2];if(["latex","katex","math"].indexOf(i)>=0){var a=C(),l=r;r=a,N[a]={type:"block",expression:l}}return{type:"code",raw:t,lang:i,text:r}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,Z=0,C=function(){return"__special_katext_id_".concat(Z++,"__")},N={};function E(){return N}function I(){Z=0,N={}}function S(e){return e=e.replace(w,(function(e,n){var t=C();return N[t]={type:"inline",expression:n},t}))}var P=x.listitem;x.listitem=function(e){return P(S(e))};var A=x.paragraph;x.paragraph=function(e){return A(S(e))};var O=x.tablecell;x.tablecell=function(e,n){return O(S(e),n)},x.code=function(e,n,t){var r=(n||"").match(/\S*/)[0];return r?["latex","katex","math"].indexOf(r)>=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>"},x.heading=function(e,n,t){var r=this.options.headerPrefix+t.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:r,level:n,text:e}),"<h"+n+' id="'+r+'">'+e+"</h"+n+">"},f().setOptions({silent:!0,gfm:!0,pedantic:!1}),f().use({tokenizer:k,renderer:x});var T=f(),R=(t(64018),t(45071)),F=t(15309),B=t(15342),L=t(1012),M=t(13282),V=t(37712),D="@▁@",W=/<pre[^>]*>/g;var q=function(e){var n=e.value,t=void 0===n?"":n,r=e.className,a=e.showTextOnly,s=e.showLines,o=e.style,p=void 0===o?{}:o,f=e.stylesPrev,m=void 0===f?{}:f,h=e.highlightKeywords,v=e.showProgramFill,x=(e.isProgramFill,e.disabledFill),g=void 0!==x&&x,y=e.programFillValue,k=e.onFillChange,w=void 0===k?function(e){}:k,Z=e.onFillBlur,C=void 0===Z?function(){}:Z,N=String(t),S=(0,d.useState)(""),P=u()(S,2),A=P[0],O=P[1],q=(0,d.useState)("office"),U=u()(q,2),H=U[0],z=U[1],K=(0,d.useState)([]),G=u()(K,2),X=G[0],J=G[1],Y=(0,d.useRef)("a"+(0,L.Z)()),Q={},$=function(e){return e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,(function(e,n){var t=n.replace(/(\n|\r)/g,"").split("}"),r=[];return t.map((function(e){""!=e&&r.push(".".concat(Y.current," ").concat(e))})),"<style>".concat(r.join("}"),"</style>")}))},ee=(0,d.useMemo)((function(){try{N=N.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+F.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+F.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+F.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,"\n")}catch(e){}if(v){var e=-1;return N=N.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,(function(n,t,r){return function(e,n){var t=document.createElement(e===D?"input":"textarea");t.style.width="100%",t.style.height=e===D?"40px":"151px",t.rows=5,t.spellcheck=!1,t.name="edu-program-fill",t.placeholder="请输入",t.dataset.id=n;var r=Object.keys(Q).length;return Q[r]=t,'<span class="edu-program-fill-wrap '.concat(e===D?"":"show",'" style="width:').concat(e===D?"200px":"100%",'"><span>').concat(t.outerHTML,'<span class="edu-program-fill-score"></span></span></span>')}(n,++e)})),'<pre style="background:#fff;padding:4px">'.concat($(N||""),"</pre>")}var n=T(N);n=$(n);var t=E();N.match(/\[TOC\]/)&&(n=n.replace("<p>[TOC]</p>",_()),b()),n=n.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var r=t[n],i=r.type,a=r.expression;return(0,B.renderToString)(function(e){var n=document.createElement("div");return n.innerHTML=e,0===n.childNodes.length?"":n.childNodes[0].nodeValue}(a)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})})),n=n.replace(/▁/g,"▁▁▁"),I();var r=document.createElement("div");return r.innerHTML=n,h?(re(r,h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),r.innerHTML):a?r.innerText:(setTimeout((function(){return le()}),500),r.innerHTML)}),[N,h]);(0,d.useEffect)((function(){ie.current&&ie.current.querySelectorAll(["input","textarea"]).forEach((function(e){e.oninput=ne,e.onblur=te}))}),[X]),(0,d.useEffect)((function(){if(null!=y&&y.length){var e,n=ie.current.querySelectorAll(".edu-program-fill-score"),t=ie.current.querySelectorAll('[name="edu-program-fill"]'),r=c()(t.entries());try{for(r.s();!(e=r.n()).done;){var i,a=u()(e.value,2),l=a[0],s=a[1];s.value=null===(i=y[l])||void 0===i?void 0:i.value,"warning"===y[l].type?s.className="program-fill-warning":"success"===y[l].type?s.className="program-fill-success":s.className=""}}catch(e){r.e(e)}finally{r.f()}var o,d=c()(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=y[h])&&void 0!==p&&p.score?"".concat(null===(f=y[h])||void 0===f?void 0:f.score,"分"):""}}catch(e){d.e(e)}finally{d.f()}J(y)}}),[y]);var ne=function(e){X[e.target.dataset.id]=X[e.target.dataset.id]||{},X[e.target.dataset.id].value=e.target.value,J(l()(X)),w(X,e.target.dataset.id)},te=function(e){X[e.target.dataset.id]=X[e.target.dataset.id]||{},X[e.target.dataset.id].value=e.target.value,J(l()(X)),C(X,e.target.dataset.id)};function re(e,n){return e.childNodes.forEach((function(e){if(e.childNodes.length>0)re(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 r=document.createElement("span");r.innerHTML=e.textContent.replace(new RegExp(n,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),e.replaceWith(r)}}))}var ie=(0,d.useRef)();function ae(e){var n=e.target;if("A"===n.tagName.toUpperCase()){var t=n.getAttribute("href");if(t.indexOf("office")>-1)e.preventDefault(),O(t),z("office");else if(t.indexOf("application/pdf")>-1)e.preventDefault(),O(t),z("pdf");else if(t.indexOf("text/html")>-1)e.preventDefault(),O(t),z("html");else if(t.startsWith("#")){e.preventDefault();var r=document.getElementById(t.replace("#",""));r&&r.scrollIntoView(!0)}}}j.WebkitLineClamp=s,s&&(p=i()(i()({},p),j));var le=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(R.ZP.isSupported()){var n=new R.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",ae),function(){var e;null===(e=ie.current)||void 0===e||e.removeEventListener("click",ae),I(),b()}}),[ee,ie.current,ae]),(0,V.jsxs)(V.Fragment,{children:[a&&(0,V.jsx)("div",{ref:ie,children:ee}),!a&&(0,V.jsx)("div",{ref:ie,style:i()({},p),className:"".concat(r||""," ").concat(g?"disabled-fill":""," markdown-body ").concat(Y.current),dangerouslySetInnerHTML:{__html:ee}}),(0,V.jsx)(M.Z,{close:!0,data:A,type:null!=A&&A.length?H:"",style:i()({},m),onClose:function(){return O("")}})]})}},58152:function(e,n,t){t.d(n,{Z:function(){return s}});t(59301);var r=t(65363),i="ldsRing___mpBZC",a="idsRingWrapper___Of9_n",l=t(37712),s=function(e){var n=e.message,t=e.className,s=(e.children,e.style),c=void 0===s?{}:s;return(0,l.jsxs)("div",{className:"".concat(a," ").concat(t),children:[(0,l.jsxs)("div",{className:i,children:[(0,l.jsx)("div",{}),(0,l.jsx)("div",{}),(0,l.jsx)("div",{}),(0,l.jsx)("div",{})]}),n?(0,l.jsx)("p",{style:c,children:n}):null,(0,l.jsx)(r.Outlet,{})]})}},35028:function(e,n,t){t.d(n,{h:function(){return x}});var r=t(82242),i=t.n(r),a=t(79800),l=t.n(a),s=t(59301),c=t(57809),o=t(78241),u=t(3113),d=t(89780),p=t.n(d),f=(t(48860),t(48838),t(37712)),m=c.default.Option,h={labelCol:{span:4},wrapperCol:{span:20}},v={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};function x(e){var n=e.value,t=e.onChange,r=e.mode,a=e.options,c=void 0===a?{}:a,o=(0,s.useRef)(),u=(0,s.useState)(),d=l()(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",r)}),[m,r]),(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:r,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));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,r=(0,s.useState)("python"),a=l()(r,2),d=a[0],p=a[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)(c.default,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(v[e][1])},children:Object.keys(v).map((function(e){return(0,f.jsx)(m,{value:e,children:v[e][0]},e)}))})}),(0,f.jsx)(o.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(x,{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:"取消"})]})]}))}},33987:function(e,n,t){t.d(n,{Z:function(){return ce}});var r=t(91232),i=t.n(r),a=t(7557),l=t.n(a),s=t(41498),c=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),v=t(76374),x=(t(48860),t(6313),t(25717),t(99498),t(25419),t(67549),t(23599)),g=t(37712),b=function(e){var n=e.value,t=void 0===n?"":n,r=(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:r}})})},j=t(82242),y=t.n(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,r=e.icon,i=e.actionName,a=e.className,l=void 0===a?"":a,s=e.children;return(0,g.jsxs)("a",{title:t,className:l,onClick:function(){n(i)},children:[(0,g.jsx)("i",{className:"md-iconfont ".concat(r)}),s]})}var w=function(e){var n=e.watch,t=e.showNullButton,r=e.showNullProgramButton,i=e.onActionCallback,a=e.fullScreen,l=e.insertTemp,s=e.hidetoolBar,c=[].concat(_,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,g.jsxs)("ul",{className:"markdown-toolbar-container",children:[!s&&c.map((function(e,n){return(0,g.jsx)("li",{children:e.actionName?(0,g.jsx)(k,y()(y()({},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,r?(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,l&&(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(l),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(a?"icon-shrink":"icon-enlarge"),title:a?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},Z=t(56386),C=t(78241),N=t(73782),E=t(3113),I={labelCol:{span:4},wrapperCol:{span:20}},S=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(C.Z,y()(y()({},I),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,g.jsx)(C.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,g.jsx)(N.Z,{})}),(0,g.jsx)(C.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,g.jsx)(N.Z,{})}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(E.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(E.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},P=t(35028),A=t(8591),O=t(18468),T=C.Z.useForm,R={width:280,marginRight:10},F={labelCol:{span:5},wrapperCol:{span:19}},B=function(e){var n=e.callback,t=e.onCancel,r=T(),i=u()(r,1)[0],a=(0,f.useRef)();function l(e,n){-1!==e.status?i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):A.ZP.error(e.message)}return(0,g.jsxs)(C.Z,y()(y()({form:i},F),{},{className:"upload-image-panel",onFinish:function(e){n(y()(y()({},e),{},{name:a.current}))},style:{width:470,overflow:"hidden"},children:[(0,g.jsx)(C.Z.Item,{label:"图片地址",required:!0,children:(0,g.jsxs)("div",{className:"flex-container",children:[(0,g.jsx)(C.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,g.jsx)(N.Z,{style:R})}),(0,g.jsx)(L,{onFileChange:function(e){var n=e.target.files[0];a.current=n.name,M(n,l)}})]})}),(0,g.jsx)(C.Z.Item,{label:"图片描述",name:"alt",children:(0,g.jsx)(N.Z,{style:{width:264}})}),(0,g.jsxs)(C.Z.Item,{style:{textAlign:"right"},children:[(0,g.jsx)(E.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(E.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function L(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 M(e,n){if(!e)throw new String("没有文件");var t=new FormData;t.append("editormd-image-file",e),t.append("file_param_name","editormd-image-file"),t.append("byxhr","true");var r=new window.XMLHttpRequest;r.withCredentials=!0,r.addEventListener("load",(function(t){n(JSON.parse(t.target.responseText),e)}),!1),r.addEventListener("error",(function(e){console.error(e)}),!1),r.open("POST","".concat(O.KI,"/api/attachments.json")),r.send(t)}var V=t(5112),D=t(94001),W=V.ZP.Group,q={margin:"0 8px"},U=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(C.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:q,children:"单元格数:"}),(0,g.jsx)("span",{style:q,children:"行数"}),(0,g.jsx)(C.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,g.jsx)(D.Z,{})}),(0,g.jsx)("span",{style:q,children:"列数"}),(0,g.jsx)(C.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,g.jsx)(D.Z,{})})]}),(0,g.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,g.jsx)("span",{style:q,children:"对齐方式:"}),(0,g.jsx)(C.Z.Item,{name:"align",children:(0,g.jsxs)(W,{children:[(0,g.jsx)(V.ZP,{value:"default",children:(0,g.jsx)("i",{className:"fa fa-align-justify"})}),(0,g.jsx)(V.ZP,{value:"left",children:(0,g.jsx)("i",{className:"fa fa-align-left"})}),(0,g.jsx)(V.ZP,{value:"center",children:(0,g.jsx)("i",{className:"fa fa-align-center"})}),(0,g.jsx)(V.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)(E.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(E.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},H=t(15309),z=t(79311),K=t(1012),G=t(43418),X="link",J="upload-image",Y="code-block",Q="add-table",$="------------",ee={default:$,left:":".concat($),center:":".concat($,":"),right:"".concat($,":")},ne=t(70325);var te="@▁▁@";function re(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",ae=["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"],le=p()(p()({},ie+"-B","bold"),ie+"-I","italic"),se=p()(p()(p()(p()({},X,"添加链接"),Y,"添加代码块"),J,"添加文件"),Q,"添加表格"),ce=function(e){var n=e.defaultValue,t=void 0===n?"":n,r=e.onChange,a=e.width,s=void 0===a?"100%":a,o=e.height,d=void 0===o?400:o,m=e.miniToolbar,j=void 0!==m&&m,y=e.isFocus,_=void 0!==y&&y,k=e.watch,C=e.insertTemp,N=e.mode,E=void 0===N?"markdown":N,I=e.id,O=void 0===I?"markdown-editor-id":I,T=e.showResizeBar,R=void 0!==T&&T,F=e.noStorage,L=void 0!==F&&F,V=e.showNullButton,D=void 0!==V&&V,W=e.showNullProgramButton,q=void 0!==W&&W,$=e.hidetoolBar,ie=void 0!==$&&$,ce=e.fullScreen,oe=void 0!==ce&&ce,ue=e.onBlur,de=e.onCMBeforeChange,pe=e.onFullScreen,fe=e.className,me=void 0===fe?"":fe,he=e.disablePaste,ve=void 0!==he&&he,xe=e.disabled,ge=void 0!==xe&&xe,be=e.disabledFill,je=void 0!==be&&be,ye=e.placeholder,_e=void 0===ye?"":ye,ke=e.values,we=void 0===ke?"":ke,Ze=(0,f.useState)(null),Ce=u()(Ze,2),Ne=Ce[0],Ee=Ce[1],Ie=(0,f.useState)(t),Se=u()(Ie,2),Pe=Se[0],Ae=Se[1],Oe=(0,f.useState)(k),Te=u()(Oe,2),Re=Te[0],Fe=Te[1],Be=(0,f.useState)(oe),Le=u()(Be,2),Me=Le[0],Ve=Le[1],De=(0,f.useState)(""),We=u()(De,2),qe=We[0],Ue=We[1],He=(0,f.useState)(0),ze=u()(He,2),Ke=ze[0],Ge=ze[1],Xe=(0,f.useState)(d),Je=u()(Xe,2),Ye=Je[0],Qe=Je[1],$e=(0,f.useState)(!1),en=u()($e,2),nn=(en[0],en[1]),tn=(0,f.useRef)((0,K.Z)()),rn=(0,f.useRef)(!1),an=(0,f.useRef)(),ln=(0,f.useRef)(),sn=(0,f.useRef)(),cn=(0,f.useRef)(),on=(0,f.useRef)(),un=function(){var e=c()(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,z.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:",Ne,ln),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?Ne.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):e.content_type.indexOf("video")>-1?Ne.replaceSelection('<video width="100%" controls src="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Ne.replaceSelection('<a href="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):Ne.replaceSelection("[".concat(e.name,"](").concat(H.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")"))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,f.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ae(we),null==Ne||Ne.setValue(we),window.scrollTo(0,e)}),[we]),(0,f.useEffect)((function(){null==pe||pe(Me)}),[Me]),(0,f.useEffect)((function(){if(ln.current){var e=function(e,t){if(!ve){var r=t.clipboardData;if(r){var i=r.types.toString(),a=r.items;if("Files"===i||r.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==E)return;try{var l,s=a[1];"file"===(null===(l=a[0])||void 0===l?void 0:l.kind)&&(s=a[0]);var c=s.getAsFile(),o=c.name.split(".").pop();M(c,(function(e){var t,r,i;e.id?(null==c||null===(t=c.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==c||null===(r=c.type)||void 0===r?void 0:r.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(c.type,'&disposition=inline" target="_blank">').concat(c.name,"</a>")):ae.includes(o)?n.replaceSelection('<a href="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(c.name,"</a>")):n.replaceSelection("[".concat(c.name,"](").concat(H.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))}catch(t){A.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=h().fromTextArea(ln.current,{mode:E,lineNumbers:!j,lineWrapping:!0,value:t,autoCloseTags:!q,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",_e):n.setOption("placeholder",null))})),n.on("keydown",(function(e,n){if(8===n.keyCode){var t=function(e,n){var t=e.getDoc(),r=t.getCursor(),i=t.getLine(r.line),a=i.charAt(r.ch-1),l=i.lastIndexOf("@▁@",r.ch),s=i.lastIndexOf("@▁▁@",r.ch),c=l>s?l:s,o=l>s?3:4;if(-1===te.indexOf(a))return null;if(console.log("change1:",n,e,i,r,c,l,s,a),c>=0&&r.ch-c<5){var u=c+o;return t.replaceRange("",{line:r.line,ch:c},{line:r.line,ch:u}),{line:r.line,ch:u}}return null}(e);t&&n.preventDefault()}})),_&&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 r;if(sn.current.classList.add("mouse-hover-md"),(r=t.dataTransfer.files).length>0){t.preventDefault(),t.stopPropagation();for(var i=function(){var e=r[a],t=e.name.split(".").pop();M(e,(function(r){var i,a,l;r.id?(null==e||null===(i=e.type)||void 0===i?void 0:i.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(r.id,"?type=").concat(r.content_type,")")):(null==e||null===(a=e.type)||void 0===a?void 0:a.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(r.id,'"></video>')):(null==e||null===(l=e.type)||void 0===l?void 0:l.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(r.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):ae.includes(t)?n.replaceSelection('<a href="'.concat(H.Z.API_SERVER,"/api/attachments/").concat(r.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(H.Z.API_SERVER,"/api/attachments/").concat(r.id,"?type=").concat(r.content_type,")")):401===(null==r?void 0:r.status)&&(document.location.href="/user/login")}))},a=0;a<r.length;a++)i()}})),ge&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ee(n),function(){n.off("paste",e)}}}),[]);var dn=(0,f.useCallback)((function(){sn.current}),[Ye,sn,Me]);(0,f.useEffect)((function(){if(Ne){var e=function(){var e=new v.Z((function(e){var n,t=i()(e);try{for(t.s();!(n=t.n()).done;){var r=n.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&(dn(),Ne.setSize("100%","100%"),Ne.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(ln.current.parentElement),e}();return function(){var n,t;null!==(n=ln.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=ln.current)||void 0===t?void 0:t.parentElement)}}}),[Ne,dn]),(0,f.useEffect)((function(){if(Ne){for(var e=[],n=function(){var n=u()(r[t],2),i=n[0],a=n[1],l=p()({},i,(function(){pn(a)}));e.push(l),Ne.addKeyMap(l)},t=0,r=Object.entries(le);t<r.length;t++)n();return an.current=setInterval((function(){rn.current&&un()}),4e3),function(){clearInterval(an.current);for(var n=0,t=e;n<t.length;n++){var r=t[n];Ne.removeKeyMap(r)}}}}),[Ne]),(0,f.useEffect)((function(){oe!==Me&&Ve(oe)}),[oe]),(0,ne.Z)((function(){if(!L&&Ke>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(O);e>=Ke+1e4&&(!n||n!==Pe)&&(window.sessionStorage.setItem(O,Pe),nn(!0))}}),1e4),(0,f.useEffect)((function(){Fe(k)}),[Ne,k]),(0,f.useEffect)((function(){Ne&&_&&Ne.focus()}),[Ne,_]),(0,f.useEffect)((function(){if(Re&&Ne){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=Ne.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Ne,Re]),(0,f.useEffect)((function(){if(Ne&&de){var e=function(e,n){de(e,n)};return Ne.on("beforeChange",e),function(){Ne.off("beforeChange",e)}}}),[Ne,de]),(0,f.useEffect)((function(){if(Ne&&ue){var e=function(){ue(Ne.getValue())};return Ne.on("blur",e),function(){Ne.off("blur",e)}}}),[Ne,ue]),(0,f.useEffect)((function(){if(Ne){var e=function(e,n){var t=e.getValue();Ae(t),Ge((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),r&&(q?r(t,xn(t)):r(t))};return Ne.on("change",e),function(){Ne.off("change",e)}}}),[Ne,r]),(0,f.useEffect)((function(){if(Ne)if(null==t)Ne.setValue(""),Ae("");else{var e=window.scrollY||window.pageYOffset;t!==Ne.getValue()&&(Ne.setValue(t),Ae(t),Ne.setCursor(ge?1:Ne.lineCount(),0),window.scrollTo(0,e))}}),[Ne,t]);var pn=(0,f.useCallback)((function(e){var n=Ne.getCursor(),t=Ne.getSelection(),r=t.split("\n");switch(e){case"bold":return Ne.replaceSelection("**"+t+"**"),""===t&&Ne.setCursor(n.line,n.ch+2),Ne.focus();case"italic":return Ne.replaceSelection("*"+t+"*"),""===t&&Ne.setCursor(n.line,n.ch+1),Ne.focus();case"code":return Ne.replaceSelection("`"+t+"`"),""===t&&Ne.setCursor(n.line,n.ch+1),Ne.focus();case"inline-latex":return Ne.replaceSelection("`$$"+t+"$$`"),""===t&&Ne.setCursor(n.line,n.ch+3),Ne.focus();case"latex":return Ne.replaceSelection("```latex\n"+t+"\n```"),Ne.setCursor(n.line+1,t.length+1),Ne.focus();case"line-break":return Ne.replaceSelection("<br/>\n"),Ne.focus();case"list-ul":return""===t?Ne.replaceSelection("- "+t):Ne.replaceSelection(r.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ne.focus();case"list-ol":return""===t?Ne.replaceSelection("1. "+t):Ne.replaceSelection(r.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),Ne.focus();case"add-null-ch":return""===t&&Ne.setCursor(n.line,n.ch),Ne.replaceSelection("▁"),Ne.focus();case"add-signal":return""===t&&Ne.setCursor(n.line,n.ch),Ne.replaceSelection("@▁@"),Ne.focus();case"add-multiple":return""===t&&Ne.setCursor(n.line,n.ch),Ne.replaceSelection(te),Ne.focus();case"inster-template-1":return""===t&&Ne.setCursor(n.line,n.ch),Ne.replaceSelection("\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作"),Ne.focus();case"eraser":return Ne.setValue(""),Ne.focus();case"trigger-watch":return Fe(!Re),Ne.focus();case"trigger-full-screen":return Ve(!Me),Ne.focus();case X:return void Ue(X);case Y:return void Ue(Y);case J:return void Ue(J);case Q:return void Ue(Q);default:throw new Error}}),[Ne,Re,Me]),fn=(0,f.useCallback)((function(e){switch(Ue(""),qe){case X:var n=e.title,t=e.link;return Ne.replaceSelection("[".concat(n,"](").concat(t,")")),Ne.focus();case Y:var r=e.language,i=e.content;return Ne.replaceSelection(["```"+r,i,"```"].join("\n")),Ne.focus();case J:var a=e.src,l=e.alt;return l?Ne.replaceSelection("![ ".concat(l," ]( ").concat(a,' "').concat(l,'" )')):Ne.replaceSelection("![,](".concat(a,")")),Ne.focus();case Q:for(var s=e.row,c=e.col,o=e.align,u="\n",d=0;d<s;d++){for(var p=[],f=[],m=0;m<c;m++)1===d&&f.push(ee[o]),p.push(" ");1===d&&(u+="| ".concat(f.join(" | ")," |\n")),u+="| ".concat(p.join(1===c?"":" | ")," |\n")}return Ne.replaceSelection(u+"\n"),Ne.focus();default:throw new Error}}),[Ne,qe]),mn=(0,f.useMemo)((function(){switch(qe){case X:return(0,g.jsx)(S,{callback:fn,onCancel:hn});case Y:return(0,g.jsx)(P.Z,{callback:fn,onCancel:hn});case J:return(0,g.jsx)(B,{callback:fn,onCancel:hn});case Q:return(0,g.jsx)(U,{callback:fn,onCancel:hn});default:return null}}),[qe]);function hn(){Ue("")}(0,f.useEffect)((function(){if(cn.current){var e=function(e){i=!0,a=e.pageY},n=function(){i=!1},t=function(e){if(i){var n=e.pageY-a;n<0&&(n=0),n>300&&(n=300),Qe(d+n+"px")}},r=cn.current,i=!1,a=0;return r.addEventListener("mousedown",e),document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),function(){r.removeEventListener("mousedown",e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}}}),[Ne,cn]),(0,f.useEffect)((function(){Qe(d)}),[d]);var vn={width:re(s),height:re(Ye)},xn=((0,f.useMemo)((function(){if(Ke){var e=new Date(Ke),n=e.getHours(),t=e.getMinutes(),r=e.getSeconds();return t=t<10?"0"+t:t,r=r<10?"0"+r:r,"".concat(n=n<10?"0"+n:n,":").concat(t,":").concat(r)}return 0}),[Ke]),function(e){var n=[];if(q){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,r){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,g.jsxs)(f.Fragment,{children:[(0,g.jsx)("div",{className:"markdown-editor-wrapper",ref:sn,children:(0,g.jsxs)("div",{className:"markdown-editor-container ".concat(me," ").concat(Re?"on-preview":""," ").concat(j?"mini":""," ").concat(Me?"full-screen":""),style:vn,children:[(0,g.jsx)(w,{insertTemp:C,watch:Re,fullScreen:Me,showNullButton:D,showNullProgramButton:q,onActionCallback:pn,hidetoolBar:ie,uuid:tn.current,setOpenPhones:function(){rn.current=!0}}),(0,g.jsxs)("div",{className:"markdown-editor-body",children:[(0,g.jsx)("div",{className:"codemirror-container",children:(0,g.jsx)("textarea",{ref:ln,placeholder:_e})}),Re?(0,g.jsxs)("div",{ref:on,className:"preview-container",children:["stex"===E&&(0,g.jsx)(b,{value:Pe}),"stex"!==E&&(0,g.jsx)(x.Z,{disabledFill:je,showProgramFill:q,value:Pe})]}):null]})]})}),R?(0,g.jsx)("a",{ref:cn,className:"editor-resize"}):null,(0,g.jsx)(Z.Z,{children:se[qe]?(0,g.jsx)(G.Z,{centered:!0,title:se[qe],open:!0,onCancel:hn,footer:null,className:"markdown-popup-form",children:mn}):null})]})}},56386:function(e,n,t){t.d(n,{Z:function(){return f}});var r=t(82100),i=t.n(r),a=t(29186),l=t.n(a),s=t(80619),c=t.n(s),o=t(47074),u=t.n(o),d=t(59301),p=t(4676),f=function(e){c()(t,e);var n=u()(t);function t(e){var r;i()(this,t),r=n.call(this,e);var a=window.document;return r.node=a.createElement("div"),a.body.appendChild(r.node),r}return l()(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)},70325:function(e,n,t){t.d(n,{Z:function(){return i}});var r=t(59301);function i(e,n){var t=(0,r.useRef)();(0,r.useEffect)((function(){t.current=e})),(0,r.useEffect)((function(){if(null!==n){var e=setInterval((function(){t.current()}),n);return function(){return clearInterval(e)}}}),[n])}},55662:function(e,n,t){t.d(n,{Y4:function(){return A},Im:function(){return I},ZP:function(){return T}});var r=t(79800),i=t.n(r),a=t(7557),l=t.n(a),s=t(41498),c=t.n(s),o=t(82242),u=t.n(o),d=t(85573),p=t.n(d),f=t(59301),m=t(73782),h=t(3113),v=t(78386),x=t(20538),g=t(53326),b=t(24334),j=t(58152),y=t(23599),_=t(27627),k=t(34376),w=t(79311),Z=t(65363),C=t(37712),N=m.Z.TextArea,E={visible:!1,tabIndex:"0"},I=p()(p()(p()(p()(p()(p()({},g.h.NOMATCH,"测试用例结果不匹配"),g.h.OK,"调试通过"),2,"调试超时"),3,"调试pod失败"),4,"编译失败"),5,"执行失败"),S=function(e){return e[e.SET_VISIBLE=0]="SET_VISIBLE",e[e.SET_TABINDEX=1]="SET_TABINDEX",e}(S||{});function P(e,n){switch(n.type){case S.SET_VISIBLE:return u()(u()({},e),{},{visible:n.payload});case S.SET_TABINDEX:return u()(u()({},e),{},{tabIndex:n.payload});default:throw new Error}}function A(e){var n=e.status,t=e.error_msg,r=e.output,i=e.input,a=e.expected_output,s=e.is_file,o=e.input_file_url,u=e.output_file_url,d=e.expected_output_file_url,p=e.setMonacoValue,m=e.setData,h=(0,f.useRef)(),v=(0,f.useRef)(),x=(0,f.useRef)(),j=null,Z={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch((0,f.useEffect)((function(){if(r&&!s&&h.current){var e=new k.Terminal({fontSize:14,letterSpacing:1,cols:83,rows:10});e.open(h.current);var n=(0,_.pp)(b.Base64.decode(r));e.write(n),e.setOption("theme",{background:"#1e1e1e"})}if(i&&!s&&v.current){var t=new k.Terminal({fontSize:14,letterSpacing:1,cols:83,rows:10});t.open(v.current),t.write((0,_.pp)(i)),t.setOption("theme",{background:"#1e1e1e"})}if(a&&!s&&x.current){var l=new k.Terminal({fontSize:14,letterSpacing:1,cols:83,rows:10});l.open(x.current),l.write((0,_.pp)(b.Base64.decode(a))),l.setOption("theme",{background:"#1e1e1e"})}}),[r]),n){case g.h.NOMATCH:j=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("p",{className:"c-red",children:"实际输入:"}),!s&&(0,C.jsx)("div",{ref:v}),s&&(0,C.jsx)("div",{style:Z,children:(0,C.jsx)("a",{style:{fontSize:"16px"},onClick:c()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(o,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return n=e.sent,e.t0=p,e.next=6,n.text();case 6:e.t1=e.sent,(0,e.t0)(e.t1),setTimeout((function(){m(o)}),200);case 9:case"end":return e.stop()}}),e)}))),children:i})}),(0,C.jsx)("p",{className:"c-red",children:"实际输出:"}),!s&&(0,C.jsx)("div",{ref:h}),s&&(0,C.jsx)("div",{style:Z,children:(0,C.jsx)("a",{style:{fontSize:"16px"},onClick:c()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,w.ZP)(u,{method:"Get",headers:{"Content-Type":"application/xml",Accept:"*/*"}});case 2:n=e.sent,p(n),setTimeout((function(){m(u)}),200);case 5:case"end":return e.stop()}}),e)}))),children:r})}),(0,C.jsx)("p",{className:"c-red",children:"预期输出:"}),!s&&(0,C.jsx)("div",{ref:x}),s&&(0,C.jsx)("div",{style:Z,children:(0,C.jsx)("a",{style:{fontSize:"16px"},onClick:c()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(d,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return n=e.sent,e.t0=p,e.next=6,n.text();case 6:e.t1=e.sent,(0,e.t0)(e.t1),setTimeout((function(){m(d)}),200);case 9:case"end":return e.stop()}}),e)}))),children:a})})]});break;case g.h.EXECUTEFAILURE:j=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{style:{border:"1px #F6F7F9 solid"},children:[(0,C.jsx)("p",{style:{width:"100%",height:40,background:"#F6F7F9",lineHeight:"40px",color:"#666666",paddingLeft:"12px"},children:"最后执行的输入:"}),!s&&(0,C.jsx)(y.Z,{value:i,style:Z}),s&&(0,C.jsx)("div",{style:Z,children:(0,C.jsx)("a",{onClick:function(){return(0,_.LR)(o,i)},children:i})})]}),(0,C.jsxs)("div",{style:{border:"1px #F6F7F9 solid",marginTop:"10px"},children:[(0,C.jsx)("p",{style:{width:"100%",height:40,background:"#F6F7F9",lineHeight:"40px",color:"#666666",paddingLeft:"12px"},children:"执行出错信息:"}),(0,C.jsxs)("pre",{className:"error",style:{color:"#E30000",padding:"0 10px"},children:[b.Base64.decode(t),"111"]})]})]});break;case g.h.COMPILEFAILURE:j=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("p",{children:"最后执行的输入:"}),!s&&(0,C.jsx)("div",{ref:v}),s&&(0,C.jsx)("div",{style:Z,children:(0,C.jsx)("a",{onClick:function(){return(0,_.LR)(o,i)},children:i})}),(0,C.jsx)("p",{children:"执行出错信息:"}),(0,C.jsx)("pre",{className:"error",children:b.Base64.decode(t)})]});break;case g.h.PODFAILURE:j=(0,C.jsx)("p",{children:"创建pod失败请稍后重试"});break;case g.h.TIMEOUT:j=(0,C.jsx)("p",{children:"评测超时,请稍后重试"})}return(0,C.jsxs)(C.Fragment,{children:[" ",j," "]})}function O(e){var n=e.status,t=e.error_msg,r=e.execute_time,i=e.output,a=e.input,l=e.expected_output,s=(e.is_file,e.input_file_url,e.output_file_url,e.expected_output_file_url,null);switch(n){case g.h.OK:s=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("p",{children:["执行用时:",r/1e3,"秒"]}),(0,C.jsx)("p",{children:"执行结果:"}),(0,C.jsx)("pre",{children:b.Base64.decode(i)})]});break;case g.h.NOMATCH:s=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("p",{children:["输入:",(0,C.jsx)("pre",{children:a})]}),(0,C.jsxs)("p",{children:["输出:",i&&b.Base64.decode(i)]}),(0,C.jsxs)("p",{children:["预期输出:",l&&b.Base64.decode(l)]})]});break;case g.h.EXECUTEFAILURE:case g.h.COMPILEFAILURE:s=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("p",{children:["最后执行的输入:",(0,C.jsx)("pre",{children:a})]}),(0,C.jsx)("p",{children:"执行出错信息:"}),(0,C.jsx)("pre",{className:"error",children:b.Base64.decode(t)})]});break;case g.h.PODFAILURE:s=(0,C.jsx)("p",{children:"创建pod失败请稍后重试"});break;case g.h.TIMEOUT:s=(0,C.jsx)("p",{children:"评测超时,请稍后重试"})}return(0,C.jsxs)(C.Fragment,{children:[" ",s," "]})}var T=function(e){var n=e.input,t=e.debuging,r=e.submitting,a=e.executingMessage,s=e.debugResult,o=e.onChangeInput,u=e.onDebugCode,d=e.onSubmitCode,p=e.hack,m=e.user,g=(0,f.useReducer)(P,E),b=i()(g,2),y=b[0],_=b[1],k=y.visible,I=y.tabIndex,A=(0,Z.useSearchParams)(),T=i()(A,1)[0];function R(e){var n=e.target.id;_({type:S.SET_TABINDEX,payload:n})}var F=(0,f.useMemo)((function(){if(s){s.status;return(0,C.jsx)(C.Fragment,{children:O(s)})}return null}),[s]);var B=function(){var e=c()(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,w.ZP)("/api/problems/".concat(n,"/start.json"),{method:"get",params:{hack_user_id:null==m?void 0:m.user_id}});case 2:(t=e.sent)&&(window.location.href="/myproblems/".concat(null==t?void 0:t.identifier,"?type=1"));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,C.jsxs)("div",{className:"test-case-panel",children:[(0,C.jsxs)("div",{className:"test-case-panel-body ".concat(k?"active":""),children:[(0,C.jsxs)("ul",{className:"s-navs",children:[(0,C.jsx)("li",{children:(0,C.jsx)("a",{className:"0"===I?"active":"",id:"0",onClick:R,children:"自定义测试用例"})}),(0,C.jsx)("li",{children:(0,C.jsx)("a",{className:"1"===I?"active":"",id:"1",onClick:R,children:"代码执行结果"})})]}),(0,C.jsx)("div",{className:"tab-panel-body ".concat("0"===I?"":"hide"),children:(0,C.jsx)(N,{placeholder:"请填写测试用例的输入值,点击“调试代码”",value:n,onChange:o})}),(0,C.jsx)("div",{className:"tab-panel-body ".concat("1"===I?"":"hide"),children:t?(0,C.jsx)(j.Z,{message:a}):s?(0,C.jsxs)("section",{style:{height:200},children:[" ",F," "]}):(0,C.jsx)("p",{className:"tip",children:"请填写测试用例的输入值,点击“调试代码”"})})]}),(0,C.jsx)("a",{className:"btn-collapse ".concat(k?"up":""),onClick:function(){_({type:S.SET_VISIBLE,payload:!k})},children:k?(0,C.jsx)(v.Z,{}):(0,C.jsx)(x.Z,{})}),(0,C.jsxs)("footer",{className:"footer",children:[(0,C.jsx)("span",{children:"控制台"}),(0,C.jsxs)("div",{className:"flex-container",children:[(null==p?void 0:p.is_program)&&(null==p?void 0:p.above_question)&&(0,C.jsx)(h.ZP,{onClick:function(){return B(null==p?void 0:p.above_question)},id:"oj-prev",className:"btn-blue",type:"ghost",children:"上一题"}),(null==p?void 0:p.is_program)&&(null==p?void 0:p.under_question)&&(0,C.jsx)(h.ZP,{onClick:function(){return B(null==p?void 0:p.under_question)},id:"oj-next",className:"btn-blue",type:"ghost",children:"下一题"}),(0,C.jsx)(h.ZP,{className:"btn-green",type:"ghost",loading:t,onClick:function(){_({type:S.SET_VISIBLE,payload:!0}),_({type:S.SET_TABINDEX,payload:"1"}),u()},children:"调试代码"}),"8"!==T.get("qtype")&&(0,C.jsx)(h.ZP,{type:"primary",className:"custom-ant-disabled",loading:r,disabled:r,onClick:function(){_({type:S.SET_VISIBLE,payload:!1}),d()},children:"评测并提交"})]})]})]})}},53326:function(e,n,t){t.d(n,{h:function(){return r}});var r=function(e){return e[e.NOMATCH=-1]="NOMATCH",e[e.OK=0]="OK",e[e.TIMEOUT=2]="TIMEOUT",e[e.PODFAILURE=3]="PODFAILURE",e[e.COMPILEFAILURE=4]="COMPILEFAILURE",e[e.EXECUTEFAILURE=5]="EXECUTEFAILURE",e}({})},9187:function(e,n,t){t.d(n,{H7:function(){return f},MK:function(){return p},MU:function(){return c},X6:function(){return u},bM:function(){return s},fi:function(){return m},fu:function(){return l},n4:function(){return h},rX:function(){return d},vl:function(){return v},zO:function(){return o}});var r=t(82242),i=t.n(r),a=t(79311);function l(e,n){return(0,a.U2)("myproblems/".concat(e,".json"),i()({hidePopLogin:!0},n||{}))}function s(e,n){return(0,a.v_)("myproblems/".concat(e,"/code_submit.json"),n)}function c(e,n){return(0,a.v_)("myproblems/".concat(e,"/code_debug.json"),n)}function o(e,n){return n.language&&(n.language=encodeURIComponent(n.language)),(0,a.U2)("myproblems/".concat(e,"/submit_records.json"),n)}function u(e){return(0,a.U2)("myproblems/record_detail.json",{id:e})}function d(e,n){return(0,a.U2)("myproblems/".concat(e,"/result.json"),{mode:n})}function p(e,n){return(0,a.v_)("myproblems/".concat(e,"/add_notes.json"),n)}function f(e){return(0,a.v_)("myproblems/".concat(e,"/restore_initial_code.json"))}function m(e){return(0,a.v_)("myproblems/".concat(e,"/sync_code.json"))}function h(e,n){return(0,a.v_)("myproblems/".concat(e,"/update_code.json"),n)}function v(e,n){return(0,a.v_)("discusses/".concat(e,"/plus.json"),n)}},64121:function(e,n,t){t.d(n,{D0:function(){return d},R8:function(){return c},jw:function(){return u},y3:function(){return p}});var r=t(85573),i=t.n(r),a=t(57809),l=(t(59301),t(37712)),s=a.default.Option,c=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()({},c.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"}]),c.difficult,[{title:"简单",key:1},{title:"中等",key:2},{title:"困难",key:3}]),c.category,[{title:"程序设计",key:1},{title:"算法",key:2}]),c.openOrNot,[{title:"公开",key:1},{title:"私有",key:0}]);function u(e){return o[e].map((function(e){return(0,l.jsxs)(s,{value:e.key,children:[" ",e.title," "]},e.title)}))}function d(e,n){e.map((function(e){var t=e.id,r=e.name,i=e.sub_disciplines,a={value:t,label:r};n.push(a),i&&i.length>0&&(a.children=[],d(i,a.children))}))}function p(e,n){for(var t=[],r=0;r<e.length;r++){var i,a=e[r];if((null===(i=a.sub_disciplines)||void 0===i?void 0:i.length)>0){t[0]=a.id;for(var l=0;l<a.sub_disciplines.length;l++){var s=a.sub_disciplines[l];if(s.id===n)return t[1]=s.id,[t,s.tag_disciplines||s.sub_disciplines||[]]}}}return[t,[]]}},92094:function(e,n,t){t.r(n),t.d(n,{default:function(){return ce}});var r=t(7557),i=t.n(r),a=t(41498),l=t.n(a),s=t(37205),c=t.n(s),o=t(79800),u=t.n(o),d=t(82242),p=t.n(d),f=t(59301),m=t(65363),h=t(78241),v=t(43418),x=t(8591),g=t(66104),b=t(5112),j=t(19842),y=t(6848),_=t(59028),k=t(61998),w=t(3113),Z=t(15309),C="bgWrapper___yZrnF",N="bg___DMAyj",E="main___l1oS8",I="addTypeRadio___eH2zI",S="formWrap___ydPvR",P="questionTypeRadio___jQze1",A="difficultyWrapper___W9ML_",O="difficultyRadio___z9UyX",T="easy___5Owsm",R="medium___NeHBc",F="hard___Hrees",B="cascaderWrapper___AUd1O",L="courseCascader___UEeI3",M="knowledgeWrapper___sIao8",V="uploadTips___v_XSU",D="uploadTipsIcon___gfQUD",W="downloadBtn___BqNPb",q="uploadBtn___p7bAk",U="buttonFixed___j1UZJ",H="buttonWrap___FfqsJ",z="button___TuRr2",K="topicWrap___v5_lJ",G="cascaderPopup___nXZ4B",X="unfold____IJ2y",J=t(63927),Y=t(27627),Q=t(10094),$=t(39248),ee=t(79311),ne=t(56559),te=t(64121),re=t(24334),ie=t(37712),ae=function(e){return"SINGLE"===e||"MULTIPLE"===e?"SELECT":e},le=function(e){return e.map((function(e){return p()(p()({},e),{},{is_answer:e.is_answer?1:0})}))},se=function(e){var n=e.form,t=e.currentItemType;return{SELECT:(0,ie.jsx)(J.uh,{form:n,questionTitlePlaceholder:"请编辑选择题题干内容",titleKey:"name",choiceKey:"choices",analysisKey:"analysis",choiceOptionsPath:"choices",choiceTextKey:"choice_text",answerKey:"is_answer",allowChangeMode:!0}),JUDGMENT:(0,ie.jsx)(J.ZZ,{form:n,questionTitlePlaceholder:"请编辑判断题题干内容",choiceKey:"choices"}),COMPLETION:(0,ie.jsx)(J.u8,{form:n,questionTitlePlaceholder:"请编辑题干并设置填空项",scoreByBlank:!1,answerKey:"standard_answers"}),SUBJECTIVE:(0,ie.jsx)(J.Wk,{showKeywords:!0,isMustKeyWords:!1,form:n,questionTitlePlaceholder:"请编辑简答题题干内容"}),COMBINATION:(0,ie.jsx)(J.rL,{form:n,questionTitlePlaceholder:"请编辑组合题题干内容",choiceKey:"choices",withScore:!1}),BPROGRAM:(0,ie.jsx)(J.tc,{form:n,questionTitlePlaceholder:"请编辑题干并设置填空项",scoreByBlank:!1,answerKey:"standard_answers"})}[t]||null},ce=(0,m.connect)((function(e){var n=e.problemset,t=e.loading;return{problemset:n,globalSetting:e.globalSetting,loading:t.effects}}))((function(e){var n,t,r,a=e.problemset,s=e.loading,o=e.dispatch,d=(0,m.useParams)(),J=(0,m.useSearchParams)(),ce=u()(J,1)[0],oe=h.Z.useForm(),ue=u()(oe,1)[0],de=(0,f.useState)(),pe=u()(de,2),fe=(pe[0],pe[1]),me=(0,f.useState)([]),he=u()(me,2),ve=he[0],xe=he[1],ge=(0,f.useRef)(),be=(0,f.useState)(1),je=u()(be,2),ye=je[0],_e=je[1],ke=(0,f.useState)([]),we=u()(ke,2),Ze=we[0],Ce=we[1],Ne=(0,f.useState)(),Ee=u()(Ne,2),Ie=Ee[0],Se=Ee[1],Pe=(0,f.useState)(!1),Ae=u()(Pe,2),Oe=Ae[0],Te=Ae[1],Re=(0,f.useState)(!1),Fe=u()(Re,2),Be=Fe[0],Le=Fe[1],Me=(0,f.useState)(),Ve=u()(Me,2),De=Ve[0],We=Ve[1],qe=(0,f.useState)("SELECT"),Ue=u()(qe,2),He=Ue[0],ze=Ue[1],Ke="BPROGRAM"===He?null===(n=h.Z.useWatch("hack",ue))||void 0===n?void 0:n.tag_discipline_ids:h.Z.useWatch("knowledge",ue);(0,f.useEffect)((function(){return o({type:"globalSetting/footerToggle",payload:!1}),function(){o({type:"globalSetting/footerToggle",payload:!0})}}),[]),(0,f.useEffect)((function(){return window.addEventListener("beforeunload",Xe),function(){window.removeEventListener("beforeunload",Xe)}}),[]),(0,f.useEffect)((function(){var e=ce.get("pages");fe(e);var n=d.id;ge.current=n}),[]);var Ge="edit"===d.type;(0,f.useEffect)((function(){o({type:"problemset/getEditDisciplines",payload:{source:"new_question"}}),"1"===ce.get("type")?ge.current&&o({type:"problemset/getEditDataBprogram",payload:{id:ge.current}}):ge.current&&o({type:"problemset/getEditData",payload:{id:ge.current}})}),[]),console.log("----",De),(0,f.useEffect)((function(){if(Ge){if(null==a||!a.editData)return;var e=(null==a?void 0:a.editData)||{},n=e.discipline,t=e.sub_discipline,r=e.sub_discipline_id,i=e.tag_disciplines,l=e.item_type,s=e.choices,o=void 0===s?[]:s,d=e.sub_item_banks,f=void 0===d?[]:d;if("1"===ce.get("type")){var m;if(ze("BPROGRAM"),null!=a&&null!==(m=a.disciplinesData)&&void 0!==m&&m.disciplines){var h,v,x,g,b=(0,te.y3)(null==a||null===(h=a.disciplinesData)||void 0===h?void 0:h.disciplines,r),j=u()(b,2),y=j[0],_=(j[1],{item_type:"BPROGRAM",standard_answers:a.editData.standard_answer,difficulty:a.editData.difficult,item_banks_group_id:a.editData.item_banks_group_id,hack:p()(p()({},a.editData),{},{sub_discipline_id:y,tag_discipline_ids:null===(v=a.editData)||void 0===v?void 0:v.tag_discipline_ids}),hack_codes:p()(p()({},a.editData),{},{code:re.Base64.decode((null===(x=a.editData)||void 0===x?void 0:x.code)||"")}),hack_sets:p()({},null===(g=a.editData)||void 0===g||null===(g=g.hack_sets)||void 0===g?void 0:g[0])});We(_),r&&en(r).then((function(e){}))}}else{var k=p()(p()({},null==a?void 0:a.editData),{},{item_type:ae(l),choices:le(o),course:[null==n?void 0:n.id,null==t?void 0:t.id],knowledge:null==i?void 0:i.map((function(e){return e.id})),sub_item_banks:f.map((function(e){return p()(p()({},e),{},{choices:le(e.choices)})}))});We(k),ze(ae(l)),null!=t&&t.id&&en(null==t?void 0:t.id).then((function(e){var n,t=null==e?void 0:e.map((function(e){return e.id}));null!=t&&t.includes(null==i||null===(n=i[0])||void 0===n?void 0:n.id)||xe((function(e){return[].concat(c()(e),c()(i))}))}))}}else We({item_type:"SELECT",choices:Array.from({length:4},(function(){return{choice_text:"",is_answer:0}})),difficulty:2,item_banks_group_id:[Number(ce.get("group_id"))||0]})}),[a.editData,null==a?void 0:a.disciplinesData]),console.log("---",ve,De);var Xe=function(e){e.preventDefault(),e.returnValue=""},Je=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;switch(ue.resetFields(),ue.setFieldsValue({item_type:e,item_banks_group_id:n}),ze(e),e){case"SELECT":ue.setFieldsValue({choices:Array.from({length:4},(function(){return{choice_text:"",is_answer:0}}))});break;case"JUDGMENT":ue.setFieldsValue({choices:[{choice_text:"正确",is_answer:0},{choice_text:"错误",is_answer:0}]});break;case"COMPLETION":ue.setFieldsValue({standard_answers:[]});break;case"SUBJECTIVE":ue.setFieldsValue({answer_texts:[],use_keywords:!0});break;case"COMBINATION":case"PROGRAM":break;case"BPROGRAM":ue.setFieldsValue({hack:{time_limit:3,allow_student_debug:!1}})}},Ye=function(e,n){var t;if(null!=e&&e.item_type&&("PROGRAM"===(null==e?void 0:e.item_type)&&(0,Y.xg)("/problems/newcreate"),Je(null==e?void 0:e.item_type,null==n?void 0:n.item_banks_group_id),Le(!1)),null!=e&&e.course){var r=u()(e.course,2),i=(r[0],r[1]);en(i),ue.setFieldsValue({knowledge:[]})}if(null!=e&&null!==(t=e.hack)&&void 0!==t&&t.sub_discipline_id){var a=u()(e.hack.sub_discipline_id,2),l=(a[0],a[1]);en(l),ue.setFieldsValue({hack:{tag_discipline_ids:[]}})}},Qe=function(){var e=l()(i()().mark((function e(){var n,t,r,a,l,s,c,d,f,h,g,b,j,y,_,k,w,Z,C,N,E;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("COMPLETION"==(null==(n=ue.getFieldsValue())?void 0:n.item_type)&&null==n.is_ordered&&(n.is_ordered=!0),r=(t=n||{}).course,a=void 0===r?[]:r,l=t.item_type,s=t.item_banks_group_id,c=t.knowledge,d=void 0===c?[]:c,f=t.choices,h=u()(a,2),g=h[0],b=h[1],1!==ye){e.next=37;break}if("PROGRAM"!==l){e.next=8;break}return(0,Y.xg)("/problems/newcreate"),e.abrupt("return");case 8:if("BPROGRAM"!==l){e.next=22;break}if(y=p()(p()({},n),{},{hack:p()(p()({},null==n?void 0:n.hack),{},{sub_discipline_id:null==n||null===(j=n.hack)||void 0===j||null===(j=j.sub_discipline_id)||void 0===j?void 0:j[1],difficult:n.difficulty,item_banks_group_ids:n.item_banks_group_id}),hack_codes:p()(p()({},n.hack_codes),{},{code:re.Base64.encode(n.hack_codes.code)}),hack_sets:[p()({},n.hack_sets)],update_hack_sets:[p()({},n.hack_sets)],is_blank:!0}),!Ge&&!sessionStorage.projectFill){e.next=17;break}return e.next=13,(0,ee.ZP)("/api/problems/".concat(ge.current||sessionStorage.projectFill,".json"),{method:"put",body:p()({},y)});case 13:0===e.sent.status&&m.history.replace("/problemset?group_id=".concat(n.hack.item_banks_group_id)),e.next=21;break;case 17:return e.next=19,(0,ee.ZP)("/api/problems.json",{method:"post",body:p()({},y)});case 19:0===e.sent.status&&v.Z.confirm({title:"提示",centered:!0,icon:null,content:"试题新增成功",okText:"继续新增",cancelText:"返回列表",onOk:function(){Je(He,s)},onCancel:function(){m.history.replace("/problemset?group_id=".concat(s))}});case 21:return e.abrupt("return");case 22:if("SELECT"===l&&(l=f.filter((function(e){return 1===e.is_answer})).length>1?"MULTIPLE":"SINGLE"),"COMBINATION"===l&&(_=(n||{}).sub_item_banks,n.sub_item_banks=null==_?void 0:_.map((function(e){return p()(p()({},e),{},{item_type:"SINGLE"})}))),k=p()(p()({},n),{},{discipline_id:g,sub_discipline_id:b,item_banks_group_ids:s,tag_discipline_ids:d,item_type:l}),!Ge){e.next=31;break}return e.next=28,o({type:"problemset/editProblemset",payload:p()(p()({},k),{},{id:ge.current})});case 28:w=e.sent,e.next=34;break;case 31:return e.next=33,o({type:"problemset/addProblemset",payload:k});case 33:w=e.sent;case 34:0===w.status&&(Ge?m.history.replace("/problemset?group_id=".concat(s)):v.Z.confirm({title:"提示",centered:!0,icon:null,content:"试题新增成功",okText:"继续新增",cancelText:"返回列表",onOk:function(){Je(He,s)},onCancel:function(){m.history.replace("/problemset?group_id=".concat(s))}})),e.next=57;break;case 37:if(!((null==Ze?void 0:Ze.length)<=0)){e.next=40;break}return x.ZP.info("请上传试题文件"),e.abrupt("return");case 40:return Te(!0),(Z=new FormData).append("file",Ze[0]),Z.append("sub_discipline_id",b),e.next=46,(0,ee.ZP)("/api/item_banks/file_import.json",{method:"post",body:Z},!0);case 46:if(C=e.sent,Te(!1),0!==(null==C?void 0:C.status)){e.next=57;break}if(!((null==C||null===(N=C.fail)||void 0===N?void 0:N.length)>0)){e.next=53;break}return Se(null==C?void 0:C.fail),x.ZP.error("上传失败题数为"+(null==C||null===(E=C.fail)||void 0===E?void 0:E.length)+",可在底部试题列表查看错误原因。"),e.abrupt("return");case 53:ue.setFieldsValue({course:[]}),Ce([]),Se([]),x.ZP.info("上传成功");case 57:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$e=function(){var e=l()(i()().mark((function e(n){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.errorFields[0].name.includes("standard_answers")?x.ZP.error("填空项答案不能为空"):x.ZP.error(n.errorFields[0].errors[0]),ue.scrollToField(null==n||null===(t=n.errorFields)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.name,{behavior:"smooth",block:"center"});case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),en=function(){var e=l()(i()().mark((function e(n){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o({type:"exercise/getTagDiscipline",payload:{sub_discipline_id:n}});case 2:return t=e.sent,xe(t.tag_disciplines),e.abrupt("return",null==t?void 0:t.tag_disciplines);case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,ie.jsx)("div",{className:C,children:(0,ie.jsxs)("section",{className:N,children:[(0,ie.jsxs)(g.Z,{className:"mb20",separator:">",children:[(0,ie.jsx)(g.Z.Item,{href:"/problemset",children:"试题库"}),(0,ie.jsxs)(g.Z.Item,{children:[Ge?"编辑":"新增","试题"]})]}),(0,ie.jsxs)("div",{className:E,children:[(0,ie.jsx)(b.ZP.Group,{className:I,optionType:"button",options:[{label:"单个添加",value:1},{label:"批量导入",value:2}],onChange:function(e){_e(e.target.value),ue.setFieldsValue({course:[]}),Ce([]),Se([])},value:ye}),1===ye&&De&&(0,ie.jsxs)(h.Z,{form:ue,className:S,layout:"horizontal",colon:!1,onValuesChange:Ye,onFinish:Qe,onFinishFailed:$e,initialValues:De,children:[(0,ie.jsx)(h.Z.Item,{label:"试题类型",name:"item_type",rules:[{required:!0,message:"请选择题型"}],children:(0,ie.jsx)(b.ZP.Group,{disabled:Ge,optionType:"button",className:P,options:[{label:"选择题",value:"SELECT"},{label:"判断题",value:"JUDGMENT"},{label:"填空题",value:"COMPLETION"},{label:"简答题",value:"SUBJECTIVE"},{label:"编程题",value:"PROGRAM"},{label:"组合题",value:"COMBINATION"},{label:"程序填空题",value:"BPROGRAM"}]})}),(0,ie.jsx)("div",{className:K,children:(0,ie.jsx)(se,{currentItemType:He,form:ue})}),"PROGRAM"!==He&&(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)(h.Z.Item,{label:"方向&课程",className:"".concat(B," mb30"),labelCol:{span:24},style:{marginTop:"PROGRAM"===He?0:30},name:"BPROGRAM"===He?["hack","sub_discipline_id"]:"course",rules:[{required:!0,message:"请选择课程"}],children:(0,ie.jsx)(j.Z,{className:L,popupClassName:G,dropdownMenuColumnStyle:{padding:"8px 12px",fontSize:14},showArrow:!0,placeholder:"请选择方向&课程",allowClear:!1,options:a.courseOptions})}),(0,ie.jsx)("div",{className:X,children:(0,ie.jsxs)("div",{onClick:function(){return Le(!Be)},children:["更多设置",Be?(0,ie.jsx)("i",{className:"iconfont icon-xialajiantou1"}):(0,ie.jsx)("i",{className:"iconfont icon-xialajiantoubeifen"})]})}),(0,ie.jsxs)("div",{style:{display:Be?"block":"none"},children:[(0,ie.jsx)(h.Z.Item,{label:"知识点",name:"BPROGRAM"===He?["hack","tag_discipline_ids"]:"knowledge",labelCol:{flex:"62px"},labelAlign:"left",className:"".concat(M," mb30"),children:(0,ie.jsx)(Q.N,{selectvalues:Ke,subId:(null===(t=ue.getFieldsValue().course)||void 0===t?void 0:t[1])||(null===(r=ue.getFieldsValue())||void 0===r||null===(r=r.hack)||void 0===r||null===(r=r.sub_discipline_id)||void 0===r?void 0:r[1]),knowledgeOptions:ve,onAddKnowledgeFinish:function(e){xe([].concat(c()(ve),[p()({},e)]))}})}),(0,ie.jsx)(h.Z.Item,{labelCol:{flex:"62px"},labelAlign:"left",name:"difficulty",label:"难度",className:"".concat(A," mb30"),rules:[{required:!0,message:"请选择难度"}],children:(0,ie.jsxs)(b.ZP.Group,{optionType:"button",className:O,children:[(0,ie.jsx)(b.ZP.Button,{value:1,className:T,children:"简单"}),(0,ie.jsx)(b.ZP.Button,{value:2,className:R,children:"适中"}),(0,ie.jsx)(b.ZP.Button,{value:3,className:F,children:"困难"})]})}),(0,ie.jsx)(h.Z.Item,{label:"放入文件夹目录",rules:[{required:!0,message:"请选择文件夹"}],name:"item_banks_group_id",labelCol:{span:24},wrapperCol:{span:24},children:(0,ie.jsx)(ne.Z,{scrollId:"item_banks_group_id"})})]})]})]}),2===ye&&(0,ie.jsxs)("div",{children:[(0,ie.jsxs)(h.Z,{form:ue,className:S,layout:"vertical",onValuesChange:Ye,onFinish:Qe,children:[(0,ie.jsx)(h.Z.Item,{className:B,label:"方向&课程:",name:"course",rules:[{required:!0,message:"请选择课程"}],children:(0,ie.jsx)(j.Z,{className:L,popupClassName:G,dropdownMenuColumnStyle:{padding:"8px 12px",fontSize:14},placeholder:"请选择方向&课程",showArrow:!0,allowClear:!1,options:a.courseOptions,style:{width:490}})}),(0,ie.jsxs)("div",{className:"mb30",children:[(0,ie.jsxs)("span",{className:V,children:["根据模板要求编辑需要上传的试题",(0,ie.jsx)(y.Z,{title:(0,ie.jsxs)("div",{children:[(0,ie.jsx)("div",{children:"提示:"}),(0,ie.jsx)("div",{children:"1、目前仅支持Excel格式模板"}),(0,ie.jsx)("div",{children:"2、不支持组合题和实训题导入"}),(0,ie.jsx)("div",{children:"3、每次最多导入300题"}),(0,ie.jsx)("div",{children:"4、填空题导入最多支持5个填空项。"})]}),children:(0,ie.jsx)($.Z,{className:D})})]}),(0,ie.jsxs)("a",{className:"".concat(W," ml30"),href:Z.Z.API_SERVER+"/api/item_banks/down_template",download:!0,children:["下载试题模版",(0,ie.jsx)("i",{className:"iconfont icon-xiazai4 ml10",style:{fontSize:14}})]})]}),(0,ie.jsx)(_.Z,{onRemove:function(){Ce([])},beforeUpload:function(e){if(console.log(e),(null==e?void 0:e.size)>52428800)return x.ZP.info("文件超过50M不符合上传要求"),!1;var n=[];return n.push(e),Ce([].concat(n)),!1},fileList:Ze,accept:".xls,.xlsx",showUploadList:{removeIcon:(0,ie.jsx)("i",{className:"iconfont icon-shanchu12",style:{color:"#F65160"}})},children:(0,ie.jsxs)("div",{className:q,children:[(0,ie.jsx)("i",{className:"iconfont icon-shangchuan3",style:{fontSize:14}}),"点击上传"]})})]}),(0,ie.jsx)("br",{}),(null==Ie?void 0:Ie.length)>0&&(0,ie.jsx)("span",{style:{fontSize:"18px",display:"flex",width:"100%",justifyContent:"center"},children:"错误列表"}),(null==Ie?void 0:Ie.length)>0&&(0,ie.jsx)(k.Z,{style:{marginTop:"10px"},dataSource:Ie,columns:[{title:"题目名称",dataIndex:"name",key:"name"},{title:"错误原因",dataIndex:"message",key:"message"}]})]})]}),(0,ie.jsx)("div",{className:U,children:(0,ie.jsxs)("div",{className:H,children:[(0,ie.jsx)(w.ZP,{size:"middle",className:"".concat(z," mr20"),onClick:function(){return m.history.push("/problemset")},children:"取消"}),(0,ie.jsx)(w.ZP,{size:"middle",type:"primary",className:"".concat(z," mr20"),onClick:function(){return ue.submit()},loading:s["problemset/editProblemset"]||s["problemset/addProblemset"]||Oe,children:"PROGRAM"===He&&1===ye?"立即创建":"保存题目"})]})})]})})}))},98887: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"}},66104:function(e,n,t){t.d(n,{Z:function(){return S}});var r=t(92310),i=t.n(r),a=t(75440),l=t(47413),s=t(59301),c=t(92343),o=t(36355),u=t(78386),d=t(91857);const p=e=>{let{children:n}=e;const{getPrefixCls:t}=s.useContext(o.E_),r=t("breadcrumb");return s.createElement("li",{className:`${r}-separator`,"aria-hidden":"true"},""===n?n:n||"/")};p.__ANT_BREADCRUMB_SEPARATOR=!0;var f=p,m=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t};function h(e,n,t,r){if(null==t)return null;const{className:a,onClick:c}=n,o=m(n,["className","onClick"]),u=Object.assign(Object.assign({},(0,l.Z)(o,{data:!0,aria:!0})),{onClick:c});return void 0!==r?s.createElement("a",Object.assign({},u,{className:i()(`${e}-link`,a),href:r}),t):s.createElement("span",Object.assign({},u,{className:i()(`${e}-link`,a)}),t)}function v(e,n){return(t,r,i,a,l)=>{if(n)return n(t,r,i,a);const s=function(e,n){if(void 0===e.title||null===e.title)return null;const t=Object.keys(n).join("|");return"object"==typeof e.title?e.title:String(e.title).replace(new RegExp(`:(${t})`,"g"),((e,t)=>n[t]||e))}(t,r);return h(e,t,s,l)}}var x=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t};const g=e=>{const{prefixCls:n,separator:t="/",children:r,menu:i,overlay:a,dropdownProps:l,href:c}=e;const o=(e=>{if(i||a){const t=Object.assign({},l);if(i){const e=i||{},{items:n}=e,r=x(e,["items"]);t.menu=Object.assign(Object.assign({},r),{items:null==n?void 0:n.map(((e,n)=>{var{key:t,title:r,label:i,path:a}=e,l=x(e,["key","title","label","path"]);let o=null!=i?i:r;return a&&(o=s.createElement("a",{href:`${c}${a}`},o)),Object.assign(Object.assign({},l),{key:null!=t?t:n,label:o})}))})}else a&&(t.overlay=a);return s.createElement(d.Z,Object.assign({placement:"bottom"},t),s.createElement("span",{className:`${n}-overlay-link`},e,s.createElement(u.Z,null)))}return e})(r);return null!=o?s.createElement(s.Fragment,null,s.createElement("li",null,o),t&&s.createElement(f,null,t)):null},b=e=>{const{prefixCls:n,children:t,href:r}=e,i=x(e,["prefixCls","children","href"]),{getPrefixCls:a}=s.useContext(o.E_),l=a("breadcrumb",n);return s.createElement(g,Object.assign({},i,{prefixCls:l}),h(l,i,t,r))};b.__ANT_BREADCRUMB_ITEM=!0;var j=b,y=t(17313),_=t(83116),k=t(37613);const w=e=>{const{componentCls:n,iconCls:t}=e;return{[n]:Object.assign(Object.assign({},(0,y.Wf)(e)),{color:e.itemColor,fontSize:e.fontSize,[t]:{fontSize:e.iconFontSize},ol:{display:"flex",flexWrap:"wrap",margin:0,padding:0,listStyle:"none"},a:Object.assign({color:e.linkColor,transition:`color ${e.motionDurationMid}`,padding:`0 ${e.paddingXXS}px`,borderRadius:e.borderRadiusSM,height:e.lineHeight*e.fontSize,display:"inline-block",marginInline:-e.marginXXS,"&:hover":{color:e.linkHoverColor,backgroundColor:e.colorBgTextHover}},(0,y.Qy)(e)),"li:last-child":{color:e.lastItemColor},[`${n}-separator`]:{marginInline:e.separatorMargin,color:e.separatorColor},[`${n}-link`]:{[`\n > ${t} + span,\n > ${t} + a\n `]:{marginInlineStart:e.marginXXS}},[`${n}-overlay-link`]:{borderRadius:e.borderRadiusSM,height:e.lineHeight*e.fontSize,display:"inline-block",padding:`0 ${e.paddingXXS}px`,marginInline:-e.marginXXS,[`> ${t}`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSizeIcon},"&:hover":{color:e.linkHoverColor,backgroundColor:e.colorBgTextHover,a:{color:e.linkHoverColor}},a:{"&:hover":{backgroundColor:"transparent"}}},[`&${e.componentCls}-rtl`]:{direction:"rtl"}})}};var Z=(0,_.Z)("Breadcrumb",(e=>{const n=(0,k.TS)(e,{});return[w(n)]}),(e=>({itemColor:e.colorTextDescription,lastItemColor:e.colorText,iconFontSize:e.fontSize,linkColor:e.colorTextDescription,linkHoverColor:e.colorText,separatorColor:e.colorTextDescription,separatorMargin:e.marginXS}))),C=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t};function N(e){const{breadcrumbName:n,children:t}=e,r=C(e,["breadcrumbName","children"]),i=Object.assign({title:n},r);return t&&(i.menu={items:t.map((e=>{var{breadcrumbName:n}=e,t=C(e,["breadcrumbName"]);return Object.assign(Object.assign({},t),{title:n})}))}),i}var E=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t};const I=e=>{const{prefixCls:n,separator:t="/",style:r,className:u,rootClassName:d,routes:p,items:m,children:h,itemRender:x,params:b={}}=e,j=E(e,["prefixCls","separator","style","className","rootClassName","routes","items","children","itemRender","params"]),{getPrefixCls:y,direction:_,breadcrumb:k}=s.useContext(o.E_);let w;const C=y("breadcrumb",n),[I,S]=Z(C),P=function(e,n){return(0,s.useMemo)((()=>e||(n?n.map(N):null)),[e,n])}(m,p);const A=v(C,x);if(P&&P.length>0){const e=[],n=m||p;w=P.map(((r,i)=>{const{path:a,key:c,type:o,menu:u,overlay:d,onClick:p,className:m,separator:h,dropdownProps:v}=r,x=((e,n)=>{if(void 0===n)return n;let t=(n||"").replace(/^\//,"");return Object.keys(e).forEach((n=>{t=t.replace(`:${n}`,e[n])})),t})(b,a);void 0!==x&&e.push(x);const j=null!=c?c:i;if("separator"===o)return s.createElement(f,{key:j},h);const y={},_=i===P.length-1;u?y.menu=u:d&&(y.overlay=d);let{href:k}=r;return e.length&&void 0!==x&&(k=`#/${e.join("/")}`),s.createElement(g,Object.assign({key:j},y,(0,l.Z)(r,{data:!0,aria:!0}),{className:m,dropdownProps:v,href:k,separator:_?"":t,onClick:p,prefixCls:C}),A(r,b,n,e,k))}))}else if(h){const e=(0,a.Z)(h).length;w=(0,a.Z)(h).map(((n,r)=>{if(!n)return n;const i=r===e-1;return(0,c.Tm)(n,{separator:i?"":t,key:r})}))}const O=i()(C,null==k?void 0:k.className,{[`${C}-rtl`]:"rtl"===_},u,d,S),T=Object.assign(Object.assign({},null==k?void 0:k.style),r);return I(s.createElement("nav",Object.assign({className:O,style:T},j),s.createElement("ol",null,w)))};I.Item=j,I.Separator=f;var S=I},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="}}]);