UNPKG

@zklogic/draw.io

Version:

Draw.IO - Graph Editor integration in Angular-cli

1 lines 75.5 kB
!function(){var e=mxPopupMenu.prototype.showMenu;mxPopupMenu.prototype.showMenu=function(){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-(EditorUi.isElectronApp?50:10)+"px",e.apply(this,arguments)},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),o=("1"!=urlParams.embed&&"0"!=urlParams.gapi||"1"==urlParams.embed&&"1"==urlParams.gapi)&&mxClient.IS_SVG&&isLocalStorage&&(null==document.documentMode||document.documentMode>=10),s=("1"!=urlParams.embed&&"0"!=urlParams.db||"1"==urlParams.embed&&"1"==urlParams.db)&&mxClient.IS_SVG&&(null==document.documentMode||document.documentMode>9),l=("www.draw.io"==window.location.hostname||"test.draw.io"==window.location.hostname||"drive.draw.io"==window.location.hostname||"app.diagrams.net"==window.location.hostname)&&("1"!=urlParams.embed&&"0"!=urlParams.od||"1"==urlParams.embed&&"1"==urlParams.od)&&!mxClient.IS_IOS&&(navigator.userAgent.indexOf("MSIE")<0||document.documentMode>=10),a="1"==urlParams.tr&&mxClient.IS_SVG&&(null==document.documentMode||document.documentMode>9);if(!mxClient.IS_SVG&&!e.isOffline()){var r=new Image;r.src=IMAGE_PATH+"/help.png"}"1"==urlParams.noFileMenu&&(this.defaultMenuItems=this.defaultMenuItems.filter((function(e){return"file"!=e}))),e.actions.addAction("new...",(function(){var t=e.isOffline();if(t||"1"!=urlParams.newTempDlg||e.mode!=App.MODE_GOOGLE){var n=new NewDialog(e,t,!(e.mode==App.MODE_DEVICE&&"chooseFileSystemEntries"in window));e.showDialog(n.container,t?350:620,t?70:460,!0,!0,(function(t){e.sidebar.hideTooltip(),t&&null==e.getCurrentFile()&&e.showSplash()})),n.init()}else{function i(e){return{id:e.id,isExt:!0,url:e.downloadUrl,title:e.title,imgUrl:e.thumbnailLink,changedBy:e.lastModifyingUserName,lastModifiedOn:e.modifiedDate}}var o=new TemplatesDialog(e,(function(t,n,i){var o=i.libs,s=i.clibs;e.pickFolder(e.mode,(function(i){e.createFile(n,t,null!=o&&o.length>0?o:null,null,(function(){e.hideDialog()}),null,i,null,null!=s&&s.length>0?s:null)}),null==e.stateArg||null==e.stateArg.folderId)}),null,null,null,"user",(function(t,n,o){var s=new Date;s.setDate(s.getDate()-7),e.drive.listFiles(null,s,!!o,(function(e){for(var n=[],o=0;o<e.items.length;o++)n.push(i(e.items[o]));t(n)}),n)}),(function(t,n,o,s){e.drive.listFiles(t,null,!!s,(function(e){for(var t=[],o=0;o<e.items.length;o++)t.push(i(e.items[o]));n(t)}),o)}),(function(t,n,i){e.drive.getFile(t.id,(function(e){n(e.data)}),i)}),null,null,!1,!1);e.showDialog(o.container,window.innerWidth,window.innerHeight,!0,!1,null,!1,!0)}})),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 d=e.actions.addAction("points",(function(){e.editor.graph.view.setUnit(mxConstants.POINTS)}));d.setToggleAction(!0),d.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.POINTS}));var u=e.actions.addAction("inches",(function(){e.editor.graph.view.setUnit(mxConstants.INCHES)}));u.setToggleAction(!0),u.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.INCHES}));var c=e.actions.addAction("millimeters",(function(){e.editor.graph.view.setUnit(mxConstants.MILLIMETERS)}));c.setToggleAction(!0),c.setSelectedCallback((function(){return e.editor.graph.view.unit==mxConstants.MILLIMETERS}));var m=e.actions.addAction("meters",(function(){e.editor.graph.view.setUnit(mxConstants.METERS)}));m.setToggleAction(!0),m.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 g=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())}));g.setEnabled(e.canvasSupported&&9!=document.documentMode),g.setToggleAction(!0),g.setSelectedCallback((function(){return null!=e.ruler}));var p=e.actions.addAction("fullscreen",(function(){"1"==urlParams.embedInline?e.setInlineFullscreen(!Editor.inlineFullscreen):null==document.fullscreenElement?document.body.requestFullscreen():document.exitFullscreen()}));p.visible="1"==urlParams.embedInline||document.fullscreenEnabled&&null!=document.body.requestFullscreen,p.setToggleAction(!0),p.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,document.body.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()),l=e.addCheckbox(t,mxResources.get("compressed"),!0),a=e.addCheckbox(t,mxResources.get("allPages"),!i,i);a.style.marginBottom="16px",mxEvent.addListener(s,"change",(function(){s.checked?a.setAttribute("disabled","disabled"):a.removeAttribute("disabled")}));var r=new CustomDialog(e,t,mxUtils.bind(this,(function(){e.downloadFile("xml",!l.checked,null,!s.checked,i||!a.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,l,a,r,d){var u=[];d&&u.push("tags=%7B%7D");var c=new EmbedDialog(e,e.createLink(t,n,i,o,s,l,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,l,a,r,d,u,c){e.createHtml(t,n,i,o,s,l,a,r,d,u,c,mxUtils.bind(this,(function(t,n){var i=e.getBaseFilename(a),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?(x.removeAttribute("disabled"),x.checked=!n.pageVisible):(x.setAttribute("disabled","disabled"),x.checked=!1)},l=200,a=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(a,Math.max(parseInt(g.value),parseInt(c.value)))),c.value=Math.max(1,Math.min(a,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&&(a=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",a),g.setAttribute("max",a),mxUtils.br(i);var f=e.addRadiobox(i,"pages",mxResources.get("selectionOnly"),!1,n.isSelectionEmpty()),x=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(f,"change",s),l+=64}else f=e.addCheckbox(i,mxResources.get("selectionOnly"),!1,n.isSelectionEmpty()),x=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(f,"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),l+=30),b&&(v=e.addCheckbox(i,mxResources.get("transparentBackground"),!1),l+=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(a-1,i-1)),to:Math.max(0,Math.min(a-1,o-1))}}e.downloadFile("pdf",null,null,!f.checked,!!t||!d.checked&&null==n,!x.checked,null!=v&&v.checked,null,null,w.checked,null!=E&&E.checked,n)})),null,mxResources.get("export"));e.showDialog(S.container,300,l,!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 h=e.actions.addAction("synchronize",(function(){e.synchronizeCurrentFile("none"==DrawioFile.SYNC)}),null,null,"Alt+Shift+S");"none"==DrawioFile.SYNC&&(h.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&&((h=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),h.setSelectedCallback((function(){return e.isMathEnabled()})),h.isEnabled=i),isLocalStorage&&((h=e.actions.addAction("showStartScreen",(function(){mxSettings.setShowStartScreen(!mxSettings.getShowStartScreen()),mxSettings.save()}))).setToggleAction(!0),h.setSelectedCallback((function(){return mxSettings.getShowStartScreen()})));var f=e.actions.addAction("autosave",(function(){e.editor.setAutosave(!e.editor.autosave)}));f.setToggleAction(!0),f.setSelectedCallback((function(){return f.isEnabled()&&e.editor.autosave})),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 x=null;if(e.actions.addAction("copyStyle",(function(){n.isEnabled()&&!n.isSelectionEmpty()&&(x=n.copyStyle(n.getSelectionCell()))}),null,null,Editor.ctrlKey+"+Shift+C"),e.actions.addAction("pasteStyle",(function(){n.isEnabled()&&!n.isSelectionEmpty()&&null!=x&&n.pasteStyle(x,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,l,a,r,d,u,c,m,g,p){var h=parseInt(t);!isNaN(h)&&h>0&&e.exportSvg(h/100,n,i,o,s,l,a,!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,l,a,r,d,u,c,m,g){var p=parseInt(t);!isNaN(p)&&p>0&&e.exportImage(p/100,n,i,o,s,a,!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,l,a,r,d,u,c,m,g){var p=parseInt(t);!isNaN(p)&&p>0&&e.exportImage(p/100,!1,i,o,!1,a,!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)}))),(h=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,(h=e.actions.put("shadowVisible",new Action(mxResources.get("shadow"),(function(){n.setShadowVisible(!n.shadowVisible)})))).setToggleAction(!0),h.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")})),e.actions.addAction("forkme",(function(){EditorUi.isElectronApp?e.openLink("https://github.com/jgraph/drawio-desktop"):e.openLink("https://github.com/jgraph/drawio")})).label="Fork me on GitHub...",e.actions.addAction("downloadDesktop...",(function(){e.openLink("https://get.diagrams.net/")})),(h=e.actions.addAction("tags",mxUtils.bind(this,(function(){null==this.tagsWindow?(this.tagsWindow=new TagsWindow(e,document.body.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),h.setSelectedCallback(mxUtils.bind(this,(function(){return null!=this.tagsWindow&&this.tagsWindow.window.isVisible()}))),(h=e.actions.addAction("findReplace...",mxUtils.bind(this,(function(t,i){var o=n.isEnabled()&&(null==i||!mxEvent.isShiftDown(i)),s=o?"findReplace":"find",l=s+"Window";if(null==this[l]){var a=o?"min"==uiTheme?330:300:240,r=o?"min"==uiTheme?304:288:170;this[l]=new FindWindow(e,document.body.offsetWidth-(a+20),100,a,r,o),this[l].window.addListener("show",(function(){e.fireEvent(new mxEventObject(s))})),this[l].window.addListener("hide",(function(){e.fireEvent(new mxEventObject(s))})),this[l].window.setVisible(!0)}else this[l].window.setVisible(!this[l].window.isVisible())})),null,null,Editor.ctrlKey+"+F")).setToggleAction(!0),h.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{mxEvent.isShiftDown(t)?(localStorage.removeItem(Editor.settingsKey),localStorage.removeItem(".drawio-config")):(localStorage.removeItem(Editor.configurationKey),e.hideDialog(),e.alert(mxResources.get("restartForChangeRequired")))}catch(t){e.handleError(t)}}))},"Shift+Click to Reset Settings"]];EditorUi.isElectronApp||n.push([mxResources.get("share"),function(t,n){if(n.value.length>0)try{var i=JSON.parse(n.value),o=window.location.protocol+"//"+window.location.host+"/"+e.getSearch()+"#_CONFIG_"+Graph.compress(JSON.stringify(i)),s=new EmbedDialog(e,o);e.showDialog(s.container,450,240,!0),s.init()}catch(t){e.handleError(t)}else e.handleError({message:mxResources.get("invalidInput")})}]);var 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 w=Menus.prototype.createMenubar;Menus.prototype.createMenubar=function(t){var n=w.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";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),"1"==urlParams.winCtrls&&(o.style.right="95px",o.style.width="19px",o.style.height="19px",o.style.webkitAppRegion="no-drag",s.style.webkitAppRegion="no-drag"),"atlas"!=uiTheme&&"dark"!=uiTheme||(o.style.opacity="0.85",o.style.filter="invert(100%)"),e.container.appendChild(o)||document.body.appendChild(o),n.langIcon=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 b=this.get("layout"),v=b.funct;if(b.funct=function(t,o){v.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,l=new mxOrgChartLayout(s,t,n,i),a=s.getDefaultParent();s.model.getChildCount(s.getSelectionCell())>1&&(a=s.getSelectionCell()),l.execute(a),o=!1}},l=document.createElement("div"),a=document.createElement("div");a.style.marginTop="6px",a.style.display="inline-block",a.style.width="140px",mxUtils.write(a,mxResources.get("orgChartType")+": "),l.appendChild(a);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})),l.appendChild(r),(a=document.createElement("div")).style.marginTop="6px",a.style.display="inline-block",a.style.width="140px",mxUtils.write(a,mxResources.get("parentChildSpacing")+": "),l.appendChild(a);var m=document.createElement("input");m.type="number",m.value=n,m.style.width="200px",m.style.boxSizing="border-box",l.appendChild(m),mxEvent.addListener(m,"change",(function(){n=m.value})),(a=document.createElement("div")).style.marginTop="6px",a.style.display="inline-block",a.style.width="140px",mxUtils.write(a,mxResources.get("siblingSpacing")+": "),l.appendChild(a);var g=document.createElement("input");g.type="number",g.value=i,g.style.width="200px",g.style.boxSizing="border-box",l.appendChild(g),mxEvent.addListener(g,"change",(function(){i=g.value}));var p=new CustomDialog(e,l,(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")+"...")},this.put("help",new Menu(mxUtils.bind(this,(function(t,n){if(!mxClient.IS_CHROMEAPP&&e.isOffline())this.addMenuItems(t,["about"],n);else{var i=t.addItem("Search:",null,null,n,null,null,!1);i.style.backgroundColor=Editor.isDarkMode()?"#505759":"whiteSmoke",i.style.cursor="default";var o=document.createElement("input");o.setAttribute("type","text"),o.setAttribute("size","25"),o.style.marginLeft="8px",mxEvent.addListener(o,"keydown",mxUtils.bind(this,(function(e){var t=mxUtils.trim(o.value);13==e.keyCode&&t.length>0?(this.editorUi.openLink("https://www.diagrams.net/search?src="+(EditorUi.isElectronApp?"DESKTOP":encodeURIComponent(location.host))+"&search="+encodeURIComponent(t)),o.value="",EditorUi.logEvent({category:"SEARCH-HELP",action:"search",label:t}),window.setTimeout(mxUtils.bind(this,(function(){this.editorUi.hideCurrentMenu()})),0)):27==e.keyCode&&(o.value="")}))),i.firstChild.nextSibling.appendChild(o),mxEvent.addGestureListeners(o,(function(e){document.activeElement!=o&&o.focus(),mxEvent.consume(e)}),(function(e){mxEvent.consume(e)}),(function(e){mxEvent.consume(e)})),window.setTimeout((function(){o.focus()}),0),EditorUi.isElectronApp?(e.actions.addAction("website...",(function(){e.openLink("https://www.diagrams.net")})),e.actions.addAction("check4Updates",(function(){e.checkForUpdates()})),this.addMenuItems(t,["-","keyboardShortcuts","quickStart","website","support","-"],n),"1"!=urlParams.disableUpdate&&this.addMenuItems(t,["check4Updates","-"],n),this.addMenuItems(t,["forkme","-","about"],n)):this.addMenuItems(t,["-","keyboardShortcuts","quickStart","support","-","forkme","downloadDesktop","-","about"],n)}"1"==urlParams.test&&(t.addSeparator(n),this.addSubmenu("testDevelop",t,n))})))),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,l={},a=0;a<n.length;a++){var r=n[a];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 l[r.id]=r.id}if(Object.keys(l).length>0){var u=t+": "+Object.keys(l).length+" Duplicates: "+Object.keys(l).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 l=n.getElementsByTagName("root"),a=0;a<l.length;a++)s(l[a]);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 E=null;e.actions.addAction("testDiff",mxUtils.bind(this,(function(){if(null!=e.pages){var t=[["Snapshot",function(t,i){E=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(E,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==E?(E=e.getPagesForNode(mxUtils.parseXml(e.getFileData(!0)).documentElement),n.textarea.value="Snapshot created "+(new Date).toLocaleString()):n.textarea.value=JSON.stringify(e.diffPages(E,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 l=new mxXmlCanvas2D(s);l.translate(Math.floor((1-t.x)/i),Math.floor((1-t.y)/i)),l.scale(1/i);var a=0,r=l.save;l.save=function(){a++,r.apply(this,arguments)};var d=l.restore;l.restore=function(){a--,d.apply(this,arguments)};var u=e.drawShape;e.drawShape=function(e){mxLog.debug("entering shape",e,a),u.apply(this,arguments),mxLog.debug("leaving shape",e,a)},e.drawState(n.getView().getState(n.model.root),l),Math.ceil(1*t.width/i+2),Math.ceil(1*t.height/i+2),mxLog.show(),mxLog.debug(mxUtils.getXml(s)),mxLog.debug("stateCounter",a)}))),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,l,a,r,d,u,c){e.createHtml(t,n,i,o,s,l,a,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 l=i.document.createElement("div");l.marginLeft="26px",l.marginTop="26px",mxUtils.write(l,mxResources.get("updatingDocument"));var a=i.document.createElement("img");a.setAttribute("src",window.location.protocol+"//"+window.location.hostname+"/"+IMAGE_PATH+"/spin.gif"),a.style.marginLeft="6px",l.appendChild(a),i.document.body.insertBefore(l,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),l.parentNode.removeChild(l)}),20)}}else e.handleError({message:mxResources.get("errorUpdatingPreview")})}));e.showDialog(i.container,450,240,!0,!0),i.init()})))}))}))}))),e.actions.put("liveImage",new Action("Live image...",(function(){var t=e.getCurrentFile();null!=t&&e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(n){if(e.spinner.stop(),null!=n){var i=new EmbedDialog(e,'<img src="'+(t.constructor!=DriveFile?n:"https://drive.google.com/uc?id="+t.getId())+'"/>');e.showDialog(i.container,450,240,!0,!0),i.init()}else e.handleError({message:mxResources.get("invalidPublicUrl")})}))}))),e.actions.put("embedImage",new Action(mxResources.get("image")+"...",(function(){e.showEmbedImageDialog((function(t,n,i,o,s,l){e.spinner.spin(document.body,mxResources.get("loading"))&&e.createEmbedImage(t,n,i,o,s,l,(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,l){e.spinner.spin(document.body,mxResources.get("loading"))&&e.createEmbedSvg(t,n,i,o,s,l,(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,l,a,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:'+a+";height:"+r+';" src="'+e.createLink(t,n,i,o,s,l,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(){var t=document.createElement("div");t.style.position="absolute",t.style.bottom="30px",t.style.textAlign="center",t.style.width="100%",t.style.left="0px";var n=document.createElement("a");n.setAttribute("href","javascript:void(0);"),n.setAttribute("target","_blank"),n.style.cursor="pointer",mxUtils.write(n,mxResources.get("getNotionChromeExtension")),t.appendChild(n),mxEvent.addListener(n,"click",(function(t){e.openLink("https://chrome.google.com/webstore/detail/drawio-for-notion/plhaalebpkihaccllnkdaokdoeaokmle"),mxEvent.consume(t)})),e.showPublishLinkDialog(mxResources.get("notion"),null,null,null,(function(t,n,i,o,s,l,a,r,d){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(a){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,l,a,null,r,!0));e.showDialog(u.container,450,240,!0,!0),u.init()}))}),!0,"https://www.diagrams.net/blog/drawio-notion",t)}))),e.actions.put("publishLink",new Action(mxResources.get("link")+"...",(function(){e.showPublishLinkDialog(null,null,null,null,(function(t,n,i,o,s,l,a,r,d){e.spinner.spin(document.body,mxResources.get("loading"))&&e.getPublicUrl(e.getCurrentFile(),(function(a){e.spinner.stop();var r=[];d&&r.push("tags=%7B%7D");var u=new EmbedDialog(e,e.createLink(t,n,i,o,s,l,a,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)&&((h=e.actions.addAction("scratchpad",(function(){e.toggleScratchpad()}))).setToggleAction(!0),h.setSelectedCallback((function(){return null!=e.scratchpad})),"0"!=urlParams.plugins&&e.actions.addAction("plugins...",(function(){e.showDialog(new PluginsDialog(e).container,360,170,!0,!1)}))),(h=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"),h.setToggleAction(!0),h.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 S=e.actions.addAction("saveAndExit",(function(){e.actions.get("save").funct(!0)}));S.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).firstChild.nextSibling.innerHTML=mxResources.get("advanced")+"...")})))),this.put("importFrom",new Menu(mxUtils.bind(this,(function(t,i){var r=mxUtils.bind(this,(function(t,i,o){var s=n.view,l=n.getGraphBounds(),a=n.snap(Math.ceil(Math.max(0,l.x/s.scale-s.translate.x)+4*n.gridSize)),r=n.snap(Math.ceil(Math.max(0,(l.y+l.height)/s.scale-s.translate.y)+4*n.gridSize));"data:image/"==t.substring(0,11)?e.loadImage(t,mxUtils.bind(this,(function(s){var l=!0,d=mxUtils.bind(this,(function(){e.resizeImage(s,t,mxUtils.bind(this,(function(s,d,u){var c=l?Math.min(1,Math.min(e.maxImageSize/d,e.maxImageSize/u)):1;e.importFile(t,i,a,r,Math.round(d*c),Math.round(u*c),o,(function(t){e.spinner.stop(),n.setSelectionCells(t),n.scrollCellToVisible(n.getSelectionCell())}))})),l)}));t.length>e.resampleThreshold?e.confirmImageResize((function(e){l=e,d()})):d()})),mxUtils.bind(this,(function(){e.handleError({message:mxResources.get("cannotOpenFile")})}))):e.importFile(t,i,a,r,0,0,o,(function(t){e.spinner.stop(),n.setSelectionCells(t),n.scrollCellToVisible(n.getSelectionCell())}))})),d=mxUtils.bind(this,(function(e){var t="text/xml";return/\.png$/i.test(e)?t="image/png":/\.jpe?g$/i.test(e)?t="image/jpg":/\.gif$/i.test(e)?t="image/gif":/\.pdf$/i.test(e)&&(t="application/pdf"),t}));function u(t){t.pickFile((function(n){e.spinner.spin(document.body,mxResources.get("loading"))&&t.getFile(n,(function(t){var n="data:image/"==t.getData().substring(0,11)?d(t.getTitle()):"text/xml";/\.svg$/i.test(t.getTitle())&&!e.editor.isDataSvg(t.getData())&&(t.setData(Editor.createSvgDataUri(t.getData())),n="image/svg+xml"),r(t.getData(),n,t.getTitle())}),(function(t){e.handleError(t,null!=t?mxResources.get("errorLoadingFile"):null)}),t==e.drive)}),!0)}"undefined"!=typeof google&&void 0!==google.picker&&(null!=e.drive?t.addItem(mxResources.get("googleDrive")+"...",null,(function(){u(e.drive)}),i):o&&"function"==typeof window.DriveClient&&t.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,(function(){}),i,null,!1)),null!=e.oneDrive?t.addItem(mxResources.get("oneDrive")+"...",null,(function(){u(e.oneDrive)}),i):l&&"function"==typeof window.OneDriveClient&&t.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,(function(){}),i,null,!1),null!=e.dropbox?t.addItem(mxResources.get("dropbox")+"...",null,(function(){u(e.dropbox)}),i):s&&"function"==typeof window.DropboxClient&&t.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,(function(){}),i,null,!1),t.addSeparator(i),null!=e.gitHub&&t.addItem(mxResources.get("github")+"...",null,(function(){u(e.gitHub)}),i),null!=e.gitLab&&t.addItem(mxResources.get("gitlab")+"...",null,(function(){u(e.gitLab)}),i),null!=e.notion&&(t.addSeparator(i),t.addItem(mxResources.get("notion")+"...",null,(function(){u(e.notion)}),i)),null!=e.trello?t.addItem(mxResources.get("trello")+"...",null,(function(){u(e.trello)}),i):a&&"function"==typeof window.TrelloClient&&t.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,(function(){}),i,null,!1),t.addSeparator(i),isLocalStorage&&"0"!=urlParams.browser&&t.addItem(mxResources.get("browser")+"...",null,(function(){e.importLocalFile(!1)}),i),"1"!=urlParams.noDevice&&t.addItem(mxResources.get("device")+"...",null,(function(){e.importLocalFile(!0)}),i),e.isOffline()||(t.addSeparator(i),t.addItem(mxResources.get("url")+"...",null,(function(){var t=new FilenameDialog(e,"",mxResources.get("import"),(function(t){if(null!=t&&t.length>0&&e.spinner.spin(document.body,mxResources.get("loading"))){var n=/(\.png)($|\?)/i.test(t)?"image/png":"text/xml";e.editor.loadUrl(PROXY_URL+"?url="+encodeURIComponent(t),(function(e){r(e,n,t)}),(function(){e.spinner.stop(),e.handleError(null,mxResources.get("errorLoadingFile"))}),"image/png"==n)}}),mxResources.get("url"));e.showDialog(t.container,300,80,!0,!0),t.init()}),i))})))).isEnabled=i,this.put("theme",new Menu(mxUtils.bind(this,(function(t,n){var i="1"==urlParams.sketch?"sketch":mxSettings.getUi(),o=t.addItem(mxResources.get("automatic"),null,(function(){mxSettings.setUi(""),e.alert(mxResources.get("restartForChangeRequired"))}),n);"kennedy"!=i&&"atlas"!=i&&"dark"!=i&&"min"!=i&&"sketch"!=i&&t.addCheckmark(o,Editor.checkmarkImage),t.addSeparator(n),o=t.addItem(mxResources.get("default"),null,(function(){mxSettings.setUi("kennedy"),e.alert(mxResources.get("restartForChangeRequired"))}),n),"kennedy"==i&&t.addCheckmark(o,Editor.checkmarkImage),o=t.addItem(mxResources.get("minimal"),null,(function(){mxSettings.setUi("min"),e.alert(mxResources.get("restartForChangeRequired"))}),n),"min"==i&&t.addCheckmark(o,Editor.checkmarkImage),o=t.addItem(mxResources.get("atlas"),null,(function(){mxSettings.setUi("atlas"),e.alert(mxResources.get("restartForChangeRequired"))}),n),"atlas"==i&&t.addCheckmark(o,Editor.checkmarkImage),"dark"!=i&&(mxClient.IS_IE||mxClient.IS_IE11)||(o=t.addItem(mxResources.get("dark"),null,(function(){mxSettings.setUi("dark"),e.alert(mxResources.get("restartForChangeRequired"))}),n),"dark"==i&&t.addCheckmark(o,Editor.checkmarkImage)),t.addSeparator(n),o=t.addItem(mxResources.get("sketch"),null,(function(){mxSettings.setUi("sketch"),e.alert(mxResources.get("restartForChangeRequired"))}),n),"sketch"==i&&t.addCheckmark(o,Editor.checkmarkImage)}))));var y=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==DriveFile||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,96,!0,!0),i.init()}})));y.isEnabled=function(){return this.enabled&&i.apply(this,arguments)},y.visible="1"!=urlParams.embed,e.actions.addAction("makeCopy...",mxUtils.bind(this,(function(){var t=e.getCurrentFile();if(null!=t){var n=e.getCopyFilename(t);if(t.constructor==DriveFile){var i=new CreateDialog(e,n,mxUtils.bind(this,(function(n,i){"_blank"==i?e.editor.editAsNew(e.getFileData(),n):("download"==i&&(i=App.MODE_GOOGLE),null!=n&&n.length>0&&(i==App.MODE_GOOGLE?e.spinner.spin(document.body,mxResources.get("saving"))&&t.saveAs(n,mxUtils.bind(this,(function(n){t.desc=n,t.save(!1,mxUtils.bind(this,(function(){e.spinner.stop(),t.setModified(!1),t.addAllSavedStatus()})),mxUtils.bind(this,(function(t){e.handleError(t)})))})),mxUtils.bind(this,(function(t){e.handleError(t)}))):e.createFile(n,e.getFileData(!0),null,i)))})),mxUtils.bind(this,(function(){e.hideDialog()})),mxResources.get("makeCopy"),mxResources.get("create"),null,null,!0,null,!0,null,null,null,null,e.editor.fileExtensions);e.showDialog(i.container,420,380,!0,!0),i.init()}else e.editor.editAsNew(this.editorUi.getFileData(!0),n)}}))),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("publish",new Menu(mxUtils.bind(this,(function(e,t){this.addMenuItems(e,["publishLink"],t)})))),e.actions.put("useOffline",new Action(mxResources.get("useOffline")+"...",(function(){e.openLink("https://app.draw.io/")}))),e.actions.put("downloadDesktop",new Action(mxResources.get("downloadDesktop")+"...",(function(){e.openLink("https://get.draw.io/")}))),this.editorUi.actions.addAction("share...",mxUtils.bind(this,(function(){try{var t=e.getCurrentFile();null!=t&&t.share()}catch(t){e.handleError(t)}}))),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),"1"==urlParams.embed||e.isOffline()||this.addMenuItems(t,["-","googleDocs","googleSlides","googleSheets","-","microsoftOffice","-","embedNotion"],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 R=function(t,i,o,s){var l=new mxCell(t,new mxGeometry(0,0,i,o),s);l.vertex=!0;var a=n.getCenterInsertPoint(n.getBoundingBoxFromGeometry([l],!0));l.geometry.x=a.x,l.geometry.y=a.y,n.getModel().beginUpdate();try{l=n.addCell(l),n.fireEvent(new mxEventObject("cellsInserted","cells",[l]))}finally{n.getModel().endUpdate()}return n.scrollCellToVisible(l),n.setSelectionCell(l),n.container.focus(),n.editAfterInsert&&n.startEditing(l),window.setTimeout((function(){null!=e.hoverIcons&&e.hoverIcons.update(n.view.getState(l))}),0),l};e.actions.put("insertText",new Action(mxResources.get("text"),(function(){n.isEnabled()&&!n.isCellLocked(n.getDefaultParent())&&n.startEditingAtCell(R("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())&&R("",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())&&R("",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())&&R("",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){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),e.isOffline()||(t.addSeparator(n),t.addItem(mxResources.get("url")+"...",null,(function(){var t=new FilenameDialog(e,"",mxResources.get("open"),(function(t){null!=t&&t.length>0&&(null==e.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(t):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(t)))}),mxResources.get("url"));e.showDialog(t.container,300,80,!0,!0),t.init()}),n))}))),Editor.enableCustomLibraries&&(this.put("newLibrary",new Menu((function(t,n){"undefined"!=typeof google&&void 0!==google.picker&&(null!=e.drive?t.addItem(mxResources.get("googleDrive")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_GOOGLE)}),n):o&&"function"==typeof window.DriveClient&&t.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1)),null!=e.oneDrive?t.addItem(mxResources.get("oneDrive")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_ONEDRIVE)}),n):l&&"function"==typeof window.OneDriveClient&&t.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1),null!=e.dropbox?t.addItem(mxResources.get("dropbox")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_DROPBOX)}),n):s&&"function"==typeof window.DropboxClient&&t.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1),t.addSeparator(n),null!=e.gitHub&&t.addItem(mxResources.get("github")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_GITHUB)}),n),null!=e.gitLab&&t.addItem(mxResources.get("gitlab")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_GITLAB)}),n),null!=e.notion&&(t.addSeparator(n),t.addItem(mxResources.get("notion")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_NOTION)}),n)),null!=e.trello?t.addItem(mxResources.get("trello")+"...",null,(function(){e.showLibraryDialog(null,null,null,null,App.MODE_TRELLO)}),n):a&&"function"==typeof window.TrelloClient&&t.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1),t.addSeparator(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){"undefined"!=typeof google&&void 0!==google.picker&&(null!=e.drive?t.addItem(mxResources.get("googleDrive")+"...",null,(function(){e.pickLibrary(App.MODE_GOOGLE)}),n):o&&"function"==typeof window.DriveClient&&t.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1)),null!=e.oneDrive?t.addItem(mxResources.get("oneDrive")+"...",null,(function(){e.pickLibrary(App.MODE_ONEDRIVE)}),n):l&&"function"==typeof window.OneDriveClient&&t.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1),null!=e.dropbox?t.addItem(mxResources.get("dropbox")+"...",null,(function(){e.pickLibrary(App.MODE_DROPBOX)}),n):s&&"function"==typeof window.DropboxClient&&t.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1),t.addSeparator(n),null!=e.gitHub&&t.addItem(mxResources.get("github")+"...",null,(function(){e.pickLibrary(App.MODE_GITHUB)}),n),null!=e.gitLab&&t.addItem(mxResources.get("gitlab")+"...",null,(function(){e.pickLibrary(App.MODE_GITLAB)}),n),null!=e.notion&&(t.addSeparator(n),t.addItem(mxResources.get("notion")+"...",null,(function(){e.pickLibrary(App.MODE_NOTION)}),n)),null!=e.trello?t.addItem(mxResources.get("trello")+"...",null,(function(){e.pickLibrary(App.MODE_TRELLO)}),n):a&&"function"==typeof window.TrelloClient&&t.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,(function(){}),n,null,!1),t.addSeparator(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),e.isOffline()||(t.addSeparator(n),t.addItem(mxResources.get("url")+"...",null,(function(){var t=new FilenameDialog(e,"",mxResources.get("open"),(function(t){if(null!=t&&t.length>0&&e.spinner.spin(document.body,mxResources.get("loading"))){var n=t;e.editor.isCorsEnabledForUrl(t)||(n=PROXY_URL+"?url="+encodeURIComponent(t)),mxUtils.get(n,(function(n){if(n.getStatus()>=200&&n.getStatus()<=299){e.spinner.stop();try{e.loadLibrary(new UrlLibrary(this,n.getText(),t))}catch(t){e.handleError(t,mxResources.get("errorLoadingFile"))}}else e.spinner.stop(),e.handleError(null,mxResources.get("errorLoadingFile"))}),(function(){e.spinner.stop(),e.handleError(null,mxResources.get("errorLoadingFile"))}))}}),mxResources.get("url"));e.showDialog(t.container,300,80,!0,!0),t.init()}),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"])})))),(h=e.actions.addAction("comments",mxUtils.bind(this,(function(){if(null==this.commentsWindow)this.commentsWindow=new CommentsWindow(e,document.body.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),h.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 C=this.get("viewPanels"),I=C.funct;if(C.funct=function(t,n){I.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)})))),EditorUi.isElectronApp){var D="1"==urlParams.enableSpellCheck,M=e.actions.addAction("spellCheck",(function(){e.toggleSpellCheck(),D=!D,e.alert(mxResources.get("restartForChangeRequired"))}));M.setToggleAction(!0),M.setSelectedCallback((function(){return D}))}function U(e,t,n){this.ui=e,this.extFonts=t,this.previousExtFonts=t,this.customFonts=n,this.prevCustomFonts=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")}EditorUi.isElectronApp&&this.addMenuItems(t,["spellCheck"],n),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(null!=i&&i.constructor==DriveFile){i.isRestricted()&&this.addMenuItems(t,["exportOptionsDisabled"],n),this.addMenuItems(t,["save","-","share"],n);var o=this.addMenuItem(t,"synchronize",n);(!e.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(o,"https://www.diagrams.net/doc/faq/synchronize"),t.addSeparator(n)}else this.addMenuItems(t,["new"],n);if(this.addSubmenu("openFrom",t,n),isLocalStorage&&this.addSubmenu("openRecent",t,n),null!=i&&i.constructor==DriveFile?this.addMenuItems(t,["new","-","rename","makeCopy","moveToFolder"],n):(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||null==i||i.constructor==LocalFile&&null==i.fileHandle||(t.addSeparator(n),o=this.addMenuItem(t,"synchronize",n),(!e.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(o,"https://www.diagrams.net/doc/faq/synchronize")),this.addMenuItems(t,["-","save","saveAs","-"],n),mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||"draw.io"!=e.getServiceName()||e.isOfflineApp()||null==i||this.addMenuItems(t,["share","-"],n),this.addMenuItems(t,["rename"],n),e.isOfflineApp()?navigator.onLine&&"1"!=urlParams.stealth&&"1"!=urlParams.lockdown&&this.addMenuItems(t,["upload"],n):(this.addMenuItems(t,["makeCopy"],n),null!=i&&i.constructor==OneDriveFile&&this.addMenuItems(t,["moveToFolder"],n))),t.addSeparator(n),this.addSubmenu("importFrom",t,n),this.addSubmenu("exportAs",t,n),t.addSeparator(n),this.addSubmenu("embed",t,n),this.addSubmenu("publish",t,n),t.addSeparator(n),this.addSubmenu("newLibrary",t,n),this.addSubmenu("openLibraryFrom",t,n),e.isRevisionHistorySupported()&&this.addMenuItems(t,["-","revisionHistory"],n),null!=i&&null!=e.fileNode&&"1"!=urlParams.embedInline){var s=null!=i.getTitle()?i.getTitle():e.defaultFilename;/(\.html)$/i.test(s)||/(\.svg)$/i.test(s)||this.addMenuItems(t,["-","properties"])}this.addMenuItems(t,["-","pageSetup"],n),mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(t,["print"],n),this.addMenuItems(t,["-","close"])}})))),U.prototype.execute=function(){var e=this.ui.editor.graph;this.customFonts=this.prevCustomFonts,this.prevCustomFonts=this.ui.menus.customFonts,this.ui.fireEvent(new mxEventObject("customFontsChanged","customFonts",this.customFonts)),this.extFonts=this.previousExtFonts;for(var t=e.extFonts,n=0;null!=t&&n<t.length;n++){var i=document.getElementById("extFont_"+t[n].name);null!=i&&i.parentNode.removeChild(i)}for(e.extFonts=[],n=0;null!=this.previousExtFonts&&n<this.previousExtFonts.length;n++)this.ui.editor.graph.addExtFont(this.previousExtFonts[n].name,this.previousExtFonts[n].url);this.previousExtFonts=t},this.put("fontFamily",new Menu(mxUtils.bind(this,(function(t,n){for(var i=mxUtils.bind(this,(function(i,o,s,l,a){var r=e.editor.graph,d=this.styleChange(t,l||i,"1"!=urlParams["ext-fonts"]?[mxConstants.STYLE_FONTFAMILY,"fontSource","FType"]:[mxConstants.STYLE_FONTFAMILY],"1"!=urlParams["ext-fonts"]?[i,null!=o?encodeURIComponent(o):null,null]:[i],null,n,(function(){"1"!=urlParams["ext-fonts"]?r.setFont(i,o):(document.execCommand("fontname",!1,i),r.addExtFont(i,o)),e.fireEvent(new mxEventObject("styleChanged","keys","1"!=urlParams["ext-fonts"]?[mxConstants.STYLE_FONTFAMILY,"fontSource","FType"]:[mxConstants.STYLE_FONTFAMILY],"values","1"!=urlParams["ext-fonts"]?[i,null!=o?encodeURIComponent(o):null,null]:[i],"cells",[r.cellEditor.getEditingCell()]))}),(function(){r.updateLabelElements(r.getSelectionCells(),(function(e){e.removeAttribute("face"),e.style.fontFamily=null,"PRE"==e.nodeName&&r.replaceElement(e,"div")})),"1"==urlParams["ext-fonts"]&&r.addExtFont(i,o)}));if(s){var u=document.createElement("span");u.className="geSprite geSprite-delete",u.style.cursor="pointer",u.style.display="inline-block",d.firstChild.nextSibling.nextSibling.appendChild(u),mxEvent.addListener(u,mxClient.IS_POINTER?"pointerup":"mouseup",mxUtils.bind(this,(function(t){if("1"!=urlParams["ext-fonts"]){delete Graph.recentCustomFonts[i.toLowerCase()];for(var n=0;n<this.customFonts.length;n++)if(this.customFonts[n].name==i&&this.customFonts[n].url==o){this.customFonts.splice(n,1),e.fireEvent(new mxEventObject("customFontsChanged"));break}}else{var s=mxUtils.clone(this.editorUi.editor.graph.extFonts);if(null!=s&&s.length>0)for(n=0;n<s.length;n++)if(s[n].name==i){s.splice(n,1);break}var l=mxUtils.clone(this.customFonts);for(n=0;n<l.length;n++)if(l[n].name==i){l.splice(n,1);break}var a=new U(this.editorUi,s,l);this.editorUi.editor.graph.model.execute(a)}this.editorUi.hideCurrentMenu(),mxEvent.consume(t)})))}Graph.addFont(i,o),d.firstChild.nextSibling.style.fontFamily=i,null!=a&&d.setAttribute("title",a)})),o={},s=0;s<this.defaultFonts.length;s++){var l=this.defaultFonts[s];"string"==typeof l?i(l):null!=l.fontFamily&&null!=l.fontUrl&&(o[encodeURIComponent(l.fontFamily)+"@"+encodeURIComponent(l.fontUrl)]=!0,i(l.fontFamily,l.fontUrl))}if(t.addSeparator(n),"1"!=urlParams["ext-fonts"]){var a={},r={},d=[];function u(e){var t=encodeURIComponent(e.name)+(null==e.url?"":"@"+encodeURIComponent(e.url));if(!o[t]){for(var n=e.name,i=0;null!=r[n.toLowerCase()];)n=e.name+" ("+ ++i+")";null==a[t]&&(d.push({name:e.name,url:e.url,label:n,title:e.url}),r[n.toLowerCase()]=e,a[t]=e)}}for(s=0;s<this.customFonts.length;s++)u(this.customFonts[s]);for(var c in Graph.recentCustomFonts)u(Graph.recentCustomFonts[c]);if(d.sort((function(e,t){return e.label<t.label?-1:e.label>t.label?1:0})),d.length>0){for(s=0;s<d.length;s++)i(d[s].name,d[s].url,!0,d[s].label,d[s].url);t.addSeparator(n)}t.addItem(mxResources.get("reset"),null,mxUtils.bind(this,(function(){Graph.recentCustomFonts={},this.customFonts=[],e.fireEvent(new mxEventObject("customFontsChanged"))})),n),t.addSeparator(n)}else{var m=this.editorUi.editor.graph.extFonts;if(null!=m&&m.length>0){var g={},p=!1;for(s=0;s<this.customFonts.length;s++)g[this.customFonts[s].name]=!0;for(s=0;s<m.length;s++)g[m[s].name]||(this.customFonts.push(m[s]),p=!0);p&&this.editorUi.fireEvent(new mxEventObject("customFontsChanged","customFonts",this.customFonts))}if(this.customFonts.length>0){for(s=0;s<this.customFonts.length;s++){var h=this.customFonts[s].name,f=this.customFonts[s].url;i(h,f,!0),this.editorUi.editor.graph.addExtFont(h,f,!0)}t.addSeparator(n),t.addItem(mxResources.get("reset"),null,mxUtils.bind(this,(function(){var t=new U(this.editorUi,[],[]);e.editor.graph.model.execute(t)})),n),t.addSeparator(n)}}t.addItem(mxResources.get("custom")+"...",null,mxUtils.bind(this,(function(){var e=this.editorUi.editor.graph,t=e.getStylesheet().getDefaultVertexStyle()[mxConstants.STYLE_FONTFAMILY],n="s",i=null;if("1"!=urlParams["ext-fonts"]&&e.isEditing()){var o=e.getSelectedEditingElement();if(null!=o){var s=mxUtils.getCurrentStyle(o);null!=s&&(t=Graph.stripQuotes(s.fontFamily),null!=(i=Graph.getFontUrl(t,null))&&(Graph.isGoogleFontUrl(i)?(i=null,n="g"):n="w"))}}else{var l=e.getView().getState(e.getSelectionCell());if(null!=l)if(t=l.style[mxConstants.STYLE_FONTFAMILY]||t,"1"!=urlParams["ext-fonts"]){var a=l.style.fontSource;null!=a&&(a=decodeURIComponent(a),Graph.isGoogleFontUrl(a)?n="g":(n="w",i=a))}else if("w"==(n=l.style.FType||n)){var r=this.editorUi.editor.graph.extFonts,d=null;null!=r&&(d=r.find((function(e){return e.name==t}))),i=null!=d?d.url:mxResources.get("urlNotFound",null,"URL not found")}}null!=i&&i.substring(0,PROXY_URL.length)==PROXY_URL&&(i=decodeURIComponent(i.substr((PROXY_URL+"?url=").length)));var u=null;document.activeElement==e.cellEditor.textarea&&(u=e.cellEditor.saveSelection());var c=new FontDialog(this.editorUi,t,i,n,mxUtils.bind(this,(function(t,n,i){if(null!=u&&(e.cellEditor.restoreSelection(u),u=null),null!=t&&t.length>0)if("1"!=urlParams["ext-fonts"]&&e.isEditing())e.setFont(t,n);else{e.getModel().beginUpdate();try{e.stopEditing(!1),"1"!=urlParams["ext-fonts"]?(e.setCellStyles(mxConstants.STYLE_FONTFAMILY,t),e.setCellStyles("fontSource",null!=n?encodeURIComponent(n):null),e.setCellStyles("FType",null)):(e.setCellStyles(mxConstants.STYLE_FONTFAMILY,t),"s"!=i&&(e.setCellStyles("FType",i),0==n.indexOf("http://")&&(n=PROXY_URL+"?url="+encodeURIComponent(n)),this.editorUi.editor.graph.addExtFont(t,n)));for(var o=!0,s=0;s<this.customFonts.length;s++)if(this.customFonts[s].name==t){o=!1;break}o&&(this.customFonts.push({name:t,url:n}),this.editorUi.fireEvent(new mxEventObject("customFontsChanged","customFonts",this.customFonts)))}finally{e.getModel().endUpdate()}}})));this.editorUi.showDialog(c.container,380,Editor.enableWebFonts?250:180,!0,!0),c.init()})),n,null,!0)}))))}}();