7.2.7 release

This commit is contained in:
Gaudenz Alder 2017-08-24 17:29:05 +02:00
parent 45a62eb45f
commit 0a82326bf6
10 changed files with 338 additions and 334 deletions

View file

@ -1,3 +1,7 @@
24-AUG-2017: 7.2.7
- Fixes file usage stats
24-AUG-2017: 7.2.6
- Improvements for Lucidchart import

View file

@ -1 +1 @@
7.2.6
7.2.7

View file

@ -1,7 +1,7 @@
CACHE MANIFEST
# THIS FILE WAS GENERATED. DO NOT MODIFY!
# 08/24/2017 05:07 PM
# 08/24/2017 05:26 PM
app.html
index.html?offline=1

158
war/js/app.min.js vendored
View file

@ -6208,7 +6208,7 @@ O.setAttribute("min","1");O.setAttribute("type","number");O.style.width="40px";H
K.appendChild(H);K.appendChild(W);N.appendChild(P);N.appendChild(Y);N.appendChild(U);T.appendChild(K);T.appendChild(N);q.appendChild(T);g.appendChild(q);h.appendChild(g);g=document.createElement("div");f=document.createElement("div");f.style.fontWeight="bold";f.style.marginBottom="12px";mxUtils.write(f,mxResources.get("paperSize"));g.appendChild(f);f=document.createElement("div");f.style.marginBottom="12px";var V=PageSetupDialog.addPageFormatPanel(f,"printdialog",a.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);
g.appendChild(f);f=document.createElement("span");mxUtils.write(f,mxResources.get("pageScale"));g.appendChild(f);var S=document.createElement("input");S.style.cssText="margin:0 8px 0 8px;";S.setAttribute("value","100 %");S.style.width="60px";g.appendChild(S);h.appendChild(g);f=document.createElement("div");f.style.cssText="text-align:right;margin:62px 0 0 0;";g=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});g.className="geBtn";a.editor.cancelFirst&&f.appendChild(g);a.isOffline()||
(q=mxUtils.button(mxResources.get("help"),function(){window.open("https://desk.draw.io/support/solutions/articles/16000048947")}),q.className="geBtn",f.appendChild(q));PrintDialog.previewEnabled&&(q=mxUtils.button(mxResources.get("preview"),function(){a.hideDialog();c(!1)}),q.className="geBtn",f.appendChild(q));q=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();c(!0)});q.className="geBtn gePrimaryBtn";f.appendChild(q);a.editor.cancelFirst||f.appendChild(g);
h.appendChild(f);this.container=h}})();(function(){EditorUi.VERSION="7.2.6";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
h.appendChild(f);this.container=h}})();(function(){EditorUi.VERSION="7.2.7";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
36;EditorUi.prototype.defaultCustomShapeStyle="shape=stencil(tZRtTsQgEEBPw1+DJR7AoN6DbWftpAgE0Ortd/jYRGq72R+YNE2YgTePloEJGWblgA18ZuKFDcMj5/Sm8boZq+BgjCX4pTyqk6ZlKROitwusOMXKQDODx5iy4pXxZ5qTHiFHawxB0JrQZH7lCabQ0Fr+XWC1/E8zcsT/gAi+Subo2/3Mh6d/oJb5nU1b5tW7r2knautaa3T+U32o7f7vZwpJkaNDLORJjcu7t59m2jXxqX9un+tt022acsfmoKaQZ+vhhswZtS6Ne/ThQGt0IV0N3Yyv6P3CeT9/tHO0XFI5cAE=);whiteSpace=wrap;html=1;";EditorUi.prototype.maxBackgroundSize=1600;EditorUi.prototype.maxImageSize=520;EditorUi.prototype.resampleThreshold=
1E5;EditorUi.prototype.maxImageBytes=1E6;EditorUi.prototype.maxBackgroundBytes=25E5;EditorUi.prototype.currentFile=null;EditorUi.prototype.printPdfExport=!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;(function(){EditorUi.prototype.useCanvasForExport=!1;EditorUi.prototype.jpgSupported=!1;try{var a=document.createElement("canvas"),b=new Image;b.onload=function(){try{a.getContext("2d").drawImage(b,0,0);var e=a.toDataURL("image/png");EditorUi.prototype.useCanvasForExport=
null!=e&&6<e.length}catch(m){}};b.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(n){}try{a=document.createElement("canvas");a.width=a.height=1;var c=a.toDataURL("image/jpeg");EditorUi.prototype.jpgSupported=null!==c.match("image/jpeg")}catch(n){}})();
@ -6242,84 +6242,84 @@ mxUtils.getXml(a))})))}else h=e+".svg",m=this.getFileData(!1,!0,null,mxUtils.bin
0;f<this.pages.length;f++)if(this.pages[f]==this.currentPage){h="&from="+f;break}return new mxXmlRequest(EXPORT_URL,"format="+b+h+"&base64="+d+"&embedXml="+e+"&xml="+encodeURIComponent(c)+(null!=a?"&filename="+encodeURIComponent(a):""))};EditorUi.prototype.setMode=function(a,b){this.mode=a};EditorUi.prototype.fileLoaded=function(a){var b=!1;this.hideDialog();var c=this.getCurrentFile();this.setCurrentFile(null);null!=c&&(c.removeListener(this.descriptorChangedListener),c.close());this.editor.graph.model.clear();
this.editor.undoManager.clear();var e=mxUtils.bind(this,function(){this.setGraphEnabled(!1);this.setCurrentFile(null);null!=c&&this.updateDocumentTitle();this.editor.graph.model.clear();this.editor.undoManager.clear();null!=window.location.hash&&0<window.location.hash.length&&(window.location.hash="");null!=this.fname&&(this.fnameWrapper.style.display="none",this.fname.innerHTML="",this.fname.setAttribute("title",mxResources.get("rename")));this.updateUi();this.showSplash()});if(null!=a)try{this.setCurrentFile(a);
a.addListener("descriptorChanged",this.descriptorChangedListener);a.addListener("contentChanged",this.descriptorChangedListener);this.descriptorChanged();a.open();this.setGraphEnabled(!0);this.setMode(a.getMode());this.editor.undoManager.clear();this.updateUi();null==a.realtime&&(a.isEditable()?this.editor.setStatus(""):this.editor.setStatus(mxUtils.htmlEntities(mxResources.get("readOnly"))));this.editor.chromeless?this.editor.graph.lightbox&&this.lightboxFit():(this.editor.graph.selectUnlockedLayer(),
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));b=!0;if(this.enableLogging&&!this.isOffline()&&null!=a.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",a.getMode())}catch(m){}if(this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(m){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(m){}}catch(m){null!=window.console&&console.log("error in fileLoaded:",a,m);if(this.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=m&&null!=m.message?":err:"+encodeURIComponent(m.message):"")+(null!=m&&null!=m.stack?"&stack="+encodeURIComponent(m.stack):"")}catch(p){}this.handleError(m,mxResources.get("errorLoadingFile"),
mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=c?c.constructor==DriveFile?this.loadFile(c.getHash()):this.fileLoaded(c):e()}))}else e();return b};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,c,d,f,g,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==this.scratchpad?this.getLocalData(".scratchpad",
mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(a){var b=mxUtils.createXmlDocument(),c=b.createElement("mxlibrary");mxUtils.setTextContent(c,JSON.stringify(a));b.appendChild(c);return mxUtils.getXml(b)};EditorUi.prototype.closeLibrary=function(a){null!=a&&(this.removeLibrarySidebar(a.getHash()),a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),
".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var b=this.sidebar.palettes[a];if(null!=b){for(var c=0;c<b.length;c++)b[c].parentNode.removeChild(b[c]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var b=this.sidebar.container;if(null==a){var c=this.sidebar.palettes["L.scratchpad"];null==c&&(c=this.sidebar.palettes.search);null!=c&&(a=c[c.length-1].nextSibling)}a=null!=a?a:b.firstChild.nextSibling.nextSibling;
var c=b.lastChild,e=c.previousSibling;b.insertBefore(c,a);b.insertBefore(e,c)};EditorUi.prototype.loadLibrary=function(a){var b=mxUtils.parseXml(a.getData());if("mxlibrary"==b.documentElement.nodeName){var c=JSON.parse(mxUtils.getTextContent(b.documentElement));this.libraryLoaded(a,c,b.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};EditorUi.prototype.libraryLoaded=function(a,b,c){a.constructor!=
LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var d=this.sidebar.palettes[a.getHash()],d=null!=d?d[d.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var e=null,h=mxUtils.bind(this,function(b,c){if(0==b.length&&a.isEditable())null==e&&(e=document.createElement("div"),mxUtils.setPrefixedStyle(e.style,"borderRadius","6px"),e.style.border="3px dotted lightGray",e.style.textAlign="center",e.style.padding="8px",e.style.color="#B3B3B3",
mxUtils.write(e,mxResources.get("dragElementsHere"))),c.appendChild(e);else for(var d=0;d<b.length;d++){var h=b[d],f=h.data;if(null!=f){var f=this.convertDataUri(f),g="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==h.aspect&&(g+="aspect=fixed;");c.appendChild(this.sidebar.createVertexTemplate(g+"image="+f,h.w,h.h,"",h.title||"",!1,!1,!1))}else null!=h.xml&&(f=this.stringToCells(this.editor.graph.decompress(h.xml)),0<f.length&&c.appendChild(this.sidebar.createVertexTemplateFromCells(f,
h.w,h.h,h.title||"",!0,!1,!1)))}});c=null!=c&&0<c.length?c:a.getTitle();var f=this.sidebar.addPalette(a.getHash(),c,!0,mxUtils.bind(this,function(a){h(b,a)}));this.repositionLibrary(d);var g=f.parentNode.previousSibling;c=g.getAttribute("title");null!=c&&0<c.length&&".scratchpad"!=a.title&&g.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+c);var l=document.createElement("div");l.style.position="absolute";l.style.right="0px";l.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(l.style.backgroundColor=
"inherit");g.style.position="relative";var u=document.createElement("img");u.setAttribute("src",Dialog.prototype.closeImage);u.setAttribute("title",mxResources.get("close"));u.setAttribute("align","top");u.setAttribute("border","0");u.className="geButton";u.style.marginRight="1px";u.style.marginTop="-1px";l.appendChild(u);var k=null;mxEvent.addListener(u,"click",mxUtils.bind(this,function(b){if(!mxEvent.isConsumed(b)){var c=mxUtils.bind(this,function(){this.closeLibrary(a)});null!=k?this.confirm(mxResources.get("allChangesLost"),
null,c,mxResources.get("cancel"),mxResources.get("discardChanges")):c();mxEvent.consume(b)}}));mxEvent.addListener(f,"mousemove",mxUtils.bind(this,function(a){mxEvent.getSource(a)==f?f.setAttribute("title",mxResources.get("libraryTooltip")):f.removeAttribute("title")}));if(a.isEditable()){var v=this.editor.graph,B=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),f,b,a,a.getMode());mxEvent.consume(c)}),C=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=y&&null!=
y.parentNode&&y.parentNode.removeChild(y),y=u.cloneNode(!1),y.setAttribute("src",Editor.spinImage),y.setAttribute("title",mxResources.get("saving")),y.style.cursor="default",y.style.marginRight="2px",y.style.marginTop="-2px",l.insertBefore(y,l.firstChild),g.style.paddingRight=18*l.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=y&&null!=y.parentNode&&(y.parentNode.removeChild(y),g.style.paddingRight=18*l.childNodes.length+"px")})):null==k&&(k=u.cloneNode(!1),
k.setAttribute("src",IMAGE_PATH+"/download.png"),k.setAttribute("title",mxResources.get("save")),l.insertBefore(k,l.firstChild),mxEvent.addListener(k,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==k||a.isModified()||(g.style.paddingRight=18*l.childNodes.length+"px",k.parentNode.removeChild(k),k=null)});mxEvent.consume(c)})),g.style.paddingRight=18*l.childNodes.length+"px")}),D=mxUtils.bind(this,function(a,c,d,h){a=
v.cloneCells(mxUtils.sortCells(v.model.getTopmostCells(a)));for(var g=0;g<a.length;g++){var l=v.getCellGeometry(a[g]);null!=l&&l.translate(-c.x,-c.y)}f.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,h||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=h&&(a.title=h);b.push(a);C(d);null!=e&&null!=e.parentNode&&0<b.length&&(e.parentNode.removeChild(e),e=null)}),z=mxUtils.bind(this,function(a){if(v.isSelectionEmpty())v.getRubberband().isActive()?
(v.getRubberband().execute(a),v.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var b=v.getSelectionCells(),c=v.view.getBounds(b),e=v.view.scale;c.x/=e;c.y/=e;c.width/=e;c.height/=e;c.x-=v.view.translate.x;c.y-=v.view.translate.y;D(b,c)}mxEvent.consume(a)});f.style.border="3px solid transparent";mxEvent.addGestureListeners(f,function(){},mxUtils.bind(this,function(a){v.isMouseDown&&null!=v.panningManager&&null!=v.graphHandler.shape&&
(v.graphHandler.shape.node.style.visibility="hidden",null!=e?e.style.border="3px dotted rgb(254, 137, 12)":f.style.border="3px dotted rgb(254, 137, 12)",f.style.cursor="copy",v.panningManager.stop(),v.autoScroll=!1,null!=v.graphHandler.guide&&v.graphHandler.guide.setVisible(!1),null!=v.graphHandler.hint&&(v.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){v.isMouseDown&&null!=v.panningManager&&null!=v.graphHandler&&(f.style.border="3px solid transparent",
null!=e&&(e.style.border="3px dotted lightGray"),f.style.cursor="default",this.sidebar.showTooltips=!0,v.panningManager.stop(),v.graphHandler.reset(),v.isMouseDown=!1,v.autoScroll=!0,z(a),mxEvent.consume(a))}));mxEvent.addListener(f,"mouseleave",mxUtils.bind(this,function(a){v.isMouseDown&&null!=v.graphHandler.shape&&(v.graphHandler.shape.node.style.visibility="visible",f.style.border="3px solid transparent",f.style.cursor="",v.autoScroll=!0,null!=v.graphHandler.guide&&v.graphHandler.guide.setVisible(!0),
null!=v.graphHandler.hint&&(v.graphHandler.hint.style.visibility="visible"),null!=e&&(e.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(f,"dragover",mxUtils.bind(this,function(a){null!=e?e.style.border="3px dotted rgb(254, 137, 12)":f.style.border="3px dotted rgb(254, 137, 12)";a.dataTransfer.dropEffect="copy";f.style.cursor="copy";this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()})),mxEvent.addListener(f,"drop",mxUtils.bind(this,function(a){f.style.border=
"3px solid transparent";f.style.cursor="";null!=e&&(e.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,g,l,m,n,u,k,w){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,m,n),c)],c[0].vertex=!0,D(c,new mxRectangle(0,0,m,n),a,mxEvent.isAltDown(a)?null:u.substring(0,
u.lastIndexOf(".")).replace(/_/g," ")),null!=e&&null!=e.parentNode&&0<b.length&&(e.parentNode.removeChild(e),e=null);else{var p=!1,v=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var g=mxUtils.parseXml(c);if("mxlibrary"==g.documentElement.nodeName)try{var l=JSON.parse(mxUtils.getTextContent(g.documentElement));h(l,f);b=b.concat(l);C(a);this.spinner.stop();p=!0}catch(V){}else if("mxfile"==g.documentElement.nodeName)try{for(var m=g.documentElement.getElementsByTagName("diagram"),g=0;g<
m.length;g++){var l=mxUtils.getTextContent(m[g]),n=this.stringToCells(this.editor.graph.decompress(l)),u=this.editor.graph.getBoundingBoxFromGeometry(n);D(n,new mxRectangle(0,0,u.width,u.height),a)}p=!0}catch(V){null!=window.console&&console.log("error in drop handler:",V)}}p||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=e&&null!=e.parentNode&&0<b.length&&(e.parentNode.removeChild(e),e=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,
u)&&null!=w?this.parseFile(w,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?v(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):v(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(f,"dragleave",function(a){null!=e?e.style.border="3px dotted lightGray":(f.style.border="3px solid transparent",f.style.cursor="");a.stopPropagation();
a.preventDefault()}));u=u.cloneNode(!1);u.setAttribute("src",IMAGE_PATH+"/edit.gif");u.setAttribute("title",mxResources.get("edit"));l.insertBefore(u,l.firstChild);mxEvent.addListener(u,"click",B);mxEvent.addListener(f,"dblclick",function(a){mxEvent.getSource(a)==f&&B(a)});u=u.cloneNode(!1);u.setAttribute("src",Editor.plusImage);u.setAttribute("title",mxResources.get("add"));l.insertBefore(u,l.firstChild);this.isOffline()||".scratchpad"!=a.title||(c=document.createElement("span"),c.setAttribute("title",
mxResources.get("help")),c.style.cssText="color:gray;text-decoration:none;",c.className="geButton",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,mxUtils.bind(this,function(a){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(a)})),l.insertBefore(c,l.firstChild));var y=null;mxEvent.addListener(u,"click",z)}g.appendChild(l);g.style.paddingRight=18*l.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==
typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=
2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position=
"relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.prototype.hideFooter=function(){var a=document.getElementById("geFooter");null!=a&&(this.footerHeight=0,a.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=function(a,b,c,d,f){a=new ImageDialog(this,a,b,c,d,f);this.showDialog(a.container,Graph.fileSupport?440:360,Graph.fileSupport?
200:90,!0,!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var b=new BackgroundImageDialog(this,mxUtils.bind(this,function(b){a(b)}));this.showDialog(b.container,360,200,!0,!0);b.init()};EditorUi.prototype.showLibraryDialog=function(a,b,c,d,f){a=new LibraryDialog(this,a,b,c,d,f);this.showDialog(a.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&
null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer");a.style.position="absolute";a.style.overflow="hidden";a.style.borderWidth="3px";var b=document.createElement("a");b.setAttribute("href","javascript:void(0);");b.className="geTitle";b.style.height="100%";b.style.paddingTop="9px";mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,"click",mxUtils.bind(this,
function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,c){var d=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},e=null!=a&&null!=a.error?a.error:a;if(null!=e||null!=b){a=mxUtils.htmlEntities(mxResources.get("unknownError"));var h=mxResources.get("ok"),f=null;b=null!=b?b:mxResources.get("error");if(null!=e)if(null!=e.retry&&(h=mxResources.get("cancel"),f=function(){d();e.retry()}),"undefined"!=
typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&e.type==gapi.drive.realtime.ErrorType.FORBIDDEN)a=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==e.code||404==e.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&e.type==gapi.drive.realtime.ErrorType.NOT_FOUND){a=mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var g=window.location.hash;null!=g&&"#G"==g.substring(0,2)&&(g=g.substring(2),
a+=' <a href="https://drive.google.com/open?id='+g+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else e.code==App.ERROR_TIMEOUT?a=mxUtils.htmlEntities(mxResources.get("timeout")):e.code==App.ERROR_BUSY?a=mxUtils.htmlEntities(mxResources.get("busy")):null!=e.message?a=mxUtils.htmlEntities(e.message):null!=e.response&&null!=e.response.error&&(a=mxUtils.htmlEntities(e.response.error));this.showError(b,a,h,c,f)}else null!=c&&c()};EditorUi.prototype.showError=
function(a,b,c,d,f,g,k){a=new ErrorDialog(this,a,b,c,d,f,g,k);this.showDialog(a.container,340,150,!0,!1);a.init()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,c,d,f){var e=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,a,function(){e();null!=b&&b()},function(){e();null!=c&&c()},d,f)).container,
340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(a){this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var a=this.editor.graph.getModel();return 1==a.getChildCount(a.root)&&0==a.getChildCount(a.getChildAt(a.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+
btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=function(a,b,c){var d=a.toDataURL("image/"+c);if(6>=d.length||d==a.cloneNode(!1).toDataURL("image/"+c))throw{message:"Invalid image"};null!=b&&(d=this.writeGraphModelToPng(d,"zTXt","mxGraphModel",atob(this.editor.graph.compress(b))));return d};EditorUi.prototype.saveCanvas=function(a,b,c){var d="jpeg"==c?"jpg":c,e=this.getBaseFilename()+"."+d;a=this.createImageDataUri(a,b,c);this.saveData(e,d,a.substring(a.lastIndexOf(",")+
1),"image/"+c,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(a,b,c,d,f){if(window.Blob&&navigator.msSaveOrOpenBlob)a=d?this.base64ToBlob(a,c):new Blob([a],{type:c}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)c=
window.open("about:blank","_blank"),null==c?mxUtils.popup(a,!0):(c.document.write(a),c.document.close(),c.document.execCommand("SaveAs",!0,b),c.close());else if(mxClient.IS_IOS)b=new TextareaDialog(this,b+":",a,null,null,mxResources.get("close")),b.textarea.style.width="600px",b.textarea.style.height="380px",this.showDialog(b.container,620,460,!0,!0),b.init(),document.execCommand("selectall",!1,null);else{var e=document.createElement("a"),h=!mxClient.IS_SF&&"undefined"!==typeof e.download;if(h||this.isOffline()){e.href=
URL.createObjectURL(d?this.base64ToBlob(a,c):new Blob([a],{type:c}));h?e.download=b:e.setAttribute("target","_blank");document.body.appendChild(e);try{window.setTimeout(function(){URL.revokeObjectURL(e.href)},0),e.click(),e.parentNode.removeChild(e)}catch(q){}}else this.createEchoRequest(a,b,c,d,f).simulate(document,"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,c,d,f,g){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=c?"&mime="+c:"")+(null!=f?"&format="+f:
"")+(null!=g?"&base64="+g:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(d?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,e=Math.ceil(d/1024),f=Array(e),h=0;h<e;++h){for(var g=1024*h,k=Math.min(g+1024,d),u=Array(k-g),w=0;g<k;++w,++g)u[w]=c[g].charCodeAt(0);f[h]=new Uint8Array(u)}return new Blob(f,{type:b})};EditorUi.prototype.saveLocalFile=function(a,b,c,d,f,g){g=null!=g?g:!1;var e="vsdx"!=f&&(!mxClient.IS_IOS||!navigator.standalone);f=this.getServiceCount(g);
b=new CreateDialog(this,b,mxUtils.bind(this,function(b,e){try{if("_blank"==e)if(null==c||"image/"!=c.substring(0,6)||"image/svg"==c.substring(0,9)&&!mxClient.IS_SVG)f=window.open("about:blank"),null==f?mxUtils.popup(a,!0):(f.document.write(mxUtils.htmlEntities(a,!1)),f.document.close());else if(mxClient.IS_EDGE||11==document.documentMode||10==document.documentMode){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write('<html><img src="data:'+c+(d?";base64,"+a:";charset=utf8,"+
encodeURIComponent(a))+'"/></html>'),f.document.close())}else f=window.open("data:"+c+(d?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null==f&&mxUtils.popup(a,!0);else e==App.MODE_DEVICE?this.doSaveLocalFile(a,b,c,d):null!=b&&0<b.length&&this.pickFolder(e,mxUtils.bind(this,function(f){try{this.exportFile(a,b,c,d,e,f)}catch(v){this.handleError(v)}}))}catch(w){this.handleError(w)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,g,
e,null,null,4<f?3:4,a,c,d);this.showDialog(b.container,380,4<f?390:270,!0,!0);b.init()};EditorUi.prototype.saveData=function(a,b,c,d,f){this.isLocalFileSave()?this.saveLocalFile(c,a,d,f,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,e){return this.createEchoRequest(c,a,d,f,b,e)}),c,f,d)};EditorUi.prototype.saveRequest=function(a,b,c,d,f,g){var e=!mxClient.IS_IOS||!navigator.standalone,h=this.getServiceCount(!1);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,e){if("_blank"==e||null!=
a&&0<a.length){var f=c("_blank"==e?null:a,e==App.MODE_DEVICE||null==e||"_blank"==e?"0":"1");null!=f&&(e==App.MODE_DEVICE||"_blank"==e?f.simulate(document,"_blank"):this.pickFolder(e,mxUtils.bind(this,function(c){g=null!=g?g:"pdf"==b?"application/pdf":"image/"+b;if(null!=d)try{this.exportFile(d,a,g,!0,e,c)}catch(B){this.handleError(B)}else this.spinner.spin(document.body,mxResources.get("saving"))&&f.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=f.getStatus()&&299>=f.getStatus())try{this.exportFile(f.getText(),
a,g,!0,e,c)}catch(B){this.handleError(B)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,e,null,null,4<h?3:4,d,g,f);this.showDialog(a.container,380,4<h?390:270,!0,!0);a.init()};EditorUi.prototype.exportFile=function(a,b,c,d,f,g){};EditorUi.prototype.pickFolder=function(a,b,c){b(null)};EditorUi.prototype.exportSvg=
function(a,b,c,d,f,g,k,q,x){if(this.spinner.spin(document.body,mxResources.get("export"))){var e=this.editor.graph.isSelectionEmpty();c=null!=c?c:e;e=b?null:this.editor.graph.background;e==mxConstants.NONE&&(e=null);null==e&&0==b&&(e="#ffffff");var h=this.editor.graph.getSvg(e,a,k,q,null,c);d&&this.editor.graph.addSvgShadow(h);var l=this.getBaseFilename()+".svg",m=mxUtils.bind(this,function(a){this.spinner.stop();f&&a.setAttribute("content",this.getFileData(!0,null,null,null,c,x));var b='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+
mxUtils.getXml(a);this.isLocalFileSave()||b.length<=MAX_REQUEST_SIZE?this.saveData(l,"svg",b,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(b)}))});this.convertMath(this.editor.graph,h,!1,mxUtils.bind(this,function(){g?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(h,m,this.thumbImageCache)):m(h)}))}};EditorUi.prototype.addCheckbox=function(a,b,c,d,f,g){g=null!=g?g:!0;var e=
document.createElement("input");e.style.marginRight="8px";e.style.marginTop="16px";e.setAttribute("type","checkbox");c&&(e.setAttribute("checked","checked"),e.defaultChecked=!0);d&&e.setAttribute("disabled","disabled");g&&(a.appendChild(e),mxUtils.write(a,b),f||mxUtils.br(a));return e};EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),e="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=
App.MODE_BROWSER&&(e=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));f.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");f.appendChild(d);a.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,
function(){if("custom"==f.value){var a=new FilenameDialog(this,e,mxResources.get("ok"),function(a){null!=a?e=a:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":
e:null},getEditInput:function(){return c},getEditSelect:function(){return f}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){h.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+f:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");
d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&
(e=document.createElement("option"),e.setAttribute("value","frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",h=null,h=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();h.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";h.style.marginLeft="4px";h.style.height="22px";h.style.width=
"22px";h.style.position="relative";h.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";h.className="geColorBtn";a.appendChild(h);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,c,d,f,g,k,q){var e=this.getCurrentFile(),h=[];d&&(h.push("lightbox=1"),"auto"!=a&&h.push("target="+a),null!=b&&b!=mxConstants.NONE&&h.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),
null!=f&&0<f.length&&h.push("edit="+encodeURIComponent(f)),g&&h.push("layers=1"),this.editor.graph.foldingEnabled&&h.push("nav=1"));if(c&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&h.push("page="+a);break}a=!0;null!=k?c="#U"+encodeURIComponent(k):(e=this.getCurrentFile(),q||null==e||e.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):
(c="#"+e.getHash(),a=!1));a&&null!=e&&null!=e.getTitle()&&e.getTitle()!=this.defaultFilename&&h.push("title="+encodeURIComponent(e.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<h.length?"?"+h.join("&"):"")+c};EditorUi.prototype.createHtml=function(a,b,c,d,f,g,k,q,x,u,w){var e=this.getBasenames(),h={};""!=f&&f!=mxConstants.NONE&&(h.highlight=f);"auto"!==d&&(h.target=d);x||(h.lightbox=!1);h.nav=this.editor.graph.foldingEnabled;
c=parseInt(c);isNaN(c)||100==c||(h.zoom=c/100);c=[];k&&(c.push("pages"),h.resize=!0,null!=this.pages&&null!=this.currentPage&&(h.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(c.push("zoom"),h.resize=!0);q&&c.push("layers");0<c.length&&(x&&c.push("lightbox"),h.toolbar=c.join(" "));null!=u&&0<u.length&&(h.edit=u);null!=a?h.url=a:h.xml=this.getFileData(!0,null,null,null,null,!k);b='<div class="mxgraph" style="'+(g?"max-width:100%;":"")+(""!=c?"border:1px solid transparent;":"")+'" data-mxgraph="'+
mxUtils.htmlEntities(JSON.stringify(h))+'"></div>';e=0<e.length?"s="+e.join(";"):"";a=null!=a?"fetch="+encodeURIComponent(a):"";w(b,'<script type="text/javascript" src="'+(0<e.length||0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+e:"https://www.draw.io/embed2.js?"+e)+"&"+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,c,d){var e=document.createElement("div");
e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(f);var h=document.createElement("div");h.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var g=document.createElement("input");g.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";g.setAttribute("value","url");g.setAttribute("type","radio");g.setAttribute("name",
"type-embedhtmldialog");f=g.cloneNode(!0);f.setAttribute("value","copy");h.appendChild(f);var l=document.createElement("span");mxUtils.write(l,mxResources.get("includeCopyOfMyDiagram"));h.appendChild(l);mxUtils.br(h);h.appendChild(g);l=document.createElement("span");mxUtils.write(l,mxResources.get("publicDiagramUrl"));h.appendChild(l);var n=this.getCurrentFile();null==c&&null!=n&&n.constructor==window.DriveFile&&(l=document.createElement("a"),l.style.paddingLeft="12px",l.style.color="gray",l.setAttribute("href",
"javascript:void(0);"),mxUtils.write(l,mxResources.get("share")),h.appendChild(l),mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(n.getId())})));f.setAttribute("checked","checked");null==c&&g.setAttribute("disabled","disabled");e.appendChild(h);var k=this.addLinkSection(e),v=this.addCheckbox(e,mxResources.get("zoom"),!0,null,!0);mxUtils.write(e,":");var B=document.createElement("input");B.setAttribute("type","text");B.style.marginRight="16px";
B.style.width="60px";B.style.marginLeft="4px";B.style.marginRight="12px";B.value="100%";e.appendChild(B);var C=this.addCheckbox(e,mxResources.get("fit"),!0),h=null!=this.pages&&1<this.pages.length,D=D=this.addCheckbox(e,mxResources.get("allPages"),h,!h),z=this.addCheckbox(e,mxResources.get("layers"),!0),y=this.addCheckbox(e,mxResources.get("lightbox"),!0),A=this.addEditButton(e,y),E=A.getEditInput();E.style.marginBottom="16px";mxEvent.addListener(y,"change",function(){y.checked?E.removeAttribute("disabled"):
E.setAttribute("disabled","disabled");E.checked&&y.checked?A.getEditSelect().removeAttribute("disabled"):A.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){d(g.checked?c:null,v.checked,B.value,k.getTarget(),k.getColor(),C.checked,D.checked,z.checked,y.checked,A.getLink())}),null,a,b);this.showDialog(a.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,c,d,f,g){var e=document.createElement("div");e.style.whiteSpace=
"nowrap";var h=document.createElement("h3");mxUtils.write(h,a||mxResources.get("link"));h.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(h);var l=this.getCurrentFile(),h="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=l&&l.constructor==window.DriveFile&&!b){a=80;var h="https://desk.draw.io/support/solutions/articles/16000039384",m=document.createElement("div");m.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";
var n=document.createElement("div");n.style.whiteSpace="normal";mxUtils.write(n,mxResources.get("linkAccountRequired"));m.appendChild(n);n=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(l.getId())}));n.style.marginTop="12px";n.className="geBtn";m.appendChild(n);e.appendChild(m);n=document.createElement("a");n.style.paddingLeft="12px";n.style.color="gray";n.style.fontSize="11px";n.setAttribute("href","javascript:void(0);");mxUtils.write(n,mxResources.get("check"));
m.appendChild(n);mxEvent.addListener(n,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,null,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var k=null,p=null;if(null!=c||null!=d)a+=30,mxUtils.write(e,mxResources.get("width")+":"),k=document.createElement("input"),
k.setAttribute("type","text"),k.style.marginRight="16px",k.style.width="50px",k.style.marginLeft="6px",k.style.marginRight="16px",k.style.marginBottom="10px",k.value="100%",e.appendChild(k),mxUtils.write(e,mxResources.get("height")+":"),p=document.createElement("input"),p.setAttribute("type","text"),p.style.width="50px",p.style.marginLeft="6px",p.style.marginBottom="10px",p.value=d+"px",e.appendChild(p),mxUtils.br(e);var C=this.addLinkSection(e,g);c=null!=this.pages&&1<this.pages.length;var D=null;
if(null==l||l.constructor!=window.DriveFile||b)D=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var z=this.addCheckbox(e,mxResources.get("lightbox"),!0),y=this.addEditButton(e,z),A=y.getEditInput(),E=this.addCheckbox(e,mxResources.get("layers"),!0);E.style.marginLeft=A.style.marginLeft;E.style.marginBottom="16px";E.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(E.removeAttribute("disabled"),A.removeAttribute("disabled")):(E.setAttribute("disabled","disabled"),A.setAttribute("disabled",
"disabled"));A.checked&&z.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){f(C.getTarget(),C.getColor(),null==D?!0:D.checked,z.checked,y.getLink(),E.checked,null!=k?k.value:null,null!=p?p.value:null)}),null,mxResources.get("create"),h);this.showDialog(b.container,340,246+a,!0,!0);null!=k?(k.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?k.select():document.execCommand("selectAll",
!1,null)):C.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var h=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),g=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),!0);null!=g&&
(g.style.marginBottom="16px");a=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!h.checked,null!=g?g.checked:!1)}),null,a,b);this.showDialog(a.container,300,d?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,c,d,f,g,k,q){k=null!=k?k:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=this.editor.graph,l="jpeg"==q?170:280,m=document.createElement("h3");mxUtils.write(m,a);m.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";e.appendChild(m);
mxUtils.write(e,mxResources.get("zoom")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.style.marginRight="12px";n.value=this.lastExportZoom||"100%";e.appendChild(n);mxUtils.write(e,mxResources.get("borderWidth")+":");var p=document.createElement("input");p.setAttribute("type","text");p.style.marginRight="16px";p.style.width="60px";p.style.marginLeft="4px";p.value=this.lastExportBorder||"0";e.appendChild(p);
mxUtils.br(e);var t=this.addCheckbox(e,mxResources.get("transparentBackground"),h.background==mxConstants.NONE||null==h.background,null,null,"jpeg"!=q),z=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,h.isSelectionEmpty()),y=document.createElement("input");y.style.marginTop="16px";y.style.marginRight="8px";y.style.marginLeft="24px";y.setAttribute("disabled","disabled");y.setAttribute("type","checkbox");g&&(e.appendChild(y),mxUtils.write(e,mxResources.get("crop")),mxUtils.br(e),l+=26,mxEvent.addListener(z,
"change",function(){z.checked?y.removeAttribute("disabled"):y.setAttribute("disabled","disabled")}));h.isSelectionEmpty()||(y.setAttribute("checked","checked"),y.defaultChecked=!0);var A=this.addCheckbox(e,mxResources.get("shadow"),h.shadowVisible),E=document.createElement("input");E.style.marginTop="16px";E.style.marginRight="8px";E.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||E.setAttribute("disabled","disabled");b&&(e.appendChild(E),mxUtils.write(e,mxResources.get("embedImages")),
mxUtils.br(e),l+=26);var L=this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=q),I=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(e,I?mxResources.get("allPages"):"",I,!I,null,"jpeg"!=q);F.style.marginLeft="24px";F.style.marginBottom="16px";I||(F.style.visibility="hidden");mxEvent.addListener(L,"change",function(){L.checked&&I?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});k&&I||F.setAttribute("disabled","disabled");a=new CustomDialog(this,
e,mxUtils.bind(this,function(){this.lastExportBorder=p.value;this.lastExportZoom=n.value;f(n.value,t.checked,!z.checked,A.checked,L.checked,E.checked,p.value,y.checked,!F.checked)}),null,c,d);this.showDialog(a.container,320,l,!0,!0);n.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,c,d,f){var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=this.editor.graph;
if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(g)}var l=this.addCheckbox(e,mxResources.get("fit"),!0),m=this.addCheckbox(e,mxResources.get("shadow"),h.shadowVisible&&d,!d),n=this.addCheckbox(e,c),k=this.addCheckbox(e,mxResources.get("lightbox"),!0),B=this.addEditButton(e,k),C=B.getEditInput(),D=1<h.model.getChildCount(h.model.getRoot()),z=this.addCheckbox(e,mxResources.get("layers"),D,
!D);z.style.marginLeft=C.style.marginLeft;z.style.marginBottom="12px";z.style.marginTop="8px";mxEvent.addListener(k,"change",function(){k.checked?(D&&z.removeAttribute("disabled"),C.removeAttribute("disabled")):(z.setAttribute("disabled","disabled"),C.setAttribute("disabled","disabled"));C.checked&&k.checked?B.getEditSelect().removeAttribute("disabled"):B.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){a(l.checked,m.checked,n.checked,k.checked,
B.getLink(),z.checked)}),null,mxResources.get("embed"),f);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,c,d,f,g,k,q){function e(b){var e=" ",l="";d&&(e=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));b=!0;if(EditorUi.enableLogging&&!this.isOffline()&&null!=a.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",a.getMode())}catch(m){}if(this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(m){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(m){}}catch(m){null!=window.console&&console.log("error in fileLoaded:",a,m);if(EditorUi.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=m&&null!=m.message?":err:"+encodeURIComponent(m.message):"")+(null!=m&&null!=m.stack?"&stack="+encodeURIComponent(m.stack):"")}catch(p){}this.handleError(m,
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=c?c.constructor==DriveFile?this.loadFile(c.getHash()):this.fileLoaded(c):e()}))}else e();return b};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,c,d,f,g,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==
this.scratchpad?this.getLocalData(".scratchpad",mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(a){var b=mxUtils.createXmlDocument(),c=b.createElement("mxlibrary");mxUtils.setTextContent(c,JSON.stringify(a));b.appendChild(c);return mxUtils.getXml(b)};EditorUi.prototype.closeLibrary=function(a){null!=a&&(this.removeLibrarySidebar(a.getHash()),
a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var b=this.sidebar.palettes[a];if(null!=b){for(var c=0;c<b.length;c++)b[c].parentNode.removeChild(b[c]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var b=this.sidebar.container;if(null==a){var c=this.sidebar.palettes["L.scratchpad"];null==c&&(c=this.sidebar.palettes.search);null!=c&&(a=c[c.length-
1].nextSibling)}a=null!=a?a:b.firstChild.nextSibling.nextSibling;var c=b.lastChild,e=c.previousSibling;b.insertBefore(c,a);b.insertBefore(e,c)};EditorUi.prototype.loadLibrary=function(a){var b=mxUtils.parseXml(a.getData());if("mxlibrary"==b.documentElement.nodeName){var c=JSON.parse(mxUtils.getTextContent(b.documentElement));this.libraryLoaded(a,c,b.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};
EditorUi.prototype.libraryLoaded=function(a,b,c){a.constructor!=LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var d=this.sidebar.palettes[a.getHash()],d=null!=d?d[d.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var e=null,h=mxUtils.bind(this,function(b,c){if(0==b.length&&a.isEditable())null==e&&(e=document.createElement("div"),mxUtils.setPrefixedStyle(e.style,"borderRadius","6px"),e.style.border="3px dotted lightGray",e.style.textAlign=
"center",e.style.padding="8px",e.style.color="#B3B3B3",mxUtils.write(e,mxResources.get("dragElementsHere"))),c.appendChild(e);else for(var d=0;d<b.length;d++){var h=b[d],f=h.data;if(null!=f){var f=this.convertDataUri(f),g="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==h.aspect&&(g+="aspect=fixed;");c.appendChild(this.sidebar.createVertexTemplate(g+"image="+f,h.w,h.h,"",h.title||"",!1,!1,!1))}else null!=h.xml&&(f=this.stringToCells(this.editor.graph.decompress(h.xml)),
0<f.length&&c.appendChild(this.sidebar.createVertexTemplateFromCells(f,h.w,h.h,h.title||"",!0,!1,!1)))}});c=null!=c&&0<c.length?c:a.getTitle();var f=this.sidebar.addPalette(a.getHash(),c,!0,mxUtils.bind(this,function(a){h(b,a)}));this.repositionLibrary(d);var g=f.parentNode.previousSibling;c=g.getAttribute("title");null!=c&&0<c.length&&".scratchpad"!=a.title&&g.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+c);var l=document.createElement("div");l.style.position="absolute";l.style.right=
"0px";l.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(l.style.backgroundColor="inherit");g.style.position="relative";var u=document.createElement("img");u.setAttribute("src",Dialog.prototype.closeImage);u.setAttribute("title",mxResources.get("close"));u.setAttribute("align","top");u.setAttribute("border","0");u.className="geButton";u.style.marginRight="1px";u.style.marginTop="-1px";l.appendChild(u);var k=null;mxEvent.addListener(u,"click",mxUtils.bind(this,function(b){if(!mxEvent.isConsumed(b)){var c=
mxUtils.bind(this,function(){this.closeLibrary(a)});null!=k?this.confirm(mxResources.get("allChangesLost"),null,c,mxResources.get("cancel"),mxResources.get("discardChanges")):c();mxEvent.consume(b)}}));mxEvent.addListener(f,"mousemove",mxUtils.bind(this,function(a){mxEvent.getSource(a)==f?f.setAttribute("title",mxResources.get("libraryTooltip")):f.removeAttribute("title")}));if(a.isEditable()){var v=this.editor.graph,B=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),f,b,a,a.getMode());
mxEvent.consume(c)}),C=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=y&&null!=y.parentNode&&y.parentNode.removeChild(y),y=u.cloneNode(!1),y.setAttribute("src",Editor.spinImage),y.setAttribute("title",mxResources.get("saving")),y.style.cursor="default",y.style.marginRight="2px",y.style.marginTop="-2px",l.insertBefore(y,l.firstChild),g.style.paddingRight=18*l.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=y&&null!=y.parentNode&&(y.parentNode.removeChild(y),
g.style.paddingRight=18*l.childNodes.length+"px")})):null==k&&(k=u.cloneNode(!1),k.setAttribute("src",IMAGE_PATH+"/download.png"),k.setAttribute("title",mxResources.get("save")),l.insertBefore(k,l.firstChild),mxEvent.addListener(k,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==k||a.isModified()||(g.style.paddingRight=18*l.childNodes.length+"px",k.parentNode.removeChild(k),k=null)});mxEvent.consume(c)})),g.style.paddingRight=
18*l.childNodes.length+"px")}),D=mxUtils.bind(this,function(a,c,d,h){a=v.cloneCells(mxUtils.sortCells(v.model.getTopmostCells(a)));for(var g=0;g<a.length;g++){var l=v.getCellGeometry(a[g]);null!=l&&l.translate(-c.x,-c.y)}f.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,h||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=h&&(a.title=h);b.push(a);C(d);null!=e&&null!=e.parentNode&&0<b.length&&(e.parentNode.removeChild(e),
e=null)}),z=mxUtils.bind(this,function(a){if(v.isSelectionEmpty())v.getRubberband().isActive()?(v.getRubberband().execute(a),v.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var b=v.getSelectionCells(),c=v.view.getBounds(b),e=v.view.scale;c.x/=e;c.y/=e;c.width/=e;c.height/=e;c.x-=v.view.translate.x;c.y-=v.view.translate.y;D(b,c)}mxEvent.consume(a)});f.style.border="3px solid transparent";mxEvent.addGestureListeners(f,
function(){},mxUtils.bind(this,function(a){v.isMouseDown&&null!=v.panningManager&&null!=v.graphHandler.shape&&(v.graphHandler.shape.node.style.visibility="hidden",null!=e?e.style.border="3px dotted rgb(254, 137, 12)":f.style.border="3px dotted rgb(254, 137, 12)",f.style.cursor="copy",v.panningManager.stop(),v.autoScroll=!1,null!=v.graphHandler.guide&&v.graphHandler.guide.setVisible(!1),null!=v.graphHandler.hint&&(v.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,
function(a){v.isMouseDown&&null!=v.panningManager&&null!=v.graphHandler&&(f.style.border="3px solid transparent",null!=e&&(e.style.border="3px dotted lightGray"),f.style.cursor="default",this.sidebar.showTooltips=!0,v.panningManager.stop(),v.graphHandler.reset(),v.isMouseDown=!1,v.autoScroll=!0,z(a),mxEvent.consume(a))}));mxEvent.addListener(f,"mouseleave",mxUtils.bind(this,function(a){v.isMouseDown&&null!=v.graphHandler.shape&&(v.graphHandler.shape.node.style.visibility="visible",f.style.border=
"3px solid transparent",f.style.cursor="",v.autoScroll=!0,null!=v.graphHandler.guide&&v.graphHandler.guide.setVisible(!0),null!=v.graphHandler.hint&&(v.graphHandler.hint.style.visibility="visible"),null!=e&&(e.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(f,"dragover",mxUtils.bind(this,function(a){null!=e?e.style.border="3px dotted rgb(254, 137, 12)":f.style.border="3px dotted rgb(254, 137, 12)";a.dataTransfer.dropEffect="copy";f.style.cursor="copy";this.sidebar.hideTooltip();
a.stopPropagation();a.preventDefault()})),mxEvent.addListener(f,"drop",mxUtils.bind(this,function(a){f.style.border="3px solid transparent";f.style.cursor="";null!=e&&(e.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,g,l,m,n,u,k,w){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",
new mxGeometry(0,0,m,n),c)],c[0].vertex=!0,D(c,new mxRectangle(0,0,m,n),a,mxEvent.isAltDown(a)?null:u.substring(0,u.lastIndexOf(".")).replace(/_/g," ")),null!=e&&null!=e.parentNode&&0<b.length&&(e.parentNode.removeChild(e),e=null);else{var p=!1,v=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var g=mxUtils.parseXml(c);if("mxlibrary"==g.documentElement.nodeName)try{var l=JSON.parse(mxUtils.getTextContent(g.documentElement));h(l,f);b=b.concat(l);C(a);this.spinner.stop();p=!0}catch(V){}else if("mxfile"==
g.documentElement.nodeName)try{for(var m=g.documentElement.getElementsByTagName("diagram"),g=0;g<m.length;g++){var l=mxUtils.getTextContent(m[g]),n=this.stringToCells(this.editor.graph.decompress(l)),u=this.editor.graph.getBoundingBoxFromGeometry(n);D(n,new mxRectangle(0,0,u.width,u.height),a)}p=!0}catch(V){null!=window.console&&console.log("error in drop handler:",V)}}p||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=e&&null!=e.parentNode&&0<b.length&&
(e.parentNode.removeChild(e),e=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,u)&&null!=w?this.parseFile(w,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?v(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):v(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(f,"dragleave",function(a){null!=
e?e.style.border="3px dotted lightGray":(f.style.border="3px solid transparent",f.style.cursor="");a.stopPropagation();a.preventDefault()}));u=u.cloneNode(!1);u.setAttribute("src",IMAGE_PATH+"/edit.gif");u.setAttribute("title",mxResources.get("edit"));l.insertBefore(u,l.firstChild);mxEvent.addListener(u,"click",B);mxEvent.addListener(f,"dblclick",function(a){mxEvent.getSource(a)==f&&B(a)});u=u.cloneNode(!1);u.setAttribute("src",Editor.plusImage);u.setAttribute("title",mxResources.get("add"));l.insertBefore(u,
l.firstChild);this.isOffline()||".scratchpad"!=a.title||(c=document.createElement("span"),c.setAttribute("title",mxResources.get("help")),c.style.cssText="color:gray;text-decoration:none;",c.className="geButton",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,mxUtils.bind(this,function(a){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(a)})),l.insertBefore(c,l.firstChild));var y=null;mxEvent.addListener(u,"click",z)}g.appendChild(l);g.style.paddingRight=
18*l.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=
46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",
Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position="relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.prototype.hideFooter=function(){var a=document.getElementById("geFooter");null!=a&&(this.footerHeight=0,a.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=
function(a,b,c,d,f){a=new ImageDialog(this,a,b,c,d,f);this.showDialog(a.container,Graph.fileSupport?440:360,Graph.fileSupport?200:90,!0,!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var b=new BackgroundImageDialog(this,mxUtils.bind(this,function(b){a(b)}));this.showDialog(b.container,360,200,!0,!0);b.init()};EditorUi.prototype.showLibraryDialog=
function(a,b,c,d,f){a=new LibraryDialog(this,a,b,c,d,f);this.showDialog(a.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer");a.style.position="absolute";a.style.overflow="hidden";a.style.borderWidth="3px";var b=document.createElement("a");b.setAttribute("href","javascript:void(0);");b.className="geTitle";b.style.height=
"100%";b.style.paddingTop="9px";mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,"click",mxUtils.bind(this,function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,c){var d=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},e=null!=a&&null!=a.error?a.error:a;if(null!=e||null!=b){a=mxUtils.htmlEntities(mxResources.get("unknownError"));var h=mxResources.get("ok"),
f=null;b=null!=b?b:mxResources.get("error");if(null!=e)if(null!=e.retry&&(h=mxResources.get("cancel"),f=function(){d();e.retry()}),"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&e.type==gapi.drive.realtime.ErrorType.FORBIDDEN)a=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==e.code||404==e.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&e.type==gapi.drive.realtime.ErrorType.NOT_FOUND){a=
mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var g=window.location.hash;null!=g&&"#G"==g.substring(0,2)&&(g=g.substring(2),a+=' <a href="https://drive.google.com/open?id='+g+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else e.code==App.ERROR_TIMEOUT?a=mxUtils.htmlEntities(mxResources.get("timeout")):e.code==App.ERROR_BUSY?a=mxUtils.htmlEntities(mxResources.get("busy")):null!=e.message?a=mxUtils.htmlEntities(e.message):null!=e.response&&
null!=e.response.error&&(a=mxUtils.htmlEntities(e.response.error));this.showError(b,a,h,c,f)}else null!=c&&c()};EditorUi.prototype.showError=function(a,b,c,d,f,g,k){a=new ErrorDialog(this,a,b,c,d,f,g,k);this.showDialog(a.container,340,150,!0,!1);a.init()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,c,d,f){var e=null!=this.spinner&&null!=this.spinner.pause?
this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,a,function(){e();null!=b&&b()},function(){e();null!=c&&c()},d,f)).container,340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(a){this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var a=this.editor.graph.getModel();return 1==a.getChildCount(a.root)&&0==a.getChildCount(a.getChildAt(a.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||
!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=function(a,b,c){var d=a.toDataURL("image/"+c);if(6>=d.length||d==a.cloneNode(!1).toDataURL("image/"+c))throw{message:"Invalid image"};null!=b&&(d=this.writeGraphModelToPng(d,"zTXt","mxGraphModel",atob(this.editor.graph.compress(b))));return d};EditorUi.prototype.saveCanvas=function(a,
b,c){var d="jpeg"==c?"jpg":c,e=this.getBaseFilename()+"."+d;a=this.createImageDataUri(a,b,c);this.saveData(e,d,a.substring(a.lastIndexOf(",")+1),"image/"+c,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(a,
b,c,d,f){if(window.Blob&&navigator.msSaveOrOpenBlob)a=d?this.base64ToBlob(a,c):new Blob([a],{type:c}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)c=window.open("about:blank","_blank"),null==c?mxUtils.popup(a,!0):(c.document.write(a),c.document.close(),c.document.execCommand("SaveAs",!0,b),c.close());else if(mxClient.IS_IOS)b=new TextareaDialog(this,b+":",a,null,null,mxResources.get("close")),b.textarea.style.width="600px",b.textarea.style.height="380px",this.showDialog(b.container,620,
460,!0,!0),b.init(),document.execCommand("selectall",!1,null);else{var e=document.createElement("a"),h=!mxClient.IS_SF&&"undefined"!==typeof e.download;if(h||this.isOffline()){e.href=URL.createObjectURL(d?this.base64ToBlob(a,c):new Blob([a],{type:c}));h?e.download=b:e.setAttribute("target","_blank");document.body.appendChild(e);try{window.setTimeout(function(){URL.revokeObjectURL(e.href)},0),e.click(),e.parentNode.removeChild(e)}catch(q){}}else this.createEchoRequest(a,b,c,d,f).simulate(document,
"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,c,d,f,g){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=c?"&mime="+c:"")+(null!=f?"&format="+f:"")+(null!=g?"&base64="+g:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(d?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,e=Math.ceil(d/1024),f=Array(e),h=0;h<e;++h){for(var g=1024*h,k=Math.min(g+1024,d),u=Array(k-g),w=0;g<k;++w,++g)u[w]=c[g].charCodeAt(0);f[h]=
new Uint8Array(u)}return new Blob(f,{type:b})};EditorUi.prototype.saveLocalFile=function(a,b,c,d,f,g){g=null!=g?g:!1;var e="vsdx"!=f&&(!mxClient.IS_IOS||!navigator.standalone);f=this.getServiceCount(g);b=new CreateDialog(this,b,mxUtils.bind(this,function(b,e){try{if("_blank"==e)if(null==c||"image/"!=c.substring(0,6)||"image/svg"==c.substring(0,9)&&!mxClient.IS_SVG)f=window.open("about:blank"),null==f?mxUtils.popup(a,!0):(f.document.write(mxUtils.htmlEntities(a,!1)),f.document.close());else if(mxClient.IS_EDGE||
11==document.documentMode||10==document.documentMode){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write('<html><img src="data:'+c+(d?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))+'"/></html>'),f.document.close())}else f=window.open("data:"+c+(d?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null==f&&mxUtils.popup(a,!0);else e==App.MODE_DEVICE?this.doSaveLocalFile(a,b,c,d):null!=b&&0<b.length&&this.pickFolder(e,mxUtils.bind(this,function(f){try{this.exportFile(a,
b,c,d,e,f)}catch(v){this.handleError(v)}}))}catch(w){this.handleError(w)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,g,e,null,null,4<f?3:4,a,c,d);this.showDialog(b.container,380,4<f?390:270,!0,!0);b.init()};EditorUi.prototype.saveData=function(a,b,c,d,f){this.isLocalFileSave()?this.saveLocalFile(c,a,d,f,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,e){return this.createEchoRequest(c,a,d,f,b,e)}),c,f,d)};EditorUi.prototype.saveRequest=
function(a,b,c,d,f,g){var e=!mxClient.IS_IOS||!navigator.standalone,h=this.getServiceCount(!1);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,e){if("_blank"==e||null!=a&&0<a.length){var f=c("_blank"==e?null:a,e==App.MODE_DEVICE||null==e||"_blank"==e?"0":"1");null!=f&&(e==App.MODE_DEVICE||"_blank"==e?f.simulate(document,"_blank"):this.pickFolder(e,mxUtils.bind(this,function(c){g=null!=g?g:"pdf"==b?"application/pdf":"image/"+b;if(null!=d)try{this.exportFile(d,a,g,!0,e,c)}catch(B){this.handleError(B)}else this.spinner.spin(document.body,
mxResources.get("saving"))&&f.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=f.getStatus()&&299>=f.getStatus())try{this.exportFile(f.getText(),a,g,!0,e,c)}catch(B){this.handleError(B)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,e,null,null,4<h?3:4,d,g,f);this.showDialog(a.container,380,4<h?
390:270,!0,!0);a.init()};EditorUi.prototype.exportFile=function(a,b,c,d,f,g){};EditorUi.prototype.pickFolder=function(a,b,c){b(null)};EditorUi.prototype.exportSvg=function(a,b,c,d,f,g,k,q,x){if(this.spinner.spin(document.body,mxResources.get("export"))){var e=this.editor.graph.isSelectionEmpty();c=null!=c?c:e;e=b?null:this.editor.graph.background;e==mxConstants.NONE&&(e=null);null==e&&0==b&&(e="#ffffff");var h=this.editor.graph.getSvg(e,a,k,q,null,c);d&&this.editor.graph.addSvgShadow(h);var l=this.getBaseFilename()+
".svg",m=mxUtils.bind(this,function(a){this.spinner.stop();f&&a.setAttribute("content",this.getFileData(!0,null,null,null,c,x));var b='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a);this.isLocalFileSave()||b.length<=MAX_REQUEST_SIZE?this.saveData(l,"svg",b,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(b)}))});this.convertMath(this.editor.graph,
h,!1,mxUtils.bind(this,function(){g?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(h,m,this.thumbImageCache)):m(h)}))}};EditorUi.prototype.addCheckbox=function(a,b,c,d,f,g){g=null!=g?g:!0;var e=document.createElement("input");e.style.marginRight="8px";e.style.marginTop="16px";e.setAttribute("type","checkbox");c&&(e.setAttribute("checked","checked"),e.defaultChecked=!0);d&&e.setAttribute("disabled","disabled");g&&(a.appendChild(e),mxUtils.write(a,b),f||mxUtils.br(a));return e};
EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),e="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER&&(e=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));
f.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");f.appendChild(d);a.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,function(){if("custom"==f.value){var a=new FilenameDialog(this,e,mxResources.get("ok"),function(a){null!=a?e=a:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",
mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":e:null},getEditInput:function(){return c},getEditSelect:function(){return f}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){h.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+
f:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value",
"blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&(e=document.createElement("option"),e.setAttribute("value","frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",h=null,h=mxUtils.button("",
mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();h.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";h.style.marginLeft="4px";h.style.height="22px";h.style.width="22px";h.style.position="relative";h.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";h.className="geColorBtn";a.appendChild(h);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=
function(a,b,c,d,f,g,k,q){var e=this.getCurrentFile(),h=[];d&&(h.push("lightbox=1"),"auto"!=a&&h.push("target="+a),null!=b&&b!=mxConstants.NONE&&h.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=f&&0<f.length&&h.push("edit="+encodeURIComponent(f)),g&&h.push("layers=1"),this.editor.graph.foldingEnabled&&h.push("nav=1"));if(c&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&h.push("page="+a);break}a=!0;null!=k?c="#U"+encodeURIComponent(k):
(e=this.getCurrentFile(),q||null==e||e.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(c="#"+e.getHash(),a=!1));a&&null!=e&&null!=e.getTitle()&&e.getTitle()!=this.defaultFilename&&h.push("title="+encodeURIComponent(e.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<h.length?"?"+h.join("&"):"")+
c};EditorUi.prototype.createHtml=function(a,b,c,d,f,g,k,q,x,u,w){var e=this.getBasenames(),h={};""!=f&&f!=mxConstants.NONE&&(h.highlight=f);"auto"!==d&&(h.target=d);x||(h.lightbox=!1);h.nav=this.editor.graph.foldingEnabled;c=parseInt(c);isNaN(c)||100==c||(h.zoom=c/100);c=[];k&&(c.push("pages"),h.resize=!0,null!=this.pages&&null!=this.currentPage&&(h.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(c.push("zoom"),h.resize=!0);q&&c.push("layers");0<c.length&&(x&&c.push("lightbox"),h.toolbar=
c.join(" "));null!=u&&0<u.length&&(h.edit=u);null!=a?h.url=a:h.xml=this.getFileData(!0,null,null,null,null,!k);b='<div class="mxgraph" style="'+(g?"max-width:100%;":"")+(""!=c?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(h))+'"></div>';e=0<e.length?"s="+e.join(";"):"";a=null!=a?"fetch="+encodeURIComponent(a):"";w(b,'<script type="text/javascript" src="'+(0<e.length||0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+e:"https://www.draw.io/embed2.js?"+
e)+"&"+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(f);var h=document.createElement("div");h.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";
var g=document.createElement("input");g.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";g.setAttribute("value","url");g.setAttribute("type","radio");g.setAttribute("name","type-embedhtmldialog");f=g.cloneNode(!0);f.setAttribute("value","copy");h.appendChild(f);var l=document.createElement("span");mxUtils.write(l,mxResources.get("includeCopyOfMyDiagram"));h.appendChild(l);mxUtils.br(h);h.appendChild(g);l=document.createElement("span");mxUtils.write(l,mxResources.get("publicDiagramUrl"));
h.appendChild(l);var n=this.getCurrentFile();null==c&&null!=n&&n.constructor==window.DriveFile&&(l=document.createElement("a"),l.style.paddingLeft="12px",l.style.color="gray",l.setAttribute("href","javascript:void(0);"),mxUtils.write(l,mxResources.get("share")),h.appendChild(l),mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(n.getId())})));f.setAttribute("checked","checked");null==c&&g.setAttribute("disabled","disabled");e.appendChild(h);var k=
this.addLinkSection(e),v=this.addCheckbox(e,mxResources.get("zoom"),!0,null,!0);mxUtils.write(e,":");var B=document.createElement("input");B.setAttribute("type","text");B.style.marginRight="16px";B.style.width="60px";B.style.marginLeft="4px";B.style.marginRight="12px";B.value="100%";e.appendChild(B);var C=this.addCheckbox(e,mxResources.get("fit"),!0),h=null!=this.pages&&1<this.pages.length,D=D=this.addCheckbox(e,mxResources.get("allPages"),h,!h),z=this.addCheckbox(e,mxResources.get("layers"),!0),
y=this.addCheckbox(e,mxResources.get("lightbox"),!0),A=this.addEditButton(e,y),E=A.getEditInput();E.style.marginBottom="16px";mxEvent.addListener(y,"change",function(){y.checked?E.removeAttribute("disabled"):E.setAttribute("disabled","disabled");E.checked&&y.checked?A.getEditSelect().removeAttribute("disabled"):A.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){d(g.checked?c:null,v.checked,B.value,k.getTarget(),k.getColor(),C.checked,D.checked,
z.checked,y.checked,A.getLink())}),null,a,b);this.showDialog(a.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,c,d,f,g){var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=document.createElement("h3");mxUtils.write(h,a||mxResources.get("link"));h.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(h);var l=this.getCurrentFile(),h="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=
l&&l.constructor==window.DriveFile&&!b){a=80;var h="https://desk.draw.io/support/solutions/articles/16000039384",m=document.createElement("div");m.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var n=document.createElement("div");n.style.whiteSpace="normal";mxUtils.write(n,mxResources.get("linkAccountRequired"));m.appendChild(n);n=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(l.getId())}));
n.style.marginTop="12px";n.className="geBtn";m.appendChild(n);e.appendChild(m);n=document.createElement("a");n.style.paddingLeft="12px";n.style.color="gray";n.style.fontSize="11px";n.setAttribute("href","javascript:void(0);");mxUtils.write(n,mxResources.get("check"));m.appendChild(n);mxEvent.addListener(n,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,
null,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var k=null,p=null;if(null!=c||null!=d)a+=30,mxUtils.write(e,mxResources.get("width")+":"),k=document.createElement("input"),k.setAttribute("type","text"),k.style.marginRight="16px",k.style.width="50px",k.style.marginLeft="6px",k.style.marginRight="16px",k.style.marginBottom="10px",k.value="100%",e.appendChild(k),mxUtils.write(e,mxResources.get("height")+
":"),p=document.createElement("input"),p.setAttribute("type","text"),p.style.width="50px",p.style.marginLeft="6px",p.style.marginBottom="10px",p.value=d+"px",e.appendChild(p),mxUtils.br(e);var C=this.addLinkSection(e,g);c=null!=this.pages&&1<this.pages.length;var D=null;if(null==l||l.constructor!=window.DriveFile||b)D=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var z=this.addCheckbox(e,mxResources.get("lightbox"),!0),y=this.addEditButton(e,z),A=y.getEditInput(),E=this.addCheckbox(e,mxResources.get("layers"),
!0);E.style.marginLeft=A.style.marginLeft;E.style.marginBottom="16px";E.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(E.removeAttribute("disabled"),A.removeAttribute("disabled")):(E.setAttribute("disabled","disabled"),A.setAttribute("disabled","disabled"));A.checked&&z.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){f(C.getTarget(),C.getColor(),null==D?
!0:D.checked,z.checked,y.getLink(),E.checked,null!=k?k.value:null,null!=p?p.value:null)}),null,mxResources.get("create"),h);this.showDialog(b.container,340,246+a,!0,!0);null!=k?(k.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?k.select():document.execCommand("selectAll",!1,null)):C.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));
f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var h=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),g=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),!0);null!=g&&(g.style.marginBottom="16px");a=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!h.checked,null!=g?g.checked:!1)}),null,a,b);this.showDialog(a.container,300,d?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(a,
b,c,d,f,g,k,q){k=null!=k?k:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=this.editor.graph,l="jpeg"==q?170:280,m=document.createElement("h3");mxUtils.write(m,a);m.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";e.appendChild(m);mxUtils.write(e,mxResources.get("zoom")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.style.marginRight="12px";n.value=
this.lastExportZoom||"100%";e.appendChild(n);mxUtils.write(e,mxResources.get("borderWidth")+":");var p=document.createElement("input");p.setAttribute("type","text");p.style.marginRight="16px";p.style.width="60px";p.style.marginLeft="4px";p.value=this.lastExportBorder||"0";e.appendChild(p);mxUtils.br(e);var t=this.addCheckbox(e,mxResources.get("transparentBackground"),h.background==mxConstants.NONE||null==h.background,null,null,"jpeg"!=q),z=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,h.isSelectionEmpty()),
y=document.createElement("input");y.style.marginTop="16px";y.style.marginRight="8px";y.style.marginLeft="24px";y.setAttribute("disabled","disabled");y.setAttribute("type","checkbox");g&&(e.appendChild(y),mxUtils.write(e,mxResources.get("crop")),mxUtils.br(e),l+=26,mxEvent.addListener(z,"change",function(){z.checked?y.removeAttribute("disabled"):y.setAttribute("disabled","disabled")}));h.isSelectionEmpty()||(y.setAttribute("checked","checked"),y.defaultChecked=!0);var A=this.addCheckbox(e,mxResources.get("shadow"),
h.shadowVisible),E=document.createElement("input");E.style.marginTop="16px";E.style.marginRight="8px";E.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||E.setAttribute("disabled","disabled");b&&(e.appendChild(E),mxUtils.write(e,mxResources.get("embedImages")),mxUtils.br(e),l+=26);var L=this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=q),I=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(e,I?mxResources.get("allPages"):"",I,!I,null,"jpeg"!=
q);F.style.marginLeft="24px";F.style.marginBottom="16px";I||(F.style.visibility="hidden");mxEvent.addListener(L,"change",function(){L.checked&&I?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});k&&I||F.setAttribute("disabled","disabled");a=new CustomDialog(this,e,mxUtils.bind(this,function(){this.lastExportBorder=p.value;this.lastExportZoom=n.value;f(n.value,t.checked,!z.checked,A.checked,L.checked,E.checked,p.value,y.checked,!F.checked)}),null,c,d);this.showDialog(a.container,
320,l,!0,!0);n.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,c,d,f){var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=this.editor.graph;if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(g)}var l=this.addCheckbox(e,mxResources.get("fit"),!0),
m=this.addCheckbox(e,mxResources.get("shadow"),h.shadowVisible&&d,!d),n=this.addCheckbox(e,c),k=this.addCheckbox(e,mxResources.get("lightbox"),!0),B=this.addEditButton(e,k),C=B.getEditInput(),D=1<h.model.getChildCount(h.model.getRoot()),z=this.addCheckbox(e,mxResources.get("layers"),D,!D);z.style.marginLeft=C.style.marginLeft;z.style.marginBottom="12px";z.style.marginTop="8px";mxEvent.addListener(k,"change",function(){k.checked?(D&&z.removeAttribute("disabled"),C.removeAttribute("disabled")):(z.setAttribute("disabled",
"disabled"),C.setAttribute("disabled","disabled"));C.checked&&k.checked?B.getEditSelect().removeAttribute("disabled"):B.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){a(l.checked,m.checked,n.checked,k.checked,B.getLink(),z.checked)}),null,mxResources.get("embed"),f);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,c,d,f,g,k,q){function e(b){var e=" ",l="";d&&(e=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
(f?"&edit=_blank":"")+(g?"&layers=1":"")+"');}})(this);\"",l+="cursor:pointer;");a&&(l+="max-width:100%;");var m="";c&&(m=' width="'+Math.round(h.width)+'" height="'+Math.round(h.height)+'"');k('<img src="'+b+'"'+m+(""!=l?' style="'+l+'"':"")+e+"/>")}var h=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(a){var b=d?this.getFileData(!0):null;a=this.createImageDataUri(a,b,"png");e(a)}),null,null,null,mxUtils.bind(this,function(a){q({message:mxResources.get("unknownError")})}),
null,!0,c?2:1,null,b);else if(b=this.getFileData(!0),h.width*h.height<=MAX_AREA&&b.length<=MAX_REQUEST_SIZE){var l="";c&&(l="&w="+Math.round(2*h.width)+"&h="+Math.round(2*h.height));var m=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(d?"1":"0")+l+"&xml="+encodeURIComponent(b));m.send(mxUtils.bind(this,function(){200<=m.getStatus()&&299>=m.getStatus()?e("data:image/png;base64,"+m.getText()):q({message:mxResources.get("unknownError")})}))}else q({message:mxResources.get("drawingTooLarge")})};
EditorUi.prototype.createEmbedSvg=function(a,b,c,d,f,g,k){var e=this.editor.graph.getSvg(),h=e.getElementsByTagName("a");if(null!=h)for(var l=0;l<h.length;l++){var m=h[l].getAttribute("href");null!=m&&"#"==m.charAt(0)&&"_blank"==h[l].getAttribute("target")&&h[l].removeAttribute("target")}d&&e.setAttribute("content",this.getFileData(!0));b&&this.editor.graph.addSvgShadow(e);if(c){var n=" ",p="";d&&(n="onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+

View file

@ -2661,84 +2661,84 @@ mxUtils.getXml(a))})))}else f=c+".svg",m=this.getFileData(!1,!0,null,mxUtils.bin
0;g<this.pages.length;g++)if(this.pages[g]==this.currentPage){f="&from="+g;break}return new mxXmlRequest(EXPORT_URL,"format="+b+f+"&base64="+e+"&embedXml="+c+"&xml="+encodeURIComponent(d)+(null!=a?"&filename="+encodeURIComponent(a):""))};EditorUi.prototype.setMode=function(a,b){this.mode=a};EditorUi.prototype.fileLoaded=function(a){var c=!1;this.hideDialog();var b=this.getCurrentFile();this.setCurrentFile(null);null!=b&&(b.removeListener(this.descriptorChangedListener),b.close());this.editor.graph.model.clear();
this.editor.undoManager.clear();var d=mxUtils.bind(this,function(){this.setGraphEnabled(!1);this.setCurrentFile(null);null!=b&&this.updateDocumentTitle();this.editor.graph.model.clear();this.editor.undoManager.clear();null!=window.location.hash&&0<window.location.hash.length&&(window.location.hash="");null!=this.fname&&(this.fnameWrapper.style.display="none",this.fname.innerHTML="",this.fname.setAttribute("title",mxResources.get("rename")));this.updateUi();this.showSplash()});if(null!=a)try{this.setCurrentFile(a);
a.addListener("descriptorChanged",this.descriptorChangedListener);a.addListener("contentChanged",this.descriptorChangedListener);this.descriptorChanged();a.open();this.setGraphEnabled(!0);this.setMode(a.getMode());this.editor.undoManager.clear();this.updateUi();null==a.realtime&&(a.isEditable()?this.editor.setStatus(""):this.editor.setStatus(mxUtils.htmlEntities(mxResources.get("readOnly"))));this.editor.chromeless?this.editor.graph.lightbox&&this.lightboxFit():(this.editor.graph.selectUnlockedLayer(),
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));c=!0;if(this.enableLogging&&!this.isOffline()&&null!=a.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",a.getMode())}catch(h){}if(this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(h){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(h){}}catch(h){null!=window.console&&console.log("error in fileLoaded:",a,h);if(this.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=h&&null!=h.message?":err:"+encodeURIComponent(h.message):"")+(null!=h&&null!=h.stack?"&stack="+encodeURIComponent(h.stack):"")}catch(q){}this.handleError(h,mxResources.get("errorLoadingFile"),
mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=b?b.constructor==DriveFile?this.loadFile(b.getHash()):this.fileLoaded(b):d()}))}else d();return c};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,d,e,h,q,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==this.scratchpad?this.getLocalData(".scratchpad",
mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(a){var c=mxUtils.createXmlDocument(),b=c.createElement("mxlibrary");mxUtils.setTextContent(b,JSON.stringify(a));c.appendChild(b);return mxUtils.getXml(c)};EditorUi.prototype.closeLibrary=function(a){null!=a&&(this.removeLibrarySidebar(a.getHash()),a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),
".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var c=this.sidebar.palettes[a];if(null!=c){for(var b=0;b<c.length;b++)c[b].parentNode.removeChild(c[b]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var c=this.sidebar.container;if(null==a){var b=this.sidebar.palettes["L.scratchpad"];null==b&&(b=this.sidebar.palettes.search);null!=b&&(a=b[b.length-1].nextSibling)}a=null!=a?a:c.firstChild.nextSibling.nextSibling;
var b=c.lastChild,d=b.previousSibling;c.insertBefore(b,a);c.insertBefore(d,b)};EditorUi.prototype.loadLibrary=function(a){var c=mxUtils.parseXml(a.getData());if("mxlibrary"==c.documentElement.nodeName){var b=JSON.parse(mxUtils.getTextContent(c.documentElement));this.libraryLoaded(a,b,c.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};EditorUi.prototype.libraryLoaded=function(a,b,d){a.constructor!=
LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var c=this.sidebar.palettes[a.getHash()],c=null!=c?c[c.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var f=null,e=mxUtils.bind(this,function(c,b){if(0==c.length&&a.isEditable())null==f&&(f=document.createElement("div"),mxUtils.setPrefixedStyle(f.style,"borderRadius","6px"),f.style.border="3px dotted lightGray",f.style.textAlign="center",f.style.padding="8px",f.style.color="#B3B3B3",
mxUtils.write(f,mxResources.get("dragElementsHere"))),b.appendChild(f);else for(var d=0;d<c.length;d++){var e=c[d],g=e.data;if(null!=g){var g=this.convertDataUri(g),h="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==e.aspect&&(h+="aspect=fixed;");b.appendChild(this.sidebar.createVertexTemplate(h+"image="+g,e.w,e.h,"",e.title||"",!1,!1,!1))}else null!=e.xml&&(g=this.stringToCells(this.editor.graph.decompress(e.xml)),0<g.length&&b.appendChild(this.sidebar.createVertexTemplateFromCells(g,
e.w,e.h,e.title||"",!0,!1,!1)))}});d=null!=d&&0<d.length?d:a.getTitle();var g=this.sidebar.addPalette(a.getHash(),d,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(c);var p=g.parentNode.previousSibling;d=p.getAttribute("title");null!=d&&0<d.length&&".scratchpad"!=a.title&&p.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+d);var k=document.createElement("div");k.style.position="absolute";k.style.right="0px";k.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(k.style.backgroundColor=
"inherit");p.style.position="relative";var r=document.createElement("img");r.setAttribute("src",Dialog.prototype.closeImage);r.setAttribute("title",mxResources.get("close"));r.setAttribute("align","top");r.setAttribute("border","0");r.className="geButton";r.style.marginRight="1px";r.style.marginTop="-1px";k.appendChild(r);var l=null;mxEvent.addListener(r,"click",mxUtils.bind(this,function(c){if(!mxEvent.isConsumed(c)){var b=mxUtils.bind(this,function(){this.closeLibrary(a)});null!=l?this.confirm(mxResources.get("allChangesLost"),
null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b();mxEvent.consume(c)}}));mxEvent.addListener(g,"mousemove",mxUtils.bind(this,function(a){mxEvent.getSource(a)==g?g.setAttribute("title",mxResources.get("libraryTooltip")):g.removeAttribute("title")}));if(a.isEditable()){var n=this.editor.graph,y=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());mxEvent.consume(c)}),u=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=w&&null!=
w.parentNode&&w.parentNode.removeChild(w),w=r.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",k.insertBefore(w,k.firstChild),p.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),p.style.paddingRight=18*k.childNodes.length+"px")})):null==l&&(l=r.cloneNode(!1),
l.setAttribute("src",IMAGE_PATH+"/download.png"),l.setAttribute("title",mxResources.get("save")),k.insertBefore(l,k.firstChild),mxEvent.addListener(l,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==l||a.isModified()||(p.style.paddingRight=18*k.childNodes.length+"px",l.parentNode.removeChild(l),l=null)});mxEvent.consume(c)})),p.style.paddingRight=18*k.childNodes.length+"px")}),A=mxUtils.bind(this,function(a,c,d,e){a=
n.cloneCells(mxUtils.sortCells(n.model.getTopmostCells(a)));for(var h=0;h<a.length;h++){var m=n.getCellGeometry(a[h]);null!=m&&m.translate(-c.x,-c.y)}g.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=e&&(a.title=e);b.push(a);u(d);null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)}),z=mxUtils.bind(this,function(a){if(n.isSelectionEmpty())n.getRubberband().isActive()?
(n.getRubberband().execute(a),n.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var c=n.getSelectionCells(),b=n.view.getBounds(c),d=n.view.scale;b.x/=d;b.y/=d;b.width/=d;b.height/=d;b.x-=n.view.translate.x;b.y-=n.view.translate.y;A(c,b)}mxEvent.consume(a)});g.style.border="3px solid transparent";mxEvent.addGestureListeners(g,function(){},mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&
(n.graphHandler.shape.node.style.visibility="hidden",null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)",g.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(g.style.border="3px solid transparent",
null!=f&&(f.style.border="3px dotted lightGray"),g.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,z(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",g.style.border="3px solid transparent",g.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),
null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=f&&(f.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(a){null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)";a.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(a){g.style.border=
"3px solid transparent";g.style.cursor="";null!=f&&(f.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,h,m,p,q,r,k,l){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,p,q),c)],c[0].vertex=!0,A(c,new mxRectangle(0,0,p,q),a,mxEvent.isAltDown(a)?null:r.substring(0,
r.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var n=!1,t=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var h=mxUtils.parseXml(c);if("mxlibrary"==h.documentElement.nodeName)try{var m=JSON.parse(mxUtils.getTextContent(h.documentElement));e(m,g);b=b.concat(m);u(a);this.spinner.stop();n=!0}catch(U){}else if("mxfile"==h.documentElement.nodeName)try{for(var p=h.documentElement.getElementsByTagName("diagram"),h=0;h<
p.length;h++){var m=mxUtils.getTextContent(p[h]),q=this.stringToCells(this.editor.graph.decompress(m)),r=this.editor.graph.getBoundingBoxFromGeometry(q);A(q,new mxRectangle(0,0,r.width,r.height),a)}n=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}n||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,
r)&&null!=l?this.parseFile(l,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?t(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):t(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"dragleave",function(a){null!=f?f.style.border="3px dotted lightGray":(g.style.border="3px solid transparent",g.style.cursor="");a.stopPropagation();
a.preventDefault()}));r=r.cloneNode(!1);r.setAttribute("src",IMAGE_PATH+"/edit.gif");r.setAttribute("title",mxResources.get("edit"));k.insertBefore(r,k.firstChild);mxEvent.addListener(r,"click",y);mxEvent.addListener(g,"dblclick",function(a){mxEvent.getSource(a)==g&&y(a)});r=r.cloneNode(!1);r.setAttribute("src",Editor.plusImage);r.setAttribute("title",mxResources.get("add"));k.insertBefore(r,k.firstChild);this.isOffline()||".scratchpad"!=a.title||(d=document.createElement("span"),d.setAttribute("title",
mxResources.get("help")),d.style.cssText="color:gray;text-decoration:none;",d.className="geButton",mxUtils.write(d,"?"),mxEvent.addGestureListeners(d,mxUtils.bind(this,function(a){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(a)})),k.insertBefore(d,k.firstChild));var w=null;mxEvent.addListener(r,"click",z)}p.appendChild(k);p.style.paddingRight=18*k.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==
typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=
2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position=
"relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.prototype.hideFooter=function(){var a=document.getElementById("geFooter");null!=a&&(this.footerHeight=0,a.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=function(a,b,d,e,h){a=new ImageDialog(this,a,b,d,e,h);this.showDialog(a.container,Graph.fileSupport?440:360,Graph.fileSupport?
200:90,!0,!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var c=new BackgroundImageDialog(this,mxUtils.bind(this,function(c){a(c)}));this.showDialog(c.container,360,200,!0,!0);c.init()};EditorUi.prototype.showLibraryDialog=function(a,b,d,e,h){a=new LibraryDialog(this,a,b,d,e,h);this.showDialog(a.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&
null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer");a.style.position="absolute";a.style.overflow="hidden";a.style.borderWidth="3px";var b=document.createElement("a");b.setAttribute("href","javascript:void(0);");b.className="geTitle";b.style.height="100%";b.style.paddingTop="9px";mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,"click",mxUtils.bind(this,
function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,d){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},f=null!=a&&null!=a.error?a.error:a;if(null!=f||null!=b){a=mxUtils.htmlEntities(mxResources.get("unknownError"));var e=mxResources.get("ok"),g=null;b=null!=b?b:mxResources.get("error");if(null!=f)if(null!=f.retry&&(e=mxResources.get("cancel"),g=function(){c();f.retry()}),"undefined"!=
typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.FORBIDDEN)a=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==f.code||404==f.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.NOT_FOUND){a=mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var p=window.location.hash;null!=p&&"#G"==p.substring(0,2)&&(p=p.substring(2),
a+=' <a href="https://drive.google.com/open?id='+p+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else f.code==App.ERROR_TIMEOUT?a=mxUtils.htmlEntities(mxResources.get("timeout")):f.code==App.ERROR_BUSY?a=mxUtils.htmlEntities(mxResources.get("busy")):null!=f.message?a=mxUtils.htmlEntities(f.message):null!=f.response&&null!=f.response.error&&(a=mxUtils.htmlEntities(f.response.error));this.showError(b,a,e,d,g)}else null!=d&&d()};EditorUi.prototype.showError=
function(a,b,d,e,h,q,k){a=new ErrorDialog(this,a,b,d,e,h,q,k);this.showDialog(a.container,340,150,!0,!1);a.init()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,d,e,h){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,a,function(){c();null!=b&&b()},function(){c();null!=d&&d()},e,h)).container,
340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(a){this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var a=this.editor.graph.getModel();return 1==a.getChildCount(a.root)&&0==a.getChildCount(a.getChildAt(a.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+
btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=function(a,b,d){var c=a.toDataURL("image/"+d);if(6>=c.length||c==a.cloneNode(!1).toDataURL("image/"+d))throw{message:"Invalid image"};null!=b&&(c=this.writeGraphModelToPng(c,"zTXt","mxGraphModel",atob(this.editor.graph.compress(b))));return c};EditorUi.prototype.saveCanvas=function(a,b,d){var c="jpeg"==d?"jpg":d,f=this.getBaseFilename()+"."+c;a=this.createImageDataUri(a,b,d);this.saveData(f,c,a.substring(a.lastIndexOf(",")+
1),"image/"+d,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(a,b,d,e,h){if(window.Blob&&navigator.msSaveOrOpenBlob)a=e?this.base64ToBlob(a,d):new Blob([a],{type:d}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)d=
window.open("about:blank","_blank"),null==d?mxUtils.popup(a,!0):(d.document.write(a),d.document.close(),d.document.execCommand("SaveAs",!0,b),d.close());else if(mxClient.IS_IOS)b=new TextareaDialog(this,b+":",a,null,null,mxResources.get("close")),b.textarea.style.width="600px",b.textarea.style.height="380px",this.showDialog(b.container,620,460,!0,!0),b.init(),document.execCommand("selectall",!1,null);else{var c=document.createElement("a"),f=!mxClient.IS_SF&&"undefined"!==typeof c.download;if(f||this.isOffline()){c.href=
URL.createObjectURL(e?this.base64ToBlob(a,d):new Blob([a],{type:d}));f?c.download=b:c.setAttribute("target","_blank");document.body.appendChild(c);try{window.setTimeout(function(){URL.revokeObjectURL(c.href)},0),c.click(),c.parentNode.removeChild(c)}catch(p){}}else this.createEchoRequest(a,b,d,e,h).simulate(document,"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,d,e,h,q){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=d?"&mime="+d:"")+(null!=h?"&format="+h:
"")+(null!=q?"&base64="+q:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(e?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,e=Math.ceil(d/1024),f=Array(e),k=0;k<e;++k){for(var p=1024*k,l=Math.min(p+1024,d),r=Array(l-p),n=0;p<l;++n,++p)r[n]=c[p].charCodeAt(0);f[k]=new Uint8Array(r)}return new Blob(f,{type:b})};EditorUi.prototype.saveLocalFile=function(a,b,d,e,h,q){q=null!=q?q:!1;var c="vsdx"!=h&&(!mxClient.IS_IOS||!navigator.standalone);h=this.getServiceCount(q);
b=new CreateDialog(this,b,mxUtils.bind(this,function(c,b){try{if("_blank"==b)if(null==d||"image/"!=d.substring(0,6)||"image/svg"==d.substring(0,9)&&!mxClient.IS_SVG)f=window.open("about:blank"),null==f?mxUtils.popup(a,!0):(f.document.write(mxUtils.htmlEntities(a,!1)),f.document.close());else if(mxClient.IS_EDGE||11==document.documentMode||10==document.documentMode){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write('<html><img src="data:'+d+(e?";base64,"+a:";charset=utf8,"+
encodeURIComponent(a))+'"/></html>'),f.document.close())}else f=window.open("data:"+d+(e?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null==f&&mxUtils.popup(a,!0);else b==App.MODE_DEVICE?this.doSaveLocalFile(a,c,d,e):null!=c&&0<c.length&&this.pickFolder(b,mxUtils.bind(this,function(f){try{this.exportFile(a,c,d,e,b,f)}catch(x){this.handleError(x)}}))}catch(B){this.handleError(B)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,q,
c,null,null,4<h?3:4,a,d,e);this.showDialog(b.container,380,4<h?390:270,!0,!0);b.init()};EditorUi.prototype.saveData=function(a,b,d,e,h){this.isLocalFileSave()?this.saveLocalFile(d,a,e,h,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,c){return this.createEchoRequest(d,a,e,h,b,c)}),d,h,e)};EditorUi.prototype.saveRequest=function(a,b,d,e,h,q){var c=!mxClient.IS_IOS||!navigator.standalone,f=this.getServiceCount(!1);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,c){if("_blank"==c||null!=
a&&0<a.length){var f=d("_blank"==c?null:a,c==App.MODE_DEVICE||null==c||"_blank"==c?"0":"1");null!=f&&(c==App.MODE_DEVICE||"_blank"==c?f.simulate(document,"_blank"):this.pickFolder(c,mxUtils.bind(this,function(d){q=null!=q?q:"pdf"==b?"application/pdf":"image/"+b;if(null!=e)try{this.exportFile(e,a,q,!0,c,d)}catch(y){this.handleError(y)}else this.spinner.spin(document.body,mxResources.get("saving"))&&f.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=f.getStatus()&&299>=f.getStatus())try{this.exportFile(f.getText(),
a,q,!0,c,d)}catch(y){this.handleError(y)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,c,null,null,4<f?3:4,e,q,h);this.showDialog(a.container,380,4<f?390:270,!0,!0);a.init()};EditorUi.prototype.exportFile=function(a,b,d,e,h,q){};EditorUi.prototype.pickFolder=function(a,b,d){b(null)};EditorUi.prototype.exportSvg=
function(a,b,d,e,h,q,k,p,l){if(this.spinner.spin(document.body,mxResources.get("export"))){var c=this.editor.graph.isSelectionEmpty();d=null!=d?d:c;c=b?null:this.editor.graph.background;c==mxConstants.NONE&&(c=null);null==c&&0==b&&(c="#ffffff");var f=this.editor.graph.getSvg(c,a,k,p,null,d);e&&this.editor.graph.addSvgShadow(f);var g=this.getBaseFilename()+".svg",m=mxUtils.bind(this,function(a){this.spinner.stop();h&&a.setAttribute("content",this.getFileData(!0,null,null,null,d,l));var c='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+
mxUtils.getXml(a);this.isLocalFileSave()||c.length<=MAX_REQUEST_SIZE?this.saveData(g,"svg",c,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(c)}))});this.convertMath(this.editor.graph,f,!1,mxUtils.bind(this,function(){q?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(f,m,this.thumbImageCache)):m(f)}))}};EditorUi.prototype.addCheckbox=function(a,b,d,e,h,q){q=null!=q?q:!0;var c=
document.createElement("input");c.style.marginRight="8px";c.style.marginTop="16px";c.setAttribute("type","checkbox");d&&(c.setAttribute("checked","checked"),c.defaultChecked=!0);e&&c.setAttribute("disabled","disabled");q&&(a.appendChild(c),mxUtils.write(a,b),h||mxUtils.br(a));return c};EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),e="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=
App.MODE_BROWSER&&(e=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));f.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");f.appendChild(d);a.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,
function(){if("custom"==f.value){var a=new FilenameDialog(this,e,mxResources.get("ok"),function(a){null!=a?e=a:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":
e:null},getEditInput:function(){return c},getEditSelect:function(){return f}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){k.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+f:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");
d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&
(e=document.createElement("option"),e.setAttribute("value","frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",k=null,k=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();k.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width=
"22px";k.style.position="relative";k.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,d,e,h,k,l,p){var c=this.getCurrentFile(),f=[];e&&(f.push("lightbox=1"),"auto"!=a&&f.push("target="+a),null!=b&&b!=mxConstants.NONE&&f.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),
null!=h&&0<h.length&&f.push("edit="+encodeURIComponent(h)),k&&f.push("layers=1"),this.editor.graph.foldingEnabled&&f.push("nav=1"));if(d&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&f.push("page="+a);break}a=!0;null!=l?d="#U"+encodeURIComponent(l):(c=this.getCurrentFile(),p||null==c||c.constructor!=window.DriveFile?d="#R"+encodeURIComponent(d?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):
(d="#"+c.getHash(),a=!1));a&&null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&f.push("title="+encodeURIComponent(c.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<f.length?"?"+f.join("&"):"")+d};EditorUi.prototype.createHtml=function(a,b,d,e,h,k,l,p,n,r,B){var c=this.getBasenames(),f={};""!=h&&h!=mxConstants.NONE&&(f.highlight=h);"auto"!==e&&(f.target=e);n||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;
d=parseInt(d);isNaN(d)||100==d||(f.zoom=d/100);d=[];l&&(d.push("pages"),f.resize=!0,null!=this.pages&&null!=this.currentPage&&(f.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(d.push("zoom"),f.resize=!0);p&&d.push("layers");0<d.length&&(n&&d.push("lightbox"),f.toolbar=d.join(" "));null!=r&&0<r.length&&(f.edit=r);null!=a?f.url=a:f.xml=this.getFileData(!0,null,null,null,null,!l);b='<div class="mxgraph" style="'+(k?"max-width:100%;":"")+(""!=d?"border:1px solid transparent;":"")+'" data-mxgraph="'+
mxUtils.htmlEntities(JSON.stringify(f))+'"></div>';c=0<c.length?"s="+c.join(";"):"";a=null!=a?"fetch="+encodeURIComponent(a):"";B(b,'<script type="text/javascript" src="'+(0<c.length||0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+c:"https://www.draw.io/embed2.js?"+c)+"&"+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,d,e){var c=document.createElement("div");
c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var m=document.createElement("input");m.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";m.setAttribute("value","url");m.setAttribute("type","radio");m.setAttribute("name",
"type-embedhtmldialog");f=m.cloneNode(!0);f.setAttribute("value","copy");g.appendChild(f);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(k);mxUtils.br(g);g.appendChild(m);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));g.appendChild(k);var r=this.getCurrentFile();null==d&&null!=r&&r.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href",
"javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),g.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(r.getId())})));f.setAttribute("checked","checked");null==d&&m.setAttribute("disabled","disabled");c.appendChild(g);var l=this.addLinkSection(c),n=this.addCheckbox(c,mxResources.get("zoom"),!0,null,!0);mxUtils.write(c,":");var y=document.createElement("input");y.setAttribute("type","text");y.style.marginRight="16px";
y.style.width="60px";y.style.marginLeft="4px";y.style.marginRight="12px";y.value="100%";c.appendChild(y);var u=this.addCheckbox(c,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,A=A=this.addCheckbox(c,mxResources.get("allPages"),g,!g),z=this.addCheckbox(c,mxResources.get("layers"),!0),w=this.addCheckbox(c,mxResources.get("lightbox"),!0),C=this.addEditButton(c,w),D=C.getEditInput();D.style.marginBottom="16px";mxEvent.addListener(w,"change",function(){w.checked?D.removeAttribute("disabled"):
D.setAttribute("disabled","disabled");D.checked&&w.checked?C.getEditSelect().removeAttribute("disabled"):C.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,c,mxUtils.bind(this,function(){e(m.checked?d:null,n.checked,y.value,l.getTarget(),l.getColor(),u.checked,A.checked,z.checked,w.checked,C.getLink())}),null,a,b);this.showDialog(a.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,d,e,h,k){var c=document.createElement("div");c.style.whiteSpace=
"nowrap";var f=document.createElement("h3");mxUtils.write(f,a||mxResources.get("link"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=this.getCurrentFile(),f="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=g&&g.constructor==window.DriveFile&&!b){a=80;var f="https://desk.draw.io/support/solutions/articles/16000039384",m=document.createElement("div");m.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";
var l=document.createElement("div");l.style.whiteSpace="normal";mxUtils.write(l,mxResources.get("linkAccountRequired"));m.appendChild(l);l=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(g.getId())}));l.style.marginTop="12px";l.className="geBtn";m.appendChild(l);c.appendChild(m);l=document.createElement("a");l.style.paddingLeft="12px";l.style.color="gray";l.style.fontSize="11px";l.setAttribute("href","javascript:void(0);");mxUtils.write(l,mxResources.get("check"));
m.appendChild(l);mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,null,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var q=null,n=null;if(null!=d||null!=e)a+=30,mxUtils.write(c,mxResources.get("width")+":"),q=document.createElement("input"),
q.setAttribute("type","text"),q.style.marginRight="16px",q.style.width="50px",q.style.marginLeft="6px",q.style.marginRight="16px",q.style.marginBottom="10px",q.value="100%",c.appendChild(q),mxUtils.write(c,mxResources.get("height")+":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.width="50px",n.style.marginLeft="6px",n.style.marginBottom="10px",n.value=e+"px",c.appendChild(n),mxUtils.br(c);var u=this.addLinkSection(c,k);d=null!=this.pages&&1<this.pages.length;var A=null;
if(null==g||g.constructor!=window.DriveFile||b)A=this.addCheckbox(c,mxResources.get("allPages"),d,!d);var z=this.addCheckbox(c,mxResources.get("lightbox"),!0),w=this.addEditButton(c,z),C=w.getEditInput(),D=this.addCheckbox(c,mxResources.get("layers"),!0);D.style.marginLeft=C.style.marginLeft;D.style.marginBottom="16px";D.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(D.removeAttribute("disabled"),C.removeAttribute("disabled")):(D.setAttribute("disabled","disabled"),C.setAttribute("disabled",
"disabled"));C.checked&&z.checked?w.getEditSelect().removeAttribute("disabled"):w.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){h(u.getTarget(),u.getColor(),null==A?!0:A.checked,z.checked,w.getLink(),D.checked,null!=q?q.value:null,null!=n?n.value:null)}),null,mxResources.get("create"),f);this.showDialog(b.container,340,246+a,!0,!0);null!=q?(q.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",
!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(f);var g=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=e?null:this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),!0);null!=m&&
(m.style.marginBottom="16px");a=new CustomDialog(this,c,mxUtils.bind(this,function(){d(!g.checked,null!=m?m.checked:!1)}),null,a,b);this.showDialog(a.container,300,e?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,d,e,h,k,l,p){l=null!=l?l:!0;var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph,g="jpeg"==p?170:280,m=document.createElement("h3");mxUtils.write(m,a);m.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";c.appendChild(m);
mxUtils.write(c,mxResources.get("zoom")+":");var q=document.createElement("input");q.setAttribute("type","text");q.style.marginRight="16px";q.style.width="60px";q.style.marginLeft="4px";q.style.marginRight="12px";q.value=this.lastExportZoom||"100%";c.appendChild(q);mxUtils.write(c,mxResources.get("borderWidth")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.value=this.lastExportBorder||"0";c.appendChild(n);
mxUtils.br(c);var v=this.addCheckbox(c,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background,null,null,"jpeg"!=p),z=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,f.isSelectionEmpty()),w=document.createElement("input");w.style.marginTop="16px";w.style.marginRight="8px";w.style.marginLeft="24px";w.setAttribute("disabled","disabled");w.setAttribute("type","checkbox");k&&(c.appendChild(w),mxUtils.write(c,mxResources.get("crop")),mxUtils.br(c),g+=26,mxEvent.addListener(z,
"change",function(){z.checked?w.removeAttribute("disabled"):w.setAttribute("disabled","disabled")}));f.isSelectionEmpty()||(w.setAttribute("checked","checked"),w.defaultChecked=!0);var C=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible),D=document.createElement("input");D.style.marginTop="16px";D.style.marginRight="8px";D.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||D.setAttribute("disabled","disabled");b&&(c.appendChild(D),mxUtils.write(c,mxResources.get("embedImages")),
mxUtils.br(c),g+=26);var O=this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),l,null,null,"jpeg"!=p),L=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(c,L?mxResources.get("allPages"):"",L,!L,null,"jpeg"!=p);F.style.marginLeft="24px";F.style.marginBottom="16px";L||(F.style.visibility="hidden");mxEvent.addListener(O,"change",function(){O.checked&&L?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});l&&L||F.setAttribute("disabled","disabled");a=new CustomDialog(this,
c,mxUtils.bind(this,function(){this.lastExportBorder=n.value;this.lastExportZoom=q.value;h(q.value,v.checked,!z.checked,C.checked,O.checked,D.checked,n.value,w.checked,!F.checked)}),null,d,e);this.showDialog(a.container,320,g,!0,!0);q.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,d,e,h){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph;
if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(g)}var m=this.addCheckbox(c,mxResources.get("fit"),!0),k=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible&&e,!e),l=this.addCheckbox(c,d),n=this.addCheckbox(c,mxResources.get("lightbox"),!0),y=this.addEditButton(c,n),u=y.getEditInput(),A=1<f.model.getChildCount(f.model.getRoot()),z=this.addCheckbox(c,mxResources.get("layers"),A,
!A);z.style.marginLeft=u.style.marginLeft;z.style.marginBottom="12px";z.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(A&&z.removeAttribute("disabled"),u.removeAttribute("disabled")):(z.setAttribute("disabled","disabled"),u.setAttribute("disabled","disabled"));u.checked&&n.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){a(m.checked,k.checked,l.checked,n.checked,
y.getLink(),z.checked)}),null,mxResources.get("embed"),h);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,d,e,h,k,l,p){function c(c){var b=" ",g="";e&&(b=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));c=!0;if(EditorUi.enableLogging&&!this.isOffline()&&null!=a.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",a.getMode())}catch(h){}if(this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(h){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(h){}}catch(h){null!=window.console&&console.log("error in fileLoaded:",a,h);if(EditorUi.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=h&&null!=h.message?":err:"+encodeURIComponent(h.message):"")+(null!=h&&null!=h.stack?"&stack="+encodeURIComponent(h.stack):"")}catch(q){}this.handleError(h,
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=b?b.constructor==DriveFile?this.loadFile(b.getHash()):this.fileLoaded(b):d()}))}else d();return c};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,d,e,h,q,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==
this.scratchpad?this.getLocalData(".scratchpad",mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(a){var c=mxUtils.createXmlDocument(),b=c.createElement("mxlibrary");mxUtils.setTextContent(b,JSON.stringify(a));c.appendChild(b);return mxUtils.getXml(c)};EditorUi.prototype.closeLibrary=function(a){null!=a&&(this.removeLibrarySidebar(a.getHash()),
a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var c=this.sidebar.palettes[a];if(null!=c){for(var b=0;b<c.length;b++)c[b].parentNode.removeChild(c[b]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var c=this.sidebar.container;if(null==a){var b=this.sidebar.palettes["L.scratchpad"];null==b&&(b=this.sidebar.palettes.search);null!=b&&(a=b[b.length-
1].nextSibling)}a=null!=a?a:c.firstChild.nextSibling.nextSibling;var b=c.lastChild,d=b.previousSibling;c.insertBefore(b,a);c.insertBefore(d,b)};EditorUi.prototype.loadLibrary=function(a){var c=mxUtils.parseXml(a.getData());if("mxlibrary"==c.documentElement.nodeName){var b=JSON.parse(mxUtils.getTextContent(c.documentElement));this.libraryLoaded(a,b,c.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};
EditorUi.prototype.libraryLoaded=function(a,b,d){a.constructor!=LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var c=this.sidebar.palettes[a.getHash()],c=null!=c?c[c.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var f=null,e=mxUtils.bind(this,function(c,b){if(0==c.length&&a.isEditable())null==f&&(f=document.createElement("div"),mxUtils.setPrefixedStyle(f.style,"borderRadius","6px"),f.style.border="3px dotted lightGray",f.style.textAlign=
"center",f.style.padding="8px",f.style.color="#B3B3B3",mxUtils.write(f,mxResources.get("dragElementsHere"))),b.appendChild(f);else for(var d=0;d<c.length;d++){var e=c[d],g=e.data;if(null!=g){var g=this.convertDataUri(g),h="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==e.aspect&&(h+="aspect=fixed;");b.appendChild(this.sidebar.createVertexTemplate(h+"image="+g,e.w,e.h,"",e.title||"",!1,!1,!1))}else null!=e.xml&&(g=this.stringToCells(this.editor.graph.decompress(e.xml)),
0<g.length&&b.appendChild(this.sidebar.createVertexTemplateFromCells(g,e.w,e.h,e.title||"",!0,!1,!1)))}});d=null!=d&&0<d.length?d:a.getTitle();var g=this.sidebar.addPalette(a.getHash(),d,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(c);var p=g.parentNode.previousSibling;d=p.getAttribute("title");null!=d&&0<d.length&&".scratchpad"!=a.title&&p.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+d);var k=document.createElement("div");k.style.position="absolute";k.style.right=
"0px";k.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(k.style.backgroundColor="inherit");p.style.position="relative";var r=document.createElement("img");r.setAttribute("src",Dialog.prototype.closeImage);r.setAttribute("title",mxResources.get("close"));r.setAttribute("align","top");r.setAttribute("border","0");r.className="geButton";r.style.marginRight="1px";r.style.marginTop="-1px";k.appendChild(r);var l=null;mxEvent.addListener(r,"click",mxUtils.bind(this,function(c){if(!mxEvent.isConsumed(c)){var b=
mxUtils.bind(this,function(){this.closeLibrary(a)});null!=l?this.confirm(mxResources.get("allChangesLost"),null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b();mxEvent.consume(c)}}));mxEvent.addListener(g,"mousemove",mxUtils.bind(this,function(a){mxEvent.getSource(a)==g?g.setAttribute("title",mxResources.get("libraryTooltip")):g.removeAttribute("title")}));if(a.isEditable()){var n=this.editor.graph,y=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());
mxEvent.consume(c)}),u=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=w&&null!=w.parentNode&&w.parentNode.removeChild(w),w=r.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",k.insertBefore(w,k.firstChild),p.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),
p.style.paddingRight=18*k.childNodes.length+"px")})):null==l&&(l=r.cloneNode(!1),l.setAttribute("src",IMAGE_PATH+"/download.png"),l.setAttribute("title",mxResources.get("save")),k.insertBefore(l,k.firstChild),mxEvent.addListener(l,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==l||a.isModified()||(p.style.paddingRight=18*k.childNodes.length+"px",l.parentNode.removeChild(l),l=null)});mxEvent.consume(c)})),p.style.paddingRight=
18*k.childNodes.length+"px")}),A=mxUtils.bind(this,function(a,c,d,e){a=n.cloneCells(mxUtils.sortCells(n.model.getTopmostCells(a)));for(var h=0;h<a.length;h++){var m=n.getCellGeometry(a[h]);null!=m&&m.translate(-c.x,-c.y)}g.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=e&&(a.title=e);b.push(a);u(d);null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),
f=null)}),z=mxUtils.bind(this,function(a){if(n.isSelectionEmpty())n.getRubberband().isActive()?(n.getRubberband().execute(a),n.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var c=n.getSelectionCells(),b=n.view.getBounds(c),d=n.view.scale;b.x/=d;b.y/=d;b.width/=d;b.height/=d;b.x-=n.view.translate.x;b.y-=n.view.translate.y;A(c,b)}mxEvent.consume(a)});g.style.border="3px solid transparent";mxEvent.addGestureListeners(g,
function(){},mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="hidden",null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)",g.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,
function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(g.style.border="3px solid transparent",null!=f&&(f.style.border="3px dotted lightGray"),g.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,z(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",g.style.border=
"3px solid transparent",g.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=f&&(f.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(a){null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)";a.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();
a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(a){g.style.border="3px solid transparent";g.style.cursor="";null!=f&&(f.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,h,m,p,q,r,k,l){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",
new mxGeometry(0,0,p,q),c)],c[0].vertex=!0,A(c,new mxRectangle(0,0,p,q),a,mxEvent.isAltDown(a)?null:r.substring(0,r.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var n=!1,t=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var h=mxUtils.parseXml(c);if("mxlibrary"==h.documentElement.nodeName)try{var m=JSON.parse(mxUtils.getTextContent(h.documentElement));e(m,g);b=b.concat(m);u(a);this.spinner.stop();n=!0}catch(U){}else if("mxfile"==
h.documentElement.nodeName)try{for(var p=h.documentElement.getElementsByTagName("diagram"),h=0;h<p.length;h++){var m=mxUtils.getTextContent(p[h]),q=this.stringToCells(this.editor.graph.decompress(m)),r=this.editor.graph.getBoundingBoxFromGeometry(q);A(q,new mxRectangle(0,0,r.width,r.height),a)}n=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}n||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&
(f.parentNode.removeChild(f),f=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,r)&&null!=l?this.parseFile(l,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?t(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):t(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"dragleave",function(a){null!=
f?f.style.border="3px dotted lightGray":(g.style.border="3px solid transparent",g.style.cursor="");a.stopPropagation();a.preventDefault()}));r=r.cloneNode(!1);r.setAttribute("src",IMAGE_PATH+"/edit.gif");r.setAttribute("title",mxResources.get("edit"));k.insertBefore(r,k.firstChild);mxEvent.addListener(r,"click",y);mxEvent.addListener(g,"dblclick",function(a){mxEvent.getSource(a)==g&&y(a)});r=r.cloneNode(!1);r.setAttribute("src",Editor.plusImage);r.setAttribute("title",mxResources.get("add"));k.insertBefore(r,
k.firstChild);this.isOffline()||".scratchpad"!=a.title||(d=document.createElement("span"),d.setAttribute("title",mxResources.get("help")),d.style.cssText="color:gray;text-decoration:none;",d.className="geButton",mxUtils.write(d,"?"),mxEvent.addGestureListeners(d,mxUtils.bind(this,function(a){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(a)})),k.insertBefore(d,k.firstChild));var w=null;mxEvent.addListener(r,"click",z)}p.appendChild(k);p.style.paddingRight=
18*k.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=
46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",
Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position="relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.prototype.hideFooter=function(){var a=document.getElementById("geFooter");null!=a&&(this.footerHeight=0,a.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=
function(a,b,d,e,h){a=new ImageDialog(this,a,b,d,e,h);this.showDialog(a.container,Graph.fileSupport?440:360,Graph.fileSupport?200:90,!0,!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var c=new BackgroundImageDialog(this,mxUtils.bind(this,function(c){a(c)}));this.showDialog(c.container,360,200,!0,!0);c.init()};EditorUi.prototype.showLibraryDialog=
function(a,b,d,e,h){a=new LibraryDialog(this,a,b,d,e,h);this.showDialog(a.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer");a.style.position="absolute";a.style.overflow="hidden";a.style.borderWidth="3px";var b=document.createElement("a");b.setAttribute("href","javascript:void(0);");b.className="geTitle";b.style.height=
"100%";b.style.paddingTop="9px";mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,"click",mxUtils.bind(this,function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,d){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},f=null!=a&&null!=a.error?a.error:a;if(null!=f||null!=b){a=mxUtils.htmlEntities(mxResources.get("unknownError"));var e=mxResources.get("ok"),
g=null;b=null!=b?b:mxResources.get("error");if(null!=f)if(null!=f.retry&&(e=mxResources.get("cancel"),g=function(){c();f.retry()}),"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.FORBIDDEN)a=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==f.code||404==f.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.NOT_FOUND){a=
mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var p=window.location.hash;null!=p&&"#G"==p.substring(0,2)&&(p=p.substring(2),a+=' <a href="https://drive.google.com/open?id='+p+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else f.code==App.ERROR_TIMEOUT?a=mxUtils.htmlEntities(mxResources.get("timeout")):f.code==App.ERROR_BUSY?a=mxUtils.htmlEntities(mxResources.get("busy")):null!=f.message?a=mxUtils.htmlEntities(f.message):null!=f.response&&
null!=f.response.error&&(a=mxUtils.htmlEntities(f.response.error));this.showError(b,a,e,d,g)}else null!=d&&d()};EditorUi.prototype.showError=function(a,b,d,e,h,q,k){a=new ErrorDialog(this,a,b,d,e,h,q,k);this.showDialog(a.container,340,150,!0,!1);a.init()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,d,e,h){var c=null!=this.spinner&&null!=this.spinner.pause?
this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,a,function(){c();null!=b&&b()},function(){c();null!=d&&d()},e,h)).container,340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(a){this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var a=this.editor.graph.getModel();return 1==a.getChildCount(a.root)&&0==a.getChildCount(a.getChildAt(a.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||
!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=function(a,b,d){var c=a.toDataURL("image/"+d);if(6>=c.length||c==a.cloneNode(!1).toDataURL("image/"+d))throw{message:"Invalid image"};null!=b&&(c=this.writeGraphModelToPng(c,"zTXt","mxGraphModel",atob(this.editor.graph.compress(b))));return c};EditorUi.prototype.saveCanvas=function(a,
b,d){var c="jpeg"==d?"jpg":d,f=this.getBaseFilename()+"."+c;a=this.createImageDataUri(a,b,d);this.saveData(f,c,a.substring(a.lastIndexOf(",")+1),"image/"+d,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(a,
b,d,e,h){if(window.Blob&&navigator.msSaveOrOpenBlob)a=e?this.base64ToBlob(a,d):new Blob([a],{type:d}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)d=window.open("about:blank","_blank"),null==d?mxUtils.popup(a,!0):(d.document.write(a),d.document.close(),d.document.execCommand("SaveAs",!0,b),d.close());else if(mxClient.IS_IOS)b=new TextareaDialog(this,b+":",a,null,null,mxResources.get("close")),b.textarea.style.width="600px",b.textarea.style.height="380px",this.showDialog(b.container,620,
460,!0,!0),b.init(),document.execCommand("selectall",!1,null);else{var c=document.createElement("a"),f=!mxClient.IS_SF&&"undefined"!==typeof c.download;if(f||this.isOffline()){c.href=URL.createObjectURL(e?this.base64ToBlob(a,d):new Blob([a],{type:d}));f?c.download=b:c.setAttribute("target","_blank");document.body.appendChild(c);try{window.setTimeout(function(){URL.revokeObjectURL(c.href)},0),c.click(),c.parentNode.removeChild(c)}catch(p){}}else this.createEchoRequest(a,b,d,e,h).simulate(document,
"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,d,e,h,q){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=d?"&mime="+d:"")+(null!=h?"&format="+h:"")+(null!=q?"&base64="+q:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(e?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,e=Math.ceil(d/1024),f=Array(e),k=0;k<e;++k){for(var p=1024*k,l=Math.min(p+1024,d),r=Array(l-p),n=0;p<l;++n,++p)r[n]=c[p].charCodeAt(0);f[k]=
new Uint8Array(r)}return new Blob(f,{type:b})};EditorUi.prototype.saveLocalFile=function(a,b,d,e,h,q){q=null!=q?q:!1;var c="vsdx"!=h&&(!mxClient.IS_IOS||!navigator.standalone);h=this.getServiceCount(q);b=new CreateDialog(this,b,mxUtils.bind(this,function(c,b){try{if("_blank"==b)if(null==d||"image/"!=d.substring(0,6)||"image/svg"==d.substring(0,9)&&!mxClient.IS_SVG)f=window.open("about:blank"),null==f?mxUtils.popup(a,!0):(f.document.write(mxUtils.htmlEntities(a,!1)),f.document.close());else if(mxClient.IS_EDGE||
11==document.documentMode||10==document.documentMode){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write('<html><img src="data:'+d+(e?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))+'"/></html>'),f.document.close())}else f=window.open("data:"+d+(e?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null==f&&mxUtils.popup(a,!0);else b==App.MODE_DEVICE?this.doSaveLocalFile(a,c,d,e):null!=c&&0<c.length&&this.pickFolder(b,mxUtils.bind(this,function(f){try{this.exportFile(a,
c,d,e,b,f)}catch(x){this.handleError(x)}}))}catch(B){this.handleError(B)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,q,c,null,null,4<h?3:4,a,d,e);this.showDialog(b.container,380,4<h?390:270,!0,!0);b.init()};EditorUi.prototype.saveData=function(a,b,d,e,h){this.isLocalFileSave()?this.saveLocalFile(d,a,e,h,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,c){return this.createEchoRequest(d,a,e,h,b,c)}),d,h,e)};EditorUi.prototype.saveRequest=
function(a,b,d,e,h,q){var c=!mxClient.IS_IOS||!navigator.standalone,f=this.getServiceCount(!1);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,c){if("_blank"==c||null!=a&&0<a.length){var f=d("_blank"==c?null:a,c==App.MODE_DEVICE||null==c||"_blank"==c?"0":"1");null!=f&&(c==App.MODE_DEVICE||"_blank"==c?f.simulate(document,"_blank"):this.pickFolder(c,mxUtils.bind(this,function(d){q=null!=q?q:"pdf"==b?"application/pdf":"image/"+b;if(null!=e)try{this.exportFile(e,a,q,!0,c,d)}catch(y){this.handleError(y)}else this.spinner.spin(document.body,
mxResources.get("saving"))&&f.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=f.getStatus()&&299>=f.getStatus())try{this.exportFile(f.getText(),a,q,!0,c,d)}catch(y){this.handleError(y)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,c,null,null,4<f?3:4,e,q,h);this.showDialog(a.container,380,4<f?
390:270,!0,!0);a.init()};EditorUi.prototype.exportFile=function(a,b,d,e,h,q){};EditorUi.prototype.pickFolder=function(a,b,d){b(null)};EditorUi.prototype.exportSvg=function(a,b,d,e,h,q,k,p,l){if(this.spinner.spin(document.body,mxResources.get("export"))){var c=this.editor.graph.isSelectionEmpty();d=null!=d?d:c;c=b?null:this.editor.graph.background;c==mxConstants.NONE&&(c=null);null==c&&0==b&&(c="#ffffff");var f=this.editor.graph.getSvg(c,a,k,p,null,d);e&&this.editor.graph.addSvgShadow(f);var g=this.getBaseFilename()+
".svg",m=mxUtils.bind(this,function(a){this.spinner.stop();h&&a.setAttribute("content",this.getFileData(!0,null,null,null,d,l));var c='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a);this.isLocalFileSave()||c.length<=MAX_REQUEST_SIZE?this.saveData(g,"svg",c,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(c)}))});this.convertMath(this.editor.graph,
f,!1,mxUtils.bind(this,function(){q?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(f,m,this.thumbImageCache)):m(f)}))}};EditorUi.prototype.addCheckbox=function(a,b,d,e,h,q){q=null!=q?q:!0;var c=document.createElement("input");c.style.marginRight="8px";c.style.marginTop="16px";c.setAttribute("type","checkbox");d&&(c.setAttribute("checked","checked"),c.defaultChecked=!0);e&&c.setAttribute("disabled","disabled");q&&(a.appendChild(c),mxUtils.write(a,b),h||mxUtils.br(a));return c};
EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),e="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER&&(e=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));
f.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");f.appendChild(d);a.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,function(){if("custom"==f.value){var a=new FilenameDialog(this,e,mxResources.get("ok"),function(a){null!=a?e=a:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",
mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":e:null},getEditInput:function(){return c},getEditSelect:function(){return f}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){k.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+
f:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value",
"blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&(e=document.createElement("option"),e.setAttribute("value","frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",k=null,k=mxUtils.button("",
mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();k.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width="22px";k.style.position="relative";k.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=
function(a,b,d,e,h,k,l,p){var c=this.getCurrentFile(),f=[];e&&(f.push("lightbox=1"),"auto"!=a&&f.push("target="+a),null!=b&&b!=mxConstants.NONE&&f.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=h&&0<h.length&&f.push("edit="+encodeURIComponent(h)),k&&f.push("layers=1"),this.editor.graph.foldingEnabled&&f.push("nav=1"));if(d&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&f.push("page="+a);break}a=!0;null!=l?d="#U"+encodeURIComponent(l):
(c=this.getCurrentFile(),p||null==c||c.constructor!=window.DriveFile?d="#R"+encodeURIComponent(d?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(d="#"+c.getHash(),a=!1));a&&null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&f.push("title="+encodeURIComponent(c.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<f.length?"?"+f.join("&"):"")+
d};EditorUi.prototype.createHtml=function(a,b,d,e,h,k,l,p,n,r,B){var c=this.getBasenames(),f={};""!=h&&h!=mxConstants.NONE&&(f.highlight=h);"auto"!==e&&(f.target=e);n||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;d=parseInt(d);isNaN(d)||100==d||(f.zoom=d/100);d=[];l&&(d.push("pages"),f.resize=!0,null!=this.pages&&null!=this.currentPage&&(f.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(d.push("zoom"),f.resize=!0);p&&d.push("layers");0<d.length&&(n&&d.push("lightbox"),f.toolbar=
d.join(" "));null!=r&&0<r.length&&(f.edit=r);null!=a?f.url=a:f.xml=this.getFileData(!0,null,null,null,null,!l);b='<div class="mxgraph" style="'+(k?"max-width:100%;":"")+(""!=d?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(f))+'"></div>';c=0<c.length?"s="+c.join(";"):"";a=null!=a?"fetch="+encodeURIComponent(a):"";B(b,'<script type="text/javascript" src="'+(0<c.length||0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+c:"https://www.draw.io/embed2.js?"+
c)+"&"+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";
var m=document.createElement("input");m.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";m.setAttribute("value","url");m.setAttribute("type","radio");m.setAttribute("name","type-embedhtmldialog");f=m.cloneNode(!0);f.setAttribute("value","copy");g.appendChild(f);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(k);mxUtils.br(g);g.appendChild(m);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));
g.appendChild(k);var r=this.getCurrentFile();null==d&&null!=r&&r.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href","javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),g.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(r.getId())})));f.setAttribute("checked","checked");null==d&&m.setAttribute("disabled","disabled");c.appendChild(g);var l=
this.addLinkSection(c),n=this.addCheckbox(c,mxResources.get("zoom"),!0,null,!0);mxUtils.write(c,":");var y=document.createElement("input");y.setAttribute("type","text");y.style.marginRight="16px";y.style.width="60px";y.style.marginLeft="4px";y.style.marginRight="12px";y.value="100%";c.appendChild(y);var u=this.addCheckbox(c,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,A=A=this.addCheckbox(c,mxResources.get("allPages"),g,!g),z=this.addCheckbox(c,mxResources.get("layers"),!0),
w=this.addCheckbox(c,mxResources.get("lightbox"),!0),C=this.addEditButton(c,w),D=C.getEditInput();D.style.marginBottom="16px";mxEvent.addListener(w,"change",function(){w.checked?D.removeAttribute("disabled"):D.setAttribute("disabled","disabled");D.checked&&w.checked?C.getEditSelect().removeAttribute("disabled"):C.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,c,mxUtils.bind(this,function(){e(m.checked?d:null,n.checked,y.value,l.getTarget(),l.getColor(),u.checked,A.checked,
z.checked,w.checked,C.getLink())}),null,a,b);this.showDialog(a.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,d,e,h,k){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,a||mxResources.get("link"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=this.getCurrentFile(),f="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=
g&&g.constructor==window.DriveFile&&!b){a=80;var f="https://desk.draw.io/support/solutions/articles/16000039384",m=document.createElement("div");m.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var l=document.createElement("div");l.style.whiteSpace="normal";mxUtils.write(l,mxResources.get("linkAccountRequired"));m.appendChild(l);l=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(g.getId())}));
l.style.marginTop="12px";l.className="geBtn";m.appendChild(l);c.appendChild(m);l=document.createElement("a");l.style.paddingLeft="12px";l.style.color="gray";l.style.fontSize="11px";l.setAttribute("href","javascript:void(0);");mxUtils.write(l,mxResources.get("check"));m.appendChild(l);mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,
null,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var q=null,n=null;if(null!=d||null!=e)a+=30,mxUtils.write(c,mxResources.get("width")+":"),q=document.createElement("input"),q.setAttribute("type","text"),q.style.marginRight="16px",q.style.width="50px",q.style.marginLeft="6px",q.style.marginRight="16px",q.style.marginBottom="10px",q.value="100%",c.appendChild(q),mxUtils.write(c,mxResources.get("height")+
":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.width="50px",n.style.marginLeft="6px",n.style.marginBottom="10px",n.value=e+"px",c.appendChild(n),mxUtils.br(c);var u=this.addLinkSection(c,k);d=null!=this.pages&&1<this.pages.length;var A=null;if(null==g||g.constructor!=window.DriveFile||b)A=this.addCheckbox(c,mxResources.get("allPages"),d,!d);var z=this.addCheckbox(c,mxResources.get("lightbox"),!0),w=this.addEditButton(c,z),C=w.getEditInput(),D=this.addCheckbox(c,mxResources.get("layers"),
!0);D.style.marginLeft=C.style.marginLeft;D.style.marginBottom="16px";D.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(D.removeAttribute("disabled"),C.removeAttribute("disabled")):(D.setAttribute("disabled","disabled"),C.setAttribute("disabled","disabled"));C.checked&&z.checked?w.getEditSelect().removeAttribute("disabled"):w.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){h(u.getTarget(),u.getColor(),null==A?
!0:A.checked,z.checked,w.getLink(),D.checked,null!=q?q.value:null,null!=n?n.value:null)}),null,mxResources.get("create"),f);this.showDialog(b.container,340,246+a,!0,!0);null!=q?(q.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));
f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(f);var g=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=e?null:this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),!0);null!=m&&(m.style.marginBottom="16px");a=new CustomDialog(this,c,mxUtils.bind(this,function(){d(!g.checked,null!=m?m.checked:!1)}),null,a,b);this.showDialog(a.container,300,e?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(a,
b,d,e,h,k,l,p){l=null!=l?l:!0;var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph,g="jpeg"==p?170:280,m=document.createElement("h3");mxUtils.write(m,a);m.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";c.appendChild(m);mxUtils.write(c,mxResources.get("zoom")+":");var q=document.createElement("input");q.setAttribute("type","text");q.style.marginRight="16px";q.style.width="60px";q.style.marginLeft="4px";q.style.marginRight="12px";q.value=
this.lastExportZoom||"100%";c.appendChild(q);mxUtils.write(c,mxResources.get("borderWidth")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.value=this.lastExportBorder||"0";c.appendChild(n);mxUtils.br(c);var v=this.addCheckbox(c,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background,null,null,"jpeg"!=p),z=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,f.isSelectionEmpty()),
w=document.createElement("input");w.style.marginTop="16px";w.style.marginRight="8px";w.style.marginLeft="24px";w.setAttribute("disabled","disabled");w.setAttribute("type","checkbox");k&&(c.appendChild(w),mxUtils.write(c,mxResources.get("crop")),mxUtils.br(c),g+=26,mxEvent.addListener(z,"change",function(){z.checked?w.removeAttribute("disabled"):w.setAttribute("disabled","disabled")}));f.isSelectionEmpty()||(w.setAttribute("checked","checked"),w.defaultChecked=!0);var C=this.addCheckbox(c,mxResources.get("shadow"),
f.shadowVisible),D=document.createElement("input");D.style.marginTop="16px";D.style.marginRight="8px";D.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||D.setAttribute("disabled","disabled");b&&(c.appendChild(D),mxUtils.write(c,mxResources.get("embedImages")),mxUtils.br(c),g+=26);var O=this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),l,null,null,"jpeg"!=p),L=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(c,L?mxResources.get("allPages"):"",L,!L,null,"jpeg"!=
p);F.style.marginLeft="24px";F.style.marginBottom="16px";L||(F.style.visibility="hidden");mxEvent.addListener(O,"change",function(){O.checked&&L?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});l&&L||F.setAttribute("disabled","disabled");a=new CustomDialog(this,c,mxUtils.bind(this,function(){this.lastExportBorder=n.value;this.lastExportZoom=q.value;h(q.value,v.checked,!z.checked,C.checked,O.checked,D.checked,n.value,w.checked,!F.checked)}),null,d,e);this.showDialog(a.container,
320,g,!0,!0);q.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,d,e,h){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph;if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(g)}var m=this.addCheckbox(c,mxResources.get("fit"),!0),
k=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible&&e,!e),l=this.addCheckbox(c,d),n=this.addCheckbox(c,mxResources.get("lightbox"),!0),y=this.addEditButton(c,n),u=y.getEditInput(),A=1<f.model.getChildCount(f.model.getRoot()),z=this.addCheckbox(c,mxResources.get("layers"),A,!A);z.style.marginLeft=u.style.marginLeft;z.style.marginBottom="12px";z.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(A&&z.removeAttribute("disabled"),u.removeAttribute("disabled")):(z.setAttribute("disabled",
"disabled"),u.setAttribute("disabled","disabled"));u.checked&&n.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){a(m.checked,k.checked,l.checked,n.checked,y.getLink(),z.checked)}),null,mxResources.get("embed"),h);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,d,e,h,k,l,p){function c(c){var b=" ",g="";e&&(b=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
(h?"&edit=_blank":"")+(k?"&layers=1":"")+"');}})(this);\"",g+="cursor:pointer;");a&&(g+="max-width:100%;");var m="";d&&(m=' width="'+Math.round(f.width)+'" height="'+Math.round(f.height)+'"');l('<img src="'+c+'"'+m+(""!=g?' style="'+g+'"':"")+b+"/>")}var f=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(a){var b=e?this.getFileData(!0):null;a=this.createImageDataUri(a,b,"png");c(a)}),null,null,null,mxUtils.bind(this,function(a){p({message:mxResources.get("unknownError")})}),
null,!0,d?2:1,null,b);else if(b=this.getFileData(!0),f.width*f.height<=MAX_AREA&&b.length<=MAX_REQUEST_SIZE){var g="";d&&(g="&w="+Math.round(2*f.width)+"&h="+Math.round(2*f.height));var m=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(e?"1":"0")+g+"&xml="+encodeURIComponent(b));m.send(mxUtils.bind(this,function(){200<=m.getStatus()&&299>=m.getStatus()?c("data:image/png;base64,"+m.getText()):p({message:mxResources.get("unknownError")})}))}else p({message:mxResources.get("drawingTooLarge")})};
EditorUi.prototype.createEmbedSvg=function(a,b,d,e,h,k,l){var c=this.editor.graph.getSvg(),f=c.getElementsByTagName("a");if(null!=f)for(var g=0;g<f.length;g++){var m=f[g].getAttribute("href");null!=m&&"#"==m.charAt(0)&&"_blank"==f[g].getAttribute("target")&&f[g].removeAttribute("target")}e&&c.setAttribute("content",this.getFileData(!0));b&&this.editor.graph.addSvgShadow(c);if(d){var q=" ",n="";e&&(q="onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+

158
war/js/atlas.min.js vendored
View file

@ -6208,7 +6208,7 @@ O.setAttribute("min","1");O.setAttribute("type","number");O.style.width="40px";H
K.appendChild(H);K.appendChild(W);N.appendChild(P);N.appendChild(Y);N.appendChild(U);T.appendChild(K);T.appendChild(N);t.appendChild(T);k.appendChild(t);h.appendChild(k);k=document.createElement("div");l=document.createElement("div");l.style.fontWeight="bold";l.style.marginBottom="12px";mxUtils.write(l,mxResources.get("paperSize"));k.appendChild(l);l=document.createElement("div");l.style.marginBottom="12px";var V=PageSetupDialog.addPageFormatPanel(l,"printdialog",b.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);
k.appendChild(l);l=document.createElement("span");mxUtils.write(l,mxResources.get("pageScale"));k.appendChild(l);var S=document.createElement("input");S.style.cssText="margin:0 8px 0 8px;";S.setAttribute("value","100 %");S.style.width="60px";k.appendChild(S);h.appendChild(k);l=document.createElement("div");l.style.cssText="text-align:right;margin:62px 0 0 0;";k=mxUtils.button(mxResources.get("cancel"),function(){b.hideDialog()});k.className="geBtn";b.editor.cancelFirst&&l.appendChild(k);b.isOffline()||
(t=mxUtils.button(mxResources.get("help"),function(){window.open("https://desk.draw.io/support/solutions/articles/16000048947")}),t.className="geBtn",l.appendChild(t));PrintDialog.previewEnabled&&(t=mxUtils.button(mxResources.get("preview"),function(){b.hideDialog();c(!1)}),t.className="geBtn",l.appendChild(t));t=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){b.hideDialog();c(!0)});t.className="geBtn gePrimaryBtn";l.appendChild(t);b.editor.cancelFirst||l.appendChild(k);
h.appendChild(l);this.container=h}})();(function(){EditorUi.VERSION="7.2.6";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
h.appendChild(l);this.container=h}})();(function(){EditorUi.VERSION="7.2.7";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
36;EditorUi.prototype.defaultCustomShapeStyle="shape=stencil(tZRtTsQgEEBPw1+DJR7AoN6DbWftpAgE0Ortd/jYRGq72R+YNE2YgTePloEJGWblgA18ZuKFDcMj5/Sm8boZq+BgjCX4pTyqk6ZlKROitwusOMXKQDODx5iy4pXxZ5qTHiFHawxB0JrQZH7lCabQ0Fr+XWC1/E8zcsT/gAi+Subo2/3Mh6d/oJb5nU1b5tW7r2knautaa3T+U32o7f7vZwpJkaNDLORJjcu7t59m2jXxqX9un+tt022acsfmoKaQZ+vhhswZtS6Ne/ThQGt0IV0N3Yyv6P3CeT9/tHO0XFI5cAE=);whiteSpace=wrap;html=1;";EditorUi.prototype.maxBackgroundSize=1600;EditorUi.prototype.maxImageSize=520;EditorUi.prototype.resampleThreshold=
1E5;EditorUi.prototype.maxImageBytes=1E6;EditorUi.prototype.maxBackgroundBytes=25E5;EditorUi.prototype.currentFile=null;EditorUi.prototype.printPdfExport=!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;(function(){EditorUi.prototype.useCanvasForExport=!1;EditorUi.prototype.jpgSupported=!1;try{var b=document.createElement("canvas"),a=new Image;a.onload=function(){try{b.getContext("2d").drawImage(a,0,0);var e=b.toDataURL("image/png");EditorUi.prototype.useCanvasForExport=
null!=e&&6<e.length}catch(g){}};a.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(l){}try{b=document.createElement("canvas");b.width=b.height=1;var c=b.toDataURL("image/jpeg");EditorUi.prototype.jpgSupported=null!==c.match("image/jpeg")}catch(l){}})();
@ -6242,84 +6242,84 @@ mxUtils.getXml(b))})))}else h=e+".svg",q=this.getFileData(!1,!0,null,mxUtils.bin
0;l<this.pages.length;l++)if(this.pages[l]==this.currentPage){h="&from="+l;break}return new mxXmlRequest(EXPORT_URL,"format="+a+h+"&base64="+d+"&embedXml="+e+"&xml="+encodeURIComponent(c)+(null!=b?"&filename="+encodeURIComponent(b):""))};EditorUi.prototype.setMode=function(b,a){this.mode=b};EditorUi.prototype.fileLoaded=function(b){var a=!1;this.hideDialog();var c=this.getCurrentFile();this.setCurrentFile(null);null!=c&&(c.removeListener(this.descriptorChangedListener),c.close());this.editor.graph.model.clear();
this.editor.undoManager.clear();var d=mxUtils.bind(this,function(){this.setGraphEnabled(!1);this.setCurrentFile(null);null!=c&&this.updateDocumentTitle();this.editor.graph.model.clear();this.editor.undoManager.clear();null!=window.location.hash&&0<window.location.hash.length&&(window.location.hash="");null!=this.fname&&(this.fnameWrapper.style.display="none",this.fname.innerHTML="",this.fname.setAttribute("title",mxResources.get("rename")));this.updateUi();this.showSplash()});if(null!=b)try{this.setCurrentFile(b);
b.addListener("descriptorChanged",this.descriptorChangedListener);b.addListener("contentChanged",this.descriptorChangedListener);this.descriptorChanged();b.open();this.setGraphEnabled(!0);this.setMode(b.getMode());this.editor.undoManager.clear();this.updateUi();null==b.realtime&&(b.isEditable()?this.editor.setStatus(""):this.editor.setStatus(mxUtils.htmlEntities(mxResources.get("readOnly"))));this.editor.chromeless?this.editor.graph.lightbox&&this.lightboxFit():(this.editor.graph.selectUnlockedLayer(),
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));a=!0;if(this.enableLogging&&!this.isOffline()&&null!=b.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",b.getMode())}catch(g){}if(this.mode==b.getMode()&&b.getMode()!=App.MODE_DEVICE&&null!=b.getMode())try{this.addRecent({id:b.getHash(),title:b.getTitle(),mode:b.getMode()})}catch(g){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(g){}}catch(g){null!=window.console&&console.log("error in fileLoaded:",b,g);if(this.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=g&&null!=g.message?":err:"+encodeURIComponent(g.message):"")+(null!=g&&null!=g.stack?"&stack="+encodeURIComponent(g.stack):"")}catch(p){}this.handleError(g,mxResources.get("errorLoadingFile"),
mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=c?c.constructor==DriveFile?this.loadFile(c.getHash()):this.fileLoaded(c):d()}))}else d();return a};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(b,a,c,d,g,f,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==this.scratchpad?this.getLocalData(".scratchpad",
mxUtils.bind(this,function(b){null==b&&(b=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,b,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(b){var a=mxUtils.createXmlDocument(),c=a.createElement("mxlibrary");mxUtils.setTextContent(c,JSON.stringify(b));a.appendChild(c);return mxUtils.getXml(a)};EditorUi.prototype.closeLibrary=function(b){null!=b&&(this.removeLibrarySidebar(b.getHash()),b.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(b.getHash()),
".scratchpad"==b.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(b){var a=this.sidebar.palettes[b];if(null!=a){for(var c=0;c<a.length;c++)a[c].parentNode.removeChild(a[c]);delete this.sidebar.palettes[b]}};EditorUi.prototype.repositionLibrary=function(b){var a=this.sidebar.container;if(null==b){var c=this.sidebar.palettes["L.scratchpad"];null==c&&(c=this.sidebar.palettes.search);null!=c&&(b=c[c.length-1].nextSibling)}b=null!=b?b:a.firstChild.nextSibling.nextSibling;
var c=a.lastChild,d=c.previousSibling;a.insertBefore(c,b);a.insertBefore(d,c)};EditorUi.prototype.loadLibrary=function(b){var a=mxUtils.parseXml(b.getData());if("mxlibrary"==a.documentElement.nodeName){var c=JSON.parse(mxUtils.getTextContent(a.documentElement));this.libraryLoaded(b,c,a.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(b){return""};EditorUi.prototype.libraryLoaded=function(b,a,c){b.constructor!=
LocalLibrary&&mxSettings.addCustomLibrary(b.getHash());".scratchpad"==b.title&&(this.scratchpad=b);var e=this.sidebar.palettes[b.getHash()],e=null!=e?e[e.length-1].nextSibling:null;this.removeLibrarySidebar(b.getHash());var g=null,h=mxUtils.bind(this,function(a,c){if(0==a.length&&b.isEditable())null==g&&(g=document.createElement("div"),mxUtils.setPrefixedStyle(g.style,"borderRadius","6px"),g.style.border="3px dotted lightGray",g.style.textAlign="center",g.style.padding="8px",g.style.color="#B3B3B3",
mxUtils.write(g,mxResources.get("dragElementsHere"))),c.appendChild(g);else for(var e=0;e<a.length;e++){var d=a[e],h=d.data;if(null!=h){var h=this.convertDataUri(h),l="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==d.aspect&&(l+="aspect=fixed;");c.appendChild(this.sidebar.createVertexTemplate(l+"image="+h,d.w,d.h,"",d.title||"",!1,!1,!1))}else null!=d.xml&&(h=this.stringToCells(this.editor.graph.decompress(d.xml)),0<h.length&&c.appendChild(this.sidebar.createVertexTemplateFromCells(h,
d.w,d.h,d.title||"",!0,!1,!1)))}});c=null!=c&&0<c.length?c:b.getTitle();var d=this.sidebar.addPalette(b.getHash(),c,!0,mxUtils.bind(this,function(b){h(a,b)}));this.repositionLibrary(e);var f=d.parentNode.previousSibling;c=f.getAttribute("title");null!=c&&0<c.length&&".scratchpad"!=b.title&&f.setAttribute("title",this.getLibraryStorageHint(b)+"\n"+c);var k=document.createElement("div");k.style.position="absolute";k.style.right="0px";k.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(k.style.backgroundColor=
"inherit");f.style.position="relative";var q=document.createElement("img");q.setAttribute("src",Dialog.prototype.closeImage);q.setAttribute("title",mxResources.get("close"));q.setAttribute("align","top");q.setAttribute("border","0");q.className="geButton";q.style.marginRight="1px";q.style.marginTop="-1px";k.appendChild(q);var m=null;mxEvent.addListener(q,"click",mxUtils.bind(this,function(a){if(!mxEvent.isConsumed(a)){var c=mxUtils.bind(this,function(){this.closeLibrary(b)});null!=m?this.confirm(mxResources.get("allChangesLost"),
null,c,mxResources.get("cancel"),mxResources.get("discardChanges")):c();mxEvent.consume(a)}}));mxEvent.addListener(d,"mousemove",mxUtils.bind(this,function(b){mxEvent.getSource(b)==d?d.setAttribute("title",mxResources.get("libraryTooltip")):d.removeAttribute("title")}));if(b.isEditable()){var n=this.editor.graph,A=mxUtils.bind(this,function(c){this.showLibraryDialog(b.getTitle(),d,a,b,b.getMode());mxEvent.consume(c)}),D=mxUtils.bind(this,function(c){b.setModified(!0);b.isAutosave()?(null!=w&&null!=
w.parentNode&&w.parentNode.removeChild(w),w=q.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",k.insertBefore(w,k.firstChild),f.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(b.getTitle(),a,b,b.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),f.style.paddingRight=18*k.childNodes.length+"px")})):null==m&&(m=q.cloneNode(!1),
m.setAttribute("src",IMAGE_PATH+"/download.png"),m.setAttribute("title",mxResources.get("save")),k.insertBefore(m,k.firstChild),mxEvent.addListener(m,"click",mxUtils.bind(this,function(c){this.saveLibrary(b.getTitle(),a,b,b.getMode(),b.constructor==LocalLibrary,!0,function(){null==m||b.isModified()||(f.style.paddingRight=18*k.childNodes.length+"px",m.parentNode.removeChild(m),m=null)});mxEvent.consume(c)})),f.style.paddingRight=18*k.childNodes.length+"px")}),B=mxUtils.bind(this,function(b,c,e,h){b=
n.cloneCells(mxUtils.sortCells(n.model.getTopmostCells(b)));for(var l=0;l<b.length;l++){var f=n.getCellGeometry(b[l]);null!=f&&f.translate(-c.x,-c.y)}d.appendChild(this.sidebar.createVertexTemplateFromCells(b,c.width,c.height,h||"",!0,!1,!1));b={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(b))),w:c.width,h:c.height};null!=h&&(b.title=h);a.push(b);D(e);null!=g&&null!=g.parentNode&&0<a.length&&(g.parentNode.removeChild(g),g=null)}),C=mxUtils.bind(this,function(b){if(n.isSelectionEmpty())n.getRubberband().isActive()?
(n.getRubberband().execute(b),n.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var a=n.getSelectionCells(),c=n.view.getBounds(a),e=n.view.scale;c.x/=e;c.y/=e;c.width/=e;c.height/=e;c.x-=n.view.translate.x;c.y-=n.view.translate.y;B(a,c)}mxEvent.consume(b)});d.style.border="3px solid transparent";mxEvent.addGestureListeners(d,function(){},mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&
(n.graphHandler.shape.node.style.visibility="hidden",null!=g?g.style.border="3px dotted rgb(254, 137, 12)":d.style.border="3px dotted rgb(254, 137, 12)",d.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(b))}),mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(d.style.border="3px solid transparent",
null!=g&&(g.style.border="3px dotted lightGray"),d.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,C(b),mxEvent.consume(b))}));mxEvent.addListener(d,"mouseleave",mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",d.style.border="3px solid transparent",d.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),
null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=g&&(g.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(d,"dragover",mxUtils.bind(this,function(b){null!=g?g.style.border="3px dotted rgb(254, 137, 12)":d.style.border="3px dotted rgb(254, 137, 12)";b.dataTransfer.dropEffect="copy";d.style.cursor="copy";this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()})),mxEvent.addListener(d,"drop",mxUtils.bind(this,function(b){d.style.border=
"3px solid transparent";d.style.cursor="";null!=g&&(g.style.border="3px dotted lightGray");0<b.dataTransfer.files.length&&this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,e,l,f,q,k,m,x,n){if(null!=c&&"image/"==e.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,q,k),c)],c[0].vertex=!0,B(c,new mxRectangle(0,0,q,k),b,mxEvent.isAltDown(b)?null:m.substring(0,
m.lastIndexOf(".")).replace(/_/g," ")),null!=g&&null!=g.parentNode&&0<a.length&&(g.parentNode.removeChild(g),g=null);else{var p=!1,t=mxUtils.bind(this,function(c,e){if(null!=c&&"text/xml"==e){var l=mxUtils.parseXml(c);if("mxlibrary"==l.documentElement.nodeName)try{var f=JSON.parse(mxUtils.getTextContent(l.documentElement));h(f,d);a=a.concat(f);D(b);this.spinner.stop();p=!0}catch(V){}else if("mxfile"==l.documentElement.nodeName)try{for(var q=l.documentElement.getElementsByTagName("diagram"),l=0;l<
q.length;l++){var f=mxUtils.getTextContent(q[l]),k=this.stringToCells(this.editor.graph.decompress(f)),m=this.editor.graph.getBoundingBoxFromGeometry(k);B(k,new mxRectangle(0,0,m.width,m.height),b)}p=!0}catch(V){null!=window.console&&console.log("error in drop handler:",V)}}p||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=g&&null!=g.parentNode&&0<a.length&&(g.parentNode.removeChild(g),g=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,
m)&&null!=n?this.parseFile(n,mxUtils.bind(this,function(b){4==b.readyState&&(this.spinner.stop(),200<=b.status&&299>=b.status?t(b.responseText,"text/xml"):this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):t(c,e)}}));b.stopPropagation();b.preventDefault()})),mxEvent.addListener(d,"dragleave",function(b){null!=g?g.style.border="3px dotted lightGray":(d.style.border="3px solid transparent",d.style.cursor="");b.stopPropagation();
b.preventDefault()}));q=q.cloneNode(!1);q.setAttribute("src",IMAGE_PATH+"/edit.gif");q.setAttribute("title",mxResources.get("edit"));k.insertBefore(q,k.firstChild);mxEvent.addListener(q,"click",A);mxEvent.addListener(d,"dblclick",function(b){mxEvent.getSource(b)==d&&A(b)});q=q.cloneNode(!1);q.setAttribute("src",Editor.plusImage);q.setAttribute("title",mxResources.get("add"));k.insertBefore(q,k.firstChild);this.isOffline()||".scratchpad"!=b.title||(c=document.createElement("span"),c.setAttribute("title",
mxResources.get("help")),c.style.cssText="color:gray;text-decoration:none;",c.className="geButton",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,mxUtils.bind(this,function(b){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(b)})),k.insertBefore(c,k.firstChild));var w=null;mxEvent.addListener(q,"click",C)}f.appendChild(k);f.style.paddingRight=18*k.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==
typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=
2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var b=document.getElementById("geFooter");if(null!=b){b.style.visibility="visible";var a=document.createElement("img");a.setAttribute("border","0");a.setAttribute("src",Dialog.prototype.closeImage);a.setAttribute("title",mxResources.get("hide"));b.appendChild(a);mxClient.IS_QUIRKS&&(a.style.position=
"relative",a.style.styleFloat="right",a.style.top="-30px",a.style.left="164px",a.style.cursor="pointer");mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return b});EditorUi.prototype.hideFooter=function(){var b=document.getElementById("geFooter");null!=b&&(this.footerHeight=0,b.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=function(b,a,c,d,g){b=new ImageDialog(this,b,a,c,d,g);this.showDialog(b.container,Graph.fileSupport?440:360,Graph.fileSupport?
200:90,!0,!0);b.init()};EditorUi.prototype.showBackgroundImageDialog=function(b){b=null!=b?b:mxUtils.bind(this,function(b){b=new ChangePageSetup(this,null,b);b.ignoreColor=!0;this.editor.graph.model.execute(b)});var a=new BackgroundImageDialog(this,mxUtils.bind(this,function(a){b(a)}));this.showDialog(a.container,360,200,!0,!0);a.init()};EditorUi.prototype.showLibraryDialog=function(b,a,c,d,g){b=new LibraryDialog(this,b,a,c,d,g);this.showDialog(b.container,620,440,!0,!1,mxUtils.bind(this,function(b){b&&
null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));b.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var b=this.createDiv("geSidebarContainer");b.style.position="absolute";b.style.overflow="hidden";b.style.borderWidth="3px";var a=document.createElement("a");a.setAttribute("href","javascript:void(0);");a.className="geTitle";a.style.height="100%";a.style.paddingTop="9px";mxUtils.write(a,mxResources.get("moreShapes")+"...");mxEvent.addListener(a,"click",mxUtils.bind(this,
function(b){this.actions.get("shapes").funct();mxEvent.consume(b)}));b.appendChild(a);return b};EditorUi.prototype.handleError=function(b,a,c){var e=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},g=null!=b&&null!=b.error?b.error:b;if(null!=g||null!=a){b=mxUtils.htmlEntities(mxResources.get("unknownError"));var d=mxResources.get("ok"),h=null;a=null!=a?a:mxResources.get("error");if(null!=g)if(null!=g.retry&&(d=mxResources.get("cancel"),h=function(){e();g.retry()}),"undefined"!=
typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&g.type==gapi.drive.realtime.ErrorType.FORBIDDEN)b=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==g.code||404==g.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&g.type==gapi.drive.realtime.ErrorType.NOT_FOUND){b=mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var f=window.location.hash;null!=f&&"#G"==f.substring(0,2)&&(f=f.substring(2),
b+=' <a href="https://drive.google.com/open?id='+f+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else g.code==App.ERROR_TIMEOUT?b=mxUtils.htmlEntities(mxResources.get("timeout")):g.code==App.ERROR_BUSY?b=mxUtils.htmlEntities(mxResources.get("busy")):null!=g.message?b=mxUtils.htmlEntities(g.message):null!=g.response&&null!=g.response.error&&(b=mxUtils.htmlEntities(g.response.error));this.showError(a,b,d,c,h)}else null!=c&&c()};EditorUi.prototype.showError=
function(b,a,c,d,g,f,k){b=new ErrorDialog(this,b,a,c,d,g,f,k);this.showDialog(b.container,340,150,!0,!1);b.init()};EditorUi.prototype.alert=function(b,a){var c=new ErrorDialog(this,null,b,mxResources.get("ok"),a);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(b,a,c,d,g){var e=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,b,function(){e();null!=a&&a()},function(){e();null!=c&&c()},d,g)).container,
340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(b){this.currentFile=b};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var b=this.editor.graph.getModel();return 1==b.getChildCount(b.root)&&0==b.getChildCount(b.getChildAt(b.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(b){return"data:image/svg+xml;base64,"+
btoa(unescape(encodeURIComponent(b)))};EditorUi.prototype.createImageDataUri=function(b,a,c){var e=b.toDataURL("image/"+c);if(6>=e.length||e==b.cloneNode(!1).toDataURL("image/"+c))throw{message:"Invalid image"};null!=a&&(e=this.writeGraphModelToPng(e,"zTXt","mxGraphModel",atob(this.editor.graph.compress(a))));return e};EditorUi.prototype.saveCanvas=function(b,a,c){var e="jpeg"==c?"jpg":c,g=this.getBaseFilename()+"."+e;b=this.createImageDataUri(b,a,c);this.saveData(g,e,b.substring(b.lastIndexOf(",")+
1),"image/"+c,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(b,a,c,d,g){if(window.Blob&&navigator.msSaveOrOpenBlob)b=d?this.base64ToBlob(b,c):new Blob([b],{type:c}),navigator.msSaveOrOpenBlob(b,a);else if(mxClient.IS_IE)c=
window.open("about:blank","_blank"),null==c?mxUtils.popup(b,!0):(c.document.write(b),c.document.close(),c.document.execCommand("SaveAs",!0,a),c.close());else if(mxClient.IS_IOS)a=new TextareaDialog(this,a+":",b,null,null,mxResources.get("close")),a.textarea.style.width="600px",a.textarea.style.height="380px",this.showDialog(a.container,620,460,!0,!0),a.init(),document.execCommand("selectall",!1,null);else{var e=document.createElement("a"),h=!mxClient.IS_SF&&"undefined"!==typeof e.download;if(h||this.isOffline()){e.href=
URL.createObjectURL(d?this.base64ToBlob(b,c):new Blob([b],{type:c}));h?e.download=a:e.setAttribute("target","_blank");document.body.appendChild(e);try{window.setTimeout(function(){URL.revokeObjectURL(e.href)},0),e.click(),e.parentNode.removeChild(e)}catch(t){}}else this.createEchoRequest(b,a,c,d,g).simulate(document,"_blank")}};EditorUi.prototype.createEchoRequest=function(b,a,c,d,g,f){b="xml="+encodeURIComponent(b);return new mxXmlRequest(SAVE_URL,b+(null!=c?"&mime="+c:"")+(null!=g?"&format="+g:
"")+(null!=f?"&base64="+f:"")+(null!=a?"&filename="+encodeURIComponent(a):"")+(d?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(b,a){a=a||"";for(var c=atob(b),e=c.length,g=Math.ceil(e/1024),d=Array(g),f=0;f<g;++f){for(var k=1024*f,m=Math.min(k+1024,e),q=Array(m-k),x=0;k<m;++x,++k)q[x]=c[k].charCodeAt(0);d[f]=new Uint8Array(q)}return new Blob(d,{type:a})};EditorUi.prototype.saveLocalFile=function(b,a,c,d,g,f){f=null!=f?f:!1;var e="vsdx"!=g&&(!mxClient.IS_IOS||!navigator.standalone);g=this.getServiceCount(f);
a=new CreateDialog(this,a,mxUtils.bind(this,function(a,e){try{if("_blank"==e)if(null==c||"image/"!=c.substring(0,6)||"image/svg"==c.substring(0,9)&&!mxClient.IS_SVG)g=window.open("about:blank"),null==g?mxUtils.popup(b,!0):(g.document.write(mxUtils.htmlEntities(b,!1)),g.document.close());else if(mxClient.IS_EDGE||11==document.documentMode||10==document.documentMode){var g=window.open("about:blank");null==g?mxUtils.popup(b,!0):(g.document.write('<html><img src="data:'+c+(d?";base64,"+b:";charset=utf8,"+
encodeURIComponent(b))+'"/></html>'),g.document.close())}else g=window.open("data:"+c+(d?";base64,"+b:";charset=utf8,"+encodeURIComponent(b))),null==g&&mxUtils.popup(b,!0);else e==App.MODE_DEVICE?this.doSaveLocalFile(b,a,c,d):null!=a&&0<a.length&&this.pickFolder(e,mxUtils.bind(this,function(g){try{this.exportFile(b,a,c,d,e,g)}catch(v){this.handleError(v)}}))}catch(x){this.handleError(x)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,f,
e,null,null,4<g?3:4,b,c,d);this.showDialog(a.container,380,4<g?390:270,!0,!0);a.init()};EditorUi.prototype.saveData=function(b,a,c,d,g){this.isLocalFileSave()?this.saveLocalFile(c,b,d,g,a):this.saveRequest(b,a,mxUtils.bind(this,function(b,e){return this.createEchoRequest(c,b,d,g,a,e)}),c,g,d)};EditorUi.prototype.saveRequest=function(b,a,c,d,g,f){var e=!mxClient.IS_IOS||!navigator.standalone,h=this.getServiceCount(!1);b=new CreateDialog(this,b,mxUtils.bind(this,function(b,e){if("_blank"==e||null!=
b&&0<b.length){var g=c("_blank"==e?null:b,e==App.MODE_DEVICE||null==e||"_blank"==e?"0":"1");null!=g&&(e==App.MODE_DEVICE||"_blank"==e?g.simulate(document,"_blank"):this.pickFolder(e,mxUtils.bind(this,function(c){f=null!=f?f:"pdf"==a?"application/pdf":"image/"+a;if(null!=d)try{this.exportFile(d,b,f,!0,e,c)}catch(A){this.handleError(A)}else this.spinner.spin(document.body,mxResources.get("saving"))&&g.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=g.getStatus()&&299>=g.getStatus())try{this.exportFile(g.getText(),
b,f,!0,e,c)}catch(A){this.handleError(A)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(b){this.spinner.stop();this.handleError(b)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,e,null,null,4<h?3:4,d,f,g);this.showDialog(b.container,380,4<h?390:270,!0,!0);b.init()};EditorUi.prototype.exportFile=function(b,a,c,d,g,f){};EditorUi.prototype.pickFolder=function(b,a,c){a(null)};EditorUi.prototype.exportSvg=
function(b,a,c,d,g,f,k,m,n){if(this.spinner.spin(document.body,mxResources.get("export"))){var e=this.editor.graph.isSelectionEmpty();c=null!=c?c:e;e=a?null:this.editor.graph.background;e==mxConstants.NONE&&(e=null);null==e&&0==a&&(e="#ffffff");var h=this.editor.graph.getSvg(e,b,k,m,null,c);d&&this.editor.graph.addSvgShadow(h);var l=this.getBaseFilename()+".svg",p=mxUtils.bind(this,function(b){this.spinner.stop();g&&b.setAttribute("content",this.getFileData(!0,null,null,null,c,n));var a='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+
mxUtils.getXml(b);this.isLocalFileSave()||a.length<=MAX_REQUEST_SIZE?this.saveData(l,"svg",a,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(a)}))});this.convertMath(this.editor.graph,h,!1,mxUtils.bind(this,function(){f?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(h,p,this.thumbImageCache)):p(h)}))}};EditorUi.prototype.addCheckbox=function(b,a,c,d,g,f){f=null!=f?f:!0;var e=
document.createElement("input");e.style.marginRight="8px";e.style.marginTop="16px";e.setAttribute("type","checkbox");c&&(e.setAttribute("checked","checked"),e.defaultChecked=!0);d&&e.setAttribute("disabled","disabled");f&&(b.appendChild(e),mxUtils.write(b,a),g||mxUtils.br(b));return e};EditorUi.prototype.addEditButton=function(b,a){var c=this.addCheckbox(b,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var e=this.getCurrentFile(),g="";null!=e&&e.getMode()!=App.MODE_DEVICE&&e.getMode()!=
App.MODE_BROWSER&&(g=window.location.href);var d=document.createElement("select");d.style.width="120px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("makeCopy"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","custom");mxUtils.write(e,mxResources.get("custom")+"...");d.appendChild(e);b.appendChild(d);mxEvent.addListener(d,"change",mxUtils.bind(this,
function(){if("custom"==d.value){var b=new FilenameDialog(this,g,mxResources.get("ok"),function(b){null!=b?g=b:d.value="blank"},mxResources.get("url"),null,null,null,null,function(){d.value="blank"});this.showDialog(b.container,300,80,!0,!1);b.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==a||a.checked)?d.removeAttribute("disabled"):d.setAttribute("disabled","disabled")}));mxUtils.br(b);return{getLink:function(){return c.checked?"blank"===d.value?"_blank":
g:null},getEditInput:function(){return c},getEditSelect:function(){return d}}};EditorUi.prototype.addLinkSection=function(b,a){function c(){f.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=d&&d!=mxConstants.NONE?"border:1px solid black;background-color:"+d:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(b,mxResources.get("links")+":");var e=document.createElement("select");
e.style.width="100px";e.style.marginLeft="8px";e.style.marginRight="10px";e.className="geBtn";var g=document.createElement("option");g.setAttribute("value","auto");mxUtils.write(g,mxResources.get("automatic"));e.appendChild(g);g=document.createElement("option");g.setAttribute("value","blank");mxUtils.write(g,mxResources.get("openInNewWindow"));e.appendChild(g);g=document.createElement("option");g.setAttribute("value","self");mxUtils.write(g,mxResources.get("openInThisWindow"));e.appendChild(g);a&&
(g=document.createElement("option"),g.setAttribute("value","frame"),mxUtils.write(g,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),e.appendChild(g));b.appendChild(e);mxUtils.write(b,mxResources.get("borderColor")+":");var d="#0000ff",f=null,f=mxUtils.button("",mxUtils.bind(this,function(b){this.pickColor(d||"none",function(b){d=b;c()});mxEvent.consume(b)}));c();f.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";f.style.marginLeft="4px";f.style.height="22px";f.style.width=
"22px";f.style.position="relative";f.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";f.className="geColorBtn";b.appendChild(f);mxUtils.br(b);return{getColor:function(){return d},getTarget:function(){return e.value},focus:function(){e.focus()}}};EditorUi.prototype.createLink=function(b,a,c,d,g,f,k,m){var e=this.getCurrentFile(),h=[];d&&(h.push("lightbox=1"),"auto"!=b&&h.push("target="+b),null!=a&&a!=mxConstants.NONE&&h.push("highlight="+("#"==a.charAt(0)?a.substring(1):a)),
null!=g&&0<g.length&&h.push("edit="+encodeURIComponent(g)),f&&h.push("layers=1"),this.editor.graph.foldingEnabled&&h.push("nav=1"));if(c&&null!=this.pages&&null!=this.currentPage)for(b=0;b<this.pages.length;b++)if(this.pages[b]==this.currentPage){0<b&&h.push("page="+b);break}b=!0;null!=k?c="#U"+encodeURIComponent(k):(e=this.getCurrentFile(),m||null==e||e.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):
(c="#"+e.getHash(),b=!1));b&&null!=e&&null!=e.getTitle()&&e.getTitle()!=this.defaultFilename&&h.push("title="+encodeURIComponent(e.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<h.length?"?"+h.join("&"):"")+c};EditorUi.prototype.createHtml=function(b,a,c,d,g,f,k,m,n,q,x){var e=this.getBasenames(),h={};""!=g&&g!=mxConstants.NONE&&(h.highlight=g);"auto"!==d&&(h.target=d);n||(h.lightbox=!1);h.nav=this.editor.graph.foldingEnabled;
c=parseInt(c);isNaN(c)||100==c||(h.zoom=c/100);c=[];k&&(c.push("pages"),h.resize=!0,null!=this.pages&&null!=this.currentPage&&(h.page=mxUtils.indexOf(this.pages,this.currentPage)));a&&(c.push("zoom"),h.resize=!0);m&&c.push("layers");0<c.length&&(n&&c.push("lightbox"),h.toolbar=c.join(" "));null!=q&&0<q.length&&(h.edit=q);null!=b?h.url=b:h.xml=this.getFileData(!0,null,null,null,null,!k);a='<div class="mxgraph" style="'+(f?"max-width:100%;":"")+(""!=c?"border:1px solid transparent;":"")+'" data-mxgraph="'+
mxUtils.htmlEntities(JSON.stringify(h))+'"></div>';e=0<e.length?"s="+e.join(";"):"";b=null!=b?"fetch="+encodeURIComponent(b):"";x(a,'<script type="text/javascript" src="'+(0<e.length||0<b.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+e:"https://www.draw.io/embed2.js?"+e)+"&"+b:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(b,a,c,d){var e=document.createElement("div");
e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(f);var h=document.createElement("div");h.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var l=document.createElement("input");l.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";l.setAttribute("value","url");l.setAttribute("type","radio");l.setAttribute("name",
"type-embedhtmldialog");f=l.cloneNode(!0);f.setAttribute("value","copy");h.appendChild(f);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));h.appendChild(k);mxUtils.br(h);h.appendChild(l);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));h.appendChild(k);var q=this.getCurrentFile();null==c&&null!=q&&q.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href",
"javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),h.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(q.getId())})));f.setAttribute("checked","checked");null==c&&l.setAttribute("disabled","disabled");e.appendChild(h);var m=this.addLinkSection(e),n=this.addCheckbox(e,mxResources.get("zoom"),!0,null,!0);mxUtils.write(e,":");var A=document.createElement("input");A.setAttribute("type","text");A.style.marginRight="16px";
A.style.width="60px";A.style.marginLeft="4px";A.style.marginRight="12px";A.value="100%";e.appendChild(A);var D=this.addCheckbox(e,mxResources.get("fit"),!0),h=null!=this.pages&&1<this.pages.length,B=B=this.addCheckbox(e,mxResources.get("allPages"),h,!h),C=this.addCheckbox(e,mxResources.get("layers"),!0),w=this.addCheckbox(e,mxResources.get("lightbox"),!0),y=this.addEditButton(e,w),E=y.getEditInput();E.style.marginBottom="16px";mxEvent.addListener(w,"change",function(){w.checked?E.removeAttribute("disabled"):
E.setAttribute("disabled","disabled");E.checked&&w.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){d(l.checked?c:null,n.checked,A.value,m.getTarget(),m.getColor(),D.checked,B.checked,C.checked,w.checked,y.getLink())}),null,b,a);this.showDialog(b.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(b,a,c,d,g,f){var e=document.createElement("div");e.style.whiteSpace=
"nowrap";var h=document.createElement("h3");mxUtils.write(h,b||mxResources.get("link"));h.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(h);var l=this.getCurrentFile(),h="https://desk.draw.io/support/solutions/articles/16000051941";b=0;if(null!=l&&l.constructor==window.DriveFile&&!a){b=80;var h="https://desk.draw.io/support/solutions/articles/16000039384",k=document.createElement("div");k.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";
var m=document.createElement("div");m.style.whiteSpace="normal";mxUtils.write(m,mxResources.get("linkAccountRequired"));k.appendChild(m);m=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(l.getId())}));m.style.marginTop="12px";m.className="geBtn";k.appendChild(m);e.appendChild(k);m=document.createElement("a");m.style.paddingLeft="12px";m.style.color="gray";m.style.fontSize="11px";m.setAttribute("href","javascript:void(0);");mxUtils.write(m,mxResources.get("check"));
k.appendChild(m);mxEvent.addListener(m,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(b){this.spinner.stop();b=new ErrorDialog(this,null,mxResources.get(null!=b?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(b.container,300,80,!0,!1);b.init()}))}))}var n=null,p=null;if(null!=c||null!=d)b+=30,mxUtils.write(e,mxResources.get("width")+":"),n=document.createElement("input"),
n.setAttribute("type","text"),n.style.marginRight="16px",n.style.width="50px",n.style.marginLeft="6px",n.style.marginRight="16px",n.style.marginBottom="10px",n.value="100%",e.appendChild(n),mxUtils.write(e,mxResources.get("height")+":"),p=document.createElement("input"),p.setAttribute("type","text"),p.style.width="50px",p.style.marginLeft="6px",p.style.marginBottom="10px",p.value=d+"px",e.appendChild(p),mxUtils.br(e);var D=this.addLinkSection(e,f);c=null!=this.pages&&1<this.pages.length;var B=null;
if(null==l||l.constructor!=window.DriveFile||a)B=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var C=this.addCheckbox(e,mxResources.get("lightbox"),!0),w=this.addEditButton(e,C),y=w.getEditInput(),E=this.addCheckbox(e,mxResources.get("layers"),!0);E.style.marginLeft=y.style.marginLeft;E.style.marginBottom="16px";E.style.marginTop="8px";mxEvent.addListener(C,"change",function(){C.checked?(E.removeAttribute("disabled"),y.removeAttribute("disabled")):(E.setAttribute("disabled","disabled"),y.setAttribute("disabled",
"disabled"));y.checked&&C.checked?w.getEditSelect().removeAttribute("disabled"):w.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){g(D.getTarget(),D.getColor(),null==B?!0:B.checked,C.checked,w.getLink(),E.checked,null!=n?n.value:null,null!=p?p.value:null)}),null,mxResources.get("create"),h);this.showDialog(a.container,340,246+b,!0,!0);null!=n?(n.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",
!1,null)):D.focus()};EditorUi.prototype.showRemoteExportDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var h=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),l=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),!0);null!=l&&
(l.style.marginBottom="16px");b=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!h.checked,null!=l?l.checked:!1)}),null,b,a);this.showDialog(b.container,300,d?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(b,a,c,d,g,f,k,m){k=null!=k?k:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=this.editor.graph,l="jpeg"==m?170:280,n=document.createElement("h3");mxUtils.write(n,b);n.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";e.appendChild(n);
mxUtils.write(e,mxResources.get("zoom")+":");var p=document.createElement("input");p.setAttribute("type","text");p.style.marginRight="16px";p.style.width="60px";p.style.marginLeft="4px";p.style.marginRight="12px";p.value=this.lastExportZoom||"100%";e.appendChild(p);mxUtils.write(e,mxResources.get("borderWidth")+":");var t=document.createElement("input");t.setAttribute("type","text");t.style.marginRight="16px";t.style.width="60px";t.style.marginLeft="4px";t.value=this.lastExportBorder||"0";e.appendChild(t);
mxUtils.br(e);var u=this.addCheckbox(e,mxResources.get("transparentBackground"),h.background==mxConstants.NONE||null==h.background,null,null,"jpeg"!=m),C=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,h.isSelectionEmpty()),w=document.createElement("input");w.style.marginTop="16px";w.style.marginRight="8px";w.style.marginLeft="24px";w.setAttribute("disabled","disabled");w.setAttribute("type","checkbox");f&&(e.appendChild(w),mxUtils.write(e,mxResources.get("crop")),mxUtils.br(e),l+=26,mxEvent.addListener(C,
"change",function(){C.checked?w.removeAttribute("disabled"):w.setAttribute("disabled","disabled")}));h.isSelectionEmpty()||(w.setAttribute("checked","checked"),w.defaultChecked=!0);var y=this.addCheckbox(e,mxResources.get("shadow"),h.shadowVisible),E=document.createElement("input");E.style.marginTop="16px";E.style.marginRight="8px";E.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||E.setAttribute("disabled","disabled");a&&(e.appendChild(E),mxUtils.write(e,mxResources.get("embedImages")),
mxUtils.br(e),l+=26);var L=this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=m),I=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(e,I?mxResources.get("allPages"):"",I,!I,null,"jpeg"!=m);F.style.marginLeft="24px";F.style.marginBottom="16px";I||(F.style.visibility="hidden");mxEvent.addListener(L,"change",function(){L.checked&&I?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});k&&I||F.setAttribute("disabled","disabled");b=new CustomDialog(this,
e,mxUtils.bind(this,function(){this.lastExportBorder=t.value;this.lastExportZoom=p.value;g(p.value,u.checked,!C.checked,y.checked,L.checked,E.checked,t.value,w.checked,!F.checked)}),null,c,d);this.showDialog(b.container,320,l,!0,!0);p.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?p.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(b,a,c,d,g){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=this.editor.graph;
if(null!=a){var h=document.createElement("h3");mxUtils.write(h,a);h.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(h)}var l=this.addCheckbox(e,mxResources.get("fit"),!0),k=this.addCheckbox(e,mxResources.get("shadow"),f.shadowVisible&&d,!d),m=this.addCheckbox(e,c),n=this.addCheckbox(e,mxResources.get("lightbox"),!0),A=this.addEditButton(e,n),D=A.getEditInput(),B=1<f.model.getChildCount(f.model.getRoot()),C=this.addCheckbox(e,mxResources.get("layers"),B,
!B);C.style.marginLeft=D.style.marginLeft;C.style.marginBottom="12px";C.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(B&&C.removeAttribute("disabled"),D.removeAttribute("disabled")):(C.setAttribute("disabled","disabled"),D.setAttribute("disabled","disabled"));D.checked&&n.checked?A.getEditSelect().removeAttribute("disabled"):A.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){b(l.checked,k.checked,m.checked,n.checked,
A.getLink(),C.checked)}),null,mxResources.get("embed"),g);this.showDialog(a.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(b,a,c,d,g,f,k,m){function e(a){var e=" ",l="";d&&(e=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));a=!0;if(EditorUi.enableLogging&&!this.isOffline()&&null!=b.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",b.getMode())}catch(g){}if(this.mode==b.getMode()&&b.getMode()!=App.MODE_DEVICE&&null!=b.getMode())try{this.addRecent({id:b.getHash(),title:b.getTitle(),mode:b.getMode()})}catch(g){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(g){}}catch(g){null!=window.console&&console.log("error in fileLoaded:",b,g);if(EditorUi.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=g&&null!=g.message?":err:"+encodeURIComponent(g.message):"")+(null!=g&&null!=g.stack?"&stack="+encodeURIComponent(g.stack):"")}catch(p){}this.handleError(g,
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=c?c.constructor==DriveFile?this.loadFile(c.getHash()):this.fileLoaded(c):d()}))}else d();return a};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(b,a,c,d,g,f,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==
this.scratchpad?this.getLocalData(".scratchpad",mxUtils.bind(this,function(b){null==b&&(b=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,b,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(b){var a=mxUtils.createXmlDocument(),c=a.createElement("mxlibrary");mxUtils.setTextContent(c,JSON.stringify(b));a.appendChild(c);return mxUtils.getXml(a)};EditorUi.prototype.closeLibrary=function(b){null!=b&&(this.removeLibrarySidebar(b.getHash()),
b.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(b.getHash()),".scratchpad"==b.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(b){var a=this.sidebar.palettes[b];if(null!=a){for(var c=0;c<a.length;c++)a[c].parentNode.removeChild(a[c]);delete this.sidebar.palettes[b]}};EditorUi.prototype.repositionLibrary=function(b){var a=this.sidebar.container;if(null==b){var c=this.sidebar.palettes["L.scratchpad"];null==c&&(c=this.sidebar.palettes.search);null!=c&&(b=c[c.length-
1].nextSibling)}b=null!=b?b:a.firstChild.nextSibling.nextSibling;var c=a.lastChild,d=c.previousSibling;a.insertBefore(c,b);a.insertBefore(d,c)};EditorUi.prototype.loadLibrary=function(b){var a=mxUtils.parseXml(b.getData());if("mxlibrary"==a.documentElement.nodeName){var c=JSON.parse(mxUtils.getTextContent(a.documentElement));this.libraryLoaded(b,c,a.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(b){return""};
EditorUi.prototype.libraryLoaded=function(b,a,c){b.constructor!=LocalLibrary&&mxSettings.addCustomLibrary(b.getHash());".scratchpad"==b.title&&(this.scratchpad=b);var e=this.sidebar.palettes[b.getHash()],e=null!=e?e[e.length-1].nextSibling:null;this.removeLibrarySidebar(b.getHash());var g=null,h=mxUtils.bind(this,function(a,c){if(0==a.length&&b.isEditable())null==g&&(g=document.createElement("div"),mxUtils.setPrefixedStyle(g.style,"borderRadius","6px"),g.style.border="3px dotted lightGray",g.style.textAlign=
"center",g.style.padding="8px",g.style.color="#B3B3B3",mxUtils.write(g,mxResources.get("dragElementsHere"))),c.appendChild(g);else for(var e=0;e<a.length;e++){var d=a[e],h=d.data;if(null!=h){var h=this.convertDataUri(h),l="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==d.aspect&&(l+="aspect=fixed;");c.appendChild(this.sidebar.createVertexTemplate(l+"image="+h,d.w,d.h,"",d.title||"",!1,!1,!1))}else null!=d.xml&&(h=this.stringToCells(this.editor.graph.decompress(d.xml)),
0<h.length&&c.appendChild(this.sidebar.createVertexTemplateFromCells(h,d.w,d.h,d.title||"",!0,!1,!1)))}});c=null!=c&&0<c.length?c:b.getTitle();var d=this.sidebar.addPalette(b.getHash(),c,!0,mxUtils.bind(this,function(b){h(a,b)}));this.repositionLibrary(e);var f=d.parentNode.previousSibling;c=f.getAttribute("title");null!=c&&0<c.length&&".scratchpad"!=b.title&&f.setAttribute("title",this.getLibraryStorageHint(b)+"\n"+c);var k=document.createElement("div");k.style.position="absolute";k.style.right=
"0px";k.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(k.style.backgroundColor="inherit");f.style.position="relative";var q=document.createElement("img");q.setAttribute("src",Dialog.prototype.closeImage);q.setAttribute("title",mxResources.get("close"));q.setAttribute("align","top");q.setAttribute("border","0");q.className="geButton";q.style.marginRight="1px";q.style.marginTop="-1px";k.appendChild(q);var m=null;mxEvent.addListener(q,"click",mxUtils.bind(this,function(a){if(!mxEvent.isConsumed(a)){var c=
mxUtils.bind(this,function(){this.closeLibrary(b)});null!=m?this.confirm(mxResources.get("allChangesLost"),null,c,mxResources.get("cancel"),mxResources.get("discardChanges")):c();mxEvent.consume(a)}}));mxEvent.addListener(d,"mousemove",mxUtils.bind(this,function(b){mxEvent.getSource(b)==d?d.setAttribute("title",mxResources.get("libraryTooltip")):d.removeAttribute("title")}));if(b.isEditable()){var n=this.editor.graph,A=mxUtils.bind(this,function(c){this.showLibraryDialog(b.getTitle(),d,a,b,b.getMode());
mxEvent.consume(c)}),D=mxUtils.bind(this,function(c){b.setModified(!0);b.isAutosave()?(null!=w&&null!=w.parentNode&&w.parentNode.removeChild(w),w=q.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",k.insertBefore(w,k.firstChild),f.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(b.getTitle(),a,b,b.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),
f.style.paddingRight=18*k.childNodes.length+"px")})):null==m&&(m=q.cloneNode(!1),m.setAttribute("src",IMAGE_PATH+"/download.png"),m.setAttribute("title",mxResources.get("save")),k.insertBefore(m,k.firstChild),mxEvent.addListener(m,"click",mxUtils.bind(this,function(c){this.saveLibrary(b.getTitle(),a,b,b.getMode(),b.constructor==LocalLibrary,!0,function(){null==m||b.isModified()||(f.style.paddingRight=18*k.childNodes.length+"px",m.parentNode.removeChild(m),m=null)});mxEvent.consume(c)})),f.style.paddingRight=
18*k.childNodes.length+"px")}),B=mxUtils.bind(this,function(b,c,e,h){b=n.cloneCells(mxUtils.sortCells(n.model.getTopmostCells(b)));for(var l=0;l<b.length;l++){var f=n.getCellGeometry(b[l]);null!=f&&f.translate(-c.x,-c.y)}d.appendChild(this.sidebar.createVertexTemplateFromCells(b,c.width,c.height,h||"",!0,!1,!1));b={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(b))),w:c.width,h:c.height};null!=h&&(b.title=h);a.push(b);D(e);null!=g&&null!=g.parentNode&&0<a.length&&(g.parentNode.removeChild(g),
g=null)}),C=mxUtils.bind(this,function(b){if(n.isSelectionEmpty())n.getRubberband().isActive()?(n.getRubberband().execute(b),n.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var a=n.getSelectionCells(),c=n.view.getBounds(a),e=n.view.scale;c.x/=e;c.y/=e;c.width/=e;c.height/=e;c.x-=n.view.translate.x;c.y-=n.view.translate.y;B(a,c)}mxEvent.consume(b)});d.style.border="3px solid transparent";mxEvent.addGestureListeners(d,
function(){},mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="hidden",null!=g?g.style.border="3px dotted rgb(254, 137, 12)":d.style.border="3px dotted rgb(254, 137, 12)",d.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(b))}),mxUtils.bind(this,
function(b){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(d.style.border="3px solid transparent",null!=g&&(g.style.border="3px dotted lightGray"),d.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,C(b),mxEvent.consume(b))}));mxEvent.addListener(d,"mouseleave",mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",d.style.border=
"3px solid transparent",d.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=g&&(g.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(d,"dragover",mxUtils.bind(this,function(b){null!=g?g.style.border="3px dotted rgb(254, 137, 12)":d.style.border="3px dotted rgb(254, 137, 12)";b.dataTransfer.dropEffect="copy";d.style.cursor="copy";this.sidebar.hideTooltip();
b.stopPropagation();b.preventDefault()})),mxEvent.addListener(d,"drop",mxUtils.bind(this,function(b){d.style.border="3px solid transparent";d.style.cursor="";null!=g&&(g.style.border="3px dotted lightGray");0<b.dataTransfer.files.length&&this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,e,l,f,q,k,m,x,n){if(null!=c&&"image/"==e.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",
new mxGeometry(0,0,q,k),c)],c[0].vertex=!0,B(c,new mxRectangle(0,0,q,k),b,mxEvent.isAltDown(b)?null:m.substring(0,m.lastIndexOf(".")).replace(/_/g," ")),null!=g&&null!=g.parentNode&&0<a.length&&(g.parentNode.removeChild(g),g=null);else{var p=!1,t=mxUtils.bind(this,function(c,e){if(null!=c&&"text/xml"==e){var l=mxUtils.parseXml(c);if("mxlibrary"==l.documentElement.nodeName)try{var f=JSON.parse(mxUtils.getTextContent(l.documentElement));h(f,d);a=a.concat(f);D(b);this.spinner.stop();p=!0}catch(V){}else if("mxfile"==
l.documentElement.nodeName)try{for(var q=l.documentElement.getElementsByTagName("diagram"),l=0;l<q.length;l++){var f=mxUtils.getTextContent(q[l]),k=this.stringToCells(this.editor.graph.decompress(f)),m=this.editor.graph.getBoundingBoxFromGeometry(k);B(k,new mxRectangle(0,0,m.width,m.height),b)}p=!0}catch(V){null!=window.console&&console.log("error in drop handler:",V)}}p||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=g&&null!=g.parentNode&&0<a.length&&
(g.parentNode.removeChild(g),g=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,m)&&null!=n?this.parseFile(n,mxUtils.bind(this,function(b){4==b.readyState&&(this.spinner.stop(),200<=b.status&&299>=b.status?t(b.responseText,"text/xml"):this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):t(c,e)}}));b.stopPropagation();b.preventDefault()})),mxEvent.addListener(d,"dragleave",function(b){null!=
g?g.style.border="3px dotted lightGray":(d.style.border="3px solid transparent",d.style.cursor="");b.stopPropagation();b.preventDefault()}));q=q.cloneNode(!1);q.setAttribute("src",IMAGE_PATH+"/edit.gif");q.setAttribute("title",mxResources.get("edit"));k.insertBefore(q,k.firstChild);mxEvent.addListener(q,"click",A);mxEvent.addListener(d,"dblclick",function(b){mxEvent.getSource(b)==d&&A(b)});q=q.cloneNode(!1);q.setAttribute("src",Editor.plusImage);q.setAttribute("title",mxResources.get("add"));k.insertBefore(q,
k.firstChild);this.isOffline()||".scratchpad"!=b.title||(c=document.createElement("span"),c.setAttribute("title",mxResources.get("help")),c.style.cssText="color:gray;text-decoration:none;",c.className="geButton",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,mxUtils.bind(this,function(b){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(b)})),k.insertBefore(c,k.firstChild));var w=null;mxEvent.addListener(q,"click",C)}f.appendChild(k);f.style.paddingRight=
18*k.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=
46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var b=document.getElementById("geFooter");if(null!=b){b.style.visibility="visible";var a=document.createElement("img");a.setAttribute("border","0");a.setAttribute("src",
Dialog.prototype.closeImage);a.setAttribute("title",mxResources.get("hide"));b.appendChild(a);mxClient.IS_QUIRKS&&(a.style.position="relative",a.style.styleFloat="right",a.style.top="-30px",a.style.left="164px",a.style.cursor="pointer");mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return b});EditorUi.prototype.hideFooter=function(){var b=document.getElementById("geFooter");null!=b&&(this.footerHeight=0,b.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=
function(b,a,c,d,g){b=new ImageDialog(this,b,a,c,d,g);this.showDialog(b.container,Graph.fileSupport?440:360,Graph.fileSupport?200:90,!0,!0);b.init()};EditorUi.prototype.showBackgroundImageDialog=function(b){b=null!=b?b:mxUtils.bind(this,function(b){b=new ChangePageSetup(this,null,b);b.ignoreColor=!0;this.editor.graph.model.execute(b)});var a=new BackgroundImageDialog(this,mxUtils.bind(this,function(a){b(a)}));this.showDialog(a.container,360,200,!0,!0);a.init()};EditorUi.prototype.showLibraryDialog=
function(b,a,c,d,g){b=new LibraryDialog(this,b,a,c,d,g);this.showDialog(b.container,620,440,!0,!1,mxUtils.bind(this,function(b){b&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));b.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var b=this.createDiv("geSidebarContainer");b.style.position="absolute";b.style.overflow="hidden";b.style.borderWidth="3px";var a=document.createElement("a");a.setAttribute("href","javascript:void(0);");a.className="geTitle";a.style.height=
"100%";a.style.paddingTop="9px";mxUtils.write(a,mxResources.get("moreShapes")+"...");mxEvent.addListener(a,"click",mxUtils.bind(this,function(b){this.actions.get("shapes").funct();mxEvent.consume(b)}));b.appendChild(a);return b};EditorUi.prototype.handleError=function(b,a,c){var e=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},g=null!=b&&null!=b.error?b.error:b;if(null!=g||null!=a){b=mxUtils.htmlEntities(mxResources.get("unknownError"));var d=mxResources.get("ok"),
h=null;a=null!=a?a:mxResources.get("error");if(null!=g)if(null!=g.retry&&(d=mxResources.get("cancel"),h=function(){e();g.retry()}),"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&g.type==gapi.drive.realtime.ErrorType.FORBIDDEN)b=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==g.code||404==g.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&g.type==gapi.drive.realtime.ErrorType.NOT_FOUND){b=
mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var f=window.location.hash;null!=f&&"#G"==f.substring(0,2)&&(f=f.substring(2),b+=' <a href="https://drive.google.com/open?id='+f+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else g.code==App.ERROR_TIMEOUT?b=mxUtils.htmlEntities(mxResources.get("timeout")):g.code==App.ERROR_BUSY?b=mxUtils.htmlEntities(mxResources.get("busy")):null!=g.message?b=mxUtils.htmlEntities(g.message):null!=g.response&&
null!=g.response.error&&(b=mxUtils.htmlEntities(g.response.error));this.showError(a,b,d,c,h)}else null!=c&&c()};EditorUi.prototype.showError=function(b,a,c,d,g,f,k){b=new ErrorDialog(this,b,a,c,d,g,f,k);this.showDialog(b.container,340,150,!0,!1);b.init()};EditorUi.prototype.alert=function(b,a){var c=new ErrorDialog(this,null,b,mxResources.get("ok"),a);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(b,a,c,d,g){var e=null!=this.spinner&&null!=this.spinner.pause?
this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,b,function(){e();null!=a&&a()},function(){e();null!=c&&c()},d,g)).container,340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(b){this.currentFile=b};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var b=this.editor.graph.getModel();return 1==b.getChildCount(b.root)&&0==b.getChildCount(b.getChildAt(b.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||
!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(b){return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(b)))};EditorUi.prototype.createImageDataUri=function(b,a,c){var e=b.toDataURL("image/"+c);if(6>=e.length||e==b.cloneNode(!1).toDataURL("image/"+c))throw{message:"Invalid image"};null!=a&&(e=this.writeGraphModelToPng(e,"zTXt","mxGraphModel",atob(this.editor.graph.compress(a))));return e};EditorUi.prototype.saveCanvas=function(b,
a,c){var e="jpeg"==c?"jpg":c,g=this.getBaseFilename()+"."+e;b=this.createImageDataUri(b,a,c);this.saveData(g,e,b.substring(b.lastIndexOf(",")+1),"image/"+c,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(b,
a,c,d,g){if(window.Blob&&navigator.msSaveOrOpenBlob)b=d?this.base64ToBlob(b,c):new Blob([b],{type:c}),navigator.msSaveOrOpenBlob(b,a);else if(mxClient.IS_IE)c=window.open("about:blank","_blank"),null==c?mxUtils.popup(b,!0):(c.document.write(b),c.document.close(),c.document.execCommand("SaveAs",!0,a),c.close());else if(mxClient.IS_IOS)a=new TextareaDialog(this,a+":",b,null,null,mxResources.get("close")),a.textarea.style.width="600px",a.textarea.style.height="380px",this.showDialog(a.container,620,
460,!0,!0),a.init(),document.execCommand("selectall",!1,null);else{var e=document.createElement("a"),h=!mxClient.IS_SF&&"undefined"!==typeof e.download;if(h||this.isOffline()){e.href=URL.createObjectURL(d?this.base64ToBlob(b,c):new Blob([b],{type:c}));h?e.download=a:e.setAttribute("target","_blank");document.body.appendChild(e);try{window.setTimeout(function(){URL.revokeObjectURL(e.href)},0),e.click(),e.parentNode.removeChild(e)}catch(t){}}else this.createEchoRequest(b,a,c,d,g).simulate(document,
"_blank")}};EditorUi.prototype.createEchoRequest=function(b,a,c,d,g,f){b="xml="+encodeURIComponent(b);return new mxXmlRequest(SAVE_URL,b+(null!=c?"&mime="+c:"")+(null!=g?"&format="+g:"")+(null!=f?"&base64="+f:"")+(null!=a?"&filename="+encodeURIComponent(a):"")+(d?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(b,a){a=a||"";for(var c=atob(b),e=c.length,g=Math.ceil(e/1024),d=Array(g),f=0;f<g;++f){for(var k=1024*f,m=Math.min(k+1024,e),q=Array(m-k),x=0;k<m;++x,++k)q[x]=c[k].charCodeAt(0);d[f]=
new Uint8Array(q)}return new Blob(d,{type:a})};EditorUi.prototype.saveLocalFile=function(b,a,c,d,g,f){f=null!=f?f:!1;var e="vsdx"!=g&&(!mxClient.IS_IOS||!navigator.standalone);g=this.getServiceCount(f);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,e){try{if("_blank"==e)if(null==c||"image/"!=c.substring(0,6)||"image/svg"==c.substring(0,9)&&!mxClient.IS_SVG)g=window.open("about:blank"),null==g?mxUtils.popup(b,!0):(g.document.write(mxUtils.htmlEntities(b,!1)),g.document.close());else if(mxClient.IS_EDGE||
11==document.documentMode||10==document.documentMode){var g=window.open("about:blank");null==g?mxUtils.popup(b,!0):(g.document.write('<html><img src="data:'+c+(d?";base64,"+b:";charset=utf8,"+encodeURIComponent(b))+'"/></html>'),g.document.close())}else g=window.open("data:"+c+(d?";base64,"+b:";charset=utf8,"+encodeURIComponent(b))),null==g&&mxUtils.popup(b,!0);else e==App.MODE_DEVICE?this.doSaveLocalFile(b,a,c,d):null!=a&&0<a.length&&this.pickFolder(e,mxUtils.bind(this,function(g){try{this.exportFile(b,
a,c,d,e,g)}catch(v){this.handleError(v)}}))}catch(x){this.handleError(x)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,f,e,null,null,4<g?3:4,b,c,d);this.showDialog(a.container,380,4<g?390:270,!0,!0);a.init()};EditorUi.prototype.saveData=function(b,a,c,d,g){this.isLocalFileSave()?this.saveLocalFile(c,b,d,g,a):this.saveRequest(b,a,mxUtils.bind(this,function(b,e){return this.createEchoRequest(c,b,d,g,a,e)}),c,g,d)};EditorUi.prototype.saveRequest=
function(b,a,c,d,g,f){var e=!mxClient.IS_IOS||!navigator.standalone,h=this.getServiceCount(!1);b=new CreateDialog(this,b,mxUtils.bind(this,function(b,e){if("_blank"==e||null!=b&&0<b.length){var g=c("_blank"==e?null:b,e==App.MODE_DEVICE||null==e||"_blank"==e?"0":"1");null!=g&&(e==App.MODE_DEVICE||"_blank"==e?g.simulate(document,"_blank"):this.pickFolder(e,mxUtils.bind(this,function(c){f=null!=f?f:"pdf"==a?"application/pdf":"image/"+a;if(null!=d)try{this.exportFile(d,b,f,!0,e,c)}catch(A){this.handleError(A)}else this.spinner.spin(document.body,
mxResources.get("saving"))&&g.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=g.getStatus()&&299>=g.getStatus())try{this.exportFile(g.getText(),b,f,!0,e,c)}catch(A){this.handleError(A)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(b){this.spinner.stop();this.handleError(b)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,e,null,null,4<h?3:4,d,f,g);this.showDialog(b.container,380,4<h?
390:270,!0,!0);b.init()};EditorUi.prototype.exportFile=function(b,a,c,d,g,f){};EditorUi.prototype.pickFolder=function(b,a,c){a(null)};EditorUi.prototype.exportSvg=function(b,a,c,d,g,f,k,m,n){if(this.spinner.spin(document.body,mxResources.get("export"))){var e=this.editor.graph.isSelectionEmpty();c=null!=c?c:e;e=a?null:this.editor.graph.background;e==mxConstants.NONE&&(e=null);null==e&&0==a&&(e="#ffffff");var h=this.editor.graph.getSvg(e,b,k,m,null,c);d&&this.editor.graph.addSvgShadow(h);var l=this.getBaseFilename()+
".svg",p=mxUtils.bind(this,function(b){this.spinner.stop();g&&b.setAttribute("content",this.getFileData(!0,null,null,null,c,n));var a='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(b);this.isLocalFileSave()||a.length<=MAX_REQUEST_SIZE?this.saveData(l,"svg",a,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(a)}))});this.convertMath(this.editor.graph,
h,!1,mxUtils.bind(this,function(){f?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(h,p,this.thumbImageCache)):p(h)}))}};EditorUi.prototype.addCheckbox=function(b,a,c,d,g,f){f=null!=f?f:!0;var e=document.createElement("input");e.style.marginRight="8px";e.style.marginTop="16px";e.setAttribute("type","checkbox");c&&(e.setAttribute("checked","checked"),e.defaultChecked=!0);d&&e.setAttribute("disabled","disabled");f&&(b.appendChild(e),mxUtils.write(b,a),g||mxUtils.br(b));return e};
EditorUi.prototype.addEditButton=function(b,a){var c=this.addCheckbox(b,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var e=this.getCurrentFile(),g="";null!=e&&e.getMode()!=App.MODE_DEVICE&&e.getMode()!=App.MODE_BROWSER&&(g=window.location.href);var d=document.createElement("select");d.style.width="120px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("makeCopy"));
d.appendChild(e);e=document.createElement("option");e.setAttribute("value","custom");mxUtils.write(e,mxResources.get("custom")+"...");d.appendChild(e);b.appendChild(d);mxEvent.addListener(d,"change",mxUtils.bind(this,function(){if("custom"==d.value){var b=new FilenameDialog(this,g,mxResources.get("ok"),function(b){null!=b?g=b:d.value="blank"},mxResources.get("url"),null,null,null,null,function(){d.value="blank"});this.showDialog(b.container,300,80,!0,!1);b.init()}}));mxEvent.addListener(c,"change",
mxUtils.bind(this,function(){c.checked&&(null==a||a.checked)?d.removeAttribute("disabled"):d.setAttribute("disabled","disabled")}));mxUtils.br(b);return{getLink:function(){return c.checked?"blank"===d.value?"_blank":g:null},getEditInput:function(){return c},getEditSelect:function(){return d}}};EditorUi.prototype.addLinkSection=function(b,a){function c(){f.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=d&&d!=mxConstants.NONE?"border:1px solid black;background-color:"+
d:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(b,mxResources.get("links")+":");var e=document.createElement("select");e.style.width="100px";e.style.marginLeft="8px";e.style.marginRight="10px";e.className="geBtn";var g=document.createElement("option");g.setAttribute("value","auto");mxUtils.write(g,mxResources.get("automatic"));e.appendChild(g);g=document.createElement("option");g.setAttribute("value",
"blank");mxUtils.write(g,mxResources.get("openInNewWindow"));e.appendChild(g);g=document.createElement("option");g.setAttribute("value","self");mxUtils.write(g,mxResources.get("openInThisWindow"));e.appendChild(g);a&&(g=document.createElement("option"),g.setAttribute("value","frame"),mxUtils.write(g,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),e.appendChild(g));b.appendChild(e);mxUtils.write(b,mxResources.get("borderColor")+":");var d="#0000ff",f=null,f=mxUtils.button("",
mxUtils.bind(this,function(b){this.pickColor(d||"none",function(b){d=b;c()});mxEvent.consume(b)}));c();f.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";f.style.marginLeft="4px";f.style.height="22px";f.style.width="22px";f.style.position="relative";f.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";f.className="geColorBtn";b.appendChild(f);mxUtils.br(b);return{getColor:function(){return d},getTarget:function(){return e.value},focus:function(){e.focus()}}};EditorUi.prototype.createLink=
function(b,a,c,d,g,f,k,m){var e=this.getCurrentFile(),h=[];d&&(h.push("lightbox=1"),"auto"!=b&&h.push("target="+b),null!=a&&a!=mxConstants.NONE&&h.push("highlight="+("#"==a.charAt(0)?a.substring(1):a)),null!=g&&0<g.length&&h.push("edit="+encodeURIComponent(g)),f&&h.push("layers=1"),this.editor.graph.foldingEnabled&&h.push("nav=1"));if(c&&null!=this.pages&&null!=this.currentPage)for(b=0;b<this.pages.length;b++)if(this.pages[b]==this.currentPage){0<b&&h.push("page="+b);break}b=!0;null!=k?c="#U"+encodeURIComponent(k):
(e=this.getCurrentFile(),m||null==e||e.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(c="#"+e.getHash(),b=!1));b&&null!=e&&null!=e.getTitle()&&e.getTitle()!=this.defaultFilename&&h.push("title="+encodeURIComponent(e.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<h.length?"?"+h.join("&"):"")+
c};EditorUi.prototype.createHtml=function(b,a,c,d,g,f,k,m,n,q,x){var e=this.getBasenames(),h={};""!=g&&g!=mxConstants.NONE&&(h.highlight=g);"auto"!==d&&(h.target=d);n||(h.lightbox=!1);h.nav=this.editor.graph.foldingEnabled;c=parseInt(c);isNaN(c)||100==c||(h.zoom=c/100);c=[];k&&(c.push("pages"),h.resize=!0,null!=this.pages&&null!=this.currentPage&&(h.page=mxUtils.indexOf(this.pages,this.currentPage)));a&&(c.push("zoom"),h.resize=!0);m&&c.push("layers");0<c.length&&(n&&c.push("lightbox"),h.toolbar=
c.join(" "));null!=q&&0<q.length&&(h.edit=q);null!=b?h.url=b:h.xml=this.getFileData(!0,null,null,null,null,!k);a='<div class="mxgraph" style="'+(f?"max-width:100%;":"")+(""!=c?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(h))+'"></div>';e=0<e.length?"s="+e.join(";"):"";b=null!=b?"fetch="+encodeURIComponent(b):"";x(a,'<script type="text/javascript" src="'+(0<e.length||0<b.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+e:"https://www.draw.io/embed2.js?"+
e)+"&"+b:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(f);var h=document.createElement("div");h.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";
var l=document.createElement("input");l.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";l.setAttribute("value","url");l.setAttribute("type","radio");l.setAttribute("name","type-embedhtmldialog");f=l.cloneNode(!0);f.setAttribute("value","copy");h.appendChild(f);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));h.appendChild(k);mxUtils.br(h);h.appendChild(l);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));
h.appendChild(k);var q=this.getCurrentFile();null==c&&null!=q&&q.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href","javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),h.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(q.getId())})));f.setAttribute("checked","checked");null==c&&l.setAttribute("disabled","disabled");e.appendChild(h);var m=
this.addLinkSection(e),n=this.addCheckbox(e,mxResources.get("zoom"),!0,null,!0);mxUtils.write(e,":");var A=document.createElement("input");A.setAttribute("type","text");A.style.marginRight="16px";A.style.width="60px";A.style.marginLeft="4px";A.style.marginRight="12px";A.value="100%";e.appendChild(A);var D=this.addCheckbox(e,mxResources.get("fit"),!0),h=null!=this.pages&&1<this.pages.length,B=B=this.addCheckbox(e,mxResources.get("allPages"),h,!h),C=this.addCheckbox(e,mxResources.get("layers"),!0),
w=this.addCheckbox(e,mxResources.get("lightbox"),!0),y=this.addEditButton(e,w),E=y.getEditInput();E.style.marginBottom="16px";mxEvent.addListener(w,"change",function(){w.checked?E.removeAttribute("disabled"):E.setAttribute("disabled","disabled");E.checked&&w.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){d(l.checked?c:null,n.checked,A.value,m.getTarget(),m.getColor(),D.checked,B.checked,
C.checked,w.checked,y.getLink())}),null,b,a);this.showDialog(b.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(b,a,c,d,g,f){var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=document.createElement("h3");mxUtils.write(h,b||mxResources.get("link"));h.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(h);var l=this.getCurrentFile(),h="https://desk.draw.io/support/solutions/articles/16000051941";b=0;if(null!=
l&&l.constructor==window.DriveFile&&!a){b=80;var h="https://desk.draw.io/support/solutions/articles/16000039384",k=document.createElement("div");k.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var m=document.createElement("div");m.style.whiteSpace="normal";mxUtils.write(m,mxResources.get("linkAccountRequired"));k.appendChild(m);m=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(l.getId())}));
m.style.marginTop="12px";m.className="geBtn";k.appendChild(m);e.appendChild(k);m=document.createElement("a");m.style.paddingLeft="12px";m.style.color="gray";m.style.fontSize="11px";m.setAttribute("href","javascript:void(0);");mxUtils.write(m,mxResources.get("check"));k.appendChild(m);mxEvent.addListener(m,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(b){this.spinner.stop();b=new ErrorDialog(this,
null,mxResources.get(null!=b?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(b.container,300,80,!0,!1);b.init()}))}))}var n=null,p=null;if(null!=c||null!=d)b+=30,mxUtils.write(e,mxResources.get("width")+":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.marginRight="16px",n.style.width="50px",n.style.marginLeft="6px",n.style.marginRight="16px",n.style.marginBottom="10px",n.value="100%",e.appendChild(n),mxUtils.write(e,mxResources.get("height")+
":"),p=document.createElement("input"),p.setAttribute("type","text"),p.style.width="50px",p.style.marginLeft="6px",p.style.marginBottom="10px",p.value=d+"px",e.appendChild(p),mxUtils.br(e);var D=this.addLinkSection(e,f);c=null!=this.pages&&1<this.pages.length;var B=null;if(null==l||l.constructor!=window.DriveFile||a)B=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var C=this.addCheckbox(e,mxResources.get("lightbox"),!0),w=this.addEditButton(e,C),y=w.getEditInput(),E=this.addCheckbox(e,mxResources.get("layers"),
!0);E.style.marginLeft=y.style.marginLeft;E.style.marginBottom="16px";E.style.marginTop="8px";mxEvent.addListener(C,"change",function(){C.checked?(E.removeAttribute("disabled"),y.removeAttribute("disabled")):(E.setAttribute("disabled","disabled"),y.setAttribute("disabled","disabled"));y.checked&&C.checked?w.getEditSelect().removeAttribute("disabled"):w.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){g(D.getTarget(),D.getColor(),null==B?
!0:B.checked,C.checked,w.getLink(),E.checked,null!=n?n.value:null,null!=p?p.value:null)}),null,mxResources.get("create"),h);this.showDialog(a.container,340,246+b,!0,!0);null!=n?(n.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null)):D.focus()};EditorUi.prototype.showRemoteExportDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));
f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var h=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),l=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),!0);null!=l&&(l.style.marginBottom="16px");b=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!h.checked,null!=l?l.checked:!1)}),null,b,a);this.showDialog(b.container,300,d?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(b,
a,c,d,g,f,k,m){k=null!=k?k:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var h=this.editor.graph,l="jpeg"==m?170:280,n=document.createElement("h3");mxUtils.write(n,b);n.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";e.appendChild(n);mxUtils.write(e,mxResources.get("zoom")+":");var p=document.createElement("input");p.setAttribute("type","text");p.style.marginRight="16px";p.style.width="60px";p.style.marginLeft="4px";p.style.marginRight="12px";p.value=
this.lastExportZoom||"100%";e.appendChild(p);mxUtils.write(e,mxResources.get("borderWidth")+":");var t=document.createElement("input");t.setAttribute("type","text");t.style.marginRight="16px";t.style.width="60px";t.style.marginLeft="4px";t.value=this.lastExportBorder||"0";e.appendChild(t);mxUtils.br(e);var u=this.addCheckbox(e,mxResources.get("transparentBackground"),h.background==mxConstants.NONE||null==h.background,null,null,"jpeg"!=m),C=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,h.isSelectionEmpty()),
w=document.createElement("input");w.style.marginTop="16px";w.style.marginRight="8px";w.style.marginLeft="24px";w.setAttribute("disabled","disabled");w.setAttribute("type","checkbox");f&&(e.appendChild(w),mxUtils.write(e,mxResources.get("crop")),mxUtils.br(e),l+=26,mxEvent.addListener(C,"change",function(){C.checked?w.removeAttribute("disabled"):w.setAttribute("disabled","disabled")}));h.isSelectionEmpty()||(w.setAttribute("checked","checked"),w.defaultChecked=!0);var y=this.addCheckbox(e,mxResources.get("shadow"),
h.shadowVisible),E=document.createElement("input");E.style.marginTop="16px";E.style.marginRight="8px";E.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||E.setAttribute("disabled","disabled");a&&(e.appendChild(E),mxUtils.write(e,mxResources.get("embedImages")),mxUtils.br(e),l+=26);var L=this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=m),I=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(e,I?mxResources.get("allPages"):"",I,!I,null,"jpeg"!=
m);F.style.marginLeft="24px";F.style.marginBottom="16px";I||(F.style.visibility="hidden");mxEvent.addListener(L,"change",function(){L.checked&&I?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});k&&I||F.setAttribute("disabled","disabled");b=new CustomDialog(this,e,mxUtils.bind(this,function(){this.lastExportBorder=t.value;this.lastExportZoom=p.value;g(p.value,u.checked,!C.checked,y.checked,L.checked,E.checked,t.value,w.checked,!F.checked)}),null,c,d);this.showDialog(b.container,
320,l,!0,!0);p.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?p.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(b,a,c,d,g){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=this.editor.graph;if(null!=a){var h=document.createElement("h3");mxUtils.write(h,a);h.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(h)}var l=this.addCheckbox(e,mxResources.get("fit"),!0),
k=this.addCheckbox(e,mxResources.get("shadow"),f.shadowVisible&&d,!d),m=this.addCheckbox(e,c),n=this.addCheckbox(e,mxResources.get("lightbox"),!0),A=this.addEditButton(e,n),D=A.getEditInput(),B=1<f.model.getChildCount(f.model.getRoot()),C=this.addCheckbox(e,mxResources.get("layers"),B,!B);C.style.marginLeft=D.style.marginLeft;C.style.marginBottom="12px";C.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(B&&C.removeAttribute("disabled"),D.removeAttribute("disabled")):(C.setAttribute("disabled",
"disabled"),D.setAttribute("disabled","disabled"));D.checked&&n.checked?A.getEditSelect().removeAttribute("disabled"):A.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){b(l.checked,k.checked,m.checked,n.checked,A.getLink(),C.checked)}),null,mxResources.get("embed"),g);this.showDialog(a.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(b,a,c,d,g,f,k,m){function e(a){var e=" ",l="";d&&(e=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
(g?"&edit=_blank":"")+(f?"&layers=1":"")+"');}})(this);\"",l+="cursor:pointer;");b&&(l+="max-width:100%;");var q="";c&&(q=' width="'+Math.round(h.width)+'" height="'+Math.round(h.height)+'"');k('<img src="'+a+'"'+q+(""!=l?' style="'+l+'"':"")+e+"/>")}var h=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(b){var a=d?this.getFileData(!0):null;b=this.createImageDataUri(b,a,"png");e(b)}),null,null,null,mxUtils.bind(this,function(b){m({message:mxResources.get("unknownError")})}),
null,!0,c?2:1,null,a);else if(a=this.getFileData(!0),h.width*h.height<=MAX_AREA&&a.length<=MAX_REQUEST_SIZE){var l="";c&&(l="&w="+Math.round(2*h.width)+"&h="+Math.round(2*h.height));var n=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(d?"1":"0")+l+"&xml="+encodeURIComponent(a));n.send(mxUtils.bind(this,function(){200<=n.getStatus()&&299>=n.getStatus()?e("data:image/png;base64,"+n.getText()):m({message:mxResources.get("unknownError")})}))}else m({message:mxResources.get("drawingTooLarge")})};
EditorUi.prototype.createEmbedSvg=function(b,a,c,d,g,f,k){var e=this.editor.graph.getSvg(),h=e.getElementsByTagName("a");if(null!=h)for(var l=0;l<h.length;l++){var m=h[l].getAttribute("href");null!=m&&"#"==m.charAt(0)&&"_blank"==h[l].getAttribute("target")&&h[l].removeAttribute("target")}d&&e.setAttribute("content",this.getFileData(!0));a&&this.editor.graph.addSvgShadow(e);if(c){var n=" ",p="";d&&(n="onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+

View file

@ -1309,8 +1309,8 @@
this.editor.fireEvent(new mxEventObject('fileLoaded'));
result = true;
if (this.enableLogging && !this.isOffline() && file.getMode() != null)
if (EditorUi.enableLogging && !this.isOffline() && file.getMode() != null)
{
try
{
@ -1355,21 +1355,21 @@
console.log('error in fileLoaded:', file, e);
}
if (this.enableLogging && !this.isOffline())
if (EditorUi.enableLogging && !this.isOffline())
{
try
{
var img = new Image();
var logDomain = window.DRAWIO_LOG_URL != null ? window.DRAWIO_LOG_URL : '';
img.src = logDomain + '/log?v=' + encodeURIComponent(EditorUi.VERSION) +
'&msg=errorInFileLoaded:url:' + encodeURIComponent(window.location.href) +
((e != null && e.message != null) ? ':err:' + encodeURIComponent(e.message) : '') +
((e != null && e.stack != null) ? '&stack=' + encodeURIComponent(e.stack) : '');
}
catch (e)
{
// ignore
}
try
{
var img = new Image();
var logDomain = window.DRAWIO_LOG_URL != null ? window.DRAWIO_LOG_URL : '';
img.src = logDomain + '/log?v=' + encodeURIComponent(EditorUi.VERSION) +
'&msg=errorInFileLoaded:url:' + encodeURIComponent(window.location.href) +
((e != null && e.message != null) ? ':err:' + encodeURIComponent(e.message) : '') +
((e != null && e.stack != null) ? '&stack=' + encodeURIComponent(e.stack) : '');
}
catch (e)
{
// ignore
}
}
// Asynchronous handling of errors

View file

@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+x.join(",")+"}";f=t;return l}}"function"!==typeof Date.prototy
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=""+a;d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();var mxBasePath="https://www.draw.io/mxgraph/",mxLoadStylesheets=mxLoadResources=!1,mxLanguage="en";window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"7.2.6",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"7.2.7",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||

View file

@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+x.join(",")+"}";f=t;return l}}"function"!==typeof Date.prototy
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=""+a;d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();var mxBasePath="https://www.draw.io/mxgraph/",mxLoadStylesheets=mxLoadResources=!1,mxLanguage="en";window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"7.2.6",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"7.2.7",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||

