@zklogic/draw.io
Version:
Draw.IO - Graph Editor integration in Angular-cli
1 lines • 190 kB
JavaScript
var StorageDialog=function(e,t,l){l=null!=l?l:2;var n=document.createElement("div");n.style.textAlign="center",n.style.whiteSpace="nowrap",n.style.paddingTop="0px",n.style.paddingBottom="20px";var i=document.createElement("div");i.style.border="1px solid #d3d3d3",i.style.borderWidth="1px 0px 1px 0px",i.style.padding="10px 0px 20px 0px";var a=0,s=0,r=document.createElement("div");r.style.paddingTop="2px",i.appendChild(r);var o=document.createElement("p");function d(n,i,d,c,m,u){s++,++a>l&&(mxUtils.br(r),a=1);var p=document.createElement("a");p.style.overflow="hidden",p.style.display="inline-block",p.className="geBaseButton",p.style.boxSizing="border-box",p.style.fontSize="11px",p.style.position="relative",p.style.margin="4px",p.style.marginTop="8px",p.style.marginBottom="0px",p.style.padding="8px 10px 8px 10px",p.style.width="88px",p.style.height="100px",p.style.whiteSpace="nowrap",p.setAttribute("title",i);var g=document.createElement("div");if(g.style.textOverflow="ellipsis",g.style.overflow="hidden",g.style.position="absolute",g.style.bottom="8px",g.style.left="0px",g.style.right="0px",mxUtils.write(g,i),p.appendChild(g),null!=n){var h=document.createElement("img");h.setAttribute("src",n),h.setAttribute("border","0"),h.setAttribute("align","absmiddle"),h.style.width="60px",h.style.height="60px",h.style.paddingBottom="6px",p.appendChild(h)}else g.style.paddingTop="5px",g.style.whiteSpace="normal",mxClient.IS_IOS?(p.style.padding="0px 10px 20px 10px",p.style.top="6px"):mxClient.IS_FF&&(g.style.paddingTop="0px",g.style.marginTop="-2px");if(null!=m)for(var x=0;x<m.length;x++)mxUtils.br(g),mxUtils.write(g,m[x]);function v(){mxEvent.addListener(p,"click",null!=u?u:function(){d!=App.MODE_GOOGLE||e.isDriveDomain()?d==App.MODE_GOOGLE&&e.spinner.spin(document.body,mxResources.get("authorizing"))?e.drive.checkToken(mxUtils.bind(this,(function(){e.spinner.stop(),e.setMode(d,!0),t()}))):d==App.MODE_ONEDRIVE&&e.spinner.spin(document.body,mxResources.get("authorizing"))?e.oneDrive.checkToken(mxUtils.bind(this,(function(){e.spinner.stop(),e.setMode(d,!0),t()}))):(e.setMode(d,!0),t()):window.location.hostname=DriveClient.prototype.newAppHostname})}if(null!=c&&null==e[c]){h.style.visibility="hidden",mxUtils.setOpacity(g,10);var y=new Spinner({lines:12,length:12,width:5,radius:10,rotate:0,color:Editor.isDarkMode()?"#c0c0c0":"#000",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"40%",zIndex:2e9});y.spin(p);var b=window.setTimeout((function(){null==e[c]&&(y.stop(),p.style.display="none")}),3e4);e.addListener("clientLoaded",mxUtils.bind(this,(function(t,l){null!=e[c]&&l.getProperty("client")==e[c]&&(window.clearTimeout(b),mxUtils.setOpacity(g,100),h.style.visibility="",y.stop(),v(),"drive"==c&&null!=o.parentNode&&o.parentNode.removeChild(o))})))}else v();r.appendChild(p)}var c=document.createElement("p");c.style.cssText="font-size:22px;padding:4px 0 16px 0;margin:0;color:gray;",mxUtils.write(c,mxResources.get("saveDiagramsTo")+":"),n.appendChild(c),n.appendChild(i),a=0,"function"==typeof window.DriveClient&&d(IMAGE_PATH+"/google-drive-logo.svg",mxResources.get("googleDrive"),App.MODE_GOOGLE,"drive"),"function"==typeof window.OneDriveClient&&d(IMAGE_PATH+"/onedrive-logo.svg",mxResources.get("oneDrive"),App.MODE_ONEDRIVE,"oneDrive"),"1"!=urlParams.noDevice&&d(IMAGE_PATH+"/osa_drive-harddisk.png",mxResources.get("device"),App.MODE_DEVICE),!isLocalStorage||"1"!=urlParams.browser&&"1"!=urlParams.offline||d(IMAGE_PATH+"/osa_database.png",mxResources.get("browser"),App.MODE_BROWSER),"function"==typeof window.DropboxClient&&d(IMAGE_PATH+"/dropbox-logo.svg",mxResources.get("dropbox"),App.MODE_DROPBOX,"dropbox"),null!=e.gitHub&&d(IMAGE_PATH+"/github-logo.svg",mxResources.get("github"),App.MODE_GITHUB,"gitHub"),null!=e.gitLab&&d(IMAGE_PATH+"/gitlab-logo.svg",mxResources.get("gitlab"),App.MODE_GITLAB,"gitLab"),s<6&&null!=e.notion&&d(IMAGE_PATH+"/notion-logo.svg",mxResources.get("notion"),App.MODE_NOTION,"notion");var m=document.createElement("span");m.style.cssText="position:absolute;cursor:pointer;bottom:27px;color:gray;userSelect:none;text-align:center;left:50%;",mxUtils.setPrefixedStyle(m.style,"transform","translate(-50%,0)"),mxUtils.write(m,mxResources.get("decideLater")),mxEvent.addListener(m,"click",(function(){e.hideDialog();var t=Editor.useLocalStorage;e.createFile(e.defaultFilename,null,null,null,null,null,null,!0),Editor.useLocalStorage=t})),n.appendChild(m),mxClient.IS_SVG&&isLocalStorage&&"0"!=urlParams.gapi&&(null==document.documentMode||document.documentMode>=10)&&window.setTimeout((function(){null==e.drive&&(o.style.padding="7px",o.style.fontSize="9pt",o.style.marginTop="-14px",o.innerHTML='<a style="background-color:#dcdcdc;padding:6px;color:black;text-decoration:none;" href="https://desk.draw.io/a/solutions/articles/16000074659" target="_blank"><img border="0" src="'+mxGraph.prototype.warningImage.src+'" align="absmiddle" style="margin-top:-4px"> '+mxResources.get("googleDriveMissingClickHere")+"</a>",n.appendChild(o))}),5e3),this.container=n},SplashDialog=function(e){var t=document.createElement("div");if(t.style.textAlign="center",mxClient.IS_CHROMEAPP||EditorUi.isElectronApp){var l=e.addLanguageMenu(t,!0);null!=l&&(l.style.bottom="19px")}e.getServiceCount();var n=document.createElement("img");n.setAttribute("border","0"),n.setAttribute("align","absmiddle"),n.style.width="32px",n.style.height="32px",n.style.marginRight="8px",n.style.marginTop="-4px";var i=document.createElement("div");i.style.margin="8px 0px 0px 0px",i.style.padding="18px 0px 24px 0px";var a,s="";if(e.mode==App.MODE_GOOGLE?(n.src=IMAGE_PATH+"/google-drive-logo.svg",s=mxResources.get("googleDrive")):e.mode==App.MODE_DROPBOX?(n.src=IMAGE_PATH+"/dropbox-logo.svg",s=mxResources.get("dropbox")):e.mode==App.MODE_ONEDRIVE?(n.src=IMAGE_PATH+"/onedrive-logo.svg",s=mxResources.get("oneDrive")):e.mode==App.MODE_GITHUB?(n.src=IMAGE_PATH+"/github-logo.svg",s=mxResources.get("github")):e.mode==App.MODE_GITLAB?(n.src=IMAGE_PATH+"/gitlab-logo.svg",s=mxResources.get("gitlab")):e.mode==App.MODE_NOTION?(n.src=IMAGE_PATH+"/notion-logo.svg",s=mxResources.get("notion")):e.mode==App.MODE_BROWSER?(n.src=IMAGE_PATH+"/osa_database.png",s=mxResources.get("browser")):e.mode==App.MODE_TRELLO?(n.src=IMAGE_PATH+"/trello-logo.svg",s=mxResources.get("trello")):(n.src=IMAGE_PATH+"/osa_drive-harddisk.png",i.style.paddingBottom="10px",i.style.paddingTop="30px",s=mxResources.get("device")),(a=document.createElement("button")).className="geBigButton",a.style.marginBottom="8px",a.style.fontSize="18px",a.style.padding="10px",a.style.width="340px",mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)i.style.padding="42px 0px 10px 0px",a.style.marginBottom="12px";else{i.style.border="1px solid #d3d3d3",i.style.borderWidth="1px 0px 1px 0px";var r=document.createElement("table"),o=document.createElement("tbody"),d=document.createElement("tr"),c=document.createElement("td"),m=document.createElement("td");r.setAttribute("align","center"),c.appendChild(n),(h=document.createElement("div")).style.fontSize="22px",h.style.paddingBottom="6px",h.style.color="gray",mxUtils.write(h,s),m.style.textAlign="left",m.appendChild(h),d.appendChild(c),d.appendChild(m),o.appendChild(d),r.appendChild(o),t.appendChild(r);var u=document.createElement("span");u.style.cssText="position:absolute;cursor:pointer;bottom:27px;color:gray;userSelect:none;text-align:center;left:50%;",mxUtils.setPrefixedStyle(u.style,"transform","translate(-50%,0)"),mxUtils.write(u,mxResources.get("changeStorage")),mxEvent.addListener(u,"click",(function(){e.hideDialog(!1),e.setMode(null),e.clearMode(),e.showSplash(!0)})),t.appendChild(u)}if(mxUtils.write(a,mxResources.get("createNewDiagram")),mxEvent.addListener(a,"click",(function(){e.hideDialog(),e.actions.get("new").funct()})),i.appendChild(a),mxUtils.br(i),(a=document.createElement("button")).className="geBigButton",a.style.marginBottom="22px",a.style.fontSize="18px",a.style.padding="10px",a.style.width="340px",mxUtils.write(a,mxResources.get("openExistingDiagram")),mxEvent.addListener(a,"click",(function(){e.actions.get("open").funct()})),i.appendChild(a),e.mode==App.MODE_GOOGLE?mxResources.get("googleDrive"):e.mode==App.MODE_DROPBOX?mxResources.get("dropbox"):e.mode==App.MODE_ONEDRIVE?mxResources.get("oneDrive"):e.mode==App.MODE_GITHUB?mxResources.get("github"):e.mode==App.MODE_GITLAB?mxResources.get("gitlab"):e.mode==App.MODE_NOTION?mxResources.get("notion"):e.mode==App.MODE_TRELLO?mxResources.get("trello"):e.mode==App.MODE_DEVICE?mxResources.get("device"):e.mode==App.MODE_BROWSER&&mxResources.get("browser"),!mxClient.IS_CHROMEAPP&&!EditorUi.isElectronApp){function p(t){a.style.marginBottom="24px";var l=document.createElement("a");l.style.display="inline-block",l.style.color="gray",l.style.cursor="pointer",l.style.marginTop="6px",mxUtils.write(l,mxResources.get("signOut")),a.style.marginBottom="16px",i.style.paddingBottom="18px",mxEvent.addListener(l,"click",(function(){e.confirm(mxResources.get("areYouSure"),(function(){t()}))})),i.appendChild(l)}if(e.mode==App.MODE_GOOGLE&&null!=e.drive){var g=e.drive.getUsersList();if(g.length>0){var h;(h=document.createElement("span")).style.marginTop="6px",mxUtils.write(h,mxResources.get("changeUser")+":"),a.style.marginBottom="16px",i.style.paddingBottom="18px",i.appendChild(h);var x=document.createElement("select");x.style.marginLeft="4px",x.style.width="140px";for(var v=0;v<g.length;v++){var y=document.createElement("option");mxUtils.write(y,g[v].displayName),y.value=v,x.appendChild(y),(y=document.createElement("option")).innerHTML=" ",mxUtils.write(y,"<"+g[v].email+">"),y.setAttribute("disabled","disabled"),x.appendChild(y)}y=document.createElement("option"),mxUtils.write(y,mxResources.get("addAccount")),y.value=g.length,x.appendChild(y),mxEvent.addListener(x,"change",(function(){var t=x.value,l=g.length!=t;l&&e.drive.setUser(g[t]),e.drive.authorize(l,(function(){e.setMode(App.MODE_GOOGLE),e.hideDialog(),e.showSplash()}),(function(t){e.handleError(t,null,(function(){e.hideDialog(),e.showSplash()}))}),!0)})),i.appendChild(x)}else p((function(){e.drive.logout()}))}else e.mode!=App.MODE_ONEDRIVE||null==e.oneDrive||e.oneDrive.noLogout?e.mode==App.MODE_GITHUB&&null!=e.gitHub?p((function(){e.gitHub.logout(),e.openLink("https://www.github.com/logout")})):e.mode==App.MODE_GITLAB&&null!=e.gitLab?p((function(){e.gitLab.logout(),e.openLink(DRAWIO_GITLAB_URL+"/users/sign_out")})):e.mode==App.MODE_NOTION&&null!=e.notion?p((function(){e.notion.logout()})):e.mode==App.MODE_TRELLO&&null!=e.trello?e.trello.isAuthorized()&&p((function(){e.trello.logout()})):e.mode==App.MODE_DROPBOX&&null!=e.dropbox&&p((function(){e.dropbox.logout(),e.openLink("https://www.dropbox.com/logout")})):p((function(){e.oneDrive.logout()}))}t.appendChild(i),this.container=t},EmbedDialog=function(e,t,l,n,i,a,s,r,o){s=null!=s?s:"Check out the diagram I made using @drawio";var d=document.createElement("div"),c=5e5,m=/^https?:\/\//.test(t)||/^mailto:\/\//.test(t);null!=a?mxUtils.write(d,a):mxUtils.write(d,mxResources.get(t.length<c?m?"link":"mainEmbedNotice":"preview")+":"),mxUtils.br(d);var u=document.createElement("div");u.style.position="absolute",u.style.top="30px",u.style.right="30px",u.style.color="gray",mxUtils.write(u,e.formatFileSize(t.length)),d.appendChild(u);var p=document.createElement("textarea");p.setAttribute("autocomplete","off"),p.setAttribute("autocorrect","off"),p.setAttribute("autocapitalize","off"),p.setAttribute("spellcheck","false"),p.style.fontFamily="monospace",p.style.wordBreak="break-all",p.style.marginTop="10px",p.style.resize="none",p.style.height="150px",p.style.width="440px",p.style.border="1px solid gray",p.value=mxResources.get("updatingDocument"),d.appendChild(p),mxUtils.br(d),this.init=function(){window.setTimeout((function(){t.length<c?(p.value=t,p.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?p.select():document.execCommand("selectAll",!1,null)):(p.setAttribute("readonly","true"),p.value=mxResources.get("tooLargeUseDownload"))}),0)};var g=document.createElement("div");if(g.style.position="absolute",g.style.bottom="36px",g.style.right="32px",!m||t.length>7500){var h=mxUtils.button(mxResources.get("download"),(function(){e.hideDialog(),e.saveData(null!=o?o:"embed.txt","txt",t,"text/plain")}));h.className="geBtn",g.appendChild(h)}if(m&&(!e.isOffline()||mxClient.IS_CHROMEAPP)){if(t.length<51200){var x=mxUtils.button("",(function(){try{var t="https://www.facebook.com/sharer.php?p[url]="+encodeURIComponent(p.value);e.openLink(t)}catch(t){e.handleError({message:t.message||mxResources.get("drawingTooLarge")})}}));(v=document.createElement("img")).setAttribute("src",Editor.facebookImage),v.setAttribute("width","18"),v.setAttribute("height","18"),v.setAttribute("border","0"),x.appendChild(v),x.setAttribute("title",mxResources.get("facebook")+" ("+e.formatFileSize(51200)+" max)"),x.style.verticalAlign="bottom",x.style.paddingTop="4px",x.style.minWidth="46px",x.className="geBtn",g.appendChild(x)}if(t.length<7168){var v,y=mxUtils.button("",(function(){try{var t="https://twitter.com/intent/tweet?text="+encodeURIComponent(s)+"&url="+encodeURIComponent(p.value);e.openLink(t)}catch(t){e.handleError({message:t.message||mxResources.get("drawingTooLarge")})}}));(v=document.createElement("img")).setAttribute("src",Editor.tweetImage),v.setAttribute("width","18"),v.setAttribute("height","18"),v.setAttribute("border","0"),v.style.marginBottom="5px",y.appendChild(v),y.setAttribute("title",mxResources.get("twitter")+" ("+e.formatFileSize(7168)+" max)"),y.style.verticalAlign="bottom",y.style.paddingTop="4px",y.style.minWidth="46px",y.className="geBtn",g.appendChild(y)}}var b=mxUtils.button(mxResources.get("close"),(function(){e.hideDialog()}));g.appendChild(b);var f=mxUtils.button(mxResources.get("copy"),(function(){p.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?p.select():document.execCommand("selectAll",!1,null),document.execCommand("copy"),e.alert(mxResources.get("copiedToClipboard"))}));t.length<c?mxClient.IS_SF||null!=document.documentMode?b.className="geBtn gePrimaryBtn":(g.appendChild(f),f.className="geBtn gePrimaryBtn",b.className="geBtn"):(g.appendChild(previewBtn),b.className="geBtn",previewBtn.className="geBtn gePrimaryBtn"),d.appendChild(g),this.container=d};EmbedDialog.showPreviewOption=!0;var GoogleSitesDialog=function(e,t){var l=document.createElement("div"),n=e.editor.graph,i=n.getGraphBounds(),a=n.view.scale,s=Math.floor(i.x/a-n.view.translate.x),r=Math.floor(i.y/a-n.view.translate.y);mxUtils.write(l,mxResources.get("googleGadget")+":"),mxUtils.br(l);var o=document.createElement("input");o.setAttribute("type","text"),o.style.marginBottom="8px",o.style.marginTop="2px",o.style.width="410px",l.appendChild(o),mxUtils.br(l),this.init=function(){o.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?o.select():document.execCommand("selectAll",!1,null)},mxUtils.write(l,mxResources.get("top")+":");var d=document.createElement("input");d.setAttribute("type","text"),d.setAttribute("size","4"),d.style.marginRight="16px",d.style.marginLeft="4px",d.value=s,l.appendChild(d),mxUtils.write(l,mxResources.get("height")+":");var c=document.createElement("input");c.setAttribute("type","text"),c.setAttribute("size","4"),c.style.marginLeft="4px",c.value=Math.ceil(i.height/a),l.appendChild(c),mxUtils.br(l);var m=document.createElement("hr");m.setAttribute("size","1"),m.style.marginBottom="16px",m.style.marginTop="16px",l.appendChild(m),mxUtils.write(l,mxResources.get("publicDiagramUrl")+":"),mxUtils.br(l);var u=document.createElement("input");u.setAttribute("type","text"),u.setAttribute("size","28"),u.style.marginBottom="8px",u.style.marginTop="2px",u.style.width="410px",u.value=t||"",l.appendChild(u),mxUtils.br(l),mxUtils.write(l,mxResources.get("borderWidth")+":");var p=document.createElement("input");p.setAttribute("type","text"),p.setAttribute("size","3"),p.style.marginBottom="8px",p.style.marginLeft="4px",p.value="0",l.appendChild(p),mxUtils.br(l);var g=document.createElement("input");g.setAttribute("type","checkbox"),g.setAttribute("checked","checked"),g.defaultChecked=!0,g.style.marginLeft="16px",l.appendChild(g),mxUtils.write(l,mxResources.get("pan")+" ");var h=document.createElement("input");h.setAttribute("type","checkbox"),h.setAttribute("checked","checked"),h.defaultChecked=!0,h.style.marginLeft="8px",l.appendChild(h),mxUtils.write(l,mxResources.get("zoom")+" ");var x=document.createElement("input");x.setAttribute("type","checkbox"),x.style.marginLeft="8px",x.setAttribute("title",window.location.href),l.appendChild(x),mxUtils.write(l,mxResources.get("edit")+" ");var v=document.createElement("input");v.setAttribute("type","checkbox"),v.style.marginLeft="8px",l.appendChild(v),mxUtils.write(l,mxResources.get("asNew")+" "),mxUtils.br(l);var y=document.createElement("input");y.setAttribute("type","checkbox"),y.setAttribute("checked","checked"),y.defaultChecked=!0,y.style.marginLeft="16px",l.appendChild(y),mxUtils.write(l,mxResources.get("resize")+" ");var b=document.createElement("input");b.setAttribute("type","checkbox"),b.style.marginLeft="8px",l.appendChild(b),mxUtils.write(l,mxResources.get("fit")+" ");var f=document.createElement("input");f.setAttribute("type","checkbox"),f.style.marginLeft="8px",l.appendChild(f),mxUtils.write(l,mxResources.get("embed")+" ");var E=e.getBasenames().join(";"),C=e.getCurrentFile();function w(){var e=null!=C&&null!=C.getTitle()?C.getTitle():this.defaultFilename;if(f.checked&&""!=u.value){var t="https://www.draw.io/gadget.xml?type=4&diagram="+encodeURIComponent(mxUtils.htmlEntities(u.value));null!=e&&(t+="&title="+encodeURIComponent(e)),E.length>0&&(t+="&s="+E),""!=p.value&&"0"!=p.value&&(t+="&border="+p.value),""!=c.value&&(t+="&height="+c.value),t+="&pan="+(g.checked?"1":"0"),t+="&zoom="+(h.checked?"1":"0"),t+="&fit="+(b.checked?"1":"0"),t+="&resize="+(y.checked?"1":"0"),t+="&x0="+Number(d.value),t+="&y0="+r,n.mathEnabled&&(t+="&math=1"),v.checked?t+="&edit=_blank":x.checked&&(t+="&edit="+encodeURIComponent(mxUtils.htmlEntities(window.location.href))),o.value=t}else C.constructor==DriveFile||C.constructor==DropboxFile?(t="https://www.draw.io/gadget.xml?embed=0&diagram=",""!=u.value?t+=encodeURIComponent(mxUtils.htmlEntities(u.value))+"&type=3":(t+=C.getHash().substring(1),C.constructor==DropboxFile?t+="&type=2":t+="&type=1"),null!=e&&(t+="&title="+encodeURIComponent(e)),""!=c.value&&(t+="&height="+(parseInt(c.value)+parseInt(d.value))),o.value=t):o.value=""}mxEvent.addListener(g,"change",w),mxEvent.addListener(h,"change",w),mxEvent.addListener(y,"change",w),mxEvent.addListener(b,"change",w),mxEvent.addListener(x,"change",w),mxEvent.addListener(v,"change",w),mxEvent.addListener(f,"change",w),mxEvent.addListener(c,"change",w),mxEvent.addListener(d,"change",w),mxEvent.addListener(p,"change",w),mxEvent.addListener(u,"change",w),w(),mxEvent.addListener(o,"click",(function(){o.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?o.select():document.execCommand("selectAll",!1,null)}));var A=document.createElement("div");A.style.paddingTop="12px",A.style.textAlign="right";var D=mxUtils.button(mxResources.get("close"),(function(){e.hideDialog()}));D.className="geBtn gePrimaryBtn",A.appendChild(D),l.appendChild(A),this.container=l},CreateGraphDialog=function(e,t,l){var n=document.createElement("div");n.style.textAlign="right",this.init=function(){var t=document.createElement("div");t.style.position="relative",t.style.border="1px solid gray",t.style.width="100%",t.style.height="360px",t.style.overflow="hidden",t.style.marginBottom="16px",mxEvent.disableContextMenu(t),n.appendChild(t);var i=new Graph(t);i.setCellsCloneable(!0),i.setPanning(!0),i.setAllowDanglingEdges(!1),i.connectionHandler.select=!1,i.view.setTranslate(20,20),i.border=20,i.panningHandler.useLeftButtonForPanning=!0;var a="curved=1;";mxCellRenderer.prototype.installCellOverlayListeners,i.cellRenderer.installCellOverlayListeners=function(e,t,l){mxCellRenderer.prototype.installCellOverlayListeners.apply(this,arguments),mxEvent.addListener(l.node,mxClient.IS_POINTER?"pointerdown":"mousedown",(function(l){t.fireEvent(new mxEventObject("pointerdown","event",l,"state",e))})),!mxClient.IS_POINTER&&mxClient.IS_TOUCH&&mxEvent.addListener(l.node,"touchstart",(function(l){t.fireEvent(new mxEventObject("pointerdown","event",l,"state",e))}))},i.getAllConnectionConstraints=function(){return null},i.connectionHandler.marker.highlight.keepOnTop=!1,i.connectionHandler.createEdgeState=function(e){var t=i.createEdge(null,null,null,null,null,a);return new mxCellState(this.graph.view,t,this.graph.getCellStyle(t))};var s,r,o=i.getDefaultParent(),d=mxUtils.bind(this,(function(e){var t=new mxCellOverlay(this.connectImage,"Add outgoing");t.cursor="hand",t.addListener(mxEvent.CLICK,(function(t,l){i.connectionHandler.reset(),i.clearSelection();var n,s=i.getCellGeometry(e);c((function(){n=i.insertVertex(o,null,"Entry",s.x,s.y,80,30,"rounded=1;"),d(n),i.view.refresh(n),i.insertEdge(o,null,"",e,n,a)}),(function(){i.scrollCellToVisible(n)}))})),t.addListener("pointerdown",(function(e,t){var l=t.getProperty("event"),n=t.getProperty("state");i.popupMenuHandler.hideMenu(),i.stopEditing(!1);var a=mxUtils.convertPoint(i.container,mxEvent.getClientX(l),mxEvent.getClientY(l));i.connectionHandler.start(n,a.x,a.y),i.isMouseDown=!0,i.isMouseTrigger=mxEvent.isMouseEvent(l),mxEvent.consume(l)})),i.addCellOverlay(e,t)}));i.getModel().beginUpdate();try{s=i.insertVertex(o,null,"Start",0,0,80,30,"ellipse"),d(s)}finally{i.getModel().endUpdate()}if("horizontalTree"==l?((r=new mxCompactTreeLayout(i)).edgeRouting=!1,r.levelDistance=30,a="edgeStyle=elbowEdgeStyle;elbow=horizontal;"):"verticalTree"==l?((r=new mxCompactTreeLayout(i,!1)).edgeRouting=!1,r.levelDistance=30,a="edgeStyle=elbowEdgeStyle;elbow=vertical;"):"radialTree"==l?((r=new mxRadialTreeLayout(i,!1)).edgeRouting=!1,r.levelDistance=80):"verticalFlow"==l?r=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH):"horizontalFlow"==l?r=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST):"organic"==l?(r=new mxFastOrganicLayout(i,!1)).forceConstant=80:"circle"==l&&(r=new mxCircleLayout(i)),null!=r){var c=function(e,t){i.getModel().beginUpdate();try{null!=e&&e(),r.execute(i.getDefaultParent(),s)}catch(e){throw e}finally{var l=new mxMorphing(i);l.addListener(mxEvent.DONE,mxUtils.bind(this,(function(){i.getModel().endUpdate(),null!=t&&t()}))),l.startAnimation()}},m=mxEdgeHandler.prototype.connect;mxEdgeHandler.prototype.connect=function(e,t,l,n,i){m.apply(this,arguments),c()},i.resizeCell=function(){mxGraph.prototype.resizeCell.apply(this,arguments),c()},i.connectionHandler.addListener(mxEvent.CONNECT,(function(){c()}))}var u=mxUtils.button(mxResources.get("close"),(function(){e.confirm(mxResources.get("areYouSure"),(function(){null!=t.parentNode&&(i.destroy(),t.parentNode.removeChild(t)),e.hideDialog()}))}));u.className="geBtn",e.editor.cancelFirst&&n.appendChild(u);var p=mxUtils.button(mxResources.get("insert"),(function(l){i.clearCellOverlays();var n=i.getModel().getChildren(i.getDefaultParent()),a=mxEvent.isAltDown(l)?e.editor.graph.getFreeInsertPoint():e.editor.graph.getCenterInsertPoint(i.getBoundingBoxFromGeometry(n,!0));n=e.editor.graph.importCells(n,a.x,a.y);var s=e.editor.graph.view,r=s.getBounds(n);r.x-=s.translate.x,r.y-=s.translate.y,e.editor.graph.scrollRectToVisible(r),e.editor.graph.setSelectionCells(n),null!=t.parentNode&&(i.destroy(),t.parentNode.removeChild(t)),e.hideDialog()}));n.appendChild(p),p.className="geBtn gePrimaryBtn",e.editor.cancelFirst||n.appendChild(u)},this.container=n};CreateGraphDialog.prototype.connectImage=new mxImage(mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RjQ3OTk0QjMyRDcyMTFFNThGQThGNDVBMjNBMjFDMzkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RjQ3OTk0QjQyRDcyMTFFNThGQThGNDVBMjNBMjFDMzkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyRjA0N0I2MjJENzExMUU1OEZBOEY0NUEyM0EyMUMzOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGNDc5OTRCMjJENzIxMUU1OEZBOEY0NUEyM0EyMUMzOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PjIf+MgAAATlSURBVHjanFZraFxFFD735u4ru3ls0yZG26ShgmJoKK1J2vhIYzBgRdtIURHyw1hQUH9IxIgI2h8iCEUF/1RRlNQYCsYfCTHVhiTtNolpZCEStqSC22xIsrs1bDfu7t37Gs/cO3Ozxs1DBw73zpk555vzmHNGgJ0NYatFgmNLYUHYUoHASMz5ijmgVLmxgfKCUiBxC4ACJAeSG8nb1dVVOTc3dyoSibwWDofPBIPBJzo7O8vpGtvjpDICGztxkciECpF2LS0tvZtOpwNkk5FKpcYXFxffwL1+JuPgllPj8nk1F6RoaGjoKCqZ5ApljZDZO4SMRA0SuG2QUJIQRV8HxMOM9vf3H0ZZH9Nhg20MMl2QkFwjIyNHWlpahtADnuUMwLcRHX5aNSBjCJYEsSSLUeLEbhGe3ytCmQtA1/XY+Pj46dbW1iDuyCJp9BC5ycBj4hoeHq5ra2sbw0Xn1ZgBZ+dVkA1Lc+6p0Ck2p0QS4Ox9EhwpEylYcmBg4LH29vYQLilIOt0u5FhDfevNZDI/u93uw6PLOrwTUtjxrbPYbhD42WgMrF8JmR894ICmCgnQjVe8Xu8pXEkzMJKbuo5oNPomBbm1ZsD7s2kwFA1JZ6QBUXWT1nmGNc/qoMgavDcrQzxjQGFh4aOYIJ0sFAXcEtui4uLiVjr5KpSBVFYDDZVrWUaKRRWSAYeK0fmKykgDXbVoNaPChRuyqdDv97czL5nXxQbq6empQmsaklkDBiNpSwFVrmr2P6UyicD5piI4f8wHh0oEm8/p4h8pyGiEWvVQd3e3nxtjAzU1NR2jP7NRBWQ8GbdEzzJAmc0V3RR4cI8Dvmwuhc8fKUFA0d6/ltHg5p+Kuaejo6OeY0jcNJ/PV00ZS0nFUoZRvvFS1bZFsKHCCQ2Pl8H0chY+C96B6ZUsrCQ1qKtwQVFRURW/QhIXMAzDPAZ6BgOr8tTa8dDxCmiYGApaJbJMxSzV+brE8pdgWkcpY5dbMF1AR9XH8/xu2ilef48bvn92n82ZwHh+8ssqTEXS9p7dHisiiURikd8PbpExNTU1UVNTA3V3Y7lC16n0gpB/NwpNcZjfa7dScC4Qh0kOQCwnlEgi3F/hMVl9fX0zvKrzSk2lfXjRhj0eT/2rvWG4+Pta3oJY7XfC3hInXAv/ldeFLx8shQ+eqQL0UAAz7ylkpej5eNZRVBWL6BU6ef14OYiY1oqyTtmsavr/5koaRucT1pzx+ZpL1+GV5nLutksUgIcmtwTRiuuVZXnU5XId7A2swJkfFsymRWC91hHg1Viw6x23+7vn9sPJ+j20BE1hCXqSWaNSQ8ScbknRZWxub1PGCw/fBV+c3AeijlUbY5bBjEqr9GuYZP4jP41WudGSC6erTRCqdGZm5i1WvXWeDHnbBCZGc2Nj4wBl/hZOwrmBBfgmlID1HmGJutHaF+tKoevp/XCgstDkjo2NtWKLuc6AVN4mNjY+s1XQxoenOoFuDPHGtnRbJj9ej5GvL0dI7+giuRyMk1giazc+DP6vgUDgOJVlOv7R+PJ12QIeL6SyeDz+Kfp8ZrNWjgDTsVjsQ7qXyTjztXJhm9ePxFLfMTg4eG9tbe1RTP9KFFYQfHliYmIS69kCC7jKYmKwxxD5P88tkVkqbPPcIps9t4T/+HjcuJ/s5BFJgf4WYABCtxGuxIZ90gAAAABJRU5ErkJggg==":IMAGE_PATH+"/handle-connect.png",26,26);var BackgroundImageDialog=function(e,t,l){var n=document.createElement("div");n.style.whiteSpace="nowrap";var i=document.createElement("h2");mxUtils.write(i,mxResources.get("backgroundImage")),i.style.marginTop="0px",n.appendChild(i);var a=null!=l&&null!=l.originalSrc,s=!1,r=document.createElement("input");r.style.cssText="margin-right:8px;margin-bottom:8px;",r.setAttribute("value","url"),r.setAttribute("type","radio"),r.setAttribute("name","geBackgroundImageDialogOption");var o=document.createElement("input");o.style.cssText="margin-right:8px;margin-bottom:8px;",o.setAttribute("value","url"),o.setAttribute("type","radio"),o.setAttribute("name","geBackgroundImageDialogOption");var d=document.createElement("input");d.setAttribute("type","text"),d.style.marginBottom="8px",d.style.width="320px",d.value=a||null==l?"":l.src;var c=document.createElement("select");if(c.style.width="320px",null!=e.pages)for(var m=0;m<e.pages.length;m++){var u=document.createElement("option");mxUtils.write(u,e.pages[m].getName()||mxResources.get("pageWithNumber",[m+1])),u.setAttribute("value","data:page/id,"+e.pages[m].getId()),e.pages[m]==e.currentPage&&u.setAttribute("disabled","disabled"),null!=l&&l.originalSrc==u.getAttribute("value")&&(u.setAttribute("selected","selected"),s=!0),c.appendChild(u)}a||null!=e.pages&&1!=e.pages.length||(r.style.display="none",o.style.display="none",c.style.display="none");var p=!1,g=!1,h=function(t,l){p||null!=t&&g||(o.checked?null!=l&&l(c.value):""==d.value||e.isOffline()?(v.value="",y.value="",null!=l&&l("")):(d.value=mxUtils.trim(d.value),e.loadImage(d.value,(function(e){v.value=e.width,y.value=e.height,null!=l&&l(d.value)}),(function(){e.showError(mxResources.get("error"),mxResources.get("fileNotFound"),mxResources.get("ok")),v.value="",y.value="",null!=l&&l(null)}))))};this.init=function(){if(a?c.focus():d.focus(),mxEvent.addListener(c,"focus",(function(){r.removeAttribute("checked"),o.setAttribute("checked","checked"),o.checked=!0})),mxEvent.addListener(d,"focus",(function(){o.removeAttribute("checked"),r.setAttribute("checked","checked"),r.checked=!0})),Graph.fileSupport){d.setAttribute("placeholder",mxResources.get("dragImagesHere"));var t=n.parentNode,l=(e.editor.graph,null);mxEvent.addListener(t,"dragleave",(function(e){null!=l&&(l.parentNode.removeChild(l),l=null),e.stopPropagation(),e.preventDefault()})),mxEvent.addListener(t,"dragover",mxUtils.bind(this,(function(n){null==l&&(!mxClient.IS_IE||document.documentMode>10)&&(l=e.highlightElement(t)),n.stopPropagation(),n.preventDefault()}))),mxEvent.addListener(t,"drop",mxUtils.bind(this,(function(t){if(null!=l&&(l.parentNode.removeChild(l),l=null),t.dataTransfer.files.length>0)e.importFiles(t.dataTransfer.files,0,0,e.maxBackgroundSize,(function(e,t,l,n,i,a){d.value=e,h()}),(function(){}),(function(e){return"image/"==e.type.substring(0,6)}),(function(e){for(var t=0;t<e.length;t++)e[t]()}),!0,e.maxBackgroundBytes,e.maxBackgroundBytes,!0);else if(mxUtils.indexOf(t.dataTransfer.types,"text/uri-list")>=0){var n=t.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(n)&&(d.value=decodeURIComponent(n),h())}t.stopPropagation(),t.preventDefault()})),!1)}},n.appendChild(r),n.appendChild(d),mxUtils.br(n);var x=document.createElement("span");x.style.marginLeft="30px",mxUtils.write(x,mxResources.get("width")+":"),n.appendChild(x);var v=document.createElement("input");v.setAttribute("type","text"),v.style.width="60px",v.style.marginLeft="8px",v.style.marginRight="16px",v.value=null==l||a?"":l.width,n.appendChild(v),mxUtils.write(n,mxResources.get("height")+":");var y=document.createElement("input");if(y.setAttribute("type","text"),y.style.width="60px",y.style.marginLeft="8px",y.style.marginRight="16px",y.value=null==l||a?"":l.height,n.appendChild(y),mxUtils.br(n),mxUtils.br(n),mxEvent.addListener(d,"change",h),ImageDialog.filePicked=function(e){if(e.action==google.picker.Action.PICKED&&null!=e.docs[0].thumbnails){var t=e.docs[0].thumbnails[e.docs[0].thumbnails.length-1];null!=t&&(d.value=t.url,h())}d.focus()},n.appendChild(o),n.appendChild(c),mxUtils.br(n),a?(o.setAttribute("checked","checked"),o.checked=!0):(r.setAttribute("checked","checked"),r.checked=!0),!s&&o.checked){var b=document.createElement("option");mxUtils.write(b,mxResources.get("pageNotFound")),b.setAttribute("disabled","disabled"),b.setAttribute("selected","selected"),b.setAttribute("value","pageNotFound"),c.appendChild(b),mxEvent.addListener(c,"change",(function(){null==b.parentNode||b.selected||b.parentNode.removeChild(b)}))}var f=document.createElement("div");f.style.marginTop="30px",f.style.textAlign="right";var E=mxUtils.button(mxResources.get("reset"),(function(){d.value="",v.value="",y.value="",r.checked=!0,p=!1}));mxEvent.addGestureListeners(E,(function(){p=!0})),E.className="geBtn",E.width="100",f.appendChild(E);var C=mxUtils.button(mxResources.get("cancel"),(function(){p=!0,e.hideDialog()}));C.className="geBtn",e.editor.cancelFirst&&f.appendChild(C),applyBtn=mxUtils.button(mxResources.get("apply"),(function(){e.hideDialog(),h(null,(function(e){t(""!=e&&null!=e?new mxImage(e,v.value,y.value):null,null==e)}))})),mxEvent.addGestureListeners(applyBtn,(function(){g=!0})),applyBtn.className="geBtn gePrimaryBtn",f.appendChild(applyBtn),e.editor.cancelFirst||f.appendChild(C),n.appendChild(f),this.container=n},ParseDialog=function(e,t,l){var n="@startuml\nskinparam shadowing false\nAlice -> Bob: Authentication Request\nBob --\x3e Alice: Authentication Response\n\nAlice -> Bob: Another authentication Request\nAlice <-- Bob: Another authentication Response\n@enduml",i=e.editor.graph.getFreeInsertPoint(),a=document.createElement("div");a.style.textAlign="right";var s=document.createElement("textarea");s.style.resize="none",s.style.width="100%",s.style.height="354px",s.style.marginBottom="16px";var r=document.createElement("select");"formatSql"!=l&&"mermaid"!=l||(r.style.display="none");var o=document.createElement("option");o.setAttribute("value","list"),mxUtils.write(o,mxResources.get("list")),"plantUml"!=l&&r.appendChild(o),null!=l&&"fromText"!=l||o.setAttribute("selected","selected");var d=document.createElement("option");d.setAttribute("value","table"),mxUtils.write(d,mxResources.get("formatSql")),"formatSql"==l&&(r.appendChild(d),d.setAttribute("selected","selected"));var c=document.createElement("option");c.setAttribute("value","mermaid"),mxUtils.write(c,mxResources.get("formatSql")),"mermaid"==l&&(r.appendChild(c),c.setAttribute("selected","selected"));var m=document.createElement("option");m.setAttribute("value","diagram"),mxUtils.write(m,mxResources.get("diagram")),"plantUml"!=l&&r.appendChild(m);var u=document.createElement("option");u.setAttribute("value","plantUmlSvg"),mxUtils.write(u,mxResources.get("plantUml")+" ("+mxResources.get("formatSvg")+")"),"plantUml"==l&&u.setAttribute("selected","selected");var p=document.createElement("option");p.setAttribute("value","plantUmlPng"),mxUtils.write(p,mxResources.get("plantUml")+" ("+mxResources.get("formatPng")+")");var g=document.createElement("option");function h(){return"list"==r.value?"Person\n-name: String\n-birthDate: Date\n--\n+getName(): String\n+setName(String): void\n+isBirthday(): boolean\n\nAddress\n-street: String\n-city: String\n-state: String":"mermaid"==r.value?"graph TD;\n A--\x3eB;\n A--\x3eC;\n B--\x3eD;\n C--\x3eD;":"table"==r.value?"CREATE TABLE Suppliers\n(\nsupplier_id int NOT NULL PRIMARY KEY,\nsupplier_name char(50) NOT NULL,\ncontact_name char(50),\n);\nCREATE TABLE Customers\n(\ncustomer_id int NOT NULL PRIMARY KEY,\ncustomer_name char(50) NOT NULL,\naddress char(50),\ncity char(50),\nstate char(25),\nzip_code char(10)\n);\n":"plantUmlPng"==r.value?"@startuml\nskinparam backgroundcolor transparent\nskinparam shadowing false\nAlice -> Bob: Authentication Request\nBob --\x3e Alice: Authentication Response\n\nAlice -> Bob: Another authentication Request\nAlice <-- Bob: Another authentication Response\n@enduml":"plantUmlSvg"==r.value||"plantUmlTxt"==r.value?n:";Example:\na->b\nb->edge label->c\nc->a\n"}g.setAttribute("value","plantUmlTxt"),mxUtils.write(g,mxResources.get("plantUml")+" ("+mxResources.get("text")+")"),EditorUi.enablePlantUml&&Graph.fileSupport&&!e.isOffline()&&"plantUml"==l&&(r.appendChild(u),r.appendChild(p),r.appendChild(g));var x=h();if(s.value=x,a.appendChild(s),this.init=function(){s.focus()},Graph.fileSupport&&(s.addEventListener("dragover",(function(e){e.stopPropagation(),e.preventDefault()}),!1),s.addEventListener("drop",(function(e){if(e.stopPropagation(),e.preventDefault(),e.dataTransfer.files.length>0){var t=e.dataTransfer.files[0],l=new FileReader;l.onload=function(e){s.value=e.target.result},l.readAsText(t)}}),!1)),a.appendChild(r),mxEvent.addListener(r,"change",(function(){var e=h();0!=s.value.length&&s.value!=x||(x=e,s.value=x)})),!e.isOffline()&&("mermaid"==l||"plantUml"==l)){var v=mxUtils.button(mxResources.get("help"),(function(){e.openLink("mermaid"==l?"https://mermaid-js.github.io/mermaid/#/":"https://plantuml.com/")}));v.className="geBtn",a.appendChild(v)}var y=mxUtils.button(mxResources.get("close"),(function(){s.value==x?e.hideDialog():e.confirm(mxResources.get("areYouSure"),(function(){e.hideDialog()}))}));y.className="geBtn",e.editor.cancelFirst&&a.appendChild(y);var b=mxUtils.button(mxResources.get("insert"),(function(t){e.hideDialog(),function(t,l,a){var s=t.split("\n");if("plantUmlPng"==l||"plantUmlSvg"==l||"plantUmlTxt"==l){if(e.spinner.spin(document.body,mxResources.get("inserting"))){var r=e.editor.graph,o="plantUmlTxt"==l?"txt":"plantUmlPng"==l?"png":"svg";function d(t,l,n,s,o){i=mxEvent.isAltDown(a)?i:r.getCenterInsertPoint(new mxRectangle(0,0,s,o));var d=null;r.getModel().beginUpdate();try{d="txt"==l?e.insertAsPreText(n,i.x,i.y):r.insertVertex(null,null,null,i.x,i.y,s,o,"shape=image;noLabel=1;verticalAlign=top;aspect=fixed;imageAspect=0;image="+e.convertDataUri(n)+";"),r.setAttributeForCell(d,"plantUmlData",JSON.stringify({data:t,format:l},null,2))}finally{r.getModel().endUpdate()}null!=d&&(r.setSelectionCell(d),r.scrollCellToVisible(d))}t==n&&"svg"==o?window.setTimeout((function(){e.spinner.stop(),d(t,o,"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBjb250ZW50U2NyaXB0VHlwZT0iYXBwbGljYXRpb24vZWNtYXNjcmlwdCIgY29udGVudFN0eWxlVHlwZT0idGV4dC9jc3MiIGhlaWdodD0iMjEycHgiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiIHN0eWxlPSJ3aWR0aDoyOTVweDtoZWlnaHQ6MjEycHg7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyOTUgMjEyIiB3aWR0aD0iMjk1cHgiIHpvb21BbmRQYW49Im1hZ25pZnkiPjxkZWZzLz48Zz48bGluZSBzdHlsZT0ic3Ryb2tlOiAjQTgwMDM2OyBzdHJva2Utd2lkdGg6IDEuMDsgc3Ryb2tlLWRhc2hhcnJheTogNS4wLDUuMDsiIHgxPSIzMSIgeDI9IjMxIiB5MT0iMzQuNDg4MyIgeTI9IjE3MS43MzA1Ii8+PGxpbmUgc3R5bGU9InN0cm9rZTogI0E4MDAzNjsgc3Ryb2tlLXdpZHRoOiAxLjA7IHN0cm9rZS1kYXNoYXJyYXk6IDUuMCw1LjA7IiB4MT0iMjY0LjUiIHgyPSIyNjQuNSIgeTE9IjM0LjQ4ODMiIHkyPSIxNzEuNzMwNSIvPjxyZWN0IGZpbGw9IiNGRUZFQ0UiIGhlaWdodD0iMzAuNDg4MyIgc3R5bGU9InN0cm9rZTogI0E4MDAzNjsgc3Ryb2tlLXdpZHRoOiAxLjU7IiB3aWR0aD0iNDciIHg9IjgiIHk9IjMiLz48dGV4dCBmaWxsPSIjMDAwMDAwIiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNCIgbGVuZ3RoQWRqdXN0PSJzcGFjaW5nQW5kR2x5cGhzIiB0ZXh0TGVuZ3RoPSIzMyIgeD0iMTUiIHk9IjIzLjUzNTIiPkFsaWNlPC90ZXh0PjxyZWN0IGZpbGw9IiNGRUZFQ0UiIGhlaWdodD0iMzAuNDg4MyIgc3R5bGU9InN0cm9rZTogI0E4MDAzNjsgc3Ryb2tlLXdpZHRoOiAxLjU7IiB3aWR0aD0iNDciIHg9IjgiIHk9IjE3MC43MzA1Ii8+PHRleHQgZmlsbD0iIzAwMDAwMCIgZm9udC1mYW1pbHk9InNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTQiIGxlbmd0aEFkanVzdD0ic3BhY2luZ0FuZEdseXBocyIgdGV4dExlbmd0aD0iMzMiIHg9IjE1IiB5PSIxOTEuMjY1NiI+QWxpY2U8L3RleHQ+PHJlY3QgZmlsbD0iI0ZFRkVDRSIgaGVpZ2h0PSIzMC40ODgzIiBzdHlsZT0ic3Ryb2tlOiAjQTgwMDM2OyBzdHJva2Utd2lkdGg6IDEuNTsiIHdpZHRoPSI0MCIgeD0iMjQ0LjUiIHk9IjMiLz48dGV4dCBmaWxsPSIjMDAwMDAwIiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNCIgbGVuZ3RoQWRqdXN0PSJzcGFjaW5nQW5kR2x5cGhzIiB0ZXh0TGVuZ3RoPSIyNiIgeD0iMjUxLjUiIHk9IjIzLjUzNTIiPkJvYjwvdGV4dD48cmVjdCBmaWxsPSIjRkVGRUNFIiBoZWlnaHQ9IjMwLjQ4ODMiIHN0eWxlPSJzdHJva2U6ICNBODAwMzY7IHN0cm9rZS13aWR0aDogMS41OyIgd2lkdGg9IjQwIiB4PSIyNDQuNSIgeT0iMTcwLjczMDUiLz48dGV4dCBmaWxsPSIjMDAwMDAwIiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNCIgbGVuZ3RoQWRqdXN0PSJzcGFjaW5nQW5kR2x5cGhzIiB0ZXh0TGVuZ3RoPSIyNiIgeD0iMjUxLjUiIHk9IjE5MS4yNjU2Ij5Cb2I8L3RleHQ+PHBvbHlnb24gZmlsbD0iI0E4MDAzNiIgcG9pbnRzPSIyNTIuNSw2MS43OTg4LDI2Mi41LDY1Ljc5ODgsMjUyLjUsNjkuNzk4OCwyNTYuNSw2NS43OTg4IiBzdHlsZT0ic3Ryb2tlOiAjQTgwMDM2OyBzdHJva2Utd2lkdGg6IDEuMDsiLz48bGluZSBzdHlsZT0ic3Ryb2tlOiAjQTgwMDM2OyBzdHJva2Utd2lkdGg6IDEuMDsiIHgxPSIzMS41IiB4Mj0iMjU4LjUiIHkxPSI2NS43OTg4IiB5Mj0iNjUuNzk4OCIvPjx0ZXh0IGZpbGw9IiMwMDAwMDAiIGZvbnQtZmFtaWx5PSJzYW5zLXNlcmlmIiBmb250LXNpemU9IjEzIiBsZW5ndGhBZGp1c3Q9InNwYWNpbmdBbmRHbHlwaHMiIHRleHRMZW5ndGg9IjE0NyIgeD0iMzguNSIgeT0iNjEuMDU2NiI+QXV0aGVudGljYXRpb24gUmVxdWVzdDwvdGV4dD48cG9seWdvbiBmaWxsPSIjQTgwMDM2IiBwb2ludHM9IjQyLjUsOTEuMTA5NCwzMi41LDk1LjEwOTQsNDIuNSw5OS4xMDk0LDM4LjUsOTUuMTA5NCIgc3R5bGU9InN0cm9rZTogI0E4MDAzNjsgc3Ryb2tlLXdpZHRoOiAxLjA7Ii8+PGxpbmUgc3R5bGU9InN0cm9rZTogI0E4MDAzNjsgc3Ryb2tlLXdpZHRoOiAxLjA7IHN0cm9rZS1kYXNoYXJyYXk6IDIuMCwyLjA7IiB4MT0iMzYuNSIgeDI9IjI2My41IiB5MT0iOTUuMTA5NCIgeTI9Ijk1LjEwOTQiLz48dGV4dCBmaWxsPSIjMDAwMDAwIiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIxMyIgbGVuZ3RoQWRqdXN0PSJzcGFjaW5nQW5kR2x5cGhzIiB0ZXh0TGVuZ3RoPSIxNTciIHg9IjQ4LjUiIHk9IjkwLjM2NzIiPkF1dGhlbnRpY2F0aW9uIFJlc3BvbnNlPC90ZXh0Pjxwb2x5Z29uIGZpbGw9IiNBODAwMzYiIHBvaW50cz0iMjUyLjUsMTIwLjQxOTksMjYyLjUsMTI0LjQxOTksMjUyLjUsMTI4LjQxOTksMjU2LjUsMTI0LjQxOTkiIHN0eWxlPSJzdHJva2U6ICNBODAwMzY7IHN0cm9rZS13aWR0aDogMS4wOyIvPjxsaW5lIHN0eWxlPSJzdHJva2U6ICNBODAwMzY7IHN0cm9rZS13aWR0aDogMS4wOyIgeDE9IjMxLjUiIHgyPSIyNTguNSIgeTE9IjEyNC40MTk5IiB5Mj0iMTI0LjQxOTkiLz48dGV4dCBmaWxsPSIjMDAwMDAwIiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIxMyIgbGVuZ3RoQWRqdXN0PSJzcGFjaW5nQW5kR2x5cGhzIiB0ZXh0TGVuZ3RoPSIxOTkiIHg9IjM4LjUiIHk9IjExOS42Nzc3Ij5Bbm90aGVyIGF1dGhlbnRpY2F0aW9uIFJlcXVlc3Q8L3RleHQ+PHBvbHlnb24gZmlsbD0iI0E4MDAzNiIgcG9pbnRzPSI0Mi41LDE0OS43MzA1LDMyLjUsMTUzLjczMDUsNDIuNSwxNTcuNzMwNSwzOC41LDE1My43MzA1IiBzdHlsZT0ic3Ryb2tlOiAjQTgwMDM2OyBzdHJva2Utd2lkdGg6IDEuMDsiLz48bGluZSBzdHlsZT0ic3Ryb2tlOiAjQTgwMDM2OyBzdHJva2Utd2lkdGg6IDEuMDsgc3Ryb2tlLWRhc2hhcnJheTogMi4wLDIuMDsiIHgxPSIzNi41IiB4Mj0iMjYzLjUiIHkxPSIxNTMuNzMwNSIgeTI9IjE1My43MzA1Ii8+PHRleHQgZmlsbD0iIzAwMDAwMCIgZm9udC1mYW1pbHk9InNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTMiIGxlbmd0aEFkanVzdD0ic3BhY2luZ0FuZEdseXBocyIgdGV4dExlbmd0aD0iMjA5IiB4PSI0OC41IiB5PSIxNDguOTg4MyI+QW5vdGhlciBhdXRoZW50aWNhdGlvbiBSZXNwb25zZTwvdGV4dD48IS0tTUQ1PVs3ZjNlNGQwYzkwMWVmZGJjNTdlYjQ0MjQ5YTNiODE5N10KQHN0YXJ0dW1sDQpza2lucGFyYW0gc2hhZG93aW5nIGZhbHNlDQpBbGljZSAtPiBCb2I6IEF1dGhlbnRpY2F0aW9uIFJlcXVlc3QNCkJvYiAtIC0+IEFsaWNlOiBBdXRoZW50aWNhdGlvbiBSZXNwb25zZQ0KDQpBbGljZSAtPiBCb2I6IEFub3RoZXIgYXV0aGVudGljYXRpb24gUmVxdWVzdA0KQWxpY2UgPC0gLSBCb2I6IEFub3RoZXIgYXV0aGVudGljYXRpb24gUmVzcG9uc2UNCkBlbmR1bWwNCgpQbGFudFVNTCB2ZXJzaW9uIDEuMjAyMC4wMihTdW4gTWFyIDAxIDA0OjIyOjA3IENTVCAyMDIwKQooTUlUIHNvdXJjZSBkaXN0cmlidXRpb24pCkphdmEgUnVudGltZTogT3BlbkpESyBSdW50aW1lIEVudmlyb25tZW50CkpWTTogT3BlbkpESyA2NC1CaXQgU2VydmVyIFZNCkphdmEgVmVyc2lvbjogMTIrMzMKT3BlcmF0aW5nIFN5c3RlbTogTWFjIE9TIFgKRGVmYXVsdCBFbmNvZGluZzogVVRGLTgKTGFuZ3VhZ2U6IGVuCkNvdW50cnk6IFVTCi0tPjwvZz48L3N2Zz4=",295,212)}),200):e.generatePlantUmlImage(t,o,(function(l,n,i){e.spinner.stop(),d(t,o,l,n,i)}),(function(t){e.handleError(t)}))}}else if("mermaid"==l)e.spinner.spin(document.body,mxResources.get("inserting"))&&(r=e.editor.graph,e.generateMermaidImage(t,o,(function(l,n,s){i=mxEvent.isAltDown(a)?i:r.getCenterInsertPoint(new mxRectangle(0,0,n,s)),e.spinner.stop();var o=null;r.getModel().beginUpdate();try{o=r.insertVertex(null,null,null,i.x,i.y,n,s,"shape=image;noLabel=1;verticalAlign=top;imageAspect=1;image="+l+";"),r.setAttributeForCell(o,"mermaidData",JSON.stringify({data:t,config:EditorUi.defaultMermaidConfig},null,2))}finally{r.getModel().endUpdate()}null!=o&&(r.setSelectionCell(o),r.scrollCellToVisible(o))}),(function(t){e.handleError(t)})));else if("table"==l){for(var c=null,m=[],u=0,p={},g=0;g<s.length;g++){var h=mxUtils.trim(s[g]);"primary key"==h.substring(0,11).toLowerCase()?((y=h.match(/\((.+)\)/))&&y[1]&&(p[y[1]]=!0),s.splice(g,1)):h.toLowerCase().indexOf("primary key")>0&&(p[h.split(" ")[0]]=!0,s[g]=mxUtils.trim(h.replace(/primary key/i,"")))}for(g=0;g<s.length;g++){var x=mxUtils.trim(s[g]);if("create table"==x.substring(0,12).toLowerCase())"("==(v=mxUtils.trim(x.substring(12))).charAt(v.length-1)&&(v=mxUtils.trim(v.substring(0,v.length-1))),(c=new mxCell(v,new mxGeometry(u,0,160,40),"shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;")).vertex=!0,m.push(c),null!=(S=e.editor.graph.getPreferredSizeForCell(b))&&(c.geometry.width=S.width+10);else if(null!=c&&")"==x.charAt(0))u+=c.geometry.width+40,c=null;else if("("!=x&&null!=c){var v,y=p[(v=x.substring(0,","==x.charAt(x.length-1)?x.length-1:x.length)).split(" ")[0]],b=new mxCell("",new mxGeometry(0,0,160,30),"shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom="+(y?"1":"0")+";");b.vertex=!0;var f=new mxCell(y?"PK":"",new mxGeometry(0,0,30,30),"shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;"+(y?"fontStyle=1;":""));f.vertex=!0,b.insert(f);var E=new mxCell(v,new mxGeometry(30,0,130,30),"shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;"+(y?"fontStyle=5;":""));E.vertex=!0,b.insert(E),null!=(S=e.editor.graph.getPreferredSizeForCell(E))&&c.geometry.width<S.width+30&&(c.geometry.width=Math.min(320,Math.max(c.geometry.width,S.width+30))),c.insert(b,y?0:null),c.geometry.height+=30}}m.length>0&&(r=e.editor.graph,i=mxEvent.isAltDown(a)?i:r.getCenterInsertPoint(r.getBoundingBoxFromGeometry(m,!0)),r.setSelectionCells(r.importCells(m,i.x,i.y)),r.scrollCellToVisible(r.getSelectionCell()))}else if("list"==l){if(s.length>0){r=e.editor.graph;var C=null,w=(m=[],0);for(g=0;g<s.length;g++)if(";"!=s[g].charAt(0))if(0==s[g].length)C=null;else if(null==C)(C=new mxCell(s[g],new mxGeometry(w,0,160,30),"swimlane;fontStyle=1;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;")).vertex=!0,m.push(C),null!=(S=r.getPreferredSizeForCell(C))&&C.geometry.width<S.width+10&&(C.geometry.width=S.width+10),w+=C.geometry.width+40;else if("--"==s[g]){var A=new mxCell("",new mxGeometry(0,0,40,8),"line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;");A.vertex=!0,C.geometry.height+=A.geometry.height,C.insert(A)}else if(s[g].length>0){var D=new mxCell(s[g],new mxGeometry(0,0,60,26),"text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;");D.vertex=!0,null!=(S=r.getPreferredSizeForCell(D))&&D.geometry.width<S.width&&(D.geometry.width=S.width),C.geometry.width=Math.max(C.geometry.width,D.geometry.width),C.geometry.height+=D.geometry.height,C.insert(D)}if(m.length>0){i=mxEvent.isAltDown(a)?i:r.getCenterInsertPoint(r.getBoundingBoxFromGeometry(m,!0)),r.getModel().beginUpdate();try{m=r.importCells(m,i.x,i.y);var T=[];for(g=0;g<m.length;g++)T.push(m[g]),T=T.concat(m[g].children);r.fireEvent(new mxEventObject("cellsInserted","cells",T))}finally{r.getModel().endUpdate()}r.setSelectionCells(m),r.scrollCellToVisible(r.getSelectionCell())}}}else{var R=new Object;function I(e){var t=R[e];return null==t&&((t=new mxCell(e,new mxGeometry(0,0,80,30),"whiteSpace=wrap;html=1;")).vertex=!0,R[e]=t,m.push(t)),t}for(m=[],g=0;g<s.length;g++)if(";"!=s[g].charAt(0)){var L=s[g].split("->");if(L.length>=2){var U=I(L[0]),k=I(L[L.length-1]),M=new mxCell(L.length>2?L[1]:"",new mxGeometry);M.edge=!0,U.insertEdge(M,!0),k.insertEdge(M,!1),m.push(M)}}if(m.length>0){var N=document.createElement("div");N.style.visibility="hidden",e.container.appendChild(N)||document.body.appendChild(N),(r=new Graph(N)).getModel().beginUpdate();try{for(m=r.importCells(m),g=0;g<m.length;g++)if(r.getModel().isVertex(m[g])){var S=r.getPreferredSizeForCell(m[g]);m[g].geometry.width=Math.max(m[g].geometry.width,S.width),m[g].geometry.height=Math.max(m[g].geometry.height,S.height)}var B=new mxFastOrganicLayout(r);B.disableEdgeStyle=!1,B.forceConstant=120,B.execute(r.getDefaultParent());var O=new mxParallelEdgeLayout(r);O.spacing=20,O.execute(r.getDefaultParent())}finally{r.getModel().endUpdate()}r.clearCellOverlays(),T=[],e.editor.graph.getModel().beginUpdate();try{m=r.getModel().getChildren(r.getDefaultParent()),i=mxEvent.isAltDown(a)?i:e.editor.graph.getCenterInsertPoint(r.getBoundingBoxFromGeometry(m,!0)),T=e.editor.graph.importCells(m,i.x,i.y),e.editor.graph.fireEvent(new mxEventObject("cellsInserted","cells",T))}finally{e.editor.graph.getModel().endUpdate()}e.editor.graph.setSelectionCells(T),e.editor.graph.scrollCellToVisible(e.editor.graph.getSelectionCell()),r.destroy(),N.parentNode.removeChild(N)}}}(s.value,r.value,t)}));a.appendChild(b),b.className="geBtn gePrimaryBtn",e.editor.cancelFirst||a.appendChild(y),this.container=a},NewDialog=function(e,t,l,n,i,a,s,r,o,d,c,m,u,p,g,h,x,v){var y=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<500;l=null==l||l,i=null!=i&&i,s=null!=s?s:"#ebf2f9",r=null!=r?r:Editor.isDarkMode()?"#a2a2a2":"#e6eff8",o=null!=o?o:Editor.isDarkMode()?"1px dashed #00a8ff":"1px solid #ccd9ea",c=null!=c?c:EditorUi.templateFile;var b=document.createElement("div");b.style.userSelect="none",b.style.height="100%";var f=document.createElement("div");f.style.whiteSpace="nowrap",f.style.height="46px",l&&b.appendChild(f);var E=document.createElement("img");E.setAttribute("border","0"),E.setAttribute("align","absmiddle"),E.style.width="40px",E.style.height="40px",E.style.marginRight="10px",E.style.paddingBottom="4px",e.mode==App.MODE_GOOGLE?E.src=IMAGE_PATH+"/google-drive-logo.svg":e.mode==App.MODE_DROPBOX?E.src=IMAGE_PATH+"/dropbox-logo.svg":e.mode==App.MODE_ONEDRIVE?E.src=IMAGE_PATH+"/onedrive-logo.svg":e.mode==App.MODE_GITHUB?E.src=IMAGE_PATH+"/github-logo.svg":e.mode==App.MODE_GITLAB?E.src=IMAGE_PATH+"/gitlab-logo.svg":e.mode==App.MODE_NOTION?E.src=IMAGE_PATH+"/notion-logo.svg":e.mode==App.MODE_TRELLO?E.src=IMAGE_PATH+"/trello-logo.svg":e.mode==App.MODE_BROWSER?E.src=IMAGE_PATH+"/osa_database.png":E.src=IMAGE_PATH+"/osa_drive-harddisk.png",t||y||!l||f.appendChild(E),l&&mxUtils.write(f,(y?mxResources.get("name"):null==e.mode||e.mode==App.MODE_GOOGLE||e.mode==App.MODE_BROWSER?mxResources.get("diagramName"):mxResources.get("filename"))+":");var C=".drawio";e.mode==App.MODE_GOOGLE&&null!=e.drive?C=e.drive.extension:e.mode==App.MODE_DROPBOX&&null!=e.dropbox?C=e.dropbox.extension:e.mode==App.MODE_ONEDRIVE&&null!=e.oneDrive?C=e.oneDrive.extension:e.mode==App.MODE_GITHUB&&null!=e.gitHub?C=e.gitHub.extension:e.mode==App.MODE_GITLAB&&null!=e.gitLab?C=e.gitLab.extension:e.mode==App.MODE_NOTION&&null!=e.notion?C=e.notion.extension:e.mode==App.MODE_TRELLO&&null!=e.trello&&(C=e.trello.extension);var w=document.createElement("input");if(w.setAttribute("value",e.defaultFilename+C),w.style.marginLeft="10px",w.style.width=t||y?"144px":"244px",this.init=function(){l&&(w.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?w.select():document.execCommand("selectAll",!1,null)),null!=q.parentNode&&null!=q.parentNode.parentNode&&mxEvent.addGestureListeners(q.parentNode.parentNode,mxUtils.bind(this,(function(t){e.sidebar.hideTooltip()})),null,null)},l)if(f.appendChild(w),v)w.style.width=t||y?"350px":"450px";else{if(null!=e.editor.diagramFileTypes){var A=FilenameDialog.createFileTypes(e,w,e.editor.diagramFileTypes);A.style.marginLeft="6px",A.style.width=t||y?"80px":"180px",f.appendChild(A)}if(null!=e.editor.fileExtensions){var D=FilenameDialog.createTypeHint(e,w,e.editor.fileExtensions);D.style.marginTop="12px",f.appendChild(D)}}var T=!1,R=0;function I(e){null!=e&&(ie=ae=e?135:140);var t=!0;if(null!=he)for(;R<he.length&&(t||0!=mxUtils.mod(R,30));){var l=he[R++],n=re(l.url,l.libs,l.title,l.tooltip?l.tooltip:l.title,l.select,l.imgUrl,l.info,l.onClick,l.preview,l.noImg,l.clibs);t&&n.click(),t=!1}}var L=new Spinner({lines:12,length:10,width:5,radius:10,rotate:0,color:"#000",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"40%",zIndex:2e9}),U=mxUtils.button(h||mxResources.get("create"),(function(){U.setAttribute("disabled","disabled"),J(),U.removeAttribute("disabled")}));if(U.className="geBtn gePrimaryBtn",m||u){var k=[],M=null,N=null,S=null,B=function(e){U.setAttribute("disabled","disabled");for(var t=0;t<k.length;t++)k[t].className=t==e?"geBtn gePrimaryBtn":"geBtn"};T=!0;var O=document.createElement("div");O.style.whiteSpace="nowrap",O.style.height="30px",b.appendChild(O);var P=mxUtils.button(mxResources.get("Templates",null,"Templates"),(function(){ne.style.display="",$.style.display="",q.style.left="160px",B(0),q.scrollTop=0,q.innerHTML="",R=0,M!=he&&(he=M,oe=N,me=S,ne.innerHTML="",ve(),M=null)}));k.push(P),O.appendChild(P);var G=function(e){ne.style.display="none",$.style.display="none",q.style.left="30px",B(e?-1:1),null==M&&(M=he),q.scrollTop=0,q.innerHTML="",L.spin(q);var t=function(e,t,l){R=0,L.stop(),he=e,l=l||{};var n=0;for(var i in l)n+=l[i].length;if(t)q.innerHTML=t;else if(0==e.length&&0==n)q.innerHTML=mxUtils.htmlEntities(mxResources.get("noDiagrams",null,"No Diagrams Found"));else if(q.innerHTML="",n>0){for(var i in ne.style.display="",q.style.left="160px",ne.innerHTML="",me=0,oe={"draw.io":e},l)oe[i]=l[i];ve()}else I(!0)};e?u(z.value,t):m(t)};if(m){var H=mxUtils.button(mxResources.get("Recent",null,"Recent"),(function(){G()}));O.appendChild(H),k.push(H)}if(u){var F=document.createElement("span");F.style.marginLeft="10px",F.innerHTML=mxUtils.htmlEntities(mxResources.get("search")+":"),O.appendChild(F);var z=document.createElement("input");z.style.marginRight="10px",z.style.marginLeft="10px",z.style.width="220px",mxEvent.addListener(z,"keypress",(function(e){13==e.keyCode&&G(!0)})),O.appendChild(z);var _=mxUtils.button(mxResources.get("search"),(function(){G(!0)}));_.className="geBtn",O.appendChild(_)}B(0)}var j=null,W=null,Z=null,V=null,X=null,Y=null,Q=null;function J(){if(X&&null!=p)l||e.hideDialog(),p(X,Q,w.value);else if(n)l||e.hideDialog(),n(Z,w.value,Y,j);else{var t=w.value;null!=t&&t.length>0&&e.pickFolder(e.mode,(function(l){e.createFile(t,Z,null!=j&&j.length>0?j:null,null,(function(){e.hideDialog()}),null,l,null,null!=W&&W.length>0?W:null)}),e.mode!=App.MODE_GOOGLE||null==e.stateArg||null==e.stateArg.folderId)}}var q=document.createElement("div");q.style.border="1px solid #d3d3d3",q.style.position="absolute",q.style.left="160px",q.style.right="34px";var K=l?72:40;K+=T?30:0,q.style.top=K+"px",q.style.bottom="68px",q.style.margin="6px 0 0 -1px",q.style.padding="6px",q.style.overflow="auto";var $=document.createElement("div");$.style.cssText="position:absolute;left:30px;width:128px;top:"+K+"px;height:22px;margin-top: 6px;white-space: nowrap";var ee=document.createElement("input");ee.style.cssText="width:105px;height:16px;border:1px solid #d3d3d3;padding: 3px 20px 3px 3px;font-size: 12px",ee.setAttribute("placeholder",mxResources.get("search")),ee.setAttribute("type","text"),$.appendChild(ee);var te=document.createElement("img"),le="undefined"!=typeof Sidebar?Sidebar.prototype.searchImage:IMAGE_PATH+"/search.png";te.setAttribute("src",le),te.setAttribute("title",mxResources.get("search")),te.style.position="relative",te.style.left="-18px",te.style.top="1px",te.style.background="url('"+e.editor.transparentImage+"')",$.appendChild(te),mxEvent.addListener(te,"click",(function(){te.getAttribute("src")==Dialog.prototype.closeImage&&(te.setAttribute("src",le),te.setAttribute("title",mxResources.get("search")),ee.value="",xe()),ee.focus()})),mxEvent.addListener(ee,"keydown",mxUtils.bind(this,(function(e){13==e.keyCode&&(function(){var e=ee.value;if(""!=e){if(null==NewDialog.tagsList[c]){var t={};for(var l in oe)for(var n=oe[l],i=0;i<n.length;i++)if(null!=(h=n[i]).tags)for(var a=h.tags.toLowerCase().split(";"),s=0;s<a.length;s++)null==t[a[s]]&&(t[a[s]]=[]),t[a[s]].push(h);NewDialog.tagsList[c]=t}var r=e.toLowerCase().split(" ");if(t=NewDialog.tagsList[c],me>0&&null==t.__tagsList__){for(var l in ce)for(n=ce[l],i=0;i<n.length;i++)for((a=(h=n[i]).title.split(" ")).push(l),s=0;s<a.length;s++){var o=a[s].toLowerCase();null==t[o]&&(t[o]=[]),t[o].push(h)}t.__tagsList__=!0}var d=[],m={},u=0;for(i=0;i<r.length;i++)if(r[i].length>0){var p=t[r[i]],g={};if(d=[],null!=p)for(s=0;s<p.length;s++){var h;0==u==(null==m[(h=p[s]).url])&&(g[h.url]=!0,d.push(h))}m=g,u++}q.scrollTop=0,q.innerHTML="",R=0;var x=document.createElement("div");x.style.cssText="border: 1px solid #D3D3D3; padding: 6px; background: #F5F5F5;",mxUtils.write(x,mxResources.get(0==d.length?"noResultsFor":"resultsFor",[e])),q.appendChild(x),null!=pe&&null==ge&&(pe.style.backgroundColor="",ge=pe,pe=x),he=d,M=null,I(!1)}else xe()}(),mxEvent.consume(e))}))),mxEvent.addListener(ee,"keyup",mxUtils.bind(this,(function(e){""==ee.value?(te.setAttribute("src",le),te.setAttribute("title",mxResources.get("search"))):(te.setAttribute("src",Dialog.prototype.closeImage),te.setAttribute("title",mxResources.get("reset")))}))),K+=23;var ne=document.createElement("div");ne.style.cssText="position:absolute;left:30px;width:128px;top:"+K+"px;bottom:68px;margin-top:6px;overflow:auto;border:1px solid #d3d3d3;",mxEvent.addListener(q,"scroll",(function(){e.sidebar.hideTooltip()}));var ie=140,ae=140;function se(e,t,l,n,i,a,s){null!=V&&(V.style.backgroundColor="transparent",V.style.border="1px solid transparent"),U.removeAttribute("disabled"),Z=t,j=l,W=a,X=n,Y=s,Q=i,(V=e).style.backgroundColor=r,V.style.border=o}function re(t,l,n,i,a,s,r,o,d,c,m){var u=document.createElement("div");u.className="geTemplate",u.style.position="relative",u.style.height=ie+"px",u.style.width=ae+"px";var p=null;function g(t,l){if(null==p){var n=t;n=/^https?:\/\//.test(n)&&!e.editor.isCorsEnabledForUrl(n)?PROXY_URL+"?url="+encodeURIComponent(n):TEMPLATE_PATH+"/"+n,mxUtils.get(n,mxUtils.bind(this,(function(e){e.getStatus()>=200&&e.getStatus()<=299?(p=e.getText(),l(p)):l(p)})))}else l(p)}Editor.isDarkMode()&&(u.style.filter="invert(100%)"),null!=n?u.setAttribute("title",mxResources.get(n,null,n)):null!=i&&i.length>0&&u.setAttribute("title",i);var h=!1,x=null;function v(l,i,a){if(null!=l&&mxUtils.isAncestorNode(document.body,u)){var s=mxUtils.parseXml(l),o=Editor.parseDiagramNode(s.documentElement),d=new mxCodec(o.ownerDocument),c=new mxGraphModel;d.decode(o,c);var p=c.root.getChildAt(0).children,g=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;e.sidebar.createTooltip(u,p,Math.min(g-80,1e3),Math.min(h-80,800),null!=n?mxResources.get(n,null,n):null,!0,new mxPoint(i,a),!0,(function(){I=null!=e.sidebar.tooltip&&"none"!=e.sidebar.tooltip.style.display,se(u,null,null,t,r,m)}),!0,!1)}}if(null!=s){u.style.display="inline-flex",u.style.justifyContent="center",u.style.alignItems="center";var y=document.createElement("img");y.setAttribute("src",s),y.setAttribute("alt",i),y.style.maxWidth=ie+"px",y.style.maxHeight=ae+"px",x=y;var b=s.replace(".drawio.xml","").replace(".drawio","").replace(".xml","");u.appendChild(y),y.onerror=function(){this.src!=b?this.src=b:(this.src=Editor.errorImage,this.onerror=null)},mxEvent.addGestureListeners(u,mxUtils.bind(this,(function(e){se(u,null,null,t,r,m)})),null,null),mxEvent.addListener(u,"dblclick",(function(e){J(),mxEvent.consume(e)}))}else if(!c&&null!=t&&t.length>0){var f=d||TEMPLATE_PATH+"/"+t.substring(0,t.length-4)+".png";if(u.style.backgroundImage="url("+f+")",u.style.backgroundPosition="center center",u.style.backgroundRepeat="no-repeat",null!=n){(A=document.createElement("table")).setAttribute("width","100%"),A.setAttribute("height","100%"),A.style.background=Editor.isDarkMode()?"transparent":"rgba(255,255,255,0.85)",A.style.lineHeight="1.3em",A.style.border="inherit";var E=document.createElement("tbody"),C=document.createElement("tr");(D=document.createElement("td")).setAttribute("align","center"),D.setAttribute("valign","middle"),(T=document.createElement("span")).style.display="inline-block",T.style.padding="4px 8px 4px 8px",T.style.userSelect="none",T.style.borderRadius="3px",T.style.background="rgba(255,255,255,0.85)",T.style.overflow="hidden",T.style.textOverflow="ellipsis",T.style.maxWidth=ie-34+"px",mxUtils.write(T,mxResources.get(n,null,n)),D.appendChild(T),C.appendChild(D),E.appendChild(C),A.appendChild(E),u.appendChild(A)}function w(e){U.setAttribute("disabled","disabled"),u.style.backgroundColor="transparent",u.style.border="1px solid transparent",L.spin(q),g(t,(function(t){L.stop(),null!=t&&(se(u,t,l,null,null,m,be),e&&J())}))}mxEvent.addGestureListeners(u,mxUtils.bind(this,(function(e){w()})),null,null),mxEvent.addListener(u,"dblclick",(function(e){w(!0),mxEvent.consume(e)}))}else{var A,D,T;(A=document.createElement("table")).setAttribute("width","100%"),A.setAttribute("height","100%"),A.style.lineHeight="1.3em",E=document.createElement("tbody"),C=document.createElement("tr"),(D=document.createElement("td")).setAttribute("align","center"),D.setAttribute("valign","middle"),(T=document.createElement("span")).style.display="inline-block",T.style.padding="4px 8px 4px 8px",T.style.userSelect="none",T.style.borderRadius="3px",T.style.background="#ffffff",T.style.overflow="hidden",T.style.textOverflow="ellipsis",T.style.maxWidth=ie-34+"px",mxUtils.write(T,mxResources.get(n,null,n)),D.appendChild(T),C.appendChild(D),E.appendChild(C),A.appendChild(E),u.appendChild(A),a&&se(u),mxEvent.addGestureListeners(u,mxUtils.bind(this,(function(e){se(u,null,null,t,r)})),null,null),null!=o?mxEvent.addListener(u,"click",o):(mxEvent.addListener(u,"click",(function(e){se(u,null,null,t,r)})),mxEvent.addListener(u,"dblclick",(function(e){J(),mxEvent.consume(e)})))}if(null!=t){var R=document.createElement("img");R.setAttribute("src",Sidebar.prototype.searchImage),R.setAttribute("title",mxResources.get("preview")),R.className="geActiveButton",R.style.position="absolute",R.style.cursor="default",R.style.padding="8px",R.style.right="0px",R.style.top="0px",u.appendChild(R);var I=!1;mxEvent.addGestureListeners(R,mxUtils.bind(this,(function(t){I=e.sidebar.currentElt==u})),null,null),mxEvent.addListener(R,"click",mxUtils.bind(this,(function(l){I||function(l,n){if(null==t||h||e.sidebar.currentElt==u)e.sidebar.hideTooltip();else{if(e.sidebar.hideTooltip(),null!=x)return void v('<mxfile><diagram id="d" name="n">'+Graph.compress('<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="2" value="" style="shape=image;image='+x.src+';imageAspect=1;" parent="1" vertex="1"><mxGeometry width="'+x.naturalWidth+'" height="'+x.naturalHeight+'" as="geometry" /></mxCell></root></mxGraphModel>')+"</diagram></mxfile>",mxEvent.getClientX(l),mxEvent.getClientY(l));e.sidebar.currentElt=u,h=!0,g(t,(function(t){h&&e.sidebar.currentElt==u&&v(t,mxEvent.getClientX(l),mxEvent.getClientY(l)),h=!1}))}}(l),mxEvent.consume(l)})))}return q.appendChild(u),u}var oe={},de={},ce={},me=0,ue=!0,pe=null,ge=null;oe.basic=[{title:"blankDiagram",select:!0}];var he=oe.basic;function xe(){null!=ge&&(ge.click(),ge=null)}function ve(){if(ue&&(ue=!1,mxEvent.addListener(q,"scroll",(function(e){q.scrollTop+q.clientHeight>=q.scrollHeight&&(I(),mxEvent.consume(e))}))),me>0){var e="font-weight: bold;background: #f9f9f9;padding: 5px 0 5px 0;text-align: center;",t=document.createElement("div");for(var l in t.style.cssText=e,mxUtils.write(t,mxResources.get("custom")),ne.appendChild(t),ce){var n=document.createElement("div"),i=l,a=ce[l];i.length>18&&(i=i.substring(0,18)+"…"),n.style.cssText="display:block;cursor:pointer;padding:6px;white-space:nowrap;margin-bottom:-1px;overflow:hidden;text-overflow:ellipsis;user-select:none;",n.setAttribute("title",i+" ("+a.length+")"),mxUtils.write(n,n.getAttribute("title")),null!=d&&(n.style.padding=d),ne.appendChild(n),function(e,t){mxEvent.addListener(n,"click",(function(){pe!=t&&(pe.style.backgroundColor="",(pe=t).style.backgroundColor=s,q.scrollTop=0,q.innerHTML="",R=0,he=ce[e],M=null,I(!1))}))}(l,n)}(t=document.createElement("div")).style.cssText=e,mxUtils.write(t,"draw.io"),ne.appendChild(t)}function r(e,t){var l=mxResources.get(e);return null==l&&(l=e.substring(0,1).toUpperCase()+e.substring(1)),l.length>18&&(l=l.substring(0,18)+"…"),l+" ("+t.length+")"}function o(e,t,l){mxEvent.addListener(t,"click",(function(){pe!=t&&(pe.style.backgroundColor="",(pe=t).style.backgroundColor=s,q.scrollTop=0,q.innerHTML="",R=0,he=l?de[e][l]:oe[e],M=null,I(!1))}))}for(var l in oe){var c=de[l],m=n=document.createElement(c?"ul":"div"),u=r(l,a=oe[l]);if(null!=c){var p=document.createElement("li"),g=document.createElement("div");g.className="geTempTreeCaret",g.setAttribute("title",u),mxUtils.write(g,u),m=g,p.appendChild(g);var h=document.createElement("ul");for(var x in h.className="geTempTreeNested",h.style.visibility="hidden",c){var v=document.createElement("li"),y=r(x,c[x]);v.setAttribute("title",y),mxUtils.write(v,y),o(l,v,x),h.appendChild(v)}p.appendChild(h),n.className="geTempTree",n.appendChild(p),function(e,t){mxEvent.addListener(t,"click",(function(){e.style.visibility="visible",e.classList.toggle("geTempTreeActive"),e.classList.toggle("geTempTreeNested")&&setTimeout((function(){e.style.visibility="hidden"}),550),t.classList.toggle("geTempTreeCaret-down")}))}(h,g)}else n.style.cssText="display:block;cursor:pointer;padding:6px;white-space:nowrap;margin-bottom:-1px;overflow:hidden;text-overflow:ellipsis;user-select:none;transition: all 0.5s;",n.setAttribute("title",u),mxUtils.write(n,u);null!=d&&(n.style.padding=d),ne.appendChild(n),null==pe&&a.length>0&&((pe=n).style.backgroundColor=s,he=a),o(l,m)}I(!1)}if(!t){b.appendChild($),b.appendChild(ne),b.appendChild(q);var ye=!1,be=c;function fe(){mxUtils.get(be,(function(e){if(!ye){ye=!0;for(var t=e.getXml().documentElement.firstChild,l={};null!=t;){if(void 0!==t.getAttribute)if("clibs"==t.nodeName){for(var n=t.getAttribute("name"),i=t.getElementsByTagName("add"),a=[],s=0;s<i.length;s++)a.push(encodeURIComponent(mxUtils.getTextContent(i[s])));null!=n&&a.length>0&&(l[n]=a.join(";"))}else{var r=t.getAttribute("url");if(null!=r){var o=t.getAttribute("section"),d=t.getAttribute("subsection");if(null==o){var c=r.indexOf("/");if(o=r.substring(0,c),null==d){var m=r.indexOf("/",c+1);m>-1&&(d=r.substring(c+1,m))}}var u=oe[o];null==u&&(u=[],oe[o]=u);var p=t.getAttribute("clibs");null!=l[p]&&(p=l[p]);var g={url:t.getAttribute("url"),libs:t.getAttribute("libs"),title:t.getAttribute("title"),tooltip:t.getAttribute("name")||t.getAttribute("url"),preview:t.getAttribute("preview"),clibs:p,tags:t.getAttribute("tags")};if(u.push(g),null!=d){var h=de[o];null==h&&(h={},de[o]=h);var x=h[d];null==x&&(x=[],h[d]=x),x.push(g)}}}t=t.nextSibling}L.stop(),ve()}}))}/^https?:\/\//.test(be)&&!e.editor.isCorsEnabledForUrl(be)&&(be=PROXY_URL+"?url="+encodeURIComponent(be)),L.spin(q),null!=x?x((function(e,t){ce=e,me=t,S=t,fe()}),fe):fe(),N=oe}mxEvent.addListener(w,"keypress",(function(t){e.dialog.container.firstChild==b&&13==t.keyCode&&J()}));var Ee=document.createElement("div");if(Ee.style.marginTop=t?"4px":"16px",Ee.style.textAlign="right",Ee.style.position="absolute",Ee.style.left="40px",Ee.style.bottom="24px",Ee.style.right="40px",!t&&!e.isOffline()&&l&&null==n&&!i){var Ce=mxUtils.button(mxResources.get("help"),(function(){e.openLink("https://support.draw.io/display/DO/Creating+and+Opening+Files")}));Ce.className="geBtn",Ee.appendChild(Ce)}var we=mxUtils.button(mxResources.get("cancel"),(function(){null!=a&&a(),e.hideDialog(!0)}));if(we.className="geBtn",!e.editor.cancelFirst||i&&null==a||Ee.appendChild(we),!(t||"1"==urlParams.embed||i||mxClient.IS_ANDROID||mxClient.IS_IOS||"1"==urlParams.noDevice)){var Ae=mxUtils.button(mxResources.get("fromTemplateUrl"),(function(){var t=new FilenameDialog(e,"",mxResources.get("create"),(function(t){if(null!=t&&t.length>0){var l=e.getUrl(window.location.pathname+"?mode="+e.mode+"&title="+encodeURIComponent(w.value)+"&create="+encodeURIComponent(t));null==e.getCurrentFile()?window.location.href=l:window.openWindow(l)}}),mxResources.get("url"));e.showDialog(t.container,300,80,!0,!0),t.init()}));Ae.className="geBtn",Ee.appendChild(Ae)}if(Graph.fileSupport&&g){var De=mxUtils.button(mxResources.get("import"),(function(){if(null==e.newDlgFileInputElt){var t=document.createElement("input");t.setAttribute("multiple","multiple"),t.setAttribute("type","file"),mxEvent.addListener(t,"change",(function(l){e.openFiles(t.files,!0),t.value=""})),t.style.display="none",e.container.appendChild(t)||document.body.appendChild(t),e.newDlgFileInputElt=t}e.newDlgFileInputElt.click()}));De.className="geBtn",Ee.appendChild(De)}Ee.appendChild(U),e.editor.cancelFirst||null!=n||i&&null==a||Ee.appendChild(we),b.appendChild(Ee),this.container=b};NewDialog.tagsList={};var CreateDialog=function(e,t,l,n,i,a,s,r,o,d,c,m,u,p,g,h,x){c="1"!=urlParams.noDevice&&c,s=null==s||s,r=null==r||r,m=null!=m?m:4,x=null==x||x;var v=document.createElement("div");v.style.whiteSpace="nowrap",null==n&&e.addLanguageMenu(v);var y=document.createElement("h2");mxUtils.write(y,i||mxResources.get("create")),y.style.marginTop="0px",y.style.marginBottom="24px",v.appendChild(y),mxUtils.write(v,mxResources.get("filename")+":");var b=document.createElement("input");if(b.setAttribute("value",t),b.style.width="200px",b.style.marginLeft="10px",b.style.marginBottom="20px",b.style.maxWidth="70%",this.init=function(){b.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?b.select():document.execCommand("selectAll",!1,null)},v.appendChild(b),null!=h){if(null!=e.editor.diagramFileTypes){var f=FilenameDialog.createFileTypes(e,b,e.editor.diagramFileTypes);f.style.marginLeft="6px",f.style.width="80px",v.appendChild(f)}v.appendChild(FilenameDialog.createTypeHint(e,b,h))}var E=null;if("1"!=urlParams.noDevice&&null!=u&&null!=p&&"image/"==p.substring(0,6)&&("image/svg"!=p.substring(0,9)||mxClient.IS_SVG)){b.style.width="160px";var C=document.createElement("img"),w=g?u:btoa(unescape(encodeURIComponent(u)));C.setAttribute("src","data:"+p+";base64,"+w),C.style.position="absolute",C.style.top="70px",C.style.right="100px",C.style.maxWidth="120px",C.style.maxHeight="80px",mxUtils.setPrefixedStyle(C.style,"transform","translate(50%,-50%)"),v.appendChild(C),mxClient.IS_FF||null==navigator.clipboard||"image/png"!=p||((E=mxUtils.button(mxResources.get("copy"),(function(t){var l=e.base64ToBlob(w,"image/png"),n=new ClipboardItem({"image/png":l,"text/html":new Blob(['<img src="data:'+p+";base64,"+w+'">'],{type:"text/html"})});navigator.clipboard.write([n]).then(mxUtils.bind(this,(function(){e.alert(mxResources.get("copiedToClipboard"))}))).catch(mxUtils.bind(this,(function(t){e.handleError(t)})))}))).style.marginTop="6px",E.className="geBtn"),o&&Editor.popupsAllowed&&(C.style.cursor="pointer",mxEvent.addGestureListeners(C,null,null,(function(e){mxEvent.isPopupTrigger(e)||z("_blank")})))}mxUtils.br(v);var A=document.createElement("div");A.style.textAlign="center";var D=0;function T(t,l,n,i){var a=document.createElement("a");a.style.overflow="hidden";var s=document.createElement("img");s.src=t,s.setAttribute("border","0"),s.setAttribute("align","absmiddle"),s.style.width="60px",s.style.height="60px",s.style.paddingBottom="6px",a.style.display="inline-block",a.className="geBaseButton",a.style.position="relative",a.style.margin="4px",a.style.padding="8px 8px 10px 8px",a.style.whiteSpace="nowrap",a.appendChild(s),a.style.color="gray",a.style.fontSize="11px";var r=document.createElement("div");function o(){mxEvent.addListener(a,"click",(function(){P(n),z(n)}))}if(a.appendChild(r),mxUtils.write(r,l),null!=i&&null==e[i]){s.style.visibility="hidden",mxUtils.setOpacity(r,10);var d=new Spinner({lines:12,length:12,width:5,radius:10,rotate:0,color:"#000",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"40%",zIndex:2e9});d.spin(a);var c=window.setTimeout((function(){null==e[i]&&(d.stop(),a.style.display="none")}),3e4);e.addListener("clientLoaded",mxUtils.bind(this,(function(){null!=e[i]&&(window.clearTimeout(c),mxUtils.setOpacity(r,100),s.style.visibility="",d.stop(),o())})))}else o();A.appendChild(a),++D==m&&(mxUtils.br(A),D=0)}A.style.marginTop="6px",v.appendChild(A);var R=document.createElement("select");if(R.style.marginLeft="10px",!e.isOfflineApp()&&!e.isOffline()){if("function"==typeof window.DriveClient){var I=document.createElement("option");I.setAttribute("value",App.MODE_GOOGLE),mxUtils.write(I,mxResources.get("googleDrive")),R.appendChild(I),T(IMAGE_PATH+"/google-drive-logo.svg",mxResources.get("googleDrive"),App.MODE_GOOGLE,"drive")}if("function"==typeof window.OneDriveClient){var L=document.createElement("option");L.setAttribute("value",App.MODE_ONEDRIVE),mxUtils.write(L,mxResources.get("oneDrive")),R.appendChild(L),e.mode==App.MODE_ONEDRIVE&&L.setAttribute("selected","selected"),T(IMAGE_PATH+"/onedrive-logo.svg",mxResources.get("oneDrive"),App.MODE_ONEDRIVE,"oneDrive")}if("function"==typeof window.DropboxClient){var U=document.createElement("option");U.setAttribute("value",App.MODE_DROPBOX),mxUtils.write(U,mxResources.get("dropbox")),R.appendChild(U),e.mode==App.MODE_DROPBOX&&U.setAttribute("selected","selected"),T(IMAGE_PATH+"/dropbox-logo.svg",mxResources.get("dropbox"),App.MODE_DROPBOX,"dropbox")}if(null!=e.gitHub){var k=document.createElement("option");k.setAttribute("value",App.MODE_GITHUB),mxUtils.write(k,mxResources.get("github")),R.appendChild(k),T(IMAGE_PATH+"/github-logo.svg",mxResources.get("github"),App.MODE_GITHUB,"gitHub")}if(null!=e.gitLab){var M=document.createElement("option");M.setAttribute("value",App.MODE_GITLAB),mxUtils.write(M,mxResources.get("gitlab")),R.appendChild(M),T(IMAGE_PATH+"/gitlab-logo.svg",mxResources.get("gitlab"),App.MODE_GITLAB,"gitLab")}if(null!=e.notion){var N=document.createElement("option");N.setAttribute("value",App.MODE_NOTION),mxUtils.write(N,mxResources.get("notion")),R.appendChild(N),T(IMAGE_PATH+"/notion-logo.svg",mxResources.get("notion"),App.MODE_NOTION,"notion")}if("function"==typeof window.TrelloClient){var S=document.createElement("option");S.setAttribute("value",App.MODE_TRELLO),mxUtils.write(S,mxResources.get("trello")),R.appendChild(S),T(IMAGE_PATH+"/trello-logo.svg",mxResources.get("trello"),App.MODE_TRELLO,"trello")}}if(!Editor.useLocalStorage||"device"==urlParams.storage||null!=e.getCurrentFile()&&"1"!=urlParams.noDevice){var B=document.createElement("option");B.setAttribute("value",App.MODE_DEVICE),mxUtils.write(B,mxResources.get("device")),R.appendChild(B),e.mode!=App.MODE_DEVICE&&r||B.setAttribute("selected","selected"),c&&T(IMAGE_PATH+"/osa_drive-harddisk.png",mxResources.get("device"),App.MODE_DEVICE)}if(r&&isLocalStorage&&"0"!=urlParams.browser){var O=document.createElement("option");O.setAttribute("value",App.MODE_BROWSER),mxUtils.write(O,mxResources.get("browser")),R.appendChild(O),e.mode==App.MODE_BROWSER&&O.setAttribute("selected","selected"),T(IMAGE_PATH+"/osa_database.png",mxResources.get("browser"),App.MODE_BROWSER)}function P(l){if(s){var n=b.value,i=n.lastIndexOf(".");if(t.lastIndexOf(".")<0&&i<0){var a="";(l=null!=l?l:R.value)==App.MODE_GOOGLE?a=e.drive.extension:l==App.MODE_GITHUB?a=e.gitHub.extension:l==App.MODE_GITLAB?a=e.gitLab.extension:l==App.MODE_NOTION?a=e.notion.extension:l==App.MODE_TRELLO?a=e.trello.extension:l==App.MODE_DROPBOX?a=e.dropbox.extension:l==App.MODE_ONEDRIVE?a=e.oneDrive.extension:l==App.MODE_DEVICE&&(a=".drawio"),i>=0&&(n=n.substring(0,i)),b.value=n+a}}}var G=document.createElement("div");if(G.style.marginTop="26px",G.style.textAlign="center",null!=d){var H=mxUtils.button(mxResources.get("help"),(function(){e.openLink(d)}));H.className="geBtn",G.appendChild(H)}var F=mxUtils.button(mxResources.get(null!=n?"close":"cancel"),(function(){null!=n?n():(e.fileLoaded(null),e.hideDialog(),window.close(),window.location.href=e.getUrl())}));function z(t){var n=b.value;(null==t||null!=n&&n.length>0)&&(x&&e.hideDialog(),l(n,t,b))}if(F.className="geBtn",e.editor.cancelFirst&&null==n&&G.appendChild(F),null==n){var _=mxUtils.button(mxResources.get("decideLater"),(function(){z(null)}));_.className="geBtn",G.appendChild(_)}if(CreateDialog.showDownloadButton){var j=mxUtils.button(mxResources.get("download"),(function(){z("download")}));j.className="geBtn",G.appendChild(j),null!=E&&(j.style.marginTop="6px",G.style.marginTop="6px")}null!=E&&(mxUtils.br(G),G.appendChild(E)),e.editor.cancelFirst&&null==n||G.appendChild(F),mxEvent.addListener(b,"keypress",(function(t){13==t.keyCode?z(App.MODE_DEVICE):27==t.keyCode&&(e.fileLoaded(null),e.hideDialog(),window.close())})),v.appendChild(G),this.container=v};CreateDialog.showDownloadButton="1"!=urlParams.noDevice;var PopupDialog=function(e,t,l,n,i){i=null==i||i;var a=document.createElement("div");a.style.textAlign="left",a.style.height="100%",mxUtils.write(a,mxResources.get("fileOpenLocation")),mxUtils.br(a),mxUtils.br(a),mxUtils.br(a),mxUtils.br(a),mxUtils.br(a),mxUtils.write(a,mxResources.get("allowPopups")),this.container=a},ImageDialog=function(e,t,l,n,i,a){a=null==a||a;var s=e.editor.graph,r=document.createElement("div");mxUtils.write(r,t);var o=document.createElement("div");o.className="geTitle",o.style.backgroundColor="transparent",o.style.borderColor="transparent",o.style.whiteSpace="nowrap",o.style.textOverflow="clip",o.style.cursor="default",o.style.paddingRight="20px";var d=document.createElement("input");d.setAttribute("value",l),d.setAttribute("type","text"),d.setAttribute("spellcheck","false"),d.setAttribute("autocorrect","off"),d.setAttribute("autocomplete","off"),d.setAttribute("autocapitalize","off"),d.style.marginTop="6px";var c=Graph.fileSupport?460:340;d.style.width=c-20+"px",d.style.backgroundImage="url('"+Dialog.prototype.clearImage+"')",d.style.backgroundRepeat="no-repeat",d.style.backgroundPosition="100% 50%",d.style.paddingRight="14px";var m=document.createElement("div");m.setAttribute("title",mxResources.get("reset")),m.style.position="relative",m.style.left="-16px",m.style.width="12px",m.style.height="14px",m.style.cursor="pointer",m.style.display="inline-block",m.style.top="3px",m.style.background="url('"+e.editor.transparentImage+"')",mxEvent.addListener(m,"click",(function(){d.value="",d.focus()})),o.appendChild(d),o.appendChild(m),r.appendChild(o);var u=function(t,l,i,s){var r="data:"==t.substring(0,5);!e.isOffline()||r&&"undefined"==typeof chrome?t.length>0&&e.spinner.spin(document.body,mxResources.get("inserting"))?e.loadImage(t,(function(r){e.spinner.stop(),e.hideDialog();var o=!1===s?1:null!=l&&null!=i?Math.max(l/r.width,i/r.height):Math.min(1,Math.min(520/r.width,520/r.height));a&&(t=e.convertDataUri(t)),n(t,Math.round(Number(r.width)*o),Math.round(Number(r.height)*o))}),(function(){e.spinner.stop(),n(null),e.showError(mxResources.get("error"),mxResources.get("fileNotFound"),mxResources.get("ok"))})):(e.hideDialog(),n(t)):(t=e.convertDataUri(t),l=null==l?120:l,i=null==i?100:i,e.hideDialog(),n(t,l,i))},p=function(t,l){if(null!=t){var a=i?null:s.getModel().getGeometry(s.getSelectionCell());null!=a?u(t,a.width,a.height,l):u(t,null,null,l)}else e.hideDialog(),n(null)};this.init=function(){if(d.focus(),Graph.fileSupport){d.setAttribute("placeholder",mxResources.get("dragImagesHere"));var t=r.parentNode,l=(e.editor.graph,null);mxEvent.addListener(t,"dragleave",(function(e){null!=l&&(l.parentNode.removeChild(l),l=null),e.stopPropagation(),e.preventDefault()})),mxEvent.addListener(t,"dragover",mxUtils.bind(this,(function(n){null==l&&(!mxClient.IS_IE||document.documentMode>10)&&(l=e.highlightElement(t)),n.stopPropagation(),n.preventDefault()}))),mxEvent.addListener(t,"drop",mxUtils.bind(this,(function(t){if(null!=l&&(l.parentNode.removeChild(l),l=null),t.dataTransfer.files.length>0)e.importFiles(t.dataTransfer.files,0,0,e.maxImageSize,(function(e,t,l,n,i,a,s,r){p(e,r)}),(function(){}),(function(e){return"image/"==e.type.substring(0,6)}),(function(e){for(var t=0;t<e.length;t++)e[t]()}),!mxEvent.isControlDown(t),null,null,!0);else if(mxUtils.indexOf(t.dataTransfer.types,"text/uri-list")>=0){var n=t.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)($|\?)/i.test(n)&&p(decodeURIComponent(n))}t.stopPropagation(),t.preventDefault()})),!1)}};var g=document.createElement("div");g.style.marginTop="14px",g.style.textAlign="center";var h=mxUtils.button(mxResources.get("cancel"),(function(){e.spinner.stop(),e.hideDialog()}));if(h.className="geBtn",e.editor.cancelFirst&&g.appendChild(h),ImageDialog.filePicked=function(e){if(e.action==google.picker.Action.PICKED&&null!=e.docs[0].thumbnails){var t=e.docs[0].thumbnails[e.docs[0].thumbnails.length-1];null!=t&&(d.value=t.url)}d.focus()},Graph.fileSupport){if(null==e.imgDlgFileInputElt){var x=document.createElement("input");x.setAttribute("multiple","multiple"),x.setAttribute("type","file"),mxEvent.addListener(x,"change",(function(t){null!=x.files&&(e.importFiles(x.files,0,0,e.maxImageSize,(function(e,t,l,n,i,a){p(e)}),(function(){}),(function(e){return"image/"==e.type.substring(0,6)}),(function(e){for(var t=0;t<e.length;t++)e[t]()}),!0),x.type="",x.type="file",x.value="")})),x.style.display="none",e.container.appendChild(x)||document.body.appendChild(x),e.imgDlgFileInputElt=x}var v=mxUtils.button(mxResources.get("open"),(function(){e.imgDlgFileInputElt.click()}));v.className="geBtn",g.appendChild(v)}if(document.createElement("canvas").getContext&&"data:image/"==d.value.substring(0,11)&&"data:image/svg"!=d.value.substring(0,14)){var y=mxUtils.button(mxResources.get("crop"),(function(){var t=new CropImageDialog(e,d.value,(function(e){d.value=e}));e.showDialog(t.container,300,380,!0,!0),t.init()}));y.className="geBtn",g.appendChild(y)}mxEvent.addListener(d,"keypress",(function(e){13==e.keyCode&&p(d.value)}));var b=mxUtils.button(mxResources.get("apply"),(function(){p(d.value)}));if(b.className="geBtn gePrimaryBtn",g.appendChild(b),e.editor.cancelFirst||g.appendChild(h),Graph.fileSupport){g.style.marginTop="120px",r.style.backgroundImage="url('"+IMAGE_PATH+"/droptarget.png')",r.style.backgroundPosition="center 65%",r.style.backgroundRepeat="no-repeat";var f=document.createElement("div");f.style.position="absolute",f.style.width="420px",f.style.top="58%",f.style.textAlign="center",f.style.fontSize="18px",f.style.color="#a0c3ff",mxUtils.write(f,mxResources.get("dragImagesHere")),r.appendChild(f)}r.appendChild(g),this.container=r},LinkDialog=function(e,t,l,n,i,a,s){var r=document.createElement("div");r.style.height="100%",mxUtils.write(r,mxResources.get("editLink")+":");var o=document.createElement("div");o.className="geTitle",o.style.backgroundColor="transparent",o.style.borderColor="transparent",o.style.whiteSpace="nowrap",o.style.textOverflow="clip",o.style.cursor="default",o.style.paddingRight="20px";var d=document.createElement("input");d.setAttribute("placeholder",mxResources.get("dragUrlsHere")),d.setAttribute("type","text"),d.style.marginTop="6px",d.style.width="100%",d.style.boxSizing="border-box",d.style.backgroundImage="url('"+Dialog.prototype.clearImage+"')",d.style.backgroundRepeat="no-repeat",d.style.backgroundPosition="100% 50%",d.style.paddingRight="14px",d.style.marginBottom="4px";var c=document.createElement("div");c.setAttribute("title",mxResources.get("reset")),c.style.position="relative",c.style.left="-16px",c.style.width="12px",c.style.height="14px",c.style.cursor="pointer",c.style.display="inline-block",c.style.top="3px",c.style.background="url('"+e.editor.transparentImage+"')",mxEvent.addListener(c,"click",(function(){d.value="",d.focus()}));var m=document.createElement("input");m.style.cssText="margin-right:8px;margin-bottom:8px;",m.setAttribute("value","url"),m.setAttribute("type","radio"),m.setAttribute("name","geLinkDialogOption");var u=document.createElement("input");u.style.cssText="margin-right:8px;margin-bottom:8px;",u.setAttribute("value","url"),u.setAttribute("type","radio"),u.setAttribute("name","geLinkDialogOption");var p=document.createElement("select");p.style.width="520px";var g=document.createElement("input");if(g.setAttribute("type","checkbox"),g.style.margin="0 6p 0 6px",null!=s&&(g.setAttribute("checked","checked"),g.defaultChecked=!0),s=null!=s?s:"_blank",g.setAttribute("title",s),a&&(d.style.width="340px"),i&&null!=e.pages){null!=t&&Graph.isPageLink(t)?(u.setAttribute("checked","checked"),u.defaultChecked=!0):(d.setAttribute("value",t),m.setAttribute("checked","checked"),m.defaultChecked=!0),o.appendChild(m),o.appendChild(d),o.appendChild(c),mxUtils.br(o),o.appendChild(u);for(var h=!1,x=0;x<e.pages.length;x++){var v=document.createElement("option");mxUtils.write(v,e.pages[x].getName()||mxResources.get("pageWithNumber",[x+1])),v.setAttribute("value","data:page/id,"+e.pages[x].getId()),t==v.getAttribute("value")&&(v.setAttribute("selected","selected"),h=!0),p.appendChild(v)}if(!h&&u.checked){var y=document.createElement("option");mxUtils.write(y,mxResources.get("pageNotFound")),y.setAttribute("disabled","disabled"),y.setAttribute("selected","selected"),y.setAttribute("value","pageNotFound"),p.appendChild(y),mxEvent.addListener(p,"change",(function(){null==y.parentNode||y.selected||y.parentNode.removeChild(y)}))}o.appendChild(p)}else d.setAttribute("value",t),o.appendChild(d),o.appendChild(c);r.appendChild(o);var b=mxUtils.button(l,(function(){e.hideDialog();var l=u.checked?"pageNotFound"!==p.value?p.value:t:d.value;n(l,LinkDialog.selectedDocs,g.checked?s:null)}));b.style.verticalAlign="middle",b.className="geBtn gePrimaryBtn",this.init=function(){if(u.checked?p.focus():(d.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?d.select():document.execCommand("selectAll",!1,null)),mxEvent.addListener(p,"focus",(function(){m.removeAttribute("checked"),u.setAttribute("checked","checked"),u.checked=!0})),mxEvent.addListener(d,"focus",(function(){u.removeAttribute("checked"),m.setAttribute("checked","checked"),m.checked=!0})),Graph.fileSupport){var t=r.parentNode,l=(e.editor.graph,null);mxEvent.addListener(t,"dragleave",(function(e){null!=l&&(l.parentNode.removeChild(l),l=null),e.stopPropagation(),e.preventDefault()})),mxEvent.addListener(t,"dragover",mxUtils.bind(this,(function(n){null==l&&(!mxClient.IS_IE||document.documentMode>10)&&(l=e.highlightElement(t)),n.stopPropagation(),n.preventDefault()}))),mxEvent.addListener(t,"drop",mxUtils.bind(this,(function(e){null!=l&&(l.parentNode.removeChild(l),l=null),mxUtils.indexOf(e.dataTransfer.types,"text/uri-list")>=0&&(d.value=decodeURIComponent(e.dataTransfer.getData("text/uri-list")),m.setAttribute("checked","checked"),m.checked=!0,b.click()),e.stopPropagation(),e.preventDefault()})),!1)}};var f=document.createElement("div");f.style.marginTop="18px",f.style.textAlign="center";var E=mxUtils.button(mxResources.get("help"),(function(){e.openLink("https://www.diagrams.net/doc/faq/custom-links")}));E.style.verticalAlign="middle",E.className="geBtn",f.appendChild(E),e.isOffline()&&!mxClient.IS_CHROMEAPP&&(E.style.display="none");var C=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));function w(e,t,l){var n=mxUtils.button("",l);n.className="geBtn",n.setAttribute("title",t);var i=document.createElement("img");i.style.height="26px",i.style.width="26px",i.setAttribute("src",e),n.style.minWidth="42px",n.style.verticalAlign="middle",n.appendChild(i),f.appendChild(n)}C.style.verticalAlign="middle",C.className="geBtn",e.editor.cancelFirst&&f.appendChild(C),LinkDialog.selectedDocs=null,LinkDialog.filePicked=function(e){if(e.action==google.picker.Action.PICKED){LinkDialog.selectedDocs=e.docs;var t=e.docs[0].url;"application/mxe"==e.docs[0].mimeType||null!=e.docs[0].mimeType&&"application/vnd.jgraph."==e.docs[0].mimeType.substring(0,23)?t="https://www.draw.io/#G"+e.docs[0].id:"application/vnd.google-apps.folder"==e.docs[0].mimeType&&(t="https://drive.google.com/#folders/"+e.docs[0].id),d.value=t,d.focus()}else LinkDialog.selectedDocs=null;d.focus()},"undefined"!=typeof google&&void 0!==google.picker&&null!=e.drive&&w(IMAGE_PATH+"/google-drive-logo.svg",mxResources.get("googlePlus"),(function(){e.spinner.spin(document.body,mxResources.get("authorizing"))&&e.drive.checkToken(mxUtils.bind(this,(function(){if(e.spinner.stop(),null==e.linkPicker){var t=e.drive.createLinkPicker();e.linkPicker=t.setCallback((function(e){LinkDialog.filePicked(e)})).build()}e.linkPicker.setVisible(!0)})))})),"undefined"!=typeof Dropbox&&void 0!==Dropbox.choose&&w(IMAGE_PATH+"/dropbox-logo.svg",mxResources.get("dropbox"),(function(){Dropbox.choose({linkType:"direct",cancel:function(){},success:function(e){d.value=e[0].link,d.focus()}})})),null!=e.oneDrive&&w(IMAGE_PATH+"/onedrive-logo.svg",mxResources.get("oneDrive"),(function(){e.oneDrive.pickFile((function(e,t){d.value=t.value[0].webUrl,d.focus()}))})),null!=e.gitHub&&w(IMAGE_PATH+"/github-logo.svg",mxResources.get("github"),(function(){e.gitHub.pickFile((function(e){if(null!=e){var t=e.split("/"),l=t[0],n=t[1],i=t[2];e=t.slice(3,t.length).join("/"),d.value="https://github.com/"+l+"/"+n+"/blob/"+i+"/"+e,d.focus()}}))})),null!=e.gitLab&&w(IMAGE_PATH+"/gitlab-logo.svg",mxResources.get("gitlab"),(function(){e.gitLab.pickFile((function(e){if(null!=e){var t=e.split("/"),l=t[0],n=t[1],i=t[2];e=t.slice(3,t.length).join("/"),d.value=DRAWIO_GITLAB_URL+"/"+l+"/"+n+"/blob/"+i+"/"+e,d.focus()}}))})),mxEvent.addListener(d,"keypress",(function(t){if(13==t.keyCode){e.hideDialog();var l=u.checked?p.value:d.value;n(l,LinkDialog.selectedDocs)}})),f.appendChild(b),e.editor.cancelFirst||f.appendChild(C),r.appendChild(f),this.container=r},FeedbackDialog=function(e,t,l,n){var i=document.createElement("div"),a=document.createElement("div");mxUtils.write(a,mxResources.get("sendYourFeedback")),a.style.fontSize="18px",a.style.marginBottom="18px",i.appendChild(a),a=document.createElement("div"),mxUtils.write(a,mxResources.get("yourEmailAddress")+(l?"":" ("+mxResources.get("required")+")")),i.appendChild(a);var s=document.createElement("input");s.setAttribute("type","text"),s.style.marginTop="6px",s.style.width="600px";var r=mxUtils.button(mxResources.get("sendMessage"),(function(){var l=u.value+(d.checked?"\nDiagram:\n"+(null!=n?n:mxUtils.getXml(e.getXmlFileData())):"")+"\nuserAgent:\n"+navigator.userAgent+"\nappVersion:\n"+navigator.appVersion+"\nappName:\n"+navigator.appName+"\nplatform:\n"+navigator.platform;if(l.length>FeedbackDialog.maxAttachmentSize)e.alert(mxResources.get("drawingTooLarge"));else if(e.hideDialog(),e.spinner.spin(document.body)){var i=null!=FeedbackDialog.feedbackUrl?FeedbackDialog.feedbackUrl:"/email";mxUtils.post(i,"email="+encodeURIComponent(s.value)+"&version="+encodeURIComponent(EditorUi.VERSION)+"&url="+encodeURIComponent(window.location.href)+"&body="+encodeURIComponent((null!=t?t:"Feedback")+":\n"+l),(function(t){e.spinner.stop(),t.getStatus()>=200&&t.getStatus()<=299?e.alert(mxResources.get("feedbackSent")):e.alert(mxResources.get("errorSendingFeedback"))}),(function(){e.spinner.stop(),e.alert(mxResources.get("errorSendingFeedback"))}))}}));if(r.className="geBtn gePrimaryBtn",!l){r.setAttribute("disabled","disabled");var o=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;mxEvent.addListener(s,"change",(function(){s.value.length>0&&o.test(s.value)>0?r.removeAttribute("disabled"):r.setAttribute("disabled","disabled")})),mxEvent.addListener(s,"keyup",(function(){s.value.length>0&&o.test(s.value)?r.removeAttribute("disabled"):r.setAttribute("disabled","disabled")}))}i.appendChild(s),this.init=function(){s.focus()};var d=document.createElement("input");d.setAttribute("type","checkbox"),d.setAttribute("checked","checked"),d.defaultChecked=!0;var c=document.createElement("p");c.style.marginTop="14px",c.appendChild(d);var m=document.createElement("span");mxUtils.write(m," "+mxResources.get("includeCopyOfMyDiagram")),c.appendChild(m),mxEvent.addListener(m,"click",(function(e){d.checked=!d.checked,mxEvent.consume(e)})),i.appendChild(c),a=document.createElement("div"),mxUtils.write(a,mxResources.get("feedback")),i.appendChild(a);var u=document.createElement("textarea");u.style.resize="none",u.style.width="600px",u.style.height="140px",u.style.marginTop="6px",u.setAttribute("placeholder",mxResources.get("comments")),i.appendChild(u);var p=document.createElement("div");p.style.marginTop="26px",p.style.textAlign="right";var g=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));g.className="geBtn",e.editor.cancelFirst?(p.appendChild(g),p.appendChild(r)):(p.appendChild(r),p.appendChild(g)),i.appendChild(p),this.container=i};FeedbackDialog.maxAttachmentSize=1e6;var RevisionDialog=function(e,t,l){var n=document.createElement("div"),i=document.createElement("h3");i.style.marginTop="0px",mxUtils.write(i,mxResources.get("revisionHistory")),n.appendChild(i);var a=document.createElement("div");a.style.position="absolute",a.style.overflow="auto",a.style.width="170px",a.style.height="378px",n.appendChild(a);var s=document.createElement("div");s.style.position="absolute",s.style.border="1px solid lightGray",s.style.left="199px",s.style.width="470px",s.style.height="376px",s.style.overflow="hidden";var r=document.createElement("div");r.style.cssText="position:absolute;left:0;right:0;top:0;bottom:20px;text-align:center;transform:translate(0,50%);pointer-events:none;",s.appendChild(r),mxEvent.disableContextMenu(s),n.appendChild(s);var o=new Graph(s);o.setTooltips(!1),o.setEnabled(!1),o.setPanning(!0),o.panningHandler.ignoreCell=!0,o.panningHandler.useLeftButtonForPanning=!0,o.minFitScale=null,o.maxFitScale=null,o.centerZoom=!0;var d=0,c=null,m=0,u=o.getGlobalVariable;o.getGlobalVariable=function(e){return"page"==e&&null!=c&&null!=c[m]?c[m].getAttribute("name"):"pagenumber"==e?m+1:"pagecount"==e?null!=c?c.length:1:u.apply(this,arguments)},o.getLinkForCell=function(){return null},Editor.MathJaxRender&&o.addListener(mxEvent.SIZE,mxUtils.bind(this,(function(t,l){e.editor.graph.mathEnabled&&Editor.MathJaxRender(o.container)})));for(var p={lines:11,length:15,width:6,radius:10,corners:1,rotate:0,direction:1,color:Editor.isDarkMode()?"#c0c0c0":"#000",speed:1.4,trail:60,shadow:!1,hwaccel:!1,className:"spinner",zIndex:2e9,top:"50%",left:"50%"},g=new Spinner(p),h=e.getCurrentFile(),x=e.getXmlFileData(!0,!1,!0).getElementsByTagName("diagram"),v={},y=0;y<x.length;y++)v[x[y].getAttribute("id")]=x[y];var b=null,f=null,E=null,C=null,w=mxUtils.button("",(function(){null!=E&&o.zoomIn()}));w.className="geSprite geSprite-zoomin",w.setAttribute("title",mxResources.get("zoomIn")),w.style.outline="none",w.style.border="none",w.style.margin="2px",w.setAttribute("disabled","disabled"),mxUtils.setOpacity(w,20);var A=mxUtils.button("",(function(){null!=E&&o.zoomOut()}));A.className="geSprite geSprite-zoomout",A.setAttribute("title",mxResources.get("zoomOut")),A.style.outline="none",A.style.border="none",A.style.margin="2px",A.setAttribute("disabled","disabled"),mxUtils.setOpacity(A,20);var D=mxUtils.button("",(function(){null!=E&&(o.maxFitScale=8,o.fit(8),o.center())}));D.className="geSprite geSprite-fit",D.setAttribute("title",mxResources.get("fit")),D.style.outline="none",D.style.border="none",D.style.margin="2px",D.setAttribute("disabled","disabled"),mxUtils.setOpacity(D,20);var T=mxUtils.button("",(function(){null!=E&&(o.zoomActual(),o.center())}));T.className="geSprite geSprite-actualsize",T.setAttribute("title",mxResources.get("actualSize")),T.style.outline="none",T.style.border="none",T.style.margin="2px",T.setAttribute("disabled","disabled"),mxUtils.setOpacity(T,20);var R=mxUtils.button("",(function(){}));R.className="geSprite geSprite-middle",R.setAttribute("title",mxResources.get("compare")),R.style.outline="none",R.style.border="none",R.style.margin="2px",mxUtils.setOpacity(R,60);var I=s.cloneNode(!1);I.style.pointerEvent="none",s.parentNode.appendChild(I);var L=new Graph(I);L.setTooltips(!1),L.setEnabled(!1),L.setPanning(!0),L.panningHandler.ignoreCell=!0,L.panningHandler.useLeftButtonForPanning=!0,L.minFitScale=null,L.maxFitScale=null,L.centerZoom=!0,mxEvent.addGestureListeners(R,(function(e){var t=v[c[d].getAttribute("id")];if(mxUtils.setOpacity(R,20),r.innerHTML="",null==t)mxUtils.write(r,mxResources.get("pageNotFound"));else{U.style.display="none",s.style.display="none",I.style.display="",I.style.backgroundColor=s.style.backgroundColor;var l=Editor.parseDiagramNode(t);new mxCodec(l.ownerDocument).decode(l,L.getModel()),L.view.scaleAndTranslate(o.view.scale,o.view.translate.x,o.view.translate.y)}}),null,(function(){mxUtils.setOpacity(R,60),r.innerHTML="","none"==s.style.display&&(U.style.display="",s.style.display="",I.style.display="none")}));var U=document.createElement("div");U.style.position="absolute",U.style.textAlign="right",U.style.color="gray",U.style.marginTop="10px",U.style.backgroundColor="transparent",U.style.top="440px",U.style.right="32px",U.style.maxWidth="380px",U.style.cursor="default";var k=mxUtils.button(mxResources.get("download"),(function(){if(null!=E){var t=mxUtils.getXml(E.documentElement),l=e.getBaseFilename()+".drawio";if(e.isLocalFileSave())e.saveLocalFile(t,l,"text/xml");else{var n="undefined"==typeof pako?"&xml="+encodeURIComponent(t):"&data="+encodeURIComponent(Graph.compress(t));new mxXmlRequest(SAVE_URL,"filename="+encodeURIComponent(l)+"&format=xml"+n).simulate(document,"_blank")}}}));k.className="geBtn",k.setAttribute("disabled","disabled");var M=mxUtils.button(mxResources.get("restore"),(function(t){if(null!=E&&null!=C)if(mxEvent.isShiftDown(t)){if(null!=E){var n=e.getPagesForNode(E.documentElement),i=e.diffPages(e.pages,n),a=new TextareaDialog(e,mxResources.get("compare"),JSON.stringify(i,null,2),(function(t){if(t.length>0)try{e.confirm(mxResources.get("areYouSure"),(function(){h.patch([JSON.parse(t)],null,!0),e.hideDialog(),e.hideDialog()}))}catch(t){e.handleError(t)}}),null,null,null,null,null,!0,null,mxResources.get("merge"));a.textarea.style.width="600px",a.textarea.style.height="380px",e.showDialog(a.container,620,460,!0,!0),a.init()}}else e.confirm(mxResources.get("areYouSure"),(function(){null!=l?l(C):e.spinner.spin(document.body,mxResources.get("restoring"))&&h.save(!0,(function(t){e.spinner.stop(),e.replaceFileData(C),e.hideDialog()}),(function(t){e.spinner.stop(),e.editor.setStatus(""),e.handleError(t,null!=t?mxResources.get("errorSavingFile"):null)}))}))}));M.className="geBtn",M.setAttribute("disabled","disabled"),M.setAttribute("title","Shift+Click for Diff");var N=document.createElement("select");N.setAttribute("disabled","disabled"),N.style.maxWidth="80px",N.style.position="relative",N.style.top="-2px",N.style.verticalAlign="bottom",N.style.marginRight="6px",N.style.display="none";var S=null;mxEvent.addListener(N,"change",(function(e){null!=S&&(S(e),mxEvent.consume(e))}));var B=mxUtils.button(mxResources.get("edit"),(function(){null!=E&&(window.openFile=new OpenFile((function(){window.openFile=null})),window.openFile.setData(mxUtils.getXml(E.documentElement)),e.openLink(e.getUrl(),null,!0))}));B.className="geBtn",B.setAttribute("disabled","disabled"),null!=l&&(B.style.display="none");var O=mxUtils.button(mxResources.get("show"),(function(){null!=f&&e.openLink(f.getUrl(N.selectedIndex))}));O.className="geBtn gePrimaryBtn",O.setAttribute("disabled","disabled"),null!=l&&(O.style.display="none",M.className="geBtn gePrimaryBtn");var P=document.createElement("div");P.style.position="absolute",P.style.top="482px",P.style.width="640px",P.style.textAlign="right";var G=document.createElement("div");G.className="geToolbarContainer",G.style.backgroundColor="transparent",G.style.padding="2px",G.style.border="none",G.style.left="199px",G.style.top="442px";var H=null;if(null!=t&&t.length>0){s.style.cursor="move";var F=document.createElement("table");F.style.border="1px solid lightGray",F.style.borderCollapse="collapse",F.style.borderSpacing="0px",F.style.width="100%";var z=document.createElement("tbody"),_=(new Date).toDateString();for(null!=e.currentPage&&null!=e.pages&&(d=mxUtils.indexOf(e.pages,e.currentPage)),y=t.length-1;y>=0;y--){var j=function(l){var n=new Date(l.modifiedDate),i=null;if(n.getTime()>=0){(i=document.createElement("tr")).style.borderBottom="1px solid lightGray",i.style.fontSize="12px",i.style.cursor="pointer";var a=document.createElement("td");a.style.padding="6px",a.style.whiteSpace="nowrap",l==t[t.length-1]?mxUtils.write(a,mxResources.get("current")):n.toDateString()===_?mxUtils.write(a,n.toLocaleTimeString()):mxUtils.write(a,n.toLocaleDateString()+" "+n.toLocaleTimeString()),i.appendChild(a),i.setAttribute("title",n.toLocaleDateString()+" "+n.toLocaleTimeString()+(null!=l.fileSize?" "+e.formatFileSize(parseInt(l.fileSize)):"")+(null!=l.lastModifyingUserName?" "+l.lastModifyingUserName:"")),mxEvent.addListener(i,"click",(function(t){f!=l&&(g.stop(),null!=b&&(b.style.backgroundColor=""),f=l,(b=i).style.backgroundColor=Editor.isDarkMode()?"#000000":"#ebf2f9",E=null,C=null,U.removeAttribute("title"),U.innerHTML=mxUtils.htmlEntities(mxResources.get("loading")+"..."),s.style.backgroundColor=o.defaultPageBackgroundColor,r.innerHTML="",o.getModel().clear(),M.setAttribute("disabled","disabled"),k.setAttribute("disabled","disabled"),w.setAttribute("disabled","disabled"),A.setAttribute("disabled","disabled"),T.setAttribute("disabled","disabled"),D.setAttribute("disabled","disabled"),R.setAttribute("disabled","disabled"),B.setAttribute("disabled","disabled"),O.setAttribute("disabled","disabled"),N.setAttribute("disabled","disabled"),mxUtils.setOpacity(w,20),mxUtils.setOpacity(A,20),mxUtils.setOpacity(D,20),mxUtils.setOpacity(T,20),mxUtils.setOpacity(R,20),g.spin(s),l.getXml((function(t){if(f==l)try{!function(t){g.stop(),r.innerHTML="";var a=mxUtils.parseXml(t),u=e.editor.extractGraphModel(a.documentElement,!0);if(null!=u){function p(e){var t=e.getAttribute("background");return null!=t&&""!=t&&t!=mxConstants.NONE||(t=o.defaultPageBackgroundColor),s.style.backgroundColor=t,new mxCodec(e.ownerDocument).decode(e,o.getModel()),o.maxFitScale=1,o.fit(8),o.center(),e}function x(e){return null!=e&&(e=p(Editor.parseDiagramNode(e))),e}if(N.style.display="none",N.innerHTML="",E=a,C=t,parseSelectFunction=null,c=null,m=0,"mxfile"==u.nodeName){var v=u.getElementsByTagName("diagram");c=[];for(var y=0;y<v.length;y++)c.push(v[y]);if(m=Math.min(d,c.length-1),c.length>0&&x(c[m]),c.length>1)for(N.removeAttribute("disabled"),N.style.display="",y=0;y<c.length;y++){var b=document.createElement("option");mxUtils.write(b,c[y].getAttribute("name")||mxResources.get("pageWithNumber",[y+1])),b.setAttribute("value",y),y==m&&b.setAttribute("selected","selected"),N.appendChild(b)}S=function(){try{var t=parseInt(N.value);m=d=t,x(c[t])}catch(t){N.value=d,e.handleError(t)}}}else p(u);var f=l.lastModifyingUserName;null!=f&&f.length>20&&(f=f.substring(0,20)+"..."),U.innerHTML="",mxUtils.write(U,(null!=f?f+" ":"")+n.toLocaleDateString()+" "+n.toLocaleTimeString()),U.setAttribute("title",i.getAttribute("title")),w.removeAttribute("disabled"),A.removeAttribute("disabled"),D.removeAttribute("disabled"),T.removeAttribute("disabled"),R.removeAttribute("disabled"),null!=h&&h.isRestricted()||(e.editor.graph.isEnabled()&&M.removeAttribute("disabled"),k.removeAttribute("disabled"),O.removeAttribute("disabled"),B.removeAttribute("disabled")),mxUtils.setOpacity(w,60),mxUtils.setOpacity(A,60),mxUtils.setOpacity(D,60),mxUtils.setOpacity(T,60),mxUtils.setOpacity(R,60)}else N.style.display="none",N.innerHTML="",U.innerHTML="",mxUtils.write(U,mxResources.get("errorLoadingFile")),mxUtils.write(r,mxResources.get("errorLoadingFile"))}(t)}catch(e){U.innerHTML=mxUtils.htmlEntities(mxResources.get("error")+": "+e.message)}}),(function(e){g.stop(),N.style.display="none",N.innerHTML="",U.innerHTML="",mxUtils.write(U,mxResources.get("errorLoadingFile")),mxUtils.write(r,mxResources.get("errorLoadingFile"))})),mxEvent.consume(t))})),mxEvent.addListener(i,"dblclick",(function(e){O.click(),window.getSelection?window.getSelection().removeAllRanges():document.selection&&document.selection.empty(),mxEvent.consume(e)}),!1),z.appendChild(i)}return i}(t[y]);null!=j&&y==t.length-1&&(H=j)}F.appendChild(z),a.appendChild(F)}else null==h||null==e.drive&&h.constructor==window.DriveFile||null==e.dropbox&&h.constructor==window.DropboxFile?(s.style.display="none",G.style.display="none",mxUtils.write(a,mxResources.get("notAvailable"))):(s.style.display="none",G.style.display="none",mxUtils.write(a,mxResources.get("noRevisions")));this.init=function(){null!=H&&H.click()};var W=mxUtils.button(mxResources.get("close"),(function(){e.hideDialog()}));W.className="geBtn",G.appendChild(N),G.appendChild(w),G.appendChild(A),G.appendChild(T),G.appendChild(D),G.appendChild(R),e.editor.cancelFirst?(P.appendChild(W),P.appendChild(k),P.appendChild(B),P.appendChild(M),P.appendChild(O)):(P.appendChild(k),P.appendChild(B),P.appendChild(M),P.appendChild(O),P.appendChild(W)),n.appendChild(P),n.appendChild(G),n.appendChild(U),this.container=n},DraftDialog=function(e,t,l,n,i,a,s,r,o){var d=document.createElement("div"),c=document.createElement("div");c.style.marginTop="0px",c.style.whiteSpace="nowrap",c.style.overflow="auto",c.style.lineHeight="normal",mxUtils.write(c,t),d.appendChild(c);var m=document.createElement("select"),u=mxUtils.bind(this,(function(){b=mxUtils.parseXml(o[m.value].data),f=e.editor.extractGraphModel(b.documentElement,!0),E=0,this.init()}));if(null!=o){m.style.marginLeft="4px";for(var p=0;p<o.length;p++){var g=document.createElement("option");g.setAttribute("value",p);var h=new Date(o[p].created),x=new Date(o[p].modified);mxUtils.write(g,h.toLocaleDateString()+" "+h.toLocaleTimeString()+" - "+(h.toDateString(),x.toDateString(),x.toLocaleDateString()+" ")+x.toLocaleTimeString()),m.appendChild(g)}c.appendChild(m),mxEvent.addListener(m,"change",u)}null==l&&(l=o[0].data);var v=document.createElement("div");v.style.position="absolute",v.style.border="1px solid lightGray",v.style.marginTop="10px",v.style.left="40px",v.style.right="40px",v.style.top="46px",v.style.bottom="74px",v.style.overflow="hidden",mxEvent.disableContextMenu(v),d.appendChild(v);var y=new Graph(v);y.setEnabled(!1),y.setPanning(!0),y.panningHandler.ignoreCell=!0,y.panningHandler.useLeftButtonForPanning=!0,y.minFitScale=null,y.maxFitScale=null,y.centerZoom=!0;var b=mxUtils.parseXml(l),f=e.editor.extractGraphModel(b.documentElement,!0),E=0,C=null,w=y.getGlobalVariable;y.getGlobalVariable=function(e){return"page"==e&&null!=C&&null!=C[E]?C[E].getAttribute("name"):"pagenumber"==e?E+1:"pagecount"==e?null!=C?C.length:1:w.apply(this,arguments)},y.getLinkForCell=function(){return null};var A=mxUtils.button("",(function(){y.zoomIn()}));A.className="geSprite geSprite-zoomin",A.setAttribute("title",mxResources.get("zoomIn")),A.style.outline="none",A.style.border="none",A.style.margin="2px",mxUtils.setOpacity(A,60);var D=mxUtils.button("",(function(){y.zoomOut()}));D.className="geSprite geSprite-zoomout",D.setAttribute("title",mxResources.get("zoomOut")),D.style.outline="none",D.style.border="none",D.style.margin="2px",mxUtils.setOpacity(D,60);var T=mxUtils.button("",(function(){y.maxFitScale=8,y.fit(8),y.center()}));T.className="geSprite geSprite-fit",T.setAttribute("title",mxResources.get("fit")),T.style.outline="none",T.style.border="none",T.style.margin="2px",mxUtils.setOpacity(T,60);var R=mxUtils.button("",(function(){y.zoomActual(),y.center()}));R.className="geSprite geSprite-actualsize",R.setAttribute("title",mxResources.get("actualSize")),R.style.outline="none",R.style.border="none",R.style.margin="2px",mxUtils.setOpacity(R,60);var I=mxUtils.button(s||mxResources.get("discard"),(function(){i.apply(this,[m.value,mxUtils.bind(this,(function(){null!=m.parentNode&&(m.options[m.selectedIndex].parentNode.removeChild(m.options[m.selectedIndex]),m.options.length>0?(m.value=m.options[0].value,u()):e.hideDialog(!0))}))])}));I.className="geBtn";var L=document.createElement("select");L.style.maxWidth="80px",L.style.position="relative",L.style.top="-2px",L.style.verticalAlign="bottom",L.style.marginRight="6px",L.style.display="none";var U=mxUtils.button(a||mxResources.get("edit"),(function(){n.apply(this,[m.value])}));U.className="geBtn gePrimaryBtn";var k=document.createElement("div");k.style.position="absolute",k.style.bottom="30px",k.style.right="40px",k.style.textAlign="right";var M=document.createElement("div");M.className="geToolbarContainer",M.style.cssText="box-shadow:none !important;background-color:transparent;padding:2px;border-style:none !important;bottom:30px;",this.init=function(){function e(e){if(null!=e){var t=e.getAttribute("background");null!=t&&""!=t&&t!=mxConstants.NONE||(t=Editor.isDarkMode()?"transparent":"#ffffff"),v.style.backgroundColor=t,new mxCodec(e.ownerDocument).decode(e,y.getModel()),y.maxFitScale=1,y.fit(8),y.center()}return e}function t(t){return null!=t&&(t=e(Editor.parseDiagramNode(t))),t}if(mxEvent.addListener(L,"change",(function(e){E=parseInt(L.value),t(C[E]),mxEvent.consume(e)})),"mxfile"==f.nodeName){var l=f.getElementsByTagName("diagram");C=[];for(var n=0;n<l.length;n++)C.push(l[n]);if(C.length>0&&t(C[E]),L.innerHTML="",C.length>1)for(L.style.display="",n=0;n<C.length;n++){var i=document.createElement("option");mxUtils.write(i,C[n].getAttribute("name")||mxResources.get("pageWithNumber",[n+1])),i.setAttribute("value",n),n==E&&i.setAttribute("selected","selected"),L.appendChild(i)}else L.style.display="none"}else e(f)},M.appendChild(L),M.appendChild(A),M.appendChild(D),M.appendChild(R),M.appendChild(T);var N=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog(!0)}));N.className="geBtn";var S=null!=r?mxUtils.button(mxResources.get("ignore"),r):null;null!=S&&(S.className="geBtn"),e.editor.cancelFirst?(k.appendChild(N),null!=S&&k.appendChild(S),k.appendChild(I),k.appendChild(U)):(k.appendChild(U),k.appendChild(I),null!=S&&k.appendChild(S),k.appendChild(N)),d.appendChild(k),d.appendChild(M),this.container=d},FindWindow=function(e,t,l,n,i,a){var s=e.actions.get("findReplace"),r=e.editor.graph,o=null,d=null,c=!1,m=!1,u=null,p=0,g=1,h=document.createElement("div");h.style.userSelect="none",h.style.overflow="hidden",h.style.padding="10px",h.style.height="100%";var x,v=a?"260px":"200px",y=document.createElement("input");y.setAttribute("placeholder",mxResources.get("find")),y.setAttribute("type","text"),y.style.marginTop="4px",y.style.marginBottom="6px",y.style.width=v,y.style.fontSize="12px",y.style.borderRadius="4px",y.style.padding="6px",h.appendChild(y),mxUtils.br(h),a&&((x=document.createElement("input")).setAttribute("placeholder",mxResources.get("replaceWith")),x.setAttribute("type","text"),x.style.marginTop="4px",x.style.marginBottom="6px",x.style.width=v,x.style.fontSize="12px",x.style.borderRadius="4px",x.style.padding="6px",h.appendChild(x),mxUtils.br(h),mxEvent.addListener(x,"input",T));var b=document.createElement("input");b.setAttribute("id","geFindWinRegExChck"),b.setAttribute("type","checkbox"),b.style.marginRight="4px",h.appendChild(b);var f=document.createElement("label");f.setAttribute("for","geFindWinRegExChck"),h.appendChild(f),mxUtils.write(f,mxResources.get("regularExpression")),h.appendChild(f);var E=e.menus.createHelpLink("https://www.diagrams.net/doc/faq/find-shapes");E.style.position="relative",E.style.marginLeft="6px",E.style.top="-1px",h.appendChild(E),mxUtils.br(h);var C=document.createElement("input");C.setAttribute("id","geFindWinAllPagesChck"),C.setAttribute("type","checkbox"),C.style.marginRight="4px",h.appendChild(C);var w=document.createElement("label");w.setAttribute("for","geFindWinAllPagesChck"),h.appendChild(w),mxUtils.write(w,mxResources.get("allPages")),h.appendChild(w);var A=document.createElement("div");function D(e,t,l,n){if("object"==typeof t.value&&null!=t.value.attributes)for(var i=t.value.attributes,a=0;a<i.length;a++)if("label"!=i[a].nodeName){var s=mxUtils.trim(i[a].nodeValue.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")).toLowerCase();if(null==e&&(n&&s.indexOf(l)>=0||!n&&s.substring(0,l.length)===l)||null!=e&&e.test(s))return!0}return!1}function T(){c&&x.value?(N.removeAttribute("disabled"),S.removeAttribute("disabled")):(N.setAttribute("disabled","disabled"),S.setAttribute("disabled","disabled")),x.value&&y.value?B.removeAttribute("disabled"):B.setAttribute("disabled","disabled")}function R(t,l,n){k.innerHTML="";var i=r.model.getDescendants(r.model.getRoot()),s=y.value.toLowerCase(),g=b.checked?new RegExp(s):null,h=null;u=null,o!=s&&(o=s,d=null,m=!1);var v=null==d;if(s.length>0){if(m){var f;m=!1;for(var E=0;E<e.pages.length;E++)if(e.currentPage==e.pages[E]){f=E;break}var w,I=(f+1)%e.pages.length;d=null;do{m=!1,w=e.pages[I],r=e.createTemporaryGraph(r.getStylesheet()),e.updatePageRoot(w),r.model.setRoot(w.root),I=(I+1)%e.pages.length}while(!R(!0,l,n)&&I!=f);return d&&(d=null,n?e.editor.graph.model.execute(new SelectPage(e,w)):e.selectPage(w)),m=!1,r=e.editor.graph,R(!0,l,n)}for(E=0;E<i.length;E++){var L=r.view.getState(i[E]);if(l&&null!=g&&(v=v||L==d),null!=L&&null!=L.cell.value&&(v||null==h)&&(r.model.isVertex(L.cell)||r.model.isEdge(L.cell))){null!=L.style&&"1"==L.style.html?(A.innerHTML=r.sanitizeHtml(r.getLabel(L.cell)),label=mxUtils.extractTextWithWhitespace([A])):label=r.getLabel(L.cell),label=mxUtils.trim(label.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")).toLowerCase();var U=0;l&&a&&null!=g&&L==d&&(label=label.substr(p),U=p);var M=""==x.value,N=M;if(null==g&&(N&&label.indexOf(s)>=0||!N&&label.substring(0,s.length)===s||M&&D(g,L.cell,s,N))||null!=g&&(g.test(label)||M&&D(g,L.cell,s,N))){if(a)if(null!=g){var S=label.match(g);u=S[0].toLowerCase(),p=U+S.index+u.length}else p=(u=s).length;if(v){h=L;break}null==h&&(h=L)}}v=v||L==d}}if(null!=h){if(E==i.length&&C.checked)return d=null,m=!0,R(!0,l,n);d=h,r.scrollCellToVisible(d.cell),r.isEnabled()&&!r.isCellLocked(d.cell)?n||r.getSelectionCell()==d.cell&&1==r.getSelectionCount()||r.setSelectionCell(d.cell):r.highlightCell(d.cell)}else{if(!t&&C.checked)return m=!0,R(!0,l,n);r.isEnabled()&&!n&&r.clearSelection()}return c=null!=h,a&&!t&&T(),0==s.length||null!=h}mxUtils.br(h);var I=document.createElement("div");I.style.left="0px",I.style.right="0px",I.style.marginTop="6px",I.style.padding="0 6px 0 6px",I.style.textAlign="center",h.appendChild(I);var L=mxUtils.button(mxResources.get("reset"),(function(){k.innerHTML="",y.value="",y.style.backgroundColor="",a&&(x.value="",T()),d=null,o=null,m=!1,y.focus()}));L.setAttribute("title",mxResources.get("reset")),L.style.float="none",L.style.width="120px",L.style.marginTop="6px",L.style.marginLeft="8px",L.style.overflow="hidden",L.style.textOverflow="ellipsis",L.className="geBtn",a||I.appendChild(L);var U=mxUtils.button(mxResources.get("find"),(function(){try{y.style.backgroundColor=R()?"":Editor.isDarkMode()?"#ff0000":"#ffcfcf"}catch(t){e.handleError(t)}}));U.setAttribute("title",mxResources.get("find")+" (Enter)"),U.style.float="none",U.style.width="120px",U.style.marginTop="6px",U.style.marginLeft="8px",U.style.overflow="hidden",U.style.textOverflow="ellipsis",U.className="geBtn gePrimaryBtn",I.appendChild(U);var k=document.createElement("div");if(k.style.marginTop="10px",a){function M(e,t,l,n,i){if(null==i||"1"!=i.html)return(o=e.toLowerCase().indexOf(t,n))<0?e:e.substr(0,o)+l+e.substr(o+t.length);var a=e;t=mxUtils.htmlEntities(t);var s=[],r=-1;for(e=e.replace(/<br>/gi,"\n");(r=e.indexOf("<",r+1))>-1;)s.push(r);var o,d=e.match(/<[^>]*>/g);if((o=(e=e.replace(/<[^>]*>/g,"")).toLowerCase().indexOf(t,n))<0)return a;for(var c=o+t.length,m=(l=mxUtils.htmlEntities(l),e.substr(0,o)+l+e.substr(c)),u=0,p=0;p<s.length;p++){if(s[p]-u<o)m=m.substr(0,s[p])+d[p]+m.substr(s[p]);else if(s[p]-u<c){var g=o+u;m=m.substr(0,g)+d[p]+m.substr(g)}else g=s[p]+(l.length-t.length),m=m.substr(0,g)+d[p]+m.substr(g);u+=d[p].length}return m.replace(/\n/g,"<br>")}var N=mxUtils.button(mxResources.get("replFind"),(function(){try{if(null!=u&&null!=d&&x.value){var t=d.cell,l=r.getLabel(t);r.isCellEditable(t)&&r.model.setValue(t,M(l,u,x.value,p-u.length,r.getCurrentCellStyle(t))),y.style.backgroundColor=R(!1,!0)?"":Editor.isDarkMode()?"#ff0000":"#ffcfcf"}}catch(t){e.handleError(t)}}));N.setAttribute("title",mxResources.get("replFind")),N.style.float="none",N.style.width="120px",N.style.marginTop="6px",N.style.marginLeft="8px",N.style.overflow="hidden",N.style.textOverflow="ellipsis",N.className="geBtn gePrimaryBtn",N.setAttribute("disabled","disabled"),I.appendChild(N),mxUtils.br(I);var S=mxUtils.button(mxResources.get("replace"),(function(){try{if(null!=u&&null!=d&&x.value){var t=d.cell,l=r.getLabel(t);r.model.setValue(t,M(l,u,x.value,p-u.length,r.getCurrentCellStyle(t))),N.setAttribute("disabled","disabled"),S.setAttribute("disabled","disabled")}}catch(t){e.handleError(t)}}));S.setAttribute("title",mxResources.get("replace")),S.style.float="none",S.style.width="120px",S.style.marginTop="6px",S.style.marginLeft="8px",S.style.overflow="hidden",S.style.textOverflow="ellipsis",S.className="geBtn gePrimaryBtn",S.setAttribute("disabled","disabled"),I.appendChild(S);var B=mxUtils.button(mxResources.get("replaceAll"),(function(){if(k.innerHTML="",x.value){var t=e.currentPage,l=e.editor.graph.getSelectionCells();e.editor.graph.rendering=!1,r.getModel().beginUpdate();try{for(var n=0,i={};R(!1,!0,!0)&&n<100;){var a=d.cell,s=r.getLabel(a),o=i[a.id];if(o&&o.replAllMrk==g&&o.replAllPos>=p)break;i[a.id]={replAllMrk:g,replAllPos:p},r.isCellEditable(a)&&(r.model.setValue(a,M(s,u,x.value,p-u.length,r.getCurrentCellStyle(a))),n++)}t!=e.currentPage&&e.editor.graph.model.execute(new SelectPage(e,t)),mxUtils.write(k,mxResources.get("matchesRepl",[n]))}catch(t){e.handleError(t)}finally{r.getModel().endUpdate(),e.editor.graph.setSelectionCells(l),e.editor.graph.rendering=!0}g++}}));B.setAttribute("title",mxResources.get("replaceAll")),B.style.float="none",B.style.width="120px",B.style.marginTop="6px",B.style.marginLeft="8px",B.style.overflow="hidden",B.style.textOverflow="ellipsis",B.className="geBtn gePrimaryBtn",B.setAttribute("disabled","disabled"),I.appendChild(B),mxUtils.br(I),I.appendChild(L);var O=mxUtils.button(mxResources.get("close"),mxUtils.bind(this,(function(){this.window.setVisible(!1)})));O.setAttribute("title",mxResources.get("close")),O.style.float="none",O.style.width="120px",O.style.marginTop="6px",O.style.marginLeft="8px",O.style.overflow="hidden",O.style.textOverflow="ellipsis",O.className="geBtn",I.appendChild(O),mxUtils.br(I),I.appendChild(k)}else L.style.width="90px",U.style.width="90px";mxEvent.addListener(y,"keyup",(function(e){if(91==e.keyCode||93==e.keyCode||17==e.keyCode)mxEvent.consume(e);else if(27==e.keyCode)s.funct();else if(o!=y.value.toLowerCase()||13==e.keyCode)try{y.style.backgroundColor=R()?"":Editor.isDarkMode()?"#ff0000":"#ffcfcf"}catch(e){y.style.backgroundColor=Editor.isDarkMode()?"#ff0000":"#ffcfcf"}})),mxEvent.addListener(h,"keydown",(function(t){70==t.keyCode&&e.keyHandler.isControlDown(t)&&!mxEvent.isShiftDown(t)&&(s.funct(),mxEvent.consume(t))}));var P=DrawIOEmptyDivCreate(e.container,"findWithReplaceDiv");this.window=new mxWindow(mxResources.get("find")+(a?"/"+mxResources.get("replace"):""),h,t,l,n,i,!0,!0,P),this.window.destroyOnClose=!1,this.window.setMaximizable(!1),this.window.setResizable(!1),this.window.setClosable(!0),this.window.addListener("show",mxUtils.bind(this,(function(){this.window.fit(),this.window.isVisible()?(y.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?y.select():document.execCommand("selectAll",!1,null),null!=e.pages&&e.pages.length>1?C.removeAttribute("disabled"):(C.checked=!1,C.setAttribute("disabled","disabled"))):r.container.focus()}))),this.window.setLocation=function(e,t){var l=window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth,n=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight;e=Math.max(0,Math.min(e,l-this.table.clientWidth)),t=Math.max(0,Math.min(t,n-this.table.clientHeight-("1"==urlParams.sketch?3:48))),this.getX()==e&&this.getY()==t||mxWindow.prototype.setLocation.apply(this,arguments)};var G=mxUtils.bind(this,(function(){var e=this.window.getX(),t=this.window.getY();this.window.setLocation(e,t)}));mxEvent.addListener(window,"resize",G),this.destroy=function(){mxEvent.removeListener(window,"resize",G),this.window.destroy()}},FreehandWindow=function(e,t,l,n,i){var a=e.editor.graph,s=document.createElement("div");s.style.textAlign="center",s.style.userSelect="none",s.style.overflow="hidden",s.style.height="100%";var r=mxUtils.button(mxResources.get("startDrawing"),(function(){a.freehand.isDrawing()?a.freehand.stopDrawing():a.freehand.startDrawing()}));r.setAttribute("title",mxResources.get("startDrawing")),r.style.marginTop="10px",r.style.width="90%",r.style.boxSizing="border-box",r.style.overflow="hidden",r.style.textOverflow="ellipsis",r.style.textAlign="center",r.className="geBtn gePrimaryBtn",s.appendChild(r);var o=DrawIOEmptyDivCreate(e.container,"freehandDiv");this.window=new mxWindow(mxResources.get("freehand"),s,t,l,n,i,!0,!0,o),this.window.destroyOnClose=!1,this.window.setMaximizable(!1),this.window.setResizable(!1),this.window.setClosable(!0),a.addListener("freehandStateChanged",mxUtils.bind(this,(function(){r.innerHTML="",mxUtils.write(r,mxResources.get(a.freehand.isDrawing()?"stopDrawing":"startDrawing")),r.setAttribute("title",mxResources.get(a.freehand.isDrawing()?"stopDrawing":"startDrawing")),r.className="geBtn"+(a.freehand.isDrawing()?"":" gePrimaryBtn")}))),this.window.addListener("show",mxUtils.bind(this,(function(){this.window.fit()}))),this.window.addListener("hide",mxUtils.bind(this,(function(){a.freehand.isDrawing()&&a.freehand.stopDrawing()}))),this.window.setLocation=function(e,t){var l=window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth,n=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight;e=Math.max(0,Math.min(e,l-this.table.clientWidth)),t=Math.max(0,Math.min(t,n-this.table.clientHeight-("1"==urlParams.sketch?3:48))),this.getX()==e&&this.getY()==t||mxWindow.prototype.setLocation.apply(this,arguments)};var d=mxUtils.bind(this,(function(){var e=this.window.getX(),t=this.window.getY();this.window.setLocation(e,t)}));mxEvent.addListener(window,"resize",d),this.destroy=function(){mxEvent.removeListener(window,"resize",d),this.window.destroy()}},TagsWindow=function(e,t,l,n,i){var a=e.editor.graph,s=e.editor.graph.createTagsDialog(mxUtils.bind(this,(function(){return this.window.isVisible()})),null,(function(t,l){if(a.isEnabled()){var n=new FilenameDialog(e,"",mxResources.get("add"),(function(n){if(e.hideDialog(),null!=n&&n.length>0){for(var i=n.split(" "),s=[],r=0;r<i.length;r++){var o=mxUtils.trim(i[r]);""!=o&&mxUtils.indexOf(t,o)<0&&s.push(o)}s.length>0&&(a.isSelectionEmpty()?l(t.concat(s)):a.addTagsForCells(a.getSelectionCells(),s))}}),mxResources.get("enterValue")+" ("+mxResources.get("tags")+")");e.showDialog(n.container,300,80,!0,!0),n.init()}})),r=s.div,o=DrawIOEmptyDivCreate(e.container,"tagsDiv");this.window=new mxWindow(mxResources.get("tags"),r,t,l,n,i,!0,!0,o),this.window.minimumSize=new mxRectangle(0,0,212,120),this.window.destroyOnClose=!1,this.window.setMaximizable(!1),this.window.setResizable(!0),this.window.setClosable(!0),this.window.addListener("show",mxUtils.bind(this,(function(){s.refresh(),this.window.fit()}))),this.window.setLocation=function(e,t){var l=window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth,n=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight;e=Math.max(0,Math.min(e,l-this.table.clientWidth)),t=Math.max(0,Math.min(t,n-this.table.clientHeight-("1"==urlParams.sketch?3:48))),this.getX()==e&&this.getY()==t||mxWindow.prototype.setLocation.apply(this,arguments)};var d=mxUtils.bind(this,(function(){var e=this.window.getX(),t=this.window.getY();this.window.setLocation(e,t)}));mxEvent.addListener(window,"resize",d),this.destroy=function(){mxEvent.removeListener(window,"resize",d),this.window.destroy()}},AuthDialog=function(e,t,l,n){var i=document.createElement("div");i.style.textAlign="center";var a=document.createElement("p");a.style.fontSize="16pt",a.style.padding="0px",a.style.margin="0px",a.style.color="gray",mxUtils.write(a,mxResources.get("authorizationRequired"));var s="Unknown",r=document.createElement("img");r.setAttribute("border","0"),r.setAttribute("align","absmiddle"),r.style.marginRight="10px",t==e.drive?(s=mxResources.get("googleDrive"),r.src=IMAGE_PATH+"/google-drive-logo-white.svg"):t==e.dropbox?(s=mxResources.get("dropbox"),r.src=IMAGE_PATH+"/dropbox-logo-white.svg"):t==e.oneDrive?(s=mxResources.get("oneDrive"),r.src=IMAGE_PATH+"/onedrive-logo-white.svg"):t==e.gitHub?(s=mxResources.get("github"),r.src=IMAGE_PATH+"/github-logo-white.svg"):t==e.gitLab?(s=mxResources.get("gitlab"),r.src=IMAGE_PATH+"/gitlab-logo.svg",r.style.width="32px"):t==e.notion?(s=mxResources.get("notion"),r.src=IMAGE_PATH+"/notion-logo-white.svg",r.style.width="32px"):t==e.trello&&(s=mxResources.get("trello"),r.src=IMAGE_PATH+"/trello-logo-white.svg");var o=document.createElement("p");mxUtils.write(o,mxResources.get("authorizeThisAppIn",[s]));var d=document.createElement("input");d.setAttribute("type","checkbox");var c=mxUtils.button(mxResources.get("authorize"),(function(){n(d.checked)}));if(c.insertBefore(r,c.firstChild),c.style.marginTop="6px",c.className="geBigButton",c.style.fontSize="18px",c.style.padding="14px",i.appendChild(a),i.appendChild(o),i.appendChild(c),l){var m=document.createElement("p");m.style.marginTop="20px",m.appendChild(d);var u=document.createElement("span");mxUtils.write(u," "+mxResources.get("rememberMe")),m.appendChild(u),i.appendChild(m),d.checked=!0,d.defaultChecked=!0,mxEvent.addListener(u,"click",(function(e){d.checked=!d.checked,mxEvent.consume(e)}))}this.container=i},MoreShapesDialog=function(e,t,l){l=null!=l?l:e.sidebar.entries;var n=document.createElement("div"),i=[];if(null!=e.sidebar.customEntries)for(var a=0;a<e.sidebar.customEntries.length;a++){for(var s=e.sidebar.customEntries[a],r={title:e.getResource(s.title),entries:[]},o=0;o<s.entries.length;o++){var d=s.entries[o];r.entries.push({id:d.id,title:e.getResource(d.title),desc:e.getResource(d.desc),image:d.preview})}i.push(r)}for(a=0;a<l.length;a++)if(null==e.sidebar.enabledLibraries)i.push(l[a]);else{for(r={title:l[a].title,entries:[]},o=0;o<l[a].entries.length;o++)mxUtils.indexOf(e.sidebar.enabledLibraries,l[a].entries[o].id)>=0&&r.entries.push(l[a].entries[o]);r.entries.length>0&&i.push(r)}if(l=i,t){var c=mxUtils.bind(this,(function(t){for(var l=0;l<t.length;l++)!function(t){var n=x.cloneNode(!1);n.style.fontWeight="bold",n.style.backgroundColor=Editor.isDarkMode()?"#505759":"#e5e5e5",n.style.padding="6px 0px 6px 20px",mxUtils.write(n,t.title),u.appendChild(n);for(var i=0;i<t.entries.length;i++)!function(t){var n=x.cloneNode(!1);n.style.cursor="pointer",n.style.padding="4px 0px 4px 20px",n.style.whiteSpace="nowrap",n.style.overflow="hidden",n.style.textOverflow="ellipsis",n.setAttribute("title",t.title+" ("+t.id+")");var a=document.createElement("input");a.setAttribute("type","checkbox"),a.checked=e.sidebar.isEntryVisible(t.id),a.defaultChecked=a.checked,n.appendChild(a),mxUtils.write(n," "+t.title),u.appendChild(n);var s=function(e){if(null==e||"INPUT"!=mxEvent.getSource(e).nodeName){if(p.style.textAlign="center",p.style.padding="0px",p.style.color="",p.innerHTML="",null!=t.desc){var l=document.createElement("pre");l.style.boxSizing="border-box",l.style.fontFamily="inherit",l.style.margin="20px",l.style.right="0px",l.style.textAlign="left",mxUtils.write(l,t.desc),p.appendChild(l)}null!=t.imageCallback?t.imageCallback(p):null!=t.image?p.innerHTML+='<img border="0" src="'+t.image+'"/>':null==t.desc&&(p.style.padding="20px",p.style.color="rgb(179, 179, 179)",mxUtils.write(p,mxResources.get("noPreview"))),null!=g&&(g.style.backgroundColor=""),(g=n).style.backgroundColor=Editor.isDarkMode()?"#000000":"#ebf2f9",null!=e&&mxEvent.consume(e)}};mxEvent.addListener(n,"click",s),mxEvent.addListener(n,"dblclick",(function(e){a.checked=!a.checked,mxEvent.consume(e)})),h.push((function(){return a.checked?t.id:null})),0==l&&0==i&&s()}(t.entries[i])}(t[l])})),m=document.createElement("div");m.className="geDialogTitle",mxUtils.write(m,mxResources.get("shapes")),m.style.position="absolute",m.style.top="0px",m.style.left="0px",m.style.lineHeight="40px",m.style.height="40px",m.style.right="0px";var u=document.createElement("div"),p=document.createElement("div");u.style.position="absolute",u.style.top="40px",u.style.left="0px",u.style.width="202px",u.style.bottom="60px",u.style.overflow="auto",p.style.position="absolute",p.style.left="202px",p.style.right="0px",p.style.top="40px",p.style.bottom="60px",p.style.overflow="auto",p.style.borderLeft="1px solid rgb(211, 211, 211)",p.style.textAlign="center";var g=null,h=[],x=document.createElement("div");x.style.position="relative",x.style.left="0px",x.style.right="0px",c(l),n.style.padding="30px",n.appendChild(m),n.appendChild(u),n.appendChild(p),(U=document.createElement("div")).className="geDialogFooter",U.style.position="absolute",U.style.paddingRight="16px",U.style.color="gray",U.style.left="0px",U.style.right="0px",U.style.bottom="0px",U.style.height="60px",U.style.lineHeight="52px",(k=document.createElement("input")).setAttribute("type","checkbox"),(isLocalStorage||mxClient.IS_CHROMEAPP)&&((M=document.createElement("span")).style.paddingRight="20px",M.appendChild(k),mxUtils.write(M," "+mxResources.get("rememberThisSetting")),k.checked=!0,k.defaultChecked=!0,mxEvent.addListener(M,"click",(function(e){mxEvent.getSource(e)!=k&&(k.checked=!k.checked,mxEvent.consume(e))})),U.appendChild(M)),(L=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}))).className="geBtn";var v=mxUtils.button(mxResources.get("apply"),(function(){e.hideDialog();for(var t=[],l=0;l<h.length;l++){var n=h[l].apply(this,arguments);null!=n&&t.push(n)}e.sidebar.showEntries(t.join(";"),k.checked,!0)}));v.className="geBtn gePrimaryBtn",e.editor.cancelFirst?(U.appendChild(L),U.appendChild(v)):(U.appendChild(v),U.appendChild(L)),n.appendChild(U)}else{var y=document.createElement("table"),b=document.createElement("tbody");n.style.height="100%",n.style.overflow="auto";var f=document.createElement("tr");y.style.width="100%";var E=document.createElement("td"),C=document.createElement("td"),w=document.createElement("td"),A=mxUtils.bind(this,(function(t,l,n){var i=document.createElement("input");i.type="checkbox",y.appendChild(i),i.checked=e.sidebar.isEntryVisible(n);var a=document.createElement("span");mxUtils.write(a,l);var s=document.createElement("div");return s.style.display="block",s.appendChild(i),s.appendChild(a),mxEvent.addListener(a,"click",(function(e){i.checked=!i.checked,mxEvent.consume(e)})),t.appendChild(s),function(){return i.checked?n:null}}));f.appendChild(E),f.appendChild(C),f.appendChild(w),b.appendChild(f),y.appendChild(b),h=[];var D=0;for(a=0;a<l.length;a++)for(o=0;o<l[a].entries.length;o++)D++;var T=[E,C,w],R=0;for(a=0;a<l.length;a++)!function(e){for(var t=0;t<e.entries.length;t++)!function(e){var t=Math.floor(R/(D/3));h.push(A(T[t],e.title,e.id)),R++}(e.entries[t])}(l[a]);n.appendChild(y);var I=document.createElement("div");I.style.marginTop="18px",I.style.textAlign="center";var L,U,k=document.createElement("input");if(isLocalStorage){k.setAttribute("type","checkbox"),k.checked=!0,k.defaultChecked=!0,I.appendChild(k);var M=document.createElement("span");mxUtils.write(M," "+mxResources.get("rememberThisSetting")),I.appendChild(M),mxEvent.addListener(M,"click",(function(e){k.checked=!k.checked,mxEvent.consume(e)}))}n.appendChild(I),(L=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}))).className="geBtn",v=mxUtils.button(mxResources.get("apply"),(function(){for(var t=["search"],l=0;l<h.length;l++){var n=h[l].apply(this,arguments);null!=n&&t.push(n)}e.sidebar.showEntries(t.length>0?t.join(";"):"",k.checked),e.hideDialog()})),v.className="geBtn gePrimaryBtn",(U=document.createElement("div")).style.marginTop="26px",U.style.textAlign="right",e.editor.cancelFirst?(U.appendChild(L),U.appendChild(v)):(U.appendChild(v),U.appendChild(L)),n.appendChild(U)}this.container=n},PluginsDialog=function(e,t,l){var n=document.createElement("div"),i=document.createElement("div");i.style.height="120px",i.style.overflow="auto";var a=mxSettings.getPlugins().slice();function s(){if(0==a.length)i.innerHTML=mxUtils.htmlEntities(mxResources.get("noPlugins"));else{i.innerHTML="";for(var t=0;t<a.length;t++){var n=document.createElement("span");n.style.whiteSpace="nowrap";var r=document.createElement("span");r.className="geSprite geSprite-delete",r.style.position="relative",r.style.cursor="pointer",r.style.top="5px",r.style.marginRight="4px",r.style.display="inline-block",n.appendChild(r),mxUtils.write(n,a[t]),i.appendChild(n),mxUtils.br(i),mxEvent.addListener(r,"click",function(t){return function(){e.confirm(mxResources.get("delete")+' "'+a[t]+'"?',(function(){null!=l&&l(a[t]),a.splice(t,1),s()}))}}(t))}}}n.appendChild(i),s();var r=mxUtils.button(mxResources.get("add")+"...",null!=t?function(){t((function(e){e&&mxUtils.indexOf(a,e)<0&&a.push(e),s()}))}:function(){var t=document.createElement("div"),l=document.createElement("span");l.style.marginTop="6px",mxUtils.write(l,mxResources.get("builtinPlugins")+": "),t.appendChild(l);var n=document.createElement("select");n.style.width="150px";for(var i=0;i<App.publicPlugin.length;i++){var r=document.createElement("option");mxUtils.write(r,App.publicPlugin[i]),r.value=App.publicPlugin[i],n.appendChild(r)}t.appendChild(n),mxUtils.br(t),mxUtils.br(t);var o=mxUtils.button(mxResources.get("custom")+"...",(function(){var t=new FilenameDialog(e,"",mxResources.get("add"),(function(t){if(e.hideDialog(),null!=t&&t.length>0){for(var l=t.split(";"),n=0;n<l.length;n++){var i=l[n],r=App.pluginRegistry[i];null!=r&&(i=r),i.length>0&&mxUtils.indexOf(a,i)<0&&a.push(i)}s()}}),mxResources.get("enterValue")+" ("+mxResources.get("url")+")");e.showDialog(t.container,300,80,!0,!0),t.init()}));o.className="geBtn";var d=new CustomDialog(e,t,mxUtils.bind(this,(function(){var e=App.pluginRegistry[n.value];mxUtils.indexOf(a,e)<0&&(a.push(e),s())})),null,null,null,o);e.showDialog(d.container,300,100,!0,!0)});r.className="geBtn";var o=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));o.className="geBtn";var d=mxUtils.button(mxResources.get("apply"),(function(){mxSettings.setPlugins(a),mxSettings.save(),e.hideDialog(),e.alert(mxResources.get("restartForChangeRequired"))}));d.className="geBtn gePrimaryBtn";var c=document.createElement("div");c.style.marginTop="14px",c.style.textAlign="right";var m=mxUtils.button(mxResources.get("help"),(function(){e.openLink("https://www.diagrams.net/doc/faq/plugins")}));m.className="geBtn",e.isOffline()&&!mxClient.IS_CHROMEAPP&&(m.style.display="none"),c.appendChild(m),e.editor.cancelFirst?(c.appendChild(o),c.appendChild(r),c.appendChild(d)):(c.appendChild(r),c.appendChild(d),c.appendChild(o)),n.appendChild(c),this.container=n},CropImageDialog=function(e,t,l){var n=document.createElement("div"),i=document.createElement("div");i.style.width="300px",i.style.height="300px",n.appendChild(i);var a=null;function s(e){null!=a&&a.destroy(),e?(a=new Croppie(i,{viewport:{width:150,height:150,type:"circle"},enableExif:!0,showZoomer:!1,enableResize:!1,enableOrientation:!0})).bind({url:t}):(a=new Croppie(i,{viewport:{width:150,height:150,type:"square"},enableExif:!0,showZoomer:!1,enableResize:!0,enableOrientation:!0})).bind({url:t})}this.init=function(){s()};var r=document.createElement("input");r.setAttribute("type","checkbox"),r.setAttribute("id","croppieCircle"),r.style.margin="5px",n.appendChild(r);var o,d,c,m,u,p=document.createElement("label");p.setAttribute("for","croppieCircle"),mxUtils.write(p,mxResources.get("circle")),n.appendChild(p),o=document.createElement("div"),d=document.createElement("button"),c=document.createElement("button"),o.appendChild(d),o.appendChild(c),m=document.createElement("i"),u=document.createElement("i"),d.appendChild(m),c.appendChild(u),o.className="cr-rotate-controls",o.style.float="right",o.style.position="inherit",d.className="cr-rotate-l",c.className="cr-rotate-r",n.appendChild(o),d.addEventListener("click",(function(){a.rotate(-90)})),c.addEventListener("click",(function(){a.rotate(90)})),mxEvent.addListener(r,"change",(function(){s(this.checked)}));var g=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));g.className="geBtn";var h=mxUtils.button(mxResources.get("apply"),(function(){a.result({type:"base64",size:"original"}).then((function(t){l(t),e.hideDialog()}))}));h.className="geBtn gePrimaryBtn";var x=document.createElement("div");x.style.marginTop="20px",x.style.textAlign="right",e.editor.cancelFirst?(x.appendChild(g),x.appendChild(h)):(x.appendChild(h),x.appendChild(g)),n.appendChild(x),this.container=n},EditGeometryDialog=function(e,t){var l=e.editor.graph,n=1==t.length?l.getCellGeometry(t[0]):null,i=document.createElement("div"),a=document.createElement("table"),s=document.createElement("tbody"),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td");a.style.paddingLeft="6px",mxUtils.write(o,mxResources.get("relative")+":");var c=document.createElement("input");c.setAttribute("type","checkbox"),null!=n&&n.relative&&(c.setAttribute("checked","checked"),c.defaultChecked=!0),this.init=function(){c.focus()},d.appendChild(c),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("left")+":");var m=document.createElement("input");m.setAttribute("type","text"),m.style.width="100px",m.value=null!=n?n.x:"",d.appendChild(m),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("top")+":");var u=document.createElement("input");u.setAttribute("type","text"),u.style.width="100px",u.value=null!=n?n.y:"",d.appendChild(u),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("dx")+":");var p=document.createElement("input");p.setAttribute("type","text"),p.style.width="100px",p.value=null!=n&&null!=n.offset?n.offset.x:"",d.appendChild(p),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("dy")+":");var g=document.createElement("input");g.setAttribute("type","text"),g.style.width="100px",g.value=null!=n&&null!=n.offset?n.offset.y:"",d.appendChild(g),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("width")+":");var h=document.createElement("input");h.setAttribute("type","text"),h.style.width="100px",h.value=null!=n?n.width:"",d.appendChild(h),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("height")+":");var x=document.createElement("input");x.setAttribute("type","text"),x.style.width="100px",x.value=null!=n?n.height:"",d.appendChild(x),r.appendChild(o),r.appendChild(d),s.appendChild(r),r=document.createElement("tr"),o=document.createElement("td"),d=document.createElement("td"),mxUtils.write(o,mxResources.get("rotation")+":");var v=document.createElement("input");v.setAttribute("type","text"),v.style.width="100px",v.value=1==t.length?mxUtils.getValue(l.getCellStyle(t[0]),mxConstants.STYLE_ROTATION,0):"",d.appendChild(v),r.appendChild(o),r.appendChild(d),s.appendChild(r),a.appendChild(s),i.appendChild(a);var y=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));y.className="geBtn";var b=mxUtils.button(mxResources.get("apply"),(function(){e.hideDialog(),l.getModel().beginUpdate();try{for(var n=0;n<t.length;n++){var i=l.getCellGeometry(t[n]);null!=i&&(i=i.clone(),l.isCellMovable(t[n])&&(i.relative=c.checked,mxUtils.trim(m.value).length>0&&(i.x=Number(m.value)),mxUtils.trim(u.value).length>0&&(i.y=Number(u.value)),mxUtils.trim(p.value).length>0&&(null==i.offset&&(i.offset=new mxPoint),i.offset.x=Number(p.value)),mxUtils.trim(g.value).length>0&&(null==i.offset&&(i.offset=new mxPoint),i.offset.y=Number(g.value))),l.isCellResizable(t[n])&&(mxUtils.trim(h.value).length>0&&(i.width=Number(h.value)),mxUtils.trim(x.value).length>0&&(i.height=Number(x.value))),l.getModel().setGeometry(t[n],i)),mxUtils.trim(v.value).length>0&&l.setCellStyles(mxConstants.STYLE_ROTATION,Number(v.value),[t[n]])}}finally{l.getModel().endUpdate()}}));b.className="geBtn gePrimaryBtn",mxEvent.addListener(i,"keypress",(function(e){13==e.keyCode&&b.click()}));var f=document.createElement("div");f.style.marginTop="20px",f.style.textAlign="right",e.editor.cancelFirst?(f.appendChild(y),f.appendChild(b)):(f.appendChild(b),f.appendChild(y)),i.appendChild(f),this.container=i},LibraryDialog=function(e,t,l,n,i,a){var s=[],r=(e.editor.graph,document.createElement("div"));r.style.height="100%";var o=document.createElement("div");o.style.whiteSpace="nowrap",o.style.height="40px",r.appendChild(o),mxUtils.write(o,mxResources.get("filename")+":");var d=t;null==d&&(d=e.defaultLibraryName+".xml");var c=document.createElement("input");c.setAttribute("value",d),c.style.marginRight="20px",c.style.marginLeft="10px",c.style.width="500px",null==i||i.isRenamable()||c.setAttribute("disabled","true"),this.init=function(){(null==i||i.isRenamable())&&(c.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?c.select():document.execCommand("selectAll",!1,null))},o.appendChild(c);var m=document.createElement("div");m.style.borderWidth="1px 0px 1px 0px",m.style.borderColor="#d3d3d3",m.style.borderStyle="solid",m.style.marginTop="6px",m.style.overflow="auto",m.style.height="340px",m.style.backgroundPosition="center center",m.style.backgroundRepeat="no-repeat",0==s.length&&Graph.fileSupport&&(m.style.backgroundImage="url('"+IMAGE_PATH+"/droptarget.png')");var u=document.createElement("div");u.style.position="absolute",u.style.width="640px",u.style.top="260px",u.style.textAlign="center",u.style.fontSize="22px",u.style.color="#a0c3ff",mxUtils.write(u,mxResources.get("dragImagesHere")),r.appendChild(u);var p={},g=100,h=100,x=null,v=null;function y(e){for(var t=document.elementFromPoint(e.clientX,e.clientY);null!=t&&t.parentNode!=m;)t=t.parentNode;var l=null;if(null!=t){var n=m.firstChild;for(l=0;null!=n&&n!=t;)n=n.nextSibling,l++}return l}var b=null,f=function(e){"true"!=mxEvent.getSource(e).getAttribute("contentEditable")&&null!=b&&(b(),b=null,mxEvent.consume(e))};mxEvent.addListener(m,"mousedown",f),mxEvent.addListener(m,"pointerdown",f),mxEvent.addListener(m,"touchstart",f);var E=new mxUrlConverter,C=!1;function w(t,l,n,i,a,r,o,d,c){try{if(e.spinner.stop(),null==l||"image/"==l.substring(0,6))if(null==t&&null!=o||null==p[t]){m.style.backgroundImage="",u.style.display="none";var v=a,f=r;if(a>e.maxImageSize||r>e.maxImageSize){var A=Math.min(1,Math.min(e.maxImageSize/Math.max(1,a)),e.maxImageSize/Math.max(1,r));a*=A,r*=A}v>f?(f=Math.round(f*g/v),v=g):(v=Math.round(v*h/f),f=h);var D=document.createElement("div");if(D.setAttribute("draggable","true"),D.style.display="inline-block",D.style.position="relative",D.style.padding="0 12px",D.style.cursor="move",mxUtils.setPrefixedStyle(D.style,"transition","transform .1s ease-in-out"),null!=t){var T=document.createElement("img");T.setAttribute("src",E.convert(t)),T.style.width=v+"px",T.style.height=f+"px",T.style.margin="10px",T.style.paddingBottom=Math.floor((h-f)/2)+"px",T.style.paddingLeft=Math.floor((g-v)/2)+"px",D.appendChild(T)}else null!=o&&(P=e.stringToCells(Graph.decompress(o.xml))).length>0&&(e.sidebar.createThumb(P,g,h,D,null,!0,!1),D.firstChild.style.display="inline-block",D.firstChild.style.cursor="");var R=document.createElement("img");R.setAttribute("src",Editor.closeBlackImage),R.setAttribute("border","0"),R.setAttribute("title",mxResources.get("delete")),R.setAttribute("align","top"),R.style.paddingTop="4px",R.style.position="absolute",R.style.marginLeft="-12px",R.style.zIndex="1",R.style.cursor="pointer",mxEvent.addListener(R,"dragstart",(function(e){mxEvent.consume(e)})),H=D,F=t,z=o,mxEvent.addListener(R,"click",(function(e){p[F]=null;for(var t=0;t<s.length;t++)if(null!=s[t].data&&s[t].data==F||null!=s[t].xml&&null!=z&&s[t].xml==z.xml){s.splice(t,1);break}D.parentNode.removeChild(H),0==s.length&&(m.style.backgroundImage="url('"+IMAGE_PATH+"/droptarget.png')",u.style.display=""),mxEvent.consume(e)})),mxEvent.addListener(R,"dblclick",(function(e){mxEvent.consume(e)})),D.appendChild(R),D.style.marginBottom="30px";var I=document.createElement("div");I.style.position="absolute",I.style.boxSizing="border-box",I.style.bottom="-18px",I.style.left="10px",I.style.right="10px",I.style.backgroundColor=Editor.isDarkMode()?Editor.darkColor:"#ffffff",I.style.overflow="hidden",I.style.textAlign="center";var L=null;function U(){I.innerHTML="",I.style.cursor="pointer",I.style.whiteSpace="nowrap",I.style.textOverflow="ellipsis",mxUtils.write(I,null!=L.title&&L.title.length>0?L.title:mxResources.get("untitled")),null==L.title||0==L.title.length?I.style.color="#d0d0d0":I.style.color=""}null!=t?(L={data:t,w:a,h:r,title:c},null!=d&&(L.aspect=d),p[t]=T,s.push(L)):null!=o&&(o.aspect="fixed",s.push(o),L=o),mxEvent.addListener(I,"keydown",(function(e){13==e.keyCode&&null!=b&&(b(),b=null,mxEvent.consume(e))})),U(),D.appendChild(I),mxEvent.addListener(I,"mousedown",(function(e){"true"!=I.getAttribute("contentEditable")&&mxEvent.consume(e)}));var k=function(t){if(mxClient.IS_IOS||mxClient.IS_FF||!(null==document.documentMode||document.documentMode>9)){var l=new FilenameDialog(e,L.title||"",mxResources.get("ok"),(function(e){null!=e&&(L.title=e,U())}),mxResources.get("enterValue"));e.showDialog(l.container,300,80,!0,!0),l.init(),mxEvent.consume(t)}else"true"!=I.getAttribute("contentEditable")&&(null!=b&&(b(),b=null),null!=L.title&&0!=L.title.length||(I.innerHTML=""),I.style.textOverflow="",I.style.whiteSpace="",I.style.cursor="text",I.style.color="",I.setAttribute("contentEditable","true"),mxUtils.setPrefixedStyle(I.style,"user-select","text"),I.focus(),document.execCommand("selectAll",!1,null),b=function(){I.removeAttribute("contentEditable"),I.style.cursor="pointer",L.title=I.innerHTML,U()},mxEvent.consume(t))};mxEvent.addListener(I,"click",k),mxEvent.addListener(D,"dblclick",k),m.appendChild(D),mxEvent.addListener(D,"dragstart",(function(e){null==t&&null!=o&&(R.style.visibility="hidden",I.style.visibility="hidden"),mxClient.IS_FF&&null!=o.xml&&e.dataTransfer.setData("Text",o.xml),x=y(e),mxClient.IS_GC&&(D.style.opacity="0.9"),window.setTimeout((function(){mxUtils.setPrefixedStyle(D.style,"transform","scale(0.5,0.5)"),mxUtils.setOpacity(D,30),R.style.visibility="",I.style.visibility=""}),0)})),mxEvent.addListener(D,"dragend",(function(e){"hidden"==R.style.visibility&&(R.style.visibility="",I.style.visibility=""),x=null,mxUtils.setOpacity(D,100),mxUtils.setPrefixedStyle(D.style,"transform",null)}))}else C||(C=!0,e.handleError({message:mxResources.get("fileExists")}));else{var M=!1;try{var N=mxUtils.parseXml(t);if("mxlibrary"==N.documentElement.nodeName){if(null!=(O=JSON.parse(mxUtils.getTextContent(N.documentElement)))&&O.length>0)for(var S=0;S<O.length;S++)null!=O[S].xml?w(null,null,0,0,0,0,O[S]):w(O[S].data,null,0,0,O[S].w,O[S].h,null,"fixed",O[S].title);M=!0}else if("mxfile"==N.documentElement.nodeName){var B=N.documentElement.getElementsByTagName("diagram");for(S=0;S<B.length;S++){var O=mxUtils.getTextContent(B[S]),P=e.stringToCells(Graph.decompress(O)),G=e.editor.graph.getBoundingBoxFromGeometry(P);w(null,null,0,0,0,0,{xml:O,w:G.width,h:G.height})}M=!0}}catch(e){}M||(e.spinner.stop(),e.handleError({message:mxResources.get("errorLoadingFile")}))}}catch(e){}var H,F,z;return null}if(null!=n)for(var A=0;A<n.length;A++){var D=n[A];w(D.data,null,0,0,D.w,D.h,D,D.aspect,D.title)}function T(e){e.dataTransfer.dropEffect=null!=x?"move":"copy",e.stopPropagation(),e.preventDefault()}mxEvent.addListener(m,"dragleave",(function(e){u.style.cursor="";for(var t=mxEvent.getSource(e);null!=t;){if(t==m||t==u){e.stopPropagation(),e.preventDefault();break}t=t.parentNode}}));var R=function(t){return function(l,n,i,a,s,r,o,d,c){null!=c&&(/(\.v(dx|sdx?))($|\?)/i.test(c.name)||/(\.vs(x|sx?))($|\?)/i.test(c.name))?e.importVisio(c,mxUtils.bind(this,(function(e){w(e,n,0,0,s,r,o,"fixed",mxEvent.isAltDown(t)?null:o.substring(0,o.lastIndexOf(".")).replace(/_/g," "))}))):null!=c&&!e.isOffline()&&(new XMLHttpRequest).upload&&e.isRemoteFileFormat(l,c.name)?e.parseFile(c,mxUtils.bind(this,(function(l){4==l.readyState&&(e.spinner.stop(),l.status>=200&&l.status<=299&&(w(l.responseText,n,0,0,s,r,o,"fixed",mxEvent.isAltDown(t)?null:o.substring(0,o.lastIndexOf(".")).replace(/_/g," ")),m.scrollTop=m.scrollHeight))}))):(w(l,n,0,0,s,r,o,"fixed",mxEvent.isAltDown(t)?null:o.substring(0,o.lastIndexOf(".")).replace(/_/g," ")),m.scrollTop=m.scrollHeight)}};function I(t){if(t.stopPropagation(),t.preventDefault(),C=!1,v=y(t),null!=x)null!=v&&v<m.children.length?(s.splice(v>x?v-1:v,0,s.splice(x,1)[0]),m.insertBefore(m.children[x],m.children[v])):(s.push(s.splice(x,1)[0]),m.appendChild(m.children[x]));else if(t.dataTransfer.files.length>0)e.importFiles(t.dataTransfer.files,0,0,e.maxImageSize,R(t));else if(mxUtils.indexOf(t.dataTransfer.types,"text/uri-list")>=0){var l=decodeURIComponent(t.dataTransfer.getData("text/uri-list"));(/(\.jpg)($|\?)/i.test(l)||/(\.png)($|\?)/i.test(l)||/(\.gif)($|\?)/i.test(l)||/(\.svg)($|\?)/i.test(l))&&e.loadImage(l,(function(e){w(l,null,0,0,e.width,e.height),m.scrollTop=m.scrollHeight}))}t.stopPropagation(),t.preventDefault()}mxEvent.addListener(m,"dragover",T),mxEvent.addListener(m,"drop",I),mxEvent.addListener(u,"dragover",T),mxEvent.addListener(u,"drop",I),r.appendChild(m);var L=document.createElement("div");L.style.textAlign="right",L.style.marginTop="20px";var U=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog(!0)}));if(U.setAttribute("id","btnCancel"),U.className="geBtn",e.editor.cancelFirst&&L.appendChild(U),"draw.io"!=e.getServiceName()||null==i||i.constructor!=DriveLibrary&&i.constructor!=GitHubLibrary||((M=mxUtils.button(mxResources.get("link"),(function(){e.spinner.spin(document.body,mxResources.get("loading"))&&i.getPublicUrl((function(t){if(e.spinner.stop(),null!=t){var l=e.getSearch(["create","title","mode","url","drive","splash","state","clibs","ui"]);l+=(0==l.length?"?":"&")+"splash=0&clibs=U"+encodeURIComponent(t);var n=new EmbedDialog(e,window.location.protocol+"//"+window.location.host+"/"+l,null,null,null,null,"Check out the library I made using @drawio");e.showDialog(n.container,450,240,!0),n.init()}else i.constructor==DriveLibrary?e.showError(mxResources.get("error"),mxResources.get("diagramIsNotPublic"),mxResources.get("share"),mxUtils.bind(this,(function(){e.drive.showPermissions(i.getId())})),null,mxResources.get("ok"),mxUtils.bind(this,(function(){}))):e.handleError({message:mxResources.get("diagramIsNotPublic")})}))}))).className="geBtn",L.appendChild(M)),(M=mxUtils.button(mxResources.get("export"),(function(){var t=e.createLibraryDataFromImages(s),l=c.value;/(\.xml)$/i.test(l)||(l+=".xml"),e.isLocalFileSave()?e.saveLocalFile(t,l,"text/xml",null,null,!0,null,"xml"):new mxXmlRequest(SAVE_URL,"filename="+encodeURIComponent(l)+"&format=xml&xml="+encodeURIComponent(t)).simulate(document,"_blank")}))).setAttribute("id","btnDownload"),M.className="geBtn",L.appendChild(M),Graph.fileSupport){if(null==e.libDlgFileInputElt){var k=document.createElement("input");k.setAttribute("multiple","multiple"),k.setAttribute("type","file"),mxEvent.addListener(k,"change",(function(t){C=!1,e.importFiles(k.files,0,0,e.maxImageSize,(function(e,l,n,i,a,s,r,o,d){null!=k.files&&(R(t)(e,l,n,i,a,s,r,o,d),k.type="",k.type="file",k.value="")})),m.scrollTop=m.scrollHeight})),k.style.display="none",e.container.appendChild(k)||document.body.appendChild(k),e.libDlgFileInputElt=k}var M;(M=mxUtils.button(mxResources.get("import"),(function(){null!=b&&(b(),b=null),e.libDlgFileInputElt.click()}))).setAttribute("id","btnAddImage"),M.className="geBtn",L.appendChild(M)}(M=mxUtils.button(mxResources.get("addImages"),(function(){null!=b&&(b(),b=null),e.showImageDialog(mxResources.get("addImageUrl"),"",(function(e,t,l){if(C=!1,null!=e){if("data:image/"==e.substring(0,11)){var n=e.indexOf(",");n>0&&(e=e.substring(0,n)+";base64,"+e.substring(n+1))}w(e,null,0,0,t,l),m.scrollTop=m.scrollHeight}}))}))).setAttribute("id","btnAddImageUrl"),M.className="geBtn",L.appendChild(M),this.saveBtnClickHandler=function(t,l,n,i){e.saveLibrary(t,l,n,i)},(M=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,(function(){null!=b&&(b(),b=null),this.saveBtnClickHandler(c.value,s,i,a)})))).setAttribute("id","btnSave"),M.className="geBtn gePrimaryBtn",L.appendChild(M),e.editor.cancelFirst||L.appendChild(U),r.appendChild(L),this.container=r},EditShapeDialog=function(e,t,l,n,i){var a,s;n=null!=n?n:300,i=null!=i?i:120;var r=document.createElement("table"),o=document.createElement("tbody");r.style.cellPadding="4px",a=document.createElement("tr"),(s=document.createElement("td")).setAttribute("colspan","2"),s.style.fontSize="10pt",mxUtils.write(s,l),a.appendChild(s),o.appendChild(a),a=document.createElement("tr"),s=document.createElement("td");var d=document.createElement("textarea");d.style.outline="none",d.style.resize="none",d.style.width=n-200+"px",d.style.height=i+"px",this.textarea=d,this.init=function(){d.focus(),d.scrollTop=0},s.appendChild(d),a.appendChild(s),s=document.createElement("td");var c=document.createElement("div");c.style.position="relative",c.style.border="1px solid gray",c.style.top="6px",c.style.width="200px",c.style.height=i+4+"px",c.style.overflow="hidden",c.style.marginBottom="16px",mxEvent.disableContextMenu(c),s.appendChild(c);var m=new Graph(c);m.setEnabled(!1);var u=e.editor.graph.cloneCell(t);m.addCells([u]);var p=m.view.getState(u),g="";null!=p.shape&&null!=p.shape.stencil&&(g=mxUtils.getPrettyXml(p.shape.stencil.desc)),mxUtils.write(d,g||"");var h=m.getGraphBounds(),x=Math.min(160/h.width,(i-40)/h.height);if(m.view.scaleAndTranslate(x,20/x-h.x,20/x-h.y),a.appendChild(s),o.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).setAttribute("colspan","2"),s.style.paddingTop="2px",s.style.whiteSpace="nowrap",s.setAttribute("align","right"),!e.isOffline()){var v=mxUtils.button(mxResources.get("help"),(function(){e.openLink("https://www.diagrams.net/doc/faq/shape-complex-create-edit")}));v.className="geBtn",s.appendChild(v)}var y=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));y.className="geBtn",e.editor.cancelFirst&&s.appendChild(y);var b=function(t,l,n){var i=d.value,a=mxUtils.parseXml(i);i=mxUtils.getPrettyXml(a.documentElement);var s=a.documentElement.getElementsByTagName("parsererror");if(null!=s&&s.length>0)e.showError(mxResources.get("error"),mxResources.get("containsValidationErrors"),mxResources.get("ok"));else{n&&e.hideDialog();var r=!t.model.contains(l);if(!n||r||i!=g){i=Graph.compress(i),t.getModel().beginUpdate();try{if(r){var o=e.editor.graph.getFreeInsertPoint();l.geometry.x=o.x,l.geometry.y=o.y,t.addCell(l)}t.setCellStyles(mxConstants.STYLE_SHAPE,"stencil("+i+")",[l])}catch(e){throw e}finally{t.getModel().endUpdate()}r&&(t.setSelectionCell(l),t.scrollCellToVisible(l))}}},f=mxUtils.button(mxResources.get("preview"),(function(){b(m,u,!1)}));f.className="geBtn",s.appendChild(f);var E=mxUtils.button(mxResources.get("apply"),(function(){b(e.editor.graph,t,!0)}));E.className="geBtn gePrimaryBtn",s.appendChild(E),e.editor.cancelFirst||s.appendChild(y),a.appendChild(s),o.appendChild(a),r.appendChild(o),this.container=r},CustomDialog=function(e,t,l,n,i,a,s,r,o,d,c){var m=document.createElement("div");m.appendChild(t);var u=document.createElement("div");if(u.style.marginTop="30px",u.style.textAlign="center",null!=s&&u.appendChild(s),!e.isOffline()&&null!=a){var p=mxUtils.button(mxResources.get("help"),(function(){e.openLink(a)}));p.className="geBtn",u.appendChild(p)}var g=mxUtils.button(o||mxResources.get("cancel"),(function(){e.hideDialog(),null!=n&&n()}));g.className="geBtn",r&&(g.style.display="none"),e.editor.cancelFirst&&u.appendChild(g);var h=mxUtils.button(i||mxResources.get("ok"),mxUtils.bind(this,(function(){if(d||e.hideDialog(null,null,this.container),null!=l){var t=l();if("string"==typeof t)return void e.showError(mxResources.get("error"),t)}d&&e.hideDialog(null,null,this.container)})));if(u.appendChild(h),h.className="geBtn gePrimaryBtn",e.editor.cancelFirst||u.appendChild(g),null!=c)for(var x=0;x<c.length;x++)!function(e,t,l){var n=mxUtils.button(e,(function(e){t(e)}));null!=l&&n.setAttribute("title",l),n.className="geBtn",u.appendChild(n)}(c[x][0],c[x][1],c[x][2]);m.appendChild(u),this.cancelBtn=g,this.okButton=h,this.container=m},TemplatesDialog=function(e,t,l,n,i,a,s,r,o,d,c,m,u,p,g){var h='<div class="geTempDlgHeader"><img src="/images/draw.io-logo.svg" class="geTempDlgHeaderLogo"><input type="search" class="geTempDlgSearchBox" '+(r?"":'style="display: none"')+' placeholder="'+mxResources.get("search")+'"></div><div class="geTemplatesList" style="display: none"><div class="geTempDlgBack">< '+mxResources.get("back")+'</div><div class="geTempDlgHLine"></div><div class="geTemplatesLbl">'+mxResources.get("templates")+'</div></div><div class="geTempDlgContent" style="width: 100%"><div class="geTempDlgNewDiagramCat"><div class="geTempDlgNewDiagramCatLbl">'+mxResources.get("newDiagram")+'</div><div class="geTempDlgNewDiagramCatList"></div><div class="geTempDlgNewDiagramCatFooter"><div class="geTempDlgShowAllBtn">'+mxResources.get("showMore")+'</div></div></div><div class="geTempDlgDiagramsList"><div class="geTempDlgDiagramsListHeader"><div class="geTempDlgDiagramsListTitle"></div><div class="geTempDlgDiagramsListBtns"><div class="geTempDlgRadioBtn geTempDlgRadioBtnLarge" data-id="myDiagramsBtn"><img src="/images/my-diagrams.svg" class="geTempDlgMyDiagramsBtnImg"> <span>'+mxResources.get("myDiagrams")+'</span></div><div class="geTempDlgRadioBtn geTempDlgRadioBtnLarge geTempDlgRadioBtnActive" data-id="allDiagramsBtn"><img src="/images/all-diagrams-sel.svg" class="geTempDlgAllDiagramsBtnImg"> <span>'+mxResources.get("allDiagrams")+'</span></div><div class="geTempDlgSpacer"> </div><div class="geTempDlgRadioBtn geTempDlgRadioBtnSmall geTempDlgRadioBtnActive" data-id="tilesBtn"><img src="/images/tiles-sel.svg" class="geTempDlgTilesBtnImg"></div><div class="geTempDlgRadioBtn geTempDlgRadioBtnSmall" data-id="listBtn"><img src="/images/list.svg" class="geTempDlgListBtnImg"></div></div></div><div class="geTempDlgDiagramsTiles"></div></div></div><br style="clear:both;"/><div class="geTempDlgFooter"><div class="geTempDlgErrMsg"></div>'+(u?'<span class="geTempDlgLinkToDiagram geTempDlgLinkToDiagramHint">'+mxResources.get("linkToDiagramHint")+'</span><button class="geTempDlgLinkToDiagram geTempDlgLinkToDiagramBtn">'+mxResources.get("linkToDiagram")+"</button>":"")+(m?'<div class="geTempDlgOpenBtn">'+mxResources.get("open")+"</div>":"")+'<div class="geTempDlgCreateBtn">'+mxResources.get("create")+'</div><div class="geTempDlgCancelBtn">'+mxResources.get("cancel")+"</div></div>",x=document.createElement("div");x.innerHTML=h,x.className="geTemplateDlg",this.container=x,n=null!=n?n:TEMPLATE_PATH+"/index.xml",i=null!=i?i:NEW_DIAGRAM_CATS_PATH+"/index.xml";var v,y,b=!1,f=!1,E=null,C=null,w=null,A=null,D=!1,T=!0,R=!1,I=[],L=null,U=!1,k=x.querySelector(".geTempDlgShowAllBtn"),M=x.querySelector(".geTempDlgDiagramsTiles"),N=x.querySelector(".geTempDlgDiagramsListTitle"),S=x.querySelector(".geTempDlgDiagramsListBtns"),B=x.querySelector(".geTempDlgContent"),O=x.querySelector(".geTempDlgDiagramsList"),P=x.querySelector(".geTempDlgNewDiagramCat"),G=x.querySelector(".geTempDlgNewDiagramCatList"),H=x.querySelector(".geTempDlgCreateBtn"),F=x.querySelector(".geTempDlgOpenBtn"),z=x.querySelector(".geTempDlgSearchBox"),_=x.querySelector(".geTempDlgErrMsg"),j=new Spinner({lines:12,length:10,width:5,radius:10,rotate:0,color:"#000",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"50px",zIndex:2e9});function W(e){_.innerHTML=mxUtils.htmlEntities(e),_.style.display="block",setTimeout((function(){_.style.display="none"}),4e3)}function Z(){null!=E&&(E.style.fontWeight="normal",E.style.textDecoration="none",C=E,E=null)}function V(e,t,l,n,i,a,s){return!(e.className.indexOf("geTempDlgRadioBtnActive")>-1||(e.className+=" geTempDlgRadioBtnActive",x.querySelector(".geTempDlgRadioBtn[data-id="+n+"]").className="geTempDlgRadioBtn "+(s?"geTempDlgRadioBtnLarge":"geTempDlgRadioBtnSmall"),x.querySelector("."+t).src="/images/"+l+"-sel.svg",x.querySelector("."+i).src="/images/"+a+".svg",0))}mxEvent.addListener(x.querySelector(".geTempDlgBack"),"click",(function(){Z(),U=!1,x.querySelector(".geTemplatesList").style.display="none",B.style.width="100%",P.style.display="",O.style.minHeight="calc(100% - 280px)",z.style.display=r?"":"none",z.value="",v=null,de(T)})),mxEvent.addListener(x.querySelector(".geTempDlgRadioBtn[data-id=allDiagramsBtn]"),"click",(function(){V(this,"geTempDlgAllDiagramsBtnImg","all-diagrams","myDiagramsBtn","geTempDlgMyDiagramsBtnImg","my-diagrams",!0)&&(T=!0,null==v?de(T):me(v))})),mxEvent.addListener(x.querySelector(".geTempDlgRadioBtn[data-id=myDiagramsBtn]"),"click",(function(){V(this,"geTempDlgMyDiagramsBtnImg","my-diagrams","allDiagramsBtn","geTempDlgAllDiagramsBtnImg","all-diagrams",!0)&&(T=!1,null==v?de(T):me(v))})),mxEvent.addListener(x.querySelector(".geTempDlgRadioBtn[data-id=listBtn]"),"click",(function(){V(this,"geTempDlgListBtnImg","list","tilesBtn","geTempDlgTilesBtnImg","tiles",!1)&&K(I,!1,R=!0,L)})),mxEvent.addListener(x.querySelector(".geTempDlgRadioBtn[data-id=tilesBtn]"),"click",(function(){V(this,"geTempDlgTilesBtnImg","tiles","listBtn","geTempDlgListBtnImg","list",!1)&&K(I,!1,R=!1,L)}));var X=!1;function Y(t,l,n,i){var a=null;if(X||e.sidebar.currentElt==l)e.sidebar.hideTooltip();else{function s(a){X&&e.sidebar.currentElt==l&&function(n,i,a){if(null!=n&&mxUtils.isAncestorNode(document.body,l)){var s=mxUtils.parseXml(n);if(null==(r=Editor.extractGraphModel(s.documentElement,!0)))return;if("mxfile"==r.nodeName)var r=Editor.parseDiagramNode(r.getElementsByTagName("diagram")[0]);var o=new mxCodec(r.ownerDocument),d=new mxGraphModel;o.decode(r,d);var c=d.root.getChildAt(0).children||[],m=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,u=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;e.sidebar.createTooltip(l,c,Math.min(m-80,1e3),Math.min(u-80,800),null!=t.title?mxResources.get(t.title,null,t.title):null,!0,new mxPoint(i,a),!0,null,!0);var p=document.createElement("div");p.className="geTempDlgDialogMask",x.appendChild(p);var g=e.sidebar.hideTooltip;e.sidebar.hideTooltip=function(){p&&(x.removeChild(p),p=null,g.apply(this,arguments),e.sidebar.hideTooltip=g)},mxEvent.addListener(p,"click",(function(){e.sidebar.hideTooltip()}))}}(a,mxEvent.getClientX(i),mxEvent.getClientY(i)),X=!1,n.src="/images/icon-search.svg"}e.sidebar.hideTooltip(),e.sidebar.currentElt=l,X=!0,n.src="/images/aui-wait.gif",t.isExt?o(t,s,(function(){W(mxResources.get("cantLoadPrev")),X=!1,n.src="/images/icon-search.svg"})):function(t,l){if(null==a){var n=t;n=/^https?:\/\//.test(n)&&!e.editor.isCorsEnabledForUrl(n)?PROXY_URL+"?url="+encodeURIComponent(n):TEMPLATE_PATH+"/"+n,mxUtils.get(n,mxUtils.bind(this,(function(e){e.getStatus()>=200&&e.getStatus()<=299?(a=e.getText(),l(a)):l(a)})))}else l(a)}(t.url,s)}}function Q(e,t,l){if(null!=w){for(var n=w.className.split(" "),i=0;i<n.length;i++)if(n[i].indexOf("Active")>-1){n.splice(i,1);break}w.className=n.join(" ")}null!=e?((w=e).className+=" "+t,A=l,l.isCategory,H.className="geTempDlgCreateBtn"):(w=null,A=null,H.className="geTempDlgCreateBtn geTempDlgBtnDisabled")}function J(l,n){if(null!=A){var i=A;function a(){A=i,H.className="geTempDlgCreateBtn",n&&(F.className="geTempDlgOpenBtn")}function s(){W(mxResources.get("cannotLoad")),a()}function r(l,a){g||e.hideDialog(!0),t(l,a,i,n)}function c(t){i.isExternal?o(i,(function(e){r(e,t)}),s):i.url?mxUtils.get(TEMPLATE_PATH+"/"+i.url,mxUtils.bind(this,(function(e){e.getStatus()>=200&&e.getStatus()<=299?r(e.getText(),t):s()}))):r(e.emptyDiagramXml,t)}if(A=null,"boolean"!=typeof n&&(n=i.isExternal&&m),1==l)d(i.url,i);else if(n)F.className="geTempDlgOpenBtn geTempDlgBtnDisabled geTempDlgBtnBusy",c();else{H.className="geTempDlgCreateBtn geTempDlgBtnDisabled geTempDlgBtnBusy";var u=null==e.mode||e.mode==App.MODE_GOOGLE||e.mode==App.MODE_BROWSER?mxResources.get("diagramName"):mxResources.get("filename"),h=new FilenameDialog(e,e.defaultFilename+".drawio",mxResources.get("ok"),c,u,(function(e){var t=null!=e&&e.length>0;return t&&g?(c(e),!1):t}),null,null,null,a,p?null:[]);e.showDialog(h.container,350,80,!0,!0),h.init()}}}function q(e){H.innerHTML=mxUtils.htmlEntities(mxResources.get(U||e?"create":"copy"));var t=e?"none":"";m&&(F.style.display=t);for(var l=x.querySelectorAll(".geTempDlgLinkToDiagram"),n=0;n<l.length;n++)l[n].style.display=t}function K(t,l,n,i,a){function s(){q(l)}a||(M.innerHTML="",Q(),I=t,L=i);var r=null;if(n){(r=document.createElement("table")).className="geTempDlgDiagramsListGrid";var o=document.createElement("tr"),d=document.createElement("th");d.style.width="50%",d.innerHTML=mxUtils.htmlEntities(mxResources.get("diagram")),o.appendChild(d),(d=document.createElement("th")).style.width="25%",d.innerHTML=mxUtils.htmlEntities(mxResources.get("changedBy")),o.appendChild(d),(d=document.createElement("th")).style.width="25%",d.innerHTML=mxUtils.htmlEntities(mxResources.get("lastModifiedOn")),o.appendChild(d),r.appendChild(o),M.appendChild(r)}for(var c=0;c<t.length;c++){t[c].isExternal=!l;var m=t[c].url,u=mxUtils.htmlEntities(l?mxResources.get(t[c].title,null,t[c].title):t[c].title),p=u||t[c].url,g=t[c].imgUrl,h=mxUtils.htmlEntities(t[c].changedBy||""),x="";if(t[c].lastModifiedOn){var v=e.timeSince(new Date(t[c].lastModifiedOn));null==v&&(v=mxResources.get("lessThanAMinute")),x=mxUtils.htmlEntities(mxResources.get("timeAgo",[v],"{1} ago"))}g||(g=TEMPLATE_PATH+"/"+m.substring(0,m.length-4)+".png");var y=n?50:15;if(null!=u&&u.length>y&&(u=u.substring(0,y)+"…"),n){var b=document.createElement("tr"),f=document.createElement("td");(T=document.createElement("img")).src="/images/icon-search.svg",T.className="geTempDlgDiagramListPreviewBtn",T.setAttribute("title",mxResources.get("preview")),a||f.appendChild(T);var E=document.createElement("span");E.className="geTempDlgDiagramTitle",E.innerHTML=u,f.appendChild(E),b.appendChild(f),(f=document.createElement("td")).innerHTML=h,b.appendChild(f),(f=document.createElement("td")).innerHTML=x,b.appendChild(f),r.appendChild(b),null==w&&(s(),Q(b,"geTempDlgDiagramsListGridActive",t[c])),function(e,t,l){mxEvent.addListener(b,"click",(function(){w!=t&&(s(),Q(t,"geTempDlgDiagramsListGridActive",e))})),mxEvent.addListener(b,"dblclick",J),mxEvent.addListener(T,"click",(function(n){Y(e,t,l,n)}))}(t[c],b,T)}else{var C=document.createElement("div");C.className="geTempDlgDiagramTile",C.setAttribute("title",p),null==w&&(s(),Q(C,"geTempDlgDiagramTileActive",t[c]));var A=document.createElement("div");A.className="geTempDlgDiagramTileImg geTempDlgDiagramTileImgLoading";var D=document.createElement("img");D.style.display="none",function(e,t,l){D.onload=function(){t.className="geTempDlgDiagramTileImg",e.style.display=""},D.onerror=function(){this.src!=l?this.src=l:t.className="geTempDlgDiagramTileImg geTempDlgDiagramTileImgError"}}(D,A,g?g.replace(".drawio.xml","").replace(".drawio","").replace(".xml",""):""),D.src=g,A.appendChild(D),C.appendChild(A);var T,R=document.createElement("div");R.className="geTempDlgDiagramTileLbl",R.innerHTML=null!=u?u:"",C.appendChild(R),(T=document.createElement("img")).src="/images/icon-search.svg",T.className="geTempDlgDiagramPreviewBtn",T.setAttribute("title",mxResources.get("preview")),a||C.appendChild(T),function(e,t,l){mxEvent.addListener(C,"click",(function(){w!=t&&(s(),Q(t,"geTempDlgDiagramTileActive",e))})),mxEvent.addListener(C,"dblclick",J),mxEvent.addListener(T,"click",(function(n){Y(e,t,l,n)}))}(t[c],C,T),M.appendChild(C)}}for(var U in i){var k=i[U];if(k.length>0){var N=document.createElement("div");N.className="geTempDlgImportCat",N.innerHTML=mxResources.get(U,null,U),M.appendChild(N),K(k,l,n,null,!0)}}}function $(e,t){G.innerHTML="",Q();for(var l=Math.floor(G.offsetWidth/150)-1,n=!t&&e.length>l?l:e.length,i=0;i<n;i++){var a=e[i];a.isCategory=!0;var s=document.createElement("div");null==(c=mxResources.get(a.title))&&(c=a.title.substring(0,1).toUpperCase()+a.title.substring(1)),s.className="geTempDlgNewDiagramCatItem",s.setAttribute("title",c),(c=mxUtils.htmlEntities(c)).length>15&&(c=c.substring(0,15)+"…"),null==w&&(q(!0),Q(s,"geTempDlgNewDiagramCatItemActive",a)),(o=document.createElement("div")).className="geTempDlgNewDiagramCatItemImg";var r=document.createElement("img");r.src=NEW_DIAGRAM_CATS_PATH+"/"+a.img,o.appendChild(r),s.appendChild(o),(d=document.createElement("div")).className="geTempDlgNewDiagramCatItemLbl",d.innerHTML=c,s.appendChild(d),G.appendChild(s),function(e,t){mxEvent.addListener(s,"click",(function(){w!=t&&(q(!0),Q(t,"geTempDlgNewDiagramCatItemActive",e))})),mxEvent.addListener(s,"dblclick",J)}(a,s)}(s=document.createElement("div")).className="geTempDlgNewDiagramCatItem";var o,d,c=mxResources.get("showAllTemps");s.setAttribute("title",c),(o=document.createElement("div")).className="geTempDlgNewDiagramCatItemImg",o.innerHTML="...",o.style.fontSize="32px",s.appendChild(o),(d=document.createElement("div")).className="geTempDlgNewDiagramCatItemLbl",d.innerHTML=c,s.appendChild(d),G.appendChild(s),mxEvent.addListener(s,"click",(function(){U=!0;var e=x.querySelector(".geTemplatesList");e.style.display="block",B.style.width="",z.style.display="",z.value="",v=null,function t(){var l=e.querySelector(".geTemplateDrawioCatLink");null!=l?l.click():setTimeout(t,200)}()})),k.style.display=e.length<=l?"none":""}mxEvent.addListener(k,"click",(function(){D?(P.style.height="280px",G.style.height="190px",k.innerHTML=mxUtils.htmlEntities(mxResources.get("showMore")),$(ae)):(P.style.height="440px",G.style.height="355px",k.innerHTML=mxUtils.htmlEntities(mxResources.get("showLess")),$(ae,!0)),D=!D}));var ee=!1,te=!1,le={},ne={},ie={},ae=[],se=0;function re(){mxUtils.get(n,(function(e){if(!ee){ee=!0;for(var t=e.getXml().documentElement.firstChild,l={};null!=t;){if(void 0!==t.getAttribute)if("clibs"==t.nodeName){for(var n=t.getAttribute("name"),i=t.getElementsByTagName("add"),a=[],s=0;s<i.length;s++)a.push(encodeURIComponent(mxUtils.getTextContent(i[s])));null!=n&&a.length>0&&(l[n]=a.join(";"))}else{var r=t.getAttribute("url");if(null!=r){var o=t.getAttribute("section"),d=t.getAttribute("subsection");if(null==o){var c=r.indexOf("/");if(o=r.substring(0,c),null==d){var m=r.indexOf("/",c+1);m>-1&&(d=r.substring(c+1,m))}}var u=le[o];null==u&&(u=[],le[o]=u);var p=t.getAttribute("clibs");null!=l[p]&&(p=l[p]);var g={url:t.getAttribute("url"),libs:t.getAttribute("libs"),title:t.getAttribute("title")||t.getAttribute("name"),preview:t.getAttribute("preview"),clibs:p,tags:t.getAttribute("tags")};if(u.push(g),null!=d){var h=ne[o];null==h&&(h={},ne[o]=h);var v=h[d];null==v&&(v=[],h[d]=v),v.push(g)}}}t=t.nextSibling}!function(e,t,l){var n=x.querySelector(".geTemplatesList");function i(e,t){var l=mxResources.get(e);null==l&&(l=e.substring(0,1).toUpperCase()+e.substring(1));var n=l+" ("+t.length+")",i=l=mxUtils.htmlEntities(l);return l.length>15&&(l=l.substring(0,15)+"…"),{lbl:l+" ("+t.length+")",fullLbl:n,lblOnly:i}}function a(l,n,i,a,s){mxEvent.addListener(i,"click",(function(){E!=i&&(null!=E?(E.style.fontWeight="normal",E.style.textDecoration="none"):(P.style.display="none",O.style.minHeight="100%"),(E=i).style.fontWeight="bold",E.style.textDecoration="underline",B.scrollTop=0,b&&(f=!0),N.innerHTML=n,S.style.display="none",K(s?t[l]:a?ne[l][a]:e[l],!s))}))}if(l>0){var s="font-weight: bold;background: #f9f9f9;padding: 5px 0 5px 0;text-align: center;margin-top: 10px;",r=document.createElement("div");for(var o in r.style.cssText=s,mxUtils.write(r,mxResources.get("custom")),n.appendChild(r),t){var d=document.createElement("div"),c=i(o,t[o]);d.className="geTemplateCatLink",d.setAttribute("title",c.fullLbl),d.innerHTML=c.lbl,n.appendChild(d),a(o,c.lblOnly,d,null,!0)}(r=document.createElement("div")).style.cssText=s,mxUtils.write(r,"draw.io"),n.appendChild(r)}for(var o in e){var m=ne[o],u=d=document.createElement(m?"ul":"div");if(c=i(o,e[o]),null!=m){var p=document.createElement("li"),g=document.createElement("div");g.className="geTempTreeCaret geTemplateCatLink geTemplateDrawioCatLink",g.style.padding="0",g.setAttribute("title",c.fullLbl),g.innerHTML=c.lbl,u=g,p.appendChild(g);var h=document.createElement("ul");for(var v in h.className="geTempTreeNested",h.style.visibility="hidden",m){var y=document.createElement("li"),C=i(v,m[v]);y.setAttribute("title",C.fullLbl),y.innerHTML=C.lbl,y.className="geTemplateCatLink",y.style.padding="0",y.style.margin="0",a(o,C.lblOnly,y,v),h.appendChild(y)}p.appendChild(h),d.className="geTempTree",d.appendChild(p),function(e,t){mxEvent.addListener(t,"click",(function(){for(var l=e.querySelectorAll("li"),n=0;n<l.length;n++)l[n].style.margin="";e.style.visibility="visible",e.classList.toggle("geTempTreeActive"),e.classList.toggle("geTempTreeNested")&&setTimeout((function(){for(var t=0;t<l.length;t++)l[t].style.margin="0";e.style.visibility="hidden"}),250),t.classList.toggle("geTempTreeCaret-down")}))}(h,g)}else d.className="geTemplateCatLink geTemplateDrawioCatLink",d.setAttribute("title",c.fullLbl),d.innerHTML=c.lbl;n.appendChild(d),a(o,c.lblOnly,u)}}(le,ie,se)}}))}null!=c?c((function(e,t){ie=e,se=t,re()}),re):re(),mxUtils.get(i,(function(e){if(!te){te=!0;for(var t=e.getXml().documentElement.firstChild;null!=t;)void 0!==t.getAttribute&&null!=t.getAttribute("title")&&ae.push({img:t.getAttribute("img"),libs:t.getAttribute("libs"),clibs:t.getAttribute("clibs"),title:t.getAttribute("title")}),t=t.nextSibling;$(ae)}}));var oe=function(e,t,l){if(S.style.display="",j.stop(),b=!1,f)f=!1;else if(t)M.innerHTML=t;else{l=l||{};var n=0;for(var i in l)n+=l[i].length;0==e.length&&0==n?M.innerHTML=mxUtils.htmlEntities(mxResources.get("noDiagrams")):K(e,!1,R,0==n?null:l)}};function de(e){s&&(B.scrollTop=0,M.innerHTML="",j.spin(M),f=!1,b=!0,N.innerHTML=mxUtils.htmlEntities(mxResources.get("recentDiag")),v=null,s(oe,(function(){W(mxResources.get("cannotLoad")),oe([])}),e?null:a))}de(T);var ce=null;function me(e){v==e&&T==y||(Z(),B.scrollTop=0,M.innerHTML="",N.innerHTML=mxUtils.htmlEntities(mxResources.get("searchResults"))+' "'+mxUtils.htmlEntities(e)+'"',ce=null,U?function(e){if(""!=e){if(null==TemplatesDialog.tagsList[n]){var t={};for(var l in le)for(var i=le[l],a=0;a<i.length;a++)if(null!=(h=i[a]).tags)for(var s=h.tags.toLowerCase().split(";"),r=0;r<s.length;r++)null==t[s[r]]&&(t[s[r]]=[]),t[s[r]].push(h);TemplatesDialog.tagsList[n]=t}var o=e.toLowerCase().split(" ");if(t=TemplatesDialog.tagsList[n],se>0&&null==t.__tagsList__){for(var l in ie)for(i=ie[l],a=0;a<i.length;a++)for((s=(h=i[a]).title.split(" ")).push(l),r=0;r<s.length;r++){var d=s[r].toLowerCase();null==t[d]&&(t[d]=[]),t[d].push(h)}t.__tagsList__=!0}var c=[],m={},u=0;for(a=0;a<o.length;a++)if(o[a].length>0){var p=t[o[a]],g={};if(c=[],null!=p)for(r=0;r<p.length;r++){var h;0==u==(null==m[(h=p[r]).url])&&(g[h.url]=!0,c.push(h))}m=g,u++}0==c.length?N.innerHTML=mxResources.get("noResultsFor",[e]):K(c,!0)}else null!=C&&(C.click(),C=null)}(e):r&&(e?(j.spin(M),f=!1,b=!0,r(e,oe,(function(){W(mxResources.get("searchFailed")),oe([])}),T?null:a)):de(T)),v=e,y=T)}function ue(e){null!=ce&&clearTimeout(ce),13==e.keyCode?me(z.value):ce=setTimeout((function(){me(z.value)}),1e3)}mxEvent.addListener(z,"keyup",ue),mxEvent.addListener(z,"search",ue),mxEvent.addListener(z,"input",ue),mxEvent.addListener(H,"click",(function(e){J(!1,!1)})),m&&mxEvent.addListener(F,"click",(function(e){J(!1,!0)})),u&&mxEvent.addListener(x.querySelector(".geTempDlgLinkToDiagramBtn"),"click",(function(e){J(!0)})),mxEvent.addListener(x.querySelector(".geTempDlgCancelBtn"),"click",(function(){null!=l&&l(),g||e.hideDialog(!0)}))};TemplatesDialog.tagsList={};var BtnDialog=function(e,t,l,n){var i=document.createElement("div");i.style.textAlign="center";var a=document.createElement("p");a.style.fontSize="16pt",a.style.padding="0px",a.style.margin="0px",a.style.color="gray",mxUtils.write(a,mxResources.get("done"));var s="Unknown",r=document.createElement("img");r.setAttribute("border","0"),r.setAttribute("align","absmiddle"),r.style.marginRight="10px",t==e.drive?(s=mxResources.get("googleDrive"),r.src=IMAGE_PATH+"/google-drive-logo-white.svg"):t==e.dropbox?(s=mxResources.get("dropbox"),r.src=IMAGE_PATH+"/dropbox-logo-white.svg"):t==e.oneDrive?(s=mxResources.get("oneDrive"),r.src=IMAGE_PATH+"/onedrive-logo-white.svg"):t==e.gitHub?(s=mxResources.get("github"),r.src=IMAGE_PATH+"/github-logo-white.svg"):t==e.gitLab?(s=mxResources.get("gitlab"),r.src=IMAGE_PATH+"/gitlab-logo.svg"):t==e.notion?(s=mxResources.get("notion"),r.src=IMAGE_PATH+"/notion-logo.svg"):t==e.trello&&(s=mxResources.get("trello"),r.src=IMAGE_PATH+"/trello-logo-white.svg");var o=document.createElement("p");mxUtils.write(o,mxResources.get("authorizedIn",[s],"You are now authorized in {1}"));var d=mxUtils.button(l,n);d.insertBefore(r,d.firstChild),d.style.marginTop="6px",d.className="geBigButton",d.style.fontSize="18px",d.style.padding="14px",i.appendChild(a),i.appendChild(o),i.appendChild(d),this.container=i},FontDialog=function(e,t,l,n,i){var a,s,r,o=document.createElement("table"),d=document.createElement("tbody");o.style.marginTop="8px",a=document.createElement("tr"),(s=document.createElement("td")).colSpan=2,s.style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.fontWeight="bold";var c=document.createElement("input");c.style.cssText="margin-right:8px;margin-bottom:8px;",c.setAttribute("value","sysfonts"),c.setAttribute("type","radio"),c.setAttribute("name","current-fontdialog"),c.setAttribute("id","fontdialog-sysfonts"),s.appendChild(c),(r=document.createElement("label")).setAttribute("for","fontdialog-sysfonts"),mxUtils.write(r,mxResources.get("sysFonts",null,"System Fonts")),s.appendChild(r),a.appendChild(s),d.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.width="120px",s.style.paddingLeft="15px",mxUtils.write(s,mxResources.get("fontname",null,"Font Name")+":"),a.appendChild(s);var m=document.createElement("input");"s"==n&&m.setAttribute("value",t),m.style.marginLeft="4px",m.style.width="250px",m.className="dlg_fontName_s",(s=document.createElement("td")).appendChild(m),a.appendChild(s),d.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).colSpan=2,s.style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.fontWeight="bold";var u=document.createElement("input");if(u.style.cssText="margin-right:8px;margin-bottom:8px;",u.setAttribute("value","googlefonts"),u.setAttribute("type","radio"),u.setAttribute("name","current-fontdialog"),u.setAttribute("id","fontdialog-googlefonts"),s.appendChild(u),(r=document.createElement("label")).setAttribute("for","fontdialog-googlefonts"),mxUtils.write(r,mxResources.get("googleFonts",null,"Google Fonts")),s.appendChild(r),!mxClient.IS_CHROMEAPP&&(!e.isOffline()||EditorUi.isElectronApp)){var p=e.menus.createHelpLink("https://fonts.google.com/");p.getElementsByTagName("img")[0].setAttribute("valign","middle"),s.appendChild(p)}a.appendChild(s),d.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.width="120px",s.style.paddingLeft="15px",mxUtils.write(s,mxResources.get("fontname",null,"Font Name")+":"),a.appendChild(s);var g=document.createElement("input");"g"==n&&g.setAttribute("value",t),g.style.marginLeft="4px",g.style.width="250px",g.className="dlg_fontName_g",(s=document.createElement("td")).appendChild(g),a.appendChild(s),d.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).colSpan=2,s.style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.fontWeight="bold";var h=document.createElement("input");h.style.cssText="margin-right:8px;margin-bottom:8px;",h.setAttribute("value","webfonts"),h.setAttribute("type","radio"),h.setAttribute("name","current-fontdialog"),h.setAttribute("id","fontdialog-webfonts"),s.appendChild(h),(r=document.createElement("label")).setAttribute("for","fontdialog-webfonts"),mxUtils.write(r,mxResources.get("webfonts",null,"Web Fonts")),s.appendChild(r),a.appendChild(s),Editor.enableWebFonts&&d.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.width="120px",s.style.paddingLeft="15px",mxUtils.write(s,mxResources.get("fontname",null,"Font Name")+":"),a.appendChild(s);var x=document.createElement("input");"w"==n&&(Editor.enableWebFonts?x.setAttribute("value",t):m.setAttribute("value",t)),x.style.marginLeft="4px",x.style.width="250px",x.className="dlg_fontName_w",(s=document.createElement("td")).appendChild(x),a.appendChild(s),Editor.enableWebFonts&&d.appendChild(a),a=document.createElement("tr"),(s=document.createElement("td")).style.whiteSpace="nowrap",s.style.fontSize="10pt",s.style.width="120px",s.style.paddingLeft="15px",mxUtils.write(s,mxResources.get("fontUrl",null,"Font URL")+":"),a.appendChild(s);var v=document.createElement("input");if(v.setAttribute("value",l||""),v.style.marginLeft="4px",v.style.width="250px",v.className="dlg_fontUrl",(s=document.createElement("td")).appendChild(v),a.appendChild(s),Editor.enableWebFonts&&d.appendChild(a),this.init=function(){var e=m;"g"==n?e=g:"w"==n&&Editor.enableWebFonts&&(e=x),e.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?e.select():document.execCommand("selectAll",!1,null)},a=document.createElement("tr"),(s=document.createElement("td")).colSpan=2,s.style.paddingTop="20px",s.style.whiteSpace="nowrap",s.setAttribute("align","right"),!e.isOffline()){var y=mxUtils.button(mxResources.get("help"),(function(){e.openLink("https://www.diagrams.net/blog/external-fonts")}));y.className="geBtn",s.appendChild(y)}var b=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog(),i()}));b.className="geBtn",e.editor.cancelFirst&&s.appendChild(b);var f=mxUtils.button(mxResources.get("apply"),(function(){var t,l,n;c.checked?(t=m.value,n="s"):u.checked?(t=g.value,l=Editor.GOOGLE_FONTS+encodeURIComponent(t).replace(/%20/g,"+"),n="g"):h.checked&&(t=x.value,l=v.value,n="w"),function(e,t,l){return null==e||0==e.length?(o.querySelector(".dlg_fontName_"+l).style.border="1px solid red",!1):!("w"==l&&!/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(t)&&(o.querySelector(".dlg_fontUrl").style.border="1px solid red",1))}(t,l,n)&&(i(t,l,n),e.hideDialog())}));function E(e){this.style.border="",13==e.keyCode&&f.click()}f.className="geBtn gePrimaryBtn",mxEvent.addListener(m,"keypress",E),mxEvent.addListener(g,"keypress",E),mxEvent.addListener(x,"keypress",E),mxEvent.addListener(v,"keypress",E),mxEvent.addListener(m,"focus",(function(){c.setAttribute("checked","checked"),c.checked=!0})),mxEvent.addListener(g,"focus",(function(){u.setAttribute("checked","checked"),u.checked=!0})),mxEvent.addListener(x,"focus",(function(){h.setAttribute("checked","checked"),h.checked=!0})),mxEvent.addListener(v,"focus",(function(){h.setAttribute("checked","checked"),h.checked=!0})),s.appendChild(f),e.editor.cancelFirst||s.appendChild(b),a.appendChild(s),d.appendChild(a),o.appendChild(d),this.container=o};function AspectDialog(e,t,l,n,i){this.aspect={pageId:t||(e.pages?e.pages[0].getId():null),layerIds:l||[]};var a=document.createElement("div"),s=document.createElement("h5");s.style.margin="0 0 10px",mxUtils.write(s,mxResources.get("pages")),a.appendChild(s);var r=document.createElement("div");r.className="geAspectDlgList",a.appendChild(r),(s=document.createElement("h5")).style.margin="0 0 10px",mxUtils.write(s,mxResources.get("layers")),a.appendChild(s);var o=document.createElement("div");o.className="geAspectDlgList",a.appendChild(o),this.pagesContainer=r,this.layersContainer=o,this.ui=e;var d=document.createElement("div");d.style.marginTop="16px",d.style.textAlign="center";var c=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog(),null!=i&&i()}));c.className="geBtn",e.editor.cancelFirst&&d.appendChild(c);var m=mxUtils.button(mxResources.get("ok"),mxUtils.bind(this,(function(){e.hideDialog(),n({pageId:this.selectedPage,layerIds:Object.keys(this.selectedLayers)})})));d.appendChild(m),m.className="geBtn gePrimaryBtn",e.editor.cancelFirst||d.appendChild(c),m.setAttribute("disabled","disabled"),this.okBtn=m,a.appendChild(d),this.container=a}AspectDialog.prototype.init=function(){var e=this.ui.getFileData(!0);if(this.ui.pages)for(var t=0;t<this.ui.pages.length;t++){var l=this.ui.updatePageRoot(this.ui.pages[t]);this.createPageItem(l.getId(),l.getName(),l.node)}else this.createPageItem("1","Page-1",mxUtils.parseXml(e).documentElement)},AspectDialog.prototype.createViewer=function(e,t,l,n){mxEvent.disableContextMenu(e),e.style.userSelect="none";var i=new Graph(e);i.setTooltips(!1),i.setEnabled(!1),i.setPanning(!1),i.minFitScale=null,i.maxFitScale=null,i.centerZoom=!0;var a="mxGraphModel"==t.nodeName?t:Editor.parseDiagramNode(t);if(null!=a){var s=a.getAttribute("background");null!=s&&""!=s&&s!=mxConstants.NONE||(s=null!=n?n:"#ffffff"),e.style.backgroundColor=s;var r=new mxCodec(a.ownerDocument),o=i.getModel();r.decode(a,o);for(var d=o.getChildCount(o.root),c=null==l,m=0;m<d;m++){var u=o.getChildAt(o.root,m);o.setVisible(u,c||l==u.id)}i.maxFitScale=1,i.fit(0),i.center()}return i},AspectDialog.prototype.createPageItem=function(e,t,l){var n=document.createElement("div");n.className="geAspectDlgListItem",n.setAttribute("data-page-id",e),n.innerHTML='<div style="max-width: 100%; max-height: 100%;"></div><div class="geAspectDlgListItemText">'+mxUtils.htmlEntities(t)+"</div>",this.pagesContainer.appendChild(n);var i=this.createViewer(n.childNodes[0],l),a=mxUtils.bind(this,(function(){null!=this.selectedItem&&(this.selectedItem.className="geAspectDlgListItem"),this.selectedItem=n,this.selectedPage=e,n.className+=" geAspectDlgListItemSelected",this.layersContainer.innerHTML="",this.selectedLayers={},this.okBtn.setAttribute("disabled","disabled");for(var t=i.model,a=t.getChildCells(t.getRoot()),s=0;s<a.length;s++)this.createLayerItem(a[s],e,i,l)}));mxEvent.addListener(n,"click",a),this.aspect.pageId==e&&a()},AspectDialog.prototype.createLayerItem=function(e,t,l,n){var i=l.convertValueToString(e)||mxResources.get("background")||"Background",a=document.createElement("div");a.setAttribute("data-layer-id",e.id),a.className="geAspectDlgListItem",a.innerHTML='<div style="max-width: 100%; max-height: 100%;"></div><div class="geAspectDlgListItemText">'+mxUtils.htmlEntities(i)+"</div>",this.layersContainer.appendChild(a),this.createViewer(a.childNodes[0],n,e.id);var s=mxUtils.bind(this,(function(){a.className.indexOf("geAspectDlgListItemSelected")>=0?(a.className="geAspectDlgListItem",delete this.selectedLayers[e.id],0==Object.keys(this.selectedLayers).length&&this.okBtn.setAttribute("disabled","disabled")):(a.className+=" geAspectDlgListItemSelected",this.selectedLayers[e.id]=!0,this.okBtn.removeAttribute("disabled"))}));mxEvent.addListener(a,"click",s),-1!=this.aspect.layerIds.indexOf(e.id)&&s()};var FilePropertiesDialog=function(e){var t,l,n=document.createElement("table"),i=document.createElement("tbody");n.style.width="100%",n.style.marginTop="8px";var a=e.getCurrentFile(),s=null!=a&&null!=a.getTitle()?a.getTitle():e.defaultFilename,r=null;if(/(\.png)$/i.test(s)){var o=1,d=0,c=e.fileNode;null!=c&&(c.hasAttribute("scale")&&(o=parseFloat(c.getAttribute("scale"))),c.hasAttribute("border")&&(d=parseInt(c.getAttribute("border")))),t=document.createElement("tr"),(l=document.createElement("td")).style.whiteSpace="nowrap",l.style.fontSize="10pt",l.style.width="120px",mxUtils.write(l,mxResources.get("zoom")+":"),t.appendChild(l);var m=document.createElement("input");m.setAttribute("value",100*o+"%"),m.style.marginLeft="4px",m.style.width="180px",(l=document.createElement("td")).style.whiteSpace="nowrap",l.appendChild(m),t.appendChild(l),i.appendChild(t),t=document.createElement("tr"),(l=document.createElement("td")).style.whiteSpace="nowrap",l.style.fontSize="10pt",l.style.width="120px",mxUtils.write(l,mxResources.get("borderWidth")+":"),t.appendChild(l);var u=document.createElement("input");u.setAttribute("value",d),u.style.marginLeft="4px",u.style.width="180px",(l=document.createElement("td")).style.whiteSpace="nowrap",l.appendChild(u),t.appendChild(l),i.appendChild(t),this.init=function(){m.focus(),mxClient.IS_GC||mxClient.IS_FF||document.documentMode>=5?m.select():document.execCommand("selectAll",!1,null)},r=function(){null!=e.fileNode&&(e.fileNode.setAttribute("scale",Math.max(0,parseInt(m.value)/100)),e.fileNode.setAttribute("border",Math.max(0,parseInt(u.value))),null!=a&&a.fileChanged()),e.hideDialog()}}else{var p=null!=a?a.isCompressed():Editor.compressXml;t=document.createElement("tr"),(l=document.createElement("td")).style.whiteSpace="nowrap",l.style.fontSize="10pt",l.style.width="120px",mxUtils.write(l,mxResources.get("compressed")+":"),t.appendChild(l);var g=document.createElement("input");g.setAttribute("type","checkbox"),p&&(g.setAttribute("checked","checked"),g.defaultChecked=!0),(l=document.createElement("td")).style.whiteSpace="nowrap",l.appendChild(g),t.appendChild(l),i.appendChild(t),this.init=function(){g.focus()},r=function(){null!=e.fileNode&&(e.fileNode.setAttribute("compressed",g.checked?"true":"false"),null!=a&&a.fileChanged()),e.hideDialog()}}var h=mxUtils.button(mxResources.get("apply"),r);h.className="geBtn gePrimaryBtn",t=document.createElement("tr"),(l=document.createElement("td")).colSpan=2,l.style.paddingTop="20px",l.style.whiteSpace="nowrap",l.setAttribute("align","right");var x=mxUtils.button(mxResources.get("cancel"),(function(){e.hideDialog()}));x.className="geBtn",e.editor.cancelFirst&&l.appendChild(x),l.appendChild(h),e.editor.cancelFirst||l.appendChild(x),t.appendChild(l),i.appendChild(t),n.appendChild(i),this.container=n};