(self.webpackChunk=self.webpackChunk||[]).push([[35729,94816],{94756:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__(31468).default;(function(){if("function"!=typeof window.GGBApplet){var isRenderGGBElementEnabled=!1,scriptLoadStarted=!1,html5AppletsToProcess=null,ggbHTML5LoadedCodebaseIsWebSimple=!1,ggbHTML5LoadedCodebaseVersion=null,ggbHTML5LoadedScript=null,GGBApplet=function(){"use strict";for(var e={},t="5.0",n={},i=null,o=!1,r=!1,a=null,l=!1,s=null,c=null,d=0;d4?parseFloat(e):5};function _(){try{return window.self!==window.top}catch(e){return!0}}function k(){return(!n.hasOwnProperty("screenshotGenerator")||!n.screenshotGenerator)&&Math.max(screen.width,screen.height)<800}e.setHTML5Codebase=function(e,t){c=e,Z(e,t)},e.setJavaCodebase=e.setJavaCodebaseVersion=e.isCompiledInstalled=e.setPreCompiledScriptPath=e.setPreCompiledResourcePath=function(){},e.setHTML5CodebaseVersion=function(e,t){var n=parseFloat(e);NaN!==n&&n<5?console.log("The GeoGebra HTML5 codebase version "+n+" is deprecated. Using version latest instead."):(s=e,O(e,t))},e.getHTML5CodebaseVersion=function(){return m},e.getParameters=function(){return n},e.setFontsCSSURL=function(e){y=e},e.setGiacJSURL=function(e){},e.setJNLPFile=function(e){e},e.setJNLPBaseDir=function(e){},e.inject=function(){function t(){return window.frameElement&&window.frameElement.getAttribute("data-singleton")}for(var i,o="auto",r=n.id,a=!1,s=0;s=5)return!0;var t=e.getAppletObject();return!(!t||"function"!=typeof t.recalculateEnvironments)&&(t.recalculateEnvironments(),!0)},e.startAnimation=function(){var t=e.getAppletObject();return!(!t||"function"!=typeof t.startAnimation)&&(t.startAnimation(),!0)},e.stopAnimation=function(){var t=e.getAppletObject();return!(!t||"function"!=typeof t.stopAnimation)&&(t.stopAnimation(),!0)},e.getAppletObject=function(){var e=void 0!==n.id?n.id:"ggbApplet";return window[e]},e.resize=function(){};var T=function(e){return e&&"false"!==e},C=function(t,n,i){x(m)<=4.2&&(i=!0);var o=!isRenderGGBElementEnabled&&!scriptLoadStarted;(!isRenderGGBElementEnabled&&!scriptLoadStarted||ggbHTML5LoadedCodebaseVersion!==m||ggbHTML5LoadedCodebaseIsWebSimple&&!w)&&(o=!0,isRenderGGBElementEnabled=!1,scriptLoadStarted=!1);var r=document.createElement("div");r.classList.add("appletParameters","notranslate");var a=n.width,l=n.height;if(n.disableAutoScale=void 0===n.disableAutoScale?GGBAppletUtils.isFlexibleWorksheetEditor():n.disableAutoScale,void 0!==n.width)if(x(m)<=4.4)T(n.showToolBar)&&(n.height-=7),T(n.showAlgebraInput)&&(n.height-=37),n.width<605&&T(n.showToolBar)&&(n.width=605,a=605);else{var d=100;(T(n.showToolBar)||T(n.showMenuBar))&&(n.hasOwnProperty("customToolBar")&&(n.customToolbar=n.customToolBar),d=T(n.showMenuBar)?245:155),a=5?(n.appletOnLoad=function(e){var n=t.querySelector(".ggb_preview");n&&n.parentNode.removeChild(n),window.GGBT_spinner&&window.GGBT_spinner.removeSpinner(v),window.GGBT_wsf_view&&$(window).trigger("resize"),f(e)},b||v.appendChild(_)):r.appendChild(_),v.appendChild(r),b||t.appendChild(v),setTimeout((function(){e.resize()}),1)}function k(e,t){t&&"function"==typeof t.appletOnLoad&&"function"==typeof renderGGBElement?renderGGBElement(e,t.appletOnLoad):renderGGBElement(e),F("GeoGebra HTML5 applet injected and rendered with previously loaded codebase.",t)}function S(e,t){"undefined"==typeof renderGGBElement?(null===html5AppletsToProcess&&(html5AppletsToProcess=[]),html5AppletsToProcess.push({article:e,params:t}),window.renderGGBElementReady=function(){isRenderGGBElementEnabled=!0,null!==html5AppletsToProcess&&html5AppletsToProcess.length&&(html5AppletsToProcess.forEach((function(e){k(e.article,e.params)})),html5AppletsToProcess=null)},x(m)<5&&(e.className+=" geogebraweb")):k(e,t)}if(o){scriptLoadStarted=!0;for(var j=0;j0?(o.remove(),l.attr("id","fullscreencontent").show(),jQuery(r).append(l),window.dispatchEvent(new Event("resize"))):C(o,t,!1),window.GGBT_wsf_view.launchFullScreen(r)}else h=i,C(e,t,!1);if(!window.GGBT_wsf_view)for(a=0;ae/4*3&&(l=e/4*3),s=l/5.8,a.setAttribute("src",b),a.setAttribute("width",l),a.setAttribute("height",s);var d=(e-l)/2,u=(t-s)/2;a.style.left=d+"px",a.style.top=u+"px",o.appendChild(a)}return o.appendChild(c),o},M=function(e){return"html5"===(e=e.toLowerCase())||"screenshot"===e?e:"html5"},G=["web","webSimple","web3d","tablet","tablet3d","phone"],O=function(e,t){if(m=e,t)Z(m,!0);else{var r,a,l=!o;if(l){var s=x(m);!isNaN(s)&&s<4.4&&(l=!1)}r="http"===window.location.protocol.substr(0,4)?window.location.protocol:"http:";var c=m.indexOf("//");for(var d in a=c>0?m:0===c?r+m:"https://www.geogebra.org/apps/5.2.814.0/",G)if(m.slice(-1*G[d].length)===G[d]||m.slice(-1*(G[d].length+1))===G[d]+"/")return void Z(a,!1);GGBAppletUtils.isFlexibleWorksheetEditor()||!l||i.is3D||i.AV||i.SV||i.CV||i.EV2||i.CP||i.PC||i.DA||i.FI||i.PV||T(n.showToolBar)||T(n.showMenuBar)||T(n.showAlgebraInput)||T(n.enableRightClick)||n.appName&&"classic"!=n.appName?a+="web3d/":a+="webSimple/",Z(a,!1)}},Z=function(e,t){if(e.requirejs)p=e;else{"/"!==e.slice(-1)&&(e+="/"),p=e,null===t&&(t=-1===e.indexOf("http")),f=t,g="web.nocache.js",w=!1;var n=p.split("/");n.length>1&&(t||"webSimple"!==n[n.length-2]?G.indexOf(n[n.length-2])>=0&&(g=n[n.length-2]+".nocache.js"):(g="webSimple.nocache.js",w=!0)),n=e.split("/"),"test"===(m=n[n.length-3]).substr(0,4)?m=m.substr(4,1)+"."+m.substr(5,1):"war"!==m.substr(0,3)&&"beta"!==m.substr(0,4)||(m="5.0");var i=parseFloat(m);NaN!==i&&i<5&&e.indexOf("geogebra.org")>=0&&(console.log("The GeoGebra HTML5 codebase version "+i+" is deprecated. Using version latest instead."),O("5.0",t))}},F=function(e,t){window.console&&window.console.log&&(!t||void 0===t.showLogging||t.showLogging&&"false"!==t.showLogging)&&console.log(e)};function R(){var e=t;null!==s?e=s:parseFloat(e)<5&&(e="5.0"),O(e,!1),null!==c&&Z(c,f),l=!0}return void 0!==n.material_id?S(R):R(),e},GGBAppletUtils=function(){"use strict";function e(){return void 0!==window.GGBT_wsf_edit}function t(e,t){1!=t?(e.style.transformOrigin="0% 0% 0px",e.style.webkitTransformOrigin="0% 0% 0px",e.style.transform="scale("+t+","+t+")",e.style.webkitTransform="scale("+t+","+t+")",e.style.maxWidth="initial",null!==e.querySelector(".ggb_preview")&&(e.querySelector(".ggb_preview").style.maxWidth="initial"),void 0!==e.querySelectorAll(".ggb_preview img")[0]&&(e.querySelectorAll(".ggb_preview img")[0].style.maxWidth="initial"),void 0!==e.querySelectorAll(".ggb_preview img")[1]&&(e.querySelectorAll(".ggb_preview img")[1].style.maxWidth="initial")):(e.style.transform="none",e.style.webkitTransform="none")}function n(e,t,n,i,o){if(e.isScreenshoGenerator)return 1;var r,a=void 0!==i&&i,l=null!=e.noScaleMargin&&e.noScaleMargin,s=(r=e.autoHeight)&&"false"!==r,c=function(e,t,n,i,o,r){var a=null;if(null!=r&&""!=r)for(var l=e.parentNode;null!=l;){if((" "+l.className+" ").indexOf(" "+r+" ")>-1){a=l;break}l=l.parentNode}var s=0,c=0,d=0,u=0,p=0,f=0,h=0;if(a)s=a.offsetWidth,c=Math.max(i?a.offsetWidth:0,a.offsetHeight);else{if(window.innerWidth&&document.documentElement.clientWidth?(s=Math.min(window.innerWidth,document.documentElement.clientWidth),c=Math.min(window.innerHeight,document.documentElement.clientHeight),d=s):(s=window.innerWidth,c=window.innerHeight,d=window.innerWidth),e){var m=e.getBoundingClientRect();m.left>0&&m.left<=s&&(void 0===o||!o)&&("rtl"===document.dir?(p=s-m.width-m.left,f=d<=480?10:30):(f=m.left,p=d<=480?10:30),u=f+p)}e&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(e.getBoundingClientRect(),"closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(u=40,h=0):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(u=0,h=40))}return e&&((void 0===n||!n)&&t>0&&t+u1&&(a=!0)),t&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(a=!0),e.hasOwnProperty("disableAutoScale")&&e.disableAutoScale?r:(o=n(e,t,a,i,e.scaleContainerClass),!a||e.hasOwnProperty("scale")&&1!==r?Math.min(r,o):o)}function o(e){var t=Math.min(window.innerWidth,document.documentElement.clientWidth),n=Math.min(window.innerHeight,document.documentElement.clientHeight),i=e.getBoundingClientRect(),o=(t-i.width)/2,r=(n-i.height)/2;r<0&&(r=0),e.style.position="relative","closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(e.style.left=o<40?"40px":o+"px",e.style.top=r+"px"):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(e.style.top=r<40?"40px":r+"px",e.style.left=o+"px")}return{responsiveResize:function(n,r){var a=n.querySelector(".appletParameters");if(a){if("object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()){if(r.id!==a.getAttribute("data-param-id"))return;window.GGBT_wsf_view.setCloseBtnPosition(n)}if(a.parentElement&&/fullscreen/.test(a.parentElement.className))return;var l=i(r,n);e()&&a.setAttribute("data-param-scale",l);for(var s=null,c=0;c=O)continue;if(j==jb){if(k=i.getAttribute(kb),k){var l,m=k.indexOf(lb);m>=O?(j=k.substring(O,m),l=k.substring(m+P)):(j=k,l=W),c[j]=l}}else if(j==mb){if(k=i.getAttribute(kb),k)try{d=eval(k)}catch(e){alert(nb+k+ob)}}else if(j==pb&&(k=i.getAttribute(kb),k))try{e=eval(k)}catch(e){alert(nb+k+qb)}}}__gwt_getMetaProperty=function(e){var t=c[e];return null==t?null:t},r=d,webModule.__errFn=e}function B(){function e(e){var t=e.lastIndexOf(rb);-1==t&&(t=e.length);var n=e.indexOf(sb);-1==n&&(n=e.length);var i=e.lastIndexOf(tb,Math.min(n,t));return i>=O?e.substring(O,i+P):W}var t,n=null!=(t=__gwt_getMetaProperty(wb))?t:W;return n==W&&(n=function(){for(var t=o.getElementsByTagName(_),n=O;nO?e[e.length-P].href:W}()),n==W&&function(){var e=o.location;return e.href==e.protocol+zb+e.host+e.pathname+e.search+e.hash}()&&(n=e(o.location.href)),n=function(t){if(t.match(/^\w+:\/\//));else{var n=o.createElement(ub);n.src=t+vb,t=e(n.src)}return t}(n),n}function C(e){return e.match(/^\//)||e.match(/^[a-zA-Z]+:\/\//)?e:webModule.__moduleBase+e}function D(){var e,t=O,i=[],o=[];function a(e){var t=o[e](),n=i[e];if(t in n)return t;var a=[];for(var l in n)a[n[l]]=l;throw r&&r(e,a,t),null}if(__gwt_isKnownPropertyValue=function(e,t){return t in i[e]},webModule.__getPropMap=function(){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[t]=a(t));return e},webModule.__computePropValue=a,n.__gwt_activeModules[L].bindings=webModule.__getPropMap,p())return C(Bb);try{var l=(e=Cb).indexOf(Db);-1!=l&&(t=parseInt(e.substring(l+P),$),e=e.substring(O,l))}catch(e){}return webModule.__softPermutationId=t,C(e+Eb)}function F(){n.__gwt_stylesLoaded||(n.__gwt_stylesLoaded={})}s[L]={moduleName:L},webModule.__moduleStartupDone=function(e){var t=s[L].bindings;s[L].bindings=function(){for(var n=t?t():{},i=e[webModule.__softPermutationId],o=O;o0){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"",n=[],i=0;i0){for(var i=a.elt(l-1);null!==i&&i.isTreeExpanded&&!i.isTreeLeaf;){i=this._sortTreeChildrenByY(i).last()}null!==i&&e.select(i)}else e.select(r)}else if("Down"===n.key){var o;if(t.isTreeExpanded&&!t.isTreeLeaf)null!==(o=this._sortTreeChildrenByY(t).first())&&e.select(o);else for(;null!==t;){var r,a,l;if(null===(r=t.findTreeParentNode()))break;if((l=(a=this._sortTreeChildrenByY(r)).indexOf(t))i.y?1:n.xi.x?1:0})),t},R.prototype.copyToClipboard=function(e){go.CommandHandler.prototype.copyToClipboard.call(this,e),this._lastPasteOffset.set(this.pasteOffset)},R.prototype.pasteFromClipboard=function(){var e=go.CommandHandler.prototype.pasteFromClipboard.call(this);return this.diagram.moveParts(e,this._lastPasteOffset),this._lastPasteOffset.add(this.pasteOffset),e},Object.defineProperty(R.prototype,"arrowKeyBehavior",{get:function(){return this._arrowKeyBehavior},set:function(e){if("move"!==e&&"select"!==e&&"scroll"!==e&&"tree"!==e&&"none"!==e)throw new Error('DrawCommandHandler.arrowKeyBehavior must be either "move", "select", "scroll", "tree", or "none", not: '+e);this._arrowKeyBehavior=e}}),Object.defineProperty(R.prototype,"pasteOffset",{get:function(){return this._pasteOffset},set:function(e){if(!(e instanceof go.Point))throw new Error("DrawCommandHandler.pasteOffset must be a Point, not: "+e);this._pasteOffset.set(e)}});var D=R,I=(n(20699),n(85160)),W=n(43418),H=n(43604),z=n(99005),V="myPaletteDiv___Xjz2I",q="maxH60___Pd4Re";window.go=F;var U=function(e){var t=e.onCancel,n=e.callback,i=(0,c.useRef)(),o=(0,c.useRef)(),r=(0,c.useRef)(),l=(0,c.useRef)(!1),s=(0,c.useRef)(!1),d=(0,c.useState)(0),u=a()(d,2),p=u[0],f=u[1],m=function(){var e=G()(A()().mark((function e(){var t,o;return A()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.current.makeImage(),e.next=3,(0,z.ZP)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:Date.now(),file:t.src}});case 3:o=e.sent,n({src:o.url});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){f(p+1)}),[]),(0,h.jsx)("div",{ref:s,className:l.current?"".concat(q," body-overflow-initial"):"body-overflow-initial",children:(0,h.jsx)(W.Z,{width:1200,icon:null,footer:null,closable:!0,visible:!!p,destroyOnClose:!0,maskClosable:!1,getContainer:s.current,rootClassName:"zIndex-9999",title:(0,h.jsxs)(P.Z,{children:[(0,h.jsx)(H.Z,{flex:1,children:"插入流程图"}),(0,h.jsx)(H.Z,{onClick:function(){l.current=!l.current,f(p+1)},children:(0,h.jsx)("span",{className:"current c-blue mr30",style:{fontWeight:400},children:"展开/收起"})})]}),onCancel:t,children:(0,h.jsxs)("div",{style:{width:"100%",height:"80vh",overflow:"hidden",position:"relative"},children:[(0,h.jsxs)("div",{style:{display:"flex",height:"100%"},children:[(0,h.jsxs)("div",{style:{width:"300px",height:"100%"},children:[(0,h.jsx)("div",{style:{background:"#fff",position:"relative",zIndex:12,fontSize:16,color:"#3061d0"},children:"图形库"}),(0,h.jsx)("div",{style:{height:"calc(100% - 50px)"},className:V,ref:r})]}),(0,h.jsxs)("div",{style:{flex:1,position:"relative"},children:[(0,h.jsx)(I.FI,{initDiagram:function(){var e=F.GraphObject.make,t="#ff3333",n="#3358ff",a="#25ad23",l="#d533ff",s="#7d33ff",c="#ff6233",d="#ffffff",u="#000000",p="#fffcd5",f="#d5ebff",h="#f2dfe0",m="#a5d2fa",g="#cccccc",w="#b3e6b3",v="#fcbbbd";function b(t,n){var i=function(e,n){e.handled=!0,e.diagram.model.commit((function(i){var o=n.part.adornedPart,r=(new F.Point).setRectSpot(o.actualBounds,t);r.subtract(o.location),r.scale(2,2),r.x+=130*Math.sign(r.x),r.y+=130*Math.sign(r.y),r.add(o.location),r.snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize);var a=i.copyNodeData(o.data);i.setGroupKeyForNodeData(a,i.getGroupKeyForNodeData(o.data)),i.addNodeData(a);var l={from:o.key,to:i.getKeyForNodeData(a)};i.addLinkData(l);var s=e.diagram.findNodeForData(a);s.location=r,e.diagram.select(s),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)}))};return e(F.Shape,{figure:n,alignment:t,alignmentFocus:t.opposite(),width:t.equals(F.Spot.Top)||t.equals(F.Spot.Bottom)?25:18,height:t.equals(F.Spot.Top)||t.equals(F.Spot.Bottom)?18:25,fill:"orange",stroke:d,strokeWidth:4,mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="orange"},isActionable:!0,click:i,contextClick:i})}function y(t){return e(F.Shape,{fill:"orange",stroke:"rgba(0, 0, 0, 0)",strokeWidth:15,background:"transparent",geometryString:"F1 M0 0 b 0 360 -4 0 4 z M10 0 b 0 360 -4 0 4 z M20 0 b 0 360 -4 0 4",isActionable:!0,cursor:"context-menu",mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="orange"},click:function(e,t){e.diagram.commandHandler.showContextMenu(t.part.adornedPart)}},t||{})}function x(e,t){return function(n,i){n.handled=!0,n.diagram.model.commit((function(n){n.set(i.part.adornedPart.data,e,t)}))}}function _(t,n){return n||(n="color"),e(F.Shape,{width:16,height:16,stroke:"lightgray",fill:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.stroke="dodgerblue"},mouseLeave:function(e,t){return t.stroke="lightgray"},click:x(n,t),contextClick:x(n,t)})}function k(){return[e("ContextMenuButton",e(F.Panel,"Horizontal",_(d,"fill"),_(p,"fill"),_(f,"fill"),_(h,"fill"))),e("ContextMenuButton",e(F.Panel,"Horizontal",_(g,"fill"),_(w,"fill"),_(m,"fill"),_(v,"fill")))]}function S(){return[e("ContextMenuButton",e(F.Panel,"Horizontal",_(u),_(a),_(n),_(t))),e("ContextMenuButton",e(F.Panel,"Horizontal",_(d),_(l),_(s),_(c)))]}function j(t,n){return n||(n="thickness"),e(F.Shape,"LineH",{width:16,height:16,strokeWidth:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:x(n,t),contextClick:x(n,t)})}function B(t,n){return n||(n="dash"),e(F.Shape,"LineH",{width:24,height:16,strokeWidth:2,strokeDashArray:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:x(n,t),contextClick:x(n,t)})}function T(){return[e("ContextMenuButton",e(F.Panel,"Horizontal",j(1),j(2),j(3),j(4))),e("ContextMenuButton",e(F.Panel,"Horizontal",B(null),B([2,4]),B([4,4])))]}function C(t,n){return n||(n="figure"),e(F.Shape,{width:32,height:32,scale:.5,fill:"lightgray",figure:t,margin:1,background:"transparent",mouseEnter:function(e,t){return t.fill="dodgerblue"},mouseLeave:function(e,t){return t.fill="lightgray"},click:x(n,t),contextClick:x(n,t)})}function P(t){return e(F.Shape,{stroke:"dodgerblue",strokeWidth:2,strokeCap:"square",geometryString:"M0 0 M4 2 H3 M4 "+(t+4).toString()+" H3"})}function N(t){var n="M0 0 M8 16 M0 8 L16 8 M12 11 L16 8 L12 5";return 0===t?n="M0 0 M16 16 M0 8 L16 8":2===t&&(n="M0 0 M16 16 M0 8 L16 8 M12 11 L16 8 L12 5 M4 11 L0 8 L4 5"),e(F.Shape,{geometryString:n,margin:2,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:x("dir",t),contextClick:x("dir",t)})}function E(t){var n=function(e,n){e.handled=!0,e.diagram.model.commit((function(e){var i=n.part.adornedPart;e.set(i.data,t?"toSpot":"fromSpot",F.Spot.stringify(F.Spot.AllSides)),(t?i.toNode:i.fromNode).invalidateConnectedLinks()}))};return e(F.Shape,{width:12,height:12,fill:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:n,contextClick:n})}function L(t,n){var i=0,o=F.Spot.RightSide;t.equals(F.Spot.Top)?(i=270,o=F.Spot.TopSide):t.equals(F.Spot.Left)?(i=180,o=F.Spot.LeftSide):t.equals(F.Spot.Bottom)&&(i=90,o=F.Spot.BottomSide),n||(i-=180);var r=function(e,t){e.handled=!0,e.diagram.model.commit((function(e){var i=t.part.adornedPart;e.set(i.data,n?"toSpot":"fromSpot",F.Spot.stringify(o)),(n?i.toNode:i.fromNode).invalidateConnectedLinks()}))};return e(F.Shape,{alignment:t,alignmentFocus:t.opposite(),geometryString:"M0 0 M12 12 M12 6 L1 6 L4 4 M1 6 L4 8",angle:i,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:r,contextClick:r})}return i.current=new F.Diagram(o.current,{padding:20,grid:e(F.Panel,"Grid",e(F.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(F.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),"draggingTool.isGridSnapEnabled":!0,handlesDragDropForTopLevelParts:!0,mouseDrop:function(e){e.diagram.commandHandler.addTopLevelParts(e.diagram.selection,!0)||e.diagram.currentTool.doCancel()},commandHandler:e(D),"clickCreatingTool.archetypeNodeData":{text:"未命名",fill:null,stroke:null,borderColor:"rgba(0,0,0,0)"},PartCreated:function(e){var t=e.subject;t.location=t.location.copy().snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)},"commandHandler.archetypeGroupData":{isGroup:!0,text:"NEW GROUP"},SelectionGrouped:function(e){e.subject;setTimeout((function(){e.diagram.commandHandler.editTextBlock()}))},LinkRelinked:function(e){e.parameter.part.invalidateConnectedLinks();var t=e.subject;e.diagram.toolManager.linkingTool.isForwards?t.toNode.invalidateConnectedLinks():t.fromNode.invalidateConnectedLinks()},"undoManager.isEnabled":!0}),i.current.nodeTemplate=e(F.Node,"Auto",{locationSpot:F.Spot.Center,locationObjectName:"SHAPE",desiredSize:new F.Size(120,60),minSize:new F.Size(40,40),resizable:!0,resizeCellSize:new F.Size(10,10),rotatable:!0},new F.Binding("location","loc",F.Point.parse).makeTwoWay(F.Point.stringify),new F.Binding("desiredSize","size",F.Size.parse).makeTwoWay(F.Size.stringify),e(F.Shape,{name:"SHAPE",fill:d,cursor:"pointer",portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:F.Spot.AllSides,toSpot:F.Spot.AllSides},new F.Binding("figure"),new F.Binding("fill"),new F.Binding("stroke","borderColor"),new F.Binding("strokeWidth","thickness"),new F.Binding("strokeDashArray","dash")),e(F.Shape,{width:100,height:20,strokeWidth:0,fill:"transparent"}),e(F.TextBlock,{margin:1,textAlign:"center",overflow:F.TextBlock.OverflowEllipsis,editable:!0},new F.Binding("text").makeTwoWay(),new F.Binding("stroke","color"))),i.current.nodeTemplate.toolTip=e("ToolTip",e(F.Panel,"Vertical",{maxSize:new F.Size(200,NaN)},e(F.TextBlock,{font:"bold 10pt sans-serif",textAlign:"center"},new F.Binding("text")),e(F.TextBlock,{font:"10pt sans-serif",textAlign:"center"},new F.Binding("text","details")))),i.current.nodeTemplate.selectionAdornmentTemplate=e(F.Adornment,"Spot",e(F.Placeholder,{padding:10}),b(F.Spot.Top,"TriangleUp"),b(F.Spot.Left,"TriangleLeft"),b(F.Spot.Right,"TriangleRight"),b(F.Spot.Bottom,"TriangleDown"),y({alignment:new F.Spot(.75,0)})),i.current.nodeTemplate.contextMenu=e("ContextMenu",e("ContextMenuButton",e(F.Panel,"Horizontal",C("Rectangle"),C("RoundedRectangle"),C("Ellipse"),C("Diamond"))),e("ContextMenuButton",e(F.Panel,"Horizontal",C("Parallelogram2"),C("ManualOperation"),C("Procedure"),C("Cylinder1"))),e("ContextMenuButton",e(F.Panel,"Horizontal",C("Terminator"),C("CreateRequest"),C("Document"),C("TriangleDown"))),k(),S(),T()),i.current.groupTemplate=e(F.Group,"Spot",{layerName:"Background",ungroupable:!0,locationSpot:F.Spot.Center,selectionObjectName:"BODY",computesBoundsAfterDrag:!0,handlesDragDropForMembers:!0,mouseDrop:function(e,t){t.addMembers(t.diagram.selection,!0)||t.diagram.currentTool.doCancel()},avoidable:!1},new F.Binding("location","loc",F.Point.parse).makeTwoWay(F.Point.stringify),e(F.Panel,"Auto",{name:"BODY"},e(F.Shape,{parameter1:10,fill:d,strokeWidth:2,cursor:"pointer",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:F.Spot.AllSides,toSpot:F.Spot.AllSides},new F.Binding("fill"),new F.Binding("stroke","color"),new F.Binding("strokeWidth","thickness"),new F.Binding("strokeDashArray","dash")),e(F.Placeholder,{background:"transparent",margin:20})),e(F.TextBlock,{alignment:F.Spot.Top,alignmentFocus:F.Spot.Bottom,font:"bold 12pt sans-serif",editable:!0},new F.Binding("text"),new F.Binding("stroke","color"))),i.current.groupTemplate.selectionAdornmentTemplate=e(F.Adornment,"Spot",e(F.Panel,"Auto",e(F.Shape,{fill:null,stroke:"dodgerblue",strokeWidth:3}),e(F.Placeholder,{margin:1.5})),y({alignment:F.Spot.TopRight,alignmentFocus:F.Spot.BottomRight})),i.current.groupTemplate.contextMenu=e("ContextMenu",k(),S(),T()),i.current.linkTemplate=e(F.Link,{layerName:"Foreground",routing:F.Link.AvoidsNodes,corner:10,fromShortLength:10,toShortLength:15,relinkableFrom:!0,relinkableTo:!0,reshapable:!0,resegmentable:!0},new F.Binding("fromSpot","fromSpot",F.Spot.parse),new F.Binding("toSpot","toSpot",F.Spot.parse),new F.Binding("fromShortLength","dir",(function(e){return e>=1?10:0})),new F.Binding("toShortLength","dir",(function(e){return e>=1?10:0})),new F.Binding("points").makeTwoWay(),e(F.Shape,{strokeWidth:2},new F.Binding("stroke","color"),new F.Binding("strokeWidth","thickness"),new F.Binding("strokeDashArray","dash")),e(F.Shape,{segmentIndex:0,segmentOffset:new F.Point(15,0),segmentOrientation:F.Link.OrientAlong,alignmentFocus:F.Spot.Right,figure:"circle",width:10,strokeWidth:0},new F.Binding("fill","color"),new F.Binding("visible","dir",(function(e){return 1===e}))),e(F.Shape,{segmentIndex:-1,segmentOffset:new F.Point(-10,6),segmentOrientation:F.Link.OrientPlus90,alignmentFocus:F.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new F.Binding("fill","color"),new F.Binding("visible","dir",(function(e){return e>=1})),new F.Binding("width","thickness",(function(e){return 7+3*e})),new F.Binding("height","thickness",(function(e){return 7+3*e})),new F.Binding("segmentOffset","thickness",(function(e){return new F.Point(-15,4+1.5*e)}))),e(F.Shape,{segmentIndex:0,segmentOffset:new F.Point(15,-6),segmentOrientation:F.Link.OrientMinus90,alignmentFocus:F.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new F.Binding("fill","color"),new F.Binding("visible","dir",(function(e){return 2===e})),new F.Binding("width","thickness",(function(e){return 7+3*e})),new F.Binding("height","thickness",(function(e){return 7+3*e})),new F.Binding("segmentOffset","thickness",(function(e){return new F.Point(-15,4+1.5*e)}))),e(F.TextBlock,{alignmentFocus:new F.Spot(0,1,-4,0),editable:!0},new F.Binding("text").makeTwoWay(),new F.Binding("stroke","color"))),i.current.linkTemplate.selectionAdornmentTemplate=e(F.Adornment,e(F.Shape,{isPanelMain:!0,stroke:"transparent",strokeWidth:6,pathPattern:P(2)},new F.Binding("pathPattern","thickness",P)),y({alignmentFocus:new F.Spot(0,0,-6,-4)})),i.current.linkTemplate.contextMenu=e("ContextMenu",S(),T(),e("ContextMenuButton",e(F.Panel,"Horizontal",N(0),N(1),N(2))),e("ContextMenuButton",e(F.Panel,"Horizontal",e(F.Panel,"Spot",E(!1),L(F.Spot.Top,!1),L(F.Spot.Left,!1),L(F.Spot.Right,!1),L(F.Spot.Bottom,!1)),e(F.Panel,"Spot",{margin:new F.Margin(0,0,0,2)},E(!0),L(F.Spot.Top,!0),L(F.Spot.Left,!0),L(F.Spot.Right,!0),L(F.Spot.Bottom,!0))))),new F.Palette(r.current,{maxSelectionCount:1,linkTemplate:e(F.Link,{locationSpot:F.Spot.Center,selectionAdornmentTemplate:e(F.Adornment,"Link",{locationSpot:F.Spot.Center},e(F.Shape,{isPanelMain:!0,fill:null,stroke:"deepskyblue",strokeWidth:0}),e(F.Shape,{toArrow:"Standard",stroke:null}))},{routing:F.Link.AvoidsNodes,curve:F.Link.JumpOver,corner:5,toShortLength:4},new F.Binding("points"),e(F.Shape,{isPanelMain:!0,strokeWidth:2}),e(F.Shape,{toArrow:"Standard",stroke:null})),model:new F.GraphLinksModel([{text:"未命名",size:"100 100",fill:null,stroke:"#000"}].concat(Z()(F.Shape.getFigureGenerators().toArray().map((function(e){return{text:"未命名",size:"100 100",figure:e.key,fill:"white",stroke:"#666",borderColor:"#000"}})))))}).nodeTemplate=e(F.Node,"Auto",{locationSpot:F.Spot.Center},new F.Binding("location","location",F.Point.parse).makeTwoWay(F.Point.stringify),e(F.Shape,"Circle",{fill:"white",stroke:"gray",strokeWidth:2,width:20,height:20,portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromLinkableSelfNode:!0,toLinkableSelfNode:!0},new F.Binding("stroke").makeTwoWay(),new F.Binding("fill").makeTwoWay(),new F.Binding("figure")),e(F.TextBlock,{margin:new F.Margin(5,5,3,5),font:"10pt sans-serif",minSize:new F.Size(16,16),maxSize:new F.Size(10,NaN),textAlign:"center",editable:!0},new F.Binding("key").makeTwoWay())),setTimeout((function(){i.current.grid=e(F.Panel,"Grid",e(F.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(F.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),i.current.grid.visible=!0,i.current.grid.gridCellStroke="darkgray",i.current.grid.gridCellStrokeWidth=1}),300),window.myDiagrams=i.current,i.current},divClassName:"diagram-component",style:{height:"80vh"}}),(0,h.jsx)("div",{ref:o})]})]}),(0,h.jsx)("div",{className:"tr",children:(0,h.jsx)(S.ZP,{size:"large",onClick:m,style:{position:"absolute",right:0,bottom:0,zIndex:8},type:"primary",children:"保存到编辑器"})})]})})})},K=n(5112),Y=n(94001),J=K.ZP.Group,X={margin:"0 8px"},Q=function(e){var t=e.callback,n=e.onCancel;return(0,h.jsxs)(_.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){t(e)},children:[(0,h.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,h.jsx)("span",{style:X,children:"单元格数:"}),(0,h.jsx)("span",{style:X,children:"行数"}),(0,h.jsx)(_.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,h.jsx)(Y.Z,{})}),(0,h.jsx)("span",{style:X,children:"列数"}),(0,h.jsx)(_.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,h.jsx)(Y.Z,{})})]}),(0,h.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,h.jsx)("span",{style:X,children:"对齐方式:"}),(0,h.jsx)(_.Z.Item,{name:"align",children:(0,h.jsxs)(J,{children:[(0,h.jsx)(K.ZP,{value:"default",children:(0,h.jsx)("i",{className:"fa fa-align-justify"})}),(0,h.jsx)(K.ZP,{value:"left",children:(0,h.jsx)("i",{className:"fa fa-align-left"})}),(0,h.jsx)(K.ZP,{value:"center",children:(0,h.jsx)("i",{className:"fa fa-align-center"})}),(0,h.jsx)(K.ZP,{value:"right",children:(0,h.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,h.jsxs)("div",{className:"flex-container flex-end",children:[(0,h.jsx)(S.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,h.jsx)(S.ZP,{type:"ghost",onClick:n,children:"取消"})]})]})},$=n(78673),ee=n(94756),te=n.n(ee),ne=(0,c.forwardRef)((function(e,t){var n=e.use3d,i=e.width,o=e.height,r=e.callback,l=(e.showSaveButton,(0,c.useRef)()),s=(0,c.useRef)(),d=(0,c.useState)(!1),u=a()(d,2),p=u[0],f=u[1],m=(0,c.useRef)({id:l,appName:"graphing",width:i||1e3,height:o||600,showToolBar:!0,showMenuBar:!0,allowStyleBar:!0,showAlgebraInput:!0,enableLabelDrags:!1,enableShiftDragZoom:!0,showToolBarHelp:!1,errorDialogsActive:!0,showTutorialLink:!0,showLogging:!0,useBrowserForJS:!1});(0,c.useEffect)((function(){s.current=new(te())(m.current,!0),window.onload=function(){s.current.inject("applet_container")}}),[]);var g=function(){var e=window.ggbApplet.getPNGBase64(1,!0,72);return r&&r(e),e};return(0,c.useEffect)((function(){m.current.appName=p?"3D":"graphing",s.current.inject("applet_container")}),[p]),(0,c.useEffect)((function(){f(n)}),[n]),(0,c.useImperativeHandle)(t,(function(){return{getImgData:g}})),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{style:{width:"100%",height:"100%"},id:"applet_container",ref:l}),(0,h.jsxs)(P.Z,{align:"middle",children:[(0,h.jsx)(H.Z,{flex:1,children:(0,h.jsx)($.Z,{size:"default",checkedChildren:"关闭3D图像",unCheckedChildren:"开启3D图像",checked:p,onChange:function(e){return f(e)}})}),(0,h.jsx)(H.Z,{children:(0,h.jsx)(S.ZP,{size:"large",onClick:g,style:{zIndex:8,marginTop:10},type:"primary",children:"保存到编辑器"})})]})]})})),ie=n(30651),oe=n(47596),re=n(8591),ae="link",le="upload-image",se="add-flowchart",ce="draw-image",de="code-block",ue="add-table",pe="------------",fe={default:pe,left:":".concat(pe),center:":".concat(pe,":"),right:"".concat(pe,":")},he=n(93345);var me="@▁▁@",ge=["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"];function we(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",be=s()(s()({},ve+"-B","bold"),ve+"-I","italic"),ye=s()(s()(s()(s()(s()(s()(s()(s()({},ae,"添加链接"),de,"添加代码块"),le,"添加图片"),ce,"添加画图"),se,"插入流程图"),ue,"添加表格"),"maths-latex","数学图像"),"inline-latex","LATEX公式"),xe=function(e){var t=e.defaultValue,n=void 0===t?"":t,i=e.onChange,r=e.width,l=void 0===r?"100%":r,d=e.height,g=void 0===d?400:d,w=e.miniToolbar,v=void 0!==w&&w,b=e.isFocus,_=void 0!==b&&b,k=e.watch,S=e.insertTemp,j=e.mode,P=void 0===j?"markdown":j,N=e.id,L=void 0===N?"markdown-editor-id":N,A=e.showResizeBar,M=void 0!==A&&A,G=e.noStorage,O=void 0!==G&&G,Z=e.showNullButton,F=void 0!==Z&&Z,R=e.showNullProgramButton,D=void 0!==R&&R,I=e.hidetoolBar,H=void 0!==I&&I,z=e.fullScreen,V=void 0!==z&&z,q=e.onBlur,K=e.onCMBeforeChange,Y=e.onFullScreen,J=e.className,X=void 0===J?"":J,$=e.disablePaste,ee=void 0!==$&&$,te=e.disabled,pe=void 0!==te&&te,ve=e.disabledFill,xe=void 0!==ve&&ve,_e=e.placeholder,ke=void 0===_e?"":_e,Se=e.values,je=void 0===Se?"":Se,Be=e.extraUse,Te=(0,c.useState)(null),Ce=a()(Te,2),Pe=Ce[0],Ne=Ce[1],Ee=(0,c.useState)(n),Le=a()(Ee,2),Ae=Le[0],Me=Le[1],Ge=(0,c.useState)(k),Oe=a()(Ge,2),Ze=Oe[0],Fe=Oe[1],Re=(0,c.useState)(V),De=a()(Re,2),Ie=De[0],We=De[1],He=(0,c.useState)(""),ze=a()(He,2),Ve=ze[0],qe=ze[1],Ue=(0,c.useState)(0),Ke=a()(Ue,2),Ye=Ke[0],Je=Ke[1],Xe=(0,c.useState)(g),Qe=a()(Xe,2),$e=Qe[0],et=Qe[1],tt=(0,c.useState)(!1),nt=a()(tt,2),it=(nt[0],nt[1]),ot=(0,c.useState)(0),rt=a()(ot,2),at=rt[0],lt=rt[1],st=(0,c.useState)(0),ct=a()(st,2),dt=ct[0],ut=ct[1],pt=(0,c.useRef)(),ft=(0,c.useRef)(),ht=(0,c.useRef)(),mt=(0,c.useRef)();(0,c.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Me(je),null==Pe||Pe.setValue(je),window.scrollTo(0,e)}),[je]),(0,c.useEffect)((function(){null==Y||Y(Ie)}),[Ie]),(0,c.useEffect)((function(){if(pt.current){var e=function(e,n){if(!ee){var i=n.clipboardData;if(i){var o=i.types.toString(),r=i.items;if("Files"===o||i.types.indexOf("Files")>-1){if(n.preventDefault(),"stex"==P)return;try{var a,l=r[1];"file"===(null===(a=r[0])||void 0===a?void 0:a.kind)&&(l=r[0]);var s=l.getAsFile(),c=s.name.split(".").pop();(0,C.I)(s,(function(e){var n,i,o;e.id?(null==s||null===(n=s.type)||void 0===n?void 0:n.indexOf("image"))>-1?t.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==s||null===(i=s.type)||void 0===i?void 0:i.indexOf("video"))>-1?t.replaceSelection('')):(null==s||null===(o=s.type)||void 0===o?void 0:o.indexOf("pdf"))>-1?t.replaceSelection('').concat(s.name,"")):ge.includes(c)?t.replaceSelection('').concat(s.name,"")):t.replaceSelection("[".concat(s.name,"](").concat(oe.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(n){re.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}n.preventDefault()},t=u().fromTextArea(pt.current,{mode:P,lineNumbers:!v,lineWrapping:!0,value:n,autoCloseTags:!0,autoCloseBrackets:!0});return t.on("keyup",(function(e,n){8===n.keyCode&&(""==e.getValue()?t.setOption("placeholder",ke):t.setOption("placeholder",null))})),t.on("keydown",(function(e,t){if(8===t.keyCode){var n=function(e,t){var n=e.getDoc(),i=n.getCursor(),o=n.getLine(i.line),r=o.charAt(i.ch-1),a=o.lastIndexOf("@▁@",i.ch),l=o.lastIndexOf("@▁▁@",i.ch),s=a>l?a:l,c=a>l?3:4;if(-1===me.indexOf(r))return null;if(console.log("change1:",t,e,o,i,s,a,l,r),s>=0&&i.ch-s<5){var d=s+c;return n.replaceRange("",{line:i.line,ch:s},{line:i.line,ch:d}),{line:i.line,ch:d}}return null}(e);n&&t.preventDefault()}})),_&&t.focus(),t.on("paste",e),pe&&t.on("beforeChange",(function(e,t){"paste"!==t.origin&&"+input"!==t.origin||t.cancel()})),Ne(t),function(){t.off("paste",e)}}}),[]);var gt=(0,c.useCallback)((function(){ft.current}),[$e,ft,Ie]);(0,c.useEffect)((function(){if(Pe){var e=function(){var e=new p.Z((function(e){var t,n=o()(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&(gt(),Pe.setSize("100%","100%"),Pe.refresh())}}catch(e){n.e(e)}finally{n.f()}}));return e.observe(pt.current.parentElement),e}();return function(){var t,n;null!==(t=pt.current)&&void 0!==t&&t.parentElement&&e.unobserve(null===(n=pt.current)||void 0===n?void 0:n.parentElement)}}}),[Pe,gt]),(0,c.useEffect)((function(){if(Pe){for(var e=[],t=function(){var t=a()(i[n],2),o=t[0],r=t[1],l=s()({},o,(function(){wt(r)}));e.push(l),Pe.addKeyMap(l)},n=0,i=Object.entries(be);n0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(L);e>=Ye+1e4&&(!t||t!==Ae)&&(window.sessionStorage.setItem(L,Ae),it(!0))}}),1e4),(0,c.useEffect)((function(){Fe(k)}),[Pe,k]),(0,c.useEffect)((function(){Pe&&_&&Pe.focus()}),[Pe,_]),(0,c.useEffect)((function(){if(Ze&&Pe){var e=function(e){var t=e.target;if(mt.current){var n=t.scrollTop/t.scrollHeight;mt.current.scrollTop=mt.current.scrollHeight*n}},t=Pe.getScrollerElement();return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[Pe,Ze]),(0,c.useEffect)((function(){if(Pe&&K){var e=function(e,t){K(e,t)};return Pe.on("beforeChange",e),function(){Pe.off("beforeChange",e)}}}),[Pe,K]),(0,c.useEffect)((function(){if(Pe&&q){var e=function(){q(Pe.getValue())};return Pe.on("blur",e),function(){Pe.off("blur",e)}}}),[Pe,q]),(0,c.useEffect)((function(){if(Pe){var e=function(e,t){var n=e.getValue();Me(n),Je((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),i&&(D?i(n,_t(n)):i(n))};return Pe.on("change",e),function(){Pe.off("change",e)}}}),[Pe,i]),(0,c.useEffect)((function(){if(Pe)if(null==n)Pe.setValue(""),Me("");else{var e=window.scrollY||window.pageYOffset;n!==Pe.getValue()&&(Pe.setValue(n),Me(n),Pe.setCursor(pe?1:Pe.lineCount(),0),window.scrollTo(0,e))}}),[Pe,n]);var wt=(0,c.useCallback)((function(e){var t=Pe.getCursor(),n=Pe.getSelection(),i=n.split("\n");switch(e){case"bold":return Pe.replaceSelection("**"+n+"**"),""===n&&Pe.setCursor(t.line,t.ch+2),Pe.focus();case"italic":return Pe.replaceSelection("*"+n+"*"),""===n&&Pe.setCursor(t.line,t.ch+1),Pe.focus();case"code":return Pe.replaceSelection("`"+n+"`"),""===n&&Pe.setCursor(t.line,t.ch+1),Pe.focus();case"inline-latex":return qe("inline-latex"),Pe.focus();case"latex":return Pe.replaceSelection("```latex\n"+n+"\n```"),Pe.setCursor(t.line+1,n.length+1),Pe.focus();case"line-break":return Pe.replaceSelection("
\n"),Pe.focus();case"list-ul":return""===n?Pe.replaceSelection("- "+n):Pe.replaceSelection(i.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Pe.focus();case"list-ol":return""===n?Pe.replaceSelection("1. "+n):Pe.replaceSelection(i.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),Pe.focus();case"add-null-ch":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection("▁"),Pe.focus();case"add-signal":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection("@▁@"),Pe.focus();case"add-multiple":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection(me),Pe.focus();case"inster-template-1":return""===n&&Pe.setCursor(t.line,t.ch),Pe.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Pe.focus();case"eraser":return Pe.setValue(""),Pe.focus();case"trigger-watch":return Fe(!Ze),Pe.focus();case"trigger-full-screen":return We(!Ie),Pe.focus();case ae:return void qe(ae);case de:return void qe(de);case le:return void qe(le);case ce:return void qe(ce);case"maths-latex":return void qe("maths-latex");case se:return void qe(se);case ue:return void qe(ue);default:throw new Error}}),[Pe,Ze,Ie]),vt=(0,c.useCallback)((function(e,t){var n,i,o,r,a;switch(qe(""),Ve){case ae:var l=e.title,s=e.link;return Pe.replaceSelection("[".concat(l,"](").concat(s,")")),Pe.focus();case de:var c=e.language,d=e.content;return Pe.replaceSelection(["```"+c,d,"```"].join("\n")),Pe.focus();case"maths-latex":for(var u=atob(e),p=new Uint8Array(u.length),f=0;f-1||null==w||!w.type?g?Pe.replaceSelection("![ ".concat(g," ]( ").concat(m,' "').concat(g,'" )')):Pe.replaceSelection("![,](".concat(m,")")):(null==w||null===(r=w.type)||void 0===r?void 0:r.indexOf("video"))>-1?Pe.replaceSelection('')):(null==w||null===(a=w.type)||void 0===a?void 0:a.indexOf("pdf"))>-1?Pe.replaceSelection('').concat(w.name,"")):ge.includes(v)?Pe.replaceSelection('').concat(w.name,"")):Pe.replaceSelection("[".concat(w.name,"](").concat(oe.Z.API_SERVER).concat(m,")")),Pe.focus();case ue:for(var b=e.row,y=e.col,x=e.align,_="\n",k=0;k300&&(t=300),et(g+t+"px")}},i=ht.current,o=!1,r=0;return i.addEventListener("mousedown",e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",t),function(){i.removeEventListener("mousedown",e),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t)}}}),[Pe,ht]),(0,c.useEffect)((function(){et(g)}),[g]);var xt={width:we(l),height:we($e)},_t=((0,c.useMemo)((function(){if(Ye){var e=new Date(Ye),t=e.getHours(),n=e.getMinutes(),i=e.getSeconds();return n=n<10?"0"+n:n,i=i<10?"0"+i:i,"".concat(t=t<10?"0"+t:t,":").concat(n,":").concat(i)}return 0}),[Ye]),function(e){var t=[];if(D){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,n,i){t.push({multiLine:!("@▁@"===e)})}))}return t});(0,c.useEffect)((function(){ye[Ve]&&Ve!==ce&&Ve!==se&&setTimeout((function(){var e=document.getElementsByClassName("markdown-popup-form")[0],t=window.innerWidth/2-e.offsetWidth/2,n=window.innerHeight/2-e.offsetHeight/2;lt(t),ut(n)}),0)}),[Ve]);var kt=function(e,t,n,i){var o=document.body.clientHeight,r=document.body.clientWidth;return!(e<20&&n>e||e>r-20&&nt||t>o-20&&i