(self.webpackChunk=self.webpackChunk||[]).push([[39752],{66455: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={},o=null,i=!1,a=!1,r=null,l=!1,s=null,c=null,d=0;d4?parseFloat(e):5};function k(){try{return window.self!==window.top}catch(e){return!0}}function S(){return(!n.hasOwnProperty("screenshotGenerator")||!n.screenshotGenerator)&&Math.max(screen.width,screen.height)<800}e.setHTML5Codebase=function(e,t){c=e,R(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 o,i="auto",a=n.id,r=!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 C=function(e){return e&&"false"!==e},P=function(t,n,o){x(m)<=4.2&&(o=!0);var i=!isRenderGGBElementEnabled&&!scriptLoadStarted;(!isRenderGGBElementEnabled&&!scriptLoadStarted||ggbHTML5LoadedCodebaseVersion!==m||ggbHTML5LoadedCodebaseIsWebSimple&&!w)&&(i=!0,isRenderGGBElementEnabled=!1,scriptLoadStarted=!1);var a=document.createElement("div");a.classList.add("appletParameters","notranslate");var r=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)C(n.showToolBar)&&(n.height-=7),C(n.showAlgebraInput)&&(n.height-=37),n.width<605&&C(n.showToolBar)&&(n.width=605,r=605);else{var d=100;(C(n.showToolBar)||C(n.showMenuBar))&&(n.hasOwnProperty("customToolBar")&&(n.customToolbar=n.customToolBar),d=C(n.showMenuBar)?245:155),r=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"),p(e)},b||v.appendChild(k)):a.appendChild(k),v.appendChild(a),b||t.appendChild(v),setTimeout((function(){e.resize()}),1)}function S(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 _(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){S(e.article,e.params)})),html5AppletsToProcess=null)},x(m)<5&&(e.className+=" geogebraweb")):S(e,t)}if(i){scriptLoadStarted=!0;for(var B=0;B0?(i.remove(),l.attr("id","fullscreencontent").show(),jQuery(a).append(l),window.dispatchEvent(new Event("resize"))):P(i,t,!1),window.GGBT_wsf_view.launchFullScreen(a)}else h=o,P(e,t,!1);if(!window.GGBT_wsf_view)for(r=0;re/4*3&&(l=e/4*3),s=l/5.8,r.setAttribute("src",b),r.setAttribute("width",l),r.setAttribute("height",s);var d=(e-l)/2,u=(t-s)/2;r.style.left=d+"px",r.style.top=u+"px",i.appendChild(r)}return i.appendChild(c),i},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)R(m,!0);else{var a,r,l=!i;if(l){var s=x(m);!isNaN(s)&&s<4.4&&(l=!1)}a="http"===window.location.protocol.substr(0,4)?window.location.protocol:"http:";var c=m.indexOf("//");for(var d in r=c>0?m:0===c?a+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 R(r,!1);GGBAppletUtils.isFlexibleWorksheetEditor()||!l||o.is3D||o.AV||o.SV||o.CV||o.EV2||o.CP||o.PC||o.DA||o.FI||o.PV||C(n.showToolBar)||C(n.showMenuBar)||C(n.showAlgebraInput)||C(n.enableRightClick)||n.appName&&"classic"!=n.appName?r+="web3d/":r+="webSimple/",R(r,!1)}},R=function(e,t){if(e.requirejs)f=e;else{"/"!==e.slice(-1)&&(e+="/"),f=e,null===t&&(t=-1===e.indexOf("http")),p=t,g="web.nocache.js",w=!1;var n=f.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 o=parseFloat(m);NaN!==o&&o<5&&e.indexOf("geogebra.org")>=0&&(console.log("The GeoGebra HTML5 codebase version "+o+" 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 D(){var e=t;null!==s?e=s:parseFloat(e)<5&&(e="5.0"),O(e,!1),null!==c&&R(c,p),l=!0}return void 0!==n.material_id?_(D):D(),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,o,i){if(e.isScreenshoGenerator)return 1;var a,r=void 0!==o&&o,l=null!=e.noScaleMargin&&e.noScaleMargin,s=(a=e.autoHeight)&&"false"!==a,c=function(e,t,n,o,i,a){var r=null;if(null!=a&&""!=a)for(var l=e.parentNode;null!=l;){if((" "+l.className+" ").indexOf(" "+a+" ")>-1){r=l;break}l=l.parentNode}var s=0,c=0,d=0,u=0,f=0,p=0,h=0;if(r)s=r.offsetWidth,c=Math.max(o?r.offsetWidth:0,r.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===i||!i)&&("rtl"===document.dir?(f=s-m.width-m.left,p=d<=480?10:30):(p=m.left,f=d<=480?10:30),u=p+f)}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&&(r=!0)),t&&"object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()&&(r=!0),e.hasOwnProperty("disableAutoScale")&&e.disableAutoScale?a:(i=n(e,t,r,o,e.scaleContainerClass),!r||e.hasOwnProperty("scale")&&1!==a?Math.min(a,i):i)}function i(e){var t=Math.min(window.innerWidth,document.documentElement.clientWidth),n=Math.min(window.innerHeight,document.documentElement.clientHeight),o=e.getBoundingClientRect(),i=(t-o.width)/2,a=(n-o.height)/2;a<0&&(a=0),e.style.position="relative","closePositionRight"===window.GGBT_wsf_view.getCloseBtnPosition()?(e.style.left=i<40?"40px":i+"px",e.style.top=a+"px"):"closePositionTop"===window.GGBT_wsf_view.getCloseBtnPosition()&&(e.style.top=a<40?"40px":a+"px",e.style.left=i+"px")}return{responsiveResize:function(n,a){var r=n.querySelector(".appletParameters");if(r){if("object"===_typeof(window.GGBT_wsf_view)&&window.GGBT_wsf_view.isFullscreen()){if(a.id!==r.getAttribute("data-param-id"))return;window.GGBT_wsf_view.setCloseBtnPosition(n)}if(r.parentElement&&/fullscreen/.test(r.parentElement.className))return;var l=o(a,n);e()&&r.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 o=e.lastIndexOf(tb,Math.min(n,t));return o>=O?e.substring(O,o+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,o=[],i=[];function a(e){var t=i[e](),n=o[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 o[e]},webModule.__getPropMap=function(){var e={};for(var t in o)o.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():{},o=e[webModule.__softPermutationId],i=O;i0){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"",n=[],o=0;o0){for(var o=r.elt(l-1);null!==o&&o.isTreeExpanded&&!o.isTreeLeaf;){o=this._sortTreeChildrenByY(o).last()}null!==o&&e.select(o)}else e.select(a)}else if("Down"===n.key){var i;if(t.isTreeExpanded&&!t.isTreeLeaf)null!==(i=this._sortTreeChildrenByY(t).first())&&e.select(i);else for(;null!==t;){var a,r,l;if(null===(a=t.findTreeParentNode()))break;if((l=(r=this._sortTreeChildrenByY(a)).indexOf(t))o.y?1:n.xo.x?1:0})),t},q.prototype.copyToClipboard=function(e){go.CommandHandler.prototype.copyToClipboard.call(this,e),this._lastPasteOffset.set(this.pasteOffset)},q.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(q.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(q.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 U=q,K=(n(31270),n(85160)),Y=n(43418),J=n(43604),X=n(51136),$="myPaletteDiv___Xjz2I",Q="maxH60___Pd4Re";window.go=V;var ee=function(e){var t=e.onCancel,n=e.callback,o=(0,c.useRef)(),i=(0,c.useRef)(),a=(0,c.useRef)(),l=(0,c.useRef)(!1),s=(0,c.useRef)(!1),d=(0,c.useState)(0),u=r()(d,2),f=u[0],p=u[1],m=function(){var e=H()(I()().mark((function e(){var t,i;return I()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.current.makeImage(),e.next=3,(0,X.ZP)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:Date.now(),file:t.src}});case 3:i=e.sent,n({src:i.url});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){p(f+1)}),[]),(0,h.jsx)("div",{ref:s,className:l.current?"".concat(Q," body-overflow-initial"):"body-overflow-initial",children:(0,h.jsx)(Y.Z,{width:1200,icon:null,footer:null,closable:!0,visible:!!f,destroyOnClose:!0,maskClosable:!1,getContainer:s.current,rootClassName:"zIndex-9999",title:(0,h.jsxs)(O.Z,{children:[(0,h.jsx)(J.Z,{flex:1,children:"插入流程图"}),(0,h.jsx)(J.Z,{onClick:function(){l.current=!l.current,p(f+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:$,ref:a})]}),(0,h.jsxs)("div",{style:{flex:1,position:"relative"},children:[(0,h.jsx)(K.FI,{initDiagram:function(){var e=V.GraphObject.make,t="#ff3333",n="#3358ff",r="#25ad23",l="#d533ff",s="#7d33ff",c="#ff6233",d="#ffffff",u="#000000",f="#fffcd5",p="#d5ebff",h="#f2dfe0",m="#a5d2fa",g="#cccccc",w="#b3e6b3",v="#fcbbbd";function b(t,n){var o=function(e,n){e.handled=!0,e.diagram.model.commit((function(o){var i=n.part.adornedPart,a=(new V.Point).setRectSpot(i.actualBounds,t);a.subtract(i.location),a.scale(2,2),a.x+=130*Math.sign(a.x),a.y+=130*Math.sign(a.y),a.add(i.location),a.snapToGridPoint(e.diagram.grid.gridOrigin,e.diagram.grid.gridCellSize);var r=o.copyNodeData(i.data);o.setGroupKeyForNodeData(r,o.getGroupKeyForNodeData(i.data)),o.addNodeData(r);var l={from:i.key,to:o.getKeyForNodeData(r)};o.addLinkData(l);var s=e.diagram.findNodeForData(r);s.location=a,e.diagram.select(s),setTimeout((function(){e.diagram.commandHandler.editTextBlock()}),20)}))};return e(V.Shape,{figure:n,alignment:t,alignmentFocus:t.opposite(),width:t.equals(V.Spot.Top)||t.equals(V.Spot.Bottom)?25:18,height:t.equals(V.Spot.Top)||t.equals(V.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:o,contextClick:o})}function y(t){return e(V.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,o){n.handled=!0,n.diagram.model.commit((function(n){n.set(o.part.adornedPart.data,e,t)}))}}function k(t,n){return n||(n="color"),e(V.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 S(){return[e("ContextMenuButton",e(V.Panel,"Horizontal",k(d,"fill"),k(f,"fill"),k(p,"fill"),k(h,"fill"))),e("ContextMenuButton",e(V.Panel,"Horizontal",k(g,"fill"),k(w,"fill"),k(m,"fill"),k(v,"fill")))]}function _(){return[e("ContextMenuButton",e(V.Panel,"Horizontal",k(u),k(r),k(n),k(t))),e("ContextMenuButton",e(V.Panel,"Horizontal",k(d),k(l),k(s),k(c)))]}function B(t,n){return n||(n="thickness"),e(V.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 T(t,n){return n||(n="dash"),e(V.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 C(){return[e("ContextMenuButton",e(V.Panel,"Horizontal",B(1),B(2),B(3),B(4))),e("ContextMenuButton",e(V.Panel,"Horizontal",T(null),T([2,4]),T([4,4])))]}function P(t,n){return n||(n="figure"),e(V.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 E(t){return e(V.Shape,{stroke:"dodgerblue",strokeWidth:2,strokeCap:"square",geometryString:"M0 0 M4 2 H3 M4 "+(t+4).toString()+" H3"})}function L(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(V.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 N(t){var n=function(e,n){e.handled=!0,e.diagram.model.commit((function(e){var o=n.part.adornedPart;e.set(o.data,t?"toSpot":"fromSpot",V.Spot.stringify(V.Spot.AllSides)),(t?o.toNode:o.fromNode).invalidateConnectedLinks()}))};return e(V.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 j(t,n){var o=0,i=V.Spot.RightSide;t.equals(V.Spot.Top)?(o=270,i=V.Spot.TopSide):t.equals(V.Spot.Left)?(o=180,i=V.Spot.LeftSide):t.equals(V.Spot.Bottom)&&(o=90,i=V.Spot.BottomSide),n||(o-=180);var a=function(e,t){e.handled=!0,e.diagram.model.commit((function(e){var o=t.part.adornedPart;e.set(o.data,n?"toSpot":"fromSpot",V.Spot.stringify(i)),(n?o.toNode:o.fromNode).invalidateConnectedLinks()}))};return e(V.Shape,{alignment:t,alignmentFocus:t.opposite(),geometryString:"M0 0 M12 12 M12 6 L1 6 L4 4 M1 6 L4 8",angle:o,background:"transparent",mouseEnter:function(e,t){return t.background="dodgerblue"},mouseLeave:function(e,t){return t.background="transparent"},click:a,contextClick:a})}return o.current=new V.Diagram(i.current,{padding:20,grid:e(V.Panel,"Grid",e(V.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(V.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(U),"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}),o.current.nodeTemplate=e(V.Node,"Auto",{locationSpot:V.Spot.Center,locationObjectName:"SHAPE",desiredSize:new V.Size(120,60),minSize:new V.Size(40,40),resizable:!0,resizeCellSize:new V.Size(10,10),rotatable:!0},new V.Binding("location","loc",V.Point.parse).makeTwoWay(V.Point.stringify),new V.Binding("desiredSize","size",V.Size.parse).makeTwoWay(V.Size.stringify),e(V.Shape,{name:"SHAPE",fill:d,cursor:"pointer",portId:"",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:V.Spot.AllSides,toSpot:V.Spot.AllSides},new V.Binding("figure"),new V.Binding("fill"),new V.Binding("stroke","borderColor"),new V.Binding("strokeWidth","thickness"),new V.Binding("strokeDashArray","dash")),e(V.Shape,{width:100,height:20,strokeWidth:0,fill:"transparent"}),e(V.TextBlock,{margin:1,textAlign:"center",overflow:V.TextBlock.OverflowEllipsis,editable:!0},new V.Binding("text").makeTwoWay(),new V.Binding("stroke","color"))),o.current.nodeTemplate.toolTip=e("ToolTip",e(V.Panel,"Vertical",{maxSize:new V.Size(200,NaN)},e(V.TextBlock,{font:"bold 10pt sans-serif",textAlign:"center"},new V.Binding("text")),e(V.TextBlock,{font:"10pt sans-serif",textAlign:"center"},new V.Binding("text","details")))),o.current.nodeTemplate.selectionAdornmentTemplate=e(V.Adornment,"Spot",e(V.Placeholder,{padding:10}),b(V.Spot.Top,"TriangleUp"),b(V.Spot.Left,"TriangleLeft"),b(V.Spot.Right,"TriangleRight"),b(V.Spot.Bottom,"TriangleDown"),y({alignment:new V.Spot(.75,0)})),o.current.nodeTemplate.contextMenu=e("ContextMenu",e("ContextMenuButton",e(V.Panel,"Horizontal",P("Rectangle"),P("RoundedRectangle"),P("Ellipse"),P("Diamond"))),e("ContextMenuButton",e(V.Panel,"Horizontal",P("Parallelogram2"),P("ManualOperation"),P("Procedure"),P("Cylinder1"))),e("ContextMenuButton",e(V.Panel,"Horizontal",P("Terminator"),P("CreateRequest"),P("Document"),P("TriangleDown"))),S(),_(),C()),o.current.groupTemplate=e(V.Group,"Spot",{layerName:"Background",ungroupable:!0,locationSpot:V.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 V.Binding("location","loc",V.Point.parse).makeTwoWay(V.Point.stringify),e(V.Panel,"Auto",{name:"BODY"},e(V.Shape,{parameter1:10,fill:d,strokeWidth:2,cursor:"pointer",fromLinkable:!0,toLinkable:!0,fromLinkableDuplicates:!0,toLinkableDuplicates:!0,fromSpot:V.Spot.AllSides,toSpot:V.Spot.AllSides},new V.Binding("fill"),new V.Binding("stroke","color"),new V.Binding("strokeWidth","thickness"),new V.Binding("strokeDashArray","dash")),e(V.Placeholder,{background:"transparent",margin:20})),e(V.TextBlock,{alignment:V.Spot.Top,alignmentFocus:V.Spot.Bottom,font:"bold 12pt sans-serif",editable:!0},new V.Binding("text"),new V.Binding("stroke","color"))),o.current.groupTemplate.selectionAdornmentTemplate=e(V.Adornment,"Spot",e(V.Panel,"Auto",e(V.Shape,{fill:null,stroke:"dodgerblue",strokeWidth:3}),e(V.Placeholder,{margin:1.5})),y({alignment:V.Spot.TopRight,alignmentFocus:V.Spot.BottomRight})),o.current.groupTemplate.contextMenu=e("ContextMenu",S(),_(),C()),o.current.linkTemplate=e(V.Link,{layerName:"Foreground",routing:V.Link.AvoidsNodes,corner:10,fromShortLength:10,toShortLength:15,relinkableFrom:!0,relinkableTo:!0,reshapable:!0,resegmentable:!0},new V.Binding("fromSpot","fromSpot",V.Spot.parse),new V.Binding("toSpot","toSpot",V.Spot.parse),new V.Binding("fromShortLength","dir",(function(e){return e>=1?10:0})),new V.Binding("toShortLength","dir",(function(e){return e>=1?10:0})),new V.Binding("points").makeTwoWay(),e(V.Shape,{strokeWidth:2},new V.Binding("stroke","color"),new V.Binding("strokeWidth","thickness"),new V.Binding("strokeDashArray","dash")),e(V.Shape,{segmentIndex:0,segmentOffset:new V.Point(15,0),segmentOrientation:V.Link.OrientAlong,alignmentFocus:V.Spot.Right,figure:"circle",width:10,strokeWidth:0},new V.Binding("fill","color"),new V.Binding("visible","dir",(function(e){return 1===e}))),e(V.Shape,{segmentIndex:-1,segmentOffset:new V.Point(-10,6),segmentOrientation:V.Link.OrientPlus90,alignmentFocus:V.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new V.Binding("fill","color"),new V.Binding("visible","dir",(function(e){return e>=1})),new V.Binding("width","thickness",(function(e){return 7+3*e})),new V.Binding("height","thickness",(function(e){return 7+3*e})),new V.Binding("segmentOffset","thickness",(function(e){return new V.Point(-15,4+1.5*e)}))),e(V.Shape,{segmentIndex:0,segmentOffset:new V.Point(15,-6),segmentOrientation:V.Link.OrientMinus90,alignmentFocus:V.Spot.Right,figure:"triangle",width:12,height:12,strokeWidth:0},new V.Binding("fill","color"),new V.Binding("visible","dir",(function(e){return 2===e})),new V.Binding("width","thickness",(function(e){return 7+3*e})),new V.Binding("height","thickness",(function(e){return 7+3*e})),new V.Binding("segmentOffset","thickness",(function(e){return new V.Point(-15,4+1.5*e)}))),e(V.TextBlock,{alignmentFocus:new V.Spot(0,1,-4,0),editable:!0},new V.Binding("text").makeTwoWay(),new V.Binding("stroke","color"))),o.current.linkTemplate.selectionAdornmentTemplate=e(V.Adornment,e(V.Shape,{isPanelMain:!0,stroke:"transparent",strokeWidth:6,pathPattern:E(2)},new V.Binding("pathPattern","thickness",E)),y({alignmentFocus:new V.Spot(0,0,-6,-4)})),o.current.linkTemplate.contextMenu=e("ContextMenu",_(),C(),e("ContextMenuButton",e(V.Panel,"Horizontal",L(0),L(1),L(2))),e("ContextMenuButton",e(V.Panel,"Horizontal",e(V.Panel,"Spot",N(!1),j(V.Spot.Top,!1),j(V.Spot.Left,!1),j(V.Spot.Right,!1),j(V.Spot.Bottom,!1)),e(V.Panel,"Spot",{margin:new V.Margin(0,0,0,2)},N(!0),j(V.Spot.Top,!0),j(V.Spot.Left,!0),j(V.Spot.Right,!0),j(V.Spot.Bottom,!0))))),new V.Palette(a.current,{maxSelectionCount:1,linkTemplate:e(V.Link,{locationSpot:V.Spot.Center,selectionAdornmentTemplate:e(V.Adornment,"Link",{locationSpot:V.Spot.Center},e(V.Shape,{isPanelMain:!0,fill:null,stroke:"deepskyblue",strokeWidth:0}),e(V.Shape,{toArrow:"Standard",stroke:null}))},{routing:V.Link.AvoidsNodes,curve:V.Link.JumpOver,corner:5,toShortLength:4},new V.Binding("points"),e(V.Shape,{isPanelMain:!0,strokeWidth:2}),e(V.Shape,{toArrow:"Standard",stroke:null})),model:new V.GraphLinksModel([{text:"未命名",size:"100 100",fill:null,stroke:"#000"}].concat(z()(V.Shape.getFigureGenerators().toArray().map((function(e){return{text:"未命名",size:"100 100",figure:e.key,fill:"white",stroke:"#666",borderColor:"#000"}})))))}).nodeTemplate=e(V.Node,"Auto",{locationSpot:V.Spot.Center},new V.Binding("location","location",V.Point.parse).makeTwoWay(V.Point.stringify),e(V.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 V.Binding("stroke").makeTwoWay(),new V.Binding("fill").makeTwoWay(),new V.Binding("figure")),e(V.TextBlock,{margin:new V.Margin(5,5,3,5),font:"10pt sans-serif",minSize:new V.Size(16,16),maxSize:new V.Size(10,NaN),textAlign:"center",editable:!0},new V.Binding("key").makeTwoWay())),setTimeout((function(){o.current.grid=e(V.Panel,"Grid",e(V.Shape,"LineH",{stroke:"lightgray",strokeWidth:.5}),e(V.Shape,"LineV",{stroke:"lightgray",strokeWidth:.5})),o.current.grid.visible=!0,o.current.grid.gridCellStroke="darkgray",o.current.grid.gridCellStrokeWidth=1}),300),window.myDiagrams=o.current,o.current},divClassName:"diagram-component",style:{height:"80vh"}}),(0,h.jsx)("div",{ref:i})]})]}),(0,h.jsx)("div",{className:"tr",children:(0,h.jsx)(_.ZP,{size:"large",onClick:m,style:{position:"absolute",right:0,bottom:0,zIndex:8},type:"primary",children:"保存到编辑器"})})]})})})},te=n(5112),ne=n(97913),oe=te.ZP.Group,ie={margin:"0 8px"},ae=function(e){var t=e.callback,n=e.onCancel;return(0,h.jsxs)(k.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:ie,children:"单元格数:"}),(0,h.jsx)("span",{style:ie,children:"行数"}),(0,h.jsx)(k.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,h.jsx)(ne.Z,{})}),(0,h.jsx)("span",{style:ie,children:"列数"}),(0,h.jsx)(k.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,h.jsx)(ne.Z,{})})]}),(0,h.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,h.jsx)("span",{style:ie,children:"对齐方式:"}),(0,h.jsx)(k.Z.Item,{name:"align",children:(0,h.jsxs)(oe,{children:[(0,h.jsx)(te.ZP,{value:"default",children:(0,h.jsx)("i",{className:"fa fa-align-justify"})}),(0,h.jsx)(te.ZP,{value:"left",children:(0,h.jsx)("i",{className:"fa fa-align-left"})}),(0,h.jsx)(te.ZP,{value:"center",children:(0,h.jsx)("i",{className:"fa fa-align-center"})}),(0,h.jsx)(te.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)(_.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,h.jsx)(_.ZP,{type:"ghost",onClick:n,children:"取消"})]})]})},re=n(78673),le=n(66455),se=n.n(le),ce=(0,c.forwardRef)((function(e,t){var n=e.use3d,o=e.width,i=e.height,a=e.callback,l=(e.showSaveButton,(0,c.useRef)()),s=(0,c.useRef)(),d=(0,c.useState)(!1),u=r()(d,2),f=u[0],p=u[1],m=(0,c.useRef)({id:l,appName:"graphing",width:o||1e3,height:i||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(se())(m.current,!0),window.onload=function(){s.current.inject("applet_container")}}),[]);var g=function(){var e=window.ggbApplet.getPNGBase64(1,!0,72);return a&&a(e),e};return(0,c.useEffect)((function(){m.current.appName=f?"3D":"graphing",s.current.inject("applet_container")}),[f]),(0,c.useEffect)((function(){p(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)(O.Z,{align:"middle",children:[(0,h.jsx)(J.Z,{flex:1,children:(0,h.jsx)(re.Z,{size:"default",checkedChildren:"关闭3D图像",unCheckedChildren:"开启3D图像",checked:f,onChange:function(e){return p(e)}})}),(0,h.jsx)(J.Z,{children:(0,h.jsx)(_.ZP,{size:"large",onClick:g,style:{zIndex:8,marginTop:10},type:"primary",children:"保存到编辑器"})})]})]})})),de=n(33773),ue=n(27065),fe="link",pe="upload-image",he="add-flowchart",me="draw-image",ge="code-block",we="add-table",ve="------------",be={default:ve,left:":".concat(ve),center:":".concat(ve,":"),right:"".concat(ve,":")},ye=n(56266);var xe="@▁▁@",ke=["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 Se(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var _e=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",Be=s()(s()({},_e+"-B","bold"),_e+"-I","italic"),Te=s()(s()(s()(s()(s()(s()(s()(s()({},fe,"添加链接"),ge,"添加代码块"),pe,"添加图片"),me,"添加画图"),he,"插入流程图"),we,"添加表格"),"maths-latex","数学图像"),"inline-latex","LATEX公式"),Ce=function(e){var t=e.defaultValue,n=void 0===t?"":t,o=e.onChange,a=e.width,l=void 0===a?"100%":a,d=e.height,g=void 0===d?400:d,w=e.miniToolbar,v=void 0!==w&&w,b=e.isFocus,k=void 0!==b&&b,S=e.watch,_=e.insertTemp,B=e.mode,E=void 0===B?"markdown":B,L=e.id,N=void 0===L?"markdown-editor-id":L,j=e.showResizeBar,M=void 0!==j&&j,O=e.noStorage,R=void 0!==O&&O,D=e.showNullButton,I=void 0!==D&&D,W=e.showNullProgramButton,H=void 0!==W&&W,Z=e.hidetoolBar,z=void 0!==Z&&Z,V=e.fullScreen,q=void 0!==V&&V,U=e.onBlur,K=e.onCMBeforeChange,J=e.onFullScreen,X=e.className,$=void 0===X?"":X,Q=e.disablePaste,te=void 0!==Q&&Q,ne=e.disabled,oe=void 0!==ne&&ne,ie=e.disabledFill,re=void 0!==ie&&ie,le=e.placeholder,se=void 0===le?"":le,ve=e.values,_e=void 0===ve?"":ve,Ce=e.extraUse,Pe=(0,c.useState)(null),Ee=r()(Pe,2),Le=Ee[0],Ne=Ee[1],je=(0,c.useState)(n),Ae=r()(je,2),Me=Ae[0],Ge=Ae[1],Oe=(0,c.useState)(S),Re=r()(Oe,2),Fe=Re[0],De=Re[1],Ie=(0,c.useState)(q),We=r()(Ie,2),He=We[0],Ze=We[1],ze=(0,c.useState)(""),Ve=r()(ze,2),qe=Ve[0],Ue=Ve[1],Ke=(0,c.useState)(0),Ye=r()(Ke,2),Je=Ye[0],Xe=Ye[1],$e=(0,c.useState)(g),Qe=r()($e,2),et=Qe[0],tt=Qe[1],nt=(0,c.useState)(!1),ot=r()(nt,2),it=(ot[0],ot[1]),at=(0,c.useState)(0),rt=r()(at,2),lt=rt[0],st=rt[1],ct=(0,c.useState)(0),dt=r()(ct,2),ut=dt[0],ft=dt[1],pt=(0,c.useRef)(),ht=(0,c.useRef)(),mt=(0,c.useRef)(),gt=(0,c.useRef)();(0,c.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ge(_e),null==Le||Le.setValue(_e),window.scrollTo(0,e)}),[_e]),(0,c.useEffect)((function(){null==J||J(He)}),[He]),(0,c.useEffect)((function(){if(pt.current){var e=function(e,n){if(!te){var o=n.clipboardData;if(o){var i=o.types.toString(),a=o.items;if("Files"===i||o.types.indexOf("Files")>-1){if(n.preventDefault(),"stex"==E)return;try{var r,l=a[1];"file"===(null===(r=a[0])||void 0===r?void 0:r.kind)&&(l=a[0]);var s=l.getAsFile(),c=s.name.split(".").pop();G(s,(function(e){var n,o,i;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===(o=s.type)||void 0===o?void 0:o.indexOf("video"))>-1?t.replaceSelection('')):(null==s||null===(i=s.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?t.replaceSelection('').concat(s.name,"")):ke.includes(c)?t.replaceSelection('').concat(s.name,"")):t.replaceSelection("[".concat(s.name,"](").concat(ue.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){P.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}n.preventDefault()},t=u().fromTextArea(pt.current,{mode:E,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",se):t.setOption("placeholder",null))})),t.on("keydown",(function(e,t){if(8===t.keyCode){var n=function(e,t){var n=e.getDoc(),o=n.getCursor(),i=n.getLine(o.line),a=i.charAt(o.ch-1),r=i.lastIndexOf("@▁@",o.ch),l=i.lastIndexOf("@▁▁@",o.ch),s=r>l?r:l,c=r>l?3:4;if(-1===xe.indexOf(a))return null;if(console.log("change1:",t,e,i,o,s,r,l,a),s>=0&&o.ch-s<5){var d=s+c;return n.replaceRange("",{line:o.line,ch:s},{line:o.line,ch:d}),{line:o.line,ch:d}}return null}(e);n&&t.preventDefault()}})),k&&t.focus(),t.on("paste",e),oe&&t.on("beforeChange",(function(e,t){"paste"!==t.origin&&"+input"!==t.origin||t.cancel()})),Ne(t),function(){t.off("paste",e)}}}),[]);var wt=(0,c.useCallback)((function(){ht.current}),[et,ht,He]);(0,c.useEffect)((function(){if(Le){var e=function(){var e=new f.Z((function(e){var t,n=i()(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;(o.target.offsetHeight>0||o.target.offsetWidth>0)&&(wt(),Le.setSize("100%","100%"),Le.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)}}}),[Le,wt]),(0,c.useEffect)((function(){if(Le){for(var e=[],t=function(){var t=r()(o[n],2),i=t[0],a=t[1],l=s()({},i,(function(){vt(a)}));e.push(l),Le.addKeyMap(l)},n=0,o=Object.entries(Be);n0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(N);e>=Je+1e4&&(!t||t!==Me)&&(window.sessionStorage.setItem(N,Me),it(!0))}}),1e4),(0,c.useEffect)((function(){De(S)}),[Le,S]),(0,c.useEffect)((function(){Le&&k&&Le.focus()}),[Le,k]),(0,c.useEffect)((function(){if(Fe&&Le){var e=function(e){var t=e.target;if(gt.current){var n=t.scrollTop/t.scrollHeight;gt.current.scrollTop=gt.current.scrollHeight*n}},t=Le.getScrollerElement();return t.addEventListener("scroll",e),function(){t.removeEventListener("scroll",e)}}}),[Le,Fe]),(0,c.useEffect)((function(){if(Le&&K){var e=function(e,t){K(e,t)};return Le.on("beforeChange",e),function(){Le.off("beforeChange",e)}}}),[Le,K]),(0,c.useEffect)((function(){if(Le&&U){var e=function(){U(Le.getValue())};return Le.on("blur",e),function(){Le.off("blur",e)}}}),[Le,U]),(0,c.useEffect)((function(){if(Le){var e=function(e,t){var n=e.getValue();Ge(n),Xe((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),o&&(H?o(n,St(n)):o(n))};return Le.on("change",e),function(){Le.off("change",e)}}}),[Le,o]),(0,c.useEffect)((function(){if(Le)if(null==n)Le.setValue(""),Ge("");else{var e=window.scrollY||window.pageYOffset;n!==Le.getValue()&&(Le.setValue(n),Ge(n),Le.setCursor(oe?1:Le.lineCount(),0),window.scrollTo(0,e))}}),[Le,n]);var vt=(0,c.useCallback)((function(e){var t=Le.getCursor(),n=Le.getSelection(),o=n.split("\n");switch(e){case"bold":return Le.replaceSelection("**"+n+"**"),""===n&&Le.setCursor(t.line,t.ch+2),Le.focus();case"italic":return Le.replaceSelection("*"+n+"*"),""===n&&Le.setCursor(t.line,t.ch+1),Le.focus();case"code":return Le.replaceSelection("`"+n+"`"),""===n&&Le.setCursor(t.line,t.ch+1),Le.focus();case"inline-latex":return Ue("inline-latex"),Le.focus();case"latex":return Le.replaceSelection("```latex\n"+n+"\n```"),Le.setCursor(t.line+1,n.length+1),Le.focus();case"line-break":return Le.replaceSelection("
\n"),Le.focus();case"list-ul":return""===n?Le.replaceSelection("- "+n):Le.replaceSelection(o.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Le.focus();case"list-ol":return""===n?Le.replaceSelection("1. "+n):Le.replaceSelection(o.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),Le.focus();case"add-null-ch":return""===n&&Le.setCursor(t.line,t.ch),Le.replaceSelection("▁"),Le.focus();case"add-signal":return""===n&&Le.setCursor(t.line,t.ch),Le.replaceSelection("@▁@"),Le.focus();case"add-multiple":return""===n&&Le.setCursor(t.line,t.ch),Le.replaceSelection(xe),Le.focus();case"inster-template-1":return""===n&&Le.setCursor(t.line,t.ch),Le.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),Le.focus();case"eraser":return Le.setValue(""),Le.focus();case"trigger-watch":return De(!Fe),Le.focus();case"trigger-full-screen":return Ze(!He),Le.focus();case fe:return void Ue(fe);case ge:return void Ue(ge);case pe:return void Ue(pe);case me:return void Ue(me);case"maths-latex":return void Ue("maths-latex");case he:return void Ue(he);case we:return void Ue(we);default:throw new Error}}),[Le,Fe,He]),bt=(0,c.useCallback)((function(e,t){var n,o,i,a,r;switch(Ue(""),qe){case fe:var l=e.title,s=e.link;return Le.replaceSelection("[".concat(l,"](").concat(s,")")),Le.focus();case ge:var c=e.language,d=e.content;return Le.replaceSelection(["```"+c,d,"```"].join("\n")),Le.focus();case"maths-latex":for(var u=atob(e),f=new Uint8Array(u.length),p=0;p-1||null==g||!g.type?m?Le.replaceSelection("![ ".concat(m," ]( ").concat(h,' "').concat(m,'" )')):Le.replaceSelection("![,](".concat(h,")")):(null==g||null===(a=g.type)||void 0===a?void 0:a.indexOf("video"))>-1?Le.replaceSelection('')):(null==g||null===(r=g.type)||void 0===r?void 0:r.indexOf("pdf"))>-1?Le.replaceSelection('').concat(g.name,"")):ke.includes(w)?Le.replaceSelection('').concat(g.name,"")):Le.replaceSelection("[".concat(g.name,"](").concat(ue.Z.API_SERVER).concat(h,")")),Le.focus();case we:for(var v=e.row,b=e.col,y=e.align,x="\n",k=0;k300&&(t=300),tt(g+t+"px")}},o=mt.current,i=!1,a=0;return o.addEventListener("mousedown",e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",t),function(){o.removeEventListener("mousedown",e),document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t)}}}),[Le,mt]),(0,c.useEffect)((function(){tt(g)}),[g]);var kt={width:Se(l),height:Se(et)},St=((0,c.useMemo)((function(){if(Je){var e=new Date(Je),t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return n=n<10?"0"+n:n,o=o<10?"0"+o:o,"".concat(t=t<10?"0"+t:t,":").concat(n,":").concat(o)}return 0}),[Je]),function(e){var t=[];if(H){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,n,o){t.push({multiLine:!("@▁@"===e)})}))}return t});(0,c.useEffect)((function(){if(Te[qe]&&qe!==me&&qe!==he){var e=document.getElementsByClassName("ant-modal")[0],t=window.innerWidth/2-e.offsetWidth/2,n=window.innerHeight/2-e.offsetHeight/2;st(t),ft(n)}}),[qe]);var _t=function(e,t,n,o){var i=document.body.clientHeight,a=document.body.clientWidth;return!(e<20&&n>e||e>a-20&&nt||t>i-20&&o