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/66390.async.js

1 line
26 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([[66390],{96403:function(e,n,t){function a(e){var n=!0;if(e.length>0){for(var t=0;t<e.length;t++)if(0==e[t].compile_success||!e[t].compile_success){n=!1;break}}else n=!1;return n}function c(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",t=[],a=0;a<e.length;a++){var c=e[a],i=n?"".concat(n,"/").concat(c.name):"".concat(c.name);t.push({title:c.name,isLeaf:"tree"!==c.type,key:i})}return t}function i(e,n,t){for(var a=0;a<e.length;a++){var c=e[a];if(c.key===n){c.children=t;break}c.children&&i(c.children,n,t)}return e}function o(e,n,t){var a;return function(){var c=this,i=arguments,o=function(){a=null,t||e.apply(c,i)},r=t&&!a;clearTimeout(a),a=setTimeout(o,n),r&&e.apply(c,i)}}t.d(n,{Ax:function(){return i},Ds:function(){return o},KI:function(){return r},SI:function(){return c},f1:function(){return a}});var r=t(59758).Z.API_SERVER},97501:function(e,n,t){t.d(n,{h:function(){return g}});var a=t(42122),c=t.n(a),i=t(27424),o=t.n(i),r=t(67294),l=t(96101),s=t(91773),u=t(71577),d=t(4631),f=t.n(d),p=(t(71749),t(30483),t(85893)),m=l.Z.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 g(e){var n=e.value,t=e.onChange,a=e.mode,i=e.options,l=void 0===i?{}:i,s=(0,r.useRef)(),u=(0,r.useState)(),d=o()(u,2),m=d[0],h=d[1];return(0,r.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,r.useEffect)((function(){m&&m.setOption("mode",a)}),[m,a]),(0,r.useEffect)((function(){m&&(n===m.getValue()&&""!==n||setTimeout((function(){m.setValue(n||"")}),300))}),[m,n]),(0,r.useEffect)((function(){if(s.current&&!m){var e=f().fromTextArea(s.current,c()({mode:a,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},l));h(e)}}),[s.current,m]),(0,p.jsx)("div",{className:"my-codemirror-container",children:(0,p.jsx)("textarea",{ref:s})})}n.Z=function(e){var n=e.callback,t=e.onCancel,a=(0,r.useState)("python"),i=o()(a,2),d=i[0],f=i[1];return(0,p.jsxs)(s.Z,c()(c()({},h),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){n(e)},children:[(0,p.jsx)(s.Z.Item,{label:"代码语言",name:"language",children:(0,p.jsx)(l.Z,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){f(v[e][1])},children:Object.keys(v).map((function(e){return(0,p.jsx)(m,{value:e,children:v[e][0]},e)}))})}),(0,p.jsx)(s.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,p.jsx)(g,{mode:d})}),(0,p.jsxs)("div",{className:"flex-container flex-end",children:[(0,p.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,p.jsx)(u.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))}},55373:function(e,n,t){t.d(n,{Z:function(){return ue}});var a=t(74704),c=t.n(a),i=t(17061),o=t.n(i),r=t(17156),l=t.n(r),s=t(27424),u=t.n(s),d=t(38416),f=t.n(d),p=t(67294),m=t(4631),h=t.n(m),v=t(91033),g=(t(71749),t(57341),t(82801),t(88386),t(49047),t(80785),t(12768)),x=t(85893),j=function(e){var n=e.value,t=void 0===n?"":n,a=(e.className,e.showTextOnly,e.showLines,e.style,(0,p.useMemo)((function(){return""}),[t]));return(0,x.jsx)(x.Fragment,{children:(0,x.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})})},y=t(42122),b=t.n(y),S=[{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 w(e){var n=e.onActionCallback,t=e.title,a=e.icon,c=e.actionName,i=e.className,o=void 0===i?"":i,r=e.children;return(0,x.jsxs)("a",{title:t,className:o,onClick:function(){n(c)},children:[(0,x.jsx)("i",{className:"md-iconfont ".concat(a)}),r]})}var k=function(e){var n=e.watch,t=e.showNullButton,a=e.showNullProgramButton,c=e.onActionCallback,i=e.fullScreen,o=e.insertTemp,r=e.hidetoolBar,l=[].concat(S,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,x.jsxs)("ul",{className:"markdown-toolbar-container",children:[!r&&l.map((function(e,n){return(0,x.jsx)("li",{children:e.actionName?(0,x.jsx)(w,b()(b()({},e),{},{onActionCallback:c})):(0,x.jsx)("span",{className:"v-line"})},n)})),t?(0,x.jsx)("li",{children:(0,x.jsx)(w,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:c,children:(0,x.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,a?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("li",{children:(0,x.jsx)(w,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:c,children:(0,x.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,x.jsx)("li",{children:(0,x.jsx)(w,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:c,children:(0,x.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,o&&(0,x.jsx)("li",{children:(0,x.jsx)(w,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(o),onActionCallback:c,children:(0,x.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,x.jsx)("li",{className:"btn-full-screen",children:(0,x.jsx)(w,{icon:"".concat(i?"icon-shrink":"icon-enlarge"),title:i?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:c})})]})},C=t(12264),N=t(91773),E=t(11486),Z=t(71577),P={labelCol:{span:4},wrapperCol:{span:20}},R=function(e){var n=e.callback,t=e.onCancel;return(0,x.jsxs)(N.Z,b()(b()({},P),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,x.jsx)(N.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,x.jsx)(E.Z,{})}),(0,x.jsx)(N.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,x.jsx)(E.Z,{})}),(0,x.jsxs)("div",{className:"flex-container flex-end",children:[(0,x.jsx)(Z.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,x.jsx)(Z.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},I=t(97501),_=t(2453),A=t(96403),V=N.Z.useForm,T={width:280,marginRight:10},O={labelCol:{span:5},wrapperCol:{span:19}},L=function(e){var n=e.callback,t=e.onCancel,a=V(),c=u()(a,1)[0],i=(0,p.useRef)();function o(e,n){-1!==e.status?c.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):_.ZP.error(e.message)}return(0,x.jsxs)(N.Z,b()(b()({form:c},O),{},{className:"upload-image-panel",onFinish:function(e){n(b()(b()({},e),{},{name:i.current}))},style:{width:470,overflow:"hidden"},children:[(0,x.jsx)(N.Z.Item,{label:"图片地址",required:!0,children:(0,x.jsxs)("div",{className:"flex-container",children:[(0,x.jsx)(N.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,x.jsx)(E.Z,{style:T})}),(0,x.jsx)(F,{onFileChange:function(e){var n=e.target.files[0];i.current=n.name,B(n,o)}})]})}),(0,x.jsx)(N.Z.Item,{label:"图片描述",name:"alt",children:(0,x.jsx)(E.Z,{style:{width:264}})}),(0,x.jsxs)(N.Z.Item,{style:{textAlign:"right"},children:[(0,x.jsx)(Z.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,x.jsx)(Z.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function F(e){var n=e.onFileChange;return(0,x.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,x.jsx)("input",{type:"file",onChange:n})]})}function B(e,n){if(!e)throw new String("没有文件");var t=new FormData;t.append("editormd-image-file",e),t.append("file_param_name","editormd-image-file"),t.append("byxhr","true");var a=new window.XMLHttpRequest;a.withCredentials=!0,a.addEventListener("load",(function(t){n(JSON.parse(t.target.responseText),e)}),!1),a.addEventListener("error",(function(e){console.error(e)}),!1),a.open("POST","".concat(A.KI,"/api/attachments.json")),a.send(t)}var D,M,q=t(78045),H=t(4082),Y=q.ZP.Group,$={margin:"0 8px"},z=function(e){var n=e.callback,t=e.onCancel;return(0,x.jsxs)(N.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,x.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,x.jsx)("span",{style:$,children:"单元格数:"}),(0,x.jsx)("span",{style:$,children:"行数"}),(0,x.jsx)(N.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,x.jsx)(H.Z,{})}),(0,x.jsx)("span",{style:$,children:"列数"}),(0,x.jsx)(N.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,x.jsx)(H.Z,{})})]}),(0,x.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,x.jsx)("span",{style:$,children:"对齐方式:"}),(0,x.jsx)(N.Z.Item,{name:"align",children:(0,x.jsxs)(Y,{children:[(0,x.jsx)(q.ZP,{value:"default",children:(0,x.jsx)("i",{className:"fa fa-align-justify"})}),(0,x.jsx)(q.ZP,{value:"left",children:(0,x.jsx)("i",{className:"fa fa-align-left"})}),(0,x.jsx)(q.ZP,{value:"center",children:(0,x.jsx)("i",{className:"fa fa-align-center"})}),(0,x.jsx)(q.ZP,{value:"right",children:(0,x.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,x.jsxs)("div",{className:"flex-container flex-end",children:[(0,x.jsx)(Z.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,x.jsx)(Z.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},J=t(59758),K=t(84519),W=t(25934),G=t(14446),U="link",X="upload-image",Q="code-block",ee="add-table",ne="------------",te={default:ne,left:":".concat(ne),center:":".concat(ne,":"),right:"".concat(ne,":")},ae=t(61891);var ce="@▁▁@";function ie(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var oe=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],le=(D={},f()(D,oe+"-B","bold"),f()(D,oe+"-I","italic"),D),se=(M={},f()(M,U,"添加链接"),f()(M,Q,"添加代码块"),f()(M,X,"添加文件"),f()(M,ee,"添加表格"),M),ue=function(e){var n=e.defaultValue,t=void 0===n?"":n,a=e.onChange,i=e.width,r=void 0===i?"100%":i,s=e.height,d=void 0===s?400:s,m=e.miniToolbar,y=void 0!==m&&m,b=e.isFocus,S=void 0!==b&&b,w=e.watch,N=e.insertTemp,E=e.mode,Z=void 0===E?"markdown":E,P=e.id,A=void 0===P?"markdown-editor-id":P,V=e.showResizeBar,T=void 0!==V&&V,O=e.noStorage,F=void 0!==O&&O,D=e.showNullButton,M=void 0!==D&&D,q=e.showNullProgramButton,H=void 0!==q&&q,Y=e.hidetoolBar,$=void 0!==Y&&Y,ne=e.fullScreen,oe=void 0!==ne&&ne,ue=e.onBlur,de=e.onCMBeforeChange,fe=e.onFullScreen,pe=e.className,me=void 0===pe?"":pe,he=e.disablePaste,ve=void 0!==he&&he,ge=e.disabled,xe=void 0!==ge&&ge,je=e.disabledFill,ye=void 0!==je&&je,be=e.placeholder,Se=void 0===be?"":be,we=e.values,ke=void 0===we?"":we,Ce=(0,p.useState)(null),Ne=u()(Ce,2),Ee=Ne[0],Ze=Ne[1],Pe=(0,p.useState)(t),Re=u()(Pe,2),Ie=Re[0],_e=Re[1],Ae=(0,p.useState)(w),Ve=u()(Ae,2),Te=Ve[0],Oe=Ve[1],Le=(0,p.useState)(oe),Fe=u()(Le,2),Be=Fe[0],De=Fe[1],Me=(0,p.useState)(""),qe=u()(Me,2),He=qe[0],Ye=qe[1],$e=(0,p.useState)(0),ze=u()($e,2),Je=ze[0],Ke=ze[1],We=(0,p.useState)(d),Ge=u()(We,2),Ue=Ge[0],Xe=Ge[1],Qe=(0,p.useState)(!1),en=u()(Qe,2),nn=(en[0],en[1]),tn=(0,p.useRef)((0,W.Z)()),an=(0,p.useRef)(!1),cn=(0,p.useRef)(),on=(0,p.useRef)(),rn=(0,p.useRef)(),ln=(0,p.useRef)(),sn=(0,p.useRef)(),un=function(){var e=l()(o()().mark((function e(){var n,t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,K.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:",Ee,on),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?Ee.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):e.content_type.indexOf("video")>-1?Ee.replaceSelection('<video width="100%" controls src="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Ee.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):Ee.replaceSelection("[".concat(e.name,"](").concat(J.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,p.useEffect)((function(){var e=window.scrollY||window.pageYOffset;_e(ke),null==Ee||Ee.setValue(ke),window.scrollTo(0,e)}),[ke]),(0,p.useEffect)((function(){null==fe||fe(Be)}),[Be]),(0,p.useEffect)((function(){if(on.current){var e=function(e,t){if(!ve){var a=t.clipboardData;if(a){var c=a.types.toString(),i=a.items;if("Files"===c||a.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==Z)return;try{var o,r=i[1];"file"===(null===(o=i[0])||void 0===o?void 0:o.kind)&&(r=i[0]);var l=r.getAsFile(),s=l.name.split(".").pop();B(l,(function(e){var t,a,c;e.id?(null==l||null===(t=l.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==l||null===(a=l.type)||void 0===a?void 0:a.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==l||null===(c=l.type)||void 0===c?void 0:c.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(l.type,'&disposition=inline" target="_blank">').concat(l.name,"</a>")):re.includes(s)?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(l.name,"</a>")):n.replaceSelection("[".concat(l.name,"](").concat(J.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){_.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=h().fromTextArea(on.current,{mode:Z,lineNumbers:!y,lineWrapping:!0,value:t,autoCloseTags:!H,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",Se):n.setOption("placeholder",null))})),n.on("keydown",(function(e,n){if(8===n.keyCode){var t=function(e,n){var t=e.getDoc(),a=t.getCursor(),c=t.getLine(a.line),i=c.charAt(a.ch-1),o=c.lastIndexOf("@▁@",a.ch),r=c.lastIndexOf("@▁▁@",a.ch),l=o>r?o:r,s=o>r?3:4;if(-1===ce.indexOf(i))return null;if(console.log("change1:",n,e,c,a,l,o,r,i),l>=0&&a.ch-l<5){var u=l+s;return t.replaceRange("",{line:a.line,ch:l},{line:a.line,ch:u}),{line:a.line,ch:u}}return null}(e);t&&n.preventDefault()}})),S&&n.focus(),n.on("paste",e),n.on("dragleave",(function(e,n){rn.current.classList.remove("mouse-hover-md")})),n.on("dragover",(function(e,n){rn.current.classList.add("mouse-hover-md")})),n.on("drop",(function(e,t){var a;if(rn.current.classList.add("mouse-hover-md"),(a=t.dataTransfer.files).length>0){t.preventDefault(),t.stopPropagation();for(var c=function(){var e=a[i],t=e.name.split(".").pop();B(e,(function(a){var c,i,o;a.id?(null==e||null===(c=e.type)||void 0===c?void 0:c.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(a.id,"?type=").concat(a.content_type,")")):(null==e||null===(i=e.type)||void 0===i?void 0:i.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(a.id,'"></video>')):(null==e||null===(o=e.type)||void 0===o?void 0:o.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):re.includes(t)?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(a.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(J.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(a.content_type,")")):401===(null==a?void 0:a.status)&&(document.location.href="/user/login")}))},i=0;i<a.length;i++)c()}})),xe&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ze(n),function(){n.off("paste",e)}}}),[]);var dn=(0,p.useCallback)((function(){rn.current}),[Ue,rn,Be]);(0,p.useEffect)((function(){if(Ee){var e=function(){var e=new v.Z((function(e){var n,t=c()(e);try{for(t.s();!(n=t.n()).done;){var a=n.value;(a.target.offsetHeight>0||a.target.offsetWidth>0)&&(dn(),Ee.setSize("100%","100%"),Ee.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(on.current.parentElement),e}();return function(){var n,t;null!==(n=on.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=on.current)||void 0===t?void 0:t.parentElement)}}}),[Ee,dn]),(0,p.useEffect)((function(){if(Ee){for(var e=[],n=function(){var n=u()(a[t],2),c=n[0],i=n[1],o=f()({},c,(function(){fn(i)}));e.push(o),Ee.addKeyMap(o)},t=0,a=Object.entries(le);t<a.length;t++)n();return cn.current=setInterval((function(){an.current&&un()}),4e3),function(){clearInterval(cn.current);for(var n=0,t=e;n<t.length;n++){var a=t[n];Ee.removeKeyMap(a)}}}}),[Ee]),(0,p.useEffect)((function(){oe!==Be&&De(oe)}),[oe]),(0,ae.Z)((function(){if(!F&&Je>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(A);e>=Je+1e4&&(!n||n!==Ie)&&(window.sessionStorage.setItem(A,Ie),nn(!0))}}),1e4),(0,p.useEffect)((function(){Oe(w)}),[Ee,w]),(0,p.useEffect)((function(){Ee&&S&&Ee.focus()}),[Ee,S]),(0,p.useEffect)((function(){if(Te&&Ee){var e=function(e){var n=e.target;if(sn.current){var t=n.scrollTop/n.scrollHeight;sn.current.scrollTop=sn.current.scrollHeight*t}},n=Ee.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Ee,Te]),(0,p.useEffect)((function(){if(Ee&&de){var e=function(e,n){de(e,n)};return Ee.on("beforeChange",e),function(){Ee.off("beforeChange",e)}}}),[Ee,de]),(0,p.useEffect)((function(){if(Ee&&ue){var e=function(){ue(Ee.getValue())};return Ee.on("blur",e),function(){Ee.off("blur",e)}}}),[Ee,ue]),(0,p.useEffect)((function(){if(Ee){var e=function(e,n){var t=e.getValue();_e(t),Ke((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),a&&(H?a(t,gn(t)):a(t))};return Ee.on("change",e),function(){Ee.off("change",e)}}}),[Ee,a]),(0,p.useEffect)((function(){if(Ee)if(null==t)Ee.setValue(""),_e("");else{var e=window.scrollY||window.pageYOffset;t!==Ee.getValue()&&(Ee.setValue(t),_e(t),Ee.setCursor(xe?1:Ee.lineCount(),0),window.scrollTo(0,e))}}),[Ee,t]);var fn=(0,p.useCallback)((function(e){var n=Ee.getCursor(),t=Ee.getSelection(),a=t.split("\n");switch(e){case"bold":return Ee.replaceSelection("**"+t+"**"),""===t&&Ee.setCursor(n.line,n.ch+2),Ee.focus();case"italic":return Ee.replaceSelection("*"+t+"*"),""===t&&Ee.setCursor(n.line,n.ch+1),Ee.focus();case"code":return Ee.replaceSelection("`"+t+"`"),""===t&&Ee.setCursor(n.line,n.ch+1),Ee.focus();case"inline-latex":return Ee.replaceSelection("`$$"+t+"$$`"),""===t&&Ee.setCursor(n.line,n.ch+3),Ee.focus();case"latex":return Ee.replaceSelection("```latex\n"+t+"\n```"),Ee.setCursor(n.line+1,t.length+1),Ee.focus();case"line-break":return Ee.replaceSelection("<br/>\n"),Ee.focus();case"list-ul":return""===t?Ee.replaceSelection("- "+t):Ee.replaceSelection(a.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ee.focus();case"list-ol":return""===t?Ee.replaceSelection("1. "+t):Ee.replaceSelection(a.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),Ee.focus();case"add-null-ch":return""===t&&Ee.setCursor(n.line,n.ch),Ee.replaceSelection("▁"),Ee.focus();case"add-signal":return""===t&&Ee.setCursor(n.line,n.ch),Ee.replaceSelection("@▁@"),Ee.focus();case"add-multiple":return""===t&&Ee.setCursor(n.line,n.ch),Ee.replaceSelection(ce),Ee.focus();case"inster-template-1":return""===t&&Ee.setCursor(n.line,n.ch),Ee.replaceSelection("\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作"),Ee.focus();case"eraser":return Ee.setValue(""),Ee.focus();case"trigger-watch":return Oe(!Te),Ee.focus();case"trigger-full-screen":return De(!Be),Ee.focus();case U:return void Ye(U);case Q:return void Ye(Q);case X:return void Ye(X);case ee:return void Ye(ee);default:throw new Error}}),[Ee,Te,Be]),pn=(0,p.useCallback)((function(e){switch(Ye(""),He){case U:var n=e.title,t=e.link;return Ee.replaceSelection("[".concat(n,"](").concat(t,")")),Ee.focus();case Q:var a=e.language,c=e.content;return Ee.replaceSelection(["```"+a,c,"```"].join("\n")),Ee.focus();case X:var i=e.src,o=e.alt;return o?Ee.replaceSelection("![ ".concat(o," ]( ").concat(i,' "').concat(o,'" )')):Ee.replaceSelection("![,](".concat(i,")")),Ee.focus();case ee:for(var r=e.row,l=e.col,s=e.align,u="\n",d=0;d<r;d++){for(var f=[],p=[],m=0;m<l;m++)1===d&&p.push(te[s]),f.push(" ");1===d&&(u+="| ".concat(p.join(" | ")," |\n")),u+="| ".concat(f.join(1===l?"":" | ")," |\n")}return Ee.replaceSelection(u+"\n"),Ee.focus();default:throw new Error}}),[Ee,He]),mn=(0,p.useMemo)((function(){switch(He){case U:return(0,x.jsx)(R,{callback:pn,onCancel:hn});case Q:return(0,x.jsx)(I.Z,{callback:pn,onCancel:hn});case X:return(0,x.jsx)(L,{callback:pn,onCancel:hn});case ee:return(0,x.jsx)(z,{callback:pn,onCancel:hn});default:return null}}),[He]);function hn(){Ye("")}(0,p.useEffect)((function(){if(ln.current){var e=function(e){c=!0,i=e.pageY},n=function(){c=!1},t=function(e){if(c){var n=e.pageY-i;n<0&&(n=0),n>300&&(n=300),Xe(d+n+"px")}},a=ln.current,c=!1,i=0;return a.addEventListener("mousedown",e),document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),function(){a.removeEventListener("mousedown",e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}}}),[Ee,ln]),(0,p.useEffect)((function(){Xe(d)}),[d]);var vn={width:ie(r),height:ie(Ue)},gn=((0,p.useMemo)((function(){if(Je){var e=new Date(Je),n=e.getHours(),t=e.getMinutes(),a=e.getSeconds();return t=t<10?"0"+t:t,a=a<10?"0"+a:a,"".concat(n=n<10?"0"+n:n,":").concat(t,":").concat(a)}return 0}),[Je]),function(e){var n=[];if(H){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,a){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,x.jsxs)(p.Fragment,{children:[(0,x.jsx)("div",{className:"markdown-editor-wrapper",ref:rn,children:(0,x.jsxs)("div",{className:"markdown-editor-container ".concat(me," ").concat(Te?"on-preview":""," ").concat(y?"mini":""," ").concat(Be?"full-screen":""),style:vn,children:[(0,x.jsx)(k,{insertTemp:N,watch:Te,fullScreen:Be,showNullButton:M,showNullProgramButton:H,onActionCallback:fn,hidetoolBar:$,uuid:tn.current,setOpenPhones:function(){an.current=!0}}),(0,x.jsxs)("div",{className:"markdown-editor-body",children:[(0,x.jsx)("div",{className:"codemirror-container",children:(0,x.jsx)("textarea",{ref:on,placeholder:Se})}),Te?(0,x.jsxs)("div",{ref:sn,className:"preview-container",children:["stex"===Z&&(0,x.jsx)(j,{value:Ie}),"stex"!==Z&&(0,x.jsx)(g.Z,{disabledFill:ye,showProgramFill:H,value:Ie})]}):null]})]})}),T?(0,x.jsx)("a",{ref:ln,className:"editor-resize"}):null,(0,x.jsx)(C.Z,{children:se[He]?(0,x.jsx)(G.Z,{centered:!0,title:se[He],open:!0,onCancel:hn,footer:null,className:"markdown-popup-form",children:mn}):null})]})}},12264:function(e,n,t){t.d(n,{Z:function(){return p}});var a=t(56690),c=t.n(a),i=t(89728),o=t.n(i),r=t(61655),l=t.n(r),s=t(26389),u=t.n(s),d=t(67294),f=t(73935),p=function(e){l()(t,e);var n=u()(t);function t(e){var a;c()(this,t),a=n.call(this,e);var i=window.document;return a.node=i.createElement("div"),i.body.appendChild(a.node),a}return o()(t,[{key:"render",value:function(){var e=this.props.children;return(0,f.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),t}(d.Component)},61891:function(e,n,t){t.d(n,{Z:function(){return c}});var a=t(67294);function c(e,n){var t=(0,a.useRef)();(0,a.useEffect)((function(){t.current=e})),(0,a.useEffect)((function(){if(null!==n){var e=setInterval((function(){t.current()}),n);return function(){return clearInterval(e)}}}),[n])}}}]);