13.2.1 release

This commit is contained in:
Gaudenz Alder 2020-06-09 20:54:36 +02:00
parent c5485b6e66
commit b2c00d159a
6 changed files with 111 additions and 104 deletions

View file

@ -1,3 +1,8 @@
09-JUN-2020: 13.2.1
- Fixes bug when pasting HTML
- Parsing improvements
09-JUN-2020: 13.2.0
- Fixes WebKitBlobResource on iOS

View file

@ -1 +1 @@
13.2.0
13.2.1

View file

@ -2598,7 +2598,7 @@ e&&(d=this.view.getState(a),h=this.view.getState(e),null!=d&&null!=h&&mxUtils.in
!this.isCellConnectable(e)&&!this.isSwimlane(e))e=null;d=[];this.model.beginUpdate();try{var n=null!=e&&this.isSwimlane(e),h=n?null:e;if(null==h&&f){for(var l=a,m=this.getCellGeometry(a);null!=m&&m.relative;)l=this.getModel().getParent(l),m=this.getCellGeometry(l);l=this.getCompositeParent(l);h=this.duplicateCells([l],!1)[0];m=this.getCellGeometry(h);null!=m&&(m.x=g.x-m.width/2,m.y=g.y-m.height/2);n&&(this.addCells([h],e,null,null,null,!0),e=null)}n=null;null!=this.layoutManager&&(n=this.layoutManager.getLayout(this.model.getParent(a)));
var p=mxEvent.isControlDown(b)&&f||null==e&&null!=n&&n.constructor==mxStackLayout?null:this.insertEdge(this.model.getParent(a),null,"",a,h,this.createCurrentEdgeStyle());if(null!=p&&this.connectionHandler.insertBeforeSource){var t=null;for(b=a;null!=b.parent&&null!=b.geometry&&b.geometry.relative&&b.parent!=p.parent;)b=this.model.getParent(b);null!=b&&null!=b.parent&&b.parent==p.parent&&(t=b.parent.getIndex(b),this.model.add(b.parent,p,t))}null==e&&null!=h&&null!=n&&null!=a.parent&&n.constructor==
mxStackLayout&&c==mxConstants.DIRECTION_WEST&&(t=a.parent.getIndex(a),this.model.add(a.parent,h,t));null!=p&&d.push(p);null==e&&null!=h&&d.push(h);null==h&&null!=p&&p.geometry.setTerminalPoint(g,!1);null!=p&&this.fireEvent(new mxEventObject("cellsInserted","cells",[p]))}finally{this.model.endUpdate()}return d};
Graph.prototype.getIndexableText=function(){var a=document.createElement("div"),c=[],d,b;for(b in this.model.cells)if(d=this.model.cells[b],this.model.isVertex(d)||this.model.isEdge(d))this.isHtmlLabel(d)?(a.innerHTML=this.getLabel(d),d=mxUtils.extractTextWithWhitespace([a])):d=this.getLabel(d),d=mxUtils.trim(d.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")),0<d.length&&c.push(d);return c.join(" ")};
Graph.prototype.getIndexableText=function(){var a=document.createElement("div"),c=[],d,b;for(b in this.model.cells)if(d=this.model.cells[b],this.model.isVertex(d)||this.model.isEdge(d))this.isHtmlLabel(d)?(a.innerHTML=this.sanitizeHtml(this.getLabel(d)),d=mxUtils.extractTextWithWhitespace([a])):d=this.getLabel(d),d=mxUtils.trim(d.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")),0<d.length&&c.push(d);return c.join(" ")};
Graph.prototype.convertValueToString=function(a){var c=this.model.getValue(a);if(null!=c&&"object"==typeof c){if(this.isReplacePlaceholders(a)&&null!=a.getAttribute("placeholder")){for(var c=a.getAttribute("placeholder"),d=a,b=null;null==b&&null!=d;)null!=d.value&&"object"==typeof d.value&&(b=d.hasAttribute(c)?null!=d.getAttribute(c)?d.getAttribute(c):"":null),d=this.model.getParent(d);return b||""}return c.getAttribute("label")||""}return mxGraph.prototype.convertValueToString.apply(this,arguments)};
Graph.prototype.getLinksForState=function(a){return null!=a&&null!=a.text&&null!=a.text.node?a.text.node.getElementsByTagName("a"):null};Graph.prototype.getLinkForCell=function(a){return null!=a.value&&"object"==typeof a.value?(a=a.value.getAttribute("link"),null!=a&&"javascript:"===a.toLowerCase().substring(0,11)&&(a=a.substring(11)),a):null};
Graph.prototype.getCellStyle=function(a){var c=mxGraph.prototype.getCellStyle.apply(this,arguments);if(null!=a&&null!=this.layoutManager){var d=this.model.getParent(a);this.model.isVertex(d)&&this.isCellCollapsed(a)&&(d=this.layoutManager.getLayout(d),null!=d&&d.constructor==mxStackLayout&&(c[mxConstants.STYLE_HORIZONTAL]=!d.horizontal))}return c};
@ -9285,7 +9285,7 @@ function(){e.openLink("https://desk.draw.io/support/solutions/articles/160000489
var F=ChangePageSetup.prototype.execute;ChangePageSetup.prototype.execute=function(){null==this.page&&(this.page=this.ui.currentPage);this.page!=this.ui.currentPage?null!=this.page.viewState&&(this.ignoreColor||(this.page.viewState.background=this.color),this.ignoreImage||(this.page.viewState.backgroundImage=this.image),null!=this.format&&(this.page.viewState.pageFormat=this.format),null!=this.mathEnabled&&(this.page.viewState.mathEnabled=this.mathEnabled),null!=this.shadowVisible&&(this.page.viewState.shadowVisible=
this.shadowVisible)):(F.apply(this,arguments),null!=this.mathEnabled&&this.mathEnabled!=this.ui.isMathEnabled()&&(this.ui.setMathEnabled(this.mathEnabled),this.mathEnabled=!this.mathEnabled),null!=this.shadowVisible&&this.shadowVisible!=this.ui.editor.graph.shadowVisible&&(this.ui.editor.graph.setShadowVisible(this.shadowVisible),this.shadowVisible=!this.shadowVisible))};Editor.prototype.useCanvasForExport=!1;try{var C=document.createElement("canvas"),I=new Image;I.onload=function(){try{C.getContext("2d").drawImage(I,
0,0);var a=C.toDataURL("image/png");Editor.prototype.useCanvasForExport=null!=a&&6<a.length}catch(K){}};I.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1px" height="1px" version="1.1"><foreignObject pointer-events="all" width="1" height="1"><div xmlns="http://www.w3.org/1999/xhtml"></div></foreignObject></svg>')))}catch(H){}})();
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,c,b){b.ui=a.ui;return c};a.afterDecode=function(a,c,b){b.previousColor=b.color;b.previousImage=b.image;b.previousFormat=b.format;null!=b.foldingEnabled&&(b.foldingEnabled=!b.foldingEnabled);null!=b.mathEnabled&&(b.mathEnabled=!b.mathEnabled);null!=b.shadowVisible&&(b.shadowVisible=!b.shadowVisible);return b};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="13.2.0";EditorUi.compactUi="atlas"!=uiTheme;mxGraphView.prototype.defaultDarkGridColor="#6e6e6e";"dark"==uiTheme&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);EditorUi.enableLogging="1"!=urlParams.stealth&&(/.*\.draw\.io$/.test(window.location.hostname)||/.*\.diagrams\.net$/.test(window.location.hostname))&&"support.draw.io"!=window.location.hostname;EditorUi.drawHost=window.DRAWIO_BASE_URL;EditorUi.lastErrorMessage=null;EditorUi.ignoredAnonymizedChars=
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,c,b){b.ui=a.ui;return c};a.afterDecode=function(a,c,b){b.previousColor=b.color;b.previousImage=b.image;b.previousFormat=b.format;null!=b.foldingEnabled&&(b.foldingEnabled=!b.foldingEnabled);null!=b.mathEnabled&&(b.mathEnabled=!b.mathEnabled);null!=b.shadowVisible&&(b.shadowVisible=!b.shadowVisible);return b};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="13.2.1";EditorUi.compactUi="atlas"!=uiTheme;mxGraphView.prototype.defaultDarkGridColor="#6e6e6e";"dark"==uiTheme&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);EditorUi.enableLogging="1"!=urlParams.stealth&&(/.*\.draw\.io$/.test(window.location.hostname)||/.*\.diagrams\.net$/.test(window.location.hostname))&&"support.draw.io"!=window.location.hostname;EditorUi.drawHost=window.DRAWIO_BASE_URL;EditorUi.lastErrorMessage=null;EditorUi.ignoredAnonymizedChars=
"\n\t`~!@#$%^&*()_+{}|:\"<>?-=[];'./,\n\t";EditorUi.templateFile=TEMPLATE_PATH+"/index.xml";EditorUi.cacheUrl="1"==urlParams.dev?"/cache":window.REALTIME_URL;null==EditorUi.cacheUrl&&"undefined"!==typeof DrawioFile&&(DrawioFile.SYNC="none");Editor.cacheTimeout=1E4;EditorUi.enablePlantUml=EditorUi.enableLogging;EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.enableDrafts=!mxClient.IS_CHROMEAPP&&isLocalStorage&&
!EditorUi.isElectronApp&&"0"!=urlParams.drafts;EditorUi.scratchpadHelpLink="https://desk.draw.io/support/solutions/articles/16000042367";EditorUi.defaultMermaidConfig={theme:"neutral",arrowMarkerAbsolute:!1,flowchart:{htmlLabels:!1},sequence:{diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,mirrorActors:!0,bottomMarginAdj:1,useMaxWidth:!0,rightAngles:!1,showSequenceNumbers:!1},gantt:{titleTopMargin:25,barHeight:20,barGap:4,
topPadding:50,leftPadding:75,gridLineStartPadding:35,fontSize:11,fontFamily:'"Open-Sans", "sans-serif"',numberSectionStyles:4,axisFormat:"%Y-%m-%d"}};EditorUi.logError=function(a,b,c,e,f,k,l){k=null!=k?k:0<=a.indexOf("NetworkError")||0<=a.indexOf("SecurityError")||0<=a.indexOf("NS_ERROR_FAILURE")||0<=a.indexOf("out of memory")?"CONFIG":"SEVERE";if(EditorUi.enableLogging&&"1"!=urlParams.dev)try{if(a!=EditorUi.lastErrorMessage&&(null==a||null==b||-1==a.indexOf("Script error")&&-1==a.indexOf("extension"))&&
@ -9543,55 +9543,55 @@ function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor,"dark"==u
8>=parseInt(mxSettings.settings.version||0))||(this.toggleScratchpad(),mxSettings.save());this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})}};EditorUi.prototype.copyCells=function(a,b){var d=this.editor.graph;if(d.isSelectionEmpty())a.innerHTML="";else{var c=mxUtils.sortCells(d.model.getTopmostCells(d.getSelectionCells())),e=mxUtils.getXml(d.encodeCells(c));mxUtils.setTextContent(a,encodeURIComponent(e));b?(d.removeCells(c,!1),d.lastPasteXml=
null):(d.lastPasteXml=e,d.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b,c,e){if(!mxEvent.isConsumed(a)){var d=b,g=!1;if(c&&null!=a.clipboardData&&a.clipboardData.getData){var f=a.clipboardData.getData("text/html");if(null!=f&&0<f.length){var k="<meta "==f.substring(0,6),d=document.createElement("div");d.innerHTML=(k?'<meta charset="utf-8">':"")+this.editor.graph.sanitizeHtml(f);g=!0;f=d.getElementsByTagName("style");if(null!=f)for(;0<
f.length;)f[0].parentNode.removeChild(f[0]);null!=d.firstChild&&d.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT&&null!=d.firstChild.nextSibling&&d.firstChild.nextSibling.nodeType==mxConstants.NODETYPE_ELEMENT&&"META"==d.firstChild.nodeName&&"A"==d.firstChild.nextSibling.nodeName&&null==d.firstChild.nextSibling.nextSibling&&(f=null==d.firstChild.nextSibling.innerText?mxUtils.getTextContent(d.firstChild.nextSibling):d.firstChild.nextSibling.innerText,f==d.firstChild.nextSibling.getAttribute("href")&&
(mxUtils.setTextContent(d,f),g=!1));k=k&&null!=d.firstChild?d.firstChild.nextSibling:d.firstChild;null!=k&&null==k.nextSibling&&(f=k.getAttribute("src"),null!=f&&(mxUtils.setTextContent(d,f),g=!1));g&&Graph.removePasteFormatting(d)}else f=a.clipboardData.getData("text/plain"),null!=f&&0<f.length&&(d=document.createElement("div"),mxUtils.setTextContent(d,f))}k=d.getElementsByTagName("span");if(null!=k&&0<k.length&&"application/vnd.lucid.chart.objects"===k[0].getAttribute("data-lucid-type"))c=k[0].getAttribute("data-lucid-content"),
null!=c&&0<c.length&&(this.convertLucidChart(c,mxUtils.bind(this,function(a){var b=this.editor.graph;b.lastPasteXml==a?b.pasteCounter++:(b.lastPasteXml=a,b.pasteCounter=0);var d=b.pasteCounter*b.gridSize;b.setSelectionCells(this.importXml(a,d,d));b.scrollCellToVisible(b.getSelectionCell())}),mxUtils.bind(this,function(a){this.handleError(a)})),mxEvent.consume(a));else{g=g?d.innerHTML:mxUtils.trim(null==d.innerText?mxUtils.getTextContent(d):d.innerText);f=!1;try{var l=g.lastIndexOf("%3E");0<=l&&l<
g.length-3&&(g=g.substring(0,l+3))}catch(B){}try{var k=d.getElementsByTagName("span"),m=null!=k&&0<k.length?mxUtils.trim(decodeURIComponent(k[0].textContent)):decodeURIComponent(g);this.isCompatibleString(m)&&(f=!0,g=m)}catch(B){}try{var n=this.editor.graph;if(null!=g&&0<g.length){n.lastPasteXml==g?n.pasteCounter++:(n.lastPasteXml=g,n.pasteCounter=0);var A=n.pasteCounter*n.gridSize;if(f||this.isCompatibleString(g))n.setSelectionCells(this.importXml(g,A,A));else if(e&&1==n.getSelectionCount())/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)&&
"image"==n.getCurrentCellStyle(n.getSelectionCell())[mxConstants.STYLE_SHAPE]?n.setCellStyles(mxConstants.STYLE_IMAGE,g):(n.labelChanged(n.getSelectionCell(),g),Graph.isLink(g)&&n.setLinkForCell(n.getSelectionCell(),g));else{var z=n.getInsertPoint();n.isMouseInsertPoint()&&(A=0,n.lastPasteXml==g&&0<n.pasteCounter&&n.pasteCounter--);n.setSelectionCells(this.insertTextAt(g,z.x+A,z.y+A,!0))}n.isSelectionEmpty()||(n.scrollCellToVisible(n.getSelectionCell()),null!=this.hoverIcons&&this.hoverIcons.update(n.view.getState(n.getSelectionCell())));
try{mxEvent.consume(a)}catch(B){}}else c||(n.lastPasteXml=null,n.pasteCounter=0)}catch(B){this.handleError(B)}}}b.innerHTML="&nbsp;"};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,d=0;d<a.length;d++)mxEvent.addListener(a[d],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[d],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==
b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[d],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):
this.openFiles(a.dataTransfer.files,!0);else{var d=this.extractGraphModelFromEvent(a);if(null==d){var c=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=c&&(10==document.documentMode||11==document.documentMode?d=c.getData("Text"):(d=null,d=0<=mxUtils.indexOf(c.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(c.types,"text/html")?c.getData("text/html"):null,null!=d&&0<d.length?(c=document.createElement("div"),c.innerHTML=this.editor.graph.sanitizeHtml(d),c=
c.getElementsByTagName("img"),0<c.length&&(d=c[0].getAttribute("src"))):0<=mxUtils.indexOf(c.types,"text/plain")&&(d=c.getData("text/plain"))),null!=d&&("data:image/png;base64,"==d.substring(0,22)?(d=this.extractGraphModelFromPng(d),null!=d&&0<d.length&&this.openLocalFile(d,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(d)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(d))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),
null,!0)})):/^https?:\/\//.test(d)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(d):window.openWindow((mxClient.IS_CHROMEAPP?EditorUi.drawHost+"/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(d)))))}else this.openLocalFile(d,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,d=0,c,e;if(null==a){e=document.body;var f=document.documentElement;c=(e.clientWidth||f.clientWidth)-3;e=Math.max(e.clientHeight||
0,f.clientHeight)-3}else b=a.offsetTop,d=a.offsetLeft,c=a.clientWidth,e=a.clientHeight;f=document.createElement("div");f.style.zIndex=mxPopupMenu.prototype.zIndex+2;f.style.border="3px dotted rgb(254, 137, 12)";f.style.pointerEvents="none";f.style.position="absolute";f.style.top=b+"px";f.style.left=d+"px";f.style.width=Math.max(0,c-3)+"px";f.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(f):document.body.appendChild(f);
return f};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var d=new mxCodec(b.ownerDocument),c=new mxGraphModel;d.decode(b,c);b=c.getChildAt(c.getRoot(),0);for(d=0;d<c.getChildCount(b);d++)a.push(c.getChildAt(b,d))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var d=0;d<a.length;d++)mxUtils.bind(this,function(a){var d=new FileReader;d.onload=
mxUtils.bind(this,function(d){try{var c=d.target.result,e=a.name;if(null!=e&&0<e.length){!this.useCanvasForExport&&/(\.png)$/i.test(e)?e=e.substring(0,e.length-4)+".drawio":/(\.pdf)$/i.test(e)&&(e=e.substring(0,e.length-4)+".drawio");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".drawio":e+".drawio";if("<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);
try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(A){this.handleError(A,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b)});if(/(\.v(dx|sdx?))($|\?)/i.test(e)||/(\.vs(x|sx?))($|\?)/i.test(e))this.importVisio(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(/(\.*<graphml )/.test(c))this.importGraphML(c,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,
e))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?f(a.responseText):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(c))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".drawio"),this.convertLucidChart(c,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,e,b)}),mxUtils.bind(this,function(a){this.spinner.stop();
this.handleError(a)}));else if("<mxlibrary"==d.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,d.target.result,a.name))}catch(x){this.handleError(x,mxResources.get("errorLoadingFile"))}}else if(0==c.indexOf("PK"))this.importZipFile(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}),mxUtils.bind(this,function(){this.spinner.stop();
this.openLocalFile(c,e,b)}));else{if("image/png"==a.type.substring(0,9))c=this.extractGraphModelFromPng(c);else if("application/pdf"==a.type){var g=Editor.extractGraphModelFromPdf(c);null!=g&&(c=g)}this.spinner.stop();this.openLocalFile(c,e,b)}}}catch(x){this.handleError(x)}});d.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"!==a.type.substring(0,5)&&"application/pdf"!==a.type||"image/svg"===a.type.substring(0,9)?d.readAsText(a):d.readAsDataURL(a)})(a[d])};
EditorUi.prototype.openLocalFile=function(a,b,c){var d=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var d=mxUtils.parseXml(a);null!=d&&(this.editor.setGraphXml(d.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,c))});if(null!=a&&0<a.length)null==d||!d.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?e():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&
null!=d&&d.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){null!=d&&d.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):e()})));else throw Error(mxResources.get("notADiagramFile"));};EditorUi.prototype.getBasenames=
function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],c;for(c in a)b.push(c);return b};EditorUi.prototype.addBasenamesForCell=function(a,b){function d(a){if(null!=a){var d=a.lastIndexOf(".");0<d&&(a=a.substring(d+1,a.length));null==b[a]&&(b[a]=!0)}}var c=this.editor.graph,e=c.getCellStyle(a);d(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));
c.model.isEdge(a)&&(d(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),d(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=c.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(c.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=
a?"":"none";this.editor.graph.setEnabled(a);null!=this.ruler&&(this.ruler.hRuler.container.style.visibility=a?"":"hidden",this.ruler.vRuler.container.style.visibility=a?"":"hidden");null!=this.tabContainer&&(this.tabContainer.style.visibility=a?"":"hidden");a||(null!=this.actions.outlineWindow&&this.actions.outlineWindow.window.setVisible(!1),null!=this.actions.layersWindow&&this.actions.layersWindow.window.setVisible(!1),null!=this.menus.tagsWindow&&this.menus.tagsWindow.window.setVisible(!1),null!=
this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1))};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,b,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);if(null==a||0==a.length)a=this.emptyDiagramXml;this.setCurrentFile(new LocalFile(this,a,this.defaultFilename,
!0));this.setFileData(a);this.editor.isChromelessView()?this.editor.graph.isLightboxView()&&this.lightboxFit():this.showLayersDialog();this.chromelessResize&&this.chromelessResize();this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?
this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,bounds:b.getGraphBounds(),currentPage:this.getSelectedPageIndex(),scale:b.view.scale,page:b.view.getBackgroundPageBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,d=!1,
c=!1,e=null,f=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,f);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){if(f.source==(window.opener||window.parent)){var g=f.data,l=mxUtils.bind(this,function(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/png;base64,"==
a.substring(0,22)?a=this.extractGraphModelFromPng(a):"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=Graph.decompress(a)))}catch(P){}return a});if("json"==urlParams.proto){try{g=JSON.parse(g)}catch(T){g=null}try{if(null==g)return;if("dialog"==g.action){this.showError(null!=g.titleKey?mxResources.get(g.titleKey):g.title,null!=g.messageKey?
mxResources.get(g.messageKey):g.message,null!=g.buttonKey?mxResources.get(g.buttonKey):g.button);null!=g.modified&&(this.editor.modified=g.modified);return}if("prompt"==g.action){this.spinner.stop();var m=new FilenameDialog(this,g.defaultValue||"",null!=g.okKey?mxResources.get(g.okKey):null,function(a){null!=a&&k.postMessage(JSON.stringify({event:"prompt",value:a,message:g}),"*")},null!=g.titleKey?mxResources.get(g.titleKey):g.title);this.showDialog(m.container,300,80,!0,!1);m.init();return}if("draft"==
g.action){var n=l(g.xml);this.spinner.stop();m=new DraftDialog(this,mxResources.get("draftFound",[g.name||this.defaultFilename]),n,mxUtils.bind(this,function(){this.hideDialog();k.postMessage(JSON.stringify({event:"draft",result:"edit",message:g}),"*")}),mxUtils.bind(this,function(){this.hideDialog();k.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),g.editKey?mxResources.get(g.editKey):null,g.discardKey?mxResources.get(g.discardKey):null,g.ignore?mxUtils.bind(this,function(){this.hideDialog();
k.postMessage(JSON.stringify({event:"draft",result:"ignore",message:g}),"*")}):null);this.showDialog(m.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{m.init()}catch(T){k.postMessage(JSON.stringify({event:"draft",error:T.toString(),message:g}),"*")}return}if("template"==g.action){this.spinner.stop();var p=1==g.enableRecent,t=1==g.enableSearch,q=1==g.enableCustomTemp,m=new NewDialog(this,!1,null!=g.callback,mxUtils.bind(this,function(b,d){b=b||this.emptyDiagramXml;
null!=g.callback?k.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:d,message:g}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,p?mxUtils.bind(this,function(a){this.remoteInvoke("getRecentDiagrams",null,null,a,function(){a(null,"Network Error!")})}):null,t?mxUtils.bind(this,function(a,b){this.remoteInvoke("searchDiagrams",[a],null,b,function(){b(null,"Network Error!")})}):null,mxUtils.bind(this,
function(a,b,d){k.postMessage(JSON.stringify({event:"template",docUrl:a,info:b,name:d}),"*")}),null,null,q?mxUtils.bind(this,function(a){this.remoteInvoke("getCustomTemplates",null,null,a,function(){a({},0)})}):null);this.showDialog(m.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));m.init();return}if("textContent"==g.action){var v=this.getDiagramTextContent();k.postMessage(JSON.stringify({event:"textContent",data:v,message:g}),"*");return}if("status"==
g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var u=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||g.show?this.spinner.spin(document.body,u):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==g.format){if(null==g.spin&&null==g.spinKey||
this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var I=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var H=this.editor.graph,K=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=g.format;b.message=g;b.data=a;b.xml=I;k.postMessage(JSON.stringify(b),"*")}),G=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==g.format&&(a=Editor.writeGraphModelToPng(a,
"tEXt","mxfile",encodeURIComponent(I)));H!=this.editor.graph&&H.container.parentNode.removeChild(H.container);K(a)}),L=g.pageId||(null!=this.pages?this.pages[0].getId():null);if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage.getId()!=L){for(var M=H.getGlobalVariable,H=this.createTemporaryGraph(H.getStylesheet()),J,S=0;S<this.pages.length;S++)if(this.pages[S].getId()==L){J=this.updatePageRoot(this.pages[S]);break}H.getGlobalVariable=function(a){return"page"==a?J.getName():"pagenumber"==
a?1:M.apply(this,arguments)};document.body.appendChild(H.container);H.model.setRoot(J.root)}if(null!=g.layerIds){for(var W=H.model,aa=W.getChildCells(W.getRoot()),m={},S=0;S<g.layerIds.length;S++)m[g.layerIds[S]]=!0;for(S=0;S<aa.length;S++)W.setVisible(aa[S],m[aa[S].id]||!1)}this.editor.exportToCanvas(mxUtils.bind(this,function(a){G(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){G(null)}),null,null,g.scale,null,null,null,H)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+
("xmlpng"==g.format?"1":"0")+(null!=L?"&pageId="+L:"")+(null!=g.layerIds?"&extras="+encodeURIComponent(JSON.stringify({layerIds:g.layerIds})):"")+(null!=g.scale?"&scale="+g.scale:"")+"&base64=1&xml="+encodeURIComponent(I))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?K("data:image/png;base64,"+a.getText()):G(null)}),mxUtils.bind(this,function(){G(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);u=this.createLoadMessage("export");u.message=g;if("html2"==
g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length)){var ca=this.getXmlFileData();u.xml=mxUtils.getXml(ca);u.data=this.getFileData(null,null,!0,null,null,null,ca);u.format=g.format}else if("html"==g.format)I=this.editor.getGraphXml(),u.data=this.getHtml(I,this.editor.graph),u.xml=mxUtils.getXml(I),u.format=g.format;else{mxSvgCanvas2D.prototype.foAltText=null;var Y=this.editor.graph.background;Y==mxConstants.NONE&&(Y=null);u.xml=this.getFileData(!0,null,null,null,
null,null,null,null,null,!1);u.format="svg";var V=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();u.data=Editor.createSvgDataUri(a);k.postMessage(JSON.stringify(u),"*")});if("xmlsvg"==g.format)(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin))&&this.getEmbeddedSvg(u.xml,this.editor.graph,null,!0,V,null,null,g.embedImages);else if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=
g.spinKey?mxResources.get(g.spinKey):g.spin)){this.editor.graph.setEnabled(!1);var U=this.editor.graph.getSvg(Y);this.embedFonts(U,mxUtils.bind(this,function(a){g.embedImages||null==g.embedImages?this.editor.convertImages(a,mxUtils.bind(this,function(a){V(mxUtils.getXml(a))})):V(mxUtils.getXml(a))}))}return}k.postMessage(JSON.stringify(u),"*")}return}if("load"==g.action)c=1==g.autosave,this.hideDialog(),null!=g.modified&&null==urlParams.modified&&(urlParams.modified=g.modified),null!=g.saveAndExit&&
null==urlParams.saveAndExit&&(urlParams.saveAndExit=g.saveAndExit),null!=g.noSaveBtn&&null==urlParams.noSaveBtn&&(urlParams.noSaveBtn=g.noSaveBtn),null!=g.noExitBtn&&null==urlParams.noExitBtn&&(urlParams.noExitBtn=g.noExitBtn),null!=g.title&&null!=this.buttonContainer&&(n=document.createElement("span"),mxUtils.write(n,g.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="6px",this.buttonContainer.style.right="25px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight=
"38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(n),this.embedFilenameSpan=n),g=null!=g.xmlpng?this.extractGraphModelFromPng(g.xmlpng):g.xml;else{if("merge"==g.action){var Z=this.getCurrentFile();null!=Z&&(n=l(g.xml),null!=n&&""!=n&&Z.mergeFile(new LocalFile(this,n),function(){k.postMessage(JSON.stringify({event:"merge",message:g}),"*")},function(a){k.postMessage(JSON.stringify({event:"merge",
message:g,error:a}),"*")}))}else"remoteInvokeReady"==g.action?this.handleRemoteInvokeReady(k):"remoteInvoke"==g.action?this.handleRemoteInvoke(g,f.origin):"remoteInvokeResponse"==g.action?this.handleRemoteInvokeResponse(g):k.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(g)}),"*");return}}catch(T){this.handleError(T)}}var ba=mxUtils.bind(this,function(g,f){d=!0;try{a(g,f)}catch(ga){this.handleError(ga)}d=!1;null!=urlParams.modified&&this.editor.setStatus("");var l=mxUtils.bind(this,
function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=l();c&&null==b&&(b=mxUtils.bind(this,function(a,b){var c=l();if(c!=e&&!d){var g=this.createLoadMessage("autosave");g.xml=c;c=JSON.stringify(g);(window.opener||window.parent).postMessage(c,"*")}e=c}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",
b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));if("1"==urlParams.returnbounds||"json"==urlParams.proto){var m=this.createLoadMessage("load");m.xml=g;k.postMessage(JSON.stringify(m),
"*")}});null!=g&&"function"===typeof g.substring&&"data:application/vnd.visio;base64,"==g.substring(0,34)?(l="0M8R4KGxGuE"==g.substring(34,45)?"raw.vsd":"raw.vsdx",this.importVisio(this.base64ToBlob(g.substring(g.indexOf(",")+1)),function(a){ba(a,f)},mxUtils.bind(this,function(a){this.handleError(a)}),l)):null!=g&&"function"===typeof g.substring&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(g,"")?this.parseFile(new Blob([g],{type:"application/octet-stream"}),mxUtils.bind(this,
function(a){4==a.readyState&&200<=a.status&&299>=a.status&&"<mxGraphModel"==a.responseText.substring(0,13)&&ba(a.responseText,f)}),""):null!=g&&"function"===typeof g.substring&&this.isLucidChartData(g)?this.convertLucidChart(g,mxUtils.bind(this,function(a){ba(a)}),mxUtils.bind(this,function(a){this.handleError(a)})):(g=l(g),ba(g,f))}}));var k=window.opener||window.parent,f="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";k.postMessage(f,"*");if("json"==urlParams.proto){var l=
this.editor.graph.openLink;this.editor.graph.openLink=function(a,b,d){l.apply(this,arguments);k.postMessage(JSON.stringify({event:"openLink",href:a,target:b,allowOpener:d}),"*")}}};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"0px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");b.className="geBigButton";
var c=b;"1"==urlParams.noSaveBtn?"0"!=urlParams.saveAndExit&&(mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b)):(mxUtils.write(b,mxResources.get("save")),b.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)"),mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()})),a.appendChild(b),
"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.className="geBigButton geBigStandardButton",b.style.marginLeft="6px",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b),c=b));"1"!=urlParams.noExitBtn&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("exit")),b.setAttribute("title",mxResources.get("exit")),
(mxUtils.setTextContent(d,f),g=!1));k=k&&null!=d.firstChild?d.firstChild.nextSibling:d.firstChild;null!=k&&null==k.nextSibling&&k.nodeType==mxConstants.NODETYPE_ELEMENT&&"IMG"==k.nodeName&&(f=k.getAttribute("src"),null!=f&&(mxUtils.setTextContent(d,f),g=!1));g&&Graph.removePasteFormatting(d)}else f=a.clipboardData.getData("text/plain"),null!=f&&0<f.length&&(d=document.createElement("div"),mxUtils.setTextContent(d,f))}k=d.getElementsByTagName("span");if(null!=k&&0<k.length&&"application/vnd.lucid.chart.objects"===
k[0].getAttribute("data-lucid-type"))c=k[0].getAttribute("data-lucid-content"),null!=c&&0<c.length&&(this.convertLucidChart(c,mxUtils.bind(this,function(a){var b=this.editor.graph;b.lastPasteXml==a?b.pasteCounter++:(b.lastPasteXml=a,b.pasteCounter=0);var d=b.pasteCounter*b.gridSize;b.setSelectionCells(this.importXml(a,d,d));b.scrollCellToVisible(b.getSelectionCell())}),mxUtils.bind(this,function(a){this.handleError(a)})),mxEvent.consume(a));else{g=g?d.innerHTML:mxUtils.trim(null==d.innerText?mxUtils.getTextContent(d):
d.innerText);f=!1;try{var l=g.lastIndexOf("%3E");0<=l&&l<g.length-3&&(g=g.substring(0,l+3))}catch(B){}try{var k=d.getElementsByTagName("span"),m=null!=k&&0<k.length?mxUtils.trim(decodeURIComponent(k[0].textContent)):decodeURIComponent(g);this.isCompatibleString(m)&&(f=!0,g=m)}catch(B){}try{var n=this.editor.graph;if(null!=g&&0<g.length){n.lastPasteXml==g?n.pasteCounter++:(n.lastPasteXml=g,n.pasteCounter=0);var A=n.pasteCounter*n.gridSize;if(f||this.isCompatibleString(g))n.setSelectionCells(this.importXml(g,
A,A));else if(e&&1==n.getSelectionCount())/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)&&"image"==n.getCurrentCellStyle(n.getSelectionCell())[mxConstants.STYLE_SHAPE]?n.setCellStyles(mxConstants.STYLE_IMAGE,g):(n.labelChanged(n.getSelectionCell(),g),Graph.isLink(g)&&n.setLinkForCell(n.getSelectionCell(),g));else{var z=n.getInsertPoint();n.isMouseInsertPoint()&&(A=0,n.lastPasteXml==g&&0<n.pasteCounter&&n.pasteCounter--);n.setSelectionCells(this.insertTextAt(g,z.x+A,z.y+A,!0))}n.isSelectionEmpty()||(n.scrollCellToVisible(n.getSelectionCell()),
null!=this.hoverIcons&&this.hoverIcons.update(n.view.getState(n.getSelectionCell())));try{mxEvent.consume(a)}catch(B){}}else c||(n.lastPasteXml=null,n.pasteCounter=0)}catch(B){this.handleError(B)}}}b.innerHTML="&nbsp;"};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,d=0;d<a.length;d++)mxEvent.addListener(a[d],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[d],"dragover",mxUtils.bind(this,
function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[d],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,
null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var d=this.extractGraphModelFromEvent(a);if(null==d){var c=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=c&&(10==document.documentMode||11==document.documentMode?d=c.getData("Text"):(d=null,d=0<=mxUtils.indexOf(c.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(c.types,"text/html")?c.getData("text/html"):null,null!=d&&0<d.length?(c=document.createElement("div"),
c.innerHTML=this.editor.graph.sanitizeHtml(d),c=c.getElementsByTagName("img"),0<c.length&&(d=c[0].getAttribute("src"))):0<=mxUtils.indexOf(c.types,"text/plain")&&(d=c.getData("text/plain"))),null!=d&&("data:image/png;base64,"==d.substring(0,22)?(d=this.extractGraphModelFromPng(d),null!=d&&0<d.length&&this.openLocalFile(d,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(d)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(d))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&
299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(d)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(d):window.openWindow((mxClient.IS_CHROMEAPP?EditorUi.drawHost+"/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(d)))))}else this.openLocalFile(d,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,d=0,c,e;if(null==a){e=document.body;var f=document.documentElement;
c=(e.clientWidth||f.clientWidth)-3;e=Math.max(e.clientHeight||0,f.clientHeight)-3}else b=a.offsetTop,d=a.offsetLeft,c=a.clientWidth,e=a.clientHeight;f=document.createElement("div");f.style.zIndex=mxPopupMenu.prototype.zIndex+2;f.style.border="3px dotted rgb(254, 137, 12)";f.style.pointerEvents="none";f.style.position="absolute";f.style.top=b+"px";f.style.left=d+"px";f.style.width=Math.max(0,c-3)+"px";f.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(f):
document.body.appendChild(f);return f};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var d=new mxCodec(b.ownerDocument),c=new mxGraphModel;d.decode(b,c);b=c.getChildAt(c.getRoot(),0);for(d=0;d<c.getChildCount(b);d++)a.push(c.getChildAt(b,d))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var d=0;d<a.length;d++)mxUtils.bind(this,function(a){var d=
new FileReader;d.onload=mxUtils.bind(this,function(d){try{var c=d.target.result,e=a.name;if(null!=e&&0<e.length){!this.useCanvasForExport&&/(\.png)$/i.test(e)?e=e.substring(0,e.length-4)+".drawio":/(\.pdf)$/i.test(e)&&(e=e.substring(0,e.length-4)+".drawio");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".drawio":e+".drawio";if("<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(A){this.handleError(A,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b)});if(/(\.v(dx|sdx?))($|\?)/i.test(e)||/(\.vs(x|sx?))($|\?)/i.test(e))this.importVisio(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(/(\.*<graphml )/.test(c))this.importGraphML(c,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&
this.isRemoteFileFormat(c,e))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?f(a.responseText):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(c))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".drawio"),this.convertLucidChart(c,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,e,b)}),mxUtils.bind(this,
function(a){this.spinner.stop();this.handleError(a)}));else if("<mxlibrary"==d.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,d.target.result,a.name))}catch(x){this.handleError(x,mxResources.get("errorLoadingFile"))}}else if(0==c.indexOf("PK"))this.importZipFile(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}),mxUtils.bind(this,
function(){this.spinner.stop();this.openLocalFile(c,e,b)}));else{if("image/png"==a.type.substring(0,9))c=this.extractGraphModelFromPng(c);else if("application/pdf"==a.type){var g=Editor.extractGraphModelFromPdf(c);null!=g&&(c=g)}this.spinner.stop();this.openLocalFile(c,e,b)}}}catch(x){this.handleError(x)}});d.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"!==a.type.substring(0,5)&&"application/pdf"!==a.type||"image/svg"===a.type.substring(0,
9)?d.readAsText(a):d.readAsDataURL(a)})(a[d])};EditorUi.prototype.openLocalFile=function(a,b,c){var d=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var d=mxUtils.parseXml(a);null!=d&&(this.editor.setGraphXml(d.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,c))});if(null!=a&&0<a.length)null==d||!d.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?
e():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=d&&d.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){null!=d&&d.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):e()})));else throw Error(mxResources.get("notADiagramFile"));
};EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],c;for(c in a)b.push(c);return b};EditorUi.prototype.addBasenamesForCell=function(a,b){function d(a){if(null!=a){var d=a.lastIndexOf(".");0<d&&(a=a.substring(d+1,a.length));null==b[a]&&(b[a]=!0)}}var c=this.editor.graph,e=c.getCellStyle(a);
d(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));c.model.isEdge(a)&&(d(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),d(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=c.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(c.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=
a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a);null!=this.ruler&&(this.ruler.hRuler.container.style.visibility=a?"":"hidden",this.ruler.vRuler.container.style.visibility=a?"":"hidden");null!=this.tabContainer&&(this.tabContainer.style.visibility=a?"":"hidden");a||(null!=this.actions.outlineWindow&&this.actions.outlineWindow.window.setVisible(!1),null!=this.actions.layersWindow&&this.actions.layersWindow.window.setVisible(!1),
null!=this.menus.tagsWindow&&this.menus.tagsWindow.window.setVisible(!1),null!=this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1))};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,b,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);if(null==a||0==a.length)a=
this.emptyDiagramXml;this.setCurrentFile(new LocalFile(this,a,this.defaultFilename,!0));this.setFileData(a);this.editor.isChromelessView()?this.editor.graph.isLightboxView()&&this.lightboxFit():this.showLayersDialog();this.chromelessResize&&this.chromelessResize();this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&
(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,bounds:b.getGraphBounds(),currentPage:this.getSelectedPageIndex(),scale:b.view.scale,page:b.view.getBackgroundPageBounds()}};EditorUi.prototype.installMessageHandler=
function(a){var b=null,d=!1,c=!1,e=null,f=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,f);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){if(f.source==(window.opener||window.parent)){var g=f.data,l=mxUtils.bind(this,function(a){if(null!=a&&"function"===typeof a.charAt&&
"<"!=a.charAt(0))try{"data:image/png;base64,"==a.substring(0,22)?a=this.extractGraphModelFromPng(a):"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=Graph.decompress(a)))}catch(P){}return a});if("json"==urlParams.proto){try{g=JSON.parse(g)}catch(T){g=null}try{if(null==g)return;if("dialog"==g.action){this.showError(null!=g.titleKey?mxResources.get(g.titleKey):
g.title,null!=g.messageKey?mxResources.get(g.messageKey):g.message,null!=g.buttonKey?mxResources.get(g.buttonKey):g.button);null!=g.modified&&(this.editor.modified=g.modified);return}if("prompt"==g.action){this.spinner.stop();var m=new FilenameDialog(this,g.defaultValue||"",null!=g.okKey?mxResources.get(g.okKey):null,function(a){null!=a&&k.postMessage(JSON.stringify({event:"prompt",value:a,message:g}),"*")},null!=g.titleKey?mxResources.get(g.titleKey):g.title);this.showDialog(m.container,300,80,!0,
!1);m.init();return}if("draft"==g.action){var n=l(g.xml);this.spinner.stop();m=new DraftDialog(this,mxResources.get("draftFound",[g.name||this.defaultFilename]),n,mxUtils.bind(this,function(){this.hideDialog();k.postMessage(JSON.stringify({event:"draft",result:"edit",message:g}),"*")}),mxUtils.bind(this,function(){this.hideDialog();k.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),g.editKey?mxResources.get(g.editKey):null,g.discardKey?mxResources.get(g.discardKey):null,
g.ignore?mxUtils.bind(this,function(){this.hideDialog();k.postMessage(JSON.stringify({event:"draft",result:"ignore",message:g}),"*")}):null);this.showDialog(m.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{m.init()}catch(T){k.postMessage(JSON.stringify({event:"draft",error:T.toString(),message:g}),"*")}return}if("template"==g.action){this.spinner.stop();var p=1==g.enableRecent,t=1==g.enableSearch,q=1==g.enableCustomTemp,m=new NewDialog(this,!1,null!=
g.callback,mxUtils.bind(this,function(b,d){b=b||this.emptyDiagramXml;null!=g.callback?k.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:d,message:g}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,p?mxUtils.bind(this,function(a){this.remoteInvoke("getRecentDiagrams",null,null,a,function(){a(null,"Network Error!")})}):null,t?mxUtils.bind(this,function(a,b){this.remoteInvoke("searchDiagrams",
[a],null,b,function(){b(null,"Network Error!")})}):null,mxUtils.bind(this,function(a,b,d){k.postMessage(JSON.stringify({event:"template",docUrl:a,info:b,name:d}),"*")}),null,null,q?mxUtils.bind(this,function(a){this.remoteInvoke("getCustomTemplates",null,null,a,function(){a({},0)})}):null);this.showDialog(m.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));m.init();return}if("textContent"==g.action){var v=this.getDiagramTextContent();k.postMessage(JSON.stringify({event:"textContent",
data:v,message:g}),"*");return}if("status"==g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var u=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||g.show?this.spinner.spin(document.body,u):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==
g.format){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var I=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var H=this.editor.graph,K=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=g.format;b.message=g;b.data=a;b.xml=I;k.postMessage(JSON.stringify(b),"*")}),G=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);
"xmlpng"==g.format&&(a=Editor.writeGraphModelToPng(a,"tEXt","mxfile",encodeURIComponent(I)));H!=this.editor.graph&&H.container.parentNode.removeChild(H.container);K(a)}),L=g.pageId||(null!=this.pages?this.pages[0].getId():null);if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage.getId()!=L){for(var M=H.getGlobalVariable,H=this.createTemporaryGraph(H.getStylesheet()),J,S=0;S<this.pages.length;S++)if(this.pages[S].getId()==L){J=this.updatePageRoot(this.pages[S]);break}H.getGlobalVariable=
function(a){return"page"==a?J.getName():"pagenumber"==a?1:M.apply(this,arguments)};document.body.appendChild(H.container);H.model.setRoot(J.root)}if(null!=g.layerIds){for(var W=H.model,aa=W.getChildCells(W.getRoot()),m={},S=0;S<g.layerIds.length;S++)m[g.layerIds[S]]=!0;for(S=0;S<aa.length;S++)W.setVisible(aa[S],m[aa[S].id]||!1)}this.editor.exportToCanvas(mxUtils.bind(this,function(a){G(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){G(null)}),null,null,g.scale,null,null,null,
H)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==g.format?"1":"0")+(null!=L?"&pageId="+L:"")+(null!=g.layerIds?"&extras="+encodeURIComponent(JSON.stringify({layerIds:g.layerIds})):"")+(null!=g.scale?"&scale="+g.scale:"")+"&base64=1&xml="+encodeURIComponent(I))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?K("data:image/png;base64,"+a.getText()):G(null)}),mxUtils.bind(this,function(){G(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);
u=this.createLoadMessage("export");u.message=g;if("html2"==g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length)){var ca=this.getXmlFileData();u.xml=mxUtils.getXml(ca);u.data=this.getFileData(null,null,!0,null,null,null,ca);u.format=g.format}else if("html"==g.format)I=this.editor.getGraphXml(),u.data=this.getHtml(I,this.editor.graph),u.xml=mxUtils.getXml(I),u.format=g.format;else{mxSvgCanvas2D.prototype.foAltText=null;var Y=this.editor.graph.background;Y==mxConstants.NONE&&
(Y=null);u.xml=this.getFileData(!0,null,null,null,null,null,null,null,null,!1);u.format="svg";var V=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();u.data=Editor.createSvgDataUri(a);k.postMessage(JSON.stringify(u),"*")});if("xmlsvg"==g.format)(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin))&&this.getEmbeddedSvg(u.xml,this.editor.graph,null,!0,V,null,null,g.embedImages);else if(null==g.spin&&null==
g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){this.editor.graph.setEnabled(!1);var U=this.editor.graph.getSvg(Y);this.embedFonts(U,mxUtils.bind(this,function(a){g.embedImages||null==g.embedImages?this.editor.convertImages(a,mxUtils.bind(this,function(a){V(mxUtils.getXml(a))})):V(mxUtils.getXml(a))}))}return}k.postMessage(JSON.stringify(u),"*")}return}if("load"==g.action)c=1==g.autosave,this.hideDialog(),null!=g.modified&&null==urlParams.modified&&(urlParams.modified=
g.modified),null!=g.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=g.saveAndExit),null!=g.noSaveBtn&&null==urlParams.noSaveBtn&&(urlParams.noSaveBtn=g.noSaveBtn),null!=g.noExitBtn&&null==urlParams.noExitBtn&&(urlParams.noExitBtn=g.noExitBtn),null!=g.title&&null!=this.buttonContainer&&(n=document.createElement("span"),mxUtils.write(n,g.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="6px",this.buttonContainer.style.right=
"25px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(n),this.embedFilenameSpan=n),g=null!=g.xmlpng?this.extractGraphModelFromPng(g.xmlpng):g.xml;else{if("merge"==g.action){var Z=this.getCurrentFile();null!=Z&&(n=l(g.xml),null!=n&&""!=n&&Z.mergeFile(new LocalFile(this,n),function(){k.postMessage(JSON.stringify({event:"merge",
message:g}),"*")},function(a){k.postMessage(JSON.stringify({event:"merge",message:g,error:a}),"*")}))}else"remoteInvokeReady"==g.action?this.handleRemoteInvokeReady(k):"remoteInvoke"==g.action?this.handleRemoteInvoke(g,f.origin):"remoteInvokeResponse"==g.action?this.handleRemoteInvokeResponse(g):k.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(g)}),"*");return}}catch(T){this.handleError(T)}}var ba=mxUtils.bind(this,function(g,f){d=!0;try{a(g,f)}catch(ga){this.handleError(ga)}d=
!1;null!=urlParams.modified&&this.editor.setStatus("");var l=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=l();c&&null==b&&(b=mxUtils.bind(this,function(a,b){var c=l();if(c!=e&&!d){var g=this.createLoadMessage("autosave");g.xml=c;c=JSON.stringify(g);(window.opener||window.parent).postMessage(c,"*")}e=c}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",
b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));if("1"==urlParams.returnbounds||"json"==urlParams.proto){var m=this.createLoadMessage("load");
m.xml=g;k.postMessage(JSON.stringify(m),"*")}});null!=g&&"function"===typeof g.substring&&"data:application/vnd.visio;base64,"==g.substring(0,34)?(l="0M8R4KGxGuE"==g.substring(34,45)?"raw.vsd":"raw.vsdx",this.importVisio(this.base64ToBlob(g.substring(g.indexOf(",")+1)),function(a){ba(a,f)},mxUtils.bind(this,function(a){this.handleError(a)}),l)):null!=g&&"function"===typeof g.substring&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(g,"")?this.parseFile(new Blob([g],{type:"application/octet-stream"}),
mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&"<mxGraphModel"==a.responseText.substring(0,13)&&ba(a.responseText,f)}),""):null!=g&&"function"===typeof g.substring&&this.isLucidChartData(g)?this.convertLucidChart(g,mxUtils.bind(this,function(a){ba(a)}),mxUtils.bind(this,function(a){this.handleError(a)})):(g=l(g),ba(g,f))}}));var k=window.opener||window.parent,f="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";k.postMessage(f,"*");if("json"==
urlParams.proto){var l=this.editor.graph.openLink;this.editor.graph.openLink=function(a,b,d){l.apply(this,arguments);k.postMessage(JSON.stringify({event:"openLink",href:a,target:b,allowOpener:d}),"*")}}};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"0px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");
b.className="geBigButton";var c=b;"1"==urlParams.noSaveBtn?"0"!=urlParams.saveAndExit&&(mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b)):(mxUtils.write(b,mxResources.get("save")),b.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)"),mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()})),
a.appendChild(b),"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.className="geBigButton geBigStandardButton",b.style.marginLeft="6px",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b),c=b));"1"!=urlParams.noExitBtn&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("exit")),b.setAttribute("title",mxResources.get("exit")),
b.className="geBigButton geBigStandardButton",b.style.marginLeft="6px",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()})),a.appendChild(b),c=b);c.style.marginRight="20px";this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,
mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import"),this.isOffline()?null:"https://drawio-app.com/import-from-csv-to-drawio/"));this.showDialog(this.importCsvDialog.container,640,520,!0,!0,null,null,null,null,!0);this.importCsvDialog.init()};EditorUi.prototype.executeLayoutList=function(a,b){for(var d=this.editor.graph,c=d.getSelectionCells(),e=0;e<a.length;e++){var g=new window[a[e].layout](d);if(null!=a[e].config)for(var f in a[e].config)g[f]=
a[e].config[f];this.executeLayout(function(){g.execute(d.getDefaultParent(),0==c.length?null:c)},e==a.length-1,b)}};EditorUi.prototype.importCsv=function(a,b){try{var d=a.split("\n"),c=[],e=[],g={};if(0<d.length){var f={},k=null,l=null,y=null,x=null,A=null,z=null,B=null,D=null,E="",F="auto",C="auto",I=null,H=null,K=40,G=40,L=100,M=0,J=this.editor.graph;J.getGraphBounds();for(var S=function(){null!=b?b(ja):(J.setSelectionCells(ja),J.scrollCellToVisible(J.getSelectionCell()))},W=J.getFreeInsertPoint(),

View file

@ -9754,7 +9754,9 @@
// Extracts single image source address
var img = (hasMeta && elt.firstChild != null) ? elt.firstChild.nextSibling : elt.firstChild;
if (img != null && img.nextSibling == null)
if (img != null && img.nextSibling == null &&
img.nodeType == mxConstants.NODETYPE_ELEMENT &&
img.nodeName == 'IMG')
{
var temp = img.getAttribute('src');

View file

@ -2914,7 +2914,7 @@ Graph.prototype.getIndexableText = function()
{
if (this.isHtmlLabel(cell))
{
tmp.innerHTML = this.getLabel(cell);
tmp.innerHTML = this.sanitizeHtml(this.getLabel(cell));
label = mxUtils.extractTextWithWhitespace([tmp]);
}
else

View file

@ -2354,7 +2354,7 @@ m&&(f=this.view.getState(a),q=this.view.getState(m),null!=f&&null!=q&&mxUtils.in
!this.isCellConnectable(m)&&!this.isSwimlane(m))m=null;f=[];this.model.beginUpdate();try{var n=null!=m&&this.isSwimlane(m),q=n?null:m;if(null==q&&k){for(var g=a,l=this.getCellGeometry(a);null!=l&&l.relative;)g=this.getModel().getParent(g),l=this.getCellGeometry(g);g=this.getCompositeParent(g);q=this.duplicateCells([g],!1)[0];l=this.getCellGeometry(q);null!=l&&(l.x=b.x-l.width/2,l.y=b.y-l.height/2);n&&(this.addCells([q],m,null,null,null,!0),m=null)}n=null;null!=this.layoutManager&&(n=this.layoutManager.getLayout(this.model.getParent(a)));
var p=mxEvent.isControlDown(d)&&k||null==m&&null!=n&&n.constructor==mxStackLayout?null:this.insertEdge(this.model.getParent(a),null,"",a,q,this.createCurrentEdgeStyle());if(null!=p&&this.connectionHandler.insertBeforeSource){var v=null;for(d=a;null!=d.parent&&null!=d.geometry&&d.geometry.relative&&d.parent!=p.parent;)d=this.model.getParent(d);null!=d&&null!=d.parent&&d.parent==p.parent&&(v=d.parent.getIndex(d),this.model.add(d.parent,p,v))}null==m&&null!=q&&null!=n&&null!=a.parent&&n.constructor==
mxStackLayout&&c==mxConstants.DIRECTION_WEST&&(v=a.parent.getIndex(a),this.model.add(a.parent,q,v));null!=p&&f.push(p);null==m&&null!=q&&f.push(q);null==q&&null!=p&&p.geometry.setTerminalPoint(b,!1);null!=p&&this.fireEvent(new mxEventObject("cellsInserted","cells",[p]))}finally{this.model.endUpdate()}return f};
Graph.prototype.getIndexableText=function(){var a=document.createElement("div"),c=[],f,d;for(d in this.model.cells)if(f=this.model.cells[d],this.model.isVertex(f)||this.model.isEdge(f))this.isHtmlLabel(f)?(a.innerHTML=this.getLabel(f),f=mxUtils.extractTextWithWhitespace([a])):f=this.getLabel(f),f=mxUtils.trim(f.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")),0<f.length&&c.push(f);return c.join(" ")};
Graph.prototype.getIndexableText=function(){var a=document.createElement("div"),c=[],f,d;for(d in this.model.cells)if(f=this.model.cells[d],this.model.isVertex(f)||this.model.isEdge(f))this.isHtmlLabel(f)?(a.innerHTML=this.sanitizeHtml(this.getLabel(f)),f=mxUtils.extractTextWithWhitespace([a])):f=this.getLabel(f),f=mxUtils.trim(f.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")),0<f.length&&c.push(f);return c.join(" ")};
Graph.prototype.convertValueToString=function(a){var c=this.model.getValue(a);if(null!=c&&"object"==typeof c){if(this.isReplacePlaceholders(a)&&null!=a.getAttribute("placeholder")){for(var c=a.getAttribute("placeholder"),f=a,d=null;null==d&&null!=f;)null!=f.value&&"object"==typeof f.value&&(d=f.hasAttribute(c)?null!=f.getAttribute(c)?f.getAttribute(c):"":null),f=this.model.getParent(f);return d||""}return c.getAttribute("label")||""}return mxGraph.prototype.convertValueToString.apply(this,arguments)};
Graph.prototype.getLinksForState=function(a){return null!=a&&null!=a.text&&null!=a.text.node?a.text.node.getElementsByTagName("a"):null};Graph.prototype.getLinkForCell=function(a){return null!=a.value&&"object"==typeof a.value?(a=a.value.getAttribute("link"),null!=a&&"javascript:"===a.toLowerCase().substring(0,11)&&(a=a.substring(11)),a):null};
Graph.prototype.getCellStyle=function(a){var c=mxGraph.prototype.getCellStyle.apply(this,arguments);if(null!=a&&null!=this.layoutManager){var f=this.model.getParent(a);this.model.isVertex(f)&&this.isCellCollapsed(a)&&(f=this.layoutManager.getLayout(f),null!=f&&f.constructor==mxStackLayout&&(c[mxConstants.STYLE_HORIZONTAL]=!f.horizontal))}return c};
@ -3353,55 +3353,55 @@ function(a,c){mxSettings.setGridColor(this.editor.graph.view.gridColor,"dark"==u
8>=parseInt(mxSettings.settings.version||0))||(this.toggleScratchpad(),mxSettings.save());this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})}};EditorUi.prototype.copyCells=function(a,c){var b=this.editor.graph;if(b.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(b.model.getTopmostCells(b.getSelectionCells())),e=mxUtils.getXml(b.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));c?(b.removeCells(d,!1),b.lastPasteXml=
null):(b.lastPasteXml=e,b.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,c,d,f){if(!mxEvent.isConsumed(a)){var b=c,e=!1;if(d&&null!=a.clipboardData&&a.clipboardData.getData){var g=a.clipboardData.getData("text/html");if(null!=g&&0<g.length){var k="<meta "==g.substring(0,6),b=document.createElement("div");b.innerHTML=(k?'<meta charset="utf-8">':"")+this.editor.graph.sanitizeHtml(g);e=!0;g=b.getElementsByTagName("style");if(null!=g)for(;0<
g.length;)g[0].parentNode.removeChild(g[0]);null!=b.firstChild&&b.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT&&null!=b.firstChild.nextSibling&&b.firstChild.nextSibling.nodeType==mxConstants.NODETYPE_ELEMENT&&"META"==b.firstChild.nodeName&&"A"==b.firstChild.nextSibling.nodeName&&null==b.firstChild.nextSibling.nextSibling&&(g=null==b.firstChild.nextSibling.innerText?mxUtils.getTextContent(b.firstChild.nextSibling):b.firstChild.nextSibling.innerText,g==b.firstChild.nextSibling.getAttribute("href")&&
(mxUtils.setTextContent(b,g),e=!1));k=k&&null!=b.firstChild?b.firstChild.nextSibling:b.firstChild;null!=k&&null==k.nextSibling&&(g=k.getAttribute("src"),null!=g&&(mxUtils.setTextContent(b,g),e=!1));e&&Graph.removePasteFormatting(b)}else g=a.clipboardData.getData("text/plain"),null!=g&&0<g.length&&(b=document.createElement("div"),mxUtils.setTextContent(b,g))}k=b.getElementsByTagName("span");if(null!=k&&0<k.length&&"application/vnd.lucid.chart.objects"===k[0].getAttribute("data-lucid-type"))d=k[0].getAttribute("data-lucid-content"),
null!=d&&0<d.length&&(this.convertLucidChart(d,mxUtils.bind(this,function(a){var b=this.editor.graph;b.lastPasteXml==a?b.pasteCounter++:(b.lastPasteXml=a,b.pasteCounter=0);var c=b.pasteCounter*b.gridSize;b.setSelectionCells(this.importXml(a,c,c));b.scrollCellToVisible(b.getSelectionCell())}),mxUtils.bind(this,function(a){this.handleError(a)})),mxEvent.consume(a));else{e=e?b.innerHTML:mxUtils.trim(null==b.innerText?mxUtils.getTextContent(b):b.innerText);g=!1;try{var m=e.lastIndexOf("%3E");0<=m&&m<
e.length-3&&(e=e.substring(0,m+3))}catch(z){}try{var k=b.getElementsByTagName("span"),n=null!=k&&0<k.length?mxUtils.trim(decodeURIComponent(k[0].textContent)):decodeURIComponent(e);this.isCompatibleString(n)&&(g=!0,e=n)}catch(z){}try{var q=this.editor.graph;if(null!=e&&0<e.length){q.lastPasteXml==e?q.pasteCounter++:(q.lastPasteXml=e,q.pasteCounter=0);var B=q.pasteCounter*q.gridSize;if(g||this.isCompatibleString(e))q.setSelectionCells(this.importXml(e,B,B));else if(f&&1==q.getSelectionCount())/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(e)&&
"image"==q.getCurrentCellStyle(q.getSelectionCell())[mxConstants.STYLE_SHAPE]?q.setCellStyles(mxConstants.STYLE_IMAGE,e):(q.labelChanged(q.getSelectionCell(),e),Graph.isLink(e)&&q.setLinkForCell(q.getSelectionCell(),e));else{var C=q.getInsertPoint();q.isMouseInsertPoint()&&(B=0,q.lastPasteXml==e&&0<q.pasteCounter&&q.pasteCounter--);q.setSelectionCells(this.insertTextAt(e,C.x+B,C.y+B,!0))}q.isSelectionEmpty()||(q.scrollCellToVisible(q.getSelectionCell()),null!=this.hoverIcons&&this.hoverIcons.update(q.view.getState(q.getSelectionCell())));
try{mxEvent.consume(a)}catch(z){}}else d||(q.lastPasteXml=null,q.pasteCounter=0)}catch(z){this.handleError(z)}}}c.innerHTML="&nbsp;"};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==
b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):
this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=this.editor.graph.sanitizeHtml(c),d=
d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),
null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?EditorUi.drawHost+"/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,f;if(null==a){f=document.body;var k=document.documentElement;d=(f.clientWidth||k.clientWidth)-3;f=Math.max(f.clientHeight||
0,k.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,f=a.clientHeight;k=document.createElement("div");k.style.zIndex=mxPopupMenu.prototype.zIndex+2;k.style.border="3px dotted rgb(254, 137, 12)";k.style.pointerEvents="none";k.style.position="absolute";k.style.top=b+"px";k.style.left=c+"px";k.style.width=Math.max(0,d-3)+"px";k.style.height=Math.max(0,f-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(k):document.body.appendChild(k);
return k};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,c){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var b=0;b<a.length;b++)mxUtils.bind(this,function(a){var b=new FileReader;b.onload=
mxUtils.bind(this,function(b){try{var d=b.target.result,e=a.name;if(null!=e&&0<e.length){!this.useCanvasForExport&&/(\.png)$/i.test(e)?e=e.substring(0,e.length-4)+".drawio":/(\.pdf)$/i.test(e)&&(e=e.substring(0,e.length-4)+".drawio");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".drawio":e+".drawio";if("<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,c);
try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(B){this.handleError(B,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,c)});if(/(\.v(dx|sdx?))($|\?)/i.test(e)||/(\.vs(x|sx?))($|\?)/i.test(e))this.importVisio(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(/(\.*<graphml )/.test(d))this.importGraphML(d,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,
e))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?f(a.responseText):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(d))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".drawio"),this.convertLucidChart(d,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,e,c)}),mxUtils.bind(this,function(a){this.spinner.stop();
this.handleError(a)}));else if("<mxlibrary"==b.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,c);try{this.loadLibrary(new LocalLibrary(this,b.target.result,a.name))}catch(D){this.handleError(D,mxResources.get("errorLoadingFile"))}}else if(0==d.indexOf("PK"))this.importZipFile(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}),mxUtils.bind(this,function(){this.spinner.stop();
this.openLocalFile(d,e,c)}));else{if("image/png"==a.type.substring(0,9))d=this.extractGraphModelFromPng(d);else if("application/pdf"==a.type){var g=Editor.extractGraphModelFromPdf(d);null!=g&&(d=g)}this.spinner.stop();this.openLocalFile(d,e,c)}}}catch(D){this.handleError(D)}});b.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"!==a.type.substring(0,5)&&"application/pdf"!==a.type||"image/svg"===a.type.substring(0,9)?b.readAsText(a):b.readAsDataURL(a)})(a[b])};
EditorUi.prototype.openLocalFile=function(a,c,d){var b=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==c&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var b=mxUtils.parseXml(a);null!=b&&(this.editor.setGraphXml(b.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,c||this.defaultFilename,d))});if(null!=a&&0<a.length)null==b||!b.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?e():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&
null!=b&&b.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,c),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){null!=b&&b.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):e()})));else throw Error(mxResources.get("notADiagramFile"));};EditorUi.prototype.getBasenames=
function(){var a={};if(null!=this.pages)for(var c=0;c<this.pages.length;c++)this.updatePageRoot(this.pages[c]),this.addBasenamesForCell(this.pages[c].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var c=[],d;for(d in a)c.push(d);return c};EditorUi.prototype.addBasenamesForCell=function(a,c){function b(a){if(null!=a){var b=a.lastIndexOf(".");0<b&&(a=a.substring(b+1,a.length));null==c[a]&&(c[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);b(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));
d.model.isEdge(a)&&(b(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),b(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),c)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=
a?"":"none";this.editor.graph.setEnabled(a);null!=this.ruler&&(this.ruler.hRuler.container.style.visibility=a?"":"hidden",this.ruler.vRuler.container.style.visibility=a?"":"hidden");null!=this.tabContainer&&(this.tabContainer.style.visibility=a?"":"hidden");a||(null!=this.actions.outlineWindow&&this.actions.outlineWindow.window.setVisible(!1),null!=this.actions.layersWindow&&this.actions.layersWindow.window.setVisible(!1),null!=this.menus.tagsWindow&&this.menus.tagsWindow.window.setVisible(!1),null!=
this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1))};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,c,d){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);if(null==a||0==a.length)a=this.emptyDiagramXml;this.setCurrentFile(new LocalFile(this,a,this.defaultFilename,
!0));this.setFileData(a);this.editor.isChromelessView()?this.editor.graph.isLightboxView()&&this.lightboxFit():this.showLayersDialog();this.chromelessResize&&this.chromelessResize();this.editor.undoManager.clear();this.editor.modified=null!=d?d:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?
this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,c){null!=a?a.getPublicUrl(c):c(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,bounds:b.getGraphBounds(),currentPage:this.getSelectedPageIndex(),scale:b.view.scale,page:b.view.getBackgroundPageBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,
d=!1,f=null,k=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,k);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){if(e.source==(window.opener||window.parent)){var g=e.data,l=mxUtils.bind(this,function(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/png;base64,"==
a.substring(0,22)?a=this.extractGraphModelFromPng(a):"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=Graph.decompress(a)))}catch(da){}return a});if("json"==urlParams.proto){try{g=JSON.parse(g)}catch(U){g=null}try{if(null==g)return;if("dialog"==g.action){this.showError(null!=g.titleKey?mxResources.get(g.titleKey):g.title,null!=g.messageKey?
mxResources.get(g.messageKey):g.message,null!=g.buttonKey?mxResources.get(g.buttonKey):g.button);null!=g.modified&&(this.editor.modified=g.modified);return}if("prompt"==g.action){this.spinner.stop();var k=new FilenameDialog(this,g.defaultValue||"",null!=g.okKey?mxResources.get(g.okKey):null,function(a){null!=a&&m.postMessage(JSON.stringify({event:"prompt",value:a,message:g}),"*")},null!=g.titleKey?mxResources.get(g.titleKey):g.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==
g.action){var n=l(g.xml);this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[g.name||this.defaultFilename]),n,mxUtils.bind(this,function(){this.hideDialog();m.postMessage(JSON.stringify({event:"draft",result:"edit",message:g}),"*")}),mxUtils.bind(this,function(){this.hideDialog();m.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),g.editKey?mxResources.get(g.editKey):null,g.discardKey?mxResources.get(g.discardKey):null,g.ignore?mxUtils.bind(this,function(){this.hideDialog();
m.postMessage(JSON.stringify({event:"draft",result:"ignore",message:g}),"*")}):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{k.init()}catch(U){m.postMessage(JSON.stringify({event:"draft",error:U.toString(),message:g}),"*")}return}if("template"==g.action){this.spinner.stop();var p=1==g.enableRecent,q=1==g.enableSearch,t=1==g.enableCustomTemp,k=new NewDialog(this,!1,null!=g.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;
null!=g.callback?m.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c,message:g}),"*"):(a(b,e,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,p?mxUtils.bind(this,function(a){this.remoteInvoke("getRecentDiagrams",null,null,a,function(){a(null,"Network Error!")})}):null,q?mxUtils.bind(this,function(a,b){this.remoteInvoke("searchDiagrams",[a],null,b,function(){b(null,"Network Error!")})}):null,mxUtils.bind(this,
function(a,b,c){m.postMessage(JSON.stringify({event:"template",docUrl:a,info:b,name:c}),"*")}),null,null,t?mxUtils.bind(this,function(a){this.remoteInvoke("getCustomTemplates",null,null,a,function(){a({},0)})}):null);this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("textContent"==g.action){var x=this.getDiagramTextContent();m.postMessage(JSON.stringify({event:"textContent",data:x,message:g}),"*");return}if("status"==
g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var v=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||g.show?this.spinner.spin(document.body,v):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==g.format){if(null==g.spin&&null==g.spinKey||
this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var J=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var u=this.editor.graph,K=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=g.format;b.message=g;b.data=a;b.xml=J;m.postMessage(JSON.stringify(b),"*")}),A=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==g.format&&(a=Editor.writeGraphModelToPng(a,
"tEXt","mxfile",encodeURIComponent(J)));u!=this.editor.graph&&u.container.parentNode.removeChild(u.container);K(a)}),M=g.pageId||(null!=this.pages?this.pages[0].getId():null);if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage.getId()!=M){for(var Q=u.getGlobalVariable,u=this.createTemporaryGraph(u.getStylesheet()),I,S=0;S<this.pages.length;S++)if(this.pages[S].getId()==M){I=this.updatePageRoot(this.pages[S]);break}u.getGlobalVariable=function(a){return"page"==a?I.getName():"pagenumber"==
a?1:Q.apply(this,arguments)};document.body.appendChild(u.container);u.model.setRoot(I.root)}if(null!=g.layerIds){for(var fa=u.model,ha=fa.getChildCells(fa.getRoot()),k={},S=0;S<g.layerIds.length;S++)k[g.layerIds[S]]=!0;for(S=0;S<ha.length;S++)fa.setVisible(ha[S],k[ha[S].id]||!1)}this.editor.exportToCanvas(mxUtils.bind(this,function(a){A(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){A(null)}),null,null,g.scale,null,null,null,u)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+
("xmlpng"==g.format?"1":"0")+(null!=M?"&pageId="+M:"")+(null!=g.layerIds?"&extras="+encodeURIComponent(JSON.stringify({layerIds:g.layerIds})):"")+(null!=g.scale?"&scale="+g.scale:"")+"&base64=1&xml="+encodeURIComponent(J))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?K("data:image/png;base64,"+a.getText()):A(null)}),mxUtils.bind(this,function(){A(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);v=this.createLoadMessage("export");v.message=g;if("html2"==
g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length)){var aa=this.getXmlFileData();v.xml=mxUtils.getXml(aa);v.data=this.getFileData(null,null,!0,null,null,null,aa);v.format=g.format}else if("html"==g.format)J=this.editor.getGraphXml(),v.data=this.getHtml(J,this.editor.graph),v.xml=mxUtils.getXml(J),v.format=g.format;else{mxSvgCanvas2D.prototype.foAltText=null;var ba=this.editor.graph.background;ba==mxConstants.NONE&&(ba=null);v.xml=this.getFileData(!0,null,null,
null,null,null,null,null,null,!1);v.format="svg";var Z=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();v.data=Editor.createSvgDataUri(a);m.postMessage(JSON.stringify(v),"*")});if("xmlsvg"==g.format)(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin))&&this.getEmbeddedSvg(v.xml,this.editor.graph,null,!0,Z,null,null,g.embedImages);else if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=
g.spinKey?mxResources.get(g.spinKey):g.spin)){this.editor.graph.setEnabled(!1);var ca=this.editor.graph.getSvg(ba);this.embedFonts(ca,mxUtils.bind(this,function(a){g.embedImages||null==g.embedImages?this.editor.convertImages(a,mxUtils.bind(this,function(a){Z(mxUtils.getXml(a))})):Z(mxUtils.getXml(a))}))}return}m.postMessage(JSON.stringify(v),"*")}return}if("load"==g.action)d=1==g.autosave,this.hideDialog(),null!=g.modified&&null==urlParams.modified&&(urlParams.modified=g.modified),null!=g.saveAndExit&&
null==urlParams.saveAndExit&&(urlParams.saveAndExit=g.saveAndExit),null!=g.noSaveBtn&&null==urlParams.noSaveBtn&&(urlParams.noSaveBtn=g.noSaveBtn),null!=g.noExitBtn&&null==urlParams.noExitBtn&&(urlParams.noExitBtn=g.noExitBtn),null!=g.title&&null!=this.buttonContainer&&(n=document.createElement("span"),mxUtils.write(n,g.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="6px",this.buttonContainer.style.right="25px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight=
"38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(n),this.embedFilenameSpan=n),g=null!=g.xmlpng?this.extractGraphModelFromPng(g.xmlpng):g.xml;else{if("merge"==g.action){var ia=this.getCurrentFile();null!=ia&&(n=l(g.xml),null!=n&&""!=n&&ia.mergeFile(new LocalFile(this,n),function(){m.postMessage(JSON.stringify({event:"merge",message:g}),"*")},function(a){m.postMessage(JSON.stringify({event:"merge",
message:g,error:a}),"*")}))}else"remoteInvokeReady"==g.action?this.handleRemoteInvokeReady(m):"remoteInvoke"==g.action?this.handleRemoteInvoke(g,e.origin):"remoteInvokeResponse"==g.action?this.handleRemoteInvokeResponse(g):m.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(g)}),"*");return}}catch(U){this.handleError(U)}}var ea=mxUtils.bind(this,function(e,g){c=!0;try{a(e,g)}catch(la){this.handleError(la)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var l=mxUtils.bind(this,
function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});f=l();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=l();if(d!=f&&!c){var e=this.createLoadMessage("autosave");e.xml=d;d=JSON.stringify(e);(window.opener||window.parent).postMessage(d,"*")}f=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",
b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));if("1"==urlParams.returnbounds||"json"==urlParams.proto){var k=this.createLoadMessage("load");k.xml=e;m.postMessage(JSON.stringify(k),
"*")}});null!=g&&"function"===typeof g.substring&&"data:application/vnd.visio;base64,"==g.substring(0,34)?(l="0M8R4KGxGuE"==g.substring(34,45)?"raw.vsd":"raw.vsdx",this.importVisio(this.base64ToBlob(g.substring(g.indexOf(",")+1)),function(a){ea(a,e)},mxUtils.bind(this,function(a){this.handleError(a)}),l)):null!=g&&"function"===typeof g.substring&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(g,"")?this.parseFile(new Blob([g],{type:"application/octet-stream"}),mxUtils.bind(this,
function(a){4==a.readyState&&200<=a.status&&299>=a.status&&"<mxGraphModel"==a.responseText.substring(0,13)&&ea(a.responseText,e)}),""):null!=g&&"function"===typeof g.substring&&this.isLucidChartData(g)?this.convertLucidChart(g,mxUtils.bind(this,function(a){ea(a)}),mxUtils.bind(this,function(a){this.handleError(a)})):(g=l(g),ea(g,e))}}));var m=window.opener||window.parent,k="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";m.postMessage(k,"*");if("json"==urlParams.proto){var q=
this.editor.graph.openLink;this.editor.graph.openLink=function(a,b,c){q.apply(this,arguments);m.postMessage(JSON.stringify({event:"openLink",href:a,target:b,allowOpener:c}),"*")}}};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"0px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var c=document.createElement("button");c.className="geBigButton";
var d=c;"1"==urlParams.noSaveBtn?"0"!=urlParams.saveAndExit&&(mxUtils.write(c,mxResources.get("saveAndExit")),c.setAttribute("title",mxResources.get("saveAndExit")),mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(c)):(mxUtils.write(c,mxResources.get("save")),c.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)"),mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()})),a.appendChild(c),
"1"==urlParams.saveAndExit&&(c=document.createElement("a"),mxUtils.write(c,mxResources.get("saveAndExit")),c.setAttribute("title",mxResources.get("saveAndExit")),c.className="geBigButton geBigStandardButton",c.style.marginLeft="6px",mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(c),d=c));"1"!=urlParams.noExitBtn&&(c=document.createElement("a"),mxUtils.write(c,mxResources.get("exit")),c.setAttribute("title",mxResources.get("exit")),
(mxUtils.setTextContent(b,g),e=!1));k=k&&null!=b.firstChild?b.firstChild.nextSibling:b.firstChild;null!=k&&null==k.nextSibling&&k.nodeType==mxConstants.NODETYPE_ELEMENT&&"IMG"==k.nodeName&&(g=k.getAttribute("src"),null!=g&&(mxUtils.setTextContent(b,g),e=!1));e&&Graph.removePasteFormatting(b)}else g=a.clipboardData.getData("text/plain"),null!=g&&0<g.length&&(b=document.createElement("div"),mxUtils.setTextContent(b,g))}k=b.getElementsByTagName("span");if(null!=k&&0<k.length&&"application/vnd.lucid.chart.objects"===
k[0].getAttribute("data-lucid-type"))d=k[0].getAttribute("data-lucid-content"),null!=d&&0<d.length&&(this.convertLucidChart(d,mxUtils.bind(this,function(a){var b=this.editor.graph;b.lastPasteXml==a?b.pasteCounter++:(b.lastPasteXml=a,b.pasteCounter=0);var c=b.pasteCounter*b.gridSize;b.setSelectionCells(this.importXml(a,c,c));b.scrollCellToVisible(b.getSelectionCell())}),mxUtils.bind(this,function(a){this.handleError(a)})),mxEvent.consume(a));else{e=e?b.innerHTML:mxUtils.trim(null==b.innerText?mxUtils.getTextContent(b):
b.innerText);g=!1;try{var m=e.lastIndexOf("%3E");0<=m&&m<e.length-3&&(e=e.substring(0,m+3))}catch(z){}try{var k=b.getElementsByTagName("span"),n=null!=k&&0<k.length?mxUtils.trim(decodeURIComponent(k[0].textContent)):decodeURIComponent(e);this.isCompatibleString(n)&&(g=!0,e=n)}catch(z){}try{var q=this.editor.graph;if(null!=e&&0<e.length){q.lastPasteXml==e?q.pasteCounter++:(q.lastPasteXml=e,q.pasteCounter=0);var B=q.pasteCounter*q.gridSize;if(g||this.isCompatibleString(e))q.setSelectionCells(this.importXml(e,
B,B));else if(f&&1==q.getSelectionCount())/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(e)&&"image"==q.getCurrentCellStyle(q.getSelectionCell())[mxConstants.STYLE_SHAPE]?q.setCellStyles(mxConstants.STYLE_IMAGE,e):(q.labelChanged(q.getSelectionCell(),e),Graph.isLink(e)&&q.setLinkForCell(q.getSelectionCell(),e));else{var C=q.getInsertPoint();q.isMouseInsertPoint()&&(B=0,q.lastPasteXml==e&&0<q.pasteCounter&&q.pasteCounter--);q.setSelectionCells(this.insertTextAt(e,C.x+B,C.y+B,!0))}q.isSelectionEmpty()||(q.scrollCellToVisible(q.getSelectionCell()),
null!=this.hoverIcons&&this.hoverIcons.update(q.view.getState(q.getSelectionCell())));try{mxEvent.consume(a)}catch(z){}}else d||(q.lastPasteXml=null,q.pasteCounter=0)}catch(z){this.handleError(z)}}}c.innerHTML="&nbsp;"};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,
function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,
null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),
d.innerHTML=this.editor.graph.sanitizeHtml(c),d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&
299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?EditorUi.drawHost+"/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,f;if(null==a){f=document.body;var k=document.documentElement;
d=(f.clientWidth||k.clientWidth)-3;f=Math.max(f.clientHeight||0,k.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,f=a.clientHeight;k=document.createElement("div");k.style.zIndex=mxPopupMenu.prototype.zIndex+2;k.style.border="3px dotted rgb(254, 137, 12)";k.style.pointerEvents="none";k.style.position="absolute";k.style.top=b+"px";k.style.left=c+"px";k.style.width=Math.max(0,d-3)+"px";k.style.height=Math.max(0,f-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(k):
document.body.appendChild(k);return k};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,c){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var b=0;b<a.length;b++)mxUtils.bind(this,function(a){var b=
new FileReader;b.onload=mxUtils.bind(this,function(b){try{var d=b.target.result,e=a.name;if(null!=e&&0<e.length){!this.useCanvasForExport&&/(\.png)$/i.test(e)?e=e.substring(0,e.length-4)+".drawio":/(\.pdf)$/i.test(e)&&(e=e.substring(0,e.length-4)+".drawio");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".drawio":e+".drawio";if("<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
this.defaultFilename,c);try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(B){this.handleError(B,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,c)});if(/(\.v(dx|sdx?))($|\?)/i.test(e)||/(\.vs(x|sx?))($|\?)/i.test(e))this.importVisio(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(/(\.*<graphml )/.test(d))this.importGraphML(d,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&
this.isRemoteFileFormat(d,e))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?f(a.responseText):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(d))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".drawio"),this.convertLucidChart(d,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,e,c)}),mxUtils.bind(this,
function(a){this.spinner.stop();this.handleError(a)}));else if("<mxlibrary"==b.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,c);try{this.loadLibrary(new LocalLibrary(this,b.target.result,a.name))}catch(D){this.handleError(D,mxResources.get("errorLoadingFile"))}}else if(0==d.indexOf("PK"))this.importZipFile(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}),mxUtils.bind(this,
function(){this.spinner.stop();this.openLocalFile(d,e,c)}));else{if("image/png"==a.type.substring(0,9))d=this.extractGraphModelFromPng(d);else if("application/pdf"==a.type){var g=Editor.extractGraphModelFromPdf(d);null!=g&&(d=g)}this.spinner.stop();this.openLocalFile(d,e,c)}}}catch(D){this.handleError(D)}});b.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"!==a.type.substring(0,5)&&"application/pdf"!==a.type||"image/svg"===a.type.substring(0,
9)?b.readAsText(a):b.readAsDataURL(a)})(a[b])};EditorUi.prototype.openLocalFile=function(a,c,d){var b=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==c&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var b=mxUtils.parseXml(a);null!=b&&(this.editor.setGraphXml(b.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,c||this.defaultFilename,d))});if(null!=a&&0<a.length)null==b||!b.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?
e():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=b&&b.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,c),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){null!=b&&b.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):e()})));else throw Error(mxResources.get("notADiagramFile"));
};EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var c=0;c<this.pages.length;c++)this.updatePageRoot(this.pages[c]),this.addBasenamesForCell(this.pages[c].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var c=[],d;for(d in a)c.push(d);return c};EditorUi.prototype.addBasenamesForCell=function(a,c){function b(a){if(null!=a){var b=a.lastIndexOf(".");0<b&&(a=a.substring(b+1,a.length));null==c[a]&&(c[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);
b(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(b(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),b(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),c)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=
a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a);null!=this.ruler&&(this.ruler.hRuler.container.style.visibility=a?"":"hidden",this.ruler.vRuler.container.style.visibility=a?"":"hidden");null!=this.tabContainer&&(this.tabContainer.style.visibility=a?"":"hidden");a||(null!=this.actions.outlineWindow&&this.actions.outlineWindow.window.setVisible(!1),null!=this.actions.layersWindow&&this.actions.layersWindow.window.setVisible(!1),
null!=this.menus.tagsWindow&&this.menus.tagsWindow.window.setVisible(!1),null!=this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1))};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,c,d){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);if(null==a||0==a.length)a=
this.emptyDiagramXml;this.setCurrentFile(new LocalFile(this,a,this.defaultFilename,!0));this.setFileData(a);this.editor.isChromelessView()?this.editor.graph.isLightboxView()&&this.lightboxFit():this.showLayersDialog();this.chromelessResize&&this.chromelessResize();this.editor.undoManager.clear();this.editor.modified=null!=d?d:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&
(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,c){null!=a?a.getPublicUrl(c):c(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,bounds:b.getGraphBounds(),currentPage:this.getSelectedPageIndex(),scale:b.view.scale,page:b.view.getBackgroundPageBounds()}};EditorUi.prototype.installMessageHandler=
function(a){var b=null,c=!1,d=!1,f=null,k=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,k);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){if(e.source==(window.opener||window.parent)){var g=e.data,l=mxUtils.bind(this,function(a){if(null!=a&&"function"===typeof a.charAt&&
"<"!=a.charAt(0))try{"data:image/png;base64,"==a.substring(0,22)?a=this.extractGraphModelFromPng(a):"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=Graph.decompress(a)))}catch(da){}return a});if("json"==urlParams.proto){try{g=JSON.parse(g)}catch(U){g=null}try{if(null==g)return;if("dialog"==g.action){this.showError(null!=g.titleKey?mxResources.get(g.titleKey):
g.title,null!=g.messageKey?mxResources.get(g.messageKey):g.message,null!=g.buttonKey?mxResources.get(g.buttonKey):g.button);null!=g.modified&&(this.editor.modified=g.modified);return}if("prompt"==g.action){this.spinner.stop();var k=new FilenameDialog(this,g.defaultValue||"",null!=g.okKey?mxResources.get(g.okKey):null,function(a){null!=a&&m.postMessage(JSON.stringify({event:"prompt",value:a,message:g}),"*")},null!=g.titleKey?mxResources.get(g.titleKey):g.title);this.showDialog(k.container,300,80,!0,
!1);k.init();return}if("draft"==g.action){var n=l(g.xml);this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[g.name||this.defaultFilename]),n,mxUtils.bind(this,function(){this.hideDialog();m.postMessage(JSON.stringify({event:"draft",result:"edit",message:g}),"*")}),mxUtils.bind(this,function(){this.hideDialog();m.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),g.editKey?mxResources.get(g.editKey):null,g.discardKey?mxResources.get(g.discardKey):null,
g.ignore?mxUtils.bind(this,function(){this.hideDialog();m.postMessage(JSON.stringify({event:"draft",result:"ignore",message:g}),"*")}):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{k.init()}catch(U){m.postMessage(JSON.stringify({event:"draft",error:U.toString(),message:g}),"*")}return}if("template"==g.action){this.spinner.stop();var p=1==g.enableRecent,q=1==g.enableSearch,t=1==g.enableCustomTemp,k=new NewDialog(this,!1,null!=
g.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=g.callback?m.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c,message:g}),"*"):(a(b,e,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,p?mxUtils.bind(this,function(a){this.remoteInvoke("getRecentDiagrams",null,null,a,function(){a(null,"Network Error!")})}):null,q?mxUtils.bind(this,function(a,b){this.remoteInvoke("searchDiagrams",
[a],null,b,function(){b(null,"Network Error!")})}):null,mxUtils.bind(this,function(a,b,c){m.postMessage(JSON.stringify({event:"template",docUrl:a,info:b,name:c}),"*")}),null,null,t?mxUtils.bind(this,function(a){this.remoteInvoke("getCustomTemplates",null,null,a,function(){a({},0)})}):null);this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("textContent"==g.action){var x=this.getDiagramTextContent();m.postMessage(JSON.stringify({event:"textContent",
data:x,message:g}),"*");return}if("status"==g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var v=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||g.show?this.spinner.spin(document.body,v):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==
g.format){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var J=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var u=this.editor.graph,K=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=g.format;b.message=g;b.data=a;b.xml=J;m.postMessage(JSON.stringify(b),"*")}),A=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);
"xmlpng"==g.format&&(a=Editor.writeGraphModelToPng(a,"tEXt","mxfile",encodeURIComponent(J)));u!=this.editor.graph&&u.container.parentNode.removeChild(u.container);K(a)}),M=g.pageId||(null!=this.pages?this.pages[0].getId():null);if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage.getId()!=M){for(var Q=u.getGlobalVariable,u=this.createTemporaryGraph(u.getStylesheet()),I,S=0;S<this.pages.length;S++)if(this.pages[S].getId()==M){I=this.updatePageRoot(this.pages[S]);break}u.getGlobalVariable=
function(a){return"page"==a?I.getName():"pagenumber"==a?1:Q.apply(this,arguments)};document.body.appendChild(u.container);u.model.setRoot(I.root)}if(null!=g.layerIds){for(var fa=u.model,ha=fa.getChildCells(fa.getRoot()),k={},S=0;S<g.layerIds.length;S++)k[g.layerIds[S]]=!0;for(S=0;S<ha.length;S++)fa.setVisible(ha[S],k[ha[S].id]||!1)}this.editor.exportToCanvas(mxUtils.bind(this,function(a){A(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){A(null)}),null,null,g.scale,null,null,
null,u)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==g.format?"1":"0")+(null!=M?"&pageId="+M:"")+(null!=g.layerIds?"&extras="+encodeURIComponent(JSON.stringify({layerIds:g.layerIds})):"")+(null!=g.scale?"&scale="+g.scale:"")+"&base64=1&xml="+encodeURIComponent(J))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?K("data:image/png;base64,"+a.getText()):A(null)}),mxUtils.bind(this,function(){A(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);
v=this.createLoadMessage("export");v.message=g;if("html2"==g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length)){var aa=this.getXmlFileData();v.xml=mxUtils.getXml(aa);v.data=this.getFileData(null,null,!0,null,null,null,aa);v.format=g.format}else if("html"==g.format)J=this.editor.getGraphXml(),v.data=this.getHtml(J,this.editor.graph),v.xml=mxUtils.getXml(J),v.format=g.format;else{mxSvgCanvas2D.prototype.foAltText=null;var ba=this.editor.graph.background;ba==mxConstants.NONE&&
(ba=null);v.xml=this.getFileData(!0,null,null,null,null,null,null,null,null,!1);v.format="svg";var Z=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();v.data=Editor.createSvgDataUri(a);m.postMessage(JSON.stringify(v),"*")});if("xmlsvg"==g.format)(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin))&&this.getEmbeddedSvg(v.xml,this.editor.graph,null,!0,Z,null,null,g.embedImages);else if(null==g.spin&&null==
g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){this.editor.graph.setEnabled(!1);var ca=this.editor.graph.getSvg(ba);this.embedFonts(ca,mxUtils.bind(this,function(a){g.embedImages||null==g.embedImages?this.editor.convertImages(a,mxUtils.bind(this,function(a){Z(mxUtils.getXml(a))})):Z(mxUtils.getXml(a))}))}return}m.postMessage(JSON.stringify(v),"*")}return}if("load"==g.action)d=1==g.autosave,this.hideDialog(),null!=g.modified&&null==urlParams.modified&&
(urlParams.modified=g.modified),null!=g.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=g.saveAndExit),null!=g.noSaveBtn&&null==urlParams.noSaveBtn&&(urlParams.noSaveBtn=g.noSaveBtn),null!=g.noExitBtn&&null==urlParams.noExitBtn&&(urlParams.noExitBtn=g.noExitBtn),null!=g.title&&null!=this.buttonContainer&&(n=document.createElement("span"),mxUtils.write(n,g.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="6px",this.buttonContainer.style.right=
"25px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(n),this.embedFilenameSpan=n),g=null!=g.xmlpng?this.extractGraphModelFromPng(g.xmlpng):g.xml;else{if("merge"==g.action){var ia=this.getCurrentFile();null!=ia&&(n=l(g.xml),null!=n&&""!=n&&ia.mergeFile(new LocalFile(this,n),function(){m.postMessage(JSON.stringify({event:"merge",
message:g}),"*")},function(a){m.postMessage(JSON.stringify({event:"merge",message:g,error:a}),"*")}))}else"remoteInvokeReady"==g.action?this.handleRemoteInvokeReady(m):"remoteInvoke"==g.action?this.handleRemoteInvoke(g,e.origin):"remoteInvokeResponse"==g.action?this.handleRemoteInvokeResponse(g):m.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(g)}),"*");return}}catch(U){this.handleError(U)}}var ea=mxUtils.bind(this,function(e,g){c=!0;try{a(e,g)}catch(la){this.handleError(la)}c=
!1;null!=urlParams.modified&&this.editor.setStatus("");var k=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});f=k();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=k();if(d!=f&&!c){var e=this.createLoadMessage("autosave");e.xml=d;d=JSON.stringify(e);(window.opener||window.parent).postMessage(d,"*")}f=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",
b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));if("1"==urlParams.returnbounds||"json"==urlParams.proto){var l=this.createLoadMessage("load");
l.xml=e;m.postMessage(JSON.stringify(l),"*")}});null!=g&&"function"===typeof g.substring&&"data:application/vnd.visio;base64,"==g.substring(0,34)?(l="0M8R4KGxGuE"==g.substring(34,45)?"raw.vsd":"raw.vsdx",this.importVisio(this.base64ToBlob(g.substring(g.indexOf(",")+1)),function(a){ea(a,e)},mxUtils.bind(this,function(a){this.handleError(a)}),l)):null!=g&&"function"===typeof g.substring&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(g,"")?this.parseFile(new Blob([g],{type:"application/octet-stream"}),
mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&"<mxGraphModel"==a.responseText.substring(0,13)&&ea(a.responseText,e)}),""):null!=g&&"function"===typeof g.substring&&this.isLucidChartData(g)?this.convertLucidChart(g,mxUtils.bind(this,function(a){ea(a)}),mxUtils.bind(this,function(a){this.handleError(a)})):(g=l(g),ea(g,e))}}));var m=window.opener||window.parent,k="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";m.postMessage(k,"*");if("json"==
urlParams.proto){var q=this.editor.graph.openLink;this.editor.graph.openLink=function(a,b,c){q.apply(this,arguments);m.postMessage(JSON.stringify({event:"openLink",href:a,target:b,allowOpener:c}),"*")}}};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"0px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var c=document.createElement("button");
c.className="geBigButton";var d=c;"1"==urlParams.noSaveBtn?"0"!=urlParams.saveAndExit&&(mxUtils.write(c,mxResources.get("saveAndExit")),c.setAttribute("title",mxResources.get("saveAndExit")),mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(c)):(mxUtils.write(c,mxResources.get("save")),c.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)"),mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()})),
a.appendChild(c),"1"==urlParams.saveAndExit&&(c=document.createElement("a"),mxUtils.write(c,mxResources.get("saveAndExit")),c.setAttribute("title",mxResources.get("saveAndExit")),c.className="geBigButton geBigStandardButton",c.style.marginLeft="6px",mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(c),d=c));"1"!=urlParams.noExitBtn&&(c=document.createElement("a"),mxUtils.write(c,mxResources.get("exit")),c.setAttribute("title",mxResources.get("exit")),
c.className="geBigButton geBigStandardButton",c.style.marginLeft="6px",mxEvent.addListener(c,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()})),a.appendChild(c),d=c);d.style.marginRight="20px";this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,
mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import"),this.isOffline()?null:"https://drawio-app.com/import-from-csv-to-drawio/"));this.showDialog(this.importCsvDialog.container,640,520,!0,!0,null,null,null,null,!0);this.importCsvDialog.init()};EditorUi.prototype.executeLayoutList=function(a,c){for(var b=this.editor.graph,d=b.getSelectionCells(),e=0;e<a.length;e++){var f=new window[a[e].layout](b);if(null!=a[e].config)for(var k in a[e].config)f[k]=
a[e].config[k];this.executeLayout(function(){f.execute(b.getDefaultParent(),0==d.length?null:d)},e==a.length-1,c)}};EditorUi.prototype.importCsv=function(a,c){try{var b=a.split("\n"),d=[],e=[],f={};if(0<b.length){var k={},m=null,q=null,y=null,D=null,B=null,C=null,z=null,E=null,G="",F="auto",H="auto",J=null,u=null,K=40,A=40,M=100,Q=0,I=this.editor.graph;I.getGraphBounds();for(var S=function(){null!=c?c(pa):(I.setSelectionCells(pa),I.scrollCellToVisible(I.getSelectionCell()))},fa=I.getFreeInsertPoint(),