156
war/js/viewer.min.js vendored
View file

@ -2661,84 +2661,84 @@ mxUtils.getXml(a))})))}else f=c+".svg",m=this.getFileData(!1,!0,null,mxUtils.bin
0;g<this.pages.length;g++)if(this.pages[g]==this.currentPage){f="&from="+g;break}return new mxXmlRequest(EXPORT_URL,"format="+b+f+"&base64="+e+"&embedXml="+c+"&xml="+encodeURIComponent(d)+(null!=a?"&filename="+encodeURIComponent(a):""))};EditorUi.prototype.setMode=function(a,b){this.mode=a};EditorUi.prototype.fileLoaded=function(a){var c=!1;this.hideDialog();var b=this.getCurrentFile();this.setCurrentFile(null);null!=b&&(b.removeListener(this.descriptorChangedListener),b.close());this.editor.graph.model.clear();
this.editor.undoManager.clear();var d=mxUtils.bind(this,function(){this.setGraphEnabled(!1);this.setCurrentFile(null);null!=b&&this.updateDocumentTitle();this.editor.graph.model.clear();this.editor.undoManager.clear();null!=window.location.hash&&0<window.location.hash.length&&(window.location.hash="");null!=this.fname&&(this.fnameWrapper.style.display="none",this.fname.innerHTML="",this.fname.setAttribute("title",mxResources.get("rename")));this.updateUi();this.showSplash()});if(null!=a)try{this.setCurrentFile(a);
a.addListener("descriptorChanged",this.descriptorChangedListener);a.addListener("contentChanged",this.descriptorChangedListener);this.descriptorChanged();a.open();this.setGraphEnabled(!0);this.setMode(a.getMode());this.editor.undoManager.clear();this.updateUi();null==a.realtime&&(a.isEditable()?this.editor.setStatus(""):this.editor.setStatus(mxUtils.htmlEntities(mxResources.get("readOnly"))));this.editor.chromeless?this.editor.graph.lightbox&&this.lightboxFit():(this.editor.graph.selectUnlockedLayer(),
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));c=!0;if(this.enableLogging&&!this.isOffline()&&null!=a.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",a.getMode())}catch(h){}if(this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(h){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(h){}}catch(h){null!=window.console&&console.log("error in fileLoaded:",a,h);if(this.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=h&&null!=h.message?":err:"+encodeURIComponent(h.message):"")+(null!=h&&null!=h.stack?"&stack="+encodeURIComponent(h.stack):"")}catch(q){}this.handleError(h,mxResources.get("errorLoadingFile"),
mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=b?b.constructor==DriveFile?this.loadFile(b.getHash()):this.fileLoaded(b):d()}))}else d();return c};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,d,e,h,q,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==this.scratchpad?this.getLocalData(".scratchpad",
mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(a){var c=mxUtils.createXmlDocument(),b=c.createElement("mxlibrary");mxUtils.setTextContent(b,JSON.stringify(a));c.appendChild(b);return mxUtils.getXml(c)};EditorUi.prototype.closeLibrary=function(a){null!=a&&(this.removeLibrarySidebar(a.getHash()),a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),
".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var c=this.sidebar.palettes[a];if(null!=c){for(var b=0;b<c.length;b++)c[b].parentNode.removeChild(c[b]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var c=this.sidebar.container;if(null==a){var b=this.sidebar.palettes["L.scratchpad"];null==b&&(b=this.sidebar.palettes.search);null!=b&&(a=b[b.length-1].nextSibling)}a=null!=a?a:c.firstChild.nextSibling.nextSibling;
var b=c.lastChild,d=b.previousSibling;c.insertBefore(b,a);c.insertBefore(d,b)};EditorUi.prototype.loadLibrary=function(a){var c=mxUtils.parseXml(a.getData());if("mxlibrary"==c.documentElement.nodeName){var b=JSON.parse(mxUtils.getTextContent(c.documentElement));this.libraryLoaded(a,b,c.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};EditorUi.prototype.libraryLoaded=function(a,b,d){a.constructor!=
LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var c=this.sidebar.palettes[a.getHash()],c=null!=c?c[c.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var f=null,e=mxUtils.bind(this,function(c,b){if(0==c.length&&a.isEditable())null==f&&(f=document.createElement("div"),mxUtils.setPrefixedStyle(f.style,"borderRadius","6px"),f.style.border="3px dotted lightGray",f.style.textAlign="center",f.style.padding="8px",f.style.color="#B3B3B3",
mxUtils.write(f,mxResources.get("dragElementsHere"))),b.appendChild(f);else for(var d=0;d<c.length;d++){var e=c[d],g=e.data;if(null!=g){var g=this.convertDataUri(g),h="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==e.aspect&&(h+="aspect=fixed;");b.appendChild(this.sidebar.createVertexTemplate(h+"image="+g,e.w,e.h,"",e.title||"",!1,!1,!1))}else null!=e.xml&&(g=this.stringToCells(this.editor.graph.decompress(e.xml)),0<g.length&&b.appendChild(this.sidebar.createVertexTemplateFromCells(g,
e.w,e.h,e.title||"",!0,!1,!1)))}});d=null!=d&&0<d.length?d:a.getTitle();var g=this.sidebar.addPalette(a.getHash(),d,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(c);var p=g.parentNode.previousSibling;d=p.getAttribute("title");null!=d&&0<d.length&&".scratchpad"!=a.title&&p.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+d);var k=document.createElement("div");k.style.position="absolute";k.style.right="0px";k.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(k.style.backgroundColor=
"inherit");p.style.position="relative";var r=document.createElement("img");r.setAttribute("src",Dialog.prototype.closeImage);r.setAttribute("title",mxResources.get("close"));r.setAttribute("align","top");r.setAttribute("border","0");r.className="geButton";r.style.marginRight="1px";r.style.marginTop="-1px";k.appendChild(r);var l=null;mxEvent.addListener(r,"click",mxUtils.bind(this,function(c){if(!mxEvent.isConsumed(c)){var b=mxUtils.bind(this,function(){this.closeLibrary(a)});null!=l?this.confirm(mxResources.get("allChangesLost"),
null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b();mxEvent.consume(c)}}));mxEvent.addListener(g,"mousemove",mxUtils.bind(this,function(a){mxEvent.getSource(a)==g?g.setAttribute("title",mxResources.get("libraryTooltip")):g.removeAttribute("title")}));if(a.isEditable()){var n=this.editor.graph,y=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());mxEvent.consume(c)}),u=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=w&&null!=
w.parentNode&&w.parentNode.removeChild(w),w=r.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",k.insertBefore(w,k.firstChild),p.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),p.style.paddingRight=18*k.childNodes.length+"px")})):null==l&&(l=r.cloneNode(!1),
l.setAttribute("src",IMAGE_PATH+"/download.png"),l.setAttribute("title",mxResources.get("save")),k.insertBefore(l,k.firstChild),mxEvent.addListener(l,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==l||a.isModified()||(p.style.paddingRight=18*k.childNodes.length+"px",l.parentNode.removeChild(l),l=null)});mxEvent.consume(c)})),p.style.paddingRight=18*k.childNodes.length+"px")}),A=mxUtils.bind(this,function(a,c,d,e){a=
n.cloneCells(mxUtils.sortCells(n.model.getTopmostCells(a)));for(var h=0;h<a.length;h++){var m=n.getCellGeometry(a[h]);null!=m&&m.translate(-c.x,-c.y)}g.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=e&&(a.title=e);b.push(a);u(d);null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)}),z=mxUtils.bind(this,function(a){if(n.isSelectionEmpty())n.getRubberband().isActive()?
(n.getRubberband().execute(a),n.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var c=n.getSelectionCells(),b=n.view.getBounds(c),d=n.view.scale;b.x/=d;b.y/=d;b.width/=d;b.height/=d;b.x-=n.view.translate.x;b.y-=n.view.translate.y;A(c,b)}mxEvent.consume(a)});g.style.border="3px solid transparent";mxEvent.addGestureListeners(g,function(){},mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&
(n.graphHandler.shape.node.style.visibility="hidden",null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)",g.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(g.style.border="3px solid transparent",
null!=f&&(f.style.border="3px dotted lightGray"),g.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,z(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",g.style.border="3px solid transparent",g.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),
null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=f&&(f.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(a){null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)";a.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(a){g.style.border=
"3px solid transparent";g.style.cursor="";null!=f&&(f.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,h,m,p,q,r,k,l){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,p,q),c)],c[0].vertex=!0,A(c,new mxRectangle(0,0,p,q),a,mxEvent.isAltDown(a)?null:r.substring(0,
r.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var n=!1,t=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var h=mxUtils.parseXml(c);if("mxlibrary"==h.documentElement.nodeName)try{var m=JSON.parse(mxUtils.getTextContent(h.documentElement));e(m,g);b=b.concat(m);u(a);this.spinner.stop();n=!0}catch(U){}else if("mxfile"==h.documentElement.nodeName)try{for(var p=h.documentElement.getElementsByTagName("diagram"),h=0;h<
p.length;h++){var m=mxUtils.getTextContent(p[h]),q=this.stringToCells(this.editor.graph.decompress(m)),r=this.editor.graph.getBoundingBoxFromGeometry(q);A(q,new mxRectangle(0,0,r.width,r.height),a)}n=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}n||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,
r)&&null!=l?this.parseFile(l,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?t(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):t(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"dragleave",function(a){null!=f?f.style.border="3px dotted lightGray":(g.style.border="3px solid transparent",g.style.cursor="");a.stopPropagation();
a.preventDefault()}));r=r.cloneNode(!1);r.setAttribute("src",IMAGE_PATH+"/edit.gif");r.setAttribute("title",mxResources.get("edit"));k.insertBefore(r,k.firstChild);mxEvent.addListener(r,"click",y);mxEvent.addListener(g,"dblclick",function(a){mxEvent.getSource(a)==g&&y(a)});r=r.cloneNode(!1);r.setAttribute("src",Editor.plusImage);r.setAttribute("title",mxResources.get("add"));k.insertBefore(r,k.firstChild);this.isOffline()||".scratchpad"!=a.title||(d=document.createElement("span"),d.setAttribute("title",
mxResources.get("help")),d.style.cssText="color:gray;text-decoration:none;",d.className="geButton",mxUtils.write(d,"?"),mxEvent.addGestureListeners(d,mxUtils.bind(this,function(a){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(a)})),k.insertBefore(d,k.firstChild));var w=null;mxEvent.addListener(r,"click",z)}p.appendChild(k);p.style.paddingRight=18*k.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==
typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=
2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position=
"relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.prototype.hideFooter=function(){var a=document.getElementById("geFooter");null!=a&&(this.footerHeight=0,a.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=function(a,b,d,e,h){a=new ImageDialog(this,a,b,d,e,h);this.showDialog(a.container,Graph.fileSupport?440:360,Graph.fileSupport?
200:90,!0,!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var c=new BackgroundImageDialog(this,mxUtils.bind(this,function(c){a(c)}));this.showDialog(c.container,360,200,!0,!0);c.init()};EditorUi.prototype.showLibraryDialog=function(a,b,d,e,h){a=new LibraryDialog(this,a,b,d,e,h);this.showDialog(a.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&
null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer");a.style.position="absolute";a.style.overflow="hidden";a.style.borderWidth="3px";var b=document.createElement("a");b.setAttribute("href","javascript:void(0);");b.className="geTitle";b.style.height="100%";b.style.paddingTop="9px";mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,"click",mxUtils.bind(this,
function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,d){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},f=null!=a&&null!=a.error?a.error:a;if(null!=f||null!=b){a=mxUtils.htmlEntities(mxResources.get("unknownError"));var e=mxResources.get("ok"),g=null;b=null!=b?b:mxResources.get("error");if(null!=f)if(null!=f.retry&&(e=mxResources.get("cancel"),g=function(){c();f.retry()}),"undefined"!=
typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.FORBIDDEN)a=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==f.code||404==f.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.NOT_FOUND){a=mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var p=window.location.hash;null!=p&&"#G"==p.substring(0,2)&&(p=p.substring(2),
a+=' <a href="https://drive.google.com/open?id='+p+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else f.code==App.ERROR_TIMEOUT?a=mxUtils.htmlEntities(mxResources.get("timeout")):f.code==App.ERROR_BUSY?a=mxUtils.htmlEntities(mxResources.get("busy")):null!=f.message?a=mxUtils.htmlEntities(f.message):null!=f.response&&null!=f.response.error&&(a=mxUtils.htmlEntities(f.response.error));this.showError(b,a,e,d,g)}else null!=d&&d()};EditorUi.prototype.showError=
function(a,b,d,e,h,q,k){a=new ErrorDialog(this,a,b,d,e,h,q,k);this.showDialog(a.container,340,150,!0,!1);a.init()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,d,e,h){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,a,function(){c();null!=b&&b()},function(){c();null!=d&&d()},e,h)).container,
340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(a){this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var a=this.editor.graph.getModel();return 1==a.getChildCount(a.root)&&0==a.getChildCount(a.getChildAt(a.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+
btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=function(a,b,d){var c=a.toDataURL("image/"+d);if(6>=c.length||c==a.cloneNode(!1).toDataURL("image/"+d))throw{message:"Invalid image"};null!=b&&(c=this.writeGraphModelToPng(c,"zTXt","mxGraphModel",atob(this.editor.graph.compress(b))));return c};EditorUi.prototype.saveCanvas=function(a,b,d){var c="jpeg"==d?"jpg":d,f=this.getBaseFilename()+"."+c;a=this.createImageDataUri(a,b,d);this.saveData(f,c,a.substring(a.lastIndexOf(",")+
1),"image/"+d,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(a,b,d,e,h){if(window.Blob&&navigator.msSaveOrOpenBlob)a=e?this.base64ToBlob(a,d):new Blob([a],{type:d}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)d=
window.open("about:blank","_blank"),null==d?mxUtils.popup(a,!0):(d.document.write(a),d.document.close(),d.document.execCommand("SaveAs",!0,b),d.close());else if(mxClient.IS_IOS)b=new TextareaDialog(this,b+":",a,null,null,mxResources.get("close")),b.textarea.style.width="600px",b.textarea.style.height="380px",this.showDialog(b.container,620,460,!0,!0),b.init(),document.execCommand("selectall",!1,null);else{var c=document.createElement("a"),f=!mxClient.IS_SF&&"undefined"!==typeof c.download;if(f||this.isOffline()){c.href=
URL.createObjectURL(e?this.base64ToBlob(a,d):new Blob([a],{type:d}));f?c.download=b:c.setAttribute("target","_blank");document.body.appendChild(c);try{window.setTimeout(function(){URL.revokeObjectURL(c.href)},0),c.click(),c.parentNode.removeChild(c)}catch(p){}}else this.createEchoRequest(a,b,d,e,h).simulate(document,"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,d,e,h,q){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=d?"&mime="+d:"")+(null!=h?"&format="+h:
"")+(null!=q?"&base64="+q:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(e?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,e=Math.ceil(d/1024),f=Array(e),k=0;k<e;++k){for(var p=1024*k,l=Math.min(p+1024,d),r=Array(l-p),n=0;p<l;++n,++p)r[n]=c[p].charCodeAt(0);f[k]=new Uint8Array(r)}return new Blob(f,{type:b})};EditorUi.prototype.saveLocalFile=function(a,b,d,e,h,q){q=null!=q?q:!1;var c="vsdx"!=h&&(!mxClient.IS_IOS||!navigator.standalone);h=this.getServiceCount(q);
b=new CreateDialog(this,b,mxUtils.bind(this,function(c,b){try{if("_blank"==b)if(null==d||"image/"!=d.substring(0,6)||"image/svg"==d.substring(0,9)&&!mxClient.IS_SVG)f=window.open("about:blank"),null==f?mxUtils.popup(a,!0):(f.document.write(mxUtils.htmlEntities(a,!1)),f.document.close());else if(mxClient.IS_EDGE||11==document.documentMode||10==document.documentMode){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write('<html><img src="data:'+d+(e?";base64,"+a:";charset=utf8,"+
encodeURIComponent(a))+'"/></html>'),f.document.close())}else f=window.open("data:"+d+(e?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null==f&&mxUtils.popup(a,!0);else b==App.MODE_DEVICE?this.doSaveLocalFile(a,c,d,e):null!=c&&0<c.length&&this.pickFolder(b,mxUtils.bind(this,function(f){try{this.exportFile(a,c,d,e,b,f)}catch(x){this.handleError(x)}}))}catch(B){this.handleError(B)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,q,
c,null,null,4<h?3:4,a,d,e);this.showDialog(b.container,380,4<h?390:270,!0,!0);b.init()};EditorUi.prototype.saveData=function(a,b,d,e,h){this.isLocalFileSave()?this.saveLocalFile(d,a,e,h,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,c){return this.createEchoRequest(d,a,e,h,b,c)}),d,h,e)};EditorUi.prototype.saveRequest=function(a,b,d,e,h,q){var c=!mxClient.IS_IOS||!navigator.standalone,f=this.getServiceCount(!1);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,c){if("_blank"==c||null!=
a&&0<a.length){var f=d("_blank"==c?null:a,c==App.MODE_DEVICE||null==c||"_blank"==c?"0":"1");null!=f&&(c==App.MODE_DEVICE||"_blank"==c?f.simulate(document,"_blank"):this.pickFolder(c,mxUtils.bind(this,function(d){q=null!=q?q:"pdf"==b?"application/pdf":"image/"+b;if(null!=e)try{this.exportFile(e,a,q,!0,c,d)}catch(y){this.handleError(y)}else this.spinner.spin(document.body,mxResources.get("saving"))&&f.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=f.getStatus()&&299>=f.getStatus())try{this.exportFile(f.getText(),
a,q,!0,c,d)}catch(y){this.handleError(y)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,c,null,null,4<f?3:4,e,q,h);this.showDialog(a.container,380,4<f?390:270,!0,!0);a.init()};EditorUi.prototype.exportFile=function(a,b,d,e,h,q){};EditorUi.prototype.pickFolder=function(a,b,d){b(null)};EditorUi.prototype.exportSvg=
function(a,b,d,e,h,q,k,p,l){if(this.spinner.spin(document.body,mxResources.get("export"))){var c=this.editor.graph.isSelectionEmpty();d=null!=d?d:c;c=b?null:this.editor.graph.background;c==mxConstants.NONE&&(c=null);null==c&&0==b&&(c="#ffffff");var f=this.editor.graph.getSvg(c,a,k,p,null,d);e&&this.editor.graph.addSvgShadow(f);var g=this.getBaseFilename()+".svg",m=mxUtils.bind(this,function(a){this.spinner.stop();h&&a.setAttribute("content",this.getFileData(!0,null,null,null,d,l));var c='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+
mxUtils.getXml(a);this.isLocalFileSave()||c.length<=MAX_REQUEST_SIZE?this.saveData(g,"svg",c,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(c)}))});this.convertMath(this.editor.graph,f,!1,mxUtils.bind(this,function(){q?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(f,m,this.thumbImageCache)):m(f)}))}};EditorUi.prototype.addCheckbox=function(a,b,d,e,h,q){q=null!=q?q:!0;var c=
document.createElement("input");c.style.marginRight="8px";c.style.marginTop="16px";c.setAttribute("type","checkbox");d&&(c.setAttribute("checked","checked"),c.defaultChecked=!0);e&&c.setAttribute("disabled","disabled");q&&(a.appendChild(c),mxUtils.write(a,b),h||mxUtils.br(a));return c};EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),e="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=
App.MODE_BROWSER&&(e=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));f.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");f.appendChild(d);a.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,
function(){if("custom"==f.value){var a=new FilenameDialog(this,e,mxResources.get("ok"),function(a){null!=a?e=a:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":
e:null},getEditInput:function(){return c},getEditSelect:function(){return f}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){k.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+f:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");
d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&
(e=document.createElement("option"),e.setAttribute("value","frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",k=null,k=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();k.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width=
"22px";k.style.position="relative";k.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,d,e,h,k,l,p){var c=this.getCurrentFile(),f=[];e&&(f.push("lightbox=1"),"auto"!=a&&f.push("target="+a),null!=b&&b!=mxConstants.NONE&&f.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),
null!=h&&0<h.length&&f.push("edit="+encodeURIComponent(h)),k&&f.push("layers=1"),this.editor.graph.foldingEnabled&&f.push("nav=1"));if(d&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&f.push("page="+a);break}a=!0;null!=l?d="#U"+encodeURIComponent(l):(c=this.getCurrentFile(),p||null==c||c.constructor!=window.DriveFile?d="#R"+encodeURIComponent(d?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):
(d="#"+c.getHash(),a=!1));a&&null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&f.push("title="+encodeURIComponent(c.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<f.length?"?"+f.join("&"):"")+d};EditorUi.prototype.createHtml=function(a,b,d,e,h,k,l,p,n,r,B){var c=this.getBasenames(),f={};""!=h&&h!=mxConstants.NONE&&(f.highlight=h);"auto"!==e&&(f.target=e);n||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;
d=parseInt(d);isNaN(d)||100==d||(f.zoom=d/100);d=[];l&&(d.push("pages"),f.resize=!0,null!=this.pages&&null!=this.currentPage&&(f.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(d.push("zoom"),f.resize=!0);p&&d.push("layers");0<d.length&&(n&&d.push("lightbox"),f.toolbar=d.join(" "));null!=r&&0<r.length&&(f.edit=r);null!=a?f.url=a:f.xml=this.getFileData(!0,null,null,null,null,!l);b='<div class="mxgraph" style="'+(k?"max-width:100%;":"")+(""!=d?"border:1px solid transparent;":"")+'" data-mxgraph="'+
mxUtils.htmlEntities(JSON.stringify(f))+'"></div>';c=0<c.length?"s="+c.join(";"):"";a=null!=a?"fetch="+encodeURIComponent(a):"";B(b,'<script type="text/javascript" src="'+(0<c.length||0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+c:"https://www.draw.io/embed2.js?"+c)+"&"+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,d,e){var c=document.createElement("div");
c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var m=document.createElement("input");m.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";m.setAttribute("value","url");m.setAttribute("type","radio");m.setAttribute("name",
"type-embedhtmldialog");f=m.cloneNode(!0);f.setAttribute("value","copy");g.appendChild(f);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(k);mxUtils.br(g);g.appendChild(m);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));g.appendChild(k);var r=this.getCurrentFile();null==d&&null!=r&&r.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href",
"javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),g.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(r.getId())})));f.setAttribute("checked","checked");null==d&&m.setAttribute("disabled","disabled");c.appendChild(g);var l=this.addLinkSection(c),n=this.addCheckbox(c,mxResources.get("zoom"),!0,null,!0);mxUtils.write(c,":");var y=document.createElement("input");y.setAttribute("type","text");y.style.marginRight="16px";
y.style.width="60px";y.style.marginLeft="4px";y.style.marginRight="12px";y.value="100%";c.appendChild(y);var u=this.addCheckbox(c,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,A=A=this.addCheckbox(c,mxResources.get("allPages"),g,!g),z=this.addCheckbox(c,mxResources.get("layers"),!0),w=this.addCheckbox(c,mxResources.get("lightbox"),!0),C=this.addEditButton(c,w),D=C.getEditInput();D.style.marginBottom="16px";mxEvent.addListener(w,"change",function(){w.checked?D.removeAttribute("disabled"):
D.setAttribute("disabled","disabled");D.checked&&w.checked?C.getEditSelect().removeAttribute("disabled"):C.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,c,mxUtils.bind(this,function(){e(m.checked?d:null,n.checked,y.value,l.getTarget(),l.getColor(),u.checked,A.checked,z.checked,w.checked,C.getLink())}),null,a,b);this.showDialog(a.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,d,e,h,k){var c=document.createElement("div");c.style.whiteSpace=
"nowrap";var f=document.createElement("h3");mxUtils.write(f,a||mxResources.get("link"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=this.getCurrentFile(),f="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=g&&g.constructor==window.DriveFile&&!b){a=80;var f="https://desk.draw.io/support/solutions/articles/16000039384",m=document.createElement("div");m.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";
var l=document.createElement("div");l.style.whiteSpace="normal";mxUtils.write(l,mxResources.get("linkAccountRequired"));m.appendChild(l);l=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(g.getId())}));l.style.marginTop="12px";l.className="geBtn";m.appendChild(l);c.appendChild(m);l=document.createElement("a");l.style.paddingLeft="12px";l.style.color="gray";l.style.fontSize="11px";l.setAttribute("href","javascript:void(0);");mxUtils.write(l,mxResources.get("check"));
m.appendChild(l);mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,null,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var q=null,n=null;if(null!=d||null!=e)a+=30,mxUtils.write(c,mxResources.get("width")+":"),q=document.createElement("input"),
q.setAttribute("type","text"),q.style.marginRight="16px",q.style.width="50px",q.style.marginLeft="6px",q.style.marginRight="16px",q.style.marginBottom="10px",q.value="100%",c.appendChild(q),mxUtils.write(c,mxResources.get("height")+":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.width="50px",n.style.marginLeft="6px",n.style.marginBottom="10px",n.value=e+"px",c.appendChild(n),mxUtils.br(c);var u=this.addLinkSection(c,k);d=null!=this.pages&&1<this.pages.length;var A=null;
if(null==g||g.constructor!=window.DriveFile||b)A=this.addCheckbox(c,mxResources.get("allPages"),d,!d);var z=this.addCheckbox(c,mxResources.get("lightbox"),!0),w=this.addEditButton(c,z),C=w.getEditInput(),D=this.addCheckbox(c,mxResources.get("layers"),!0);D.style.marginLeft=C.style.marginLeft;D.style.marginBottom="16px";D.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(D.removeAttribute("disabled"),C.removeAttribute("disabled")):(D.setAttribute("disabled","disabled"),C.setAttribute("disabled",
"disabled"));C.checked&&z.checked?w.getEditSelect().removeAttribute("disabled"):w.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){h(u.getTarget(),u.getColor(),null==A?!0:A.checked,z.checked,w.getLink(),D.checked,null!=q?q.value:null,null!=n?n.value:null)}),null,mxResources.get("create"),f);this.showDialog(b.container,340,246+a,!0,!0);null!=q?(q.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",
!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(f);var g=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=e?null:this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),!0);null!=m&&
(m.style.marginBottom="16px");a=new CustomDialog(this,c,mxUtils.bind(this,function(){d(!g.checked,null!=m?m.checked:!1)}),null,a,b);this.showDialog(a.container,300,e?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,d,e,h,k,l,p){l=null!=l?l:!0;var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph,g="jpeg"==p?170:280,m=document.createElement("h3");mxUtils.write(m,a);m.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";c.appendChild(m);
mxUtils.write(c,mxResources.get("zoom")+":");var q=document.createElement("input");q.setAttribute("type","text");q.style.marginRight="16px";q.style.width="60px";q.style.marginLeft="4px";q.style.marginRight="12px";q.value=this.lastExportZoom||"100%";c.appendChild(q);mxUtils.write(c,mxResources.get("borderWidth")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.value=this.lastExportBorder||"0";c.appendChild(n);
mxUtils.br(c);var v=this.addCheckbox(c,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background,null,null,"jpeg"!=p),z=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,f.isSelectionEmpty()),w=document.createElement("input");w.style.marginTop="16px";w.style.marginRight="8px";w.style.marginLeft="24px";w.setAttribute("disabled","disabled");w.setAttribute("type","checkbox");k&&(c.appendChild(w),mxUtils.write(c,mxResources.get("crop")),mxUtils.br(c),g+=26,mxEvent.addListener(z,
"change",function(){z.checked?w.removeAttribute("disabled"):w.setAttribute("disabled","disabled")}));f.isSelectionEmpty()||(w.setAttribute("checked","checked"),w.defaultChecked=!0);var C=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible),D=document.createElement("input");D.style.marginTop="16px";D.style.marginRight="8px";D.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||D.setAttribute("disabled","disabled");b&&(c.appendChild(D),mxUtils.write(c,mxResources.get("embedImages")),
mxUtils.br(c),g+=26);var O=this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),l,null,null,"jpeg"!=p),L=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(c,L?mxResources.get("allPages"):"",L,!L,null,"jpeg"!=p);F.style.marginLeft="24px";F.style.marginBottom="16px";L||(F.style.visibility="hidden");mxEvent.addListener(O,"change",function(){O.checked&&L?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});l&&L||F.setAttribute("disabled","disabled");a=new CustomDialog(this,
c,mxUtils.bind(this,function(){this.lastExportBorder=n.value;this.lastExportZoom=q.value;h(q.value,v.checked,!z.checked,C.checked,O.checked,D.checked,n.value,w.checked,!F.checked)}),null,d,e);this.showDialog(a.container,320,g,!0,!0);q.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,d,e,h){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph;
if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(g)}var m=this.addCheckbox(c,mxResources.get("fit"),!0),k=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible&&e,!e),l=this.addCheckbox(c,d),n=this.addCheckbox(c,mxResources.get("lightbox"),!0),y=this.addEditButton(c,n),u=y.getEditInput(),A=1<f.model.getChildCount(f.model.getRoot()),z=this.addCheckbox(c,mxResources.get("layers"),A,
!A);z.style.marginLeft=u.style.marginLeft;z.style.marginBottom="12px";z.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(A&&z.removeAttribute("disabled"),u.removeAttribute("disabled")):(z.setAttribute("disabled","disabled"),u.setAttribute("disabled","disabled"));u.checked&&n.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){a(m.checked,k.checked,l.checked,n.checked,
y.getLink(),z.checked)}),null,mxResources.get("embed"),h);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,d,e,h,k,l,p){function c(c){var b=" ",g="";e&&(b=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus());this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));c=!0;if(EditorUi.enableLogging&&!this.isOffline()&&null!=a.getMode())try{"function"===typeof window.ga&&ga("send","event","File","open",a.getMode())}catch(h){}if(this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(h){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
1),mxSettings.save()}catch(h){}}catch(h){null!=window.console&&console.log("error in fileLoaded:",a,h);if(EditorUi.enableLogging&&!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=h&&null!=h.message?":err:"+encodeURIComponent(h.message):"")+(null!=h&&null!=h.stack?"&stack="+encodeURIComponent(h.stack):"")}catch(q){}this.handleError(h,
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):null!=b?b.constructor==DriveFile?this.loadFile(b.getHash()):this.fileLoaded(b):d()}))}else d();return c};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,d,e,h,q,k){};EditorUi.prototype.toggleScratchpad=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)null==
this.scratchpad?this.getLocalData(".scratchpad",mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad)};EditorUi.prototype.createLibraryDataFromImages=function(a){var c=mxUtils.createXmlDocument(),b=c.createElement("mxlibrary");mxUtils.setTextContent(b,JSON.stringify(a));c.appendChild(b);return mxUtils.getXml(c)};EditorUi.prototype.closeLibrary=function(a){null!=a&&(this.removeLibrarySidebar(a.getHash()),
a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var c=this.sidebar.palettes[a];if(null!=c){for(var b=0;b<c.length;b++)c[b].parentNode.removeChild(c[b]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var c=this.sidebar.container;if(null==a){var b=this.sidebar.palettes["L.scratchpad"];null==b&&(b=this.sidebar.palettes.search);null!=b&&(a=b[b.length-
1].nextSibling)}a=null!=a?a:c.firstChild.nextSibling.nextSibling;var b=c.lastChild,d=b.previousSibling;c.insertBefore(b,a);c.insertBefore(d,b)};EditorUi.prototype.loadLibrary=function(a){var c=mxUtils.parseXml(a.getData());if("mxlibrary"==c.documentElement.nodeName){var b=JSON.parse(mxUtils.getTextContent(c.documentElement));this.libraryLoaded(a,b,c.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};
EditorUi.prototype.libraryLoaded=function(a,b,d){a.constructor!=LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var c=this.sidebar.palettes[a.getHash()],c=null!=c?c[c.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var f=null,e=mxUtils.bind(this,function(c,b){if(0==c.length&&a.isEditable())null==f&&(f=document.createElement("div"),mxUtils.setPrefixedStyle(f.style,"borderRadius","6px"),f.style.border="3px dotted lightGray",f.style.textAlign=
"center",f.style.padding="8px",f.style.color="#B3B3B3",mxUtils.write(f,mxResources.get("dragElementsHere"))),b.appendChild(f);else for(var d=0;d<c.length;d++){var e=c[d],g=e.data;if(null!=g){var g=this.convertDataUri(g),h="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==e.aspect&&(h+="aspect=fixed;");b.appendChild(this.sidebar.createVertexTemplate(h+"image="+g,e.w,e.h,"",e.title||"",!1,!1,!1))}else null!=e.xml&&(g=this.stringToCells(this.editor.graph.decompress(e.xml)),
0<g.length&&b.appendChild(this.sidebar.createVertexTemplateFromCells(g,e.w,e.h,e.title||"",!0,!1,!1)))}});d=null!=d&&0<d.length?d:a.getTitle();var g=this.sidebar.addPalette(a.getHash(),d,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(c);var p=g.parentNode.previousSibling;d=p.getAttribute("title");null!=d&&0<d.length&&".scratchpad"!=a.title&&p.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+d);var k=document.createElement("div");k.style.position="absolute";k.style.right=
"0px";k.style.top="5px";mxClient.IS_QUIRKS||8==document.documentMode||(k.style.backgroundColor="inherit");p.style.position="relative";var r=document.createElement("img");r.setAttribute("src",Dialog.prototype.closeImage);r.setAttribute("title",mxResources.get("close"));r.setAttribute("align","top");r.setAttribute("border","0");r.className="geButton";r.style.marginRight="1px";r.style.marginTop="-1px";k.appendChild(r);var l=null;mxEvent.addListener(r,"click",mxUtils.bind(this,function(c){if(!mxEvent.isConsumed(c)){var b=
mxUtils.bind(this,function(){this.closeLibrary(a)});null!=l?this.confirm(mxResources.get("allChangesLost"),null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b();mxEvent.consume(c)}}));mxEvent.addListener(g,"mousemove",mxUtils.bind(this,function(a){mxEvent.getSource(a)==g?g.setAttribute("title",mxResources.get("libraryTooltip")):g.removeAttribute("title")}));if(a.isEditable()){var n=this.editor.graph,y=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());
mxEvent.consume(c)}),u=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=w&&null!=w.parentNode&&w.parentNode.removeChild(w),w=r.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",k.insertBefore(w,k.firstChild),p.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),
p.style.paddingRight=18*k.childNodes.length+"px")})):null==l&&(l=r.cloneNode(!1),l.setAttribute("src",IMAGE_PATH+"/download.png"),l.setAttribute("title",mxResources.get("save")),k.insertBefore(l,k.firstChild),mxEvent.addListener(l,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==l||a.isModified()||(p.style.paddingRight=18*k.childNodes.length+"px",l.parentNode.removeChild(l),l=null)});mxEvent.consume(c)})),p.style.paddingRight=
18*k.childNodes.length+"px")}),A=mxUtils.bind(this,function(a,c,d,e){a=n.cloneCells(mxUtils.sortCells(n.model.getTopmostCells(a)));for(var h=0;h<a.length;h++){var m=n.getCellGeometry(a[h]);null!=m&&m.translate(-c.x,-c.y)}g.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=e&&(a.title=e);b.push(a);u(d);null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),
f=null)}),z=mxUtils.bind(this,function(a){if(n.isSelectionEmpty())n.getRubberband().isActive()?(n.getRubberband().execute(a),n.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var c=n.getSelectionCells(),b=n.view.getBounds(c),d=n.view.scale;b.x/=d;b.y/=d;b.width/=d;b.height/=d;b.x-=n.view.translate.x;b.y-=n.view.translate.y;A(c,b)}mxEvent.consume(a)});g.style.border="3px solid transparent";mxEvent.addGestureListeners(g,
function(){},mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="hidden",null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)",g.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,
function(a){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(g.style.border="3px solid transparent",null!=f&&(f.style.border="3px dotted lightGray"),g.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,z(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(a){n.isMouseDown&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",g.style.border=
"3px solid transparent",g.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=f&&(f.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(a){null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)";a.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();
a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(a){g.style.border="3px solid transparent";g.style.cursor="";null!=f&&(f.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,h,m,p,q,r,k,l){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",
new mxGeometry(0,0,p,q),c)],c[0].vertex=!0,A(c,new mxRectangle(0,0,p,q),a,mxEvent.isAltDown(a)?null:r.substring(0,r.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var n=!1,t=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var h=mxUtils.parseXml(c);if("mxlibrary"==h.documentElement.nodeName)try{var m=JSON.parse(mxUtils.getTextContent(h.documentElement));e(m,g);b=b.concat(m);u(a);this.spinner.stop();n=!0}catch(U){}else if("mxfile"==
h.documentElement.nodeName)try{for(var p=h.documentElement.getElementsByTagName("diagram"),h=0;h<p.length;h++){var m=mxUtils.getTextContent(p[h]),q=this.stringToCells(this.editor.graph.decompress(m)),r=this.editor.graph.getBoundingBoxFromGeometry(q);A(q,new mxRectangle(0,0,r.width,r.height),a)}n=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}n||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&
(f.parentNode.removeChild(f),f=null)});!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,r)&&null!=l?this.parseFile(l,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?t(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):t(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"dragleave",function(a){null!=
f?f.style.border="3px dotted lightGray":(g.style.border="3px solid transparent",g.style.cursor="");a.stopPropagation();a.preventDefault()}));r=r.cloneNode(!1);r.setAttribute("src",IMAGE_PATH+"/edit.gif");r.setAttribute("title",mxResources.get("edit"));k.insertBefore(r,k.firstChild);mxEvent.addListener(r,"click",y);mxEvent.addListener(g,"dblclick",function(a){mxEvent.getSource(a)==g&&y(a)});r=r.cloneNode(!1);r.setAttribute("src",Editor.plusImage);r.setAttribute("title",mxResources.get("add"));k.insertBefore(r,
k.firstChild);this.isOffline()||".scratchpad"!=a.title||(d=document.createElement("span"),d.setAttribute("title",mxResources.get("help")),d.style.cssText="color:gray;text-decoration:none;",d.className="geButton",mxUtils.write(d,"?"),mxEvent.addGestureListeners(d,mxUtils.bind(this,function(a){window.open("https://desk.draw.io/support/solutions/articles/16000042367");mxEvent.consume(a)})),k.insertBefore(d,k.firstChild));var w=null;mxEvent.addListener(r,"click",z)}p.appendChild(k);p.style.paddingRight=
18*k.childNodes.length+"px"};"1"==urlParams.offline?EditorUi.prototype.footerHeight=4:("atlas"==uiTheme?("undefined"!==typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=
46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2):"1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",
Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position="relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.prototype.hideFooter=function(){var a=document.getElementById("geFooter");null!=a&&(this.footerHeight=0,a.style.display="none",this.refresh())};EditorUi.prototype.showImageDialog=
function(a,b,d,e,h){a=new ImageDialog(this,a,b,d,e,h);this.showDialog(a.container,Graph.fileSupport?440:360,Graph.fileSupport?200:90,!0,!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var c=new BackgroundImageDialog(this,mxUtils.bind(this,function(c){a(c)}));this.showDialog(c.container,360,200,!0,!0);c.init()};EditorUi.prototype.showLibraryDialog=
function(a,b,d,e,h){a=new LibraryDialog(this,a,b,d,e,h);this.showDialog(a.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer");a.style.position="absolute";a.style.overflow="hidden";a.style.borderWidth="3px";var b=document.createElement("a");b.setAttribute("href","javascript:void(0);");b.className="geTitle";b.style.height=
"100%";b.style.paddingTop="9px";mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,"click",mxUtils.bind(this,function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,d){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},f=null!=a&&null!=a.error?a.error:a;if(null!=f||null!=b){a=mxUtils.htmlEntities(mxResources.get("unknownError"));var e=mxResources.get("ok"),
g=null;b=null!=b?b:mxResources.get("error");if(null!=f)if(null!=f.retry&&(e=mxResources.get("cancel"),g=function(){c();f.retry()}),"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.FORBIDDEN)a=mxUtils.htmlEntities(mxResources.get("forbidden"));else if(404==f.code||404==f.status||"undefined"!=typeof gapi&&"undefined"!=typeof gapi.drive&&"undefined"!=typeof gapi.drive.realtime&&f.type==gapi.drive.realtime.ErrorType.NOT_FOUND){a=
mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied"));var p=window.location.hash;null!=p&&"#G"==p.substring(0,2)&&(p=p.substring(2),a+=' <a href="https://drive.google.com/open?id='+p+'" target="_blank">'+mxUtils.htmlEntities(mxResources.get("tryOpeningViaThisPage"))+"</a>")}else f.code==App.ERROR_TIMEOUT?a=mxUtils.htmlEntities(mxResources.get("timeout")):f.code==App.ERROR_BUSY?a=mxUtils.htmlEntities(mxResources.get("busy")):null!=f.message?a=mxUtils.htmlEntities(f.message):null!=f.response&&
null!=f.response.error&&(a=mxUtils.htmlEntities(f.response.error));this.showError(b,a,e,d,g)}else null!=d&&d()};EditorUi.prototype.showError=function(a,b,d,e,h,q,k){a=new ErrorDialog(this,a,b,d,e,h,q,k);this.showDialog(a.container,340,150,!0,!1);a.init()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,d,e,h){var c=null!=this.spinner&&null!=this.spinner.pause?
this.spinner.pause():function(){};this.showDialog((new ConfirmDialog(this,a,function(){c();null!=b&&b()},function(){c();null!=d&&d()},e,h)).container,340,90,!0,!1)};EditorUi.prototype.setCurrentFile=function(a){this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isDiagramEmpty=function(){var a=this.editor.graph.getModel();return 1==a.getChildCount(a.root)&&0==a.getChildCount(a.getChildAt(a.root,0))};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||
!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=function(a,b,d){var c=a.toDataURL("image/"+d);if(6>=c.length||c==a.cloneNode(!1).toDataURL("image/"+d))throw{message:"Invalid image"};null!=b&&(c=this.writeGraphModelToPng(c,"zTXt","mxGraphModel",atob(this.editor.graph.compress(b))));return c};EditorUi.prototype.saveCanvas=function(a,
b,d){var c="jpeg"==d?"jpg":d,f=this.getBaseFilename()+"."+c;a=this.createImageDataUri(a,b,d);this.saveData(f,c,a.substring(a.lastIndexOf(",")+1),"image/"+d,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.doSaveLocalFile=function(a,
b,d,e,h){if(window.Blob&&navigator.msSaveOrOpenBlob)a=e?this.base64ToBlob(a,d):new Blob([a],{type:d}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)d=window.open("about:blank","_blank"),null==d?mxUtils.popup(a,!0):(d.document.write(a),d.document.close(),d.document.execCommand("SaveAs",!0,b),d.close());else if(mxClient.IS_IOS)b=new TextareaDialog(this,b+":",a,null,null,mxResources.get("close")),b.textarea.style.width="600px",b.textarea.style.height="380px",this.showDialog(b.container,620,
460,!0,!0),b.init(),document.execCommand("selectall",!1,null);else{var c=document.createElement("a"),f=!mxClient.IS_SF&&"undefined"!==typeof c.download;if(f||this.isOffline()){c.href=URL.createObjectURL(e?this.base64ToBlob(a,d):new Blob([a],{type:d}));f?c.download=b:c.setAttribute("target","_blank");document.body.appendChild(c);try{window.setTimeout(function(){URL.revokeObjectURL(c.href)},0),c.click(),c.parentNode.removeChild(c)}catch(p){}}else this.createEchoRequest(a,b,d,e,h).simulate(document,
"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,d,e,h,q){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=d?"&mime="+d:"")+(null!=h?"&format="+h:"")+(null!=q?"&base64="+q:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(e?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,e=Math.ceil(d/1024),f=Array(e),k=0;k<e;++k){for(var p=1024*k,l=Math.min(p+1024,d),r=Array(l-p),n=0;p<l;++n,++p)r[n]=c[p].charCodeAt(0);f[k]=
new Uint8Array(r)}return new Blob(f,{type:b})};EditorUi.prototype.saveLocalFile=function(a,b,d,e,h,q){q=null!=q?q:!1;var c="vsdx"!=h&&(!mxClient.IS_IOS||!navigator.standalone);h=this.getServiceCount(q);b=new CreateDialog(this,b,mxUtils.bind(this,function(c,b){try{if("_blank"==b)if(null==d||"image/"!=d.substring(0,6)||"image/svg"==d.substring(0,9)&&!mxClient.IS_SVG)f=window.open("about:blank"),null==f?mxUtils.popup(a,!0):(f.document.write(mxUtils.htmlEntities(a,!1)),f.document.close());else if(mxClient.IS_EDGE||
11==document.documentMode||10==document.documentMode){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write('<html><img src="data:'+d+(e?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))+'"/></html>'),f.document.close())}else f=window.open("data:"+d+(e?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null==f&&mxUtils.popup(a,!0);else b==App.MODE_DEVICE?this.doSaveLocalFile(a,c,d,e):null!=c&&0<c.length&&this.pickFolder(b,mxUtils.bind(this,function(f){try{this.exportFile(a,
c,d,e,b,f)}catch(x){this.handleError(x)}}))}catch(B){this.handleError(B)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,q,c,null,null,4<h?3:4,a,d,e);this.showDialog(b.container,380,4<h?390:270,!0,!0);b.init()};EditorUi.prototype.saveData=function(a,b,d,e,h){this.isLocalFileSave()?this.saveLocalFile(d,a,e,h,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,c){return this.createEchoRequest(d,a,e,h,b,c)}),d,h,e)};EditorUi.prototype.saveRequest=
function(a,b,d,e,h,q){var c=!mxClient.IS_IOS||!navigator.standalone,f=this.getServiceCount(!1);a=new CreateDialog(this,a,mxUtils.bind(this,function(a,c){if("_blank"==c||null!=a&&0<a.length){var f=d("_blank"==c?null:a,c==App.MODE_DEVICE||null==c||"_blank"==c?"0":"1");null!=f&&(c==App.MODE_DEVICE||"_blank"==c?f.simulate(document,"_blank"):this.pickFolder(c,mxUtils.bind(this,function(d){q=null!=q?q:"pdf"==b?"application/pdf":"image/"+b;if(null!=e)try{this.exportFile(e,a,q,!0,c,d)}catch(y){this.handleError(y)}else this.spinner.spin(document.body,
mxResources.get("saving"))&&f.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=f.getStatus()&&299>=f.getStatus())try{this.exportFile(f.getText(),a,q,!0,c,d)}catch(y){this.handleError(y)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,c,null,null,4<f?3:4,e,q,h);this.showDialog(a.container,380,4<f?
390:270,!0,!0);a.init()};EditorUi.prototype.exportFile=function(a,b,d,e,h,q){};EditorUi.prototype.pickFolder=function(a,b,d){b(null)};EditorUi.prototype.exportSvg=function(a,b,d,e,h,q,k,p,l){if(this.spinner.spin(document.body,mxResources.get("export"))){var c=this.editor.graph.isSelectionEmpty();d=null!=d?d:c;c=b?null:this.editor.graph.background;c==mxConstants.NONE&&(c=null);null==c&&0==b&&(c="#ffffff");var f=this.editor.graph.getSvg(c,a,k,p,null,d);e&&this.editor.graph.addSvgShadow(f);var g=this.getBaseFilename()+
".svg",m=mxUtils.bind(this,function(a){this.spinner.stop();h&&a.setAttribute("content",this.getFileData(!0,null,null,null,d,l));var c='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a);this.isLocalFileSave()||c.length<=MAX_REQUEST_SIZE?this.saveData(g,"svg",c,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(c)}))});this.convertMath(this.editor.graph,
f,!1,mxUtils.bind(this,function(){q?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(f,m,this.thumbImageCache)):m(f)}))}};EditorUi.prototype.addCheckbox=function(a,b,d,e,h,q){q=null!=q?q:!0;var c=document.createElement("input");c.style.marginRight="8px";c.style.marginTop="16px";c.setAttribute("type","checkbox");d&&(c.setAttribute("checked","checked"),c.defaultChecked=!0);e&&c.setAttribute("disabled","disabled");q&&(a.appendChild(c),mxUtils.write(a,b),h||mxUtils.br(a));return c};
EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),e="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER&&(e=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));
f.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");f.appendChild(d);a.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,function(){if("custom"==f.value){var a=new FilenameDialog(this,e,mxResources.get("ok"),function(a){null!=a?e=a:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",
mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":e:null},getEditInput:function(){return c},getEditSelect:function(){return f}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){k.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+
f:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value",
"blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&(e=document.createElement("option"),e.setAttribute("value","frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",k=null,k=mxUtils.button("",
mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();k.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width="22px";k.style.position="relative";k.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=
function(a,b,d,e,h,k,l,p){var c=this.getCurrentFile(),f=[];e&&(f.push("lightbox=1"),"auto"!=a&&f.push("target="+a),null!=b&&b!=mxConstants.NONE&&f.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=h&&0<h.length&&f.push("edit="+encodeURIComponent(h)),k&&f.push("layers=1"),this.editor.graph.foldingEnabled&&f.push("nav=1"));if(d&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&f.push("page="+a);break}a=!0;null!=l?d="#U"+encodeURIComponent(l):
(c=this.getCurrentFile(),p||null==c||c.constructor!=window.DriveFile?d="#R"+encodeURIComponent(d?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(d="#"+c.getHash(),a=!1));a&&null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&f.push("title="+encodeURIComponent(c.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?"https://www.draw.io/":"https://"+location.host+"/")+(0<f.length?"?"+f.join("&"):"")+
d};EditorUi.prototype.createHtml=function(a,b,d,e,h,k,l,p,n,r,B){var c=this.getBasenames(),f={};""!=h&&h!=mxConstants.NONE&&(f.highlight=h);"auto"!==e&&(f.target=e);n||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;d=parseInt(d);isNaN(d)||100==d||(f.zoom=d/100);d=[];l&&(d.push("pages"),f.resize=!0,null!=this.pages&&null!=this.currentPage&&(f.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(d.push("zoom"),f.resize=!0);p&&d.push("layers");0<d.length&&(n&&d.push("lightbox"),f.toolbar=
d.join(" "));null!=r&&0<r.length&&(f.edit=r);null!=a?f.url=a:f.xml=this.getFileData(!0,null,null,null,null,!l);b='<div class="mxgraph" style="'+(k?"max-width:100%;":"")+(""!=d?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(f))+'"></div>';c=0<c.length?"s="+c.join(";"):"";a=null!=a?"fetch="+encodeURIComponent(a):"";B(b,'<script type="text/javascript" src="'+(0<c.length||0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1&"+c:"https://www.draw.io/embed2.js?"+
c)+"&"+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";
var m=document.createElement("input");m.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";m.setAttribute("value","url");m.setAttribute("type","radio");m.setAttribute("name","type-embedhtmldialog");f=m.cloneNode(!0);f.setAttribute("value","copy");g.appendChild(f);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(k);mxUtils.br(g);g.appendChild(m);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));
g.appendChild(k);var r=this.getCurrentFile();null==d&&null!=r&&r.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href","javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),g.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(r.getId())})));f.setAttribute("checked","checked");null==d&&m.setAttribute("disabled","disabled");c.appendChild(g);var l=
this.addLinkSection(c),n=this.addCheckbox(c,mxResources.get("zoom"),!0,null,!0);mxUtils.write(c,":");var y=document.createElement("input");y.setAttribute("type","text");y.style.marginRight="16px";y.style.width="60px";y.style.marginLeft="4px";y.style.marginRight="12px";y.value="100%";c.appendChild(y);var u=this.addCheckbox(c,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,A=A=this.addCheckbox(c,mxResources.get("allPages"),g,!g),z=this.addCheckbox(c,mxResources.get("layers"),!0),
w=this.addCheckbox(c,mxResources.get("lightbox"),!0),C=this.addEditButton(c,w),D=C.getEditInput();D.style.marginBottom="16px";mxEvent.addListener(w,"change",function(){w.checked?D.removeAttribute("disabled"):D.setAttribute("disabled","disabled");D.checked&&w.checked?C.getEditSelect().removeAttribute("disabled"):C.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,c,mxUtils.bind(this,function(){e(m.checked?d:null,n.checked,y.value,l.getTarget(),l.getColor(),u.checked,A.checked,
z.checked,w.checked,C.getLink())}),null,a,b);this.showDialog(a.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,d,e,h,k){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,a||mxResources.get("link"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=this.getCurrentFile(),f="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=
g&&g.constructor==window.DriveFile&&!b){a=80;var f="https://desk.draw.io/support/solutions/articles/16000039384",m=document.createElement("div");m.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var l=document.createElement("div");l.style.whiteSpace="normal";mxUtils.write(l,mxResources.get("linkAccountRequired"));m.appendChild(l);l=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(g.getId())}));
l.style.marginTop="12px";l.className="geBtn";m.appendChild(l);c.appendChild(m);l=document.createElement("a");l.style.paddingLeft="12px";l.style.color="gray";l.style.fontSize="11px";l.setAttribute("href","javascript:void(0);");mxUtils.write(l,mxResources.get("check"));m.appendChild(l);mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,
null,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var q=null,n=null;if(null!=d||null!=e)a+=30,mxUtils.write(c,mxResources.get("width")+":"),q=document.createElement("input"),q.setAttribute("type","text"),q.style.marginRight="16px",q.style.width="50px",q.style.marginLeft="6px",q.style.marginRight="16px",q.style.marginBottom="10px",q.value="100%",c.appendChild(q),mxUtils.write(c,mxResources.get("height")+
":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.width="50px",n.style.marginLeft="6px",n.style.marginBottom="10px",n.value=e+"px",c.appendChild(n),mxUtils.br(c);var u=this.addLinkSection(c,k);d=null!=this.pages&&1<this.pages.length;var A=null;if(null==g||g.constructor!=window.DriveFile||b)A=this.addCheckbox(c,mxResources.get("allPages"),d,!d);var z=this.addCheckbox(c,mxResources.get("lightbox"),!0),w=this.addEditButton(c,z),C=w.getEditInput(),D=this.addCheckbox(c,mxResources.get("layers"),
!0);D.style.marginLeft=C.style.marginLeft;D.style.marginBottom="16px";D.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(D.removeAttribute("disabled"),C.removeAttribute("disabled")):(D.setAttribute("disabled","disabled"),C.setAttribute("disabled","disabled"));C.checked&&z.checked?w.getEditSelect().removeAttribute("disabled"):w.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){h(u.getTarget(),u.getColor(),null==A?
!0:A.checked,z.checked,w.getLink(),D.checked,null!=q?q.value:null,null!=n?n.value:null)}),null,mxResources.get("create"),f);this.showDialog(b.container,340,246+a,!0,!0);null!=q?(q.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));
f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(f);var g=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=e?null:this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),!0);null!=m&&(m.style.marginBottom="16px");a=new CustomDialog(this,c,mxUtils.bind(this,function(){d(!g.checked,null!=m?m.checked:!1)}),null,a,b);this.showDialog(a.container,300,e?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(a,
b,d,e,h,k,l,p){l=null!=l?l:!0;var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph,g="jpeg"==p?170:280,m=document.createElement("h3");mxUtils.write(m,a);m.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";c.appendChild(m);mxUtils.write(c,mxResources.get("zoom")+":");var q=document.createElement("input");q.setAttribute("type","text");q.style.marginRight="16px";q.style.width="60px";q.style.marginLeft="4px";q.style.marginRight="12px";q.value=
this.lastExportZoom||"100%";c.appendChild(q);mxUtils.write(c,mxResources.get("borderWidth")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.value=this.lastExportBorder||"0";c.appendChild(n);mxUtils.br(c);var v=this.addCheckbox(c,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background,null,null,"jpeg"!=p),z=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,f.isSelectionEmpty()),
w=document.createElement("input");w.style.marginTop="16px";w.style.marginRight="8px";w.style.marginLeft="24px";w.setAttribute("disabled","disabled");w.setAttribute("type","checkbox");k&&(c.appendChild(w),mxUtils.write(c,mxResources.get("crop")),mxUtils.br(c),g+=26,mxEvent.addListener(z,"change",function(){z.checked?w.removeAttribute("disabled"):w.setAttribute("disabled","disabled")}));f.isSelectionEmpty()||(w.setAttribute("checked","checked"),w.defaultChecked=!0);var C=this.addCheckbox(c,mxResources.get("shadow"),
f.shadowVisible),D=document.createElement("input");D.style.marginTop="16px";D.style.marginRight="8px";D.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||D.setAttribute("disabled","disabled");b&&(c.appendChild(D),mxUtils.write(c,mxResources.get("embedImages")),mxUtils.br(c),g+=26);var O=this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),l,null,null,"jpeg"!=p),L=null!=this.pages&&1<this.pages.length,F=this.addCheckbox(c,L?mxResources.get("allPages"):"",L,!L,null,"jpeg"!=
p);F.style.marginLeft="24px";F.style.marginBottom="16px";L||(F.style.visibility="hidden");mxEvent.addListener(O,"change",function(){O.checked&&L?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled")});l&&L||F.setAttribute("disabled","disabled");a=new CustomDialog(this,c,mxUtils.bind(this,function(){this.lastExportBorder=n.value;this.lastExportZoom=q.value;h(q.value,v.checked,!z.checked,C.checked,O.checked,D.checked,n.value,w.checked,!F.checked)}),null,d,e);this.showDialog(a.container,
320,g,!0,!0);q.focus();mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?q.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,d,e,h){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph;if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(g)}var m=this.addCheckbox(c,mxResources.get("fit"),!0),
k=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible&&e,!e),l=this.addCheckbox(c,d),n=this.addCheckbox(c,mxResources.get("lightbox"),!0),y=this.addEditButton(c,n),u=y.getEditInput(),A=1<f.model.getChildCount(f.model.getRoot()),z=this.addCheckbox(c,mxResources.get("layers"),A,!A);z.style.marginLeft=u.style.marginLeft;z.style.marginBottom="12px";z.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(A&&z.removeAttribute("disabled"),u.removeAttribute("disabled")):(z.setAttribute("disabled",
"disabled"),u.setAttribute("disabled","disabled"));u.checked&&n.checked?y.getEditSelect().removeAttribute("disabled"):y.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){a(m.checked,k.checked,l.checked,n.checked,y.getLink(),z.checked)}),null,mxResources.get("embed"),h);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,d,e,h,k,l,p){function c(c){var b=" ",g="";e&&(b=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+
(h?"&edit=_blank":"")+(k?"&layers=1":"")+"');}})(this);\"",g+="cursor:pointer;");a&&(g+="max-width:100%;");var m="";d&&(m=' width="'+Math.round(f.width)+'" height="'+Math.round(f.height)+'"');l('<img src="'+c+'"'+m+(""!=g?' style="'+g+'"':"")+b+"/>")}var f=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(a){var b=e?this.getFileData(!0):null;a=this.createImageDataUri(a,b,"png");c(a)}),null,null,null,mxUtils.bind(this,function(a){p({message:mxResources.get("unknownError")})}),
null,!0,d?2:1,null,b);else if(b=this.getFileData(!0),f.width*f.height<=MAX_AREA&&b.length<=MAX_REQUEST_SIZE){var g="";d&&(g="&w="+Math.round(2*f.width)+"&h="+Math.round(2*f.height));var m=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(e?"1":"0")+g+"&xml="+encodeURIComponent(b));m.send(mxUtils.bind(this,function(){200<=m.getStatus()&&299>=m.getStatus()?c("data:image/png;base64,"+m.getText()):p({message:mxResources.get("unknownError")})}))}else p({message:mxResources.get("drawingTooLarge")})};
EditorUi.prototype.createEmbedSvg=function(a,b,d,e,h,k,l){var c=this.editor.graph.getSvg(),f=c.getElementsByTagName("a");if(null!=f)for(var g=0;g<f.length;g++){var m=f[g].getAttribute("href");null!=m&&"#"==m.charAt(0)&&"_blank"==f[g].getAttribute("target")&&f[g].removeAttribute("target")}e&&c.setAttribute("content",this.getFileData(!0));b&&this.editor.graph.addSvgShadow(c);if(d){var q=" ",n="";e&&(q="onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('https://www.draw.io/?client=1&lightbox=1"+