UNPKG

@zklogic/draw.io

Version:

Draw.IO - Graph Editor integration in Angular-cli

1 lines 57 kB
!function(){var e=mxPopupMenu.prototype.showMenu;mxPopupMenu.prototype.showMenu=function(){e.apply(this,arguments),this.div.style.overflowY="auto",this.div.style.overflowX="hidden";var t=Math.max(document.body.clientHeight,document.documentElement.clientHeight);this.div.style.maxHeight=t-10+"px"},Menus.prototype.createHelpLink=function(e){var t=document.createElement("span");t.setAttribute("title",mxResources.get("help")),t.style.cssText="color:blue;text-decoration:underline;margin-left:8px;cursor:help;";var n=document.createElement("img");return mxUtils.setOpacity(n,50),n.style.height="16px",n.style.width="16px",n.setAttribute("border","0"),n.setAttribute("valign","bottom"),n.setAttribute("src",Editor.helpImage),t.appendChild(n),mxEvent.addGestureListeners(t,mxUtils.bind(this,(function(t){this.editorUi.hideCurrentMenu(),this.editorUi.openLink(e),mxEvent.consume(t)}))),t},Menus.prototype.addLinkToItem=function(e,t){null!=e&&e.firstChild.nextSibling.appendChild(this.createHelpLink(t))};var t=Menus.prototype.init;Menus.prototype.init=function(){t.apply(this,arguments);var e=this.editorUi,n=e.editor.graph,i=mxUtils.bind(n,n.isEnabled);if(!mxClient.IS_SVG&&!e.isOffline()){var o=new Image;o.src=IMAGE_PATH+"/help.png"}"1"==urlParams.noFileMenu&&(this.defaultMenuItems=this.defaultMenuItems.filter((function(e){return"file"!=e}))),e.actions.put("insertTemplate",new Action(mxResources.get("template")+"...",(function(){if(n.isEnabled()&&!n.isCellLocked(n.getDefaultParent())){var t=new NewDialog(e,null,!1,(function(t){if(e.hideDialog(),null!=t){var i=e.editor.graph.getFreeInsertPoint();n.setSelectionCells(e.importXml(t,Math.max(i.x,20),Math.max(i.y,20),!0,null,null,!0)),n.scrollCellToVisible(n.getSelectionCell())}}),null,null,null,null,null,null,null,null,null,null,!1,mxResources.get("insert"));e.showDialog(t.container,620,460,!0,!0,(function(){e.sidebar.hideTooltip()})),t.init()}}))).isEnabled=i;var s=e.actions.addAction("points",(function(){e.editor.graph.view.setUnit(mxConstants.POINTS)}));s.setToggleAction(!0),s.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.POINTS}));var a=e.actions.addAction("inches",(function(){e.editor.graph.view.setUnit(mxConstants.INCHES)}));a.setToggleAction(!0),a.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.INCHES}));var l=e.actions.addAction("millimeters",(function(){e.editor.graph.view.setUnit(mxConstants.MILLIMETERS)}));l.setToggleAction(!0),l.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.MILLIMETERS}));var r=e.actions.addAction("meters",(function(){e.editor.graph.view.setUnit(mxConstants.METERS)}));r.setToggleAction(!0),r.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.METERS})),this.put("units",new Menu(mxUtils.bind(this,(function(e,t){this.addMenuItems(e,["points","inches","millimeters","meters"],t)}))));var d=e.actions.addAction("ruler",(function(){mxSettings.setRulerOn(!mxSettings.isRulerOn()),mxSettings.save(),null!=e.ruler?(e.ruler.destroy(),e.ruler=null,e.refresh()):(e.ruler=new mxDualRuler(e,e.editor.graph.view.unit),e.refresh())}));d.setEnabled(e.canvasSupported&&9!=document.documentMode),d.setToggleAction(!0),d.setSelectedCallback((function(){return null!=e.ruler}));var u=e.actions.addAction("fullscreen",(function(){"1"==urlParams.embedInline?e.setInlineFullscreen(!Editor.inlineFullscreen):null==document.fullscreenElement?document.body.requestFullscreen():document.exitFullscreen()}));u.visible="1"==urlParams.embedInline||document.fullscreenEnabled&&null!=document.body.requestFullscreen,u.setToggleAction(!0),u.setSelectedCallback((function(){return"1"==urlParams.embedInline?Editor.inlineFullscreen:null!=document.fullscreenElement})),e.actions.addAction("properties...",(function(){var t=new FilePropertiesDialog(e);e.showDialog(t.container,320,120,!0,!0),t.init()})).isEnabled=i,window.mxFreehand&&(e.actions.put("insertFreehand",new Action(mxResources.get("freehand")+"...",(function(t){n.isEnabled()&&(null==this.freehandWindow&&(this.freehandWindow=new FreehandWindow(e,e.container.offsetWidth-420,102,176,84)),n.freehand.isDrawing()?n.freehand.stopDrawing():n.freehand.startDrawing(),this.freehandWindow.window.setVisible(n.freehand.isDrawing()))}))).isEnabled=function(){return i()&&mxClient.IS_SVG}),e.actions.put("exportXml",new Action(mxResources.get("formatXml")+"...",(function(){var t=document.createElement("div");t.style.whiteSpace="nowrap";var i=null==e.pages||e.pages.length<=1,o=document.createElement("h3");mxUtils.write(o,mxResources.get("formatXml")),o.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px",t.appendChild(o);var s=e.addCheckbox(t,mxResources.get("selectionOnly"),!1,n.isSelectionEmpty()),a=e.addCheckbox(t,mxResources.get("compressed"),!0),l=e.addCheckbox(t,mxResources.get("allPages"),!i,i);l.style.marginBottom="16px",mxEvent.addListener(s,"change",(function(){s.checked?l.setAttribute("disabled","disabled"):l.removeAttribute("disabled")}));var r=new CustomDialog(e,t,mxUtils.bind(this,(function(){e.downloadFile("xml",!a.checked,null,!s.checked,i||!l.checked)})),null,mxResources.get("export"));e.showDialog(r.container,300,200,!0,!0)}))),Editor.enableExportUrl&&e.actions.put("exportUrl",new Action(mxResources.get("url")+"...",(function(){e.showPublishLinkDialog(mxResources.get("url"),!0,null,null,(function(t,n,i,o,s,a,l,r,d){var u=[];d&&u.push("tags=%7B%7D");var c=new EmbedDialog(e,e.createLink(t,n,i,o,s,a,null,!0,u));e.showDialog(c.container,450,240,!0,!0),c.init()}))}))),e.actions.put("exportHtml",new Action(mxResources.get("formatHtmlEmbedded")+"...",(function(){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(t){e.spinner.stop(),e.showHtmlDialog(mxResources.get("export"),null,t,(function(t,n,i,o,s,a,l,r,d,u,c){e.createHtml(t,n,i,o,s,a,l,r,d,u,c,mxUtils.bind(this,(function(t,n){var i=e.getBaseFilename(l),o='\x3c!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]--\x3e\n<!DOCTYPE html>\n<html>\n<head>\n<title>'+mxUtils.htmlEntities(i)+'</title>\n<meta charset="utf-8"/>\n</head>\n<body>'+t+"\n"+n+"\n</body>\n</html>";e.saveData(i+(".drawio"==i.substring(i.lenth-7)?"":".drawio")+".html","html",o,"text/html")})))}))}))}))),e.actions.put("exportPdf",new Action(mxResources.get("formatPdf")+"...",(function(){if(EditorUi.isElectronApp||!e.isOffline()&&!e.printPdfExport){var t=null==e.pages||e.pages.length<=1,i=document.createElement("div");i.style.whiteSpace="nowrap";var o=document.createElement("h3");mxUtils.write(o,mxResources.get("formatPdf")),o.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px",i.appendChild(o);var s=function(){d!=this&&this.checked?(f.removeAttribute("disabled"),f.checked=!n.pageVisible):(f.setAttribute("disabled","disabled"),f.checked=!1)},a=200,l=1,r=null;if(e.pdfPageExport&&!t){var d=e.addRadiobox(i,"pages",mxResources.get("allPages"),!0),u=e.addRadiobox(i,"pages",mxResources.get("pages")+":",!1,null,!0),c=document.createElement("input");c.style.cssText="margin:0 8px 0 8px;",c.setAttribute("value","1"),c.setAttribute("type","number"),c.setAttribute("min","1"),c.style.width="50px",i.appendChild(c);var m=document.createElement("span");mxUtils.write(m,mxResources.get("to")),i.appendChild(m);var g=c.cloneNode(!0);function p(){g.value=Math.max(1,Math.min(l,Math.max(parseInt(g.value),parseInt(c.value)))),c.value=Math.max(1,Math.min(l,Math.min(parseInt(g.value),parseInt(c.value))))}if(i.appendChild(g),mxEvent.addListener(c,"focus",(function(){u.checked=!0})),mxEvent.addListener(g,"focus",(function(){u.checked=!0})),mxEvent.addListener(c,"change",p),mxEvent.addListener(g,"change",p),null!=e.pages&&(l=e.pages.length,null!=e.currentPage))for(var h=0;h<e.pages.length;h++)if(e.currentPage==e.pages[h]){r=h+1,c.value=r,g.value=r;break}c.setAttribute("max",l),g.setAttribute("max",l),mxUtils.br(i);var x=e.addRadiobox(i,"pages",mxResources.get("selectionOnly"),!1,n.isSelectionEmpty()),f=e.addCheckbox(i,mxResources.get("crop"),!1,!0),w=e.addCheckbox(i,mxResources.get("grid"),!1,!1);mxEvent.addListener(d,"change",s),mxEvent.addListener(u,"change",s),mxEvent.addListener(x,"change",s),a+=64}else x=e.addCheckbox(i,mxResources.get("selectionOnly"),!1,n.isSelectionEmpty()),f=e.addCheckbox(i,mxResources.get("crop"),!n.pageVisible||!e.pdfPageExport,!e.pdfPageExport),w=e.addCheckbox(i,mxResources.get("grid"),!1,!1),e.pdfPageExport||mxEvent.addListener(x,"change",s);var b=!mxClient.IS_CHROMEAPP&&!EditorUi.isElectronApp&&"draw.io"==e.getServiceName(),v=null,E=null;(EditorUi.isElectronApp||b)&&(E=e.addCheckbox(i,mxResources.get("includeCopyOfMyDiagram"),Editor.defaultIncludeDiagram),a+=30),b&&(v=e.addCheckbox(i,mxResources.get("transparentBackground"),!1),a+=30);var S=new CustomDialog(e,i,mxUtils.bind(this,(function(){var n=null;if(!t){var i=parseInt(c.value),o=parseInt(g.value);n=d.checked||i==r&&o==r?null:{from:Math.max(0,Math.min(l-1,i-1)),to:Math.max(0,Math.min(l-1,o-1))}}e.downloadFile("pdf",null,null,!x.checked,!!t||!d.checked&&null==n,!f.checked,null!=v&&v.checked,null,null,w.checked,null!=E&&E.checked,n)})),null,mxResources.get("export"));e.showDialog(S.container,300,a,!0,!0)}else e.showDialog(new PrintDialog(e,mxResources.get("formatPdf")).container,360,null!=e.pages&&e.pages.length>1&&(e.editor.editable||"1"!=urlParams["hide-pages"])?450:370,!0,!0)}))),e.actions.addAction("open...",(function(){e.pickFile()})),e.actions.addAction("close",(function(){var t=e.getCurrentFile();function n(){null!=t&&t.removeDraft(),e.fileLoaded(null)}null!=t&&t.isModified()?e.confirm(mxResources.get("allChangesLost"),null,n,mxResources.get("cancel"),mxResources.get("discardChanges")):n()})),e.actions.addAction("editShape...",mxUtils.bind(this,(function(){if(n.getSelectionCells(),1==n.getSelectionCount()){var t=n.getSelectionCell(),i=n.view.getState(t);if(null!=i&&null!=i.shape&&null!=i.shape.stencil){var o=new EditShapeDialog(e,t,mxResources.get("editShape")+":",630,400);e.showDialog(o.container,640,480,!0,!1),o.init()}}}))),e.actions.addAction("revisionHistory...",(function(){e.isRevisionHistorySupported()?e.spinner.spin(document.body,mxResources.get("loading"))&&e.getRevisions(mxUtils.bind(this,(function(t,n){e.spinner.stop();var i=new RevisionDialog(e,t,n);e.showDialog(i.container,640,480,!0,!0),i.init()})),mxUtils.bind(this,(function(t){e.handleError(t)}))):e.showError(mxResources.get("error"),mxResources.get("notAvailable"),mxResources.get("ok"))})),e.actions.addAction("createRevision",(function(){e.actions.get("save").funct()}),null,null,Editor.ctrlKey+"+S");var c=e.actions.addAction("synchronize",(function(){e.synchronizeCurrentFile("none"==DrawioFile.SYNC)}),null,null,"Alt+Shift+S");"none"==DrawioFile.SYNC&&(c.label=mxResources.get("refresh")),e.actions.addAction("upload...",(function(){var t=e.getCurrentFile();if(null!=t){window.drawdata=e.getFileData();var n=null!=t.getTitle()?t.getTitle():e.defaultFilename;e.openLink(window.location.protocol+"//"+window.location.host+"/?create=drawdata&"+(e.mode==App.MODE_DROPBOX?"mode=dropbox&":"")+"title="+encodeURIComponent(n),null,!0)}})),"undefined"!=typeof MathJax&&((c=e.actions.addAction("mathematicalTypesetting",(function(){var t=new ChangePageSetup(e);t.ignoreColor=!0,t.ignoreImage=!0,t.mathEnabled=!e.isMathEnabled(),n.model.execute(t)}))).setToggleAction(!0),c.setSelectedCallback((function(){return e.isMathEnabled()})),c.isEnabled=i),isLocalStorage&&((c=e.actions.addAction("showStartScreen",(function(){mxSettings.setShowStartScreen(!mxSettings.getShowStartScreen()),mxSettings.save()}))).setToggleAction(!0),c.setSelectedCallback((function(){return mxSettings.getShowStartScreen()}))),e.actions.addAction("editGeometry...",(function(){for(var t=n.getSelectionCells(),i=[],o=0;o<t.length;o++)n.getModel().isVertex(t[o])&&i.push(t[o]);if(i.length>0){var s=new EditGeometryDialog(e,i);e.showDialog(s.container,200,270,!0,!0),s.init()}}),null,null,Editor.ctrlKey+"+Shift+M");var m=null;if(e.actions.addAction("copyStyle",(function(){n.isEnabled()&&!n.isSelectionEmpty()&&(m=n.copyStyle(n.getSelectionCell()))}),null,null,Editor.ctrlKey+"+Shift+C"),e.actions.addAction("pasteStyle",(function(){n.isEnabled()&&!n.isSelectionEmpty()&&null!=m&&n.pasteStyle(m,n.getSelectionCells())}),null,null,Editor.ctrlKey+"+Shift+V"),e.actions.put("pageBackgroundImage",new Action(mxResources.get("backgroundImage")+"...",(function(){if(!e.isOffline()){var t=new BackgroundImageDialog(e,(function(t){e.setBackgroundImage(t)}));e.showDialog(t.container,320,170,!0,!0),t.init()}}))),e.actions.put("exportSvg",new Action(mxResources.get("formatSvg")+"...",(function(){e.showExportDialog(mxResources.get("formatSvg"),!0,mxResources.get("export"),"https://www.diagrams.net/doc/faq/export-diagram",mxUtils.bind(this,(function(t,n,i,o,s,a,l,r,d,u,c,m,g,p){var h=parseInt(t);!isNaN(h)&&h>0&&e.exportSvg(h/100,n,i,o,s,a,l,!r,!1,u,m,g,p)})),!0,null,"svg",!0)}))),e.actions.put("exportPng",new Action(mxResources.get("formatPng")+"...",(function(){e.isExportToCanvas()?e.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://www.diagrams.net/doc/faq/export-diagram",mxUtils.bind(this,(function(t,n,i,o,s,a,l,r,d,u,c,m,g){var p=parseInt(t);!isNaN(p)&&p>0&&e.exportImage(p/100,n,i,o,s,l,!r,!1,null,c,null,m,g)})),!0,Editor.defaultIncludeDiagram,"png",!0):e.isOffline()||mxClient.IS_IOS&&navigator.standalone||e.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,(function(t,n,i,o,s){e.downloadFile(n?"xmlpng":"png",null,null,t,null,null,i,o,s)})),!1,!0)}))),e.actions.put("exportJpg",new Action(mxResources.get("formatJpg")+"...",(function(){e.isExportToCanvas()?e.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://www.diagrams.net/doc/faq/export-diagram",mxUtils.bind(this,(function(t,n,i,o,s,a,l,r,d,u,c,m,g){var p=parseInt(t);!isNaN(p)&&p>0&&e.exportImage(p/100,!1,i,o,!1,l,!r,!1,"jpeg",c,null,m,g)})),!0,!1,"jpeg",!0):e.isOffline()||mxClient.IS_IOS&&navigator.standalone||e.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,(function(t,n,i,o,s){e.downloadFile("jpeg",null,null,t,null,null,null,o,s)})),!0,!0)}))),(c=e.actions.addAction("copyAsImage",mxUtils.bind(this,(function(){var t=mxUtils.sortCells(n.model.getTopmostCells(n.getSelectionCells())),i=mxUtils.getXml(0==t.length?e.editor.getGraphXml():n.encodeCells(t));e.copyImage(t,i)})))).visible=Editor.enableNativeCipboard&&e.isExportToCanvas()&&!mxClient.IS_SF,(c=e.actions.put("shadowVisible",new Action(mxResources.get("shadow"),(function(){n.setShadowVisible(!n.shadowVisible)})))).setToggleAction(!0),c.setSelectedCallback((function(){return n.shadowVisible})),e.actions.put("about",new Action(mxResources.get("about")+" "+EditorUi.VERSION+"...",(function(){e.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?e.alert(e.editor.appName+" "+EditorUi.VERSION):e.openLink("https://www.diagrams.net/")}))),e.actions.addAction("support...",(function(){EditorUi.isElectronApp?e.openLink("https://github.com/jgraph/drawio-desktop/wiki/Getting-Support"):e.openLink("https://github.com/jgraph/drawio/wiki/Getting-Support")})),e.actions.addAction("exportOptionsDisabled...",(function(){e.handleError({message:mxResources.get("exportOptionsDisabledDetails")},mxResources.get("exportOptionsDisabled"))})),e.actions.addAction("keyboardShortcuts...",(function(){!mxClient.IS_SVG||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?e.openLink("https://viewer.diagrams.net/#Uhttps%3A%2F%2Fviewer.diagrams.net%2Fshortcuts.svg"):e.openLink("shortcuts.svg")})),e.actions.addAction("feedback...",(function(){var t=new FeedbackDialog(e);e.showDialog(t.container,610,360,!0,!1),t.init()})),e.actions.addAction("quickStart...",(function(){e.openLink("https://www.youtube.com/watch?v=Z0D96ZikMkc")})),(c=e.actions.addAction("tags",mxUtils.bind(this,(function(){null==this.tagsWindow?(this.tagsWindow=new TagsWindow(e,e.container.offsetWidth-400,60,212,200),this.tagsWindow.window.addListener("show",mxUtils.bind(this,(function(){e.fireEvent(new mxEventObject("tags")),this.tagsWindow.window.fit()}))),this.tagsWindow.window.addListener("hide",(function(){e.fireEvent(new mxEventObject("tags"))})),this.tagsWindow.window.setVisible(!0),e.fireEvent(new mxEventObject("tags"))):this.tagsWindow.window.setVisible(!this.tagsWindow.window.isVisible())})))).setToggleAction(!0),c.setSelectedCallback(mxUtils.bind(this,(function(){return null!=this.tagsWindow&&this.tagsWindow.window.isVisible()}))),(c=e.actions.addAction("findReplace...",mxUtils.bind(this,(function(t,i){var o=n.isEnabled()&&(null==i||!mxEvent.isShiftDown(i)),s=o?"findReplace":"find",a=s+"Window";if(null==this[a]){var l=o?"min"==uiTheme?330:300:240,r=o?"min"==uiTheme?304:288:170;this[a]=new FindWindow(e,e.container.offsetWidth-(l+20),100,l,r,o),this[a].window.addListener("show",(function(){e.fireEvent(new mxEventObject(s))})),this[a].window.addListener("hide",(function(){e.fireEvent(new mxEventObject(s))})),this[a].window.setVisible(!0)}else this[a].window.setVisible(!this[a].window.isVisible())})),null,null,Editor.ctrlKey+"+F")).setToggleAction(!0),c.setSelectedCallback(mxUtils.bind(this,(function(){var e=n.isEnabled()?"findReplaceWindow":"findWindow";return null!=this[e]&&this[e].window.isVisible()}))),e.actions.put("exportVsdx",new Action(mxResources.get("formatVsdx")+" (beta)...",(function(){var t=null==e.pages||e.pages.length<=1;if(t)e.exportVisio();else{var n=document.createElement("div");n.style.whiteSpace="nowrap";var i=document.createElement("h3");mxUtils.write(i,mxResources.get("formatVsdx")),i.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px",n.appendChild(i);var o=e.addCheckbox(n,mxResources.get("allPages"),!t,t);o.style.marginBottom="16px";var s=new CustomDialog(e,n,mxUtils.bind(this,(function(){e.exportVisio(!o.checked)})),null,mxResources.get("export"));e.showDialog(s.container,300,130,!0,!0)}}))),isLocalStorage&&null!=localStorage&&"1"!=urlParams.embed&&e.actions.addAction("configuration...",(function(){var t=localStorage.getItem(Editor.configurationKey),n=[[mxResources.get("reset"),function(t,n){e.confirm(mxResources.get("areYouSure"),(function(){try{localStorage.removeItem(Editor.configurationKey),mxEvent.isShiftDown(t)&&(localStorage.removeItem(".drawio-config"),localStorage.removeItem(".mode")),e.hideDialog(),e.alert(mxResources.get("restartForChangeRequired"))}catch(t){e.handleError(t)}}))}]],i=new TextareaDialog(e,mxResources.get("configuration")+":",null!=t?JSON.stringify(JSON.parse(t),null,2):"",(function(t){if(null!=t)try{if(t.length>0){var n=JSON.parse(t);localStorage.setItem(Editor.configurationKey,JSON.stringify(n))}else localStorage.removeItem(Editor.configurationKey);e.hideDialog(),e.alert(mxResources.get("restartForChangeRequired"))}catch(t){e.handleError(t)}}),null,null,null,null,null,!0,null,null,"https://www.diagrams.net/doc/faq/configure-diagram-editor",n);i.textarea.style.width="600px",i.textarea.style.height="380px",e.showDialog(i.container,620,460,!0,!1),i.init()})),mxClient.IS_CHROMEAPP||isLocalStorage){this.put("language",new Menu(mxUtils.bind(this,(function(t,n){var i=mxUtils.bind(this,(function(i){var o=""==i?mxResources.get("automatic"):mxLanguageMap[i],s=null;return""!=o&&(s=t.addItem(o,null,mxUtils.bind(this,(function(){mxSettings.setLanguage(i),mxSettings.save(),mxClient.language=i,mxResources.loadDefaultBundle=!1,mxResources.add(RESOURCE_BASE),e.alert(mxResources.get("restartForChangeRequired"))})),n),(i==mxLanguage||""==i&&null==mxLanguage)&&t.addCheckmark(s,Editor.checkmarkImage)),s}));for(var o in i(""),t.addSeparator(n),mxLanguageMap)i(o)}))));var g=Menus.prototype.createMenubar;Menus.prototype.createMenubar=function(t){var n=g.apply(this,arguments);if(null!=n&&"1"!=urlParams.noLangIcon){var i=this.get("language");if(null!=i){var o=n.addMenu("",i.funct);o.setAttribute("title",mxResources.get("language")),o.style.width="16px",o.style.paddingTop="2px",o.style.paddingLeft="4px",o.style.zIndex="1",o.style.position="absolute",o.style.display="block",o.style.cursor="pointer",o.style.right="17px","atlas"==uiTheme?(o.style.top="6px",o.style.right="15px"):"min"==uiTheme?o.style.top="2px":o.style.top="0px",EditorUi.isElectronApp&&(o.style.right="95px");var s=document.createElement("div");s.style.backgroundImage="url("+Editor.globeImage+")",s.style.backgroundPosition="center center",s.style.backgroundRepeat="no-repeat",s.style.backgroundSize="19px 19px",s.style.position="absolute",s.style.height="19px",s.style.width="19px",s.style.marginTop="2px",s.style.zIndex="1",o.appendChild(s),mxUtils.setOpacity(o,40),"atlas"!=uiTheme&&"dark"!=uiTheme||(o.style.opacity="0.85",o.style.filter="invert(100%)"),e.container.appendChild(o)||document.body.appendChild(o)}}return n}}e.customLayoutConfig=[{layout:"mxHierarchicalLayout",config:{orientation:"west",intraCellSpacing:30,interRankCellSpacing:100,interHierarchySpacing:60,parallelEdgeSpacing:10}}],e.actions.addAction("runLayout",(function(){var t=new TextareaDialog(e,"Run Layouts:",JSON.stringify(e.customLayoutConfig,null,2),(function(t){if(t.length>0)try{var n=JSON.parse(t);e.executeLayoutList(n),e.customLayoutConfig=n}catch(t){e.handleError(t),null!=window.console&&console.error(t)}}),null,null,null,null,null,!0,null,null,"https://www.diagrams.net/doc/faq/apply-layouts");t.textarea.style.width="600px",t.textarea.style.height="380px",e.showDialog(t.container,620,460,!0,!0),t.init()}));var p=this.get("layout"),h=p.funct;if(p.funct=function(t,o){h.apply(this,arguments),t.addItem(mxResources.get("orgChart"),null,(function(){var t=null,n=20,i=20,o=!0,s=function(){if(e.loadingOrgChart=!1,e.spinner.stop(),"undefined"!=typeof mxOrgChartLayout&&null!=t&&o){var s=e.editor.graph,a=new mxOrgChartLayout(s,t,n,i),l=s.getDefaultParent();s.model.getChildCount(s.getSelectionCell())>1&&(l=s.getSelectionCell()),a.execute(l),o=!1}},a=document.createElement("div"),l=document.createElement("div");l.style.marginTop="6px",l.style.display="inline-block",l.style.width="140px",mxUtils.write(l,mxResources.get("orgChartType")+": "),a.appendChild(l);var r=document.createElement("select");r.style.width="200px",r.style.boxSizing="border-box";for(var d=[mxResources.get("linear"),mxResources.get("hanger2"),mxResources.get("hanger4"),mxResources.get("fishbone1"),mxResources.get("fishbone2"),mxResources.get("1ColumnLeft"),mxResources.get("1ColumnRight"),mxResources.get("smart")],u=0;u<d.length;u++){var c=document.createElement("option");mxUtils.write(c,d[u]),c.value=u,2==u&&c.setAttribute("selected","selected"),r.appendChild(c)}mxEvent.addListener(r,"change",(function(){t=r.value})),a.appendChild(r),(l=document.createElement("div")).style.marginTop="6px",l.style.display="inline-block",l.style.width="140px",mxUtils.write(l,mxResources.get("parentChildSpacing")+": "),a.appendChild(l);var m=document.createElement("input");m.type="number",m.value=n,m.style.width="200px",m.style.boxSizing="border-box",a.appendChild(m),mxEvent.addListener(m,"change",(function(){n=m.value})),(l=document.createElement("div")).style.marginTop="6px",l.style.display="inline-block",l.style.width="140px",mxUtils.write(l,mxResources.get("siblingSpacing")+": "),a.appendChild(l);var g=document.createElement("input");g.type="number",g.value=i,g.style.width="200px",g.style.boxSizing="border-box",a.appendChild(g),mxEvent.addListener(g,"change",(function(){i=g.value}));var p=new CustomDialog(e,a,(function(){null==t&&(t=2),"undefined"!=typeof mxOrgChartLayout||e.loadingOrgChart||e.isOffline(!0)?s():e.spinner.spin(document.body,mxResources.get("loading"))&&(e.loadingOrgChart=!0,"1"==urlParams.dev?mxscript("js/orgchart/bridge.min.js",(function(){mxscript("js/orgchart/bridge.collections.min.js",(function(){mxscript("js/orgchart/OrgChart.Layout.min.js",(function(){mxscript("js/orgchart/mxOrgChartLayout.js",s)}))}))})):mxscript("js/extensions.min.js",s))}));e.showDialog(p.container,355,140,!0,!0)}),o,null,i()),t.addSeparator(o),t.addItem(mxResources.get("parallels"),null,mxUtils.bind(this,(function(){var t=new mxParallelEdgeLayout(n);t.checkOverlap=!0,t.spacing=20,e.executeLayout((function(){t.execute(n.getDefaultParent(),n.isSelectionEmpty()?null:n.getSelectionCells())}),!1)})),o),t.addSeparator(o),e.menus.addMenuItem(t,"runLayout",o,null,null,mxResources.get("apply")+"...")},mxResources.parse("diagramLanguage=Diagram Language"),e.actions.addAction("diagramLanguage...",(function(){var e=prompt("Language Code",Graph.diagramLanguage||"");null!=e&&(Graph.diagramLanguage=e.length>0?e:null,n.refresh())})),"1"==urlParams.test){mxResources.parse("testDevelop=Develop"),mxResources.parse("showBoundingBox=Show bounding box"),mxResources.parse("createSidebarEntry=Create Sidebar Entry"),mxResources.parse("testCheckFile=Check File"),mxResources.parse("testDiff=Diff/Sync"),mxResources.parse("testInspect=Inspect"),mxResources.parse("testShowConsole=Show Console"),mxResources.parse("testXmlImageExport=XML Image Export"),mxResources.parse("testDownloadRtModel=Export RT model"),mxResources.parse("testImportRtModel=Import RT model"),e.actions.addAction("createSidebarEntry",mxUtils.bind(this,(function(){if(!n.isSelectionEmpty()){var t=n.cloneCells(n.getSelectionCells()),i=n.getBoundingBoxFromGeometry(t);t=n.moveCells(t,-i.x,-i.y),e.showTextDialog("Create Sidebar Entry","this.addDataEntry('tag1 tag2', "+i.width+", "+i.height+", 'The Title', '"+Graph.compress(mxUtils.getXml(n.encodeCells(t)))+"'),")}}))),e.actions.addAction("showBoundingBox",mxUtils.bind(this,(function(){var e=n.getGraphBounds(),t=n.view.translate,i=n.view.scale;n.insertVertex(n.getDefaultParent(),null,"",e.x/i-t.x,e.y/i-t.y,e.width/i,e.height/i,"fillColor=none;strokeColor=red;")}))),e.actions.addAction("testCheckFile",mxUtils.bind(this,(function(){var t=null!=e.pages&&null!=e.getCurrentFile()?e.getCurrentFile().getAnonymizedXmlForPages(e.pages):"",n=new TextareaDialog(e,"Paste Data:",t,(function(t){if(t.length>0)try{"<"!=t.charAt(0)&&(t=Graph.decompress(t),mxLog.debug("See console for uncompressed XML"),console.log("xml",t));var n=mxUtils.parseXml(t),i=e.getPagesForNode(n.documentElement,"mxGraphModel");if(null!=i&&i.length>0)try{var o=e.getHashValueForPages(i);mxLog.debug("Checksum: ",o)}catch(e){mxLog.debug("Error: ",e.message)}else mxLog.debug("No pages found for checksum");function s(e){for(var t=e.parentNode.id,n=e.childNodes,i={},o={},s=null,a={},l=0;l<n.length;l++){var r=n[l];if(null!=r.id&&r.id.length>0)if(null==i[r.id]){i[r.id]=r.id;var d=r.getAttribute("parent");null==d?null!=s?mxLog.debug(t+": Multiple roots: "+r.id):s=r.id:(null==o[d]&&(o[d]=[]),o[d].push(r.id))}else a[r.id]=r.id}if(Object.keys(a).length>0){var u=t+": "+Object.keys(a).length+" Duplicates: "+Object.keys(a).join(", ");mxLog.debug(u+" (see console)")}else mxLog.debug(t+": Checked");var c={};null==s?mxLog.debug(t+": No root"):(function e(n){if(null==c[n]){if(c[n]=!0,null!=o[n]){for(;o[n].length>0;)e(o[n].pop());delete o[n]}}else mxLog.debug(t+": Visited: "+n)}(s),Object.keys(c).length!=Object.keys(i).length&&(mxLog.debug(t+": Invalid tree: (see console)"),console.log(t+": Invalid tree",o)))}for(var a=n.getElementsByTagName("root"),l=0;l<a.length;l++)s(a[l]);mxLog.show()}catch(t){e.handleError(t),null!=window.console&&console.error(t)}}));n.textarea.style.width="600px",n.textarea.style.height="380px",e.showDialog(n.container,620,460,!0,!0),n.init()})));var x=null;e.actions.addAction("testDiff",mxUtils.bind(this,(function(){if(null!=e.pages){var t=[["Snapshot",function(t,i){x=e.getPagesForNode(mxUtils.parseXml(e.getFileData(!0)).documentElement),n.textarea.value="Snapshot updated "+(new Date).toLocaleString()}],["Diff",function(t,i){try{n.textarea.value=JSON.stringify(e.diffPages(x,e.pages),null,2)}catch(t){e.handleError(t)}}]],n=new TextareaDialog(e,"Diff/Sync:","",(function(t){var n=e.getCurrentFile();if(t.length>0&&null!=n)try{var i=JSON.parse(t);n.patch([i],null,!0),e.hideDialog()}catch(t){e.handleError(t)}}),null,"Close",null,null,null,!0,null,"Patch",null,t);n.textarea.style.width="600px",n.textarea.style.height="380px",null==x?(x=e.getPagesForNode(mxUtils.parseXml(e.getFileData(!0)).documentElement),n.textarea.value="Snapshot created "+(new Date).toLocaleString()):n.textarea.value=JSON.stringify(e.diffPages(x,e.pages),null,2),e.showDialog(n.container,620,460,!0,!0),n.init()}else e.alert("No pages")}))),e.actions.addAction("testInspect",mxUtils.bind(this,(function(){console.log(e,n.getModel())}))),e.actions.addAction("testXmlImageExport",mxUtils.bind(this,(function(){var e=new mxImageExport,t=n.getGraphBounds(),i=n.view.scale,o=mxUtils.createXmlDocument(),s=o.createElement("output");o.appendChild(s);var a=new mxXmlCanvas2D(s);a.translate(Math.floor((1-t.x)/i),Math.floor((1-t.y)/i)),a.scale(1/i);var l=0,r=a.save;a.save=function(){l++,r.apply(this,arguments)};var d=a.restore;a.restore=function(){l--,d.apply(this,arguments)};var u=e.drawShape;e.drawShape=function(e){mxLog.debug("entering shape",e,l),u.apply(this,arguments),mxLog.debug("leaving shape",e,l)},e.drawState(n.getView().getState(n.model.root),a),Math.ceil(1*t.width/i+2),Math.ceil(1*t.height/i+2),mxLog.show(),mxLog.debug(mxUtils.getXml(s)),mxLog.debug("stateCounter",l)}))),e.actions.addAction("testShowConsole",(function(){mxLog.isVisible()?mxLog.window.fit():mxLog.show(),mxLog.window.div.style.zIndex=mxPopupMenu.prototype.zIndex-2})),this.put("testDevelop",new Menu(mxUtils.bind(this,(function(e,t){this.addMenuItems(e,["createSidebarEntry","showBoundingBox","-","testCheckFile","testDiff","-","testInspect","-","testXmlImageExport","-","testShowConsole"],t)}))))}if(e.actions.addAction("shapes...",(function(){mxClient.IS_CHROMEAPP||!e.isOffline()?e.showDialog(new MoreShapesDialog(e,!0).container,640,isLocalStorage?mxClient.IS_IOS?480:460:440,!0,!0):e.showDialog(new MoreShapesDialog(e,!1).container,360,isLocalStorage?mxClient.IS_IOS?300:280:260,!0,!0)})),e.actions.put("createShape",new Action(mxResources.get("shape")+"...",(function(t){if(n.isEnabled()){var i=new mxCell("",new mxGeometry(0,0,120,120),e.defaultCustomShapeStyle);i.vertex=!0;var o=new EditShapeDialog(e,i,mxResources.get("editShape")+":",630,400);e.showDialog(o.container,640,480,!0,!1),o.init()}}))).isEnabled=i,e.actions.put("embedHtml",new Action(mxResources.get("html")+"...",(function(){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(t){e.spinner.stop(),e.showHtmlDialog(mxResources.get("create"),"https://www.diagrams.net/doc/faq/embed-html-options",t,(function(t,n,i,o,s,a,l,r,d,u,c){e.createHtml(t,n,i,o,s,a,l,r,d,u,c,mxUtils.bind(this,(function(t,n){var i=new EmbedDialog(e,t+"\n"+n,null,null,(function(){var i=window.open(),o=i.document;if(null!=o){"CSS1Compat"===document.compatMode&&o.writeln("<!DOCTYPE html>"),o.writeln("<html>"),o.writeln("<head><title>"+encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head>'),o.writeln("<body>"),o.writeln(t);var s=mxClient.IS_IE||mxClient.IS_EDGE||null!=document.documentMode;if(s&&o.writeln(n),o.writeln("</body>"),o.writeln("</html>"),o.close(),!s){var a=i.document.createElement("div");a.marginLeft="26px",a.marginTop="26px",mxUtils.write(a,mxResources.get("updatingDocument"));var l=i.document.createElement("img");l.setAttribute("src",window.location.protocol+"//"+window.location.hostname+"/"+IMAGE_PATH+"/spin.gif"),l.style.marginLeft="6px",a.appendChild(l),i.document.body.insertBefore(a,i.document.body.firstChild),window.setTimeout((function(){var e=document.createElement("script");e.type="text/javascript",e.src=/<script.*?src="(.*?)"/.exec(n)[1],o.body.appendChild(e),a.parentNode.removeChild(a)}),20)}}else e.handleError({message:mxResources.get("errorUpdatingPreview")})}));e.showDialog(i.container,450,240,!0,!0),i.init()})))}))}))}))),e.actions.put("embedImage",new Action(mxResources.get("image")+"...",(function(){e.showEmbedImageDialog((function(t,n,i,o,s,a){e.spinner.spin(document.body,mxResources.get("loading"))&&e.createEmbedImage(t,n,i,o,s,a,(function(t){e.spinner.stop();var n=new EmbedDialog(e,t);e.showDialog(n.container,450,240,!0,!0),n.init()}),(function(t){e.spinner.stop(),e.handleError(t)}))}),mxResources.get("image"),mxResources.get("retina"),e.isExportToCanvas())}))),e.actions.put("embedSvg",new Action(mxResources.get("formatSvg")+"...",(function(){e.showEmbedImageDialog((function(t,n,i,o,s,a){e.spinner.spin(document.body,mxResources.get("loading"))&&e.createEmbedSvg(t,n,i,o,s,a,(function(t){e.spinner.stop();var n=new EmbedDialog(e,t);e.showDialog(n.container,450,240,!0,!0),n.init()}),(function(t){e.spinner.stop(),e.handleError(t)}))}),mxResources.get("formatSvg"),mxResources.get("image"),!0,"https://www.diagrams.net/doc/faq/embed-svg.html")}))),e.actions.put("embedIframe",new Action(mxResources.get("iframe")+"...",(function(){var t=n.getGraphBounds();e.showPublishLinkDialog(mxResources.get("iframe"),null,"100%",Math.ceil(t.height/n.view.scale)+2,(function(t,n,i,o,s,a,l,r,d){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(u){e.spinner.stop();var c=[];d&&c.push("tags=%7B%7D");var m=new EmbedDialog(e,'<iframe frameborder="0" style="width:'+l+";height:"+r+';" src="'+e.createLink(t,n,i,o,s,a,u,null,c)+'"></iframe>');e.showDialog(m.container,450,240,!0,!0),m.init()}))}),!0)}))),e.actions.put("embedNotion",new Action(mxResources.get("notion")+"...",(function(){e.showPublishLinkDialog(mxResources.get("notion"),null,null,null,(function(t,n,i,o,s,a,l,r,d){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(l){e.spinner.stop();var r=["border=0"];d&&r.push("tags=%7B%7D");var u=new EmbedDialog(e,e.createLink(t,n,i,o,s,a,l,null,r,!0));e.showDialog(u.container,450,240,!0,!0),u.init()}))}),!0)}))),e.actions.put("publishLink",new Action(mxResources.get("link")+"...",(function(){e.showPublishLinkDialog(null,null,null,null,(function(t,n,i,o,s,a,l,r,d){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(l){e.spinner.stop();var r=[];d&&r.push("tags=%7B%7D");var u=new EmbedDialog(e,e.createLink(t,n,i,o,s,a,l,null,r));e.showDialog(u.container,450,240,!0,!0),u.init()}))}))}))),e.actions.addAction("microsoftOffice...",(function(){e.openLink("https://office.draw.io")})),e.actions.addAction("googleDocs...",(function(){e.openLink("http://docsaddon.draw.io")})),e.actions.addAction("googleSlides...",(function(){e.openLink("https://slidesaddon.draw.io")})),e.actions.addAction("googleSheets...",(function(){e.openLink("https://sheetsaddon.draw.io")})),e.actions.addAction("googleSites...",(function(){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(t){e.spinner.stop();var n=new GoogleSitesDialog(e,t);e.showDialog(n.container,420,256,!0,!0),n.init()}))})),(isLocalStorage||mxClient.IS_CHROMEAPP)&&((c=e.actions.addAction("scratchpad",(function(){e.toggleScratchpad()}))).setToggleAction(!0),c.setSelectedCallback((function(){return null!=e.scratchpad})),"0"!=urlParams.plugins&&e.actions.addAction("plugins...",(function(){e.showDialog(new PluginsDialog(e).container,360,170,!0,!1)}))),(c=e.actions.addAction("search",(function(){var t=e.sidebar.isEntryVisible("search");e.sidebar.showPalette("search",!t),isLocalStorage&&(mxSettings.settings.search=!t,mxSettings.save())}))).label=mxResources.get("searchShapes"),c.setToggleAction(!0),c.setSelectedCallback((function(){return e.sidebar.isEntryVisible("search")})),"1"==urlParams.embed){e.actions.get("save").funct=function(t){n.isEditing()&&n.stopEditing();var i="0"!=urlParams.pages||null!=e.pages&&e.pages.length>1?e.getFileData(!0):mxUtils.getXml(e.editor.getGraphXml());if("json"==urlParams.proto){var o=e.createLoadMessage("save");o.xml=i,t&&(o.exit=!0),i=JSON.stringify(o)}(window.opener||window.parent).postMessage(i,"*"),"0"!=urlParams.modified&&"1"!=urlParams.keepmodified&&(e.editor.modified=!1,e.editor.setStatus(""));var s=e.getCurrentFile();null==s||s.constructor==EmbedFile||s.constructor==LocalFile&&null==s.mode||e.saveFile()};var f=e.actions.addAction("saveAndExit",(function(){e.actions.get("save").funct(!0)}));f.label="1"==urlParams.publishClose?mxResources.get("publish"):mxResources.get("saveAndExit"),e.actions.addAction("exit",(function(){if("1"==urlParams.embedInline)e.sendEmbeddedSvgExport();else{var t=function(){e.editor.modified=!1;var t="json"==urlParams.proto?JSON.stringify({event:"exit",modified:e.editor.modified}):"";(window.opener||window.parent).postMessage(t,"*")};e.editor.modified?e.confirm(mxResources.get("allChangesLost"),null,t,mxResources.get("cancel"),mxResources.get("discardChanges")):t()}}))}this.put("exportAs",new Menu(mxUtils.bind(this,(function(t,n){e.isExportToCanvas()?(this.addMenuItems(t,["exportPng"],n),e.jpgSupported&&this.addMenuItems(t,["exportJpg"],n)):e.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(t,["exportPng","exportJpg"],n),this.addMenuItems(t,["exportSvg","-"],n),e.isOffline()||e.printPdfExport?this.addMenuItems(t,["exportPdf"],n):e.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(t,["exportPdf"],n),mxClient.IS_IE||"undefined"==typeof VsdxExport&&e.isOffline()||this.addMenuItems(t,["exportVsdx"],n),this.addMenuItems(t,["-","exportHtml","exportXml","exportUrl"],n),e.isOffline()||(t.addSeparator(n),this.addMenuItem(t,"export",n)&&(this.addMenuItem(t,"export",n).firstChild.nextSibling.innerHTML=mxResources.get("advanced")+"..."))})))),this.put("importFrom",new Menu(mxUtils.bind(this,(function(t,n){t.addSeparator(n),isLocalStorage&&"0"!=urlParams.browser&&t.addItem(mxResources.get("browser")+"...",null,(function(){e.importLocalFile(!1)}),n),"1"!=urlParams.noDevice&&t.addItem(mxResources.get("device")+"...",null,(function(){e.importLocalFile(!0)}),n)})))).isEnabled=i;var w=this.editorUi.actions.addAction("rename...",mxUtils.bind(this,(function(){var t=this.editorUi.getCurrentFile();if(null!=t)if(t.constructor==LocalFile&&null!=t.fileHandle)e.showSaveFilePicker(mxUtils.bind(e,(function(n,i){t.invalidFileHandle=null,t.fileHandle=n,t.title=i.name,t.desc=i,e.save(i.name)})),null,e.createFileSystemOptions(t.getTitle()));else{var n=null!=t.getTitle()?t.getTitle():this.editorUi.defaultFilename,i=new FilenameDialog(this.editorUi,n,mxResources.get("rename"),mxUtils.bind(this,(function(e){null!=e&&e.length>0&&null!=t&&e!=t.getTitle()&&this.editorUi.spinner.spin(document.body,mxResources.get("renaming"))&&t.rename(e,mxUtils.bind(this,(function(e){this.editorUi.spinner.stop()})),mxUtils.bind(this,(function(e){this.editorUi.handleError(e,null!=e?mxResources.get("errorRenamingFile"):null)})))})),t.constructor==StorageFile?mxResources.get("diagramName"):null,(function(t){return null!=t&&t.length>0||(e.showError(mxResources.get("error"),mxResources.get("invalidName"),mxResources.get("ok")),!1)}),null,null,null,null,e.editor.fileExtensions);this.editorUi.showDialog(i.container,340,144,!0,!0),i.init()}})));w.isEnabled=function(){return this.enabled&&i.apply(this,arguments)},w.visible="1"!=urlParams.embed,e.actions.addAction("moveToFolder...",mxUtils.bind(this,(function(){var t=e.getCurrentFile();if(t.getMode()==App.MODE_GOOGLE||t.getMode()==App.MODE_ONEDRIVE){var n=!1;if(t.getMode()==App.MODE_GOOGLE&&null!=t.desc.parents)for(var i=0;i<t.desc.parents.length;i++)if(t.desc.parents[i].isRoot){n=!0;break}e.pickFolder(t.getMode(),mxUtils.bind(this,(function(n){e.spinner.spin(document.body,mxResources.get("moving"))&&t.move(n,mxUtils.bind(this,(function(t){e.spinner.stop()})),mxUtils.bind(this,(function(t){e.handleError(t)})))})),null,!0,n)}}))),this.put("embed",new Menu(mxUtils.bind(this,(function(t,n){var i=e.getCurrentFile();null==i||i.getMode()!=App.MODE_GOOGLE&&i.getMode()!=App.MODE_GITHUB||!/(\.png)$/i.test(i.getTitle())||this.addMenuItems(t,["liveImage","-"],n),this.addMenuItems(t,["embedImage","embedSvg","-","embedHtml"],n),navigator.standalone||e.isOffline()||this.addMenuItems(t,["embedIframe"],n)})))),e.addInsertItem=function(t,n,o,s){("plantUml"!=s||EditorUi.enablePlantUml&&!e.isOffline())&&t.addItem(o,null,mxUtils.bind(this,(function(){if("fromText"==s||"formatSql"==s||"plantUml"==s||"mermaid"==s){var t=new ParseDialog(e,o,s);e.showDialog(t.container,620,420,!0,!1),e.dialog.container.style.overflow="auto",t.init()}else t=new CreateGraphDialog(e,o,s),e.showDialog(t.container,620,420,!0,!1),t.init()})),n,null,i())};var b=function(t,i,o,s){var a=new mxCell(t,new mxGeometry(0,0,i,o),s);a.vertex=!0;var l=n.getCenterInsertPoint(n.getBoundingBoxFromGeometry([a],!0));a.geometry.x=l.x,a.geometry.y=l.y,n.getModel().beginUpdate();try{a=n.addCell(a),n.fireEvent(new mxEventObject("cellsInserted","cells",[a]))}finally{n.getModel().endUpdate()}return n.scrollCellToVisible(a),n.setSelectionCell(a),n.container.focus(),n.editAfterInsert&&n.startEditing(a),window.setTimeout((function(){null!=e.hoverIcons&&e.hoverIcons.update(n.view.getState(a))}),0),a};e.actions.put("insertText",new Action(mxResources.get("text"),(function(){n.isEnabled()&&!n.isCellLocked(n.getDefaultParent())&&n.startEditingAtCell(b("Text",40,20,"text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;"))})),null,null,Editor.ctrlKey+"+Shift+X").isEnabled=i,e.actions.put("insertRectangle",new Action(mxResources.get("rectangle"),(function(){n.isEnabled()&&!n.isCellLocked(n.getDefaultParent())&&b("",120,60,"whiteSpace=wrap;html=1;")})),null,null,Editor.ctrlKey+"+K").isEnabled=i,e.actions.put("insertEllipse",new Action(mxResources.get("ellipse"),(function(){n.isEnabled()&&!n.isCellLocked(n.getDefaultParent())&&b("",80,80,"ellipse;whiteSpace=wrap;html=1;")})),null,null,Editor.ctrlKey+"+Shift+K").isEnabled=i,e.actions.put("insertRhombus",new Action(mxResources.get("rhombus"),(function(){n.isEnabled()&&!n.isCellLocked(n.getDefaultParent())&&b("",80,80,"rhombus;whiteSpace=wrap;html=1;")}))).isEnabled=i,e.addInsertMenuItems=mxUtils.bind(this,(function(t,n,i){for(var o=0;o<i.length;o++)"-"==i[o]?t.addSeparator(n):e.addInsertItem(t,n,mxResources.get(i[o])+"...",i[o])})),this.put("insert",new Menu(mxUtils.bind(this,(function(t,n){this.addMenuItems(t,["insertRectangle","insertEllipse","insertRhombus","-","insertText","insertLink","-","createShape","insertFreehand","-","insertImage"],n),e.insertTemplateEnabled&&!e.isOffline()&&this.addMenuItems(t,["insertTemplate"],n),t.addSeparator(n),this.addSubmenu("insertLayout",t,n,mxResources.get("layout")),this.addSubmenu("insertAdvanced",t,n,mxResources.get("advanced"))})))),this.put("insertLayout",new Menu(mxUtils.bind(this,(function(t,n){e.addInsertMenuItems(t,n,["horizontalFlow","verticalFlow","-","horizontalTree","verticalTree","radialTree","-","organic","circle"])})))),this.put("insertAdvanced",new Menu(mxUtils.bind(this,(function(t,n){e.addInsertMenuItems(t,n,["fromText","plantUml","mermaid","-","formatSql"]),t.addItem(mxResources.get("csv")+"...",null,(function(){e.showImportCsvDialog()}),n,null,i())})))),this.put("openRecent",new Menu((function(t,n){var i=e.getRecent();if(null!=i){for(var o=0;o<i.length;o++)!function(i){var o=i.mode;o==App.MODE_GOOGLE?o="googleDrive":o==App.MODE_ONEDRIVE&&(o="oneDrive"),t.addItem(i.title+" ("+mxResources.get(o)+")",null,(function(){e.loadFile(i.id)}),n)}(i[o]);t.addSeparator(n)}t.addItem(mxResources.get("reset"),null,(function(){e.resetRecent()}),n)}))),this.put("openFrom",new Menu((function(t,n){t.addSeparator(n),isLocalStorage&&"0"!=urlParams.browser&&t.addItem(mxResources.get("browser")+"...",null,(function(){e.pickFile(App.MODE_BROWSER)}),n),"1"!=urlParams.noDevice&&t.addItem(mxResources.get("device")+"...",null,(function(){e.pickFile(App.MODE_DEVICE)}),n)}))),Editor.enableCustomLibraries&&(this.put("newLibrary",new Menu((function(t,n){isLocalStorage&&"0"!=urlParams.browser&&t.addItem(mxResources.get("browser")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_BROWSER)}),n),"1"!=urlParams.noDevice&&t.addItem(mxResources.get("device")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_DEVICE)}),n)}))),this.put("openLibraryFrom",new Menu((function(t,n){isLocalStorage&&"0"!=urlParams.browser&&t.addItem(mxResources.get("browser")+"...",null,(function(){e.pickLibrary(App.MODE_BROWSER)}),n),"1"!=urlParams.noDevice&&t.addItem(mxResources.get("device")+"...",null,(function(){e.pickLibrary(App.MODE_DEVICE)}),n),"1"==urlParams.confLib&&(t.addSeparator(n),t.addItem(mxResources.get("confluenceCloud")+"...",null,(function(){e.showRemotelyStoredLibrary(mxResources.get("libraries"))}),n))})))),this.put("edit",new Menu(mxUtils.bind(this,(function(e,t){this.addMenuItems(e,["undo","redo","-","cut","copy","copyAsImage","paste","delete","-","duplicate","-","findReplace","-","editData","editTooltip","-","editStyle","editGeometry","-","edit","-","editLink","openLink","-","selectVertices","selectEdges","selectAll","selectNone","-","lockUnlock"])})))),(c=e.actions.addAction("comments",mxUtils.bind(this,(function(){if(null==this.commentsWindow)this.commentsWindow=new CommentsWindow(e,e.container.offsetWidth-380,120,300,350),this.commentsWindow.window.addListener("show",(function(){e.fireEvent(new mxEventObject("comments"))})),this.commentsWindow.window.addListener("hide",(function(){e.fireEvent(new mxEventObject("comments"))})),this.commentsWindow.window.setVisible(!0),e.fireEvent(new mxEventObject("comments"));else{var t=!this.commentsWindow.window.isVisible();this.commentsWindow.window.setVisible(t),this.commentsWindow.refreshCommentsTime(),t&&this.commentsWindow.hasError&&this.commentsWindow.refreshComments()}})))).setToggleAction(!0),c.setSelectedCallback(mxUtils.bind(this,(function(){return null!=this.commentsWindow&&this.commentsWindow.window.isVisible()}))),e.editor.addListener("fileLoaded",mxUtils.bind(this,(function(){null!=this.commentsWindow&&(this.commentsWindow.destroy(),this.commentsWindow=null)})));var v=this.get("viewPanels"),E=v.funct;function S(e,t,n){this.ui=e,this.extFonts=t,this.previousExtFonts=t,this.customFonts=n,this.prevCustomFonts=n}v.funct=function(t,n){E.apply(this,arguments),e.menus.addMenuItems(t,["tags"],n),e.commentsSupported()&&e.menus.addMenuItems(t,["comments"],n)},this.put("view",new Menu(mxUtils.bind(this,(function(t,n){if(this.addMenuItems(t,(null!=this.editorUi.format?["formatPanel"]:[]).concat(["outline","layers","tags"]).concat(e.commentsSupported()?["comments","-"]:["-"])),this.addMenuItems(t,["-","search"],n),isLocalStorage||mxClient.IS_CHROMEAPP){var i=this.addMenuItem(t,"scratchpad",n);(!e.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(i,"https://www.diagrams.net/doc/faq/scratchpad")}this.addMenuItems(t,["shapes","-","pageView","pageScale"]),this.addSubmenu("units",t,n),this.addMenuItems(t,["-","scrollbars","tooltips","ruler","-","grid","guides"],n),mxClient.IS_SVG&&(null==document.documentMode||document.documentMode>9)&&this.addMenuItem(t,"shadowVisible",n),this.addMenuItems(t,["-","connectionArrows","connectionPoints","-","resetView","zoomIn","zoomOut"],n),"1"!=urlParams.sketch&&this.addMenuItems(t,["-","fullscreen"],n)})))),this.put("extras",new Menu(mxUtils.bind(this,(function(t,n){if("1"==urlParams.noLangIcon&&(this.addSubmenu("language",t,n),t.addSeparator(n)),"1"!=urlParams.embed&&(this.addSubmenu("theme",t,n),t.addSeparator(n)),"undefined"!=typeof MathJax){var i=this.addMenuItem(t,"mathematicalTypesetting",n);(!e.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(i,"https://www.diagrams.net/doc/faq/math-typesetting")}this.addMenuItems(t,["copyConnect","collapseExpand","-"],n),"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(t,["showStartScreen"],n),"1"!=urlParams.embed&&this.addMenuItems(t,["autosave"],n),t.addSeparator(n),!e.isOfflineApp()&&isLocalStorage&&this.addMenuItem(t,"plugins",n),this.addMenuItems(t,["-","editDiagram"],n),Graph.translateDiagram&&this.addMenuItems(t,["diagramLanguage"]),this.addMenuItems(t,["-","configuration"],n),t.addSeparator(n),"1"==urlParams.newTempDlg&&(e.actions.addAction("templates",(function(){function t(e){return{id:e.id,isExt:!0,url:e.downloadUrl,title:e.title,imgUrl:e.thumbnailLink,changedBy:e.lastModifyingUserName,lastModifiedOn:e.modifiedDate}}var n=new TemplatesDialog(e,(function(e){console.log(arguments)}),null,null,null,"user",(function(n,i,o){var s=new Date;s.setDate(s.getDate()-7),e.drive.listFiles(null,s,!!o,(function(e){for(var i=[],o=0;o<e.items.length;o++)i.push(t(e.items[o]));n(i)}),i)}),(function(n,i,o,s){e.drive.listFiles(n,null,!!s,(function(e){for(var n=[],o=0;o<e.items.length;o++)n.push(t(e.items[o]));i(n)}),o)}),(function(t,n,i){e.drive.getFile(t.id,(function(e){n(e.data)}),i)}),null,(function(e){e({Test:[]},1)}),!0,!1);e.showDialog(n.container,window.innerWidth,window.innerHeight,!0,!1,null,!1,!0)})),this.addMenuItem(t,"templates",n))})))),this.put("file",new Menu(mxUtils.bind(this,(function(t,n){if("1"==urlParams.embed)this.addSubmenu("importFrom",t,n),this.addSubmenu("exportAs",t,n),this.addSubmenu("embed",t,n),"1"==urlParams.libraries&&(this.addMenuItems(t,["-"],n),this.addSubmenu("newLibrary",t,n),this.addSubmenu("openLibraryFrom",t,n)),e.isRevisionHistorySupported()&&this.addMenuItems(t,["-","revisionHistory"],n),this.addMenuItems(t,["-","pageSetup","print","-","rename"],n),"1"!=urlParams.embedInline&&("1"==urlParams.noSaveBtn?"0"!=urlParams.saveAndExit&&this.addMenuItems(t,["saveAndExit"],n):(this.addMenuItems(t,["save"],n),"1"==urlParams.saveAndExit&&this.addMenuItems(t,["saveAndExit"],n))),"1"!=urlParams.noExitBtn&&this.addMenuItems(t,["exit"],n);else{var i=this.editorUi.getCurrentFile();if(this.addMenuItems(t,["new"],n),this.addSubmenu("openFrom",t,n),isLocalStorage&&this.addSubmenu("openRecent",t,n),this.addMenuItems(t,["-","save","saveAs","-"],n),this.addMenuItems(t,["rename"],n),e.isOfflineApp()&&navigator.onLine&&"1"!=urlParams.stealth&&"