parent
13a93e7d69
commit
ae7f8f03a0
11 changed files with 545 additions and 511 deletions
|
@ -1,3 +1,7 @@
|
|||
02-AUG-2017: 6.9.9
|
||||
|
||||
- Fixes paste from Lucidchart
|
||||
|
||||
31-JUL-2017: 6.9.8
|
||||
|
||||
- Gliffy import improvements
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
6.9.8
|
||||
6.9.9
|
|
@ -112,7 +112,24 @@ public class GliffyObject implements PostDeserializable
|
|||
*/
|
||||
|
||||
GROUP_SHAPES.add("com.gliffy.shape.basic.basic_v1.default.group");
|
||||
|
||||
GROUP_SHAPES.add("com.gliffy.shape.erd.erd_v1.default.entity_with_attributes");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.erd.erd_v1.default.entity_with_multiple_attributes");
|
||||
// GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.frame");//
|
||||
// GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.interaction_use");//
|
||||
// GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.opt_combined_fragment");//
|
||||
// GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.loop_combined_fragment");//
|
||||
// GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.sequence.alt_combined_fragment");//
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.class.object");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.class.enumeration");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.class.interface");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.class.class2");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.class.class");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.class.data_type");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.state_machine.composite_state");
|
||||
GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.state_machine.orthoganal_state");
|
||||
//GROUP_SHAPES.add("com.gliffy.shape.uml.uml_v2.use_case.frame");//???
|
||||
//GROUP_SHAPES.add("");
|
||||
|
||||
MINDMAP_SHAPES.add("com.gliffy.shape.mindmap.mindmap_v1.default.main_topic");
|
||||
MINDMAP_SHAPES.add("com.gliffy.shape.mindmap.mindmap_v1.default.subtopic");
|
||||
MINDMAP_SHAPES.add("com.gliffy.shape.mindmap.mindmap_v1.default.child_node");
|
||||
|
@ -294,7 +311,7 @@ public class GliffyObject implements PostDeserializable
|
|||
*/
|
||||
public boolean isSubRoutine()
|
||||
{
|
||||
return uid.equals("com.gliffy.shape.flowchart.flowchart_v1.default.subroutine");
|
||||
return "com.gliffy.shape.flowchart.flowchart_v1.default.subroutine".equals(uid);
|
||||
}
|
||||
|
||||
public boolean isUnrecognizedGraphicType()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CACHE MANIFEST
|
||||
|
||||
# THIS FILE WAS GENERATED. DO NOT MODIFY!
|
||||
# 07/31/2017 01:07 PM
|
||||
# 08/02/2017 07:37 AM
|
||||
|
||||
app.html
|
||||
index.html?offline=1
|
||||
|
|
235
war/js/app.min.js
vendored
235
war/js/app.min.js
vendored
|
@ -6158,7 +6158,7 @@ L=document.createElement("tr"),N=L.cloneNode(!0),Q=document.createElement("td"),
|
|||
mxResources.get("fitToSheetsAcross"));W.appendChild(l);mxUtils.write(P,mxResources.get("fitToBy"));var R=O.cloneNode(!0);Y.appendChild(R);mxEvent.addListener(O,"focus",function(){K.checked=!0});mxEvent.addListener(R,"focus",function(){K.checked=!0});l=document.createElement("span");mxUtils.write(l,mxResources.get("fitToSheetsDown"));U.appendChild(l);L.appendChild(Q);L.appendChild(J);L.appendChild(W);N.appendChild(P);N.appendChild(Y);N.appendChild(U);T.appendChild(L);T.appendChild(N);p.appendChild(T);
|
||||
m.appendChild(p);h.appendChild(m);m=document.createElement("div");l=document.createElement("div");l.style.fontWeight="bold";l.style.marginBottom="12px";mxUtils.write(l,mxResources.get("paperSize"));m.appendChild(l);l=document.createElement("div");l.style.marginBottom="12px";var V=PageSetupDialog.addPageFormatPanel(l,"printdialog",a.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);m.appendChild(l);l=document.createElement("span");mxUtils.write(l,mxResources.get("pageScale"));m.appendChild(l);
|
||||
var S=document.createElement("input");S.style.cssText="margin:0 8px 0 8px;";S.setAttribute("value","100 %");S.style.width="60px";m.appendChild(S);h.appendChild(m);l=document.createElement("div");l.style.cssText="text-align:right;margin:62px 0 0 0;";m=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});m.className="geBtn";a.editor.cancelFirst&&l.appendChild(m);a.isOffline()||(p=mxUtils.button(mxResources.get("help"),function(){window.open("https://desk.draw.io/support/solutions/articles/16000048947")}),
|
||||
p.className="geBtn",l.appendChild(p));PrintDialog.previewEnabled&&(p=mxUtils.button(mxResources.get("preview"),function(){a.hideDialog();d(!1)}),p.className="geBtn",l.appendChild(p));p=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();d(!0)});p.className="geBtn gePrimaryBtn";l.appendChild(p);a.editor.cancelFirst||l.appendChild(m);h.appendChild(l);this.container=h}})();(function(){EditorUi.VERSION="6.9.8";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
|
||||
p.className="geBtn",l.appendChild(p));PrintDialog.previewEnabled&&(p=mxUtils.button(mxResources.get("preview"),function(){a.hideDialog();d(!1)}),p.className="geBtn",l.appendChild(p));p=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();d(!0)});p.className="geBtn gePrimaryBtn";l.appendChild(p);a.editor.cancelFirst||l.appendChild(m);h.appendChild(l);this.container=h}})();(function(){EditorUi.VERSION="6.9.9";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
|
||||
36;EditorUi.prototype.defaultCustomShapeStyle="shape=stencil(tZRtTsQgEEBPw1+DJR7AoN6DbWftpAgE0Ortd/jYRGq72R+YNE2YgTePloEJGWblgA18ZuKFDcMj5/Sm8boZq+BgjCX4pTyqk6ZlKROitwusOMXKQDODx5iy4pXxZ5qTHiFHawxB0JrQZH7lCabQ0Fr+XWC1/E8zcsT/gAi+Subo2/3Mh6d/oJb5nU1b5tW7r2knautaa3T+U32o7f7vZwpJkaNDLORJjcu7t59m2jXxqX9un+tt022acsfmoKaQZ+vhhswZtS6Ne/ThQGt0IV0N3Yyv6P3CeT9/tHO0XFI5cAE=);whiteSpace=wrap;html=1;";EditorUi.prototype.maxBackgroundSize=1600;EditorUi.prototype.maxImageSize=520;EditorUi.prototype.resampleThreshold=
|
||||
1E5;EditorUi.prototype.maxImageBytes=1E6;EditorUi.prototype.maxBackgroundBytes=25E5;EditorUi.prototype.currentFile=null;EditorUi.prototype.printPdfExport=!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;(function(){EditorUi.prototype.useCanvasForExport=!1;EditorUi.prototype.jpgSupported=!1;try{var a=document.createElement("canvas"),b=new Image;b.onload=function(){try{a.getContext("2d").drawImage(b,0,0);var c=a.toDataURL("image/png");EditorUi.prototype.useCanvasForExport=
|
||||
null!=c&&6<c.length}catch(n){}};b.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1px" height="1px" version="1.1"><foreignObject pointer-events="all" width="1" height="1"><div xmlns="http://www.w3.org/1999/xhtml"></div></foreignObject></svg>')))}catch(m){}try{a=document.createElement("canvas");a.width=a.height=1;var c=a.toDataURL("image/jpeg");EditorUi.prototype.jpgSupported=null!==c.match("image/jpeg")}catch(m){}})();
|
||||
|
@ -6291,122 +6291,123 @@ function(){b()});else{var c=new Image;c.onload=function(){var a=document.createE
|
|||
l.getElementsByTagName("diagram");if(1==k.length)l=mxUtils.parseXml(h.decompress(mxUtils.getTextContent(k[0]))).documentElement;else if(1<k.length){h.model.beginUpdate();try{for(var m=0;m<k.length;m++){var n=this.updatePageRoot(new DiagramPage(k[m])),y=this.pages.length;null==n.getName()&&n.setName(mxResources.get("pageWithNumber",[y+1]));h.model.execute(new ChangePage(this,n,n,y))}}finally{h.model.endUpdate()}}}if(null!=l&&"mxGraphModel"===l.nodeName){var D=new mxGraphModel;(new mxCodec(l.ownerDocument)).decode(l,
|
||||
D);var E=D.getChildCount(D.getRoot());h.model.getChildCount(h.model.getRoot());h.model.beginUpdate();try{a={};for(m=0;m<E;m++){var z=D.getChildAt(D.getRoot(),m);if(1!=E||h.isCellLocked(h.getDefaultParent()))z=h.importCells([z],0,0,h.model.getRoot(),null,a)[0],B=h.model.getChildren(z),h.moveCells(B,b,c),e=e.concat(B);else var B=D.getChildren(z),e=e.concat(h.importCells(B,b,c,h.getDefaultParent(),null,a))}if(d){h.isGridEnabled()&&(b=h.snap(b),c=h.snap(c));var A=h.getBoundingBoxFromGeometry(e,!0);null!=
|
||||
A&&h.moveCells(e,b-A.x,c-A.y)}}finally{h.model.endUpdate()}}}}catch(F){throw f||this.handleError(F,mxResources.get("invalidOrMissingFile")),F;}return e};EditorUi.prototype.importLucidChart=function(a,b,c,d,f){var e=mxUtils.bind(this,function(){if(this.pasteLucidChart)try{this.insertLucidChart(a,b,c,d,f)}catch(p){this.handleError(p)}finally{null!=f&&f()}});this.pasteLucidChart||this.loadingExtensions||this.isOffline()?window.setTimeout(e,0):(this.loadingExtensions=!0,"1"==urlParams.dev?mxscript("/js/diagramly/Extensions.js",
|
||||
e):mxscript("/js/extensions.min.js",e))};EditorUi.prototype.insertLucidChart=function(a,b,c,d,f){f=JSON.parse(JSON.parse(a).state);a=[];for(var e in f.Pages)a.push(f.Pages[e]);a.sort(function(a,b){return a.Properties.Order<b.Properties.Order?-1:a.Properties.Order>b.Properties.Order?1:0});if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,c,d),null!=this.pages){var h=this.currentPage;for(b=1;b<a.length;b++)this.insertPage(),this.pasteLucidChart(a[b]);this.selectPage(h)}}finally{this.editor.graph.getModel().endUpdate()}}};
|
||||
EditorUi.prototype.insertTextAt=function(a,b,c,d,f,g,k){g=null!=g?g:!0;k=null!=k?k:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,b,c,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(f||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var e=
|
||||
this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var h=this.extractGraphModelFromPng(a),l=this.importXml(h,b,c,g,!0);if(0<l.length)return l}if("data:image/svg+xml;"==a.substring(0,19))try{if(h=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(h=a.substring(a.indexOf(",")+1),h=window.atob&&!mxClient.IS_SF?atob(h):Base64.decode(h,!0)):h=decodeURIComponent(a.substring(a.indexOf(",")+1)),l=this.importXml(h,b,c,g,!0),0<l.length)return l}catch(x){}this.loadImage(a,mxUtils.bind(this,
|
||||
function(d){if("data:"==a.substring(0,5))this.resizeImage(d,a,mxUtils.bind(this,function(a,d,h){e.setSelectionCell(e.insertVertex(null,null,"",e.snap(b),e.snap(c),d,h,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),k,this.maxImageSize);else{var h=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/d.height)),f=Math.round(d.width*h);d=Math.round(d.height*h);e.setSelectionCell(e.insertVertex(null,
|
||||
null,"",e.snap(b),e.snap(c),f,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var h=null;e.getModel().beginUpdate();try{h=e.insertVertex(e.getDefaultParent(),null,a,e.snap(b),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.updateCellSize(h),e.fireEvent(new mxEventObject("textInserted","cells",[h]))}finally{e.getModel().endUpdate()}e.setSelectionCell(h)}))}else{a=this.editor.graph.zapGremlins(mxUtils.trim(a));
|
||||
if(this.isCompatibleString(a))return this.importXml(a,b,c,g);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,c,g);else{e=this.editor.graph;f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,"",e.snap(b),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.fireEvent(new mxEventObject("textInserted","cells",[f])),f.value=a,e.updateCellSize(f),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(f.value)&&
|
||||
e.setLinkForCell(f,f.value),f.geometry.width+=e.gridSize,f.geometry.height+=e.gridSize}finally{e.getModel().endUpdate()}return[f]}}return[]};EditorUi.prototype.formatFileSize=function(a){var b=-1;do a/=1024,b++;while(1024<a);return Math.max(a,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[b]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var b=a.indexOf(";");0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1)))}return a};EditorUi.prototype.isRemoteFileFormat=
|
||||
function(a,b){return/(\.*<graphml xmlns=\".*)/.test(a)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)||null!=b&&/(\.vsdx)($|\?)/i.test(b)||null!=b&&/(\.vssx)($|\?)/i.test(b)};EditorUi.prototype.importFile=function(a,b,c,d,f,g,k,q,v,u,x){u=null!=u?u:!0;var e=!1,h=null;"image"==b.substring(0,5)?(v=!1,"image/png"==b.substring(0,9)&&(b=x?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(h=this.importXml(b,c,d,u),v=!0)),v||(h=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,
|
||||
b)+a.substring(a.indexOf(",",b+1))),u&&h.isGridEnabled()&&(c=h.snap(c),d=h.snap(d)),h=[h.insertVertex(null,null,"",c,d,f,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,k)?(e=!0,this.parseFile(null!=v?v:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){if(4==a.readyState){var b=null;200<=a.status&&299>=a.status&&
|
||||
(a=a.responseText,null!=a&&"<mxlibrary"==a.substring(0,10)?(null!=k&&".vssx"==k.toLowerCase().substring(k.length-5)&&(k=k.substring(0,k.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,a,k))):b=this.importXml(a,c,d,u));null!=q&&q(b)}}),k)):/(\.vsd)($|\?)/i.test(k)||(h=this.insertTextAt(this.validateFileData(a),c,d,!0,null,u));e||null==q||q(h);return h};EditorUi.prototype.base64Encode=function(a){for(var b="",c=0,d=a.length,e,f,g;c<d;){e=a.charCodeAt(c++)&255;if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);b+="==";break}f=a.charCodeAt(c++);if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2);b+="=";break}g=a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2|(g&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g&63)}return b};EditorUi.prototype.importFiles=function(a,b,c,d,f,g,k,q,v,u,x,w){b=null!=b?b:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;u=null!=u?u:this.maxImageBytes;var e=null!=b&&null!=c,h=!0,l=!1;if(!mxClient.IS_CHROMEAPP&&
|
||||
null!=a)for(var m=x||this.resampleThreshold,n=0;n<a.length;n++)if("image/"==a[n].type.substring(0,6)&&a[n].size>m){l=!0;break}var p=mxUtils.bind(this,function(){var l=this.editor.graph,m=l.gridSize;f=null!=f?f:mxUtils.bind(this,function(a,b,c,d,f,h,g,l,k){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,g)),null):this.importFile(a,b,c,d,f,h,g,l,k,e,w)});g=null!=g?g:mxUtils.bind(this,function(a){l.setSelectionCells(a)});if(this.spinner.spin(document.body,
|
||||
mxResources.get("loading")))for(var n=a.length,v=n,p=[],t=mxUtils.bind(this,function(a,b){p[a]=b;if(0==--v){this.spinner.stop();if(null!=q)q(p);else{var c=[];l.getModel().beginUpdate();try{for(var d=0;d<p.length;d++){var e=p[d]();null!=e&&(c=c.concat(e))}}finally{l.getModel().endUpdate()}}g(c)}}),B=0;B<n;B++)mxUtils.bind(this,function(e){var g=a[e],l=new FileReader;l.onload=mxUtils.bind(this,function(a){if(null==k||k(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var l=
|
||||
a.target.result,n=l.indexOf(","),v=atob(l.substring(n+1)),p=mxUtils.parseXml(v),v=p.getElementsByTagName("svg");if(0<v.length){var v=v[0],q=w?null:v.getAttribute("content");null!=q&&"<"!=q.charAt(0)&&"%"!=q.charAt(0)&&(q=unescape(window.atob?atob(q):Base64.decode(q,!0)));null!=q&&"%"==q.charAt(0)&&(q=decodeURIComponent(q));null==q||"<mxfile "!==q.substring(0,8)&&"<mxGraphModel "!==q.substring(0,14)?t(e,mxUtils.bind(this,function(){try{if(l.substring(0,n+1),null!=p){var a=p.getElementsByTagName("svg");
|
||||
if(0<a.length){var h=a[0],k=parseFloat(h.getAttribute("width")),u=parseFloat(h.getAttribute("height")),v=h.getAttribute("viewBox");if(null==v||0==v.length)h.setAttribute("viewBox","0 0 "+k+" "+u);else if(isNaN(k)||isNaN(u)){var x=v.split(" ");3<x.length&&(k=parseFloat(x[2]),u=parseFloat(x[3]))}l=this.createSvgDataUri(mxUtils.getXml(a[0]));var t=Math.min(1,Math.min(d/Math.max(1,k)),d/Math.max(1,u));return f(l,g.type,b+e*m,c+e*m,Math.max(1,Math.round(k*t)),Math.max(1,Math.round(u*t)),g.name)}}}catch(Z){}return null})):
|
||||
t(e,mxUtils.bind(this,function(){return f(q,"text/xml",b+e*m,c+e*m,0,0,g.name)}))}}else{v=!1;if("image/png"==g.type){var B=w?null:this.extractGraphModelFromPng(a.target.result);if(null!=B&&0<B.length){var y=new Image;y.src=a.target.result;t(e,mxUtils.bind(this,function(){return f(B,"text/xml",b+e*m,c+e*m,y.width,y.height,g.name)}));v=!0}}v||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,
|
||||
function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(l){this.resizeImage(l,a.target.result,mxUtils.bind(this,function(l,k,n){t(e,mxUtils.bind(this,function(){if(null!=l&&l.length<u){var v=h&&this.isResampleImage(a.target.result,x)?Math.min(1,Math.min(d/k,d/n)):1;return f(l,g.type,b+e*m,c+e*m,Math.round(k*v),Math.round(n*v),g.name)}this.handleError({message:mxResources.get("imageTooBig")});
|
||||
return null}))}),h,d,x)})))}else f(a.target.result,g.type,b+e*m,c+e*m,240,160,g.name,function(a){t(e,function(){return a})})});/(\.vsdx)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?f(null,g.type,b+e*m,c+e*m,240,160,g.name,function(a){t(e,function(){return a})},g):"image"==g.type.substring(0,5)?l.readAsDataURL(g):l.readAsText(g)})(B)});l?this.confirmImageResize(function(a){h=a;p()},v):p()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?
|
||||
this.spinner.pause():function(){},d=function(b,d){mxSettings.setResizeImages(b?d:null);mxSettings.save();c();a(d)},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null;null==e||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){d(a,!0)},function(a){d(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||
|
||||
mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):d(!1,e)};EditorUi.prototype.parseFile=function(a,b,c){c=null!=c?c:a.name;var d=new FormData;d.append("format","xml");d.append("upfile",a,c);var e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(d)};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,c,d,f,g){f=null!=f?f:this.maxImageSize;
|
||||
var e=Math.max(1,a.width),h=Math.max(1,a.height);if(d&&this.isResampleImage(b,g))try{var l=Math.max(e/f,h/f);if(1<l){var k=Math.round(e/l),m=Math.round(h/l),n=document.createElement("canvas");n.width=k;n.height=m;n.getContext("2d").drawImage(a,0,0,k,m);var t=n.toDataURL();if(t.length<b.length){var D=document.createElement("canvas");D.width=k;D.height=m;var E=D.toDataURL();t!==E&&(b=t,e=k,h=m)}}}catch(z){}c(b,e,h)};EditorUi.prototype.crcTable=[];for(var b=0;256>b;b++)for(var c=b,d=0;8>d;d++)c=1==(c&
|
||||
1)?3988292384^c>>>1:c>>>1,EditorUi.prototype.crcTable[b]=c;EditorUi.prototype.updateCRC=function(a,b,c,d){for(var e=0;e<d;e++)a=EditorUi.prototype.crcTable[(a^b[c+e])&255]^a>>>8;return a};EditorUi.prototype.writeGraphModelToPng=function(a,b,c,d,f){function e(a,b){var c=l;l+=b;return a.substring(c,l)}function h(a){a=e(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+
|
||||
1);a=window.atob?atob(a):Base64.decode(a,!0);var l=0;if(e(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=f&&f();else if(e(a,4),"IHDR"!=e(a,4))null!=f&&f();else{e(a,17);f=a.substring(0,l);do{var k=h(a);if("IDAT"==e(a,4)){f=a.substring(0,l-8);c=c+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,b,0,4);d=this.updateCRC(d,c,0,c.length);f+=g(c.length)+b+c+g(d^4294967295);f+=a.substring(l-8,a.length);break}f+=a.substring(l-8,l-4+
|
||||
k);d=e(a,k);e(a,4)}while(k);return"data:image/png;base64,"+(window.btoa?btoa(f):Base64.encode(f,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g,
|
||||
" "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(n){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,c){var d=new Image;d.onload=function(){b(d)};null!=c&&(d.onerror=c);d.src=a};var f=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a){var c=a.indexOf(",");
|
||||
0<c&&(a=b.getPageById(a.substring(c+1)))&&b.selectPage(a)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,c=this.editor.graph,d=c.addClickHandler;c.addClickHandler=function(b,e,f){var h=e;e=function(b,d){if(null==d){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(d=e.getAttribute("href"))}null!=d&&c.isPageLink(d)&&(a(d),mxEvent.consume(b));null!=h&&h(b,d)};d.call(this,b,e,f)};f.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(c.view.canvas.ownerSVGElement,
|
||||
null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var g=c.getGlobalVariable;c.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:g.apply(this,arguments)};var k=c.createLinkForHint;c.createLinkForHint=function(d,e){var f=
|
||||
c.isPageLink(d);if(f){var h=d.indexOf(",");0<h&&(h=b.getPageById(d.substring(h+1)),e=null!=h?h.getName():mxResources.get("pageNotFound"))}h=k.apply(this,arguments);f&&mxEvent.addListener(h,"click",function(b){a(d);mxEvent.consume(b)});return h};var p=c.labelLinkClicked;c.labelLinkClicked=function(b,d,e){var f=d.getAttribute("href");c.isPageLink(f)?(a(f),mxEvent.consume(e)):p.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=
|
||||
null!=c.getTitle()?c.getTitle():a);return a};var q=this.actions.get("print");q.setEnabled(!mxClient.IS_IOS||!navigator.standalone);q.visible=q.isEnabled();if(!this.editor.chromeless){var v=function(){window.setTimeout(function(){u.innerHTML=" ";u.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,
|
||||
!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||c.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.originalEvent.clipboardData,d=!1,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var h=f[index];if("file"===h.kind){if(b.isEditing())this.importFiles([h.getAsFile()],
|
||||
0,0,this.maxImageSize,function(a,c,d,e,f,h){b.insertImage(a,f,h)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var g=this.editor.graph.getInsertPoint();this.importFiles([h.getAsFile()],g.x,g.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(K){}}),!1);var u=document.createElement("div");u.style.position="absolute";u.style.whiteSpace="nowrap";u.style.overflow="hidden";u.style.display="block";u.contentEditable=!0;mxUtils.setOpacity(u,
|
||||
0);u.style.width="1px";u.style.height="1px";u.innerHTML=" ";var x=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(a){var b=mxEvent.getSource(a);null==c.container||!c.isEnabled()||c.isMouseDown||c.isEditing()||null!=this.dialog||"INPUT"==b.nodeName||"TEXTAREA"==b.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||
|
||||
x||(u.style.left=c.container.scrollLeft+10+"px",u.style.top=c.container.scrollTop+10+"px",c.container.appendChild(u),x=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){u.focus();document.execCommand("selectAll",!1,null)},0):(u.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var b=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!x||224!=b&&17!=b&&91!=b||(x=!1,c.isEditing()||null!=this.dialog||null==c.container||c.container.focus(),
|
||||
u.parentNode.removeChild(u))}),0)}));mxEvent.addListener(u,"copy",mxUtils.bind(this,function(a){c.isEnabled()&&(mxClipboard.copy(c),this.copyCells(u),v())}));mxEvent.addListener(u,"cut",mxUtils.bind(this,function(a){c.isEnabled()&&(this.copyCells(u,!0),v())}));mxEvent.addListener(u,"paste",mxUtils.bind(this,function(a){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&(u.innerHTML=" ",u.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,u);u.innerHTML=" "}),0))}),
|
||||
!0);var w=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==u?!0:w.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),
|
||||
d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,e,f,h){b.insertImage(a,f,h)},function(){},function(a){return"image/"==
|
||||
a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",
|
||||
!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){q=document.createElement("div");q.style.position="absolute";q.style.top="95px";q.style.left="250px";
|
||||
q.style.width="2000px";q.style.height="30px";q.style.background="whiteSmoke";document.body.appendChild(q);var y=document.createElement("div");y.style.position="absolute";y.style.top="125px";y.style.left="220px";y.style.width="30px";y.style.height="1000px";y.style.background="whiteSmoke";document.body.appendChild(y);var D=document.createElement("div");D.style.position="absolute";D.style.top="95px";D.style.left="220px";D.style.width="30px";D.style.height="30px";D.style.background="whiteSmoke";document.body.appendChild(D);
|
||||
this.vRuler=new mxRuler(this.editor.graph,y,!0);this.hRuler=new mxRuler(this.editor.graph,q,!1)}if("1"==urlParams.test){q=document.getElementById("geFooter");null!=q&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,
|
||||
"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),q.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility=
|
||||
"hidden"})));var E=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:E.apply(this,arguments)}}q=document.getElementById("geInfo");null!=q&&q.parentNode.removeChild(q);if(Graph.fileSupport){var z=null;mxEvent.addListener(c.container,"dragleave",function(a){c.isEnabled()&&(null!=z&&(z.parentNode.removeChild(z),z=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(c.container,"dragover",mxUtils.bind(this,function(a){null==z&&(!mxClient.IS_IE||
|
||||
10<document.documentMode)&&(z=this.highlightElement(c.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(c.container,"drop",mxUtils.bind(this,function(a){null!=z&&(z.parentNode.removeChild(z),z=null);if(c.isEnabled()){var b=mxUtils.convertPoint(c.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),d=c.view.translate,e=c.view.scale,f=b.x/e-d.x,h=b.y/e-d.y;mxEvent.isAltDown(a)&&(h=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,
|
||||
f,h,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var g=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,b=this.extractGraphModelFromEvent(a,null!=this.pages);if(null!=b)c.setSelectionCells(this.importXml(b,f,h,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var l=a.dataTransfer.getData("text/html"),b=document.createElement("div");b.innerHTML=l;var k=null,d=b.getElementsByTagName("img");
|
||||
null!=d&&1==d.length?(l=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)||(k=!0)):(b=b.getElementsByTagName("a"),null!=b&&1==b.length&&(l=b[0].getAttribute("href")));var m=!0,n=mxUtils.bind(this,function(){c.setSelectionCells(this.insertTextAt(l,f,h,!0,k,null,m))});k&&l.length>this.resampleThreshold?this.confirmImageResize(function(a){m=a;n()},mxEvent.isControlDown(a)):n()}else null!=g&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)?this.loadImage(decodeURIComponent(g),mxUtils.bind(this,
|
||||
function(a){var b=Math.max(1,a.width);a=Math.max(1,a.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,b)),d/Math.max(1,a));c.setSelectionCell(c.insertVertex(null,null,"",f,h,b*d,a*d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+g+";"))}),mxUtils.bind(this,function(a){c.setSelectionCells(this.insertTextAt(g,f,h,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&c.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),
|
||||
f,h,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged",
|
||||
"keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());
|
||||
mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,
|
||||
function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=
|
||||
function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=e,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=
|
||||
c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.insertLucidChart(JSON.parse(d)),mxEvent.consume(a))}else{var d=this.editor.graph,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):b.textContent),f=!1;try{var h=e.lastIndexOf("%3E");0<=h&&h<e.length-3&&(e=e.substring(0,h+3))}catch(v){}try{var c=b.getElementsByTagName("span"),g=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):
|
||||
decodeURIComponent(e);this.isCompatibleString(g)&&(f=!0,e=g)}catch(v){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=
|
||||
this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(v){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||
|
||||
10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,
|
||||
!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):
|
||||
0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash=
|
||||
"#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;var f=document.documentElement;d=(e.clientWidth||f.clientWidth)-3;e=Math.max(e.clientHeight||0,f.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,
|
||||
e=a.clientHeight;f=document.createElement("div");f.style.zIndex=mxPopupMenu.prototype.zIndex+2;f.style.border="3px dotted rgb(254, 137, 12)";f.style.pointerEvents="none";f.style.position="absolute";f.style.top=b+"px";f.style.left=c+"px";f.style.width=Math.max(0,d-3)+"px";f.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(f):document.body.appendChild(f);return f};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);
|
||||
var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var d=c.target.result,e=a.name;if(null!=
|
||||
e&&0<e.length)if(/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml",this.parseFile(a,mxUtils.bind(this,function(a){if(4==a.readyState)if(this.spinner.stop(),200<=a.status&&299>=a.status)if(a=a.responseText,"<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,b);null!=e&&".vssx"==e.toLowerCase().substring(e.length-5)&&(e=e.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(u){this.handleError(u,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b);else this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,
|
||||
e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(v){this.handleError(v,mxResources.get("errorLoadingFile"))}}else"image/png"==
|
||||
a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=function(a,b,c){var d=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var d=
|
||||
mxUtils.parseXml(a);null!=d&&(this.editor.setGraphXml(d.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,c))});null!=a&&0<a.length&&(null!=d&&d.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):e())};
|
||||
EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],c;for(c in a)b.push(c);return b};EditorUi.prototype.addBasenamesForCell=function(a,b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);
|
||||
c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=
|
||||
a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,b,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.showLayersDialog()):
|
||||
(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};
|
||||
EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=null,f=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):
|
||||
this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,f);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){function h(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=this.editor.graph.decompress(a)))}catch(I){}return a}var k=f.data;
|
||||
if("json"==urlParams.proto){try{k=JSON.parse(k)}catch(G){k=null}if(null==k)return;if("dialog"==k.action){this.showError(null!=k.titleKey?mxResources.get(k.titleKey):k.title,null!=k.messageKey?mxResources.get(k.messageKey):k.message,null!=k.buttonKey?mxResources.get(k.buttonKey):k.button);null!=k.modified&&(this.editor.modified=k.modified);return}if("prompt"==k.action){this.spinner.stop();var l=new FilenameDialog(this,k.defaultValue||"",null!=k.okKey?mxResources.get(k.okKey):null,function(a){null!=
|
||||
a&&g.postMessage(JSON.stringify({event:"prompt",value:a,message:k}),"*")},null!=k.titleKey?mxResources.get(k.titleKey):k.title);this.showDialog(l.container,300,80,!0,!1);l.init();return}if("draft"==k.action){l=null;l="data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):h(k.xml);this.spinner.stop();l=new DraftDialog(this,mxResources.get("draftFound",[k.name||this.defaultFilename]),l,mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",
|
||||
result:"edit",message:k}),"*")}),mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"discard",message:k}),"*")}),k.editKey?mxResources.get(k.editKey):null,k.discardKey?mxResources.get(k.discardKey):null);this.showDialog(l.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{l.init()}catch(G){g.postMessage(JSON.stringify({event:"draft",error:G.toString(),message:k}),"*")}return}if("template"==k.action){this.spinner.stop();
|
||||
l=new NewDialog(this,!1,null!=k.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=k.callback?g.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(l.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));l.init();return}if("status"==k.action){null!=k.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(k.messageKey))):
|
||||
null!=k.message&&this.editor.setStatus(mxUtils.htmlEntities(k.message));null!=k.modified&&(this.editor.modified=k.modified);return}if("spinner"==k.action){var m=null!=k.messageKey?mxResources.get(k.messageKey):k.message;null==k.show||k.show?this.spinner.spin(document.body,m):this.spinner.stop();return}if("export"==k.action){if("png"==k.format||"xmlpng"==k.format){if(null==k.spin&&null==k.spinKey||this.spinner.spin(document.body,null!=k.spinKey?mxResources.get(k.spinKey):k.spin)){var n=null!=k.xml?
|
||||
k.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var p=this.editor.graph,q=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=k.format;b.xml=encodeURIComponent(n);b.data=a;g.postMessage(JSON.stringify(b),"*")}),t=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==k.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(n))));p!=this.editor.graph&&p.container.parentNode.removeChild(p.container);
|
||||
q(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var p=this.createTemporaryGraph(p.getStylesheet()),B=p.getGlobalVariable,A=this.pages[0];p.getGlobalVariable=function(a){return"page"==a?A.getName():"pagenumber"==a?1:B.apply(this,arguments)};document.body.appendChild(p.container);p.model.setRoot(A.root)}this.exportToCanvas(mxUtils.bind(this,function(a){t(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){t(null)}),null,null,null,null,null,
|
||||
null,p)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==k.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(n)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?q("data:image/png;base64,"+a.getText()):t(null)}),mxUtils.bind(this,function(){t(null)}))}}else{null!=k.xml&&0<k.xml.length&&this.setFileData(k.xml);m=this.createLoadMessage("export");if("html2"==k.format||"html"==k.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))l=
|
||||
this.getXmlFileData(),m.xml=mxUtils.getXml(l),m.data=this.getFileData(null,null,!0,null,null,null,l),m.format=k.format;else if("html"==k.format)n=this.editor.getGraphXml(),m.data=this.getHtml(n,this.editor.graph),m.xml=mxUtils.getXml(n),m.format=k.format;else{mxSvgCanvas2D.prototype.foAltText=null;l=this.editor.graph.background;l==mxConstants.NONE&&(l=null);m.xml=this.getFileData(!0);m.format="svg";if(k.embedImages||null==k.embedImages){if(null==k.spin&&null==k.spinKey||this.spinner.spin(document.body,
|
||||
null!=k.spinKey?mxResources.get(k.spinKey):k.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==k.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(a);g.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(l),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(a));g.postMessage(JSON.stringify(m),
|
||||
"*")}));return}l="xmlsvg"==k.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(l));m.data=this.createSvgDataUri(l)}g.postMessage(JSON.stringify(m),"*")}return}if("load"==k.action)d=1==k.autosave,this.hideDialog(),null!=k.modified&&null==urlParams.modified&&(urlParams.modified=k.modified),null!=k.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=k.saveAndExit),null!=k.title&&null!=this.buttonContainer&&(l=document.createElement("span"),
|
||||
mxUtils.write(l,k.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),this.buttonContainer.appendChild(l)),k=null!=k.xmlpng?this.extractGraphModelFromPng(k.xmlpng):null!=k.xml&&"data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):k.xml;else{g.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(k)}),
|
||||
"*");return}}k=h(k);c=!0;try{a(k,f)}catch(G){this.handleError(G)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var F=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=F();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=F();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,
|
||||
b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&
|
||||
"json"!=urlParams.proto||g.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var g=window.opener||window.parent,f="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";g.postMessage(f,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=
|
||||
document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");b.className="geBigButton";b.style.fontSize="12px";b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));a.appendChild(b);"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),
|
||||
b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,
|
||||
function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,
|
||||
640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a){try{var b=a.split("\n"),c=[];if(0<b.length){var d={},e=null,f=null,g="auto",k="auto",v=40,u=40,x=0,w=this.editor.graph;w.getGraphBounds();for(var y=function(){w.setSelectionCells(O);w.scrollCellToVisible(w.getSelectionCell())},D=w.getFreeInsertPoint(),E=D.x,z=D.y,D=z,B=null,A="auto",F=[],G=null,I=null,C=0;C<b.length&&"#"==b[C].charAt(0);){a=b[C];for(C++;C<b.length&&"\\"==a.charAt(a.length-1)&&"#"==b[C].charAt(0);)a=
|
||||
a.substring(0,a.length-1)+mxUtils.trim(b[C].substring(1)),C++;if("#"!=a.charAt(1)){var M=a.indexOf(":");if(0<M){var H=mxUtils.trim(a.substring(1,M)),K=mxUtils.trim(a.substring(M+1));"label"==H?B=w.sanitizeHtml(K):"style"==H?e=K:"identity"==H&&0<K.length&&"-"!=K?f=K:"width"==H?g=K:"height"==H?k=K:"ignore"==H?I=K.split(","):"connect"==H?F.push(JSON.parse(K)):"link"==H?G=K:"padding"==H?x=parseFloat(K):"edgespacing"==H?v=parseFloat(K):"nodespacing"==H?u=parseFloat(K):"layout"==H&&(A=K)}}}var T=this.editor.csvToArray(b[C]);
|
||||
a=null;if(null!=f)for(var L=0;L<T.length;L++)if(f==T[L]){a=L;break}null==B&&(B="%"+T[0]+"%");if(null!=F)for(var N=0;N<F.length;N++)null==d[F[N].to]&&(d[F[N].to]={});w.model.beginUpdate();try{for(L=C+1;L<b.length;L++){var Q=this.editor.csvToArray(b[L]);if(Q.length==T.length){var J=null,W=null!=a?Q[a]:null;null!=W&&(J=w.model.getCell(W));null==J&&(J=new mxCell(B,new mxGeometry(E,D,0,0),e||"whiteSpace=wrap;html=1;"),J.vertex=!0,J.id=W);for(var P=0;P<Q.length;P++)w.setAttributeForCell(J,T[P],Q[P]);w.setAttributeForCell(J,
|
||||
"placeholders","1");J.style=w.replacePlaceholders(J,J.style);for(N=0;N<F.length;N++)d[F[N].to][J.getAttribute(F[N].to)]=J;null!=G&&"link"!=G&&(w.setLinkForCell(J,J.getAttribute(G)),w.setAttributeForCell(J,G,null));var Y=this.editor.graph.getPreferredSizeForCell(J);J.geometry.width="auto"==g?Y.width+x:parseFloat(g);J.geometry.height="auto"==k?Y.height+x:parseFloat(k);D+=J.geometry.height+u;c.push(w.addCell(J))}}null==e&&w.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var U=c.slice(),
|
||||
O=c.slice(),N=0;N<F.length;N++)for(var R=F[N],L=0;L<c.length;L++){var J=c[L],V=J.getAttribute(R.from);if(null!=V){w.setAttributeForCell(J,R.from,null);for(var S=V.split(","),P=0;P<S.length;P++){var X=d[R.to][S[P]];null!=X&&(O.push(w.insertEdge(null,null,R.label||"",R.invert?X:J,R.invert?J:X,R.style||w.createCurrentEdgeStyle())),mxUtils.remove(R.invert?J:X,U))}}}if(null!=I)for(L=0;L<c.length;L++)for(J=c[L],P=0;P<I.length;P++)w.setAttributeForCell(J,mxUtils.trim(I[P]),null);var ba=new mxParallelEdgeLayout(w);
|
||||
ba.spacing=v;var ea=function(){ba.execute(w.getDefaultParent());for(var a=0;a<c.length;a++){var b=w.getCellGeometry(c[a]);b.x=Math.round(w.snap(b.x));b.y=Math.round(w.snap(b.y));"auto"==g&&(b.width=Math.round(w.snap(b.width)));"auto"==k&&(b.height=Math.round(w.snap(b.height)))}};if("circle"==A){var ca=new mxCircleLayout(w);ca.resetEdges=!1;var fa=ca.isVertexIgnored;ca.isVertexIgnored=function(a){return fa.apply(this,arguments)||0>mxUtils.indexOf(c,a)};this.executeLayout(function(){ca.execute(w.getDefaultParent());
|
||||
ea()},!0,y);y=null}else if("horizontaltree"==A||"verticaltree"==A||"auto"==A&&O.length==2*c.length-1&&1==U.length){w.view.validate();var Z=new mxCompactTreeLayout(w,"horizontaltree"==A);Z.levelDistance=u;Z.edgeRouting=!1;Z.resetEdges=!1;this.executeLayout(function(){Z.execute(w.getDefaultParent(),0<U.length?U[0]:null)},!0,y);y=null}else if("horizontalflow"==A||"verticalflow"==A||"auto"==A&&1==U.length){w.view.validate();var da=new mxHierarchicalLayout(w,"horizontalflow"==A?mxConstants.DIRECTION_WEST:
|
||||
mxConstants.DIRECTION_NORTH);da.intraCellSpacing=u;da.disableEdgeStyle=!1;this.executeLayout(function(){da.execute(w.getDefaultParent(),O);w.moveCells(O,E,z)},!0,y);y=null}else if("organic"==A||"auto"==A&&O.length>c.length){w.view.validate();var aa=new mxFastOrganicLayout(w);aa.forceConstant=3*u;aa.resetEdges=!1;var ga=aa.isVertexIgnored;aa.isVertexIgnored=function(a){return ga.apply(this,arguments)||0>mxUtils.indexOf(c,a)};ba=new mxParallelEdgeLayout(w);ba.spacing=v;this.executeLayout(function(){aa.execute(w.getDefaultParent());
|
||||
ea()},!0,y);y=null}this.hideDialog()}finally{w.model.endUpdate()}null!=y&&y()}}catch(ha){this.handleError(ha)}};EditorUi.prototype.getSearch=function(a){var b="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;
|
||||
if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,c){a=new LinkDialog(this,a,b,c,!0);this.showDialog(a.container,420,120,!0,!0);a.init()};var g=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=
|
||||
g.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-
|
||||
2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/a,8/a)};var f=b.init;b.init=function(){f.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};
|
||||
this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=e.pageFormat;f.background=e.background;f.pageVisible=e.pageVisible;f.background=e.background;var g=mxUtils.getCurrentStyle(e.container);f.container.style.backgroundColor=g.backgroundColor;null!=e.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=e.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,
|
||||
!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a){var b=0;null==this.drive&&"function"!==typeof window.DriveClient||b++;null==this.dropbox&&"function"!==typeof window.DropboxClient||b++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||b++;null!=this.gitHub&&b++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&b++;mxClient.IS_IOS||b++;return b};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();
|
||||
var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);var c=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!c);this.actions.get("print").setEnabled(!c);this.menus.get("exportAs").setEnabled(!c);this.menus.get("embed").setEnabled(!c);c="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(c);
|
||||
this.menus.get("newLibrary").setEnabled(c);this.menus.get("extras").setEnabled(c);a="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&a.isEditable();this.actions.get("image").setEnabled(b);this.actions.get("zoomIn").setEnabled(b);this.actions.get("zoomOut").setEnabled(b);this.actions.get("resetView").setEnabled(b);this.menus.get("edit").setEnabled(b);this.menus.get("view").setEnabled(b);this.menus.get("importFrom").setEnabled(a);this.menus.get("arrange").setEnabled(a);null!=this.toolbar&&
|
||||
(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(a),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(a));if(this.isOfflineApp()){var d=applicationCache;if(null!=d&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color=
|
||||
"#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML="";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var a=this.offlineStatus.getElementsByTagName("img");null!=a&&0<a.length&&this.alert(a[0].getAttribute("title"))}));var d=window.applicationCache,f=null,b=mxUtils.bind(this,function(){var a=d.status,b;a==d.CHECKING&&
|
||||
(a=d.DOWNLOADING);switch(a){case d.UNCACHED:b="";break;case d.IDLE:b='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';break;case d.DOWNLOADING:b='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case d.UPDATEREADY:b='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case d.OBSOLETE:b='<img title="Obsolete" border="0" src="'+IMAGE_PATH+
|
||||
'/clear.gif"/>';break;default:b='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}a!=f&&(this.offlineStatus.innerHTML=b,f=a)});mxEvent.addListener(d,"checking",b);mxEvent.addListener(d,"noupdate",b);mxEvent.addListener(d,"downloading",b);mxEvent.addListener(d,"progress",b);mxEvent.addListener(d,"cached",b);mxEvent.addListener(d,"updateready",b);mxEvent.addListener(d,"obsolete",b);mxEvent.addListener(d,"error",b);b()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=
|
||||
function(){};EditorUi.prototype.updateUserElement=function(){};var k=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){k.apply(this,arguments);var a=this.editor.graph,b=this.getCurrentFile(),c=null!=b&&b.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(c);this.actions.get("autosave").setEnabled(null!=b&&b.isEditable()&&b.isAutosaveOptional());this.actions.get("guides").setEnabled(c);this.actions.get("shadowVisible").setEnabled(c);
|
||||
this.actions.get("connectionArrows").setEnabled(c);this.actions.get("connectionPoints").setEnabled(c);this.actions.get("copyStyle").setEnabled(c&&!a.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(c&&!a.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(a.getModel().isVertex(a.getSelectionCell()));this.actions.get("createShape").setEnabled(c);this.actions.get("createRevision").setEnabled(c);this.actions.get("moveToFolder").setEnabled(null!=b);this.actions.get("makeCopy").setEnabled(null!=
|
||||
b&&!b.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.actions.get("publishLink").setEnabled(null!=b&&!b.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.menus.get("publish").setEnabled(null!=b&&!b.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(c&&null!=a&&null!=a.shape&&
|
||||
null!=a.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=function(a,b,c,d,f,g){var e=a.editor.graph;if("xml"==c)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==c)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(e.getSvg(d,f,g)),"image/svg+xml");else{var h=a.getFileData(!0,null,null,null,null,!0),k=e.getGraphBounds(),l=Math.floor(k.width*f/e.view.scale),m=Math.floor(k.height*
|
||||
f/e.view.scale);h.length<=MAX_REQUEST_SIZE&&l*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,c,function(a,b){return new mxXmlRequest(EXPORT_URL,"format="+c+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=d?d:"none")+"&w="+l+"&h="+m+"&border="+g+"&xml="+encodeURIComponent(h))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
e):mxscript("/js/extensions.min.js",e))};EditorUi.prototype.insertLucidChart=function(a,b,c,d,f){f=JSON.parse(a);a=[];if(null!=f.state){f=JSON.parse(f.state);for(var e in f.Pages)a.push(f.Pages[e]);a.sort(function(a,b){return a.Properties.Order<b.Properties.Order?-1:a.Properties.Order>b.Properties.Order?1:0})}else a.push(f);if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,c,d),null!=this.pages){var h=this.currentPage;for(b=1;b<a.length;b++)this.insertPage(),
|
||||
this.pasteLucidChart(a[b]);this.selectPage(h)}}finally{this.editor.graph.getModel().endUpdate()}}};EditorUi.prototype.insertTextAt=function(a,b,c,d,f,g,k){g=null!=g?g:!0;k=null!=k?k:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,
|
||||
b,c,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(f||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var e=this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var h=this.extractGraphModelFromPng(a),l=this.importXml(h,b,c,g,!0);if(0<l.length)return l}if("data:image/svg+xml;"==a.substring(0,19))try{if(h=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(h=a.substring(a.indexOf(",")+1),h=window.atob&&!mxClient.IS_SF?atob(h):Base64.decode(h,!0)):h=decodeURIComponent(a.substring(a.indexOf(",")+
|
||||
1)),l=this.importXml(h,b,c,g,!0),0<l.length)return l}catch(x){}this.loadImage(a,mxUtils.bind(this,function(d){if("data:"==a.substring(0,5))this.resizeImage(d,a,mxUtils.bind(this,function(a,d,h){e.setSelectionCell(e.insertVertex(null,null,"",e.snap(b),e.snap(c),d,h,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),k,this.maxImageSize);else{var h=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/
|
||||
d.height)),f=Math.round(d.width*h);d=Math.round(d.height*h);e.setSelectionCell(e.insertVertex(null,null,"",e.snap(b),e.snap(c),f,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var h=null;e.getModel().beginUpdate();try{h=e.insertVertex(e.getDefaultParent(),null,a,e.snap(b),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.updateCellSize(h),e.fireEvent(new mxEventObject("textInserted","cells",
|
||||
[h]))}finally{e.getModel().endUpdate()}e.setSelectionCell(h)}))}else{a=this.editor.graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,c,g);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,c,g);else{e=this.editor.graph;f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,"",e.snap(b),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.fireEvent(new mxEventObject("textInserted","cells",[f])),f.value=
|
||||
a,e.updateCellSize(f),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(f.value)&&e.setLinkForCell(f,f.value),f.geometry.width+=e.gridSize,f.geometry.height+=e.gridSize}finally{e.getModel().endUpdate()}return[f]}}return[]};EditorUi.prototype.formatFileSize=function(a){var b=-1;do a/=1024,b++;while(1024<a);return Math.max(a,.1).toFixed(1)+
|
||||
" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[b]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var b=a.indexOf(";");0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1)))}return a};EditorUi.prototype.isRemoteFileFormat=function(a,b){return/(\.*<graphml xmlns=\".*)/.test(a)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)||null!=b&&/(\.vsdx)($|\?)/i.test(b)||null!=b&&/(\.vssx)($|\?)/i.test(b)};EditorUi.prototype.importFile=function(a,b,c,d,f,g,k,q,v,u,x){u=
|
||||
null!=u?u:!0;var e=!1,h=null;"image"==b.substring(0,5)?(v=!1,"image/png"==b.substring(0,9)&&(b=x?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(h=this.importXml(b,c,d,u),v=!0)),v||(h=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),u&&h.isGridEnabled()&&(c=h.snap(c),d=h.snap(d)),h=[h.insertVertex(null,null,"",c,d,f,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+
|
||||
";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,k)?(e=!0,this.parseFile(null!=v?v:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){if(4==a.readyState){var b=null;200<=a.status&&299>=a.status&&(a=a.responseText,null!=a&&"<mxlibrary"==a.substring(0,10)?(null!=k&&".vssx"==k.toLowerCase().substring(k.length-5)&&(k=k.substring(0,k.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,a,k))):b=this.importXml(a,c,d,u));null!=q&&q(b)}}),k)):
|
||||
/(\.vsd)($|\?)/i.test(k)||(h=this.insertTextAt(this.validateFileData(a),c,d,!0,null,u));e||null==q||q(h);return h};EditorUi.prototype.base64Encode=function(a){for(var b="",c=0,d=a.length,e,f,g;c<d;){e=a.charCodeAt(c++)&255;if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);b+="==";break}f=a.charCodeAt(c++);if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2);b+="=";break}g=a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2|(g&192)>>6);
|
||||
b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g&63)}return b};EditorUi.prototype.importFiles=function(a,b,c,d,f,g,k,q,v,u,x,w){b=null!=b?b:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;u=null!=u?u:this.maxImageBytes;var e=null!=b&&null!=c,h=!0,l=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var m=x||this.resampleThreshold,n=0;n<a.length;n++)if("image/"==a[n].type.substring(0,6)&&a[n].size>m){l=!0;break}var p=mxUtils.bind(this,function(){var l=this.editor.graph,m=l.gridSize;
|
||||
f=null!=f?f:mxUtils.bind(this,function(a,b,c,d,f,h,g,l,k){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,g)),null):this.importFile(a,b,c,d,f,h,g,l,k,e,w)});g=null!=g?g:mxUtils.bind(this,function(a){l.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var n=a.length,v=n,p=[],t=mxUtils.bind(this,function(a,b){p[a]=b;if(0==--v){this.spinner.stop();if(null!=q)q(p);else{var c=[];l.getModel().beginUpdate();
|
||||
try{for(var d=0;d<p.length;d++){var e=p[d]();null!=e&&(c=c.concat(e))}}finally{l.getModel().endUpdate()}}g(c)}}),B=0;B<n;B++)mxUtils.bind(this,function(e){var g=a[e],l=new FileReader;l.onload=mxUtils.bind(this,function(a){if(null==k||k(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var l=a.target.result,n=l.indexOf(","),v=atob(l.substring(n+1)),p=mxUtils.parseXml(v),v=p.getElementsByTagName("svg");if(0<v.length){var v=v[0],q=w?null:v.getAttribute("content");null!=q&&
|
||||
"<"!=q.charAt(0)&&"%"!=q.charAt(0)&&(q=unescape(window.atob?atob(q):Base64.decode(q,!0)));null!=q&&"%"==q.charAt(0)&&(q=decodeURIComponent(q));null==q||"<mxfile "!==q.substring(0,8)&&"<mxGraphModel "!==q.substring(0,14)?t(e,mxUtils.bind(this,function(){try{if(l.substring(0,n+1),null!=p){var a=p.getElementsByTagName("svg");if(0<a.length){var h=a[0],k=parseFloat(h.getAttribute("width")),u=parseFloat(h.getAttribute("height")),v=h.getAttribute("viewBox");if(null==v||0==v.length)h.setAttribute("viewBox",
|
||||
"0 0 "+k+" "+u);else if(isNaN(k)||isNaN(u)){var x=v.split(" ");3<x.length&&(k=parseFloat(x[2]),u=parseFloat(x[3]))}l=this.createSvgDataUri(mxUtils.getXml(a[0]));var t=Math.min(1,Math.min(d/Math.max(1,k)),d/Math.max(1,u));return f(l,g.type,b+e*m,c+e*m,Math.max(1,Math.round(k*t)),Math.max(1,Math.round(u*t)),g.name)}}}catch(Z){}return null})):t(e,mxUtils.bind(this,function(){return f(q,"text/xml",b+e*m,c+e*m,0,0,g.name)}))}}else{v=!1;if("image/png"==g.type){var B=w?null:this.extractGraphModelFromPng(a.target.result);
|
||||
if(null!=B&&0<B.length){var y=new Image;y.src=a.target.result;t(e,mxUtils.bind(this,function(){return f(B,"text/xml",b+e*m,c+e*m,y.width,y.height,g.name)}));v=!0}}v||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(l){this.resizeImage(l,
|
||||
a.target.result,mxUtils.bind(this,function(l,k,n){t(e,mxUtils.bind(this,function(){if(null!=l&&l.length<u){var v=h&&this.isResampleImage(a.target.result,x)?Math.min(1,Math.min(d/k,d/n)):1;return f(l,g.type,b+e*m,c+e*m,Math.round(k*v),Math.round(n*v),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),h,d,x)})))}else f(a.target.result,g.type,b+e*m,c+e*m,240,160,g.name,function(a){t(e,function(){return a})})});/(\.vsdx)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?
|
||||
f(null,g.type,b+e*m,c+e*m,240,160,g.name,function(a){t(e,function(){return a})},g):"image"==g.type.substring(0,5)?l.readAsDataURL(g):l.readAsText(g)})(B)});l?this.confirmImageResize(function(a){h=a;p()},v):p()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},d=function(b,d){mxSettings.setResizeImages(b?d:null);mxSettings.save();c();a(d)},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():
|
||||
null;null==e||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){d(a,!0)},function(a){d(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):d(!1,e)};EditorUi.prototype.parseFile=function(a,b,c){c=null!=c?c:a.name;var d=new FormData;
|
||||
d.append("format","xml");d.append("upfile",a,c);var e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(d)};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,c,d,f,g){f=null!=f?f:this.maxImageSize;var e=Math.max(1,a.width),h=Math.max(1,a.height);if(d&&this.isResampleImage(b,g))try{var l=Math.max(e/f,h/f);if(1<l){var k=Math.round(e/l),m=Math.round(h/l),n=document.createElement("canvas");
|
||||
n.width=k;n.height=m;n.getContext("2d").drawImage(a,0,0,k,m);var t=n.toDataURL();if(t.length<b.length){var D=document.createElement("canvas");D.width=k;D.height=m;var E=D.toDataURL();t!==E&&(b=t,e=k,h=m)}}}catch(z){}c(b,e,h)};EditorUi.prototype.crcTable=[];for(var b=0;256>b;b++)for(var c=b,d=0;8>d;d++)c=1==(c&1)?3988292384^c>>>1:c>>>1,EditorUi.prototype.crcTable[b]=c;EditorUi.prototype.updateCRC=function(a,b,c,d){for(var e=0;e<d;e++)a=EditorUi.prototype.crcTable[(a^b[c+e])&255]^a>>>8;return a};EditorUi.prototype.writeGraphModelToPng=
|
||||
function(a,b,c,d,f){function e(a,b){var c=l;l+=b;return a.substring(c,l)}function h(a){a=e(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+1);a=window.atob?atob(a):Base64.decode(a,!0);var l=0;if(e(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=f&&f();else if(e(a,4),"IHDR"!=e(a,4))null!=f&&f();else{e(a,17);f=a.substring(0,
|
||||
l);do{var k=h(a);if("IDAT"==e(a,4)){f=a.substring(0,l-8);c=c+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,b,0,4);d=this.updateCRC(d,c,0,c.length);f+=g(c.length)+b+c+g(d^4294967295);f+=a.substring(l-8,a.length);break}f+=a.substring(l-8,l-4+k);d=e(a,k);e(a,4)}while(k);return"data:image/png;base64,"+(window.btoa?btoa(f):Base64.encode(f,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=
|
||||
window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g," "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(n){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));
|
||||
null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,c){var d=new Image;d.onload=function(){b(d)};null!=c&&(d.onerror=c);d.src=a};var f=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a){var c=a.indexOf(",");0<c&&(a=b.getPageById(a.substring(c+1)))&&b.selectPage(a)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,c=this.editor.graph,d=c.addClickHandler;c.addClickHandler=function(b,
|
||||
e,f){var h=e;e=function(b,d){if(null==d){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(d=e.getAttribute("href"))}null!=d&&c.isPageLink(d)&&(a(d),mxEvent.consume(b));null!=h&&h(b,d)};d.call(this,b,e,f)};f.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(c.view.canvas.ownerSVGElement,null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");
|
||||
var g=c.getGlobalVariable;c.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:g.apply(this,arguments)};var k=c.createLinkForHint;c.createLinkForHint=function(d,e){var f=c.isPageLink(d);if(f){var h=d.indexOf(",");0<h&&(h=b.getPageById(d.substring(h+1)),e=null!=h?h.getName():mxResources.get("pageNotFound"))}h=k.apply(this,arguments);f&&mxEvent.addListener(h,"click",
|
||||
function(b){a(d);mxEvent.consume(b)});return h};var p=c.labelLinkClicked;c.labelLinkClicked=function(b,d,e){var f=d.getAttribute("href");c.isPageLink(f)?(a(f),mxEvent.consume(e)):p.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=null!=c.getTitle()?c.getTitle():a);return a};var q=this.actions.get("print");q.setEnabled(!mxClient.IS_IOS||!navigator.standalone);q.visible=q.isEnabled();if(!this.editor.chromeless){var v=function(){window.setTimeout(function(){u.innerHTML=
|
||||
" ";u.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||c.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=
|
||||
this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.originalEvent.clipboardData,d=!1,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var h=f[index];if("file"===h.kind){if(b.isEditing())this.importFiles([h.getAsFile()],0,0,this.maxImageSize,function(a,c,d,e,f,h){b.insertImage(a,f,h)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var g=this.editor.graph.getInsertPoint();
|
||||
this.importFiles([h.getAsFile()],g.x,g.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(K){}}),!1);var u=document.createElement("div");u.style.position="absolute";u.style.whiteSpace="nowrap";u.style.overflow="hidden";u.style.display="block";u.contentEditable=!0;mxUtils.setOpacity(u,0);u.style.width="1px";u.style.height="1px";u.innerHTML=" ";var x=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,
|
||||
"keydown",mxUtils.bind(this,function(a){var b=mxEvent.getSource(a);null==c.container||!c.isEnabled()||c.isMouseDown||c.isEditing()||null!=this.dialog||"INPUT"==b.nodeName||"TEXTAREA"==b.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||x||(u.style.left=c.container.scrollLeft+10+"px",u.style.top=c.container.scrollTop+10+"px",c.container.appendChild(u),x=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){u.focus();document.execCommand("selectAll",!1,null)},
|
||||
0):(u.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var b=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!x||224!=b&&17!=b&&91!=b||(x=!1,c.isEditing()||null!=this.dialog||null==c.container||c.container.focus(),u.parentNode.removeChild(u))}),0)}));mxEvent.addListener(u,"copy",mxUtils.bind(this,function(a){c.isEnabled()&&(mxClipboard.copy(c),this.copyCells(u),v())}));mxEvent.addListener(u,"cut",mxUtils.bind(this,function(a){c.isEnabled()&&
|
||||
(this.copyCells(u,!0),v())}));mxEvent.addListener(u,"paste",mxUtils.bind(this,function(a){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&(u.innerHTML=" ",u.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,u);u.innerHTML=" "}),0))}),!0);var w=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==u?!0:w.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||
|
||||
0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();
|
||||
a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,e,f,h){b.insertImage(a,f,h)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");
|
||||
/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,
|
||||
"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){q=document.createElement("div");q.style.position="absolute";q.style.top="95px";q.style.left="250px";q.style.width="2000px";q.style.height="30px";q.style.background="whiteSmoke";document.body.appendChild(q);var y=document.createElement("div");y.style.position="absolute";y.style.top="125px";y.style.left="220px";
|
||||
y.style.width="30px";y.style.height="1000px";y.style.background="whiteSmoke";document.body.appendChild(y);var D=document.createElement("div");D.style.position="absolute";D.style.top="95px";D.style.left="220px";D.style.width="30px";D.style.height="30px";D.style.background="whiteSmoke";document.body.appendChild(D);this.vRuler=new mxRuler(this.editor.graph,y,!0);this.hRuler=new mxRuler(this.editor.graph,q,!1)}if("1"==urlParams.test){q=document.getElementById("geFooter");null!=q&&(this.styleInput=document.createElement("input"),
|
||||
this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),q.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,
|
||||
mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var E=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:E.apply(this,arguments)}}q=document.getElementById("geInfo");null!=q&&q.parentNode.removeChild(q);if(Graph.fileSupport){var z=
|
||||
null;mxEvent.addListener(c.container,"dragleave",function(a){c.isEnabled()&&(null!=z&&(z.parentNode.removeChild(z),z=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(c.container,"dragover",mxUtils.bind(this,function(a){null==z&&(!mxClient.IS_IE||10<document.documentMode)&&(z=this.highlightElement(c.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(c.container,"drop",mxUtils.bind(this,function(a){null!=z&&(z.parentNode.removeChild(z),
|
||||
z=null);if(c.isEnabled()){var b=mxUtils.convertPoint(c.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),d=c.view.translate,e=c.view.scale,f=b.x/e-d.x,h=b.y/e-d.y;mxEvent.isAltDown(a)&&(h=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,f,h,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var g=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,b=this.extractGraphModelFromEvent(a,
|
||||
null!=this.pages);if(null!=b)c.setSelectionCells(this.importXml(b,f,h,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var l=a.dataTransfer.getData("text/html"),b=document.createElement("div");b.innerHTML=l;var k=null,d=b.getElementsByTagName("img");null!=d&&1==d.length?(l=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)||(k=!0)):(b=b.getElementsByTagName("a"),null!=b&&1==b.length&&(l=b[0].getAttribute("href")));var m=!0,n=mxUtils.bind(this,function(){c.setSelectionCells(this.insertTextAt(l,
|
||||
f,h,!0,k,null,m))});k&&l.length>this.resampleThreshold?this.confirmImageResize(function(a){m=a;n()},mxEvent.isControlDown(a)):n()}else null!=g&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)?this.loadImage(decodeURIComponent(g),mxUtils.bind(this,function(a){var b=Math.max(1,a.width);a=Math.max(1,a.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,b)),d/Math.max(1,a));c.setSelectionCell(c.insertVertex(null,null,"",f,h,b*d,a*d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
||||
g+";"))}),mxUtils.bind(this,function(a){c.setSelectionCells(this.insertTextAt(g,f,h,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&c.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),f,h,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=
|
||||
mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),
|
||||
this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",
|
||||
mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||
|
||||
0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=
|
||||
e,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.importLucidChart(d,0,0),mxEvent.consume(a))}else{var d=this.editor.graph,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):
|
||||
b.textContent),f=!1;try{var h=e.lastIndexOf("%3E");0<=h&&h<e.length-3&&(e=e.substring(0,h+3))}catch(v){}try{var c=b.getElementsByTagName("span"),g=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(e);this.isCompatibleString(g)&&(f=!0,e=g)}catch(v){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),
|
||||
d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(v){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),
|
||||
b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),
|
||||
"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,
|
||||
"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,
|
||||
function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;
|
||||
var f=document.documentElement;d=(e.clientWidth||f.clientWidth)-3;e=Math.max(e.clientHeight||0,f.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,e=a.clientHeight;f=document.createElement("div");f.style.zIndex=mxPopupMenu.prototype.zIndex+2;f.style.border="3px dotted rgb(254, 137, 12)";f.style.pointerEvents="none";f.style.position="absolute";f.style.top=b+"px";f.style.left=c+"px";f.style.width=Math.max(0,d-3)+"px";f.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?
|
||||
this.editor.graph.container.appendChild(f):document.body.appendChild(f);return f};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=
|
||||
0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var d=c.target.result,e=a.name;if(null!=e&&0<e.length)if(/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml",this.parseFile(a,mxUtils.bind(this,function(a){if(4==a.readyState)if(this.spinner.stop(),200<=a.status&&299>=
|
||||
a.status)if(a=a.responseText,"<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);null!=e&&".vssx"==e.toLowerCase().substring(e.length-5)&&(e=e.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(u){this.handleError(u,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b);else this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(v){this.handleError(v,mxResources.get("errorLoadingFile"))}}else"image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=
|
||||
function(a,b,c){var d=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var d=mxUtils.parseXml(a);null!=d&&(this.editor.setGraphXml(d.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,c))});null!=a&&0<a.length&&(null!=d&&d.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),
|
||||
null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):e())};EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],c;for(c in a)b.push(c);return b};EditorUi.prototype.addBasenamesForCell=function(a,
|
||||
b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=
|
||||
function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,
|
||||
function(a,b,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.showLayersDialog()):(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&
|
||||
(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=
|
||||
null,f=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,f);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){function h(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==
|
||||
a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=this.editor.graph.decompress(a)))}catch(I){}return a}var k=f.data;if("json"==urlParams.proto){try{k=JSON.parse(k)}catch(G){k=null}if(null==k)return;if("dialog"==k.action){this.showError(null!=k.titleKey?mxResources.get(k.titleKey):k.title,null!=k.messageKey?mxResources.get(k.messageKey):k.message,null!=k.buttonKey?mxResources.get(k.buttonKey):k.button);null!=k.modified&&(this.editor.modified=
|
||||
k.modified);return}if("prompt"==k.action){this.spinner.stop();var l=new FilenameDialog(this,k.defaultValue||"",null!=k.okKey?mxResources.get(k.okKey):null,function(a){null!=a&&g.postMessage(JSON.stringify({event:"prompt",value:a,message:k}),"*")},null!=k.titleKey?mxResources.get(k.titleKey):k.title);this.showDialog(l.container,300,80,!0,!1);l.init();return}if("draft"==k.action){l=null;l="data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):h(k.xml);this.spinner.stop();
|
||||
l=new DraftDialog(this,mxResources.get("draftFound",[k.name||this.defaultFilename]),l,mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"edit",message:k}),"*")}),mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"discard",message:k}),"*")}),k.editKey?mxResources.get(k.editKey):null,k.discardKey?mxResources.get(k.discardKey):null);this.showDialog(l.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&
|
||||
this.actions.get("exit").funct()}));try{l.init()}catch(G){g.postMessage(JSON.stringify({event:"draft",error:G.toString(),message:k}),"*")}return}if("template"==k.action){this.spinner.stop();l=new NewDialog(this,!1,null!=k.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=k.callback?g.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(l.container,
|
||||
620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));l.init();return}if("status"==k.action){null!=k.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(k.messageKey))):null!=k.message&&this.editor.setStatus(mxUtils.htmlEntities(k.message));null!=k.modified&&(this.editor.modified=k.modified);return}if("spinner"==k.action){var m=null!=k.messageKey?mxResources.get(k.messageKey):k.message;null==k.show||k.show?this.spinner.spin(document.body,m):this.spinner.stop();
|
||||
return}if("export"==k.action){if("png"==k.format||"xmlpng"==k.format){if(null==k.spin&&null==k.spinKey||this.spinner.spin(document.body,null!=k.spinKey?mxResources.get(k.spinKey):k.spin)){var n=null!=k.xml?k.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var p=this.editor.graph,q=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=k.format;b.xml=encodeURIComponent(n);b.data=a;g.postMessage(JSON.stringify(b),
|
||||
"*")}),t=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==k.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(n))));p!=this.editor.graph&&p.container.parentNode.removeChild(p.container);q(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var p=this.createTemporaryGraph(p.getStylesheet()),B=p.getGlobalVariable,A=this.pages[0];p.getGlobalVariable=function(a){return"page"==a?A.getName():"pagenumber"==
|
||||
a?1:B.apply(this,arguments)};document.body.appendChild(p.container);p.model.setRoot(A.root)}this.exportToCanvas(mxUtils.bind(this,function(a){t(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){t(null)}),null,null,null,null,null,null,p)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==k.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(n)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?q("data:image/png;base64,"+
|
||||
a.getText()):t(null)}),mxUtils.bind(this,function(){t(null)}))}}else{null!=k.xml&&0<k.xml.length&&this.setFileData(k.xml);m=this.createLoadMessage("export");if("html2"==k.format||"html"==k.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))l=this.getXmlFileData(),m.xml=mxUtils.getXml(l),m.data=this.getFileData(null,null,!0,null,null,null,l),m.format=k.format;else if("html"==k.format)n=this.editor.getGraphXml(),m.data=this.getHtml(n,this.editor.graph),m.xml=mxUtils.getXml(n),m.format=
|
||||
k.format;else{mxSvgCanvas2D.prototype.foAltText=null;l=this.editor.graph.background;l==mxConstants.NONE&&(l=null);m.xml=this.getFileData(!0);m.format="svg";if(k.embedImages||null==k.embedImages){if(null==k.spin&&null==k.spinKey||this.spinner.spin(document.body,null!=k.spinKey?mxResources.get(k.spinKey):k.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==k.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=
|
||||
this.createSvgDataUri(a);g.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(l),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(a));g.postMessage(JSON.stringify(m),"*")}));return}l="xmlsvg"==k.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(l));m.data=this.createSvgDataUri(l)}g.postMessage(JSON.stringify(m),"*")}return}if("load"==
|
||||
k.action)d=1==k.autosave,this.hideDialog(),null!=k.modified&&null==urlParams.modified&&(urlParams.modified=k.modified),null!=k.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=k.saveAndExit),null!=k.title&&null!=this.buttonContainer&&(l=document.createElement("span"),mxUtils.write(l,k.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop=
|
||||
"6px"),this.buttonContainer.appendChild(l)),k=null!=k.xmlpng?this.extractGraphModelFromPng(k.xmlpng):null!=k.xml&&"data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):k.xml;else{g.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(k)}),"*");return}}k=h(k);c=!0;try{a(k,f)}catch(G){this.handleError(G)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var F=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?
|
||||
this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=F();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=F();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",
|
||||
b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||g.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var g=window.opener||window.parent,f="json"==urlParams.proto?JSON.stringify({event:"init"}):
|
||||
urlParams.ready||"ready";g.postMessage(f,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");b.className="geBigButton";b.style.fontSize="12px";
|
||||
b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));a.appendChild(b);"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),
|
||||
a.appendChild(b));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=
|
||||
function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a){try{var b=a.split("\n"),c=[];if(0<b.length){var d={},e=null,f=null,g="auto",k="auto",v=40,u=40,x=0,w=this.editor.graph;w.getGraphBounds();
|
||||
for(var y=function(){w.setSelectionCells(O);w.scrollCellToVisible(w.getSelectionCell())},D=w.getFreeInsertPoint(),E=D.x,z=D.y,D=z,B=null,A="auto",F=[],G=null,I=null,C=0;C<b.length&&"#"==b[C].charAt(0);){a=b[C];for(C++;C<b.length&&"\\"==a.charAt(a.length-1)&&"#"==b[C].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(b[C].substring(1)),C++;if("#"!=a.charAt(1)){var M=a.indexOf(":");if(0<M){var H=mxUtils.trim(a.substring(1,M)),K=mxUtils.trim(a.substring(M+1));"label"==H?B=w.sanitizeHtml(K):"style"==
|
||||
H?e=K:"identity"==H&&0<K.length&&"-"!=K?f=K:"width"==H?g=K:"height"==H?k=K:"ignore"==H?I=K.split(","):"connect"==H?F.push(JSON.parse(K)):"link"==H?G=K:"padding"==H?x=parseFloat(K):"edgespacing"==H?v=parseFloat(K):"nodespacing"==H?u=parseFloat(K):"layout"==H&&(A=K)}}}var T=this.editor.csvToArray(b[C]);a=null;if(null!=f)for(var L=0;L<T.length;L++)if(f==T[L]){a=L;break}null==B&&(B="%"+T[0]+"%");if(null!=F)for(var N=0;N<F.length;N++)null==d[F[N].to]&&(d[F[N].to]={});w.model.beginUpdate();try{for(L=C+
|
||||
1;L<b.length;L++){var Q=this.editor.csvToArray(b[L]);if(Q.length==T.length){var J=null,W=null!=a?Q[a]:null;null!=W&&(J=w.model.getCell(W));null==J&&(J=new mxCell(B,new mxGeometry(E,D,0,0),e||"whiteSpace=wrap;html=1;"),J.vertex=!0,J.id=W);for(var P=0;P<Q.length;P++)w.setAttributeForCell(J,T[P],Q[P]);w.setAttributeForCell(J,"placeholders","1");J.style=w.replacePlaceholders(J,J.style);for(N=0;N<F.length;N++)d[F[N].to][J.getAttribute(F[N].to)]=J;null!=G&&"link"!=G&&(w.setLinkForCell(J,J.getAttribute(G)),
|
||||
w.setAttributeForCell(J,G,null));var Y=this.editor.graph.getPreferredSizeForCell(J);J.geometry.width="auto"==g?Y.width+x:parseFloat(g);J.geometry.height="auto"==k?Y.height+x:parseFloat(k);D+=J.geometry.height+u;c.push(w.addCell(J))}}null==e&&w.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var U=c.slice(),O=c.slice(),N=0;N<F.length;N++)for(var R=F[N],L=0;L<c.length;L++){var J=c[L],V=J.getAttribute(R.from);if(null!=V){w.setAttributeForCell(J,R.from,null);for(var S=V.split(","),P=0;P<S.length;P++){var X=
|
||||
d[R.to][S[P]];null!=X&&(O.push(w.insertEdge(null,null,R.label||"",R.invert?X:J,R.invert?J:X,R.style||w.createCurrentEdgeStyle())),mxUtils.remove(R.invert?J:X,U))}}}if(null!=I)for(L=0;L<c.length;L++)for(J=c[L],P=0;P<I.length;P++)w.setAttributeForCell(J,mxUtils.trim(I[P]),null);var ba=new mxParallelEdgeLayout(w);ba.spacing=v;var ea=function(){ba.execute(w.getDefaultParent());for(var a=0;a<c.length;a++){var b=w.getCellGeometry(c[a]);b.x=Math.round(w.snap(b.x));b.y=Math.round(w.snap(b.y));"auto"==g&&
|
||||
(b.width=Math.round(w.snap(b.width)));"auto"==k&&(b.height=Math.round(w.snap(b.height)))}};if("circle"==A){var ca=new mxCircleLayout(w);ca.resetEdges=!1;var fa=ca.isVertexIgnored;ca.isVertexIgnored=function(a){return fa.apply(this,arguments)||0>mxUtils.indexOf(c,a)};this.executeLayout(function(){ca.execute(w.getDefaultParent());ea()},!0,y);y=null}else if("horizontaltree"==A||"verticaltree"==A||"auto"==A&&O.length==2*c.length-1&&1==U.length){w.view.validate();var Z=new mxCompactTreeLayout(w,"horizontaltree"==
|
||||
A);Z.levelDistance=u;Z.edgeRouting=!1;Z.resetEdges=!1;this.executeLayout(function(){Z.execute(w.getDefaultParent(),0<U.length?U[0]:null)},!0,y);y=null}else if("horizontalflow"==A||"verticalflow"==A||"auto"==A&&1==U.length){w.view.validate();var da=new mxHierarchicalLayout(w,"horizontalflow"==A?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);da.intraCellSpacing=u;da.disableEdgeStyle=!1;this.executeLayout(function(){da.execute(w.getDefaultParent(),O);w.moveCells(O,E,z)},!0,y);y=null}else if("organic"==
|
||||
A||"auto"==A&&O.length>c.length){w.view.validate();var aa=new mxFastOrganicLayout(w);aa.forceConstant=3*u;aa.resetEdges=!1;var ga=aa.isVertexIgnored;aa.isVertexIgnored=function(a){return ga.apply(this,arguments)||0>mxUtils.indexOf(c,a)};ba=new mxParallelEdgeLayout(w);ba.spacing=v;this.executeLayout(function(){aa.execute(w.getDefaultParent());ea()},!0,y);y=null}this.hideDialog()}finally{w.model.endUpdate()}null!=y&&y()}}catch(ha){this.handleError(ha)}};EditorUi.prototype.getSearch=function(a){var b=
|
||||
"";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),
|
||||
d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,c){a=new LinkDialog(this,a,b,c,!0);this.showDialog(a.container,420,120,!0,!0);a.init()};var g=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=g.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var f=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*
|
||||
b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return f.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/
|
||||
a,8/a)};var e=b.init;b.init=function(){e.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),f=b.source,e=b.outline;e.pageScale=f.pageScale;e.pageFormat=
|
||||
f.pageFormat;e.background=f.background;e.pageVisible=f.pageVisible;e.background=f.background;var g=mxUtils.getCurrentStyle(f.container);e.container.style.backgroundColor=g.backgroundColor;null!=f.view.backgroundPageShape&&null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.fill=f.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a){var b=0;null==this.drive&&"function"!==typeof window.DriveClient||
|
||||
b++;null==this.dropbox&&"function"!==typeof window.DropboxClient||b++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||b++;null!=this.gitHub&&b++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&b++;mxClient.IS_IOS||b++;return b};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);
|
||||
var c=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!c);this.actions.get("print").setEnabled(!c);this.menus.get("exportAs").setEnabled(!c);this.menus.get("embed").setEnabled(!c);c="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(c);this.menus.get("newLibrary").setEnabled(c);this.menus.get("extras").setEnabled(c);a="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=
|
||||
a&&a.isEditable();this.actions.get("image").setEnabled(b);this.actions.get("zoomIn").setEnabled(b);this.actions.get("zoomOut").setEnabled(b);this.actions.get("resetView").setEnabled(b);this.menus.get("edit").setEnabled(b);this.menus.get("view").setEnabled(b);this.menus.get("importFrom").setEnabled(a);this.menus.get("arrange").setEnabled(a);null!=this.toolbar&&(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(a),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(a));
|
||||
if(this.isOfflineApp()){var d=applicationCache;if(null!=d&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color="#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML=
|
||||
"";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var a=this.offlineStatus.getElementsByTagName("img");null!=a&&0<a.length&&this.alert(a[0].getAttribute("title"))}));var d=window.applicationCache,f=null,b=mxUtils.bind(this,function(){var a=d.status,b;a==d.CHECKING&&(a=d.DOWNLOADING);switch(a){case d.UNCACHED:b="";break;case d.IDLE:b='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';
|
||||
break;case d.DOWNLOADING:b='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case d.UPDATEREADY:b='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case d.OBSOLETE:b='<img title="Obsolete" border="0" src="'+IMAGE_PATH+'/clear.gif"/>';break;default:b='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}a!=f&&(this.offlineStatus.innerHTML=b,f=a)});mxEvent.addListener(d,
|
||||
"checking",b);mxEvent.addListener(d,"noupdate",b);mxEvent.addListener(d,"downloading",b);mxEvent.addListener(d,"progress",b);mxEvent.addListener(d,"cached",b);mxEvent.addListener(d,"updateready",b);mxEvent.addListener(d,"obsolete",b);mxEvent.addListener(d,"error",b);b()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=function(){};EditorUi.prototype.updateUserElement=function(){};var k=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){k.apply(this,
|
||||
arguments);var a=this.editor.graph,b=this.getCurrentFile(),c=null!=b&&b.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(c);this.actions.get("autosave").setEnabled(null!=b&&b.isEditable()&&b.isAutosaveOptional());this.actions.get("guides").setEnabled(c);this.actions.get("shadowVisible").setEnabled(c);this.actions.get("connectionArrows").setEnabled(c);this.actions.get("connectionPoints").setEnabled(c);this.actions.get("copyStyle").setEnabled(c&&
|
||||
!a.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(c&&!a.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(a.getModel().isVertex(a.getSelectionCell()));this.actions.get("createShape").setEnabled(c);this.actions.get("createRevision").setEnabled(c);this.actions.get("moveToFolder").setEnabled(null!=b);this.actions.get("makeCopy").setEnabled(null!=b&&!b.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&
|
||||
!b.isRestricted());this.actions.get("publishLink").setEnabled(null!=b&&!b.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.menus.get("publish").setEnabled(null!=b&&!b.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(c&&null!=a&&null!=a.shape&&null!=a.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=
|
||||
function(a,b,c,d,f,g){var e=a.editor.graph;if("xml"==c)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==c)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(e.getSvg(d,f,g)),"image/svg+xml");else{var h=a.getFileData(!0,null,null,null,null,!0),k=e.getGraphBounds(),l=Math.floor(k.width*f/e.view.scale),m=Math.floor(k.height*f/e.view.scale);h.length<=MAX_REQUEST_SIZE&&l*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,c,function(a,b){return new mxXmlRequest(EXPORT_URL,
|
||||
"format="+c+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=d?d:"none")+"&w="+l+"&h="+m+"&border="+g+"&xml="+encodeURIComponent(h))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
setGridColor:function(a){mxSettings.settings.gridColor=a},getAutosave:function(){return mxSettings.settings.autosave},setAutosave:function(a){mxSettings.settings.autosave=a},getResizeImages:function(){return mxSettings.settings.resizeImages},setResizeImages:function(a){mxSettings.settings.resizeImages=a},getOpenCounter:function(){return mxSettings.settings.openCounter},setOpenCounter:function(a){mxSettings.settings.openCounter=a},getLibraries:function(){return mxSettings.settings.libraries},setLibraries:function(a){mxSettings.settings.libraries=
|
||||
a},addCustomLibrary:function(a){mxSettings.load();0>mxUtils.indexOf(mxSettings.settings.customLibraries,a)&&("L.scratchpad"===a?mxSettings.settings.customLibraries.splice(0,0,a):mxSettings.settings.customLibraries.push(a));mxSettings.save()},removeCustomLibrary:function(a){mxSettings.load();mxUtils.remove(a,mxSettings.settings.customLibraries);mxSettings.save()},getCustomLibraries:function(){return mxSettings.settings.customLibraries},getPlugins:function(){return mxSettings.settings.plugins},setPlugins:function(a){mxSettings.settings.plugins=
|
||||
a},getRecentColors:function(){return mxSettings.settings.recentColors},setRecentColors:function(a){mxSettings.settings.recentColors=a},getFormatWidth:function(){return parseInt(mxSettings.settings.formatWidth)},setFormatWidth:function(a){mxSettings.settings.formatWidth=a},getCurrentEdgeStyle:function(){return mxSettings.settings.currentEdgeStyle},setCurrentEdgeStyle:function(a){mxSettings.settings.currentEdgeStyle=a},getCurrentVertexStyle:function(){return mxSettings.settings.currentVertexStyle},
|
||||
|
|
233
war/js/atlas-viewer.min.js
vendored
233
war/js/atlas-viewer.min.js
vendored
|
@ -2726,122 +2726,123 @@ function(){b()});else{var c=new Image;c.onload=function(){var a=document.createE
|
|||
k.getElementsByTagName("diagram");if(1==p.length)k=mxUtils.parseXml(f.decompress(mxUtils.getTextContent(p[0]))).documentElement;else if(1<p.length){f.model.beginUpdate();try{for(var l=0;l<p.length;l++){var m=this.updatePageRoot(new DiagramPage(p[l])),w=this.pages.length;null==m.getName()&&m.setName(mxResources.get("pageWithNumber",[w+1]));f.model.execute(new ChangePage(this,m,m,w))}}finally{f.model.endUpdate()}}}if(null!=k&&"mxGraphModel"===k.nodeName){var x=new mxGraphModel;(new mxCodec(k.ownerDocument)).decode(k,
|
||||
x);var D=x.getChildCount(x.getRoot());f.model.getChildCount(f.model.getRoot());f.model.beginUpdate();try{a={};for(l=0;l<D;l++){var A=x.getChildAt(x.getRoot(),l);if(1!=D||f.isCellLocked(f.getDefaultParent()))A=f.importCells([A],0,0,f.model.getRoot(),null,a)[0],y=f.model.getChildren(A),f.moveCells(y,b,d),c=c.concat(y);else var y=x.getChildren(A),c=c.concat(f.importCells(y,b,d,f.getDefaultParent(),null,a))}if(e){f.isGridEnabled()&&(b=f.snap(b),d=f.snap(d));var B=f.getBoundingBoxFromGeometry(c,!0);null!=
|
||||
B&&f.moveCells(c,b-B.x,d-B.y)}}finally{f.model.endUpdate()}}}}catch(C){throw h||this.handleError(C,mxResources.get("invalidOrMissingFile")),C;}return c};EditorUi.prototype.importLucidChart=function(a,b,d,e,h){var c=mxUtils.bind(this,function(){if(this.pasteLucidChart)try{this.insertLucidChart(a,b,d,e,h)}catch(u){this.handleError(u)}finally{null!=h&&h()}});this.pasteLucidChart||this.loadingExtensions||this.isOffline()?window.setTimeout(c,0):(this.loadingExtensions=!0,"1"==urlParams.dev?mxscript("/js/diagramly/Extensions.js",
|
||||
c):mxscript("/js/extensions.min.js",c))};EditorUi.prototype.insertLucidChart=function(a,b,d,e,h){h=JSON.parse(JSON.parse(a).state);a=[];for(var c in h.Pages)a.push(h.Pages[c]);a.sort(function(a,c){return a.Properties.Order<c.Properties.Order?-1:a.Properties.Order>c.Properties.Order?1:0});if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,d,e),null!=this.pages){var f=this.currentPage;for(b=1;b<a.length;b++)this.insertPage(),this.pasteLucidChart(a[b]);this.selectPage(f)}}finally{this.editor.graph.getModel().endUpdate()}}};
|
||||
EditorUi.prototype.insertTextAt=function(a,b,d,e,h,k,l){k=null!=k?k:!0;l=null!=l?l:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,b,d,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(h||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var c=
|
||||
this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var f=this.extractGraphModelFromPng(a),g=this.importXml(f,b,d,k,!0);if(0<g.length)return g}if("data:image/svg+xml;"==a.substring(0,19))try{if(f=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(f=a.substring(a.indexOf(",")+1),f=window.atob&&!mxClient.IS_SF?atob(f):Base64.decode(f,!0)):f=decodeURIComponent(a.substring(a.indexOf(",")+1)),g=this.importXml(f,b,d,k,!0),0<g.length)return g}catch(z){}this.loadImage(a,mxUtils.bind(this,
|
||||
function(e){if("data:"==a.substring(0,5))this.resizeImage(e,a,mxUtils.bind(this,function(a,e,f){c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),e,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),l,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/e.width,this.maxImageSize/e.height)),g=Math.round(e.width*f);e=Math.round(e.height*f);c.setSelectionCell(c.insertVertex(null,
|
||||
null,"",c.snap(b),c.snap(d),g,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var f=null;c.getModel().beginUpdate();try{f=c.insertVertex(c.getDefaultParent(),null,a,c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.updateCellSize(f),c.fireEvent(new mxEventObject("textInserted","cells",[f]))}finally{c.getModel().endUpdate()}c.setSelectionCell(f)}))}else{a=this.editor.graph.zapGremlins(mxUtils.trim(a));
|
||||
if(this.isCompatibleString(a))return this.importXml(a,b,d,k);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,d,k);else{c=this.editor.graph;h=null;c.getModel().beginUpdate();try{h=c.insertVertex(c.getDefaultParent(),null,"",c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.fireEvent(new mxEventObject("textInserted","cells",[h])),h.value=a,c.updateCellSize(h),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(h.value)&&
|
||||
c.setLinkForCell(h,h.value),h.geometry.width+=c.gridSize,h.geometry.height+=c.gridSize}finally{c.getModel().endUpdate()}return[h]}}return[]};EditorUi.prototype.formatFileSize=function(a){var c=-1;do a/=1024,c++;while(1024<a);return Math.max(a,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[c]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var c=a.indexOf(";");0<c&&(a=a.substring(0,c)+a.substring(a.indexOf(",",c+1)))}return a};EditorUi.prototype.isRemoteFileFormat=
|
||||
function(a,b){return/(\.*<graphml xmlns=\".*)/.test(a)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)||null!=b&&/(\.vsdx)($|\?)/i.test(b)||null!=b&&/(\.vssx)($|\?)/i.test(b)};EditorUi.prototype.importFile=function(a,b,d,e,h,k,l,n,m,r,z){r=null!=r?r:!0;var c=!1,f=null;"image"==b.substring(0,5)?(m=!1,"image/png"==b.substring(0,9)&&(b=z?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(f=this.importXml(b,d,e,r),m=!0)),m||(f=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,
|
||||
b)+a.substring(a.indexOf(",",b+1))),r&&f.isGridEnabled()&&(d=f.snap(d),e=f.snap(e)),f=[f.insertVertex(null,null,"",d,e,h,k,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,l)?(c=!0,this.parseFile(null!=m?m:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){if(4==a.readyState){var c=null;200<=a.status&&299>=a.status&&
|
||||
(a=a.responseText,null!=a&&"<mxlibrary"==a.substring(0,10)?(null!=l&&".vssx"==l.toLowerCase().substring(l.length-5)&&(l=l.substring(0,l.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,a,l))):c=this.importXml(a,d,e,r));null!=n&&n(c)}}),l)):/(\.vsd)($|\?)/i.test(l)||(f=this.insertTextAt(this.validateFileData(a),d,e,!0,null,r));c||null==n||n(f);return f};EditorUi.prototype.base64Encode=function(a){for(var c="",b=0,d=a.length,e,k,l;b<d;){e=a.charCodeAt(b++)&255;if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);c+="==";break}k=a.charCodeAt(b++);if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2);c+="=";break}l=a.charCodeAt(b++);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2|(l&192)>>6);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(l&63)}return c};EditorUi.prototype.importFiles=function(a,b,d,e,h,k,l,m,t,r,z,v){b=null!=b?b:0;d=null!=d?d:0;e=null!=e?e:this.maxImageSize;r=null!=r?r:this.maxImageBytes;var c=null!=b&&null!=d,f=!0,g=!1;if(!mxClient.IS_CHROMEAPP&&
|
||||
null!=a)for(var p=z||this.resampleThreshold,n=0;n<a.length;n++)if("image/"==a[n].type.substring(0,6)&&a[n].size>p){g=!0;break}var q=mxUtils.bind(this,function(){var g=this.editor.graph,p=g.gridSize;h=null!=h?h:mxUtils.bind(this,function(a,b,d,e,f,g,h,k,p){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,h)),null):this.importFile(a,b,d,e,f,g,h,k,p,c,v)});k=null!=k?k:mxUtils.bind(this,function(a){g.setSelectionCells(a)});if(this.spinner.spin(document.body,
|
||||
mxResources.get("loading")))for(var n=a.length,q=n,u=[],t=mxUtils.bind(this,function(a,c){u[a]=c;if(0==--q){this.spinner.stop();if(null!=m)m(u);else{var b=[];g.getModel().beginUpdate();try{for(var d=0;d<u.length;d++){var e=u[d]();null!=e&&(b=b.concat(e))}}finally{g.getModel().endUpdate()}}k(b)}}),y=0;y<n;y++)mxUtils.bind(this,function(c){var g=a[c],k=new FileReader;k.onload=mxUtils.bind(this,function(a){if(null==l||l(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var k=
|
||||
a.target.result,n=k.indexOf(","),m=atob(k.substring(n+1)),q=mxUtils.parseXml(m),m=q.getElementsByTagName("svg");if(0<m.length){var m=m[0],u=v?null:m.getAttribute("content");null!=u&&"<"!=u.charAt(0)&&"%"!=u.charAt(0)&&(u=unescape(window.atob?atob(u):Base64.decode(u,!0)));null!=u&&"%"==u.charAt(0)&&(u=decodeURIComponent(u));null==u||"<mxfile "!==u.substring(0,8)&&"<mxGraphModel "!==u.substring(0,14)?t(c,mxUtils.bind(this,function(){try{if(k.substring(0,n+1),null!=q){var a=q.getElementsByTagName("svg");
|
||||
if(0<a.length){var f=a[0],l=parseFloat(f.getAttribute("width")),m=parseFloat(f.getAttribute("height")),r=f.getAttribute("viewBox");if(null==r||0==r.length)f.setAttribute("viewBox","0 0 "+l+" "+m);else if(isNaN(l)||isNaN(m)){var u=r.split(" ");3<u.length&&(l=parseFloat(u[2]),m=parseFloat(u[3]))}k=this.createSvgDataUri(mxUtils.getXml(a[0]));var t=Math.min(1,Math.min(e/Math.max(1,l)),e/Math.max(1,m));return h(k,g.type,b+c*p,d+c*p,Math.max(1,Math.round(l*t)),Math.max(1,Math.round(m*t)),g.name)}}}catch(ba){}return null})):
|
||||
t(c,mxUtils.bind(this,function(){return h(u,"text/xml",b+c*p,d+c*p,0,0,g.name)}))}}else{m=!1;if("image/png"==g.type){var y=v?null:this.extractGraphModelFromPng(a.target.result);if(null!=y&&0<y.length){var x=new Image;x.src=a.target.result;t(c,mxUtils.bind(this,function(){return h(y,"text/xml",b+c*p,d+c*p,x.width,x.height,g.name)}));m=!0}}m||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,
|
||||
function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(k){this.resizeImage(k,a.target.result,mxUtils.bind(this,function(k,l,m){t(c,mxUtils.bind(this,function(){if(null!=k&&k.length<r){var n=f&&this.isResampleImage(a.target.result,z)?Math.min(1,Math.min(e/l,e/m)):1;return h(k,g.type,b+c*p,d+c*p,Math.round(l*n),Math.round(m*n),g.name)}this.handleError({message:mxResources.get("imageTooBig")});
|
||||
return null}))}),f,e,z)})))}else h(a.target.result,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})})});/(\.vsdx)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?h(null,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})},g):"image"==g.type.substring(0,5)?k.readAsDataURL(g):k.readAsText(g)})(y)});g?this.confirmImageResize(function(a){f=a;q()},t):q()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?
|
||||
this.spinner.pause():function(){},d=function(b,d){mxSettings.setResizeImages(b?d:null);mxSettings.save();c();a(d)},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null;null==e||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){d(a,!0)},function(a){d(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||
|
||||
mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):d(!1,e)};EditorUi.prototype.parseFile=function(a,b,d){d=null!=d?d:a.name;var c=new FormData;c.append("format","xml");c.append("upfile",a,d);var e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(c)};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,d,e,h,k){h=null!=h?h:this.maxImageSize;
|
||||
var c=Math.max(1,a.width),f=Math.max(1,a.height);if(e&&this.isResampleImage(b,k))try{var g=Math.max(c/h,f/h);if(1<g){var l=Math.round(c/g),p=Math.round(f/g),m=document.createElement("canvas");m.width=l;m.height=p;m.getContext("2d").drawImage(a,0,0,l,p);var q=m.toDataURL();if(q.length<b.length){var x=document.createElement("canvas");x.width=l;x.height=p;var D=x.toDataURL();q!==D&&(b=q,c=l,f=p)}}}catch(A){}d(b,c,f)};EditorUi.prototype.crcTable=[];for(var b=0;256>b;b++)for(var e=b,d=0;8>d;d++)e=1==(e&
|
||||
1)?3988292384^e>>>1:e>>>1,EditorUi.prototype.crcTable[b]=e;EditorUi.prototype.updateCRC=function(a,b,d,e){for(var c=0;c<e;c++)a=EditorUi.prototype.crcTable[(a^b[d+c])&255]^a>>>8;return a};EditorUi.prototype.writeGraphModelToPng=function(a,b,d,e,h){function c(a,b){var c=k;k+=b;return a.substring(c,k)}function f(a){a=c(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+
|
||||
1);a=window.atob?atob(a):Base64.decode(a,!0);var k=0;if(c(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=h&&h();else if(c(a,4),"IHDR"!=c(a,4))null!=h&&h();else{c(a,17);h=a.substring(0,k);do{var l=f(a);if("IDAT"==c(a,4)){h=a.substring(0,k-8);d=d+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+e;e=4294967295;e=this.updateCRC(e,b,0,4);e=this.updateCRC(e,d,0,d.length);h+=g(d.length)+b+d+g(e^4294967295);h+=a.substring(k-8,a.length);break}h+=a.substring(k-8,k-4+
|
||||
l);e=c(a,l);c(a,4)}while(l);return"data:image/png;base64,"+(window.btoa?btoa(h):Base64.encode(h,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g,
|
||||
" "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(h){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,d){var c=new Image;c.onload=function(){b(c)};null!=d&&(c.onerror=d);c.src=a};var k=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a){var c=a.indexOf(",");
|
||||
0<c&&(a=b.getPageById(a.substring(c+1)))&&b.selectPage(a)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,d=this.editor.graph,e=d.addClickHandler;d.addClickHandler=function(b,c,f){var g=c;c=function(b,c){if(null==c){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(c=e.getAttribute("href"))}null!=c&&d.isPageLink(c)&&(a(c),mxEvent.consume(b));null!=g&&g(b,c)};e.call(this,b,c,f)};k.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(d.view.canvas.ownerSVGElement,
|
||||
null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var h=d.getGlobalVariable;d.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:h.apply(this,arguments)};var l=d.createLinkForHint;d.createLinkForHint=function(c,e){var f=
|
||||
d.isPageLink(c);if(f){var g=c.indexOf(",");0<g&&(g=b.getPageById(c.substring(g+1)),e=null!=g?g.getName():mxResources.get("pageNotFound"))}g=l.apply(this,arguments);f&&mxEvent.addListener(g,"click",function(b){a(c);mxEvent.consume(b)});return g};var m=d.labelLinkClicked;d.labelLinkClicked=function(b,c,e){var f=c.getAttribute("href");d.isPageLink(f)?(a(f),mxEvent.consume(e)):m.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=
|
||||
null!=c.getTitle()?c.getTitle():a);return a};var n=this.actions.get("print");n.setEnabled(!mxClient.IS_IOS||!navigator.standalone);n.visible=n.isEnabled();if(!this.editor.chromeless){var t=function(){window.setTimeout(function(){r.innerHTML=" ";r.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,
|
||||
!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||d.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.originalEvent.clipboardData,d=!1,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var g=f[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],
|
||||
0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var h=this.editor.graph.getInsertPoint();this.importFiles([g.getAsFile()],h.x,h.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(I){}}),!1);var r=document.createElement("div");r.style.position="absolute";r.style.whiteSpace="nowrap";r.style.overflow="hidden";r.style.display="block";r.contentEditable=!0;mxUtils.setOpacity(r,
|
||||
0);r.style.width="1px";r.style.height="1px";r.innerHTML=" ";var z=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(a){var b=mxEvent.getSource(a);null==d.container||!d.isEnabled()||d.isMouseDown||d.isEditing()||null!=this.dialog||"INPUT"==b.nodeName||"TEXTAREA"==b.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||
|
||||
z||(r.style.left=d.container.scrollLeft+10+"px",r.style.top=d.container.scrollTop+10+"px",d.container.appendChild(r),z=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){r.focus();document.execCommand("selectAll",!1,null)},0):(r.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var b=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!z||224!=b&&17!=b&&91!=b||(z=!1,d.isEditing()||null!=this.dialog||null==d.container||d.container.focus(),
|
||||
r.parentNode.removeChild(r))}),0)}));mxEvent.addListener(r,"copy",mxUtils.bind(this,function(a){d.isEnabled()&&(mxClipboard.copy(d),this.copyCells(r),t())}));mxEvent.addListener(r,"cut",mxUtils.bind(this,function(a){d.isEnabled()&&(this.copyCells(r,!0),t())}));mxEvent.addListener(r,"paste",mxUtils.bind(this,function(a){d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())&&(r.innerHTML=" ",r.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,r);r.innerHTML=" "}),0))}),
|
||||
!0);var v=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==r?!0:v.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),
|
||||
d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==
|
||||
a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",
|
||||
!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){n=document.createElement("div");n.style.position="absolute";n.style.top="95px";n.style.left="250px";
|
||||
n.style.width="2000px";n.style.height="30px";n.style.background="whiteSmoke";document.body.appendChild(n);var w=document.createElement("div");w.style.position="absolute";w.style.top="125px";w.style.left="220px";w.style.width="30px";w.style.height="1000px";w.style.background="whiteSmoke";document.body.appendChild(w);var x=document.createElement("div");x.style.position="absolute";x.style.top="95px";x.style.left="220px";x.style.width="30px";x.style.height="30px";x.style.background="whiteSmoke";document.body.appendChild(x);
|
||||
this.vRuler=new mxRuler(this.editor.graph,w,!0);this.hRuler=new mxRuler(this.editor.graph,n,!1)}if("1"==urlParams.test){n=document.getElementById("geFooter");null!=n&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,
|
||||
"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),n.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility=
|
||||
"hidden"})));var D=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:D.apply(this,arguments)}}n=document.getElementById("geInfo");null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport){var A=null;mxEvent.addListener(d.container,"dragleave",function(a){d.isEnabled()&&(null!=A&&(A.parentNode.removeChild(A),A=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(d.container,"dragover",mxUtils.bind(this,function(a){null==A&&(!mxClient.IS_IE||
|
||||
10<document.documentMode)&&(A=this.highlightElement(d.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(d.container,"drop",mxUtils.bind(this,function(a){null!=A&&(A.parentNode.removeChild(A),A=null);if(d.isEnabled()){var b=mxUtils.convertPoint(d.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),c=d.view.translate,e=d.view.scale,f=b.x/e-c.x,g=b.y/e-c.y;mxEvent.isAltDown(a)&&(g=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,
|
||||
f,g,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var h=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,b=this.extractGraphModelFromEvent(a,null!=this.pages);if(null!=b)d.setSelectionCells(this.importXml(b,f,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var k=a.dataTransfer.getData("text/html"),b=document.createElement("div");b.innerHTML=k;var l=null,c=b.getElementsByTagName("img");
|
||||
null!=c&&1==c.length?(k=c[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)||(l=!0)):(b=b.getElementsByTagName("a"),null!=b&&1==b.length&&(k=b[0].getAttribute("href")));var p=!0,m=mxUtils.bind(this,function(){d.setSelectionCells(this.insertTextAt(k,f,g,!0,l,null,p))});l&&k.length>this.resampleThreshold?this.confirmImageResize(function(a){p=a;m()},mxEvent.isControlDown(a)):m()}else null!=h&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(h)?this.loadImage(decodeURIComponent(h),mxUtils.bind(this,
|
||||
function(a){var b=Math.max(1,a.width);a=Math.max(1,a.height);var c=this.maxImageSize,c=Math.min(1,Math.min(c/Math.max(1,b)),c/Math.max(1,a));d.setSelectionCell(d.insertVertex(null,null,"",f,g,b*c,a*c,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+h+";"))}),mxUtils.bind(this,function(a){d.setSelectionCells(this.insertTextAt(h,f,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&d.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),
|
||||
f,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged",
|
||||
"keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());
|
||||
mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,
|
||||
function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=
|
||||
function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=e,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=
|
||||
c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.insertLucidChart(JSON.parse(d)),mxEvent.consume(a))}else{var d=this.editor.graph,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):b.textContent),f=!1;try{var k=e.lastIndexOf("%3E");0<=k&&k<e.length-3&&(e=e.substring(0,k+3))}catch(t){}try{var c=b.getElementsByTagName("span"),l=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):
|
||||
decodeURIComponent(e);this.isCompatibleString(l)&&(f=!0,e=l)}catch(t){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=
|
||||
this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(t){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||
|
||||
10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,
|
||||
!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):
|
||||
0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash=
|
||||
"#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;var k=document.documentElement;d=(e.clientWidth||k.clientWidth)-3;e=Math.max(e.clientHeight||0,k.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,
|
||||
e=a.clientHeight;k=document.createElement("div");k.style.zIndex=mxPopupMenu.prototype.zIndex+2;k.style.border="3px dotted rgb(254, 137, 12)";k.style.pointerEvents="none";k.style.position="absolute";k.style.top=b+"px";k.style.left=c+"px";k.style.width=Math.max(0,d-3)+"px";k.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(k):document.body.appendChild(k);return k};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);
|
||||
var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var d=c.target.result,e=a.name;if(null!=
|
||||
e&&0<e.length)if(/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml",this.parseFile(a,mxUtils.bind(this,function(a){if(4==a.readyState)if(this.spinner.stop(),200<=a.status&&299>=a.status)if(a=a.responseText,"<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,b);null!=e&&".vssx"==e.toLowerCase().substring(e.length-5)&&(e=e.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(r){this.handleError(r,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b);else this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,
|
||||
e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(t){this.handleError(t,mxResources.get("errorLoadingFile"))}}else"image/png"==
|
||||
a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=function(a,b,d){var c=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var c=
|
||||
mxUtils.parseXml(a);null!=c&&(this.editor.setGraphXml(c.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,d))});null!=a&&0<a.length&&(null!=c&&c.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):e())};
|
||||
EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],d;for(d in a)b.push(d);return b};EditorUi.prototype.addBasenamesForCell=function(a,b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);
|
||||
c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=
|
||||
a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,b,d){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.showLayersDialog()):
|
||||
(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=d?d:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};
|
||||
EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=null,k=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):
|
||||
this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,k);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){function g(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=this.editor.graph.decompress(a)))}catch(K){}return a}var h=f.data;
|
||||
if("json"==urlParams.proto){try{h=JSON.parse(h)}catch(J){h=null}if(null==h)return;if("dialog"==h.action){this.showError(null!=h.titleKey?mxResources.get(h.titleKey):h.title,null!=h.messageKey?mxResources.get(h.messageKey):h.message,null!=h.buttonKey?mxResources.get(h.buttonKey):h.button);null!=h.modified&&(this.editor.modified=h.modified);return}if("prompt"==h.action){this.spinner.stop();var k=new FilenameDialog(this,h.defaultValue||"",null!=h.okKey?mxResources.get(h.okKey):null,function(a){null!=
|
||||
a&&l.postMessage(JSON.stringify({event:"prompt",value:a,message:h}),"*")},null!=h.titleKey?mxResources.get(h.titleKey):h.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==h.action){k=null;k="data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):g(h.xml);this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[h.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",
|
||||
result:"edit",message:h}),"*")}),mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"discard",message:h}),"*")}),h.editKey?mxResources.get(h.editKey):null,h.discardKey?mxResources.get(h.discardKey):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{k.init()}catch(J){l.postMessage(JSON.stringify({event:"draft",error:J.toString(),message:h}),"*")}return}if("template"==h.action){this.spinner.stop();
|
||||
k=new NewDialog(this,!1,null!=h.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=h.callback?l.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("status"==h.action){null!=h.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(h.messageKey))):
|
||||
null!=h.message&&this.editor.setStatus(mxUtils.htmlEntities(h.message));null!=h.modified&&(this.editor.modified=h.modified);return}if("spinner"==h.action){var m=null!=h.messageKey?mxResources.get(h.messageKey):h.message;null==h.show||h.show?this.spinner.spin(document.body,m):this.spinner.stop();return}if("export"==h.action){if("png"==h.format||"xmlpng"==h.format){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,null!=h.spinKey?mxResources.get(h.spinKey):h.spin)){var p=null!=h.xml?
|
||||
h.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var n=this.editor.graph,q=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=h.format;b.xml=encodeURIComponent(p);b.data=a;l.postMessage(JSON.stringify(b),"*")}),u=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==h.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(p))));n!=this.editor.graph&&n.container.parentNode.removeChild(n.container);
|
||||
q(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var n=this.createTemporaryGraph(n.getStylesheet()),y=n.getGlobalVariable,B=this.pages[0];n.getGlobalVariable=function(a){return"page"==a?B.getName():"pagenumber"==a?1:y.apply(this,arguments)};document.body.appendChild(n.container);n.model.setRoot(B.root)}this.exportToCanvas(mxUtils.bind(this,function(a){u(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){u(null)}),null,null,null,null,null,
|
||||
null,n)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==h.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(p)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?q("data:image/png;base64,"+a.getText()):u(null)}),mxUtils.bind(this,function(){u(null)}))}}else{null!=h.xml&&0<h.xml.length&&this.setFileData(h.xml);m=this.createLoadMessage("export");if("html2"==h.format||"html"==h.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=
|
||||
this.getXmlFileData(),m.xml=mxUtils.getXml(k),m.data=this.getFileData(null,null,!0,null,null,null,k),m.format=h.format;else if("html"==h.format)p=this.editor.getGraphXml(),m.data=this.getHtml(p,this.editor.graph),m.xml=mxUtils.getXml(p),m.format=h.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);m.xml=this.getFileData(!0);m.format="svg";if(h.embedImages||null==h.embedImages){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,
|
||||
null!=h.spinKey?mxResources.get(h.spinKey):h.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==h.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(a);l.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(a));l.postMessage(JSON.stringify(m),
|
||||
"*")}));return}k="xmlsvg"==h.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));m.data=this.createSvgDataUri(k)}l.postMessage(JSON.stringify(m),"*")}return}if("load"==h.action)d=1==h.autosave,this.hideDialog(),null!=h.modified&&null==urlParams.modified&&(urlParams.modified=h.modified),null!=h.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=h.saveAndExit),null!=h.title&&null!=this.buttonContainer&&(k=document.createElement("span"),
|
||||
mxUtils.write(k,h.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),this.buttonContainer.appendChild(k)),h=null!=h.xmlpng?this.extractGraphModelFromPng(h.xmlpng):null!=h.xml&&"data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):h.xml;else{l.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(h)}),
|
||||
"*");return}}h=g(h);c=!0;try{a(h,f)}catch(J){this.handleError(J)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var C=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=C();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=C();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,
|
||||
b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&
|
||||
"json"!=urlParams.proto||l.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var l=window.opener||window.parent,k="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";l.postMessage(k,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=
|
||||
document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");b.className="geBigButton";b.style.fontSize="12px";b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));a.appendChild(b);"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),
|
||||
b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,
|
||||
function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,
|
||||
640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a){try{var b=a.split("\n"),c=[];if(0<b.length){var d={},e=null,k=null,l="auto",m="auto",t=40,r=40,z=0,v=this.editor.graph;v.getGraphBounds();for(var w=function(){v.setSelectionCells(P);v.scrollCellToVisible(v.getSelectionCell())},x=v.getFreeInsertPoint(),D=x.x,A=x.y,x=A,y=null,B="auto",C=[],J=null,K=null,L=0;L<b.length&&"#"==b[L].charAt(0);){a=b[L];for(L++;L<b.length&&"\\"==a.charAt(a.length-1)&&"#"==b[L].charAt(0);)a=
|
||||
a.substring(0,a.length-1)+mxUtils.trim(b[L].substring(1)),L++;if("#"!=a.charAt(1)){var W=a.indexOf(":");if(0<W){var H=mxUtils.trim(a.substring(1,W)),I=mxUtils.trim(a.substring(W+1));"label"==H?y=v.sanitizeHtml(I):"style"==H?e=I:"identity"==H&&0<I.length&&"-"!=I?k=I:"width"==H?l=I:"height"==H?m=I:"ignore"==H?K=I.split(","):"connect"==H?C.push(JSON.parse(I)):"link"==H?J=I:"padding"==H?z=parseFloat(I):"edgespacing"==H?t=parseFloat(I):"nodespacing"==H?r=parseFloat(I):"layout"==H&&(B=I)}}}var T=this.editor.csvToArray(b[L]);
|
||||
a=null;if(null!=k)for(var G=0;G<T.length;G++)if(k==T[G]){a=G;break}null==y&&(y="%"+T[0]+"%");if(null!=C)for(var F=0;F<C.length;F++)null==d[C[F].to]&&(d[C[F].to]={});v.model.beginUpdate();try{for(G=L+1;G<b.length;G++){var N=this.editor.csvToArray(b[G]);if(N.length==T.length){var E=null,S=null!=a?N[a]:null;null!=S&&(E=v.model.getCell(S));null==E&&(E=new mxCell(y,new mxGeometry(D,x,0,0),e||"whiteSpace=wrap;html=1;"),E.vertex=!0,E.id=S);for(var O=0;O<N.length;O++)v.setAttributeForCell(E,T[O],N[O]);v.setAttributeForCell(E,
|
||||
"placeholders","1");E.style=v.replacePlaceholders(E,E.style);for(F=0;F<C.length;F++)d[C[F].to][E.getAttribute(C[F].to)]=E;null!=J&&"link"!=J&&(v.setLinkForCell(E,E.getAttribute(J)),v.setAttributeForCell(E,J,null));var U=this.editor.graph.getPreferredSizeForCell(E);E.geometry.width="auto"==l?U.width+z:parseFloat(l);E.geometry.height="auto"==m?U.height+z:parseFloat(m);x+=E.geometry.height+r;c.push(v.addCell(E))}}null==e&&v.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var Q=c.slice(),
|
||||
P=c.slice(),F=0;F<C.length;F++)for(var R=C[F],G=0;G<c.length;G++){var E=c[G],X=E.getAttribute(R.from);if(null!=X){v.setAttributeForCell(E,R.from,null);for(var V=X.split(","),O=0;O<V.length;O++){var Y=d[R.to][V[O]];null!=Y&&(P.push(v.insertEdge(null,null,R.label||"",R.invert?Y:E,R.invert?E:Y,R.style||v.createCurrentEdgeStyle())),mxUtils.remove(R.invert?E:Y,Q))}}}if(null!=K)for(G=0;G<c.length;G++)for(E=c[G],O=0;O<K.length;O++)v.setAttributeForCell(E,mxUtils.trim(K[O]),null);var Z=new mxParallelEdgeLayout(v);
|
||||
Z.spacing=t;var fa=function(){Z.execute(v.getDefaultParent());for(var a=0;a<c.length;a++){var b=v.getCellGeometry(c[a]);b.x=Math.round(v.snap(b.x));b.y=Math.round(v.snap(b.y));"auto"==l&&(b.width=Math.round(v.snap(b.width)));"auto"==m&&(b.height=Math.round(v.snap(b.height)))}};if("circle"==B){var aa=new mxCircleLayout(v);aa.resetEdges=!1;var ja=aa.isVertexIgnored;aa.isVertexIgnored=function(a){return ja.apply(this,arguments)||0>mxUtils.indexOf(c,a)};this.executeLayout(function(){aa.execute(v.getDefaultParent());
|
||||
fa()},!0,w);w=null}else if("horizontaltree"==B||"verticaltree"==B||"auto"==B&&P.length==2*c.length-1&&1==Q.length){v.view.validate();var ba=new mxCompactTreeLayout(v,"horizontaltree"==B);ba.levelDistance=r;ba.edgeRouting=!1;ba.resetEdges=!1;this.executeLayout(function(){ba.execute(v.getDefaultParent(),0<Q.length?Q[0]:null)},!0,w);w=null}else if("horizontalflow"==B||"verticalflow"==B||"auto"==B&&1==Q.length){v.view.validate();var ga=new mxHierarchicalLayout(v,"horizontalflow"==B?mxConstants.DIRECTION_WEST:
|
||||
mxConstants.DIRECTION_NORTH);ga.intraCellSpacing=r;ga.disableEdgeStyle=!1;this.executeLayout(function(){ga.execute(v.getDefaultParent(),P);v.moveCells(P,D,A)},!0,w);w=null}else if("organic"==B||"auto"==B&&P.length>c.length){v.view.validate();var ca=new mxFastOrganicLayout(v);ca.forceConstant=3*r;ca.resetEdges=!1;var na=ca.isVertexIgnored;ca.isVertexIgnored=function(a){return na.apply(this,arguments)||0>mxUtils.indexOf(c,a)};Z=new mxParallelEdgeLayout(v);Z.spacing=t;this.executeLayout(function(){ca.execute(v.getDefaultParent());
|
||||
fa()},!0,w);w=null}this.hideDialog()}finally{v.model.endUpdate()}null!=w&&w()}}catch(ka){this.handleError(ka)}};EditorUi.prototype.getSearch=function(a){var b="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;
|
||||
if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,d){a=new LinkDialog(this,a,b,d,!0);this.showDialog(a.container,420,120,!0,!0);a.init()};var l=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=
|
||||
l.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-
|
||||
2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/a,8/a)};var k=b.init;b.init=function(){k.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};
|
||||
this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=e.pageFormat;f.background=e.background;f.pageVisible=e.pageVisible;f.background=e.background;var g=mxUtils.getCurrentStyle(e.container);f.container.style.backgroundColor=g.backgroundColor;null!=e.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=e.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,
|
||||
!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a){var b=0;null==this.drive&&"function"!==typeof window.DriveClient||b++;null==this.dropbox&&"function"!==typeof window.DropboxClient||b++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||b++;null!=this.gitHub&&b++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&b++;mxClient.IS_IOS||b++;return b};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();
|
||||
var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);var d=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!d);this.actions.get("print").setEnabled(!d);this.menus.get("exportAs").setEnabled(!d);this.menus.get("embed").setEnabled(!d);d="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(d);
|
||||
this.menus.get("newLibrary").setEnabled(d);this.menus.get("extras").setEnabled(d);a="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&a.isEditable();this.actions.get("image").setEnabled(b);this.actions.get("zoomIn").setEnabled(b);this.actions.get("zoomOut").setEnabled(b);this.actions.get("resetView").setEnabled(b);this.menus.get("edit").setEnabled(b);this.menus.get("view").setEnabled(b);this.menus.get("importFrom").setEnabled(a);this.menus.get("arrange").setEnabled(a);null!=this.toolbar&&
|
||||
(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(a),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(a));if(this.isOfflineApp()){var e=applicationCache;if(null!=e&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color=
|
||||
"#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML="";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var a=this.offlineStatus.getElementsByTagName("img");null!=a&&0<a.length&&this.alert(a[0].getAttribute("title"))}));var e=window.applicationCache,h=null,b=mxUtils.bind(this,function(){var a=e.status,b;a==e.CHECKING&&
|
||||
(a=e.DOWNLOADING);switch(a){case e.UNCACHED:b="";break;case e.IDLE:b='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';break;case e.DOWNLOADING:b='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case e.UPDATEREADY:b='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case e.OBSOLETE:b='<img title="Obsolete" border="0" src="'+IMAGE_PATH+
|
||||
'/clear.gif"/>';break;default:b='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}a!=h&&(this.offlineStatus.innerHTML=b,h=a)});mxEvent.addListener(e,"checking",b);mxEvent.addListener(e,"noupdate",b);mxEvent.addListener(e,"downloading",b);mxEvent.addListener(e,"progress",b);mxEvent.addListener(e,"cached",b);mxEvent.addListener(e,"updateready",b);mxEvent.addListener(e,"obsolete",b);mxEvent.addListener(e,"error",b);b()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=
|
||||
function(){};EditorUi.prototype.updateUserElement=function(){};var m=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){m.apply(this,arguments);var a=this.editor.graph,b=this.getCurrentFile(),d=null!=b&&b.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(d);this.actions.get("autosave").setEnabled(null!=b&&b.isEditable()&&b.isAutosaveOptional());this.actions.get("guides").setEnabled(d);this.actions.get("shadowVisible").setEnabled(d);
|
||||
this.actions.get("connectionArrows").setEnabled(d);this.actions.get("connectionPoints").setEnabled(d);this.actions.get("copyStyle").setEnabled(d&&!a.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(d&&!a.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(a.getModel().isVertex(a.getSelectionCell()));this.actions.get("createShape").setEnabled(d);this.actions.get("createRevision").setEnabled(d);this.actions.get("moveToFolder").setEnabled(null!=b);this.actions.get("makeCopy").setEnabled(null!=
|
||||
b&&!b.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.actions.get("publishLink").setEnabled(null!=b&&!b.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.menus.get("publish").setEnabled(null!=b&&!b.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(d&&null!=a&&null!=a.shape&&
|
||||
null!=a.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=function(a,b,d,e,h,k){var c=a.editor.graph;if("xml"==d)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==d)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(c.getSvg(e,h,k)),"image/svg+xml");else{var f=a.getFileData(!0,null,null,null,null,!0),g=c.getGraphBounds(),l=Math.floor(g.width*h/c.view.scale),m=Math.floor(g.height*
|
||||
h/c.view.scale);f.length<=MAX_REQUEST_SIZE&&l*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,d,function(a,b){return new mxXmlRequest(EXPORT_URL,"format="+d+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=e?e:"none")+"&w="+l+"&h="+m+"&border="+k+"&xml="+encodeURIComponent(f))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};
|
||||
c):mxscript("/js/extensions.min.js",c))};EditorUi.prototype.insertLucidChart=function(a,b,d,e,h){h=JSON.parse(a);a=[];if(null!=h.state){h=JSON.parse(h.state);for(var c in h.Pages)a.push(h.Pages[c]);a.sort(function(a,c){return a.Properties.Order<c.Properties.Order?-1:a.Properties.Order>c.Properties.Order?1:0})}else a.push(h);if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,d,e),null!=this.pages){var f=this.currentPage;for(b=1;b<a.length;b++)this.insertPage(),
|
||||
this.pasteLucidChart(a[b]);this.selectPage(f)}}finally{this.editor.graph.getModel().endUpdate()}}};EditorUi.prototype.insertTextAt=function(a,b,d,e,h,k,l){k=null!=k?k:!0;l=null!=l?l:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,
|
||||
b,d,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(h||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var c=this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var f=this.extractGraphModelFromPng(a),g=this.importXml(f,b,d,k,!0);if(0<g.length)return g}if("data:image/svg+xml;"==a.substring(0,19))try{if(f=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(f=a.substring(a.indexOf(",")+1),f=window.atob&&!mxClient.IS_SF?atob(f):Base64.decode(f,!0)):f=decodeURIComponent(a.substring(a.indexOf(",")+
|
||||
1)),g=this.importXml(f,b,d,k,!0),0<g.length)return g}catch(z){}this.loadImage(a,mxUtils.bind(this,function(e){if("data:"==a.substring(0,5))this.resizeImage(e,a,mxUtils.bind(this,function(a,e,f){c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),e,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),l,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/e.width,this.maxImageSize/
|
||||
e.height)),g=Math.round(e.width*f);e=Math.round(e.height*f);c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),g,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var f=null;c.getModel().beginUpdate();try{f=c.insertVertex(c.getDefaultParent(),null,a,c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.updateCellSize(f),c.fireEvent(new mxEventObject("textInserted","cells",
|
||||
[f]))}finally{c.getModel().endUpdate()}c.setSelectionCell(f)}))}else{a=this.editor.graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,d,k);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,d,k);else{c=this.editor.graph;h=null;c.getModel().beginUpdate();try{h=c.insertVertex(c.getDefaultParent(),null,"",c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.fireEvent(new mxEventObject("textInserted","cells",[h])),h.value=
|
||||
a,c.updateCellSize(h),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(h.value)&&c.setLinkForCell(h,h.value),h.geometry.width+=c.gridSize,h.geometry.height+=c.gridSize}finally{c.getModel().endUpdate()}return[h]}}return[]};EditorUi.prototype.formatFileSize=function(a){var c=-1;do a/=1024,c++;while(1024<a);return Math.max(a,.1).toFixed(1)+
|
||||
" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[c]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var c=a.indexOf(";");0<c&&(a=a.substring(0,c)+a.substring(a.indexOf(",",c+1)))}return a};EditorUi.prototype.isRemoteFileFormat=function(a,b){return/(\.*<graphml xmlns=\".*)/.test(a)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)||null!=b&&/(\.vsdx)($|\?)/i.test(b)||null!=b&&/(\.vssx)($|\?)/i.test(b)};EditorUi.prototype.importFile=function(a,b,d,e,h,k,l,n,m,r,z){r=
|
||||
null!=r?r:!0;var c=!1,f=null;"image"==b.substring(0,5)?(m=!1,"image/png"==b.substring(0,9)&&(b=z?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(f=this.importXml(b,d,e,r),m=!0)),m||(f=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),r&&f.isGridEnabled()&&(d=f.snap(d),e=f.snap(e)),f=[f.insertVertex(null,null,"",d,e,h,k,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+
|
||||
";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,l)?(c=!0,this.parseFile(null!=m?m:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){if(4==a.readyState){var c=null;200<=a.status&&299>=a.status&&(a=a.responseText,null!=a&&"<mxlibrary"==a.substring(0,10)?(null!=l&&".vssx"==l.toLowerCase().substring(l.length-5)&&(l=l.substring(0,l.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,a,l))):c=this.importXml(a,d,e,r));null!=n&&n(c)}}),l)):
|
||||
/(\.vsd)($|\?)/i.test(l)||(f=this.insertTextAt(this.validateFileData(a),d,e,!0,null,r));c||null==n||n(f);return f};EditorUi.prototype.base64Encode=function(a){for(var c="",b=0,d=a.length,e,k,l;b<d;){e=a.charCodeAt(b++)&255;if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);c+="==";break}k=a.charCodeAt(b++);if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2);c+="=";break}l=a.charCodeAt(b++);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2|(l&192)>>6);
|
||||
c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(l&63)}return c};EditorUi.prototype.importFiles=function(a,b,d,e,h,k,l,m,t,r,z,v){b=null!=b?b:0;d=null!=d?d:0;e=null!=e?e:this.maxImageSize;r=null!=r?r:this.maxImageBytes;var c=null!=b&&null!=d,f=!0,g=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var p=z||this.resampleThreshold,n=0;n<a.length;n++)if("image/"==a[n].type.substring(0,6)&&a[n].size>p){g=!0;break}var q=mxUtils.bind(this,function(){var g=this.editor.graph,p=g.gridSize;
|
||||
h=null!=h?h:mxUtils.bind(this,function(a,b,d,e,f,g,h,k,p){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,h)),null):this.importFile(a,b,d,e,f,g,h,k,p,c,v)});k=null!=k?k:mxUtils.bind(this,function(a){g.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var n=a.length,q=n,u=[],t=mxUtils.bind(this,function(a,c){u[a]=c;if(0==--q){this.spinner.stop();if(null!=m)m(u);else{var b=[];g.getModel().beginUpdate();
|
||||
try{for(var d=0;d<u.length;d++){var e=u[d]();null!=e&&(b=b.concat(e))}}finally{g.getModel().endUpdate()}}k(b)}}),y=0;y<n;y++)mxUtils.bind(this,function(c){var g=a[c],k=new FileReader;k.onload=mxUtils.bind(this,function(a){if(null==l||l(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var k=a.target.result,n=k.indexOf(","),m=atob(k.substring(n+1)),q=mxUtils.parseXml(m),m=q.getElementsByTagName("svg");if(0<m.length){var m=m[0],u=v?null:m.getAttribute("content");null!=u&&
|
||||
"<"!=u.charAt(0)&&"%"!=u.charAt(0)&&(u=unescape(window.atob?atob(u):Base64.decode(u,!0)));null!=u&&"%"==u.charAt(0)&&(u=decodeURIComponent(u));null==u||"<mxfile "!==u.substring(0,8)&&"<mxGraphModel "!==u.substring(0,14)?t(c,mxUtils.bind(this,function(){try{if(k.substring(0,n+1),null!=q){var a=q.getElementsByTagName("svg");if(0<a.length){var f=a[0],l=parseFloat(f.getAttribute("width")),m=parseFloat(f.getAttribute("height")),r=f.getAttribute("viewBox");if(null==r||0==r.length)f.setAttribute("viewBox",
|
||||
"0 0 "+l+" "+m);else if(isNaN(l)||isNaN(m)){var u=r.split(" ");3<u.length&&(l=parseFloat(u[2]),m=parseFloat(u[3]))}k=this.createSvgDataUri(mxUtils.getXml(a[0]));var t=Math.min(1,Math.min(e/Math.max(1,l)),e/Math.max(1,m));return h(k,g.type,b+c*p,d+c*p,Math.max(1,Math.round(l*t)),Math.max(1,Math.round(m*t)),g.name)}}}catch(ba){}return null})):t(c,mxUtils.bind(this,function(){return h(u,"text/xml",b+c*p,d+c*p,0,0,g.name)}))}}else{m=!1;if("image/png"==g.type){var y=v?null:this.extractGraphModelFromPng(a.target.result);
|
||||
if(null!=y&&0<y.length){var x=new Image;x.src=a.target.result;t(c,mxUtils.bind(this,function(){return h(y,"text/xml",b+c*p,d+c*p,x.width,x.height,g.name)}));m=!0}}m||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(k){this.resizeImage(k,
|
||||
a.target.result,mxUtils.bind(this,function(k,l,m){t(c,mxUtils.bind(this,function(){if(null!=k&&k.length<r){var n=f&&this.isResampleImage(a.target.result,z)?Math.min(1,Math.min(e/l,e/m)):1;return h(k,g.type,b+c*p,d+c*p,Math.round(l*n),Math.round(m*n),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),f,e,z)})))}else h(a.target.result,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})})});/(\.vsdx)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?
|
||||
h(null,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})},g):"image"==g.type.substring(0,5)?k.readAsDataURL(g):k.readAsText(g)})(y)});g?this.confirmImageResize(function(a){f=a;q()},t):q()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},d=function(b,d){mxSettings.setResizeImages(b?d:null);mxSettings.save();c();a(d)},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():
|
||||
null;null==e||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){d(a,!0)},function(a){d(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):d(!1,e)};EditorUi.prototype.parseFile=function(a,b,d){d=null!=d?d:a.name;var c=new FormData;
|
||||
c.append("format","xml");c.append("upfile",a,d);var e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(c)};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,d,e,h,k){h=null!=h?h:this.maxImageSize;var c=Math.max(1,a.width),f=Math.max(1,a.height);if(e&&this.isResampleImage(b,k))try{var g=Math.max(c/h,f/h);if(1<g){var l=Math.round(c/g),p=Math.round(f/g),m=document.createElement("canvas");
|
||||
m.width=l;m.height=p;m.getContext("2d").drawImage(a,0,0,l,p);var q=m.toDataURL();if(q.length<b.length){var x=document.createElement("canvas");x.width=l;x.height=p;var D=x.toDataURL();q!==D&&(b=q,c=l,f=p)}}}catch(A){}d(b,c,f)};EditorUi.prototype.crcTable=[];for(var b=0;256>b;b++)for(var e=b,d=0;8>d;d++)e=1==(e&1)?3988292384^e>>>1:e>>>1,EditorUi.prototype.crcTable[b]=e;EditorUi.prototype.updateCRC=function(a,b,d,e){for(var c=0;c<e;c++)a=EditorUi.prototype.crcTable[(a^b[d+c])&255]^a>>>8;return a};EditorUi.prototype.writeGraphModelToPng=
|
||||
function(a,b,d,e,h){function c(a,b){var c=k;k+=b;return a.substring(c,k)}function f(a){a=c(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+1);a=window.atob?atob(a):Base64.decode(a,!0);var k=0;if(c(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=h&&h();else if(c(a,4),"IHDR"!=c(a,4))null!=h&&h();else{c(a,17);h=a.substring(0,
|
||||
k);do{var l=f(a);if("IDAT"==c(a,4)){h=a.substring(0,k-8);d=d+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+e;e=4294967295;e=this.updateCRC(e,b,0,4);e=this.updateCRC(e,d,0,d.length);h+=g(d.length)+b+d+g(e^4294967295);h+=a.substring(k-8,a.length);break}h+=a.substring(k-8,k-4+l);e=c(a,l);c(a,4)}while(l);return"data:image/png;base64,"+(window.btoa?btoa(h):Base64.encode(h,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=
|
||||
window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g," "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(h){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));
|
||||
null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,d){var c=new Image;c.onload=function(){b(c)};null!=d&&(c.onerror=d);c.src=a};var k=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a){var c=a.indexOf(",");0<c&&(a=b.getPageById(a.substring(c+1)))&&b.selectPage(a)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,d=this.editor.graph,e=d.addClickHandler;d.addClickHandler=function(b,
|
||||
c,f){var g=c;c=function(b,c){if(null==c){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(c=e.getAttribute("href"))}null!=c&&d.isPageLink(c)&&(a(c),mxEvent.consume(b));null!=g&&g(b,c)};e.call(this,b,c,f)};k.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(d.view.canvas.ownerSVGElement,null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");
|
||||
var h=d.getGlobalVariable;d.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:h.apply(this,arguments)};var l=d.createLinkForHint;d.createLinkForHint=function(c,e){var f=d.isPageLink(c);if(f){var g=c.indexOf(",");0<g&&(g=b.getPageById(c.substring(g+1)),e=null!=g?g.getName():mxResources.get("pageNotFound"))}g=l.apply(this,arguments);f&&mxEvent.addListener(g,"click",
|
||||
function(b){a(c);mxEvent.consume(b)});return g};var m=d.labelLinkClicked;d.labelLinkClicked=function(b,c,e){var f=c.getAttribute("href");d.isPageLink(f)?(a(f),mxEvent.consume(e)):m.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=null!=c.getTitle()?c.getTitle():a);return a};var n=this.actions.get("print");n.setEnabled(!mxClient.IS_IOS||!navigator.standalone);n.visible=n.isEnabled();if(!this.editor.chromeless){var t=function(){window.setTimeout(function(){r.innerHTML=
|
||||
" ";r.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||d.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=
|
||||
this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.originalEvent.clipboardData,d=!1,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var g=f[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var h=this.editor.graph.getInsertPoint();
|
||||
this.importFiles([g.getAsFile()],h.x,h.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(I){}}),!1);var r=document.createElement("div");r.style.position="absolute";r.style.whiteSpace="nowrap";r.style.overflow="hidden";r.style.display="block";r.contentEditable=!0;mxUtils.setOpacity(r,0);r.style.width="1px";r.style.height="1px";r.innerHTML=" ";var z=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,
|
||||
"keydown",mxUtils.bind(this,function(a){var b=mxEvent.getSource(a);null==d.container||!d.isEnabled()||d.isMouseDown||d.isEditing()||null!=this.dialog||"INPUT"==b.nodeName||"TEXTAREA"==b.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||z||(r.style.left=d.container.scrollLeft+10+"px",r.style.top=d.container.scrollTop+10+"px",d.container.appendChild(r),z=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){r.focus();document.execCommand("selectAll",!1,null)},
|
||||
0):(r.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var b=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!z||224!=b&&17!=b&&91!=b||(z=!1,d.isEditing()||null!=this.dialog||null==d.container||d.container.focus(),r.parentNode.removeChild(r))}),0)}));mxEvent.addListener(r,"copy",mxUtils.bind(this,function(a){d.isEnabled()&&(mxClipboard.copy(d),this.copyCells(r),t())}));mxEvent.addListener(r,"cut",mxUtils.bind(this,function(a){d.isEnabled()&&
|
||||
(this.copyCells(r,!0),t())}));mxEvent.addListener(r,"paste",mxUtils.bind(this,function(a){d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())&&(r.innerHTML=" ",r.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,r);r.innerHTML=" "}),0))}),!0);var v=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==r?!0:v.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||
|
||||
0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();
|
||||
a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");
|
||||
/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,
|
||||
"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){n=document.createElement("div");n.style.position="absolute";n.style.top="95px";n.style.left="250px";n.style.width="2000px";n.style.height="30px";n.style.background="whiteSmoke";document.body.appendChild(n);var w=document.createElement("div");w.style.position="absolute";w.style.top="125px";w.style.left="220px";
|
||||
w.style.width="30px";w.style.height="1000px";w.style.background="whiteSmoke";document.body.appendChild(w);var x=document.createElement("div");x.style.position="absolute";x.style.top="95px";x.style.left="220px";x.style.width="30px";x.style.height="30px";x.style.background="whiteSmoke";document.body.appendChild(x);this.vRuler=new mxRuler(this.editor.graph,w,!0);this.hRuler=new mxRuler(this.editor.graph,n,!1)}if("1"==urlParams.test){n=document.getElementById("geFooter");null!=n&&(this.styleInput=document.createElement("input"),
|
||||
this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),n.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,
|
||||
mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var D=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:D.apply(this,arguments)}}n=document.getElementById("geInfo");null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport){var A=
|
||||
null;mxEvent.addListener(d.container,"dragleave",function(a){d.isEnabled()&&(null!=A&&(A.parentNode.removeChild(A),A=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(d.container,"dragover",mxUtils.bind(this,function(a){null==A&&(!mxClient.IS_IE||10<document.documentMode)&&(A=this.highlightElement(d.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(d.container,"drop",mxUtils.bind(this,function(a){null!=A&&(A.parentNode.removeChild(A),
|
||||
A=null);if(d.isEnabled()){var b=mxUtils.convertPoint(d.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),c=d.view.translate,e=d.view.scale,f=b.x/e-c.x,g=b.y/e-c.y;mxEvent.isAltDown(a)&&(g=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,f,g,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var h=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,b=this.extractGraphModelFromEvent(a,
|
||||
null!=this.pages);if(null!=b)d.setSelectionCells(this.importXml(b,f,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var k=a.dataTransfer.getData("text/html"),b=document.createElement("div");b.innerHTML=k;var l=null,c=b.getElementsByTagName("img");null!=c&&1==c.length?(k=c[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)||(l=!0)):(b=b.getElementsByTagName("a"),null!=b&&1==b.length&&(k=b[0].getAttribute("href")));var p=!0,m=mxUtils.bind(this,function(){d.setSelectionCells(this.insertTextAt(k,
|
||||
f,g,!0,l,null,p))});l&&k.length>this.resampleThreshold?this.confirmImageResize(function(a){p=a;m()},mxEvent.isControlDown(a)):m()}else null!=h&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(h)?this.loadImage(decodeURIComponent(h),mxUtils.bind(this,function(a){var b=Math.max(1,a.width);a=Math.max(1,a.height);var c=this.maxImageSize,c=Math.min(1,Math.min(c/Math.max(1,b)),c/Math.max(1,a));d.setSelectionCell(d.insertVertex(null,null,"",f,g,b*c,a*c,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
||||
h+";"))}),mxUtils.bind(this,function(a){d.setSelectionCells(this.insertTextAt(h,f,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&d.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),f,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=
|
||||
mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),
|
||||
this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",
|
||||
mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||
|
||||
0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=
|
||||
e,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.importLucidChart(d,0,0),mxEvent.consume(a))}else{var d=this.editor.graph,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):
|
||||
b.textContent),f=!1;try{var k=e.lastIndexOf("%3E");0<=k&&k<e.length-3&&(e=e.substring(0,k+3))}catch(t){}try{var c=b.getElementsByTagName("span"),l=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(e);this.isCompatibleString(l)&&(f=!0,e=l)}catch(t){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),
|
||||
d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(t){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),
|
||||
b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),
|
||||
"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,
|
||||
"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,
|
||||
function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;
|
||||
var k=document.documentElement;d=(e.clientWidth||k.clientWidth)-3;e=Math.max(e.clientHeight||0,k.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,e=a.clientHeight;k=document.createElement("div");k.style.zIndex=mxPopupMenu.prototype.zIndex+2;k.style.border="3px dotted rgb(254, 137, 12)";k.style.pointerEvents="none";k.style.position="absolute";k.style.top=b+"px";k.style.left=c+"px";k.style.width=Math.max(0,d-3)+"px";k.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?
|
||||
this.editor.graph.container.appendChild(k):document.body.appendChild(k);return k};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=
|
||||
0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var d=c.target.result,e=a.name;if(null!=e&&0<e.length)if(/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml",this.parseFile(a,mxUtils.bind(this,function(a){if(4==a.readyState)if(this.spinner.stop(),200<=a.status&&299>=
|
||||
a.status)if(a=a.responseText,"<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);null!=e&&".vssx"==e.toLowerCase().substring(e.length-5)&&(e=e.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(r){this.handleError(r,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b);else this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(t){this.handleError(t,mxResources.get("errorLoadingFile"))}}else"image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=
|
||||
function(a,b,d){var c=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var c=mxUtils.parseXml(a);null!=c&&(this.editor.setGraphXml(c.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,d))});null!=a&&0<a.length&&(null!=c&&c.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),
|
||||
null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):e())};EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],d;for(d in a)b.push(d);return b};EditorUi.prototype.addBasenamesForCell=function(a,
|
||||
b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=
|
||||
function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,
|
||||
function(a,b,d){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.showLayersDialog()):(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=d?d:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&
|
||||
(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=
|
||||
null,k=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,k);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){function g(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==
|
||||
a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=this.editor.graph.decompress(a)))}catch(K){}return a}var h=f.data;if("json"==urlParams.proto){try{h=JSON.parse(h)}catch(J){h=null}if(null==h)return;if("dialog"==h.action){this.showError(null!=h.titleKey?mxResources.get(h.titleKey):h.title,null!=h.messageKey?mxResources.get(h.messageKey):h.message,null!=h.buttonKey?mxResources.get(h.buttonKey):h.button);null!=h.modified&&(this.editor.modified=
|
||||
h.modified);return}if("prompt"==h.action){this.spinner.stop();var k=new FilenameDialog(this,h.defaultValue||"",null!=h.okKey?mxResources.get(h.okKey):null,function(a){null!=a&&l.postMessage(JSON.stringify({event:"prompt",value:a,message:h}),"*")},null!=h.titleKey?mxResources.get(h.titleKey):h.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==h.action){k=null;k="data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):g(h.xml);this.spinner.stop();
|
||||
k=new DraftDialog(this,mxResources.get("draftFound",[h.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"edit",message:h}),"*")}),mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"discard",message:h}),"*")}),h.editKey?mxResources.get(h.editKey):null,h.discardKey?mxResources.get(h.discardKey):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&
|
||||
this.actions.get("exit").funct()}));try{k.init()}catch(J){l.postMessage(JSON.stringify({event:"draft",error:J.toString(),message:h}),"*")}return}if("template"==h.action){this.spinner.stop();k=new NewDialog(this,!1,null!=h.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=h.callback?l.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(k.container,
|
||||
620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("status"==h.action){null!=h.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(h.messageKey))):null!=h.message&&this.editor.setStatus(mxUtils.htmlEntities(h.message));null!=h.modified&&(this.editor.modified=h.modified);return}if("spinner"==h.action){var m=null!=h.messageKey?mxResources.get(h.messageKey):h.message;null==h.show||h.show?this.spinner.spin(document.body,m):this.spinner.stop();
|
||||
return}if("export"==h.action){if("png"==h.format||"xmlpng"==h.format){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,null!=h.spinKey?mxResources.get(h.spinKey):h.spin)){var p=null!=h.xml?h.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var n=this.editor.graph,q=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=h.format;b.xml=encodeURIComponent(p);b.data=a;l.postMessage(JSON.stringify(b),
|
||||
"*")}),u=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==h.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(p))));n!=this.editor.graph&&n.container.parentNode.removeChild(n.container);q(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var n=this.createTemporaryGraph(n.getStylesheet()),y=n.getGlobalVariable,B=this.pages[0];n.getGlobalVariable=function(a){return"page"==a?B.getName():"pagenumber"==
|
||||
a?1:y.apply(this,arguments)};document.body.appendChild(n.container);n.model.setRoot(B.root)}this.exportToCanvas(mxUtils.bind(this,function(a){u(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){u(null)}),null,null,null,null,null,null,n)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==h.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(p)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?q("data:image/png;base64,"+
|
||||
a.getText()):u(null)}),mxUtils.bind(this,function(){u(null)}))}}else{null!=h.xml&&0<h.xml.length&&this.setFileData(h.xml);m=this.createLoadMessage("export");if("html2"==h.format||"html"==h.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=this.getXmlFileData(),m.xml=mxUtils.getXml(k),m.data=this.getFileData(null,null,!0,null,null,null,k),m.format=h.format;else if("html"==h.format)p=this.editor.getGraphXml(),m.data=this.getHtml(p,this.editor.graph),m.xml=mxUtils.getXml(p),m.format=
|
||||
h.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);m.xml=this.getFileData(!0);m.format="svg";if(h.embedImages||null==h.embedImages){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,null!=h.spinKey?mxResources.get(h.spinKey):h.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==h.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=
|
||||
this.createSvgDataUri(a);l.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(a));l.postMessage(JSON.stringify(m),"*")}));return}k="xmlsvg"==h.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));m.data=this.createSvgDataUri(k)}l.postMessage(JSON.stringify(m),"*")}return}if("load"==
|
||||
h.action)d=1==h.autosave,this.hideDialog(),null!=h.modified&&null==urlParams.modified&&(urlParams.modified=h.modified),null!=h.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=h.saveAndExit),null!=h.title&&null!=this.buttonContainer&&(k=document.createElement("span"),mxUtils.write(k,h.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop=
|
||||
"6px"),this.buttonContainer.appendChild(k)),h=null!=h.xmlpng?this.extractGraphModelFromPng(h.xmlpng):null!=h.xml&&"data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):h.xml;else{l.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(h)}),"*");return}}h=g(h);c=!0;try{a(h,f)}catch(J){this.handleError(J)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var C=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?
|
||||
this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=C();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=C();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",
|
||||
b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||l.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var l=window.opener||window.parent,k="json"==urlParams.proto?JSON.stringify({event:"init"}):
|
||||
urlParams.ready||"ready";l.postMessage(k,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");b.className="geBigButton";b.style.fontSize="12px";
|
||||
b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));a.appendChild(b);"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),
|
||||
a.appendChild(b));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=
|
||||
function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a){try{var b=a.split("\n"),c=[];if(0<b.length){var d={},e=null,k=null,l="auto",m="auto",t=40,r=40,z=0,v=this.editor.graph;v.getGraphBounds();
|
||||
for(var w=function(){v.setSelectionCells(P);v.scrollCellToVisible(v.getSelectionCell())},x=v.getFreeInsertPoint(),D=x.x,A=x.y,x=A,y=null,B="auto",C=[],J=null,K=null,L=0;L<b.length&&"#"==b[L].charAt(0);){a=b[L];for(L++;L<b.length&&"\\"==a.charAt(a.length-1)&&"#"==b[L].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(b[L].substring(1)),L++;if("#"!=a.charAt(1)){var W=a.indexOf(":");if(0<W){var H=mxUtils.trim(a.substring(1,W)),I=mxUtils.trim(a.substring(W+1));"label"==H?y=v.sanitizeHtml(I):"style"==
|
||||
H?e=I:"identity"==H&&0<I.length&&"-"!=I?k=I:"width"==H?l=I:"height"==H?m=I:"ignore"==H?K=I.split(","):"connect"==H?C.push(JSON.parse(I)):"link"==H?J=I:"padding"==H?z=parseFloat(I):"edgespacing"==H?t=parseFloat(I):"nodespacing"==H?r=parseFloat(I):"layout"==H&&(B=I)}}}var T=this.editor.csvToArray(b[L]);a=null;if(null!=k)for(var G=0;G<T.length;G++)if(k==T[G]){a=G;break}null==y&&(y="%"+T[0]+"%");if(null!=C)for(var F=0;F<C.length;F++)null==d[C[F].to]&&(d[C[F].to]={});v.model.beginUpdate();try{for(G=L+
|
||||
1;G<b.length;G++){var N=this.editor.csvToArray(b[G]);if(N.length==T.length){var E=null,S=null!=a?N[a]:null;null!=S&&(E=v.model.getCell(S));null==E&&(E=new mxCell(y,new mxGeometry(D,x,0,0),e||"whiteSpace=wrap;html=1;"),E.vertex=!0,E.id=S);for(var O=0;O<N.length;O++)v.setAttributeForCell(E,T[O],N[O]);v.setAttributeForCell(E,"placeholders","1");E.style=v.replacePlaceholders(E,E.style);for(F=0;F<C.length;F++)d[C[F].to][E.getAttribute(C[F].to)]=E;null!=J&&"link"!=J&&(v.setLinkForCell(E,E.getAttribute(J)),
|
||||
v.setAttributeForCell(E,J,null));var U=this.editor.graph.getPreferredSizeForCell(E);E.geometry.width="auto"==l?U.width+z:parseFloat(l);E.geometry.height="auto"==m?U.height+z:parseFloat(m);x+=E.geometry.height+r;c.push(v.addCell(E))}}null==e&&v.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var Q=c.slice(),P=c.slice(),F=0;F<C.length;F++)for(var R=C[F],G=0;G<c.length;G++){var E=c[G],X=E.getAttribute(R.from);if(null!=X){v.setAttributeForCell(E,R.from,null);for(var V=X.split(","),O=0;O<V.length;O++){var Y=
|
||||
d[R.to][V[O]];null!=Y&&(P.push(v.insertEdge(null,null,R.label||"",R.invert?Y:E,R.invert?E:Y,R.style||v.createCurrentEdgeStyle())),mxUtils.remove(R.invert?E:Y,Q))}}}if(null!=K)for(G=0;G<c.length;G++)for(E=c[G],O=0;O<K.length;O++)v.setAttributeForCell(E,mxUtils.trim(K[O]),null);var Z=new mxParallelEdgeLayout(v);Z.spacing=t;var fa=function(){Z.execute(v.getDefaultParent());for(var a=0;a<c.length;a++){var b=v.getCellGeometry(c[a]);b.x=Math.round(v.snap(b.x));b.y=Math.round(v.snap(b.y));"auto"==l&&(b.width=
|
||||
Math.round(v.snap(b.width)));"auto"==m&&(b.height=Math.round(v.snap(b.height)))}};if("circle"==B){var aa=new mxCircleLayout(v);aa.resetEdges=!1;var ja=aa.isVertexIgnored;aa.isVertexIgnored=function(a){return ja.apply(this,arguments)||0>mxUtils.indexOf(c,a)};this.executeLayout(function(){aa.execute(v.getDefaultParent());fa()},!0,w);w=null}else if("horizontaltree"==B||"verticaltree"==B||"auto"==B&&P.length==2*c.length-1&&1==Q.length){v.view.validate();var ba=new mxCompactTreeLayout(v,"horizontaltree"==
|
||||
B);ba.levelDistance=r;ba.edgeRouting=!1;ba.resetEdges=!1;this.executeLayout(function(){ba.execute(v.getDefaultParent(),0<Q.length?Q[0]:null)},!0,w);w=null}else if("horizontalflow"==B||"verticalflow"==B||"auto"==B&&1==Q.length){v.view.validate();var ga=new mxHierarchicalLayout(v,"horizontalflow"==B?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);ga.intraCellSpacing=r;ga.disableEdgeStyle=!1;this.executeLayout(function(){ga.execute(v.getDefaultParent(),P);v.moveCells(P,D,A)},!0,w);w=null}else if("organic"==
|
||||
B||"auto"==B&&P.length>c.length){v.view.validate();var ca=new mxFastOrganicLayout(v);ca.forceConstant=3*r;ca.resetEdges=!1;var na=ca.isVertexIgnored;ca.isVertexIgnored=function(a){return na.apply(this,arguments)||0>mxUtils.indexOf(c,a)};Z=new mxParallelEdgeLayout(v);Z.spacing=t;this.executeLayout(function(){ca.execute(v.getDefaultParent());fa()},!0,w);w=null}this.hideDialog()}finally{v.model.endUpdate()}null!=w&&w()}}catch(ka){this.handleError(ka)}};EditorUi.prototype.getSearch=function(a){var b=
|
||||
"";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),
|
||||
d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,d){a=new LinkDialog(this,a,b,d,!0);this.showDialog(a.container,420,120,!0,!0);a.init()};var l=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=l.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*
|
||||
b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/
|
||||
a,8/a)};var k=b.init;b.init=function(){k.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=
|
||||
e.pageFormat;f.background=e.background;f.pageVisible=e.pageVisible;f.background=e.background;var g=mxUtils.getCurrentStyle(e.container);f.container.style.backgroundColor=g.backgroundColor;null!=e.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=e.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a){var b=0;null==this.drive&&"function"!==typeof window.DriveClient||
|
||||
b++;null==this.dropbox&&"function"!==typeof window.DropboxClient||b++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||b++;null!=this.gitHub&&b++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&b++;mxClient.IS_IOS||b++;return b};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);
|
||||
var d=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!d);this.actions.get("print").setEnabled(!d);this.menus.get("exportAs").setEnabled(!d);this.menus.get("embed").setEnabled(!d);d="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(d);this.menus.get("newLibrary").setEnabled(d);this.menus.get("extras").setEnabled(d);a="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=
|
||||
a&&a.isEditable();this.actions.get("image").setEnabled(b);this.actions.get("zoomIn").setEnabled(b);this.actions.get("zoomOut").setEnabled(b);this.actions.get("resetView").setEnabled(b);this.menus.get("edit").setEnabled(b);this.menus.get("view").setEnabled(b);this.menus.get("importFrom").setEnabled(a);this.menus.get("arrange").setEnabled(a);null!=this.toolbar&&(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(a),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(a));
|
||||
if(this.isOfflineApp()){var e=applicationCache;if(null!=e&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color="#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML=
|
||||
"";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var a=this.offlineStatus.getElementsByTagName("img");null!=a&&0<a.length&&this.alert(a[0].getAttribute("title"))}));var e=window.applicationCache,h=null,b=mxUtils.bind(this,function(){var a=e.status,b;a==e.CHECKING&&(a=e.DOWNLOADING);switch(a){case e.UNCACHED:b="";break;case e.IDLE:b='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';
|
||||
break;case e.DOWNLOADING:b='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case e.UPDATEREADY:b='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case e.OBSOLETE:b='<img title="Obsolete" border="0" src="'+IMAGE_PATH+'/clear.gif"/>';break;default:b='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}a!=h&&(this.offlineStatus.innerHTML=b,h=a)});mxEvent.addListener(e,
|
||||
"checking",b);mxEvent.addListener(e,"noupdate",b);mxEvent.addListener(e,"downloading",b);mxEvent.addListener(e,"progress",b);mxEvent.addListener(e,"cached",b);mxEvent.addListener(e,"updateready",b);mxEvent.addListener(e,"obsolete",b);mxEvent.addListener(e,"error",b);b()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=function(){};EditorUi.prototype.updateUserElement=function(){};var m=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){m.apply(this,
|
||||
arguments);var a=this.editor.graph,b=this.getCurrentFile(),d=null!=b&&b.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(d);this.actions.get("autosave").setEnabled(null!=b&&b.isEditable()&&b.isAutosaveOptional());this.actions.get("guides").setEnabled(d);this.actions.get("shadowVisible").setEnabled(d);this.actions.get("connectionArrows").setEnabled(d);this.actions.get("connectionPoints").setEnabled(d);this.actions.get("copyStyle").setEnabled(d&&
|
||||
!a.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(d&&!a.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(a.getModel().isVertex(a.getSelectionCell()));this.actions.get("createShape").setEnabled(d);this.actions.get("createRevision").setEnabled(d);this.actions.get("moveToFolder").setEnabled(null!=b);this.actions.get("makeCopy").setEnabled(null!=b&&!b.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&
|
||||
!b.isRestricted());this.actions.get("publishLink").setEnabled(null!=b&&!b.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.menus.get("publish").setEnabled(null!=b&&!b.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(d&&null!=a&&null!=a.shape&&null!=a.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=
|
||||
function(a,b,d,e,h,k){var c=a.editor.graph;if("xml"==d)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==d)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(c.getSvg(e,h,k)),"image/svg+xml");else{var f=a.getFileData(!0,null,null,null,null,!0),g=c.getGraphBounds(),l=Math.floor(g.width*h/c.view.scale),m=Math.floor(g.height*h/c.view.scale);f.length<=MAX_REQUEST_SIZE&&l*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,d,function(a,b){return new mxXmlRequest(EXPORT_URL,
|
||||
"format="+d+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=e?e:"none")+"&w="+l+"&h="+m+"&border="+k+"&xml="+encodeURIComponent(f))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};
|
||||
DiagramPage.prototype.getName=function(){return this.node.getAttribute("name")};DiagramPage.prototype.setName=function(a){null==a?this.node.removeAttribute("name"):this.node.setAttribute("name",a)};function RenamePage(a,b,e){this.ui=a;this.page=b;this.previous=e}RenamePage.prototype.execute=function(){var a=this.page.getName();this.page.setName(this.previous);this.previous=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageRenamed"))};
|
||||
function MovePage(a,b,e){this.ui=a;this.oldIndex=b;this.newIndex=e}MovePage.prototype.execute=function(){this.ui.pages.splice(this.newIndex,0,this.ui.pages.splice(this.oldIndex,1)[0]);var a=this.oldIndex;this.oldIndex=this.newIndex;this.newIndex=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageMoved"))};
|
||||
function SelectPage(a,b){this.ui=a;this.previousPage=this.page=b;this.neverShown=!0;null!=b&&(this.neverShown=null==b.viewState,this.ui.updatePageRoot(b))}
|
||||
|
|
249
war/js/atlas.min.js
vendored
249
war/js/atlas.min.js
vendored
|
@ -6158,7 +6158,7 @@ K=document.createElement("tr"),N=K.cloneNode(!0),Q=document.createElement("td"),
|
|||
mxResources.get("fitToSheetsAcross"));W.appendChild(d);mxUtils.write(P,mxResources.get("fitToBy"));var R=O.cloneNode(!0);Y.appendChild(R);mxEvent.addListener(O,"focus",function(){J.checked=!0});mxEvent.addListener(R,"focus",function(){J.checked=!0});d=document.createElement("span");mxUtils.write(d,mxResources.get("fitToSheetsDown"));U.appendChild(d);K.appendChild(Q);K.appendChild(I);K.appendChild(W);N.appendChild(P);N.appendChild(Y);N.appendChild(U);T.appendChild(K);T.appendChild(N);t.appendChild(T);
|
||||
n.appendChild(t);k.appendChild(n);n=document.createElement("div");d=document.createElement("div");d.style.fontWeight="bold";d.style.marginBottom="12px";mxUtils.write(d,mxResources.get("paperSize"));n.appendChild(d);d=document.createElement("div");d.style.marginBottom="12px";var V=PageSetupDialog.addPageFormatPanel(d,"printdialog",b.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);n.appendChild(d);d=document.createElement("span");mxUtils.write(d,mxResources.get("pageScale"));n.appendChild(d);
|
||||
var S=document.createElement("input");S.style.cssText="margin:0 8px 0 8px;";S.setAttribute("value","100 %");S.style.width="60px";n.appendChild(S);k.appendChild(n);d=document.createElement("div");d.style.cssText="text-align:right;margin:62px 0 0 0;";n=mxUtils.button(mxResources.get("cancel"),function(){b.hideDialog()});n.className="geBtn";b.editor.cancelFirst&&d.appendChild(n);b.isOffline()||(t=mxUtils.button(mxResources.get("help"),function(){window.open("https://desk.draw.io/support/solutions/articles/16000048947")}),
|
||||
t.className="geBtn",d.appendChild(t));PrintDialog.previewEnabled&&(t=mxUtils.button(mxResources.get("preview"),function(){b.hideDialog();c(!1)}),t.className="geBtn",d.appendChild(t));t=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){b.hideDialog();c(!0)});t.className="geBtn gePrimaryBtn";d.appendChild(t);b.editor.cancelFirst||d.appendChild(n);k.appendChild(d);this.container=k}})();(function(){EditorUi.VERSION="6.9.8";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
|
||||
t.className="geBtn",d.appendChild(t));PrintDialog.previewEnabled&&(t=mxUtils.button(mxResources.get("preview"),function(){b.hideDialog();c(!1)}),t.className="geBtn",d.appendChild(t));t=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){b.hideDialog();c(!0)});t.className="geBtn gePrimaryBtn";d.appendChild(t);b.editor.cancelFirst||d.appendChild(n);k.appendChild(d);this.container=k}})();(function(){EditorUi.VERSION="6.9.9";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname);EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.sidebarFooterHeight=
|
||||
36;EditorUi.prototype.defaultCustomShapeStyle="shape=stencil(tZRtTsQgEEBPw1+DJR7AoN6DbWftpAgE0Ortd/jYRGq72R+YNE2YgTePloEJGWblgA18ZuKFDcMj5/Sm8boZq+BgjCX4pTyqk6ZlKROitwusOMXKQDODx5iy4pXxZ5qTHiFHawxB0JrQZH7lCabQ0Fr+XWC1/E8zcsT/gAi+Subo2/3Mh6d/oJb5nU1b5tW7r2knautaa3T+U32o7f7vZwpJkaNDLORJjcu7t59m2jXxqX9un+tt022acsfmoKaQZ+vhhswZtS6Ne/ThQGt0IV0N3Yyv6P3CeT9/tHO0XFI5cAE=);whiteSpace=wrap;html=1;";EditorUi.prototype.maxBackgroundSize=1600;EditorUi.prototype.maxImageSize=520;EditorUi.prototype.resampleThreshold=
|
||||
1E5;EditorUi.prototype.maxImageBytes=1E6;EditorUi.prototype.maxBackgroundBytes=25E5;EditorUi.prototype.currentFile=null;EditorUi.prototype.printPdfExport=!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;(function(){EditorUi.prototype.useCanvasForExport=!1;EditorUi.prototype.jpgSupported=!1;try{var b=document.createElement("canvas"),a=new Image;a.onload=function(){try{b.getContext("2d").drawImage(a,0,0);var e=b.toDataURL("image/png");EditorUi.prototype.useCanvasForExport=
|
||||
null!=e&&6<e.length}catch(n){}};a.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1px" height="1px" version="1.1"><foreignObject pointer-events="all" width="1" height="1"><div xmlns="http://www.w3.org/1999/xhtml"></div></foreignObject></svg>')))}catch(k){}try{b=document.createElement("canvas");b.width=b.height=1;var c=b.toDataURL("image/jpeg");EditorUi.prototype.jpgSupported=null!==c.match("image/jpeg")}catch(k){}})();
|
||||
|
@ -6255,12 +6255,12 @@ g.appendChild(h);var p=this.getCurrentFile();null==c&&null!=p&&p.constructor==wi
|
|||
this.addLinkSection(e),m=this.addCheckbox(e,mxResources.get("zoom"),!0,null,!0);mxUtils.write(e,":");var A=document.createElement("input");A.setAttribute("type","text");A.style.marginRight="16px";A.style.width="60px";A.style.marginLeft="4px";A.style.marginRight="12px";A.value="100%";e.appendChild(A);var D=this.addCheckbox(e,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,y=y=this.addCheckbox(e,mxResources.get("allPages"),g,!g),B=this.addCheckbox(e,mxResources.get("layers"),!0),
|
||||
C=this.addCheckbox(e,mxResources.get("lightbox"),!0),z=this.addEditButton(e,C),F=z.getEditInput();F.style.marginBottom="16px";mxEvent.addListener(C,"change",function(){C.checked?F.removeAttribute("disabled"):F.setAttribute("disabled","disabled");F.checked&&C.checked?z.getEditSelect().removeAttribute("disabled"):z.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,e,mxUtils.bind(this,function(){d(k.checked?c:null,m.checked,A.value,l.getTarget(),l.getColor(),D.checked,y.checked,
|
||||
B.checked,C.checked,z.getLink())}),null,b,a);this.showDialog(b.container,340,360,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(b,a,c,d,f,h){var e=document.createElement("div");e.style.whiteSpace="nowrap";var g=document.createElement("h3");mxUtils.write(g,b||mxResources.get("link"));g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(g);var k=this.getCurrentFile(),g="https://desk.draw.io/support/solutions/articles/16000051941";b=0;if(null!=
|
||||
k&&k.constructor==window.DriveFile&&!a){b=80;var g="https://desk.draw.io/support/solutions/articles/16000039384",p=document.createElement("div");p.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var l=document.createElement("div");l.style.whiteSpace="normal";mxUtils.write(l,mxResources.get("linkAccountRequired"));p.appendChild(l);l=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(k.getId())}));
|
||||
l.style.marginTop="12px";l.className="geBtn";p.appendChild(l);e.appendChild(p);l=document.createElement("a");l.style.paddingLeft="12px";l.style.color="gray";l.style.fontSize="11px";l.setAttribute("href","javascript:void(0);");mxUtils.write(l,mxResources.get("check"));p.appendChild(l);mxEvent.addListener(l,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(b){this.spinner.stop();b=new ErrorDialog(this,
|
||||
null,mxResources.get(null!=b?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(b.container,300,80,!0,!1);b.init()}))}))}var n=null,m=null;if(null!=c||null!=d)b+=30,mxUtils.write(e,mxResources.get("width")+":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.marginRight="16px",n.style.width="50px",n.style.marginLeft="6px",n.style.marginRight="16px",n.style.marginBottom="10px",n.value="100%",e.appendChild(n),mxUtils.write(e,mxResources.get("height")+
|
||||
k&&k.constructor==window.DriveFile&&!a){b=80;var g="https://desk.draw.io/support/solutions/articles/16000039384",p=document.createElement("div");p.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var n=document.createElement("div");n.style.whiteSpace="normal";mxUtils.write(n,mxResources.get("linkAccountRequired"));p.appendChild(n);n=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(k.getId())}));
|
||||
n.style.marginTop="12px";n.className="geBtn";p.appendChild(n);e.appendChild(p);n=document.createElement("a");n.style.paddingLeft="12px";n.style.color="gray";n.style.fontSize="11px";n.setAttribute("href","javascript:void(0);");mxUtils.write(n,mxResources.get("check"));p.appendChild(n);mxEvent.addListener(n,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(b){this.spinner.stop();b=new ErrorDialog(this,
|
||||
null,mxResources.get(null!=b?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(b.container,300,80,!0,!1);b.init()}))}))}var l=null,m=null;if(null!=c||null!=d)b+=30,mxUtils.write(e,mxResources.get("width")+":"),l=document.createElement("input"),l.setAttribute("type","text"),l.style.marginRight="16px",l.style.width="50px",l.style.marginLeft="6px",l.style.marginRight="16px",l.style.marginBottom="10px",l.value="100%",e.appendChild(l),mxUtils.write(e,mxResources.get("height")+
|
||||
":"),m=document.createElement("input"),m.setAttribute("type","text"),m.style.width="50px",m.style.marginLeft="6px",m.style.marginBottom="10px",m.value=d+"px",e.appendChild(m),mxUtils.br(e);var v=this.addLinkSection(e,h);c=null!=this.pages&&1<this.pages.length;var y=null;if(null==k||k.constructor!=window.DriveFile||a)y=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var B=this.addCheckbox(e,mxResources.get("lightbox"),!0),C=this.addEditButton(e,B),z=C.getEditInput(),F=this.addCheckbox(e,mxResources.get("layers"),
|
||||
!0);F.style.marginLeft=z.style.marginLeft;F.style.marginBottom="16px";F.style.marginTop="8px";mxEvent.addListener(B,"change",function(){B.checked?(F.removeAttribute("disabled"),z.removeAttribute("disabled")):(F.setAttribute("disabled","disabled"),z.setAttribute("disabled","disabled"));z.checked&&B.checked?C.getEditSelect().removeAttribute("disabled"):C.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){f(v.getTarget(),v.getColor(),null==y?
|
||||
!0:y.checked,B.checked,C.getLink(),F.checked,null!=n?n.value:null,null!=m?m.value:null)}),null,mxResources.get("create"),g);this.showDialog(a.container,340,246+b,!0,!0);null!=n?(n.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null)):v.focus()};EditorUi.prototype.showRemoteExportDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));
|
||||
!0:y.checked,B.checked,C.getLink(),F.checked,null!=l?l.value:null,null!=m?m.value:null)}),null,mxResources.get("create"),g);this.showDialog(a.container,340,246+b,!0,!0);null!=l?(l.focus(),mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?l.select():document.execCommand("selectAll",!1,null)):v.focus()};EditorUi.prototype.showRemoteExportDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));
|
||||
f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var g=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),k=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),!0);null!=k&&(k.style.marginBottom="16px");b=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!g.checked,null!=k?k.checked:!1)}),null,b,a);this.showDialog(b.container,300,d?100:146,!0,!0)};EditorUi.prototype.showExportDialog=function(b,
|
||||
a,c,d,f,h,l,m){l=null!=l?l:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var g=this.editor.graph,k="jpeg"==m?170:280,n=document.createElement("h3");mxUtils.write(n,b);n.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";e.appendChild(n);mxUtils.write(e,mxResources.get("zoom")+":");var t=document.createElement("input");t.setAttribute("type","text");t.style.marginRight="16px";t.style.width="60px";t.style.marginLeft="4px";t.style.marginRight="12px";t.value=
|
||||
this.lastExportZoom||"100%";e.appendChild(t);mxUtils.write(e,mxResources.get("borderWidth")+":");var u=document.createElement("input");u.setAttribute("type","text");u.style.marginRight="16px";u.style.width="60px";u.style.marginLeft="4px";u.value=this.lastExportBorder||"0";e.appendChild(u);mxUtils.br(e);var v=this.addCheckbox(e,mxResources.get("transparentBackground"),g.background==mxConstants.NONE||null==g.background,null,null,"jpeg"!=m),B=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,g.isSelectionEmpty()),
|
||||
|
@ -6287,126 +6287,127 @@ function(){var b=new mxUrlConverter;b.updateBaseUrl();var a=b.convert;b.convert=
|
|||
h=0;h<k.length;h++)mxUtils.bind(this,function(c){var k=d.convert(c.getAttribute(g));if(null!=k&&"data:"!=k.substring(0,5)){var h=f[k];null==h?(e++,this.convertImageToDataUri(k,function(d){null!=d&&(f[k]=d,c.setAttribute(g,d));e--;0==e&&a(b)})):c.setAttribute(g,h)}})(k[h])});c("image","xlink:href");c("img","src");0==e&&a(b)};EditorUi.prototype.loadUrl=function(b,a,c,d,f,h){try{var e=d||/(\.png)($|\?)/i.test(b)||/(\.jpe?g)($|\?)/i.test(b)||/(\.gif)($|\?)/i.test(b);f=null!=f?f:!0;var g=mxUtils.bind(this,
|
||||
function(){mxUtils.get(b,mxUtils.bind(this,function(b){if(200<=b.getStatus()&&299>=b.getStatus()){if(null!=a){var d=b.getText();if(e){if((9==document.documentMode||10==document.documentMode)&&"undefined"!==typeof window.mxUtilsBinaryToArray){b=mxUtilsBinaryToArray(b.request.responseBody).toArray();for(var d=Array(b.length),f=0;f<b.length;f++)d[f]=String.fromCharCode(b[f]);d=d.join("")}h=null!=h?h:"data:image/png;base64,";d=h+this.base64Encode(d)}a(d)}}else null!=c&&c({code:App.ERROR_UNKNOWN})}),function(){null!=
|
||||
c&&c({code:App.ERROR_UNKNOWN})},e,this.timeout,function(){f&&null!=c&&c({code:App.ERROR_TIMEOUT,retry:g})})});g()}catch(q){null!=c&&c(q)}};EditorUi.prototype.isCorsEnabledForUrl=function(b){return"https?://raw.githubusercontent.com/"===b.substring(0,34)||/^https?:\/\/.*\.github\.io\//.test(b)||/^https?:\/\/(.*\.)?rawgit\.com\//.test(b)};EditorUi.prototype.convertImageToDataUri=function(b,a){if(/(\.svg)$/i.test(b))mxUtils.get(b,mxUtils.bind(this,function(b){a(this.createSvgDataUri(b.getText()))}),
|
||||
function(){a()});else{var c=new Image;c.onload=function(){var b=document.createElement("canvas"),e=b.getContext("2d");b.height=c.height;b.width=c.width;e.drawImage(c,0,0);a(b.toDataURL())};c.onerror=function(){a()};c.src=b}};EditorUi.prototype.importXml=function(b,a,c,d,f){a=null!=a?a:0;c=null!=c?c:0;var e=[];try{var g=this.editor.graph;if(null!=b&&0<b.length){var k=mxUtils.parseXml(b),h=this.editor.extractGraphModel(k.documentElement,null!=this.pages);if(null!=h&&"mxfile"==h.nodeName&&null!=this.pages){var l=
|
||||
h.getElementsByTagName("diagram");if(1==l.length)h=mxUtils.parseXml(g.decompress(mxUtils.getTextContent(l[0]))).documentElement;else if(1<l.length){g.model.beginUpdate();try{for(var n=0;n<l.length;n++){var m=this.updatePageRoot(new DiagramPage(l[n])),A=this.pages.length;null==m.getName()&&m.setName(mxResources.get("pageWithNumber",[A+1]));g.model.execute(new ChangePage(this,m,m,A))}}finally{g.model.endUpdate()}}}if(null!=h&&"mxGraphModel"===h.nodeName){var D=new mxGraphModel;(new mxCodec(h.ownerDocument)).decode(h,
|
||||
D);var y=D.getChildCount(D.getRoot());g.model.getChildCount(g.model.getRoot());g.model.beginUpdate();try{b={};for(n=0;n<y;n++){var B=D.getChildAt(D.getRoot(),n);if(1!=y||g.isCellLocked(g.getDefaultParent()))B=g.importCells([B],0,0,g.model.getRoot(),null,b)[0],C=g.model.getChildren(B),g.moveCells(C,a,c),e=e.concat(C);else var C=D.getChildren(B),e=e.concat(g.importCells(C,a,c,g.getDefaultParent(),null,b))}if(d){g.isGridEnabled()&&(a=g.snap(a),c=g.snap(c));var z=g.getBoundingBoxFromGeometry(e,!0);null!=
|
||||
function(){a()});else{var c=new Image;c.onload=function(){var b=document.createElement("canvas"),e=b.getContext("2d");b.height=c.height;b.width=c.width;e.drawImage(c,0,0);a(b.toDataURL())};c.onerror=function(){a()};c.src=b}};EditorUi.prototype.importXml=function(b,a,c,d,f){a=null!=a?a:0;c=null!=c?c:0;var e=[];try{var g=this.editor.graph;if(null!=b&&0<b.length){var k=mxUtils.parseXml(b),h=this.editor.extractGraphModel(k.documentElement,null!=this.pages);if(null!=h&&"mxfile"==h.nodeName&&null!=this.pages){var p=
|
||||
h.getElementsByTagName("diagram");if(1==p.length)h=mxUtils.parseXml(g.decompress(mxUtils.getTextContent(p[0]))).documentElement;else if(1<p.length){g.model.beginUpdate();try{for(var l=0;l<p.length;l++){var n=this.updatePageRoot(new DiagramPage(p[l])),m=this.pages.length;null==n.getName()&&n.setName(mxResources.get("pageWithNumber",[m+1]));g.model.execute(new ChangePage(this,n,n,m))}}finally{g.model.endUpdate()}}}if(null!=h&&"mxGraphModel"===h.nodeName){var D=new mxGraphModel;(new mxCodec(h.ownerDocument)).decode(h,
|
||||
D);var y=D.getChildCount(D.getRoot());g.model.getChildCount(g.model.getRoot());g.model.beginUpdate();try{b={};for(l=0;l<y;l++){var B=D.getChildAt(D.getRoot(),l);if(1!=y||g.isCellLocked(g.getDefaultParent()))B=g.importCells([B],0,0,g.model.getRoot(),null,b)[0],C=g.model.getChildren(B),g.moveCells(C,a,c),e=e.concat(C);else var C=D.getChildren(B),e=e.concat(g.importCells(C,a,c,g.getDefaultParent(),null,b))}if(d){g.isGridEnabled()&&(a=g.snap(a),c=g.snap(c));var z=g.getBoundingBoxFromGeometry(e,!0);null!=
|
||||
z&&g.moveCells(e,a-z.x,c-z.y)}}finally{g.model.endUpdate()}}}}catch(F){throw f||this.handleError(F,mxResources.get("invalidOrMissingFile")),F;}return e};EditorUi.prototype.importLucidChart=function(b,a,c,d,f){var e=mxUtils.bind(this,function(){if(this.pasteLucidChart)try{this.insertLucidChart(b,a,c,d,f)}catch(u){this.handleError(u)}finally{null!=f&&f()}});this.pasteLucidChart||this.loadingExtensions||this.isOffline()?window.setTimeout(e,0):(this.loadingExtensions=!0,"1"==urlParams.dev?mxscript("/js/diagramly/Extensions.js",
|
||||
e):mxscript("/js/extensions.min.js",e))};EditorUi.prototype.insertLucidChart=function(b,a,c,d,f){f=JSON.parse(JSON.parse(b).state);b=[];for(var e in f.Pages)b.push(f.Pages[e]);b.sort(function(b,a){return b.Properties.Order<a.Properties.Order?-1:b.Properties.Order>a.Properties.Order?1:0});if(0<b.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(b[0],a,c,d),null!=this.pages){var g=this.currentPage;for(a=1;a<b.length;a++)this.insertPage(),this.pasteLucidChart(b[a]);this.selectPage(g)}}finally{this.editor.graph.getModel().endUpdate()}}};
|
||||
EditorUi.prototype.insertTextAt=function(b,a,c,d,f,h,l){h=null!=h?h:!0;l=null!=l?l:!0;if(null!=b)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(b))this.parseFile(new Blob([b.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(b){4==b.readyState&&200<=b.status&&299>=b.status&&this.editor.graph.setSelectionCells(this.insertTextAt(b.responseText,a,c,!0))}));else if("data:"==b.substring(0,5)||!this.isOffline()&&(f||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(b))){var e=
|
||||
this.editor.graph;if("data:image/png;base64,"==b.substring(0,22)){var g=this.extractGraphModelFromPng(b),k=this.importXml(g,a,c,h,!0);if(0<k.length)return k}if("data:image/svg+xml;"==b.substring(0,19))try{if(g=null,"data:image/svg+xml;base64,"==b.substring(0,26)?(g=b.substring(b.indexOf(",")+1),g=window.atob&&!mxClient.IS_SF?atob(g):Base64.decode(g,!0)):g=decodeURIComponent(b.substring(b.indexOf(",")+1)),k=this.importXml(g,a,c,h,!0),0<k.length)return k}catch(x){}this.loadImage(b,mxUtils.bind(this,
|
||||
function(d){if("data:"==b.substring(0,5))this.resizeImage(d,b,mxUtils.bind(this,function(b,d,f){e.setSelectionCell(e.insertVertex(null,null,"",e.snap(a),e.snap(c),d,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(b)+";"))}),l,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/d.height)),g=Math.round(d.width*f);d=Math.round(d.height*f);e.setSelectionCell(e.insertVertex(null,
|
||||
null,"",e.snap(a),e.snap(c),g,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+";"))}}),mxUtils.bind(this,function(){var f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,b,e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.updateCellSize(f),e.fireEvent(new mxEventObject("textInserted","cells",[f]))}finally{e.getModel().endUpdate()}e.setSelectionCell(f)}))}else{b=this.editor.graph.zapGremlins(mxUtils.trim(b));
|
||||
if(this.isCompatibleString(b))return this.importXml(b,a,c,h);if(0<b.length)if('{"state":"{\\"Properties\\":'==b.substring(0,26))this.importLucidChart(b,a,c,h);else{e=this.editor.graph;f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,"",e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.fireEvent(new mxEventObject("textInserted","cells",[f])),f.value=b,e.updateCellSize(f),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(f.value)&&
|
||||
e.setLinkForCell(f,f.value),f.geometry.width+=e.gridSize,f.geometry.height+=e.gridSize}finally{e.getModel().endUpdate()}return[f]}}return[]};EditorUi.prototype.formatFileSize=function(b){var a=-1;do b/=1024,a++;while(1024<b);return Math.max(b,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[a]};EditorUi.prototype.convertDataUri=function(b){if("data:"==b.substring(0,5)){var a=b.indexOf(";");0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1)))}return b};EditorUi.prototype.isRemoteFileFormat=
|
||||
function(b,a){return/(\.*<graphml xmlns=\".*)/.test(b)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(b)||null!=a&&/(\.vsdx)($|\?)/i.test(a)||null!=a&&/(\.vssx)($|\?)/i.test(a)};EditorUi.prototype.importFile=function(b,a,c,d,f,h,l,m,q,p,x){p=null!=p?p:!0;var e=!1,g=null;"image"==a.substring(0,5)?(q=!1,"image/png"==a.substring(0,9)&&(a=x?null:this.extractGraphModelFromPng(b),null!=a&&0<a.length&&(g=this.importXml(a,c,d,p),q=!0)),q||(g=this.editor.graph,a=b.indexOf(";"),0<a&&(b=b.substring(0,
|
||||
a)+b.substring(b.indexOf(",",a+1))),p&&g.isGridEnabled()&&(c=g.snap(c),d=g.snap(d)),g=[g.insertVertex(null,null,"",c,d,f,h,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(b,l)?(e=!0,this.parseFile(null!=q?q:new Blob([b],{type:"application/octet-stream"}),mxUtils.bind(this,function(b){if(4==b.readyState){var a=null;200<=b.status&&299>=b.status&&
|
||||
(b=b.responseText,null!=b&&"<mxlibrary"==b.substring(0,10)?(null!=l&&".vssx"==l.toLowerCase().substring(l.length-5)&&(l=l.substring(0,l.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,b,l))):a=this.importXml(b,c,d,p));null!=m&&m(a)}}),l)):/(\.vsd)($|\?)/i.test(l)||(g=this.insertTextAt(this.validateFileData(b),c,d,!0,null,p));e||null==m||m(g);return g};EditorUi.prototype.base64Encode=function(b){for(var a="",c=0,d=b.length,f,h,l;c<d;){f=b.charCodeAt(c++)&255;if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>
|
||||
2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4);a+="==";break}h=b.charCodeAt(c++);if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(h&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((h&15)<<2);a+="=";break}l=b.charCodeAt(c++);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>
|
||||
2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(h&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((h&15)<<2|(l&192)>>6);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(l&63)}return a};EditorUi.prototype.importFiles=function(b,a,c,d,f,h,l,m,q,p,x,w){a=null!=a?a:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;p=null!=p?p:this.maxImageBytes;var e=null!=a&&null!=c,g=!0,k=!1;if(!mxClient.IS_CHROMEAPP&&
|
||||
null!=b)for(var n=x||this.resampleThreshold,u=0;u<b.length;u++)if("image/"==b[u].type.substring(0,6)&&b[u].size>n){k=!0;break}var t=mxUtils.bind(this,function(){var k=this.editor.graph,q=k.gridSize;f=null!=f?f:mxUtils.bind(this,function(b,a,c,d,f,g,h,k,l){return null!=b&&"<mxlibrary"==b.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,b,h)),null):this.importFile(b,a,c,d,f,g,h,k,l,e,w)});h=null!=h?h:mxUtils.bind(this,function(b){k.setSelectionCells(b)});if(this.spinner.spin(document.body,
|
||||
mxResources.get("loading")))for(var n=b.length,u=n,t=[],v=mxUtils.bind(this,function(b,a){t[b]=a;if(0==--u){this.spinner.stop();if(null!=m)m(t);else{var c=[];k.getModel().beginUpdate();try{for(var e=0;e<t.length;e++){var d=t[e]();null!=d&&(c=c.concat(d))}}finally{k.getModel().endUpdate()}}h(c)}}),y=0;y<n;y++)mxUtils.bind(this,function(e){var h=b[e],k=new FileReader;k.onload=mxUtils.bind(this,function(b){if(null==l||l(h))if("image/"==h.type.substring(0,6))if("image/svg"==h.type.substring(0,9)){var k=
|
||||
b.target.result,m=k.indexOf(","),n=atob(k.substring(m+1)),u=mxUtils.parseXml(n),n=u.getElementsByTagName("svg");if(0<n.length){var n=n[0],t=w?null:n.getAttribute("content");null!=t&&"<"!=t.charAt(0)&&"%"!=t.charAt(0)&&(t=unescape(window.atob?atob(t):Base64.decode(t,!0)));null!=t&&"%"==t.charAt(0)&&(t=decodeURIComponent(t));null==t||"<mxfile "!==t.substring(0,8)&&"<mxGraphModel "!==t.substring(0,14)?v(e,mxUtils.bind(this,function(){try{if(k.substring(0,m+1),null!=u){var b=u.getElementsByTagName("svg");
|
||||
if(0<b.length){var g=b[0],l=parseFloat(g.getAttribute("width")),p=parseFloat(g.getAttribute("height")),n=g.getAttribute("viewBox");if(null==n||0==n.length)g.setAttribute("viewBox","0 0 "+l+" "+p);else if(isNaN(l)||isNaN(p)){var x=n.split(" ");3<x.length&&(l=parseFloat(x[2]),p=parseFloat(x[3]))}k=this.createSvgDataUri(mxUtils.getXml(b[0]));var t=Math.min(1,Math.min(d/Math.max(1,l)),d/Math.max(1,p));return f(k,h.type,a+e*q,c+e*q,Math.max(1,Math.round(l*t)),Math.max(1,Math.round(p*t)),h.name)}}}catch(Z){}return null})):
|
||||
v(e,mxUtils.bind(this,function(){return f(t,"text/xml",a+e*q,c+e*q,0,0,h.name)}))}}else{n=!1;if("image/png"==h.type){var y=w?null:this.extractGraphModelFromPng(b.target.result);if(null!=y&&0<y.length){var C=new Image;C.src=b.target.result;v(e,mxUtils.bind(this,function(){return f(y,"text/xml",a+e*q,c+e*q,C.width,C.height,h.name)}));n=!0}}n||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,
|
||||
function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(b.target.result,mxUtils.bind(this,function(k){this.resizeImage(k,b.target.result,mxUtils.bind(this,function(k,l,m){v(e,mxUtils.bind(this,function(){if(null!=k&&k.length<p){var n=g&&this.isResampleImage(b.target.result,x)?Math.min(1,Math.min(d/l,d/m)):1;return f(k,h.type,a+e*q,c+e*q,Math.round(l*n),Math.round(m*n),h.name)}this.handleError({message:mxResources.get("imageTooBig")});
|
||||
return null}))}),g,d,x)})))}else f(b.target.result,h.type,a+e*q,c+e*q,240,160,h.name,function(b){v(e,function(){return b})})});/(\.vsdx)($|\?)/i.test(h.name)||/(\.vssx)($|\?)/i.test(h.name)?f(null,h.type,a+e*q,c+e*q,240,160,h.name,function(b){v(e,function(){return b})},h):"image"==h.type.substring(0,5)?k.readAsDataURL(h):k.readAsText(h)})(y)});k?this.confirmImageResize(function(b){g=b;t()},q):t()};EditorUi.prototype.confirmImageResize=function(b,a){a=null!=a?a:!1;var c=null!=this.spinner&&null!=this.spinner.pause?
|
||||
this.spinner.pause():function(){},e=function(a,e){mxSettings.setResizeImages(a?e:null);mxSettings.save();c();b(e)},d=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null;null==d||a?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(b){e(b,!0)},function(b){e(b,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||
|
||||
mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):e(!1,d)};EditorUi.prototype.parseFile=function(b,a,c){c=null!=c?c:b.name;var e=new FormData;e.append("format","xml");e.append("upfile",b,c);var d=new XMLHttpRequest;d.open("POST",OPEN_URL);d.onreadystatechange=function(){a(d)};d.send(e)};EditorUi.prototype.isResampleImage=function(b,a){a=null!=a?a:this.resampleThreshold;return b.length>a};EditorUi.prototype.resizeImage=function(b,a,c,d,f,h){f=null!=f?f:this.maxImageSize;
|
||||
var e=Math.max(1,b.width),g=Math.max(1,b.height);if(d&&this.isResampleImage(a,h))try{var k=Math.max(e/f,g/f);if(1<k){var l=Math.round(e/k),m=Math.round(g/k),n=document.createElement("canvas");n.width=l;n.height=m;n.getContext("2d").drawImage(b,0,0,l,m);var v=n.toDataURL();if(v.length<a.length){var D=document.createElement("canvas");D.width=l;D.height=m;var y=D.toDataURL();v!==y&&(a=v,e=l,g=m)}}}catch(B){}c(a,e,g)};EditorUi.prototype.crcTable=[];for(var f=0;256>f;f++)for(var d=f,c=0;8>c;c++)d=1==(d&
|
||||
1)?3988292384^d>>>1:d>>>1,EditorUi.prototype.crcTable[f]=d;EditorUi.prototype.updateCRC=function(b,a,c,d){for(var e=0;e<d;e++)b=EditorUi.prototype.crcTable[(b^a[c+e])&255]^b>>>8;return b};EditorUi.prototype.writeGraphModelToPng=function(b,a,c,d,f){function e(b,a){var c=k;k+=a;return b.substring(c,k)}function g(b){b=e(b,4);return b.charCodeAt(3)+(b.charCodeAt(2)<<8)+(b.charCodeAt(1)<<16)+(b.charCodeAt(0)<<24)}function h(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}b=b.substring(b.indexOf(",")+
|
||||
1);b=window.atob?atob(b):Base64.decode(b,!0);var k=0;if(e(b,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=f&&f();else if(e(b,4),"IHDR"!=e(b,4))null!=f&&f();else{e(b,17);f=b.substring(0,k);do{var l=g(b);if("IDAT"==e(b,4)){f=b.substring(0,k-8);c=c+String.fromCharCode(0)+("zTXt"==a?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,a,0,4);d=this.updateCRC(d,c,0,c.length);f+=h(c.length)+a+c+h(d^4294967295);f+=b.substring(k-8,b.length);break}f+=b.substring(k-8,k-4+
|
||||
l);d=e(b,l);e(b,4)}while(l);return"data:image/png;base64,"+(window.btoa?btoa(f):Base64.encode(f,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(b){var a=null;try{var c=b.substring(b.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(b,c,e){b=d.substring(b+8,b+8+e);"zTXt"==c?(e=b.indexOf(String.fromCharCode(0)),"mxGraphModel"==b.substring(0,e)&&(b=this.editor.graph.bytesToString(pako.inflateRaw(b.substring(e+2))).replace(/\+/g,
|
||||
" "),null!=b&&0<b.length&&(a=b))):"tEXt"==c&&(b=b.split(String.fromCharCode(0)),1<b.length&&"mxGraphModel"==b[0]&&(a=b[1]));if(null!=a||"IDAT"==c)return!0}))}catch(n){}null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));return a};EditorUi.prototype.loadImage=function(b,a,c){var e=new Image;e.onload=function(){a(e)};null!=c&&(e.onerror=c);e.src=b};var h=EditorUi.prototype.init;EditorUi.prototype.init=function(){function b(b){var c=b.indexOf(",");
|
||||
0<c&&(b=a.getPageById(b.substring(c+1)))&&a.selectPage(b)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var a=this,c=this.editor.graph,d=c.addClickHandler;c.addClickHandler=function(a,e,f){var h=e;e=function(a,e){if(null==e){var d=mxEvent.getSource(a);"a"==d.nodeName.toLowerCase()&&(e=d.getAttribute("href"))}null!=e&&c.isPageLink(e)&&(b(e),mxEvent.consume(a));null!=h&&h(a,e)};d.call(this,a,e,f)};h.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(c.view.canvas.ownerSVGElement,
|
||||
null,!0);a.actions.get("print").funct=function(){a.showDialog((new PrintDialog(a)).container,360,null!=a.pages&&1<a.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var f=c.getGlobalVariable;c.getGlobalVariable=function(b){return"page"==b&&null!=a.currentPage?a.currentPage.getName():"pagenumber"==b?null!=a.currentPage&&null!=a.pages?mxUtils.indexOf(a.pages,a.currentPage)+1:1:f.apply(this,arguments)};var l=c.createLinkForHint;c.createLinkForHint=function(e,d){var f=
|
||||
c.isPageLink(e);if(f){var h=e.indexOf(",");0<h&&(h=a.getPageById(e.substring(h+1)),d=null!=h?h.getName():mxResources.get("pageNotFound"))}h=l.apply(this,arguments);f&&mxEvent.addListener(h,"click",function(a){b(e);mxEvent.consume(a)});return h};var m=c.labelLinkClicked;c.labelLinkClicked=function(a,e,d){var f=e.getAttribute("href");c.isPageLink(f)?(b(f),mxEvent.consume(d)):m.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var b=a.defaultFilename,c=a.getCurrentFile();null!=c&&(b=
|
||||
null!=c.getTitle()?c.getTitle():b);return b};var t=this.actions.get("print");t.setEnabled(!mxClient.IS_IOS||!navigator.standalone);t.visible=t.isEnabled();if(!this.editor.chromeless){var q=function(){window.setTimeout(function(){p.innerHTML=" ";p.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,
|
||||
!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||c.container.addEventListener("paste",mxUtils.bind(this,function(b){var a=this.editor.graph;if(!mxEvent.isConsumed(b))try{for(var c=b.clipboardData||b.originalEvent.clipboardData,e=!1,d=0;d<c.types.length;d++)if("text/"===c.types[d].substring(0,5)){e=!0;break}if(!e){var f=c.items;for(index in f){var h=f[index];if("file"===h.kind){if(a.isEditing())this.importFiles([h.getAsFile()],
|
||||
0,0,this.maxImageSize,function(b,c,e,d,f,h){a.insertImage(b,f,h)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()});else{var k=this.editor.graph.getInsertPoint();this.importFiles([h.getAsFile()],k.x,k.y,this.maxImageSize);mxEvent.consume(b)}break}}}}catch(J){}}),!1);var p=document.createElement("div");p.style.position="absolute";p.style.whiteSpace="nowrap";p.style.overflow="hidden";p.style.display="block";p.contentEditable=!0;mxUtils.setOpacity(p,
|
||||
0);p.style.width="1px";p.style.height="1px";p.innerHTML=" ";var x=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(b){var a=mxEvent.getSource(b);null==c.container||!c.isEnabled()||c.isMouseDown||c.isEditing()||null!=this.dialog||"INPUT"==a.nodeName||"TEXTAREA"==a.nodeName||!(224==b.keyCode||!mxClient.IS_MAC&&17==b.keyCode||mxClient.IS_MAC&&91==b.keyCode)||
|
||||
x||(p.style.left=c.container.scrollLeft+10+"px",p.style.top=c.container.scrollTop+10+"px",c.container.appendChild(p),x=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){p.focus();document.execCommand("selectAll",!1,null)},0):(p.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(b){var a=b.keyCode;window.setTimeout(mxUtils.bind(this,function(){!x||224!=a&&17!=a&&91!=a||(x=!1,c.isEditing()||null!=this.dialog||null==c.container||c.container.focus(),
|
||||
p.parentNode.removeChild(p))}),0)}));mxEvent.addListener(p,"copy",mxUtils.bind(this,function(b){c.isEnabled()&&(mxClipboard.copy(c),this.copyCells(p),q())}));mxEvent.addListener(p,"cut",mxUtils.bind(this,function(b){c.isEnabled()&&(this.copyCells(p,!0),q())}));mxEvent.addListener(p,"paste",mxUtils.bind(this,function(b){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&(p.innerHTML=" ",p.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(b,p);p.innerHTML=" "}),0))}),
|
||||
!0);var w=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==p?!0:w.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(b){var a=this.editor.graph,c=a.cellEditor.text2,e=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(b){null!=e&&(e.parentNode.removeChild(e),
|
||||
e=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(b){null==e&&(!mxClient.IS_IE||10<document.documentMode)&&(e=this.highlightElement(c));b.stopPropagation();b.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(b){null!=e&&(e.parentNode.removeChild(e),e=null);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,function(b,c,e,d,f,h){a.insertImage(b,f,h)},function(){},function(b){return"image/"==
|
||||
b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()},mxEvent.isControlDown(b));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")){var c=b.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(b){var e=Math.max(1,b.width);b=Math.max(1,b.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,e)),d/Math.max(1,b));a.insertImage(decodeURIComponent(c),e*d,b*d)})):document.execCommand("insertHTML",
|
||||
!1,b.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"));b.stopPropagation();b.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){t=document.createElement("div");t.style.position="absolute";t.style.top="95px";t.style.left="250px";
|
||||
t.style.width="2000px";t.style.height="30px";t.style.background="whiteSmoke";document.body.appendChild(t);var A=document.createElement("div");A.style.position="absolute";A.style.top="125px";A.style.left="220px";A.style.width="30px";A.style.height="1000px";A.style.background="whiteSmoke";document.body.appendChild(A);var D=document.createElement("div");D.style.position="absolute";D.style.top="95px";D.style.left="220px";D.style.width="30px";D.style.height="30px";D.style.background="whiteSmoke";document.body.appendChild(D);
|
||||
this.vRuler=new mxRuler(this.editor.graph,A,!0);this.hRuler=new mxRuler(this.editor.graph,t,!1)}if("1"==urlParams.test){t=document.getElementById("geFooter");null!=t&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,
|
||||
"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),t.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(b,a){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility=
|
||||
"hidden"})));var y=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==this.styleInput?!0:y.apply(this,arguments)}}t=document.getElementById("geInfo");null!=t&&t.parentNode.removeChild(t);if(Graph.fileSupport){var B=null;mxEvent.addListener(c.container,"dragleave",function(b){c.isEnabled()&&(null!=B&&(B.parentNode.removeChild(B),B=null),b.stopPropagation(),b.preventDefault())});mxEvent.addListener(c.container,"dragover",mxUtils.bind(this,function(b){null==B&&(!mxClient.IS_IE||
|
||||
10<document.documentMode)&&(B=this.highlightElement(c.container));null!=this.sidebar&&this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()}));mxEvent.addListener(c.container,"drop",mxUtils.bind(this,function(b){null!=B&&(B.parentNode.removeChild(B),B=null);if(c.isEnabled()){var a=mxUtils.convertPoint(c.container,mxEvent.getClientX(b),mxEvent.getClientY(b)),e=c.view.translate,d=c.view.scale,f=a.x/d-e.x,h=a.y/d-e.y;mxEvent.isAltDown(b)&&(h=f=0);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,
|
||||
f,h,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(b),null,null,mxEvent.isShiftDown(b));else{var k=0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):null,a=this.extractGraphModelFromEvent(b,null!=this.pages);if(null!=a)c.setSelectionCells(this.importXml(a,f,h,!0));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")){var g=b.dataTransfer.getData("text/html"),a=document.createElement("div");a.innerHTML=g;var l=null,e=a.getElementsByTagName("img");
|
||||
null!=e&&1==e.length?(g=e[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)||(l=!0)):(a=a.getElementsByTagName("a"),null!=a&&1==a.length&&(g=a[0].getAttribute("href")));var p=!0,q=mxUtils.bind(this,function(){c.setSelectionCells(this.insertTextAt(g,f,h,!0,l,null,p))});l&&g.length>this.resampleThreshold?this.confirmImageResize(function(b){p=b;q()},mxEvent.isControlDown(b)):q()}else null!=k&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)?this.loadImage(decodeURIComponent(k),mxUtils.bind(this,
|
||||
function(b){var a=Math.max(1,b.width);b=Math.max(1,b.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,a)),e/Math.max(1,b));c.setSelectionCell(c.insertVertex(null,null,"",f,h,a*e,b*e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+k+";"))}),mxUtils.bind(this,function(b){c.setSelectionCells(this.insertTextAt(k,f,h,!0))})):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&c.setSelectionCells(this.insertTextAt(b.dataTransfer.getData("text/plain"),
|
||||
f,h,!0))}}b.stopPropagation();b.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged",
|
||||
"keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(b,a){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(b,a){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());
|
||||
mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(b,a){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",mxUtils.bind(this,function(b,a){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,
|
||||
function(b,a){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=
|
||||
function(b,a){var c=this.editor.graph;if(c.isSelectionEmpty())b.innerHTML="";else{var e=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),d=mxUtils.getXml(this.editor.graph.encodeCells(e));mxUtils.setTextContent(b,encodeURIComponent(d));a?(c.removeCells(e,!1),c.lastPasteXml=null):(c.lastPasteXml=d,c.pasteCounter=0);b.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(b,a){if(!mxEvent.isConsumed(b)){var c=a.getElementsByTagName("span");if(null!=
|
||||
c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var e=c[0].getAttribute("data-lucid-content");null!=e&&0<e.length&&(this.insertLucidChart(JSON.parse(e)),mxEvent.consume(b))}else{var e=this.editor.graph,d=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(a):a.textContent),f=!1;try{var h=d.lastIndexOf("%3E");0<=h&&h<d.length-3&&(d=d.substring(0,h+3))}catch(q){}try{var c=a.getElementsByTagName("span"),l=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):
|
||||
decodeURIComponent(d);this.isCompatibleString(l)&&(f=!0,d=l)}catch(q){}e.lastPasteXml==d?e.pasteCounter++:(e.lastPasteXml=d,e.pasteCounter=0);c=e.pasteCounter*e.gridSize;if(null!=d&&0<d.length&&(f||this.isCompatibleString(d)?e.setSelectionCells(this.importXml(d,c,c)):(f=e.getInsertPoint(),e.isMouseInsertPoint()&&(c=0,e.lastPasteXml==d&&0<e.pasteCounter&&e.pasteCounter--),e.setSelectionCells(this.insertTextAt(d,f.x+c,f.y+c,!0))),!e.isSelectionEmpty())){e.scrollCellToVisible(e.getSelectionCell());null!=
|
||||
this.hoverIcons&&this.hoverIcons.update(e.view.getState(e.getSelectionCell()));try{mxEvent.consume(b)}catch(q){}}}}};EditorUi.prototype.addFileDropHandler=function(b){if(Graph.fileSupport)for(var a=null,c=0;c<b.length;c++)mxEvent.addListener(b[c],"dragleave",function(b){null!=a&&(a.parentNode.removeChild(a),a=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(b[c],"dragover",mxUtils.bind(this,function(b){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==a&&(!mxClient.IS_IE||
|
||||
10<document.documentMode&&12>document.documentMode)&&(a=this.highlightElement());b.stopPropagation();b.preventDefault()})),mxEvent.addListener(b[c],"drop",mxUtils.bind(this,function(b){null!=a&&(a.parentNode.removeChild(a),a=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<b.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(b)&&!mxEvent.isShiftDown(b)):this.openFiles(b.dataTransfer.files,
|
||||
!0);else{var c=this.extractGraphModelFromEvent(b);if(null==c){var e=null!=b.dataTransfer?b.dataTransfer:b.clipboardData;null!=e&&(10==document.documentMode||11==document.documentMode?c=e.getData("Text"):(c=null,c=0<=mxUtils.indexOf(e.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(e.types,"text/html")?e.getData("text/html"):null,null!=c&&0<c.length?(e=document.createElement("div"),e.innerHTML=c,e=e.getElementsByTagName("img"),0<e.length&&(c=e[0].getAttribute("src"))):
|
||||
0<=mxUtils.indexOf(e.types,"text/plain")&&(c=e.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(b){200<=b.getStatus()&&299>=b.getStatus()&&this.openLocalFile(b.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash=
|
||||
"#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}b.stopPropagation();b.preventDefault()}))};EditorUi.prototype.highlightElement=function(b){var a=0,c=0,d,f;if(null==b){f=document.body;var h=document.documentElement;d=(f.clientWidth||h.clientWidth)-3;f=Math.max(f.clientHeight||0,h.clientHeight)-3}else a=b.offsetTop,c=b.offsetLeft,d=b.clientWidth,
|
||||
f=b.clientHeight;h=document.createElement("div");h.style.zIndex=mxPopupMenu.prototype.zIndex+2;h.style.border="3px dotted rgb(254, 137, 12)";h.style.pointerEvents="none";h.style.position="absolute";h.style.top=a+"px";h.style.left=c+"px";h.style.width=Math.max(0,d-3)+"px";h.style.height=Math.max(0,f-3)+"px";null!=b&&b.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(h):document.body.appendChild(h);return h};EditorUi.prototype.stringToCells=function(b){b=mxUtils.parseXml(b);
|
||||
var a=this.editor.extractGraphModel(b.documentElement);b=[];if(null!=a){var c=new mxCodec(a.ownerDocument),d=new mxGraphModel;c.decode(a,d);a=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(a);c++)b.push(d.getChildAt(a,c))}return b};EditorUi.prototype.openFiles=function(b,a){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<b.length;c++)mxUtils.bind(this,function(b){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var e=c.target.result,d=b.name;if(null!=
|
||||
d&&0<d.length)if(/(\.png)$/i.test(d)&&(d=d.substring(0,d.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(e,d))d=0<=d.lastIndexOf(".")?d.substring(0,d.lastIndexOf("."))+".xml":d+".xml",this.parseFile(b,mxUtils.bind(this,function(b){if(4==b.readyState)if(this.spinner.stop(),200<=b.status&&299>=b.status)if(b=b.responseText,"<mxlibrary"==b.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,a);null!=d&&".vssx"==d.toLowerCase().substring(d.length-5)&&(d=d.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,b,d))}catch(p){this.handleError(p,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(b,d,a);else this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==e.substring(0,26))/(\.json)$/i.test(d)&&(d=d.substring(0,
|
||||
d.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,d,a),this.importLucidChart(e,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,a);try{this.loadLibrary(new LocalLibrary(this,c.target.result,b.name))}catch(q){this.handleError(q,mxResources.get("errorLoadingFile"))}}else"image/png"==
|
||||
b.type.substring(0,9)&&(e=this.extractGraphModelFromPng(e)),this.spinner.stop(),this.openLocalFile(e,d,a)});c.onerror=mxUtils.bind(this,function(b){this.spinner.stop();this.handleError(b);window.openFile=null});"image"===b.type.substring(0,5)&&"image/svg"!==b.type.substring(0,9)?c.readAsDataURL(b):c.readAsText(b)})(b[c])};EditorUi.prototype.openLocalFile=function(b,a,c){var e=this.getCurrentFile(),d=mxUtils.bind(this,function(){window.openFile=null;if(null==a&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var e=
|
||||
mxUtils.parseXml(b);null!=e&&(this.editor.setGraphXml(e.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,b,a||this.defaultFilename,c))});null!=b&&0<b.length&&(null!=e&&e.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(b,a),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,d,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):d())};
|
||||
EditorUi.prototype.getBasenames=function(){var b={};if(null!=this.pages)for(var a=0;a<this.pages.length;a++)this.updatePageRoot(this.pages[a]),this.addBasenamesForCell(this.pages[a].root,b);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),b);var a=[],c;for(c in b)a.push(c);return a};EditorUi.prototype.addBasenamesForCell=function(b,a){function c(b){if(null!=b){var c=b.lastIndexOf(".");0<c&&(b=b.substring(c+1,b.length));null==a[b]&&(a[b]=!0)}}var e=this.editor.graph,d=e.getCellStyle(b);
|
||||
c(mxStencilRegistry.getBasenameForStencil(d[mxConstants.STYLE_SHAPE]));e.model.isEdge(b)&&(c(mxMarker.getPackageForType(d[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(d[mxConstants.STYLE_ENDARROW])));for(var d=e.model.getChildCount(b),f=0;f<d;f++)this.addBasenamesForCell(e.model.getChildAt(b,f),a)};EditorUi.prototype.setGraphEnabled=function(b){this.diagramContainer.style.visibility=b?"":"hidden";this.formatContainer.style.visibility=b?"":"hidden";this.sidebarFooterContainer.style.display=
|
||||
b?"":"none";this.sidebarContainer.style.display=b?"":"none";this.hsplit.style.display=b?"":"none";this.editor.graph.setEnabled(b)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(b,a,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=b&&0<b.length?(this.setFileData(b),this.showLayersDialog()):
|
||||
(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};
|
||||
EditorUi.prototype.getPublicUrl=function(b,a){null!=b?b.getPublicUrl(a):a(null)};EditorUi.prototype.createLoadMessage=function(b){var a=this.editor.graph;return{event:b,pageVisible:a.pageVisible,translate:a.view.translate,scale:a.view.scale,page:a.view.getBackgroundPageBounds(),bounds:a.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(b){var a=null,c=!1,d=!1,f=null,h=mxUtils.bind(this,function(b,a){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):
|
||||
this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,h);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){function h(b){if(null!=b&&"function"===typeof b.charAt&&"<"!=b.charAt(0))try{"data:image/svg+xml;base64,"==b.substring(0,26)?b=atob(b.substring(26)):"data:image/svg+xml;utf8,"==b.substring(0,24)&&(b=b.substring(24)),null!=b&&("%"==b.charAt(0)?b=decodeURIComponent(b):"<"!=b.charAt(0)&&(b=this.editor.graph.decompress(b)))}catch(G){}return b}var g=e.data;
|
||||
if("json"==urlParams.proto){try{g=JSON.parse(g)}catch(L){g=null}if(null==g)return;if("dialog"==g.action){this.showError(null!=g.titleKey?mxResources.get(g.titleKey):g.title,null!=g.messageKey?mxResources.get(g.messageKey):g.message,null!=g.buttonKey?mxResources.get(g.buttonKey):g.button);null!=g.modified&&(this.editor.modified=g.modified);return}if("prompt"==g.action){this.spinner.stop();var k=new FilenameDialog(this,g.defaultValue||"",null!=g.okKey?mxResources.get(g.okKey):null,function(b){null!=
|
||||
b&&l.postMessage(JSON.stringify({event:"prompt",value:b,message:g}),"*")},null!=g.titleKey?mxResources.get(g.titleKey):g.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==g.action){k=null;k="data:image/png;base64,"==g.xml.substring(0,22)?this.extractGraphModelFromPng(g.xml):h(g.xml);this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[g.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",
|
||||
result:"edit",message:g}),"*")}),mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),g.editKey?mxResources.get(g.editKey):null,g.discardKey?mxResources.get(g.discardKey):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));try{k.init()}catch(L){l.postMessage(JSON.stringify({event:"draft",error:L.toString(),message:g}),"*")}return}if("template"==g.action){this.spinner.stop();
|
||||
k=new NewDialog(this,!1,null!=g.callback,mxUtils.bind(this,function(a,c){a=a||this.emptyDiagramXml;null!=g.callback?l.postMessage(JSON.stringify({event:"template",xml:a,blank:a==this.emptyDiagramXml,name:c}),"*"):(b(a,e,a!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));k.init();return}if("status"==g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):
|
||||
null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var m=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||g.show?this.spinner.spin(document.body,m):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==g.format){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var n=null!=g.xml?
|
||||
g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var t=this.editor.graph,u=mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();var a=this.createLoadMessage("export");a.format=g.format;a.xml=encodeURIComponent(n);a.data=b;l.postMessage(JSON.stringify(a),"*")}),v=mxUtils.bind(this,function(b){null==b&&(b=Editor.blankImage);"xmlpng"==g.format&&(b=this.writeGraphModelToPng(b,"zTXt","mxGraphModel",atob(this.editor.graph.compress(n))));t!=this.editor.graph&&t.container.parentNode.removeChild(t.container);
|
||||
u(b)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var t=this.createTemporaryGraph(t.getStylesheet()),C=t.getGlobalVariable,z=this.pages[0];t.getGlobalVariable=function(b){return"page"==b?z.getName():"pagenumber"==b?1:C.apply(this,arguments)};document.body.appendChild(t.container);t.model.setRoot(z.root)}this.exportToCanvas(mxUtils.bind(this,function(b){v(b.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){v(null)}),null,null,null,null,null,
|
||||
null,t)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==g.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(n)))).send(mxUtils.bind(this,function(b){200<=b.getStatus()&&299>=b.getStatus()?u("data:image/png;base64,"+b.getText()):v(null)}),mxUtils.bind(this,function(){v(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);m=this.createLoadMessage("export");if("html2"==g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=
|
||||
this.getXmlFileData(),m.xml=mxUtils.getXml(k),m.data=this.getFileData(null,null,!0,null,null,null,k),m.format=g.format;else if("html"==g.format)n=this.editor.getGraphXml(),m.data=this.getHtml(n,this.editor.graph),m.xml=mxUtils.getXml(n),m.format=g.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);m.xml=this.getFileData(!0);m.format="svg";if(g.embedImages||null==g.embedImages){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,
|
||||
null!=g.spinKey?mxResources.get(g.spinKey):g.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==g.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(b);l.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(b));l.postMessage(JSON.stringify(m),
|
||||
"*")}));return}k="xmlsvg"==g.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));m.data=this.createSvgDataUri(k)}l.postMessage(JSON.stringify(m),"*")}return}if("load"==g.action)d=1==g.autosave,this.hideDialog(),null!=g.modified&&null==urlParams.modified&&(urlParams.modified=g.modified),null!=g.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=g.saveAndExit),null!=g.title&&null!=this.buttonContainer&&(k=document.createElement("span"),
|
||||
mxUtils.write(k,g.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),this.buttonContainer.appendChild(k)),g=null!=g.xmlpng?this.extractGraphModelFromPng(g.xmlpng):null!=g.xml&&"data:image/png;base64,"==g.xml.substring(0,22)?this.extractGraphModelFromPng(g.xml):g.xml;else{l.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(g)}),
|
||||
"*");return}}g=h(g);c=!0;try{b(g,e)}catch(L){this.handleError(L)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var F=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});f=F();d&&null==a&&(a=mxUtils.bind(this,function(b,a){var e=F();if(e!=f&&!c){var d=this.createLoadMessage("autosave");d.xml=e;e=JSON.stringify(d);(window.opener||window.parent).postMessage(e,"*")}f=e}),this.editor.graph.model.addListener(mxEvent.CHANGE,
|
||||
a),this.editor.graph.addListener("gridSizeChanged",a),this.editor.graph.addListener("shadowVisibleChanged",a),this.addListener("pageFormatChanged",a),this.addListener("pageScaleChanged",a),this.addListener("backgroundColorChanged",a),this.addListener("backgroundImageChanged",a),this.addListener("foldingEnabledChanged",a),this.addListener("mathEnabledChanged",a),this.addListener("gridEnabledChanged",a),this.addListener("guidesEnabledChanged",a),this.addListener("pageViewChanged",a));"1"!=urlParams.returnbounds&&
|
||||
"json"!=urlParams.proto||l.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var l=window.opener||window.parent,h="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";l.postMessage(h,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var b=document.createElement("div");b.style.display="inline-block";b.style.position="absolute";b.style.paddingTop="atlas"==uiTheme?"2px":"3px";b.style.paddingLeft="8px";b.style.paddingBottom="2px";var a=
|
||||
document.createElement("button");mxUtils.write(a,mxResources.get("save"));a.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");a.className="geBigButton";a.style.fontSize="12px";a.style.padding="4px 6px 4px 6px";a.style.borderRadius="3px";mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));b.appendChild(a);"1"==urlParams.saveAndExit&&(a=document.createElement("a"),mxUtils.write(a,mxResources.get("saveAndExit")),a.setAttribute("title",mxResources.get("saveAndExit")),
|
||||
a.style.fontSize="12px",a.style.marginLeft="6px",a.style.padding="4px",a.style.cursor="pointer",mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),b.appendChild(a));a=document.createElement("a");mxUtils.write(a,mxResources.get("exit"));a.setAttribute("title",mxResources.get("exit"));a.style.fontSize="12px";a.style.marginLeft="6px";a.style.marginRight="20px";a.style.padding="4px";a.style.cursor="pointer";mxEvent.addListener(a,"click",mxUtils.bind(this,
|
||||
function(){this.actions.get("exit").funct()}));b.appendChild(a);this.toolbar.container.appendChild(b);this.toolbar.staticElements.push(b);b.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(b){this.importCsv(b)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,
|
||||
640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(b){try{var a=b.split("\n"),c=[];if(0<a.length){var d={},f=null,h=null,l="auto",m="auto",q=40,p=40,x=0,w=this.editor.graph;w.getGraphBounds();for(var A=function(){w.setSelectionCells(O);w.scrollCellToVisible(w.getSelectionCell())},D=w.getFreeInsertPoint(),y=D.x,B=D.y,D=B,C=null,z="auto",F=[],L=null,G=null,E=0;E<a.length&&"#"==a[E].charAt(0);){b=a[E];for(E++;E<a.length&&"\\"==b.charAt(b.length-1)&&"#"==a[E].charAt(0);)b=
|
||||
b.substring(0,b.length-1)+mxUtils.trim(a[E].substring(1)),E++;if("#"!=b.charAt(1)){var M=b.indexOf(":");if(0<M){var H=mxUtils.trim(b.substring(1,M)),J=mxUtils.trim(b.substring(M+1));"label"==H?C=w.sanitizeHtml(J):"style"==H?f=J:"identity"==H&&0<J.length&&"-"!=J?h=J:"width"==H?l=J:"height"==H?m=J:"ignore"==H?G=J.split(","):"connect"==H?F.push(JSON.parse(J)):"link"==H?L=J:"padding"==H?x=parseFloat(J):"edgespacing"==H?q=parseFloat(J):"nodespacing"==H?p=parseFloat(J):"layout"==H&&(z=J)}}}var T=this.editor.csvToArray(a[E]);
|
||||
b=null;if(null!=h)for(var K=0;K<T.length;K++)if(h==T[K]){b=K;break}null==C&&(C="%"+T[0]+"%");if(null!=F)for(var N=0;N<F.length;N++)null==d[F[N].to]&&(d[F[N].to]={});w.model.beginUpdate();try{for(K=E+1;K<a.length;K++){var Q=this.editor.csvToArray(a[K]);if(Q.length==T.length){var I=null,W=null!=b?Q[b]:null;null!=W&&(I=w.model.getCell(W));null==I&&(I=new mxCell(C,new mxGeometry(y,D,0,0),f||"whiteSpace=wrap;html=1;"),I.vertex=!0,I.id=W);for(var P=0;P<Q.length;P++)w.setAttributeForCell(I,T[P],Q[P]);w.setAttributeForCell(I,
|
||||
"placeholders","1");I.style=w.replacePlaceholders(I,I.style);for(N=0;N<F.length;N++)d[F[N].to][I.getAttribute(F[N].to)]=I;null!=L&&"link"!=L&&(w.setLinkForCell(I,I.getAttribute(L)),w.setAttributeForCell(I,L,null));var Y=this.editor.graph.getPreferredSizeForCell(I);I.geometry.width="auto"==l?Y.width+x:parseFloat(l);I.geometry.height="auto"==m?Y.height+x:parseFloat(m);D+=I.geometry.height+p;c.push(w.addCell(I))}}null==f&&w.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var U=c.slice(),
|
||||
O=c.slice(),N=0;N<F.length;N++)for(var R=F[N],K=0;K<c.length;K++){var I=c[K],V=I.getAttribute(R.from);if(null!=V){w.setAttributeForCell(I,R.from,null);for(var S=V.split(","),P=0;P<S.length;P++){var X=d[R.to][S[P]];null!=X&&(O.push(w.insertEdge(null,null,R.label||"",R.invert?X:I,R.invert?I:X,R.style||w.createCurrentEdgeStyle())),mxUtils.remove(R.invert?I:X,U))}}}if(null!=G)for(K=0;K<c.length;K++)for(I=c[K],P=0;P<G.length;P++)w.setAttributeForCell(I,mxUtils.trim(G[P]),null);var ba=new mxParallelEdgeLayout(w);
|
||||
ba.spacing=q;var ea=function(){ba.execute(w.getDefaultParent());for(var b=0;b<c.length;b++){var a=w.getCellGeometry(c[b]);a.x=Math.round(w.snap(a.x));a.y=Math.round(w.snap(a.y));"auto"==l&&(a.width=Math.round(w.snap(a.width)));"auto"==m&&(a.height=Math.round(w.snap(a.height)))}};if("circle"==z){var ca=new mxCircleLayout(w);ca.resetEdges=!1;var fa=ca.isVertexIgnored;ca.isVertexIgnored=function(b){return fa.apply(this,arguments)||0>mxUtils.indexOf(c,b)};this.executeLayout(function(){ca.execute(w.getDefaultParent());
|
||||
ea()},!0,A);A=null}else if("horizontaltree"==z||"verticaltree"==z||"auto"==z&&O.length==2*c.length-1&&1==U.length){w.view.validate();var Z=new mxCompactTreeLayout(w,"horizontaltree"==z);Z.levelDistance=p;Z.edgeRouting=!1;Z.resetEdges=!1;this.executeLayout(function(){Z.execute(w.getDefaultParent(),0<U.length?U[0]:null)},!0,A);A=null}else if("horizontalflow"==z||"verticalflow"==z||"auto"==z&&1==U.length){w.view.validate();var da=new mxHierarchicalLayout(w,"horizontalflow"==z?mxConstants.DIRECTION_WEST:
|
||||
mxConstants.DIRECTION_NORTH);da.intraCellSpacing=p;da.disableEdgeStyle=!1;this.executeLayout(function(){da.execute(w.getDefaultParent(),O);w.moveCells(O,y,B)},!0,A);A=null}else if("organic"==z||"auto"==z&&O.length>c.length){w.view.validate();var aa=new mxFastOrganicLayout(w);aa.forceConstant=3*p;aa.resetEdges=!1;var ga=aa.isVertexIgnored;aa.isVertexIgnored=function(b){return ga.apply(this,arguments)||0>mxUtils.indexOf(c,b)};ba=new mxParallelEdgeLayout(w);ba.spacing=q;this.executeLayout(function(){aa.execute(w.getDefaultParent());
|
||||
ea()},!0,A);A=null}this.hideDialog()}finally{w.model.endUpdate()}null!=A&&A()}}catch(ha){this.handleError(ha)}};EditorUi.prototype.getSearch=function(b){var a="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=b&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(b,d)&&null!=urlParams[d]&&(a+=c+d+"="+urlParams[d],c="&")}else a=window.location.search;return a};EditorUi.prototype.getUrl=function(b){b=null!=b?b:window.location.pathname;var a=0<b.indexOf("?")?1:0;
|
||||
if("1"==urlParams.offline)b+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(b=0==a?b+"?":b+"&",null!=urlParams[d]&&(b+=d+"="+urlParams[d],a++))}return b};EditorUi.prototype.showLinkDialog=function(b,a,c){b=new LinkDialog(this,b,a,c,!0);this.showDialog(b.container,420,120,!0,!0);b.init()};var l=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(b){var a=
|
||||
l.apply(this,arguments),c=this.editor.graph,d=a.getSourceGraphBounds;a.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*b.x/a),Math.ceil(this.source.minimumGraphSize.height-2*b.y/a))}return d.apply(this,arguments)};var f=a.getSourceContainerSize;a.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&
|
||||
null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*a-2*b.x),Math.ceil(this.source.minimumGraphSize.height*a-2*b.y))}return f.apply(this,arguments)};a.getOutlineOffset=function(b){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var e=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(a.outline.container.clientWidth/b-(this.source.minimumGraphSize.width-
|
||||
2*e.x))/2)-e.x),Math.round(Math.max(0,(a.outline.container.clientHeight/b-(this.source.minimumGraphSize.height-2*e.y))/2)-e.y-5/b))}return new mxPoint(8/b,8/b)};var h=a.init;a.init=function(){h.apply(this,arguments);a.outline.view.getBackgroundPageBounds=function(){var b=c.getPageLayout(),a=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+b.x*a.width),this.scale*(this.translate.y+b.y*a.height),this.scale*b.width*a.width,this.scale*b.height*a.height)};a.outline.view.validateBackgroundPage()};
|
||||
this.editor.addListener("pageSelected",function(b,c){var e=c.getProperty("change"),d=a.source,f=a.outline;f.pageScale=d.pageScale;f.pageFormat=d.pageFormat;f.background=d.background;f.pageVisible=d.pageVisible;f.background=d.background;var h=mxUtils.getCurrentStyle(d.container);f.container.style.backgroundColor=h.backgroundColor;null!=d.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=d.view.backgroundPageShape.fill);a.outline.view.clear(e.previousPage.root,
|
||||
!0);a.outline.view.validate()});return a};EditorUi.prototype.getServiceCount=function(b){var a=0;null==this.drive&&"function"!==typeof window.DriveClient||a++;null==this.dropbox&&"function"!==typeof window.DropboxClient||a++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||a++;null!=this.gitHub&&a++;b&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&a++;mxClient.IS_IOS||a++;return a};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();
|
||||
var b=this.getCurrentFile(),a=null!=b||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(a);this.menus.get("viewZoom").setEnabled(a);var c=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==b||b.isRestricted());this.actions.get("makeCopy").setEnabled(!c);this.actions.get("print").setEnabled(!c);this.menus.get("exportAs").setEnabled(!c);this.menus.get("embed").setEnabled(!c);c="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(c);
|
||||
this.menus.get("newLibrary").setEnabled(c);this.menus.get("extras").setEnabled(c);b="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&b.isEditable();this.actions.get("image").setEnabled(a);this.actions.get("zoomIn").setEnabled(a);this.actions.get("zoomOut").setEnabled(a);this.actions.get("resetView").setEnabled(a);this.menus.get("edit").setEnabled(a);this.menus.get("view").setEnabled(a);this.menus.get("importFrom").setEnabled(b);this.menus.get("arrange").setEnabled(b);null!=this.toolbar&&
|
||||
(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(b),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(b));if(this.isOfflineApp()){var d=applicationCache;if(null!=d&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color=
|
||||
"#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML="";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var b=this.offlineStatus.getElementsByTagName("img");null!=b&&0<b.length&&this.alert(b[0].getAttribute("title"))}));var d=window.applicationCache,f=null,a=mxUtils.bind(this,function(){var b=d.status,a;b==d.CHECKING&&
|
||||
(b=d.DOWNLOADING);switch(b){case d.UNCACHED:a="";break;case d.IDLE:a='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';break;case d.DOWNLOADING:a='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case d.UPDATEREADY:a='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case d.OBSOLETE:a='<img title="Obsolete" border="0" src="'+IMAGE_PATH+
|
||||
'/clear.gif"/>';break;default:a='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}b!=f&&(this.offlineStatus.innerHTML=a,f=b)});mxEvent.addListener(d,"checking",a);mxEvent.addListener(d,"noupdate",a);mxEvent.addListener(d,"downloading",a);mxEvent.addListener(d,"progress",a);mxEvent.addListener(d,"cached",a);mxEvent.addListener(d,"updateready",a);mxEvent.addListener(d,"obsolete",a);mxEvent.addListener(d,"error",a);a()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=
|
||||
function(){};EditorUi.prototype.updateUserElement=function(){};var m=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){m.apply(this,arguments);var b=this.editor.graph,a=this.getCurrentFile(),c=null!=a&&a.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(c);this.actions.get("autosave").setEnabled(null!=a&&a.isEditable()&&a.isAutosaveOptional());this.actions.get("guides").setEnabled(c);this.actions.get("shadowVisible").setEnabled(c);
|
||||
this.actions.get("connectionArrows").setEnabled(c);this.actions.get("connectionPoints").setEnabled(c);this.actions.get("copyStyle").setEnabled(c&&!b.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(c&&!b.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(b.getModel().isVertex(b.getSelectionCell()));this.actions.get("createShape").setEnabled(c);this.actions.get("createRevision").setEnabled(c);this.actions.get("moveToFolder").setEnabled(null!=a);this.actions.get("makeCopy").setEnabled(null!=
|
||||
a&&!a.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&!a.isRestricted());this.actions.get("publishLink").setEnabled(null!=a&&!a.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&!a.isRestricted());this.menus.get("publish").setEnabled(null!=a&&!a.isRestricted());b=b.view.getState(b.getSelectionCell());this.actions.get("editShape").setEnabled(c&&null!=b&&null!=b.shape&&
|
||||
null!=b.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=function(b,a,c,d,f,h){var e=b.editor.graph;if("xml"==c)b.hideDialog(),b.saveData(a,"xml",mxUtils.getXml(b.editor.getGraphXml()),"text/xml");else if("svg"==c)b.hideDialog(),b.saveData(a,"svg",mxUtils.getXml(e.getSvg(d,f,h)),"image/svg+xml");else{var g=b.getFileData(!0,null,null,null,null,!0),l=e.getGraphBounds(),k=Math.floor(l.width*f/e.view.scale),m=Math.floor(l.height*
|
||||
f/e.view.scale);g.length<=MAX_REQUEST_SIZE&&k*m<MAX_AREA?(b.hideDialog(),b.saveRequest(a,c,function(b,a){return new mxXmlRequest(EXPORT_URL,"format="+c+"&base64="+(a||"0")+(null!=b?"&filename="+encodeURIComponent(b):"")+"&bg="+(null!=d?d:"none")+"&w="+k+"&h="+m+"&border="+h+"&xml="+encodeURIComponent(g))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
e):mxscript("/js/extensions.min.js",e))};EditorUi.prototype.insertLucidChart=function(b,a,c,d,f){f=JSON.parse(b);b=[];if(null!=f.state){f=JSON.parse(f.state);for(var e in f.Pages)b.push(f.Pages[e]);b.sort(function(b,a){return b.Properties.Order<a.Properties.Order?-1:b.Properties.Order>a.Properties.Order?1:0})}else b.push(f);if(0<b.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(b[0],a,c,d),null!=this.pages){var g=this.currentPage;for(a=1;a<b.length;a++)this.insertPage(),
|
||||
this.pasteLucidChart(b[a]);this.selectPage(g)}}finally{this.editor.graph.getModel().endUpdate()}}};EditorUi.prototype.insertTextAt=function(b,a,c,d,f,h,l){h=null!=h?h:!0;l=null!=l?l:!0;if(null!=b)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(b))this.parseFile(new Blob([b.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(b){4==b.readyState&&200<=b.status&&299>=b.status&&this.editor.graph.setSelectionCells(this.insertTextAt(b.responseText,
|
||||
a,c,!0))}));else if("data:"==b.substring(0,5)||!this.isOffline()&&(f||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(b))){var e=this.editor.graph;if("data:image/png;base64,"==b.substring(0,22)){var g=this.extractGraphModelFromPng(b),k=this.importXml(g,a,c,h,!0);if(0<k.length)return k}if("data:image/svg+xml;"==b.substring(0,19))try{if(g=null,"data:image/svg+xml;base64,"==b.substring(0,26)?(g=b.substring(b.indexOf(",")+1),g=window.atob&&!mxClient.IS_SF?atob(g):Base64.decode(g,!0)):g=decodeURIComponent(b.substring(b.indexOf(",")+
|
||||
1)),k=this.importXml(g,a,c,h,!0),0<k.length)return k}catch(x){}this.loadImage(b,mxUtils.bind(this,function(d){if("data:"==b.substring(0,5))this.resizeImage(d,b,mxUtils.bind(this,function(b,d,f){e.setSelectionCell(e.insertVertex(null,null,"",e.snap(a),e.snap(c),d,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(b)+";"))}),l,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/
|
||||
d.height)),g=Math.round(d.width*f);d=Math.round(d.height*f);e.setSelectionCell(e.insertVertex(null,null,"",e.snap(a),e.snap(c),g,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+";"))}}),mxUtils.bind(this,function(){var f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,b,e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.updateCellSize(f),e.fireEvent(new mxEventObject("textInserted","cells",
|
||||
[f]))}finally{e.getModel().endUpdate()}e.setSelectionCell(f)}))}else{b=this.editor.graph.zapGremlins(mxUtils.trim(b));if(this.isCompatibleString(b))return this.importXml(b,a,c,h);if(0<b.length)if('{"state":"{\\"Properties\\":'==b.substring(0,26))this.importLucidChart(b,a,c,h);else{e=this.editor.graph;f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,"",e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.fireEvent(new mxEventObject("textInserted","cells",[f])),f.value=
|
||||
b,e.updateCellSize(f),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(f.value)&&e.setLinkForCell(f,f.value),f.geometry.width+=e.gridSize,f.geometry.height+=e.gridSize}finally{e.getModel().endUpdate()}return[f]}}return[]};EditorUi.prototype.formatFileSize=function(b){var a=-1;do b/=1024,a++;while(1024<b);return Math.max(b,.1).toFixed(1)+
|
||||
" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[a]};EditorUi.prototype.convertDataUri=function(b){if("data:"==b.substring(0,5)){var a=b.indexOf(";");0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1)))}return b};EditorUi.prototype.isRemoteFileFormat=function(b,a){return/(\.*<graphml xmlns=\".*)/.test(b)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(b)||null!=a&&/(\.vsdx)($|\?)/i.test(a)||null!=a&&/(\.vssx)($|\?)/i.test(a)};EditorUi.prototype.importFile=function(b,a,c,d,f,h,l,m,q,p,x){p=
|
||||
null!=p?p:!0;var e=!1,g=null;"image"==a.substring(0,5)?(q=!1,"image/png"==a.substring(0,9)&&(a=x?null:this.extractGraphModelFromPng(b),null!=a&&0<a.length&&(g=this.importXml(a,c,d,p),q=!0)),q||(g=this.editor.graph,a=b.indexOf(";"),0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1))),p&&g.isGridEnabled()&&(c=g.snap(c),d=g.snap(d)),g=[g.insertVertex(null,null,"",c,d,f,h,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+
|
||||
";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(b,l)?(e=!0,this.parseFile(null!=q?q:new Blob([b],{type:"application/octet-stream"}),mxUtils.bind(this,function(b){if(4==b.readyState){var a=null;200<=b.status&&299>=b.status&&(b=b.responseText,null!=b&&"<mxlibrary"==b.substring(0,10)?(null!=l&&".vssx"==l.toLowerCase().substring(l.length-5)&&(l=l.substring(0,l.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,b,l))):a=this.importXml(b,c,d,p));null!=m&&m(a)}}),l)):
|
||||
/(\.vsd)($|\?)/i.test(l)||(g=this.insertTextAt(this.validateFileData(b),c,d,!0,null,p));e||null==m||m(g);return g};EditorUi.prototype.base64Encode=function(b){for(var a="",c=0,d=b.length,f,h,l;c<d;){f=b.charCodeAt(c++)&255;if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4);a+="==";break}h=b.charCodeAt(c++);if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>
|
||||
2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(h&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((h&15)<<2);a+="=";break}l=b.charCodeAt(c++);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(h&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((h&15)<<2|(l&192)>>6);
|
||||
a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(l&63)}return a};EditorUi.prototype.importFiles=function(b,a,c,d,f,h,l,m,q,p,x,w){a=null!=a?a:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;p=null!=p?p:this.maxImageBytes;var e=null!=a&&null!=c,g=!0,k=!1;if(!mxClient.IS_CHROMEAPP&&null!=b)for(var n=x||this.resampleThreshold,u=0;u<b.length;u++)if("image/"==b[u].type.substring(0,6)&&b[u].size>n){k=!0;break}var t=mxUtils.bind(this,function(){var k=this.editor.graph,q=k.gridSize;
|
||||
f=null!=f?f:mxUtils.bind(this,function(b,a,c,d,f,g,h,k,l){return null!=b&&"<mxlibrary"==b.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,b,h)),null):this.importFile(b,a,c,d,f,g,h,k,l,e,w)});h=null!=h?h:mxUtils.bind(this,function(b){k.setSelectionCells(b)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var n=b.length,u=n,t=[],v=mxUtils.bind(this,function(b,a){t[b]=a;if(0==--u){this.spinner.stop();if(null!=m)m(t);else{var c=[];k.getModel().beginUpdate();
|
||||
try{for(var e=0;e<t.length;e++){var d=t[e]();null!=d&&(c=c.concat(d))}}finally{k.getModel().endUpdate()}}h(c)}}),y=0;y<n;y++)mxUtils.bind(this,function(e){var h=b[e],k=new FileReader;k.onload=mxUtils.bind(this,function(b){if(null==l||l(h))if("image/"==h.type.substring(0,6))if("image/svg"==h.type.substring(0,9)){var k=b.target.result,m=k.indexOf(","),n=atob(k.substring(m+1)),u=mxUtils.parseXml(n),n=u.getElementsByTagName("svg");if(0<n.length){var n=n[0],t=w?null:n.getAttribute("content");null!=t&&
|
||||
"<"!=t.charAt(0)&&"%"!=t.charAt(0)&&(t=unescape(window.atob?atob(t):Base64.decode(t,!0)));null!=t&&"%"==t.charAt(0)&&(t=decodeURIComponent(t));null==t||"<mxfile "!==t.substring(0,8)&&"<mxGraphModel "!==t.substring(0,14)?v(e,mxUtils.bind(this,function(){try{if(k.substring(0,m+1),null!=u){var b=u.getElementsByTagName("svg");if(0<b.length){var g=b[0],l=parseFloat(g.getAttribute("width")),p=parseFloat(g.getAttribute("height")),n=g.getAttribute("viewBox");if(null==n||0==n.length)g.setAttribute("viewBox",
|
||||
"0 0 "+l+" "+p);else if(isNaN(l)||isNaN(p)){var x=n.split(" ");3<x.length&&(l=parseFloat(x[2]),p=parseFloat(x[3]))}k=this.createSvgDataUri(mxUtils.getXml(b[0]));var t=Math.min(1,Math.min(d/Math.max(1,l)),d/Math.max(1,p));return f(k,h.type,a+e*q,c+e*q,Math.max(1,Math.round(l*t)),Math.max(1,Math.round(p*t)),h.name)}}}catch(Z){}return null})):v(e,mxUtils.bind(this,function(){return f(t,"text/xml",a+e*q,c+e*q,0,0,h.name)}))}}else{n=!1;if("image/png"==h.type){var y=w?null:this.extractGraphModelFromPng(b.target.result);
|
||||
if(null!=y&&0<y.length){var C=new Image;C.src=b.target.result;v(e,mxUtils.bind(this,function(){return f(y,"text/xml",a+e*q,c+e*q,C.width,C.height,h.name)}));n=!0}}n||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(b.target.result,mxUtils.bind(this,function(k){this.resizeImage(k,
|
||||
b.target.result,mxUtils.bind(this,function(k,l,m){v(e,mxUtils.bind(this,function(){if(null!=k&&k.length<p){var n=g&&this.isResampleImage(b.target.result,x)?Math.min(1,Math.min(d/l,d/m)):1;return f(k,h.type,a+e*q,c+e*q,Math.round(l*n),Math.round(m*n),h.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),g,d,x)})))}else f(b.target.result,h.type,a+e*q,c+e*q,240,160,h.name,function(b){v(e,function(){return b})})});/(\.vsdx)($|\?)/i.test(h.name)||/(\.vssx)($|\?)/i.test(h.name)?
|
||||
f(null,h.type,a+e*q,c+e*q,240,160,h.name,function(b){v(e,function(){return b})},h):"image"==h.type.substring(0,5)?k.readAsDataURL(h):k.readAsText(h)})(y)});k?this.confirmImageResize(function(b){g=b;t()},q):t()};EditorUi.prototype.confirmImageResize=function(b,a){a=null!=a?a:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},e=function(a,e){mxSettings.setResizeImages(a?e:null);mxSettings.save();c();b(e)},d=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():
|
||||
null;null==d||a?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(b){e(b,!0)},function(b){e(b,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):e(!1,d)};EditorUi.prototype.parseFile=function(b,a,c){c=null!=c?c:b.name;var e=new FormData;
|
||||
e.append("format","xml");e.append("upfile",b,c);var d=new XMLHttpRequest;d.open("POST",OPEN_URL);d.onreadystatechange=function(){a(d)};d.send(e)};EditorUi.prototype.isResampleImage=function(b,a){a=null!=a?a:this.resampleThreshold;return b.length>a};EditorUi.prototype.resizeImage=function(b,a,c,d,f,h){f=null!=f?f:this.maxImageSize;var e=Math.max(1,b.width),g=Math.max(1,b.height);if(d&&this.isResampleImage(a,h))try{var k=Math.max(e/f,g/f);if(1<k){var l=Math.round(e/k),m=Math.round(g/k),n=document.createElement("canvas");
|
||||
n.width=l;n.height=m;n.getContext("2d").drawImage(b,0,0,l,m);var v=n.toDataURL();if(v.length<a.length){var D=document.createElement("canvas");D.width=l;D.height=m;var y=D.toDataURL();v!==y&&(a=v,e=l,g=m)}}}catch(B){}c(a,e,g)};EditorUi.prototype.crcTable=[];for(var f=0;256>f;f++)for(var d=f,c=0;8>c;c++)d=1==(d&1)?3988292384^d>>>1:d>>>1,EditorUi.prototype.crcTable[f]=d;EditorUi.prototype.updateCRC=function(b,a,c,d){for(var e=0;e<d;e++)b=EditorUi.prototype.crcTable[(b^a[c+e])&255]^b>>>8;return b};EditorUi.prototype.writeGraphModelToPng=
|
||||
function(b,a,c,d,f){function e(b,a){var c=k;k+=a;return b.substring(c,k)}function g(b){b=e(b,4);return b.charCodeAt(3)+(b.charCodeAt(2)<<8)+(b.charCodeAt(1)<<16)+(b.charCodeAt(0)<<24)}function h(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}b=b.substring(b.indexOf(",")+1);b=window.atob?atob(b):Base64.decode(b,!0);var k=0;if(e(b,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=f&&f();else if(e(b,4),"IHDR"!=e(b,4))null!=f&&f();else{e(b,17);f=b.substring(0,
|
||||
k);do{var l=g(b);if("IDAT"==e(b,4)){f=b.substring(0,k-8);c=c+String.fromCharCode(0)+("zTXt"==a?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,a,0,4);d=this.updateCRC(d,c,0,c.length);f+=h(c.length)+a+c+h(d^4294967295);f+=b.substring(k-8,b.length);break}f+=b.substring(k-8,k-4+l);d=e(b,l);e(b,4)}while(l);return"data:image/png;base64,"+(window.btoa?btoa(f):Base64.encode(f,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(b){var a=null;try{var c=b.substring(b.indexOf(",")+1),d=
|
||||
window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(b,c,e){b=d.substring(b+8,b+8+e);"zTXt"==c?(e=b.indexOf(String.fromCharCode(0)),"mxGraphModel"==b.substring(0,e)&&(b=this.editor.graph.bytesToString(pako.inflateRaw(b.substring(e+2))).replace(/\+/g," "),null!=b&&0<b.length&&(a=b))):"tEXt"==c&&(b=b.split(String.fromCharCode(0)),1<b.length&&"mxGraphModel"==b[0]&&(a=b[1]));if(null!=a||"IDAT"==c)return!0}))}catch(n){}null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));
|
||||
null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));return a};EditorUi.prototype.loadImage=function(b,a,c){var e=new Image;e.onload=function(){a(e)};null!=c&&(e.onerror=c);e.src=b};var h=EditorUi.prototype.init;EditorUi.prototype.init=function(){function b(b){var c=b.indexOf(",");0<c&&(b=a.getPageById(b.substring(c+1)))&&a.selectPage(b)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var a=this,c=this.editor.graph,d=c.addClickHandler;c.addClickHandler=function(a,
|
||||
e,f){var h=e;e=function(a,e){if(null==e){var d=mxEvent.getSource(a);"a"==d.nodeName.toLowerCase()&&(e=d.getAttribute("href"))}null!=e&&c.isPageLink(e)&&(b(e),mxEvent.consume(a));null!=h&&h(a,e)};d.call(this,a,e,f)};h.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(c.view.canvas.ownerSVGElement,null,!0);a.actions.get("print").funct=function(){a.showDialog((new PrintDialog(a)).container,360,null!=a.pages&&1<a.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");
|
||||
var f=c.getGlobalVariable;c.getGlobalVariable=function(b){return"page"==b&&null!=a.currentPage?a.currentPage.getName():"pagenumber"==b?null!=a.currentPage&&null!=a.pages?mxUtils.indexOf(a.pages,a.currentPage)+1:1:f.apply(this,arguments)};var l=c.createLinkForHint;c.createLinkForHint=function(e,d){var f=c.isPageLink(e);if(f){var h=e.indexOf(",");0<h&&(h=a.getPageById(e.substring(h+1)),d=null!=h?h.getName():mxResources.get("pageNotFound"))}h=l.apply(this,arguments);f&&mxEvent.addListener(h,"click",
|
||||
function(a){b(e);mxEvent.consume(a)});return h};var m=c.labelLinkClicked;c.labelLinkClicked=function(a,e,d){var f=e.getAttribute("href");c.isPageLink(f)?(b(f),mxEvent.consume(d)):m.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var b=a.defaultFilename,c=a.getCurrentFile();null!=c&&(b=null!=c.getTitle()?c.getTitle():b);return b};var t=this.actions.get("print");t.setEnabled(!mxClient.IS_IOS||!navigator.standalone);t.visible=t.isEnabled();if(!this.editor.chromeless){var q=function(){window.setTimeout(function(){p.innerHTML=
|
||||
" ";p.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||c.container.addEventListener("paste",mxUtils.bind(this,function(b){var a=
|
||||
this.editor.graph;if(!mxEvent.isConsumed(b))try{for(var c=b.clipboardData||b.originalEvent.clipboardData,e=!1,d=0;d<c.types.length;d++)if("text/"===c.types[d].substring(0,5)){e=!0;break}if(!e){var f=c.items;for(index in f){var h=f[index];if("file"===h.kind){if(a.isEditing())this.importFiles([h.getAsFile()],0,0,this.maxImageSize,function(b,c,e,d,f,h){a.insertImage(b,f,h)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()});else{var k=this.editor.graph.getInsertPoint();
|
||||
this.importFiles([h.getAsFile()],k.x,k.y,this.maxImageSize);mxEvent.consume(b)}break}}}}catch(J){}}),!1);var p=document.createElement("div");p.style.position="absolute";p.style.whiteSpace="nowrap";p.style.overflow="hidden";p.style.display="block";p.contentEditable=!0;mxUtils.setOpacity(p,0);p.style.width="1px";p.style.height="1px";p.innerHTML=" ";var x=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,
|
||||
"keydown",mxUtils.bind(this,function(b){var a=mxEvent.getSource(b);null==c.container||!c.isEnabled()||c.isMouseDown||c.isEditing()||null!=this.dialog||"INPUT"==a.nodeName||"TEXTAREA"==a.nodeName||!(224==b.keyCode||!mxClient.IS_MAC&&17==b.keyCode||mxClient.IS_MAC&&91==b.keyCode)||x||(p.style.left=c.container.scrollLeft+10+"px",p.style.top=c.container.scrollTop+10+"px",c.container.appendChild(p),x=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){p.focus();document.execCommand("selectAll",!1,null)},
|
||||
0):(p.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(b){var a=b.keyCode;window.setTimeout(mxUtils.bind(this,function(){!x||224!=a&&17!=a&&91!=a||(x=!1,c.isEditing()||null!=this.dialog||null==c.container||c.container.focus(),p.parentNode.removeChild(p))}),0)}));mxEvent.addListener(p,"copy",mxUtils.bind(this,function(b){c.isEnabled()&&(mxClipboard.copy(c),this.copyCells(p),q())}));mxEvent.addListener(p,"cut",mxUtils.bind(this,function(b){c.isEnabled()&&
|
||||
(this.copyCells(p,!0),q())}));mxEvent.addListener(p,"paste",mxUtils.bind(this,function(b){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&(p.innerHTML=" ",p.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(b,p);p.innerHTML=" "}),0))}),!0);var w=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==p?!0:w.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||
|
||||
0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(b){var a=this.editor.graph,c=a.cellEditor.text2,e=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(b){null!=e&&(e.parentNode.removeChild(e),e=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(b){null==e&&(!mxClient.IS_IE||10<document.documentMode)&&(e=this.highlightElement(c));b.stopPropagation();
|
||||
b.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(b){null!=e&&(e.parentNode.removeChild(e),e=null);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,function(b,c,e,d,f,h){a.insertImage(b,f,h)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()},mxEvent.isControlDown(b));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")){var c=b.dataTransfer.getData("text/uri-list");
|
||||
/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(b){var e=Math.max(1,b.width);b=Math.max(1,b.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,e)),d/Math.max(1,b));a.insertImage(decodeURIComponent(c),e*d,b*d)})):document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(b.dataTransfer.types,
|
||||
"text/plain")&&document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"));b.stopPropagation();b.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){t=document.createElement("div");t.style.position="absolute";t.style.top="95px";t.style.left="250px";t.style.width="2000px";t.style.height="30px";t.style.background="whiteSmoke";document.body.appendChild(t);var A=document.createElement("div");A.style.position="absolute";A.style.top="125px";A.style.left="220px";
|
||||
A.style.width="30px";A.style.height="1000px";A.style.background="whiteSmoke";document.body.appendChild(A);var D=document.createElement("div");D.style.position="absolute";D.style.top="95px";D.style.left="220px";D.style.width="30px";D.style.height="30px";D.style.background="whiteSmoke";document.body.appendChild(D);this.vRuler=new mxRuler(this.editor.graph,A,!0);this.hRuler=new mxRuler(this.editor.graph,t,!1)}if("1"==urlParams.test){t=document.getElementById("geFooter");null!=t&&(this.styleInput=document.createElement("input"),
|
||||
this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),t.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,
|
||||
mxUtils.bind(this,function(b,a){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var y=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==this.styleInput?!0:y.apply(this,arguments)}}t=document.getElementById("geInfo");null!=t&&t.parentNode.removeChild(t);if(Graph.fileSupport){var B=
|
||||
null;mxEvent.addListener(c.container,"dragleave",function(b){c.isEnabled()&&(null!=B&&(B.parentNode.removeChild(B),B=null),b.stopPropagation(),b.preventDefault())});mxEvent.addListener(c.container,"dragover",mxUtils.bind(this,function(b){null==B&&(!mxClient.IS_IE||10<document.documentMode)&&(B=this.highlightElement(c.container));null!=this.sidebar&&this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()}));mxEvent.addListener(c.container,"drop",mxUtils.bind(this,function(b){null!=B&&(B.parentNode.removeChild(B),
|
||||
B=null);if(c.isEnabled()){var a=mxUtils.convertPoint(c.container,mxEvent.getClientX(b),mxEvent.getClientY(b)),e=c.view.translate,d=c.view.scale,f=a.x/d-e.x,h=a.y/d-e.y;mxEvent.isAltDown(b)&&(h=f=0);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,f,h,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(b),null,null,mxEvent.isShiftDown(b));else{var k=0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):null,a=this.extractGraphModelFromEvent(b,
|
||||
null!=this.pages);if(null!=a)c.setSelectionCells(this.importXml(a,f,h,!0));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")){var g=b.dataTransfer.getData("text/html"),a=document.createElement("div");a.innerHTML=g;var l=null,e=a.getElementsByTagName("img");null!=e&&1==e.length?(g=e[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)||(l=!0)):(a=a.getElementsByTagName("a"),null!=a&&1==a.length&&(g=a[0].getAttribute("href")));var p=!0,q=mxUtils.bind(this,function(){c.setSelectionCells(this.insertTextAt(g,
|
||||
f,h,!0,l,null,p))});l&&g.length>this.resampleThreshold?this.confirmImageResize(function(b){p=b;q()},mxEvent.isControlDown(b)):q()}else null!=k&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)?this.loadImage(decodeURIComponent(k),mxUtils.bind(this,function(b){var a=Math.max(1,b.width);b=Math.max(1,b.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,a)),e/Math.max(1,b));c.setSelectionCell(c.insertVertex(null,null,"",f,h,a*e,b*e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
||||
k+";"))}),mxUtils.bind(this,function(b){c.setSelectionCells(this.insertTextAt(k,f,h,!0))})):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&c.setSelectionCells(this.insertTextAt(b.dataTransfer.getData("text/plain"),f,h,!0))}}b.stopPropagation();b.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=
|
||||
mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(b,a){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),
|
||||
this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(b,a){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(b,a){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",
|
||||
mxUtils.bind(this,function(b,a){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(b,a){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||
|
||||
0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=function(b,a){var c=this.editor.graph;if(c.isSelectionEmpty())b.innerHTML="";else{var e=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),d=mxUtils.getXml(this.editor.graph.encodeCells(e));mxUtils.setTextContent(b,encodeURIComponent(d));a?(c.removeCells(e,!1),c.lastPasteXml=null):(c.lastPasteXml=
|
||||
d,c.pasteCounter=0);b.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(b,a){if(!mxEvent.isConsumed(b)){var c=a.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var e=c[0].getAttribute("data-lucid-content");null!=e&&0<e.length&&(this.importLucidChart(e,0,0),mxEvent.consume(b))}else{var e=this.editor.graph,d=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(a):
|
||||
a.textContent),f=!1;try{var h=d.lastIndexOf("%3E");0<=h&&h<d.length-3&&(d=d.substring(0,h+3))}catch(q){}try{var c=a.getElementsByTagName("span"),l=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(d);this.isCompatibleString(l)&&(f=!0,d=l)}catch(q){}e.lastPasteXml==d?e.pasteCounter++:(e.lastPasteXml=d,e.pasteCounter=0);c=e.pasteCounter*e.gridSize;if(null!=d&&0<d.length&&(f||this.isCompatibleString(d)?e.setSelectionCells(this.importXml(d,c,c)):(f=e.getInsertPoint(),
|
||||
e.isMouseInsertPoint()&&(c=0,e.lastPasteXml==d&&0<e.pasteCounter&&e.pasteCounter--),e.setSelectionCells(this.insertTextAt(d,f.x+c,f.y+c,!0))),!e.isSelectionEmpty())){e.scrollCellToVisible(e.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(e.view.getState(e.getSelectionCell()));try{mxEvent.consume(b)}catch(q){}}}}};EditorUi.prototype.addFileDropHandler=function(b){if(Graph.fileSupport)for(var a=null,c=0;c<b.length;c++)mxEvent.addListener(b[c],"dragleave",function(b){null!=a&&(a.parentNode.removeChild(a),
|
||||
a=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(b[c],"dragover",mxUtils.bind(this,function(b){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==a&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(a=this.highlightElement());b.stopPropagation();b.preventDefault()})),mxEvent.addListener(b[c],"drop",mxUtils.bind(this,function(b){null!=a&&(a.parentNode.removeChild(a),a=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<b.dataTransfer.files.length)this.hideDialog(),
|
||||
"1"==urlParams.embed?this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(b)&&!mxEvent.isShiftDown(b)):this.openFiles(b.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(b);if(null==c){var e=null!=b.dataTransfer?b.dataTransfer:b.clipboardData;null!=e&&(10==document.documentMode||11==document.documentMode?c=e.getData("Text"):(c=null,c=0<=mxUtils.indexOf(e.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(e.types,
|
||||
"text/html")?e.getData("text/html"):null,null!=c&&0<c.length?(e=document.createElement("div"),e.innerHTML=c,e=e.getElementsByTagName("img"),0<e.length&&(c=e[0].getAttribute("src"))):0<=mxUtils.indexOf(e.types,"text/plain")&&(c=e.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,
|
||||
function(b){200<=b.getStatus()&&299>=b.getStatus()&&this.openLocalFile(b.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}b.stopPropagation();b.preventDefault()}))};EditorUi.prototype.highlightElement=function(b){var a=0,c=0,d,f;if(null==b){f=document.body;
|
||||
var h=document.documentElement;d=(f.clientWidth||h.clientWidth)-3;f=Math.max(f.clientHeight||0,h.clientHeight)-3}else a=b.offsetTop,c=b.offsetLeft,d=b.clientWidth,f=b.clientHeight;h=document.createElement("div");h.style.zIndex=mxPopupMenu.prototype.zIndex+2;h.style.border="3px dotted rgb(254, 137, 12)";h.style.pointerEvents="none";h.style.position="absolute";h.style.top=a+"px";h.style.left=c+"px";h.style.width=Math.max(0,d-3)+"px";h.style.height=Math.max(0,f-3)+"px";null!=b&&b.parentNode==this.editor.graph.container?
|
||||
this.editor.graph.container.appendChild(h):document.body.appendChild(h);return h};EditorUi.prototype.stringToCells=function(b){b=mxUtils.parseXml(b);var a=this.editor.extractGraphModel(b.documentElement);b=[];if(null!=a){var c=new mxCodec(a.ownerDocument),d=new mxGraphModel;c.decode(a,d);a=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(a);c++)b.push(d.getChildAt(a,c))}return b};EditorUi.prototype.openFiles=function(b,a){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=
|
||||
0;c<b.length;c++)mxUtils.bind(this,function(b){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var e=c.target.result,d=b.name;if(null!=d&&0<d.length)if(/(\.png)$/i.test(d)&&(d=d.substring(0,d.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(e,d))d=0<=d.lastIndexOf(".")?d.substring(0,d.lastIndexOf("."))+".xml":d+".xml",this.parseFile(b,mxUtils.bind(this,function(b){if(4==b.readyState)if(this.spinner.stop(),200<=b.status&&299>=
|
||||
b.status)if(b=b.responseText,"<mxlibrary"==b.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,a);null!=d&&".vssx"==d.toLowerCase().substring(d.length-5)&&(d=d.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,b,d))}catch(p){this.handleError(p,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(b,d,a);else this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==e.substring(0,26))/(\.json)$/i.test(d)&&(d=d.substring(0,d.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,d,a),this.importLucidChart(e,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,a);try{this.loadLibrary(new LocalLibrary(this,c.target.result,b.name))}catch(q){this.handleError(q,mxResources.get("errorLoadingFile"))}}else"image/png"==b.type.substring(0,9)&&(e=this.extractGraphModelFromPng(e)),this.spinner.stop(),this.openLocalFile(e,d,a)});c.onerror=mxUtils.bind(this,function(b){this.spinner.stop();this.handleError(b);window.openFile=null});"image"===b.type.substring(0,5)&&"image/svg"!==b.type.substring(0,9)?c.readAsDataURL(b):c.readAsText(b)})(b[c])};EditorUi.prototype.openLocalFile=
|
||||
function(b,a,c){var e=this.getCurrentFile(),d=mxUtils.bind(this,function(){window.openFile=null;if(null==a&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var e=mxUtils.parseXml(b);null!=e&&(this.editor.setGraphXml(e.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,b,a||this.defaultFilename,c))});null!=b&&0<b.length&&(null!=e&&e.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(b,a),window.openWindow(this.getUrl(),
|
||||
null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,d,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):d())};EditorUi.prototype.getBasenames=function(){var b={};if(null!=this.pages)for(var a=0;a<this.pages.length;a++)this.updatePageRoot(this.pages[a]),this.addBasenamesForCell(this.pages[a].root,b);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),b);var a=[],c;for(c in b)a.push(c);return a};EditorUi.prototype.addBasenamesForCell=function(b,
|
||||
a){function c(b){if(null!=b){var c=b.lastIndexOf(".");0<c&&(b=b.substring(c+1,b.length));null==a[b]&&(a[b]=!0)}}var e=this.editor.graph,d=e.getCellStyle(b);c(mxStencilRegistry.getBasenameForStencil(d[mxConstants.STYLE_SHAPE]));e.model.isEdge(b)&&(c(mxMarker.getPackageForType(d[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(d[mxConstants.STYLE_ENDARROW])));for(var d=e.model.getChildCount(b),f=0;f<d;f++)this.addBasenamesForCell(e.model.getChildAt(b,f),a)};EditorUi.prototype.setGraphEnabled=
|
||||
function(b){this.diagramContainer.style.visibility=b?"":"hidden";this.formatContainer.style.visibility=b?"":"hidden";this.sidebarFooterContainer.style.display=b?"":"none";this.sidebarContainer.style.display=b?"":"none";this.hsplit.style.display=b?"":"none";this.editor.graph.setEnabled(b)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,
|
||||
function(b,a,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=b&&0<b.length?(this.setFileData(b),this.showLayersDialog()):(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&
|
||||
(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(b,a){null!=b?b.getPublicUrl(a):a(null)};EditorUi.prototype.createLoadMessage=function(b){var a=this.editor.graph;return{event:b,pageVisible:a.pageVisible,translate:a.view.translate,scale:a.view.scale,page:a.view.getBackgroundPageBounds(),bounds:a.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(b){var a=null,c=!1,d=!1,f=
|
||||
null,h=mxUtils.bind(this,function(b,a){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,h);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){function h(b){if(null!=b&&"function"===typeof b.charAt&&"<"!=b.charAt(0))try{"data:image/svg+xml;base64,"==b.substring(0,26)?b=atob(b.substring(26)):"data:image/svg+xml;utf8,"==
|
||||
b.substring(0,24)&&(b=b.substring(24)),null!=b&&("%"==b.charAt(0)?b=decodeURIComponent(b):"<"!=b.charAt(0)&&(b=this.editor.graph.decompress(b)))}catch(G){}return b}var g=e.data;if("json"==urlParams.proto){try{g=JSON.parse(g)}catch(L){g=null}if(null==g)return;if("dialog"==g.action){this.showError(null!=g.titleKey?mxResources.get(g.titleKey):g.title,null!=g.messageKey?mxResources.get(g.messageKey):g.message,null!=g.buttonKey?mxResources.get(g.buttonKey):g.button);null!=g.modified&&(this.editor.modified=
|
||||
g.modified);return}if("prompt"==g.action){this.spinner.stop();var k=new FilenameDialog(this,g.defaultValue||"",null!=g.okKey?mxResources.get(g.okKey):null,function(b){null!=b&&l.postMessage(JSON.stringify({event:"prompt",value:b,message:g}),"*")},null!=g.titleKey?mxResources.get(g.titleKey):g.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==g.action){k=null;k="data:image/png;base64,"==g.xml.substring(0,22)?this.extractGraphModelFromPng(g.xml):h(g.xml);this.spinner.stop();
|
||||
k=new DraftDialog(this,mxResources.get("draftFound",[g.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"edit",message:g}),"*")}),mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),g.editKey?mxResources.get(g.editKey):null,g.discardKey?mxResources.get(g.discardKey):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(b){b&&
|
||||
this.actions.get("exit").funct()}));try{k.init()}catch(L){l.postMessage(JSON.stringify({event:"draft",error:L.toString(),message:g}),"*")}return}if("template"==g.action){this.spinner.stop();k=new NewDialog(this,!1,null!=g.callback,mxUtils.bind(this,function(a,c){a=a||this.emptyDiagramXml;null!=g.callback?l.postMessage(JSON.stringify({event:"template",xml:a,blank:a==this.emptyDiagramXml,name:c}),"*"):(b(a,e,a!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(k.container,
|
||||
620,440,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));k.init();return}if("status"==g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var m=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||g.show?this.spinner.spin(document.body,m):this.spinner.stop();
|
||||
return}if("export"==g.action){if("png"==g.format||"xmlpng"==g.format){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var n=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var t=this.editor.graph,u=mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();var a=this.createLoadMessage("export");a.format=g.format;a.xml=encodeURIComponent(n);a.data=b;l.postMessage(JSON.stringify(a),
|
||||
"*")}),v=mxUtils.bind(this,function(b){null==b&&(b=Editor.blankImage);"xmlpng"==g.format&&(b=this.writeGraphModelToPng(b,"zTXt","mxGraphModel",atob(this.editor.graph.compress(n))));t!=this.editor.graph&&t.container.parentNode.removeChild(t.container);u(b)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var t=this.createTemporaryGraph(t.getStylesheet()),C=t.getGlobalVariable,z=this.pages[0];t.getGlobalVariable=function(b){return"page"==b?z.getName():"pagenumber"==
|
||||
b?1:C.apply(this,arguments)};document.body.appendChild(t.container);t.model.setRoot(z.root)}this.exportToCanvas(mxUtils.bind(this,function(b){v(b.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){v(null)}),null,null,null,null,null,null,t)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==g.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(n)))).send(mxUtils.bind(this,function(b){200<=b.getStatus()&&299>=b.getStatus()?u("data:image/png;base64,"+
|
||||
b.getText()):v(null)}),mxUtils.bind(this,function(){v(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);m=this.createLoadMessage("export");if("html2"==g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=this.getXmlFileData(),m.xml=mxUtils.getXml(k),m.data=this.getFileData(null,null,!0,null,null,null,k),m.format=g.format;else if("html"==g.format)n=this.editor.getGraphXml(),m.data=this.getHtml(n,this.editor.graph),m.xml=mxUtils.getXml(n),m.format=
|
||||
g.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);m.xml=this.getFileData(!0);m.format="svg";if(g.embedImages||null==g.embedImages){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==g.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=
|
||||
this.createSvgDataUri(b);l.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(b));l.postMessage(JSON.stringify(m),"*")}));return}k="xmlsvg"==g.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));m.data=this.createSvgDataUri(k)}l.postMessage(JSON.stringify(m),"*")}return}if("load"==
|
||||
g.action)d=1==g.autosave,this.hideDialog(),null!=g.modified&&null==urlParams.modified&&(urlParams.modified=g.modified),null!=g.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=g.saveAndExit),null!=g.title&&null!=this.buttonContainer&&(k=document.createElement("span"),mxUtils.write(k,g.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop=
|
||||
"6px"),this.buttonContainer.appendChild(k)),g=null!=g.xmlpng?this.extractGraphModelFromPng(g.xmlpng):null!=g.xml&&"data:image/png;base64,"==g.xml.substring(0,22)?this.extractGraphModelFromPng(g.xml):g.xml;else{l.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(g)}),"*");return}}g=h(g);c=!0;try{b(g,e)}catch(L){this.handleError(L)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var F=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?
|
||||
this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});f=F();d&&null==a&&(a=mxUtils.bind(this,function(b,a){var e=F();if(e!=f&&!c){var d=this.createLoadMessage("autosave");d.xml=e;e=JSON.stringify(d);(window.opener||window.parent).postMessage(e,"*")}f=e}),this.editor.graph.model.addListener(mxEvent.CHANGE,a),this.editor.graph.addListener("gridSizeChanged",a),this.editor.graph.addListener("shadowVisibleChanged",a),this.addListener("pageFormatChanged",a),this.addListener("pageScaleChanged",
|
||||
a),this.addListener("backgroundColorChanged",a),this.addListener("backgroundImageChanged",a),this.addListener("foldingEnabledChanged",a),this.addListener("mathEnabledChanged",a),this.addListener("gridEnabledChanged",a),this.addListener("guidesEnabledChanged",a),this.addListener("pageViewChanged",a));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||l.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var l=window.opener||window.parent,h="json"==urlParams.proto?JSON.stringify({event:"init"}):
|
||||
urlParams.ready||"ready";l.postMessage(h,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var b=document.createElement("div");b.style.display="inline-block";b.style.position="absolute";b.style.paddingTop="atlas"==uiTheme?"2px":"3px";b.style.paddingLeft="8px";b.style.paddingBottom="2px";var a=document.createElement("button");mxUtils.write(a,mxResources.get("save"));a.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");a.className="geBigButton";a.style.fontSize="12px";
|
||||
a.style.padding="4px 6px 4px 6px";a.style.borderRadius="3px";mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));b.appendChild(a);"1"==urlParams.saveAndExit&&(a=document.createElement("a"),mxUtils.write(a,mxResources.get("saveAndExit")),a.setAttribute("title",mxResources.get("saveAndExit")),a.style.fontSize="12px",a.style.marginLeft="6px",a.style.padding="4px",a.style.cursor="pointer",mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),
|
||||
b.appendChild(a));a=document.createElement("a");mxUtils.write(a,mxResources.get("exit"));a.setAttribute("title",mxResources.get("exit"));a.style.fontSize="12px";a.style.marginLeft="6px";a.style.marginRight="20px";a.style.padding="4px";a.style.cursor="pointer";mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));b.appendChild(a);this.toolbar.container.appendChild(b);this.toolbar.staticElements.push(b);b.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=
|
||||
function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(b){this.importCsv(b)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(b){try{var a=b.split("\n"),c=[];if(0<a.length){var d={},f=null,h=null,l="auto",m="auto",q=40,p=40,x=0,w=this.editor.graph;w.getGraphBounds();
|
||||
for(var A=function(){w.setSelectionCells(O);w.scrollCellToVisible(w.getSelectionCell())},D=w.getFreeInsertPoint(),y=D.x,B=D.y,D=B,C=null,z="auto",F=[],L=null,G=null,E=0;E<a.length&&"#"==a[E].charAt(0);){b=a[E];for(E++;E<a.length&&"\\"==b.charAt(b.length-1)&&"#"==a[E].charAt(0);)b=b.substring(0,b.length-1)+mxUtils.trim(a[E].substring(1)),E++;if("#"!=b.charAt(1)){var M=b.indexOf(":");if(0<M){var H=mxUtils.trim(b.substring(1,M)),J=mxUtils.trim(b.substring(M+1));"label"==H?C=w.sanitizeHtml(J):"style"==
|
||||
H?f=J:"identity"==H&&0<J.length&&"-"!=J?h=J:"width"==H?l=J:"height"==H?m=J:"ignore"==H?G=J.split(","):"connect"==H?F.push(JSON.parse(J)):"link"==H?L=J:"padding"==H?x=parseFloat(J):"edgespacing"==H?q=parseFloat(J):"nodespacing"==H?p=parseFloat(J):"layout"==H&&(z=J)}}}var T=this.editor.csvToArray(a[E]);b=null;if(null!=h)for(var K=0;K<T.length;K++)if(h==T[K]){b=K;break}null==C&&(C="%"+T[0]+"%");if(null!=F)for(var N=0;N<F.length;N++)null==d[F[N].to]&&(d[F[N].to]={});w.model.beginUpdate();try{for(K=E+
|
||||
1;K<a.length;K++){var Q=this.editor.csvToArray(a[K]);if(Q.length==T.length){var I=null,W=null!=b?Q[b]:null;null!=W&&(I=w.model.getCell(W));null==I&&(I=new mxCell(C,new mxGeometry(y,D,0,0),f||"whiteSpace=wrap;html=1;"),I.vertex=!0,I.id=W);for(var P=0;P<Q.length;P++)w.setAttributeForCell(I,T[P],Q[P]);w.setAttributeForCell(I,"placeholders","1");I.style=w.replacePlaceholders(I,I.style);for(N=0;N<F.length;N++)d[F[N].to][I.getAttribute(F[N].to)]=I;null!=L&&"link"!=L&&(w.setLinkForCell(I,I.getAttribute(L)),
|
||||
w.setAttributeForCell(I,L,null));var Y=this.editor.graph.getPreferredSizeForCell(I);I.geometry.width="auto"==l?Y.width+x:parseFloat(l);I.geometry.height="auto"==m?Y.height+x:parseFloat(m);D+=I.geometry.height+p;c.push(w.addCell(I))}}null==f&&w.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var U=c.slice(),O=c.slice(),N=0;N<F.length;N++)for(var R=F[N],K=0;K<c.length;K++){var I=c[K],V=I.getAttribute(R.from);if(null!=V){w.setAttributeForCell(I,R.from,null);for(var S=V.split(","),P=0;P<S.length;P++){var X=
|
||||
d[R.to][S[P]];null!=X&&(O.push(w.insertEdge(null,null,R.label||"",R.invert?X:I,R.invert?I:X,R.style||w.createCurrentEdgeStyle())),mxUtils.remove(R.invert?I:X,U))}}}if(null!=G)for(K=0;K<c.length;K++)for(I=c[K],P=0;P<G.length;P++)w.setAttributeForCell(I,mxUtils.trim(G[P]),null);var ba=new mxParallelEdgeLayout(w);ba.spacing=q;var ea=function(){ba.execute(w.getDefaultParent());for(var b=0;b<c.length;b++){var a=w.getCellGeometry(c[b]);a.x=Math.round(w.snap(a.x));a.y=Math.round(w.snap(a.y));"auto"==l&&
|
||||
(a.width=Math.round(w.snap(a.width)));"auto"==m&&(a.height=Math.round(w.snap(a.height)))}};if("circle"==z){var ca=new mxCircleLayout(w);ca.resetEdges=!1;var fa=ca.isVertexIgnored;ca.isVertexIgnored=function(b){return fa.apply(this,arguments)||0>mxUtils.indexOf(c,b)};this.executeLayout(function(){ca.execute(w.getDefaultParent());ea()},!0,A);A=null}else if("horizontaltree"==z||"verticaltree"==z||"auto"==z&&O.length==2*c.length-1&&1==U.length){w.view.validate();var Z=new mxCompactTreeLayout(w,"horizontaltree"==
|
||||
z);Z.levelDistance=p;Z.edgeRouting=!1;Z.resetEdges=!1;this.executeLayout(function(){Z.execute(w.getDefaultParent(),0<U.length?U[0]:null)},!0,A);A=null}else if("horizontalflow"==z||"verticalflow"==z||"auto"==z&&1==U.length){w.view.validate();var da=new mxHierarchicalLayout(w,"horizontalflow"==z?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);da.intraCellSpacing=p;da.disableEdgeStyle=!1;this.executeLayout(function(){da.execute(w.getDefaultParent(),O);w.moveCells(O,y,B)},!0,A);A=null}else if("organic"==
|
||||
z||"auto"==z&&O.length>c.length){w.view.validate();var aa=new mxFastOrganicLayout(w);aa.forceConstant=3*p;aa.resetEdges=!1;var ga=aa.isVertexIgnored;aa.isVertexIgnored=function(b){return ga.apply(this,arguments)||0>mxUtils.indexOf(c,b)};ba=new mxParallelEdgeLayout(w);ba.spacing=q;this.executeLayout(function(){aa.execute(w.getDefaultParent());ea()},!0,A);A=null}this.hideDialog()}finally{w.model.endUpdate()}null!=A&&A()}}catch(ha){this.handleError(ha)}};EditorUi.prototype.getSearch=function(b){var a=
|
||||
"";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=b&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(b,d)&&null!=urlParams[d]&&(a+=c+d+"="+urlParams[d],c="&")}else a=window.location.search;return a};EditorUi.prototype.getUrl=function(b){b=null!=b?b:window.location.pathname;var a=0<b.indexOf("?")?1:0;if("1"==urlParams.offline)b+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),
|
||||
d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(b=0==a?b+"?":b+"&",null!=urlParams[d]&&(b+=d+"="+urlParams[d],a++))}return b};EditorUi.prototype.showLinkDialog=function(b,a,c){b=new LinkDialog(this,b,a,c,!0);this.showDialog(b.container,420,120,!0,!0);b.init()};var l=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(b){var a=l.apply(this,arguments),c=this.editor.graph,d=a.getSourceGraphBounds;a.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&
|
||||
null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*b.x/a),Math.ceil(this.source.minimumGraphSize.height-2*b.y/a))}return d.apply(this,arguments)};var f=a.getSourceContainerSize;a.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*
|
||||
a-2*b.x),Math.ceil(this.source.minimumGraphSize.height*a-2*b.y))}return f.apply(this,arguments)};a.getOutlineOffset=function(b){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var e=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(a.outline.container.clientWidth/b-(this.source.minimumGraphSize.width-2*e.x))/2)-e.x),Math.round(Math.max(0,(a.outline.container.clientHeight/b-(this.source.minimumGraphSize.height-2*e.y))/2)-e.y-5/b))}return new mxPoint(8/
|
||||
b,8/b)};var h=a.init;a.init=function(){h.apply(this,arguments);a.outline.view.getBackgroundPageBounds=function(){var b=c.getPageLayout(),a=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+b.x*a.width),this.scale*(this.translate.y+b.y*a.height),this.scale*b.width*a.width,this.scale*b.height*a.height)};a.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(b,c){var e=c.getProperty("change"),d=a.source,f=a.outline;f.pageScale=d.pageScale;f.pageFormat=
|
||||
d.pageFormat;f.background=d.background;f.pageVisible=d.pageVisible;f.background=d.background;var h=mxUtils.getCurrentStyle(d.container);f.container.style.backgroundColor=h.backgroundColor;null!=d.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=d.view.backgroundPageShape.fill);a.outline.view.clear(e.previousPage.root,!0);a.outline.view.validate()});return a};EditorUi.prototype.getServiceCount=function(b){var a=0;null==this.drive&&"function"!==typeof window.DriveClient||
|
||||
a++;null==this.dropbox&&"function"!==typeof window.DropboxClient||a++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||a++;null!=this.gitHub&&a++;b&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&a++;mxClient.IS_IOS||a++;return a};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();var b=this.getCurrentFile(),a=null!=b||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(a);this.menus.get("viewZoom").setEnabled(a);
|
||||
var c=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==b||b.isRestricted());this.actions.get("makeCopy").setEnabled(!c);this.actions.get("print").setEnabled(!c);this.menus.get("exportAs").setEnabled(!c);this.menus.get("embed").setEnabled(!c);c="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(c);this.menus.get("newLibrary").setEnabled(c);this.menus.get("extras").setEnabled(c);b="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=
|
||||
b&&b.isEditable();this.actions.get("image").setEnabled(a);this.actions.get("zoomIn").setEnabled(a);this.actions.get("zoomOut").setEnabled(a);this.actions.get("resetView").setEnabled(a);this.menus.get("edit").setEnabled(a);this.menus.get("view").setEnabled(a);this.menus.get("importFrom").setEnabled(b);this.menus.get("arrange").setEnabled(b);null!=this.toolbar&&(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(b),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(b));
|
||||
if(this.isOfflineApp()){var d=applicationCache;if(null!=d&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color="#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML=
|
||||
"";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var b=this.offlineStatus.getElementsByTagName("img");null!=b&&0<b.length&&this.alert(b[0].getAttribute("title"))}));var d=window.applicationCache,f=null,a=mxUtils.bind(this,function(){var b=d.status,a;b==d.CHECKING&&(b=d.DOWNLOADING);switch(b){case d.UNCACHED:a="";break;case d.IDLE:a='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';
|
||||
break;case d.DOWNLOADING:a='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case d.UPDATEREADY:a='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case d.OBSOLETE:a='<img title="Obsolete" border="0" src="'+IMAGE_PATH+'/clear.gif"/>';break;default:a='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}b!=f&&(this.offlineStatus.innerHTML=a,f=b)});mxEvent.addListener(d,
|
||||
"checking",a);mxEvent.addListener(d,"noupdate",a);mxEvent.addListener(d,"downloading",a);mxEvent.addListener(d,"progress",a);mxEvent.addListener(d,"cached",a);mxEvent.addListener(d,"updateready",a);mxEvent.addListener(d,"obsolete",a);mxEvent.addListener(d,"error",a);a()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=function(){};EditorUi.prototype.updateUserElement=function(){};var m=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){m.apply(this,
|
||||
arguments);var b=this.editor.graph,a=this.getCurrentFile(),c=null!=a&&a.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(c);this.actions.get("autosave").setEnabled(null!=a&&a.isEditable()&&a.isAutosaveOptional());this.actions.get("guides").setEnabled(c);this.actions.get("shadowVisible").setEnabled(c);this.actions.get("connectionArrows").setEnabled(c);this.actions.get("connectionPoints").setEnabled(c);this.actions.get("copyStyle").setEnabled(c&&
|
||||
!b.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(c&&!b.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(b.getModel().isVertex(b.getSelectionCell()));this.actions.get("createShape").setEnabled(c);this.actions.get("createRevision").setEnabled(c);this.actions.get("moveToFolder").setEnabled(null!=a);this.actions.get("makeCopy").setEnabled(null!=a&&!a.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&
|
||||
!a.isRestricted());this.actions.get("publishLink").setEnabled(null!=a&&!a.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&!a.isRestricted());this.menus.get("publish").setEnabled(null!=a&&!a.isRestricted());b=b.view.getState(b.getSelectionCell());this.actions.get("editShape").setEnabled(c&&null!=b&&null!=b.shape&&null!=b.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=
|
||||
function(b,a,c,d,f,h){var e=b.editor.graph;if("xml"==c)b.hideDialog(),b.saveData(a,"xml",mxUtils.getXml(b.editor.getGraphXml()),"text/xml");else if("svg"==c)b.hideDialog(),b.saveData(a,"svg",mxUtils.getXml(e.getSvg(d,f,h)),"image/svg+xml");else{var g=b.getFileData(!0,null,null,null,null,!0),l=e.getGraphBounds(),k=Math.floor(l.width*f/e.view.scale),m=Math.floor(l.height*f/e.view.scale);g.length<=MAX_REQUEST_SIZE&&k*m<MAX_AREA?(b.hideDialog(),b.saveRequest(a,c,function(b,a){return new mxXmlRequest(EXPORT_URL,
|
||||
"format="+c+"&base64="+(a||"0")+(null!=b?"&filename="+encodeURIComponent(b):"")+"&bg="+(null!=d?d:"none")+"&w="+k+"&h="+m+"&border="+h+"&xml="+encodeURIComponent(g))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
setGridColor:function(a){mxSettings.settings.gridColor=a},getAutosave:function(){return mxSettings.settings.autosave},setAutosave:function(a){mxSettings.settings.autosave=a},getResizeImages:function(){return mxSettings.settings.resizeImages},setResizeImages:function(a){mxSettings.settings.resizeImages=a},getOpenCounter:function(){return mxSettings.settings.openCounter},setOpenCounter:function(a){mxSettings.settings.openCounter=a},getLibraries:function(){return mxSettings.settings.libraries},setLibraries:function(a){mxSettings.settings.libraries=
|
||||
a},addCustomLibrary:function(a){mxSettings.load();0>mxUtils.indexOf(mxSettings.settings.customLibraries,a)&&("L.scratchpad"===a?mxSettings.settings.customLibraries.splice(0,0,a):mxSettings.settings.customLibraries.push(a));mxSettings.save()},removeCustomLibrary:function(a){mxSettings.load();mxUtils.remove(a,mxSettings.settings.customLibraries);mxSettings.save()},getCustomLibraries:function(){return mxSettings.settings.customLibraries},getPlugins:function(){return mxSettings.settings.plugins},setPlugins:function(a){mxSettings.settings.plugins=
|
||||
a},getRecentColors:function(){return mxSettings.settings.recentColors},setRecentColors:function(a){mxSettings.settings.recentColors=a},getFormatWidth:function(){return parseInt(mxSettings.settings.formatWidth)},setFormatWidth:function(a){mxSettings.settings.formatWidth=a},getCurrentEdgeStyle:function(){return mxSettings.settings.currentEdgeStyle},setCurrentEdgeStyle:function(a){mxSettings.settings.currentEdgeStyle=a},getCurrentVertexStyle:function(){return mxSettings.settings.currentVertexStyle},
|
||||
|
|
|
@ -4978,10 +4978,10 @@
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (done != null)
|
||||
{
|
||||
done();
|
||||
}
|
||||
if (done != null)
|
||||
{
|
||||
done();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -5011,38 +5011,47 @@
|
|||
*/
|
||||
EditorUi.prototype.insertLucidChart = function(data, dx, dy, crop, done)
|
||||
{
|
||||
var state = JSON.parse(JSON.parse(data).state);
|
||||
var state = JSON.parse(data);
|
||||
|
||||
// Extracts and sorts all pages
|
||||
var pages = [];
|
||||
|
||||
for (var id in state.Pages)
|
||||
if (state.state != null)
|
||||
{
|
||||
pages.push(state.Pages[id]);
|
||||
state = JSON.parse(state.state);
|
||||
|
||||
for (var id in state.Pages)
|
||||
{
|
||||
pages.push(state.Pages[id]);
|
||||
}
|
||||
|
||||
pages.sort(function(a, b)
|
||||
{
|
||||
if (a.Properties.Order < b.Properties.Order)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (a.Properties.Order > b.Properties.Order)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pages.sort(function(a, b)
|
||||
else
|
||||
{
|
||||
if (a.Properties.Order < b.Properties.Order)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (a.Properties.Order > b.Properties.Order)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
pages.push(state);
|
||||
}
|
||||
|
||||
if (pages.length > 0)
|
||||
{
|
||||
this.editor.graph.getModel().beginUpdate();
|
||||
|
||||
try
|
||||
{
|
||||
this.editor.graph.getModel().beginUpdate();
|
||||
|
||||
try
|
||||
{
|
||||
this.pasteLucidChart(pages[0], dx, dy, crop);
|
||||
|
||||
// If pages are enabled add more pages
|
||||
|
@ -5058,11 +5067,11 @@
|
|||
|
||||
this.selectPage(current);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.editor.graph.getModel().endUpdate();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.editor.graph.getModel().endUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -7063,7 +7072,7 @@
|
|||
|
||||
if (content != null && content.length > 0)
|
||||
{
|
||||
this.insertLucidChart(JSON.parse(content));
|
||||
this.importLucidChart(content, 0, 0);
|
||||
mxEvent.consume(evt);
|
||||
}
|
||||
}
|
||||
|
|
2
war/js/embed-static.min.js
vendored
2
war/js/embed-static.min.js
vendored
|
@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+x.join(",")+"}";f=t;return l}}"function"!==typeof Date.prototy
|
|||
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
|
||||
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=""+a;d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||||
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();var mxBasePath="https://www.draw.io/mxgraph/",mxLoadStylesheets=mxLoadResources=!1,mxLanguage="en";window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"6.9.8",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"6.9.9",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
|
||||
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
|
||||
0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||
|
||||
|
|
2
war/js/reader.min.js
vendored
2
war/js/reader.min.js
vendored
|
@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+x.join(",")+"}";f=t;return l}}"function"!==typeof Date.prototy
|
|||
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
|
||||
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=""+a;d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||||
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();var mxBasePath="https://www.draw.io/mxgraph/",mxLoadStylesheets=mxLoadResources=!1,mxLanguage="en";window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"6.9.8",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"6.9.9",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
|
||||
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
|
||||
0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||
|
||||
|
|
233
war/js/viewer.min.js
vendored
233
war/js/viewer.min.js
vendored
|
@ -2726,122 +2726,123 @@ function(){b()});else{var c=new Image;c.onload=function(){var a=document.createE
|
|||
k.getElementsByTagName("diagram");if(1==p.length)k=mxUtils.parseXml(f.decompress(mxUtils.getTextContent(p[0]))).documentElement;else if(1<p.length){f.model.beginUpdate();try{for(var l=0;l<p.length;l++){var m=this.updatePageRoot(new DiagramPage(p[l])),w=this.pages.length;null==m.getName()&&m.setName(mxResources.get("pageWithNumber",[w+1]));f.model.execute(new ChangePage(this,m,m,w))}}finally{f.model.endUpdate()}}}if(null!=k&&"mxGraphModel"===k.nodeName){var x=new mxGraphModel;(new mxCodec(k.ownerDocument)).decode(k,
|
||||
x);var D=x.getChildCount(x.getRoot());f.model.getChildCount(f.model.getRoot());f.model.beginUpdate();try{a={};for(l=0;l<D;l++){var A=x.getChildAt(x.getRoot(),l);if(1!=D||f.isCellLocked(f.getDefaultParent()))A=f.importCells([A],0,0,f.model.getRoot(),null,a)[0],y=f.model.getChildren(A),f.moveCells(y,b,d),c=c.concat(y);else var y=x.getChildren(A),c=c.concat(f.importCells(y,b,d,f.getDefaultParent(),null,a))}if(e){f.isGridEnabled()&&(b=f.snap(b),d=f.snap(d));var B=f.getBoundingBoxFromGeometry(c,!0);null!=
|
||||
B&&f.moveCells(c,b-B.x,d-B.y)}}finally{f.model.endUpdate()}}}}catch(C){throw h||this.handleError(C,mxResources.get("invalidOrMissingFile")),C;}return c};EditorUi.prototype.importLucidChart=function(a,b,d,e,h){var c=mxUtils.bind(this,function(){if(this.pasteLucidChart)try{this.insertLucidChart(a,b,d,e,h)}catch(u){this.handleError(u)}finally{null!=h&&h()}});this.pasteLucidChart||this.loadingExtensions||this.isOffline()?window.setTimeout(c,0):(this.loadingExtensions=!0,"1"==urlParams.dev?mxscript("/js/diagramly/Extensions.js",
|
||||
c):mxscript("/js/extensions.min.js",c))};EditorUi.prototype.insertLucidChart=function(a,b,d,e,h){h=JSON.parse(JSON.parse(a).state);a=[];for(var c in h.Pages)a.push(h.Pages[c]);a.sort(function(a,c){return a.Properties.Order<c.Properties.Order?-1:a.Properties.Order>c.Properties.Order?1:0});if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,d,e),null!=this.pages){var f=this.currentPage;for(b=1;b<a.length;b++)this.insertPage(),this.pasteLucidChart(a[b]);this.selectPage(f)}}finally{this.editor.graph.getModel().endUpdate()}}};
|
||||
EditorUi.prototype.insertTextAt=function(a,b,d,e,h,k,l){k=null!=k?k:!0;l=null!=l?l:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,b,d,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(h||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var c=
|
||||
this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var f=this.extractGraphModelFromPng(a),g=this.importXml(f,b,d,k,!0);if(0<g.length)return g}if("data:image/svg+xml;"==a.substring(0,19))try{if(f=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(f=a.substring(a.indexOf(",")+1),f=window.atob&&!mxClient.IS_SF?atob(f):Base64.decode(f,!0)):f=decodeURIComponent(a.substring(a.indexOf(",")+1)),g=this.importXml(f,b,d,k,!0),0<g.length)return g}catch(z){}this.loadImage(a,mxUtils.bind(this,
|
||||
function(e){if("data:"==a.substring(0,5))this.resizeImage(e,a,mxUtils.bind(this,function(a,e,f){c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),e,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),l,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/e.width,this.maxImageSize/e.height)),g=Math.round(e.width*f);e=Math.round(e.height*f);c.setSelectionCell(c.insertVertex(null,
|
||||
null,"",c.snap(b),c.snap(d),g,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var f=null;c.getModel().beginUpdate();try{f=c.insertVertex(c.getDefaultParent(),null,a,c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.updateCellSize(f),c.fireEvent(new mxEventObject("textInserted","cells",[f]))}finally{c.getModel().endUpdate()}c.setSelectionCell(f)}))}else{a=this.editor.graph.zapGremlins(mxUtils.trim(a));
|
||||
if(this.isCompatibleString(a))return this.importXml(a,b,d,k);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,d,k);else{c=this.editor.graph;h=null;c.getModel().beginUpdate();try{h=c.insertVertex(c.getDefaultParent(),null,"",c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.fireEvent(new mxEventObject("textInserted","cells",[h])),h.value=a,c.updateCellSize(h),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(h.value)&&
|
||||
c.setLinkForCell(h,h.value),h.geometry.width+=c.gridSize,h.geometry.height+=c.gridSize}finally{c.getModel().endUpdate()}return[h]}}return[]};EditorUi.prototype.formatFileSize=function(a){var c=-1;do a/=1024,c++;while(1024<a);return Math.max(a,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[c]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var c=a.indexOf(";");0<c&&(a=a.substring(0,c)+a.substring(a.indexOf(",",c+1)))}return a};EditorUi.prototype.isRemoteFileFormat=
|
||||
function(a,b){return/(\.*<graphml xmlns=\".*)/.test(a)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)||null!=b&&/(\.vsdx)($|\?)/i.test(b)||null!=b&&/(\.vssx)($|\?)/i.test(b)};EditorUi.prototype.importFile=function(a,b,d,e,h,k,l,n,m,r,z){r=null!=r?r:!0;var c=!1,f=null;"image"==b.substring(0,5)?(m=!1,"image/png"==b.substring(0,9)&&(b=z?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(f=this.importXml(b,d,e,r),m=!0)),m||(f=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,
|
||||
b)+a.substring(a.indexOf(",",b+1))),r&&f.isGridEnabled()&&(d=f.snap(d),e=f.snap(e)),f=[f.insertVertex(null,null,"",d,e,h,k,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,l)?(c=!0,this.parseFile(null!=m?m:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){if(4==a.readyState){var c=null;200<=a.status&&299>=a.status&&
|
||||
(a=a.responseText,null!=a&&"<mxlibrary"==a.substring(0,10)?(null!=l&&".vssx"==l.toLowerCase().substring(l.length-5)&&(l=l.substring(0,l.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,a,l))):c=this.importXml(a,d,e,r));null!=n&&n(c)}}),l)):/(\.vsd)($|\?)/i.test(l)||(f=this.insertTextAt(this.validateFileData(a),d,e,!0,null,r));c||null==n||n(f);return f};EditorUi.prototype.base64Encode=function(a){for(var c="",b=0,d=a.length,e,k,l;b<d;){e=a.charCodeAt(b++)&255;if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);c+="==";break}k=a.charCodeAt(b++);if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2);c+="=";break}l=a.charCodeAt(b++);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2|(l&192)>>6);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(l&63)}return c};EditorUi.prototype.importFiles=function(a,b,d,e,h,k,l,m,t,r,z,v){b=null!=b?b:0;d=null!=d?d:0;e=null!=e?e:this.maxImageSize;r=null!=r?r:this.maxImageBytes;var c=null!=b&&null!=d,f=!0,g=!1;if(!mxClient.IS_CHROMEAPP&&
|
||||
null!=a)for(var p=z||this.resampleThreshold,n=0;n<a.length;n++)if("image/"==a[n].type.substring(0,6)&&a[n].size>p){g=!0;break}var q=mxUtils.bind(this,function(){var g=this.editor.graph,p=g.gridSize;h=null!=h?h:mxUtils.bind(this,function(a,b,d,e,f,g,h,k,p){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,h)),null):this.importFile(a,b,d,e,f,g,h,k,p,c,v)});k=null!=k?k:mxUtils.bind(this,function(a){g.setSelectionCells(a)});if(this.spinner.spin(document.body,
|
||||
mxResources.get("loading")))for(var n=a.length,q=n,u=[],t=mxUtils.bind(this,function(a,c){u[a]=c;if(0==--q){this.spinner.stop();if(null!=m)m(u);else{var b=[];g.getModel().beginUpdate();try{for(var d=0;d<u.length;d++){var e=u[d]();null!=e&&(b=b.concat(e))}}finally{g.getModel().endUpdate()}}k(b)}}),y=0;y<n;y++)mxUtils.bind(this,function(c){var g=a[c],k=new FileReader;k.onload=mxUtils.bind(this,function(a){if(null==l||l(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var k=
|
||||
a.target.result,n=k.indexOf(","),m=atob(k.substring(n+1)),q=mxUtils.parseXml(m),m=q.getElementsByTagName("svg");if(0<m.length){var m=m[0],u=v?null:m.getAttribute("content");null!=u&&"<"!=u.charAt(0)&&"%"!=u.charAt(0)&&(u=unescape(window.atob?atob(u):Base64.decode(u,!0)));null!=u&&"%"==u.charAt(0)&&(u=decodeURIComponent(u));null==u||"<mxfile "!==u.substring(0,8)&&"<mxGraphModel "!==u.substring(0,14)?t(c,mxUtils.bind(this,function(){try{if(k.substring(0,n+1),null!=q){var a=q.getElementsByTagName("svg");
|
||||
if(0<a.length){var f=a[0],l=parseFloat(f.getAttribute("width")),m=parseFloat(f.getAttribute("height")),r=f.getAttribute("viewBox");if(null==r||0==r.length)f.setAttribute("viewBox","0 0 "+l+" "+m);else if(isNaN(l)||isNaN(m)){var u=r.split(" ");3<u.length&&(l=parseFloat(u[2]),m=parseFloat(u[3]))}k=this.createSvgDataUri(mxUtils.getXml(a[0]));var t=Math.min(1,Math.min(e/Math.max(1,l)),e/Math.max(1,m));return h(k,g.type,b+c*p,d+c*p,Math.max(1,Math.round(l*t)),Math.max(1,Math.round(m*t)),g.name)}}}catch(ba){}return null})):
|
||||
t(c,mxUtils.bind(this,function(){return h(u,"text/xml",b+c*p,d+c*p,0,0,g.name)}))}}else{m=!1;if("image/png"==g.type){var y=v?null:this.extractGraphModelFromPng(a.target.result);if(null!=y&&0<y.length){var x=new Image;x.src=a.target.result;t(c,mxUtils.bind(this,function(){return h(y,"text/xml",b+c*p,d+c*p,x.width,x.height,g.name)}));m=!0}}m||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,
|
||||
function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(k){this.resizeImage(k,a.target.result,mxUtils.bind(this,function(k,l,m){t(c,mxUtils.bind(this,function(){if(null!=k&&k.length<r){var n=f&&this.isResampleImage(a.target.result,z)?Math.min(1,Math.min(e/l,e/m)):1;return h(k,g.type,b+c*p,d+c*p,Math.round(l*n),Math.round(m*n),g.name)}this.handleError({message:mxResources.get("imageTooBig")});
|
||||
return null}))}),f,e,z)})))}else h(a.target.result,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})})});/(\.vsdx)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?h(null,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})},g):"image"==g.type.substring(0,5)?k.readAsDataURL(g):k.readAsText(g)})(y)});g?this.confirmImageResize(function(a){f=a;q()},t):q()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?
|
||||
this.spinner.pause():function(){},d=function(b,d){mxSettings.setResizeImages(b?d:null);mxSettings.save();c();a(d)},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null;null==e||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){d(a,!0)},function(a){d(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||
|
||||
mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):d(!1,e)};EditorUi.prototype.parseFile=function(a,b,d){d=null!=d?d:a.name;var c=new FormData;c.append("format","xml");c.append("upfile",a,d);var e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(c)};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,d,e,h,k){h=null!=h?h:this.maxImageSize;
|
||||
var c=Math.max(1,a.width),f=Math.max(1,a.height);if(e&&this.isResampleImage(b,k))try{var g=Math.max(c/h,f/h);if(1<g){var l=Math.round(c/g),p=Math.round(f/g),m=document.createElement("canvas");m.width=l;m.height=p;m.getContext("2d").drawImage(a,0,0,l,p);var q=m.toDataURL();if(q.length<b.length){var x=document.createElement("canvas");x.width=l;x.height=p;var D=x.toDataURL();q!==D&&(b=q,c=l,f=p)}}}catch(A){}d(b,c,f)};EditorUi.prototype.crcTable=[];for(var b=0;256>b;b++)for(var e=b,d=0;8>d;d++)e=1==(e&
|
||||
1)?3988292384^e>>>1:e>>>1,EditorUi.prototype.crcTable[b]=e;EditorUi.prototype.updateCRC=function(a,b,d,e){for(var c=0;c<e;c++)a=EditorUi.prototype.crcTable[(a^b[d+c])&255]^a>>>8;return a};EditorUi.prototype.writeGraphModelToPng=function(a,b,d,e,h){function c(a,b){var c=k;k+=b;return a.substring(c,k)}function f(a){a=c(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+
|
||||
1);a=window.atob?atob(a):Base64.decode(a,!0);var k=0;if(c(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=h&&h();else if(c(a,4),"IHDR"!=c(a,4))null!=h&&h();else{c(a,17);h=a.substring(0,k);do{var l=f(a);if("IDAT"==c(a,4)){h=a.substring(0,k-8);d=d+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+e;e=4294967295;e=this.updateCRC(e,b,0,4);e=this.updateCRC(e,d,0,d.length);h+=g(d.length)+b+d+g(e^4294967295);h+=a.substring(k-8,a.length);break}h+=a.substring(k-8,k-4+
|
||||
l);e=c(a,l);c(a,4)}while(l);return"data:image/png;base64,"+(window.btoa?btoa(h):Base64.encode(h,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g,
|
||||
" "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(h){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,d){var c=new Image;c.onload=function(){b(c)};null!=d&&(c.onerror=d);c.src=a};var k=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a){var c=a.indexOf(",");
|
||||
0<c&&(a=b.getPageById(a.substring(c+1)))&&b.selectPage(a)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,d=this.editor.graph,e=d.addClickHandler;d.addClickHandler=function(b,c,f){var g=c;c=function(b,c){if(null==c){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(c=e.getAttribute("href"))}null!=c&&d.isPageLink(c)&&(a(c),mxEvent.consume(b));null!=g&&g(b,c)};e.call(this,b,c,f)};k.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(d.view.canvas.ownerSVGElement,
|
||||
null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var h=d.getGlobalVariable;d.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:h.apply(this,arguments)};var l=d.createLinkForHint;d.createLinkForHint=function(c,e){var f=
|
||||
d.isPageLink(c);if(f){var g=c.indexOf(",");0<g&&(g=b.getPageById(c.substring(g+1)),e=null!=g?g.getName():mxResources.get("pageNotFound"))}g=l.apply(this,arguments);f&&mxEvent.addListener(g,"click",function(b){a(c);mxEvent.consume(b)});return g};var m=d.labelLinkClicked;d.labelLinkClicked=function(b,c,e){var f=c.getAttribute("href");d.isPageLink(f)?(a(f),mxEvent.consume(e)):m.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=
|
||||
null!=c.getTitle()?c.getTitle():a);return a};var n=this.actions.get("print");n.setEnabled(!mxClient.IS_IOS||!navigator.standalone);n.visible=n.isEnabled();if(!this.editor.chromeless){var t=function(){window.setTimeout(function(){r.innerHTML=" ";r.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,
|
||||
!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||d.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.originalEvent.clipboardData,d=!1,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var g=f[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],
|
||||
0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var h=this.editor.graph.getInsertPoint();this.importFiles([g.getAsFile()],h.x,h.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(I){}}),!1);var r=document.createElement("div");r.style.position="absolute";r.style.whiteSpace="nowrap";r.style.overflow="hidden";r.style.display="block";r.contentEditable=!0;mxUtils.setOpacity(r,
|
||||
0);r.style.width="1px";r.style.height="1px";r.innerHTML=" ";var z=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(a){var b=mxEvent.getSource(a);null==d.container||!d.isEnabled()||d.isMouseDown||d.isEditing()||null!=this.dialog||"INPUT"==b.nodeName||"TEXTAREA"==b.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||
|
||||
z||(r.style.left=d.container.scrollLeft+10+"px",r.style.top=d.container.scrollTop+10+"px",d.container.appendChild(r),z=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){r.focus();document.execCommand("selectAll",!1,null)},0):(r.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var b=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!z||224!=b&&17!=b&&91!=b||(z=!1,d.isEditing()||null!=this.dialog||null==d.container||d.container.focus(),
|
||||
r.parentNode.removeChild(r))}),0)}));mxEvent.addListener(r,"copy",mxUtils.bind(this,function(a){d.isEnabled()&&(mxClipboard.copy(d),this.copyCells(r),t())}));mxEvent.addListener(r,"cut",mxUtils.bind(this,function(a){d.isEnabled()&&(this.copyCells(r,!0),t())}));mxEvent.addListener(r,"paste",mxUtils.bind(this,function(a){d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())&&(r.innerHTML=" ",r.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,r);r.innerHTML=" "}),0))}),
|
||||
!0);var v=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==r?!0:v.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),
|
||||
d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==
|
||||
a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",
|
||||
!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){n=document.createElement("div");n.style.position="absolute";n.style.top="95px";n.style.left="250px";
|
||||
n.style.width="2000px";n.style.height="30px";n.style.background="whiteSmoke";document.body.appendChild(n);var w=document.createElement("div");w.style.position="absolute";w.style.top="125px";w.style.left="220px";w.style.width="30px";w.style.height="1000px";w.style.background="whiteSmoke";document.body.appendChild(w);var x=document.createElement("div");x.style.position="absolute";x.style.top="95px";x.style.left="220px";x.style.width="30px";x.style.height="30px";x.style.background="whiteSmoke";document.body.appendChild(x);
|
||||
this.vRuler=new mxRuler(this.editor.graph,w,!0);this.hRuler=new mxRuler(this.editor.graph,n,!1)}if("1"==urlParams.test){n=document.getElementById("geFooter");null!=n&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,
|
||||
"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),n.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility=
|
||||
"hidden"})));var D=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:D.apply(this,arguments)}}n=document.getElementById("geInfo");null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport){var A=null;mxEvent.addListener(d.container,"dragleave",function(a){d.isEnabled()&&(null!=A&&(A.parentNode.removeChild(A),A=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(d.container,"dragover",mxUtils.bind(this,function(a){null==A&&(!mxClient.IS_IE||
|
||||
10<document.documentMode)&&(A=this.highlightElement(d.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(d.container,"drop",mxUtils.bind(this,function(a){null!=A&&(A.parentNode.removeChild(A),A=null);if(d.isEnabled()){var b=mxUtils.convertPoint(d.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),c=d.view.translate,e=d.view.scale,f=b.x/e-c.x,g=b.y/e-c.y;mxEvent.isAltDown(a)&&(g=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,
|
||||
f,g,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var h=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,b=this.extractGraphModelFromEvent(a,null!=this.pages);if(null!=b)d.setSelectionCells(this.importXml(b,f,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var k=a.dataTransfer.getData("text/html"),b=document.createElement("div");b.innerHTML=k;var l=null,c=b.getElementsByTagName("img");
|
||||
null!=c&&1==c.length?(k=c[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)||(l=!0)):(b=b.getElementsByTagName("a"),null!=b&&1==b.length&&(k=b[0].getAttribute("href")));var p=!0,m=mxUtils.bind(this,function(){d.setSelectionCells(this.insertTextAt(k,f,g,!0,l,null,p))});l&&k.length>this.resampleThreshold?this.confirmImageResize(function(a){p=a;m()},mxEvent.isControlDown(a)):m()}else null!=h&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(h)?this.loadImage(decodeURIComponent(h),mxUtils.bind(this,
|
||||
function(a){var b=Math.max(1,a.width);a=Math.max(1,a.height);var c=this.maxImageSize,c=Math.min(1,Math.min(c/Math.max(1,b)),c/Math.max(1,a));d.setSelectionCell(d.insertVertex(null,null,"",f,g,b*c,a*c,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+h+";"))}),mxUtils.bind(this,function(a){d.setSelectionCells(this.insertTextAt(h,f,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&d.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),
|
||||
f,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged",
|
||||
"keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());
|
||||
mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,
|
||||
function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=
|
||||
function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=e,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=
|
||||
c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.insertLucidChart(JSON.parse(d)),mxEvent.consume(a))}else{var d=this.editor.graph,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):b.textContent),f=!1;try{var k=e.lastIndexOf("%3E");0<=k&&k<e.length-3&&(e=e.substring(0,k+3))}catch(t){}try{var c=b.getElementsByTagName("span"),l=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):
|
||||
decodeURIComponent(e);this.isCompatibleString(l)&&(f=!0,e=l)}catch(t){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=
|
||||
this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(t){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||
|
||||
10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,
|
||||
!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):
|
||||
0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash=
|
||||
"#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;var k=document.documentElement;d=(e.clientWidth||k.clientWidth)-3;e=Math.max(e.clientHeight||0,k.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,
|
||||
e=a.clientHeight;k=document.createElement("div");k.style.zIndex=mxPopupMenu.prototype.zIndex+2;k.style.border="3px dotted rgb(254, 137, 12)";k.style.pointerEvents="none";k.style.position="absolute";k.style.top=b+"px";k.style.left=c+"px";k.style.width=Math.max(0,d-3)+"px";k.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(k):document.body.appendChild(k);return k};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);
|
||||
var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var d=c.target.result,e=a.name;if(null!=
|
||||
e&&0<e.length)if(/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml",this.parseFile(a,mxUtils.bind(this,function(a){if(4==a.readyState)if(this.spinner.stop(),200<=a.status&&299>=a.status)if(a=a.responseText,"<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,b);null!=e&&".vssx"==e.toLowerCase().substring(e.length-5)&&(e=e.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(r){this.handleError(r,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b);else this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,
|
||||
e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(t){this.handleError(t,mxResources.get("errorLoadingFile"))}}else"image/png"==
|
||||
a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=function(a,b,d){var c=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var c=
|
||||
mxUtils.parseXml(a);null!=c&&(this.editor.setGraphXml(c.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,d))});null!=a&&0<a.length&&(null!=c&&c.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):e())};
|
||||
EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],d;for(d in a)b.push(d);return b};EditorUi.prototype.addBasenamesForCell=function(a,b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);
|
||||
c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=
|
||||
a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,b,d){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.showLayersDialog()):
|
||||
(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=d?d:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};
|
||||
EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=null,k=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):
|
||||
this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,k);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){function g(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=this.editor.graph.decompress(a)))}catch(K){}return a}var h=f.data;
|
||||
if("json"==urlParams.proto){try{h=JSON.parse(h)}catch(J){h=null}if(null==h)return;if("dialog"==h.action){this.showError(null!=h.titleKey?mxResources.get(h.titleKey):h.title,null!=h.messageKey?mxResources.get(h.messageKey):h.message,null!=h.buttonKey?mxResources.get(h.buttonKey):h.button);null!=h.modified&&(this.editor.modified=h.modified);return}if("prompt"==h.action){this.spinner.stop();var k=new FilenameDialog(this,h.defaultValue||"",null!=h.okKey?mxResources.get(h.okKey):null,function(a){null!=
|
||||
a&&l.postMessage(JSON.stringify({event:"prompt",value:a,message:h}),"*")},null!=h.titleKey?mxResources.get(h.titleKey):h.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==h.action){k=null;k="data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):g(h.xml);this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[h.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",
|
||||
result:"edit",message:h}),"*")}),mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"discard",message:h}),"*")}),h.editKey?mxResources.get(h.editKey):null,h.discardKey?mxResources.get(h.discardKey):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{k.init()}catch(J){l.postMessage(JSON.stringify({event:"draft",error:J.toString(),message:h}),"*")}return}if("template"==h.action){this.spinner.stop();
|
||||
k=new NewDialog(this,!1,null!=h.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=h.callback?l.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("status"==h.action){null!=h.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(h.messageKey))):
|
||||
null!=h.message&&this.editor.setStatus(mxUtils.htmlEntities(h.message));null!=h.modified&&(this.editor.modified=h.modified);return}if("spinner"==h.action){var m=null!=h.messageKey?mxResources.get(h.messageKey):h.message;null==h.show||h.show?this.spinner.spin(document.body,m):this.spinner.stop();return}if("export"==h.action){if("png"==h.format||"xmlpng"==h.format){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,null!=h.spinKey?mxResources.get(h.spinKey):h.spin)){var p=null!=h.xml?
|
||||
h.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var n=this.editor.graph,q=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=h.format;b.xml=encodeURIComponent(p);b.data=a;l.postMessage(JSON.stringify(b),"*")}),u=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==h.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(p))));n!=this.editor.graph&&n.container.parentNode.removeChild(n.container);
|
||||
q(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var n=this.createTemporaryGraph(n.getStylesheet()),y=n.getGlobalVariable,B=this.pages[0];n.getGlobalVariable=function(a){return"page"==a?B.getName():"pagenumber"==a?1:y.apply(this,arguments)};document.body.appendChild(n.container);n.model.setRoot(B.root)}this.exportToCanvas(mxUtils.bind(this,function(a){u(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){u(null)}),null,null,null,null,null,
|
||||
null,n)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==h.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(p)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?q("data:image/png;base64,"+a.getText()):u(null)}),mxUtils.bind(this,function(){u(null)}))}}else{null!=h.xml&&0<h.xml.length&&this.setFileData(h.xml);m=this.createLoadMessage("export");if("html2"==h.format||"html"==h.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=
|
||||
this.getXmlFileData(),m.xml=mxUtils.getXml(k),m.data=this.getFileData(null,null,!0,null,null,null,k),m.format=h.format;else if("html"==h.format)p=this.editor.getGraphXml(),m.data=this.getHtml(p,this.editor.graph),m.xml=mxUtils.getXml(p),m.format=h.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);m.xml=this.getFileData(!0);m.format="svg";if(h.embedImages||null==h.embedImages){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,
|
||||
null!=h.spinKey?mxResources.get(h.spinKey):h.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==h.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(a);l.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(a));l.postMessage(JSON.stringify(m),
|
||||
"*")}));return}k="xmlsvg"==h.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));m.data=this.createSvgDataUri(k)}l.postMessage(JSON.stringify(m),"*")}return}if("load"==h.action)d=1==h.autosave,this.hideDialog(),null!=h.modified&&null==urlParams.modified&&(urlParams.modified=h.modified),null!=h.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=h.saveAndExit),null!=h.title&&null!=this.buttonContainer&&(k=document.createElement("span"),
|
||||
mxUtils.write(k,h.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),this.buttonContainer.appendChild(k)),h=null!=h.xmlpng?this.extractGraphModelFromPng(h.xmlpng):null!=h.xml&&"data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):h.xml;else{l.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(h)}),
|
||||
"*");return}}h=g(h);c=!0;try{a(h,f)}catch(J){this.handleError(J)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var C=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=C();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=C();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,
|
||||
b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&
|
||||
"json"!=urlParams.proto||l.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var l=window.opener||window.parent,k="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";l.postMessage(k,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=
|
||||
document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");b.className="geBigButton";b.style.fontSize="12px";b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));a.appendChild(b);"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),
|
||||
b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,
|
||||
function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,
|
||||
640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a){try{var b=a.split("\n"),c=[];if(0<b.length){var d={},e=null,k=null,l="auto",m="auto",t=40,r=40,z=0,v=this.editor.graph;v.getGraphBounds();for(var w=function(){v.setSelectionCells(P);v.scrollCellToVisible(v.getSelectionCell())},x=v.getFreeInsertPoint(),D=x.x,A=x.y,x=A,y=null,B="auto",C=[],J=null,K=null,L=0;L<b.length&&"#"==b[L].charAt(0);){a=b[L];for(L++;L<b.length&&"\\"==a.charAt(a.length-1)&&"#"==b[L].charAt(0);)a=
|
||||
a.substring(0,a.length-1)+mxUtils.trim(b[L].substring(1)),L++;if("#"!=a.charAt(1)){var W=a.indexOf(":");if(0<W){var H=mxUtils.trim(a.substring(1,W)),I=mxUtils.trim(a.substring(W+1));"label"==H?y=v.sanitizeHtml(I):"style"==H?e=I:"identity"==H&&0<I.length&&"-"!=I?k=I:"width"==H?l=I:"height"==H?m=I:"ignore"==H?K=I.split(","):"connect"==H?C.push(JSON.parse(I)):"link"==H?J=I:"padding"==H?z=parseFloat(I):"edgespacing"==H?t=parseFloat(I):"nodespacing"==H?r=parseFloat(I):"layout"==H&&(B=I)}}}var T=this.editor.csvToArray(b[L]);
|
||||
a=null;if(null!=k)for(var G=0;G<T.length;G++)if(k==T[G]){a=G;break}null==y&&(y="%"+T[0]+"%");if(null!=C)for(var F=0;F<C.length;F++)null==d[C[F].to]&&(d[C[F].to]={});v.model.beginUpdate();try{for(G=L+1;G<b.length;G++){var N=this.editor.csvToArray(b[G]);if(N.length==T.length){var E=null,S=null!=a?N[a]:null;null!=S&&(E=v.model.getCell(S));null==E&&(E=new mxCell(y,new mxGeometry(D,x,0,0),e||"whiteSpace=wrap;html=1;"),E.vertex=!0,E.id=S);for(var O=0;O<N.length;O++)v.setAttributeForCell(E,T[O],N[O]);v.setAttributeForCell(E,
|
||||
"placeholders","1");E.style=v.replacePlaceholders(E,E.style);for(F=0;F<C.length;F++)d[C[F].to][E.getAttribute(C[F].to)]=E;null!=J&&"link"!=J&&(v.setLinkForCell(E,E.getAttribute(J)),v.setAttributeForCell(E,J,null));var U=this.editor.graph.getPreferredSizeForCell(E);E.geometry.width="auto"==l?U.width+z:parseFloat(l);E.geometry.height="auto"==m?U.height+z:parseFloat(m);x+=E.geometry.height+r;c.push(v.addCell(E))}}null==e&&v.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var Q=c.slice(),
|
||||
P=c.slice(),F=0;F<C.length;F++)for(var R=C[F],G=0;G<c.length;G++){var E=c[G],X=E.getAttribute(R.from);if(null!=X){v.setAttributeForCell(E,R.from,null);for(var V=X.split(","),O=0;O<V.length;O++){var Y=d[R.to][V[O]];null!=Y&&(P.push(v.insertEdge(null,null,R.label||"",R.invert?Y:E,R.invert?E:Y,R.style||v.createCurrentEdgeStyle())),mxUtils.remove(R.invert?E:Y,Q))}}}if(null!=K)for(G=0;G<c.length;G++)for(E=c[G],O=0;O<K.length;O++)v.setAttributeForCell(E,mxUtils.trim(K[O]),null);var Z=new mxParallelEdgeLayout(v);
|
||||
Z.spacing=t;var fa=function(){Z.execute(v.getDefaultParent());for(var a=0;a<c.length;a++){var b=v.getCellGeometry(c[a]);b.x=Math.round(v.snap(b.x));b.y=Math.round(v.snap(b.y));"auto"==l&&(b.width=Math.round(v.snap(b.width)));"auto"==m&&(b.height=Math.round(v.snap(b.height)))}};if("circle"==B){var aa=new mxCircleLayout(v);aa.resetEdges=!1;var ja=aa.isVertexIgnored;aa.isVertexIgnored=function(a){return ja.apply(this,arguments)||0>mxUtils.indexOf(c,a)};this.executeLayout(function(){aa.execute(v.getDefaultParent());
|
||||
fa()},!0,w);w=null}else if("horizontaltree"==B||"verticaltree"==B||"auto"==B&&P.length==2*c.length-1&&1==Q.length){v.view.validate();var ba=new mxCompactTreeLayout(v,"horizontaltree"==B);ba.levelDistance=r;ba.edgeRouting=!1;ba.resetEdges=!1;this.executeLayout(function(){ba.execute(v.getDefaultParent(),0<Q.length?Q[0]:null)},!0,w);w=null}else if("horizontalflow"==B||"verticalflow"==B||"auto"==B&&1==Q.length){v.view.validate();var ga=new mxHierarchicalLayout(v,"horizontalflow"==B?mxConstants.DIRECTION_WEST:
|
||||
mxConstants.DIRECTION_NORTH);ga.intraCellSpacing=r;ga.disableEdgeStyle=!1;this.executeLayout(function(){ga.execute(v.getDefaultParent(),P);v.moveCells(P,D,A)},!0,w);w=null}else if("organic"==B||"auto"==B&&P.length>c.length){v.view.validate();var ca=new mxFastOrganicLayout(v);ca.forceConstant=3*r;ca.resetEdges=!1;var na=ca.isVertexIgnored;ca.isVertexIgnored=function(a){return na.apply(this,arguments)||0>mxUtils.indexOf(c,a)};Z=new mxParallelEdgeLayout(v);Z.spacing=t;this.executeLayout(function(){ca.execute(v.getDefaultParent());
|
||||
fa()},!0,w);w=null}this.hideDialog()}finally{v.model.endUpdate()}null!=w&&w()}}catch(ka){this.handleError(ka)}};EditorUi.prototype.getSearch=function(a){var b="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;
|
||||
if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,d){a=new LinkDialog(this,a,b,d,!0);this.showDialog(a.container,420,120,!0,!0);a.init()};var l=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=
|
||||
l.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-
|
||||
2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/a,8/a)};var k=b.init;b.init=function(){k.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};
|
||||
this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=e.pageFormat;f.background=e.background;f.pageVisible=e.pageVisible;f.background=e.background;var g=mxUtils.getCurrentStyle(e.container);f.container.style.backgroundColor=g.backgroundColor;null!=e.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=e.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,
|
||||
!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a){var b=0;null==this.drive&&"function"!==typeof window.DriveClient||b++;null==this.dropbox&&"function"!==typeof window.DropboxClient||b++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||b++;null!=this.gitHub&&b++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&b++;mxClient.IS_IOS||b++;return b};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();
|
||||
var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);var d=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!d);this.actions.get("print").setEnabled(!d);this.menus.get("exportAs").setEnabled(!d);this.menus.get("embed").setEnabled(!d);d="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(d);
|
||||
this.menus.get("newLibrary").setEnabled(d);this.menus.get("extras").setEnabled(d);a="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=a&&a.isEditable();this.actions.get("image").setEnabled(b);this.actions.get("zoomIn").setEnabled(b);this.actions.get("zoomOut").setEnabled(b);this.actions.get("resetView").setEnabled(b);this.menus.get("edit").setEnabled(b);this.menus.get("view").setEnabled(b);this.menus.get("importFrom").setEnabled(a);this.menus.get("arrange").setEnabled(a);null!=this.toolbar&&
|
||||
(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(a),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(a));if(this.isOfflineApp()){var e=applicationCache;if(null!=e&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color=
|
||||
"#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML="";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var a=this.offlineStatus.getElementsByTagName("img");null!=a&&0<a.length&&this.alert(a[0].getAttribute("title"))}));var e=window.applicationCache,h=null,b=mxUtils.bind(this,function(){var a=e.status,b;a==e.CHECKING&&
|
||||
(a=e.DOWNLOADING);switch(a){case e.UNCACHED:b="";break;case e.IDLE:b='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';break;case e.DOWNLOADING:b='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case e.UPDATEREADY:b='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case e.OBSOLETE:b='<img title="Obsolete" border="0" src="'+IMAGE_PATH+
|
||||
'/clear.gif"/>';break;default:b='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}a!=h&&(this.offlineStatus.innerHTML=b,h=a)});mxEvent.addListener(e,"checking",b);mxEvent.addListener(e,"noupdate",b);mxEvent.addListener(e,"downloading",b);mxEvent.addListener(e,"progress",b);mxEvent.addListener(e,"cached",b);mxEvent.addListener(e,"updateready",b);mxEvent.addListener(e,"obsolete",b);mxEvent.addListener(e,"error",b);b()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=
|
||||
function(){};EditorUi.prototype.updateUserElement=function(){};var m=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){m.apply(this,arguments);var a=this.editor.graph,b=this.getCurrentFile(),d=null!=b&&b.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(d);this.actions.get("autosave").setEnabled(null!=b&&b.isEditable()&&b.isAutosaveOptional());this.actions.get("guides").setEnabled(d);this.actions.get("shadowVisible").setEnabled(d);
|
||||
this.actions.get("connectionArrows").setEnabled(d);this.actions.get("connectionPoints").setEnabled(d);this.actions.get("copyStyle").setEnabled(d&&!a.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(d&&!a.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(a.getModel().isVertex(a.getSelectionCell()));this.actions.get("createShape").setEnabled(d);this.actions.get("createRevision").setEnabled(d);this.actions.get("moveToFolder").setEnabled(null!=b);this.actions.get("makeCopy").setEnabled(null!=
|
||||
b&&!b.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.actions.get("publishLink").setEnabled(null!=b&&!b.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.menus.get("publish").setEnabled(null!=b&&!b.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(d&&null!=a&&null!=a.shape&&
|
||||
null!=a.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=function(a,b,d,e,h,k){var c=a.editor.graph;if("xml"==d)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==d)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(c.getSvg(e,h,k)),"image/svg+xml");else{var f=a.getFileData(!0,null,null,null,null,!0),g=c.getGraphBounds(),l=Math.floor(g.width*h/c.view.scale),m=Math.floor(g.height*
|
||||
h/c.view.scale);f.length<=MAX_REQUEST_SIZE&&l*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,d,function(a,b){return new mxXmlRequest(EXPORT_URL,"format="+d+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=e?e:"none")+"&w="+l+"&h="+m+"&border="+k+"&xml="+encodeURIComponent(f))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};
|
||||
c):mxscript("/js/extensions.min.js",c))};EditorUi.prototype.insertLucidChart=function(a,b,d,e,h){h=JSON.parse(a);a=[];if(null!=h.state){h=JSON.parse(h.state);for(var c in h.Pages)a.push(h.Pages[c]);a.sort(function(a,c){return a.Properties.Order<c.Properties.Order?-1:a.Properties.Order>c.Properties.Order?1:0})}else a.push(h);if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,d,e),null!=this.pages){var f=this.currentPage;for(b=1;b<a.length;b++)this.insertPage(),
|
||||
this.pasteLucidChart(a[b]);this.selectPage(f)}}finally{this.editor.graph.getModel().endUpdate()}}};EditorUi.prototype.insertTextAt=function(a,b,d,e,h,k,l){k=null!=k?k:!0;l=null!=l?l:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,
|
||||
b,d,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(h||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var c=this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var f=this.extractGraphModelFromPng(a),g=this.importXml(f,b,d,k,!0);if(0<g.length)return g}if("data:image/svg+xml;"==a.substring(0,19))try{if(f=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(f=a.substring(a.indexOf(",")+1),f=window.atob&&!mxClient.IS_SF?atob(f):Base64.decode(f,!0)):f=decodeURIComponent(a.substring(a.indexOf(",")+
|
||||
1)),g=this.importXml(f,b,d,k,!0),0<g.length)return g}catch(z){}this.loadImage(a,mxUtils.bind(this,function(e){if("data:"==a.substring(0,5))this.resizeImage(e,a,mxUtils.bind(this,function(a,e,f){c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),e,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),l,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/e.width,this.maxImageSize/
|
||||
e.height)),g=Math.round(e.width*f);e=Math.round(e.height*f);c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),g,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var f=null;c.getModel().beginUpdate();try{f=c.insertVertex(c.getDefaultParent(),null,a,c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.updateCellSize(f),c.fireEvent(new mxEventObject("textInserted","cells",
|
||||
[f]))}finally{c.getModel().endUpdate()}c.setSelectionCell(f)}))}else{a=this.editor.graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,d,k);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,d,k);else{c=this.editor.graph;h=null;c.getModel().beginUpdate();try{h=c.insertVertex(c.getDefaultParent(),null,"",c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.fireEvent(new mxEventObject("textInserted","cells",[h])),h.value=
|
||||
a,c.updateCellSize(h),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(h.value)&&c.setLinkForCell(h,h.value),h.geometry.width+=c.gridSize,h.geometry.height+=c.gridSize}finally{c.getModel().endUpdate()}return[h]}}return[]};EditorUi.prototype.formatFileSize=function(a){var c=-1;do a/=1024,c++;while(1024<a);return Math.max(a,.1).toFixed(1)+
|
||||
" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[c]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var c=a.indexOf(";");0<c&&(a=a.substring(0,c)+a.substring(a.indexOf(",",c+1)))}return a};EditorUi.prototype.isRemoteFileFormat=function(a,b){return/(\.*<graphml xmlns=\".*)/.test(a)||/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)||null!=b&&/(\.vsdx)($|\?)/i.test(b)||null!=b&&/(\.vssx)($|\?)/i.test(b)};EditorUi.prototype.importFile=function(a,b,d,e,h,k,l,n,m,r,z){r=
|
||||
null!=r?r:!0;var c=!1,f=null;"image"==b.substring(0,5)?(m=!1,"image/png"==b.substring(0,9)&&(b=z?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(f=this.importXml(b,d,e,r),m=!0)),m||(f=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),r&&f.isGridEnabled()&&(d=f.snap(d),e=f.snap(e)),f=[f.insertVertex(null,null,"",d,e,h,k,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+
|
||||
";")])):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,l)?(c=!0,this.parseFile(null!=m?m:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){if(4==a.readyState){var c=null;200<=a.status&&299>=a.status&&(a=a.responseText,null!=a&&"<mxlibrary"==a.substring(0,10)?(null!=l&&".vssx"==l.toLowerCase().substring(l.length-5)&&(l=l.substring(0,l.length-5)+".xml"),this.loadLibrary(new LocalLibrary(this,a,l))):c=this.importXml(a,d,e,r));null!=n&&n(c)}}),l)):
|
||||
/(\.vsd)($|\?)/i.test(l)||(f=this.insertTextAt(this.validateFileData(a),d,e,!0,null,r));c||null==n||n(f);return f};EditorUi.prototype.base64Encode=function(a){for(var c="",b=0,d=a.length,e,k,l;b<d;){e=a.charCodeAt(b++)&255;if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);c+="==";break}k=a.charCodeAt(b++);if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2);c+="=";break}l=a.charCodeAt(b++);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(k&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((k&15)<<2|(l&192)>>6);
|
||||
c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(l&63)}return c};EditorUi.prototype.importFiles=function(a,b,d,e,h,k,l,m,t,r,z,v){b=null!=b?b:0;d=null!=d?d:0;e=null!=e?e:this.maxImageSize;r=null!=r?r:this.maxImageBytes;var c=null!=b&&null!=d,f=!0,g=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var p=z||this.resampleThreshold,n=0;n<a.length;n++)if("image/"==a[n].type.substring(0,6)&&a[n].size>p){g=!0;break}var q=mxUtils.bind(this,function(){var g=this.editor.graph,p=g.gridSize;
|
||||
h=null!=h?h:mxUtils.bind(this,function(a,b,d,e,f,g,h,k,p){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,h)),null):this.importFile(a,b,d,e,f,g,h,k,p,c,v)});k=null!=k?k:mxUtils.bind(this,function(a){g.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var n=a.length,q=n,u=[],t=mxUtils.bind(this,function(a,c){u[a]=c;if(0==--q){this.spinner.stop();if(null!=m)m(u);else{var b=[];g.getModel().beginUpdate();
|
||||
try{for(var d=0;d<u.length;d++){var e=u[d]();null!=e&&(b=b.concat(e))}}finally{g.getModel().endUpdate()}}k(b)}}),y=0;y<n;y++)mxUtils.bind(this,function(c){var g=a[c],k=new FileReader;k.onload=mxUtils.bind(this,function(a){if(null==l||l(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var k=a.target.result,n=k.indexOf(","),m=atob(k.substring(n+1)),q=mxUtils.parseXml(m),m=q.getElementsByTagName("svg");if(0<m.length){var m=m[0],u=v?null:m.getAttribute("content");null!=u&&
|
||||
"<"!=u.charAt(0)&&"%"!=u.charAt(0)&&(u=unescape(window.atob?atob(u):Base64.decode(u,!0)));null!=u&&"%"==u.charAt(0)&&(u=decodeURIComponent(u));null==u||"<mxfile "!==u.substring(0,8)&&"<mxGraphModel "!==u.substring(0,14)?t(c,mxUtils.bind(this,function(){try{if(k.substring(0,n+1),null!=q){var a=q.getElementsByTagName("svg");if(0<a.length){var f=a[0],l=parseFloat(f.getAttribute("width")),m=parseFloat(f.getAttribute("height")),r=f.getAttribute("viewBox");if(null==r||0==r.length)f.setAttribute("viewBox",
|
||||
"0 0 "+l+" "+m);else if(isNaN(l)||isNaN(m)){var u=r.split(" ");3<u.length&&(l=parseFloat(u[2]),m=parseFloat(u[3]))}k=this.createSvgDataUri(mxUtils.getXml(a[0]));var t=Math.min(1,Math.min(e/Math.max(1,l)),e/Math.max(1,m));return h(k,g.type,b+c*p,d+c*p,Math.max(1,Math.round(l*t)),Math.max(1,Math.round(m*t)),g.name)}}}catch(ba){}return null})):t(c,mxUtils.bind(this,function(){return h(u,"text/xml",b+c*p,d+c*p,0,0,g.name)}))}}else{m=!1;if("image/png"==g.type){var y=v?null:this.extractGraphModelFromPng(a.target.result);
|
||||
if(null!=y&&0<y.length){var x=new Image;x.src=a.target.result;t(c,mxUtils.bind(this,function(){return h(y,"text/xml",b+c*p,d+c*p,x.width,x.height,g.name)}));m=!0}}m||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(k){this.resizeImage(k,
|
||||
a.target.result,mxUtils.bind(this,function(k,l,m){t(c,mxUtils.bind(this,function(){if(null!=k&&k.length<r){var n=f&&this.isResampleImage(a.target.result,z)?Math.min(1,Math.min(e/l,e/m)):1;return h(k,g.type,b+c*p,d+c*p,Math.round(l*n),Math.round(m*n),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),f,e,z)})))}else h(a.target.result,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})})});/(\.vsdx)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?
|
||||
h(null,g.type,b+c*p,d+c*p,240,160,g.name,function(a){t(c,function(){return a})},g):"image"==g.type.substring(0,5)?k.readAsDataURL(g):k.readAsText(g)})(y)});g?this.confirmImageResize(function(a){f=a;q()},t):q()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},d=function(b,d){mxSettings.setResizeImages(b?d:null);mxSettings.save();c();a(d)},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():
|
||||
null;null==e||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){d(a,!0)},function(a){d(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):d(!1,e)};EditorUi.prototype.parseFile=function(a,b,d){d=null!=d?d:a.name;var c=new FormData;
|
||||
c.append("format","xml");c.append("upfile",a,d);var e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(c)};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,d,e,h,k){h=null!=h?h:this.maxImageSize;var c=Math.max(1,a.width),f=Math.max(1,a.height);if(e&&this.isResampleImage(b,k))try{var g=Math.max(c/h,f/h);if(1<g){var l=Math.round(c/g),p=Math.round(f/g),m=document.createElement("canvas");
|
||||
m.width=l;m.height=p;m.getContext("2d").drawImage(a,0,0,l,p);var q=m.toDataURL();if(q.length<b.length){var x=document.createElement("canvas");x.width=l;x.height=p;var D=x.toDataURL();q!==D&&(b=q,c=l,f=p)}}}catch(A){}d(b,c,f)};EditorUi.prototype.crcTable=[];for(var b=0;256>b;b++)for(var e=b,d=0;8>d;d++)e=1==(e&1)?3988292384^e>>>1:e>>>1,EditorUi.prototype.crcTable[b]=e;EditorUi.prototype.updateCRC=function(a,b,d,e){for(var c=0;c<e;c++)a=EditorUi.prototype.crcTable[(a^b[d+c])&255]^a>>>8;return a};EditorUi.prototype.writeGraphModelToPng=
|
||||
function(a,b,d,e,h){function c(a,b){var c=k;k+=b;return a.substring(c,k)}function f(a){a=c(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+1);a=window.atob?atob(a):Base64.decode(a,!0);var k=0;if(c(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=h&&h();else if(c(a,4),"IHDR"!=c(a,4))null!=h&&h();else{c(a,17);h=a.substring(0,
|
||||
k);do{var l=f(a);if("IDAT"==c(a,4)){h=a.substring(0,k-8);d=d+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+e;e=4294967295;e=this.updateCRC(e,b,0,4);e=this.updateCRC(e,d,0,d.length);h+=g(d.length)+b+d+g(e^4294967295);h+=a.substring(k-8,a.length);break}h+=a.substring(k-8,k-4+l);e=c(a,l);c(a,4)}while(l);return"data:image/png;base64,"+(window.btoa?btoa(h):Base64.encode(h,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=
|
||||
window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g," "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(h){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));
|
||||
null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,d){var c=new Image;c.onload=function(){b(c)};null!=d&&(c.onerror=d);c.src=a};var k=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a){var c=a.indexOf(",");0<c&&(a=b.getPageById(a.substring(c+1)))&&b.selectPage(a)}"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,d=this.editor.graph,e=d.addClickHandler;d.addClickHandler=function(b,
|
||||
c,f){var g=c;c=function(b,c){if(null==c){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(c=e.getAttribute("href"))}null!=c&&d.isPageLink(c)&&(a(c),mxEvent.consume(b));null!=g&&g(b,c)};e.call(this,b,c,f)};k.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(d.view.canvas.ownerSVGElement,null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");
|
||||
var h=d.getGlobalVariable;d.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:h.apply(this,arguments)};var l=d.createLinkForHint;d.createLinkForHint=function(c,e){var f=d.isPageLink(c);if(f){var g=c.indexOf(",");0<g&&(g=b.getPageById(c.substring(g+1)),e=null!=g?g.getName():mxResources.get("pageNotFound"))}g=l.apply(this,arguments);f&&mxEvent.addListener(g,"click",
|
||||
function(b){a(c);mxEvent.consume(b)});return g};var m=d.labelLinkClicked;d.labelLinkClicked=function(b,c,e){var f=c.getAttribute("href");d.isPageLink(f)?(a(f),mxEvent.consume(e)):m.apply(this,arguments)};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=null!=c.getTitle()?c.getTitle():a);return a};var n=this.actions.get("print");n.setEnabled(!mxClient.IS_IOS||!navigator.standalone);n.visible=n.isEnabled();if(!this.editor.chromeless){var t=function(){window.setTimeout(function(){r.innerHTML=
|
||||
" ";r.focus();document.execCommand("selectAll",!1,null)},0)};this.keyHandler.bindAction(70,!0,"find");this.keyHandler.bindAction(67,!0,"copyStyle",!0);this.keyHandler.bindAction(86,!0,"pasteStyle",!0);this.keyHandler.bindAction(77,!0,"editGeometry",!0);this.keyHandler.bindAction(88,!0,"insertText",!0);this.keyHandler.bindAction(75,!0,"insertRectangle");this.keyHandler.bindAction(75,!0,"insertEllipse",!0);mxClient.IS_IE||d.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=
|
||||
this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.originalEvent.clipboardData,d=!1,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var g=f[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var h=this.editor.graph.getInsertPoint();
|
||||
this.importFiles([g.getAsFile()],h.x,h.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(I){}}),!1);var r=document.createElement("div");r.style.position="absolute";r.style.whiteSpace="nowrap";r.style.overflow="hidden";r.style.display="block";r.contentEditable=!0;mxUtils.setOpacity(r,0);r.style.width="1px";r.style.height="1px";r.innerHTML=" ";var z=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,
|
||||
"keydown",mxUtils.bind(this,function(a){var b=mxEvent.getSource(a);null==d.container||!d.isEnabled()||d.isMouseDown||d.isEditing()||null!=this.dialog||"INPUT"==b.nodeName||"TEXTAREA"==b.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||z||(r.style.left=d.container.scrollLeft+10+"px",r.style.top=d.container.scrollTop+10+"px",d.container.appendChild(r),z=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){r.focus();document.execCommand("selectAll",!1,null)},
|
||||
0):(r.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var b=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!z||224!=b&&17!=b&&91!=b||(z=!1,d.isEditing()||null!=this.dialog||null==d.container||d.container.focus(),r.parentNode.removeChild(r))}),0)}));mxEvent.addListener(r,"copy",mxUtils.bind(this,function(a){d.isEnabled()&&(mxClipboard.copy(d),this.copyCells(r),t())}));mxEvent.addListener(r,"cut",mxUtils.bind(this,function(a){d.isEnabled()&&
|
||||
(this.copyCells(r,!0),t())}));mxEvent.addListener(r,"paste",mxUtils.bind(this,function(a){d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())&&(r.innerHTML=" ",r.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,r);r.innerHTML=" "}),0))}),!0);var v=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==r?!0:v.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||
|
||||
0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();
|
||||
a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");
|
||||
/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,
|
||||
"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){n=document.createElement("div");n.style.position="absolute";n.style.top="95px";n.style.left="250px";n.style.width="2000px";n.style.height="30px";n.style.background="whiteSmoke";document.body.appendChild(n);var w=document.createElement("div");w.style.position="absolute";w.style.top="125px";w.style.left="220px";
|
||||
w.style.width="30px";w.style.height="1000px";w.style.background="whiteSmoke";document.body.appendChild(w);var x=document.createElement("div");x.style.position="absolute";x.style.top="95px";x.style.left="220px";x.style.width="30px";x.style.height="30px";x.style.background="whiteSmoke";document.body.appendChild(x);this.vRuler=new mxRuler(this.editor.graph,w,!0);this.hRuler=new mxRuler(this.editor.graph,n,!1)}if("1"==urlParams.test){n=document.getElementById("geFooter");null!=n&&(this.styleInput=document.createElement("input"),
|
||||
this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),n.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,
|
||||
mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var D=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:D.apply(this,arguments)}}n=document.getElementById("geInfo");null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport){var A=
|
||||
null;mxEvent.addListener(d.container,"dragleave",function(a){d.isEnabled()&&(null!=A&&(A.parentNode.removeChild(A),A=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(d.container,"dragover",mxUtils.bind(this,function(a){null==A&&(!mxClient.IS_IE||10<document.documentMode)&&(A=this.highlightElement(d.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(d.container,"drop",mxUtils.bind(this,function(a){null!=A&&(A.parentNode.removeChild(A),
|
||||
A=null);if(d.isEnabled()){var b=mxUtils.convertPoint(d.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),c=d.view.translate,e=d.view.scale,f=b.x/e-c.x,g=b.y/e-c.y;mxEvent.isAltDown(a)&&(g=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,f,g,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var h=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,b=this.extractGraphModelFromEvent(a,
|
||||
null!=this.pages);if(null!=b)d.setSelectionCells(this.importXml(b,f,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var k=a.dataTransfer.getData("text/html"),b=document.createElement("div");b.innerHTML=k;var l=null,c=b.getElementsByTagName("img");null!=c&&1==c.length?(k=c[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)||(l=!0)):(b=b.getElementsByTagName("a"),null!=b&&1==b.length&&(k=b[0].getAttribute("href")));var p=!0,m=mxUtils.bind(this,function(){d.setSelectionCells(this.insertTextAt(k,
|
||||
f,g,!0,l,null,p))});l&&k.length>this.resampleThreshold?this.confirmImageResize(function(a){p=a;m()},mxEvent.isControlDown(a)):m()}else null!=h&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(h)?this.loadImage(decodeURIComponent(h),mxUtils.bind(this,function(a){var b=Math.max(1,a.width);a=Math.max(1,a.height);var c=this.maxImageSize,c=Math.min(1,Math.min(c/Math.max(1,b)),c/Math.max(1,a));d.setSelectionCell(d.insertVertex(null,null,"",f,g,b*c,a*c,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
||||
h+";"))}),mxUtils.bind(this,function(a){d.setSelectionCells(this.insertTextAt(h,f,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&d.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),f,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();"undefined"!==typeof window.mxSettings&&this.installSettings()};EditorUi.prototype.installSettings=function(){if(isLocalStorage||mxClient.IS_CHROMEAPP)ColorDialog.recentColors=
|
||||
mxSettings.getRecentColors(),this.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle(),this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle(),this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[])),this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()})),this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget()),
|
||||
this.fireEvent(new mxEventObject("copyConnectChanged")),this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()})),this.editor.graph.pageFormat=mxSettings.getPageFormat(),this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()})),this.editor.graph.view.gridColor=mxSettings.getGridColor(),this.addListener("gridColorChanged",
|
||||
mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()})),mxClient.IS_CHROMEAPP&&(this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave()),null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search),!this.editor.chromeless&&null!=this.sidebar&&(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||
|
||||
0))&&(this.toggleScratchpad(),mxSettings.save()),this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})};EditorUi.prototype.copyCells=function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=
|
||||
e,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.importLucidChart(d,0,0),mxEvent.consume(a))}else{var d=this.editor.graph,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):
|
||||
b.textContent),f=!1;try{var k=e.lastIndexOf("%3E");0<=k&&k<e.length-3&&(e=e.substring(0,k+3))}catch(t){}try{var c=b.getElementsByTagName("span"),l=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(e);this.isCompatibleString(l)&&(f=!0,e=l)}catch(t){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),
|
||||
d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(t){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),
|
||||
b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),
|
||||
"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,
|
||||
"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,
|
||||
function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;
|
||||
var k=document.documentElement;d=(e.clientWidth||k.clientWidth)-3;e=Math.max(e.clientHeight||0,k.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,e=a.clientHeight;k=document.createElement("div");k.style.zIndex=mxPopupMenu.prototype.zIndex+2;k.style.border="3px dotted rgb(254, 137, 12)";k.style.pointerEvents="none";k.style.position="absolute";k.style.top=b+"px";k.style.left=c+"px";k.style.width=Math.max(0,d-3)+"px";k.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?
|
||||
this.editor.graph.container.appendChild(k):document.body.appendChild(k);return k};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=
|
||||
0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var d=c.target.result,e=a.name;if(null!=e&&0<e.length)if(/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".xml"),Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml",this.parseFile(a,mxUtils.bind(this,function(a){if(4==a.readyState)if(this.spinner.stop(),200<=a.status&&299>=
|
||||
a.status)if(a=a.responseText,"<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);null!=e&&".vssx"==e.toLowerCase().substring(e.length-5)&&(e=e.substring(0,filename.length-5)+".xml");try{this.loadLibrary(new LocalLibrary(this,a,e))}catch(r){this.handleError(r,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b);else this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile"))}));else if('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
||||
this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(t){this.handleError(t,mxResources.get("errorLoadingFile"))}}else"image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=
|
||||
function(a,b,d){var c=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var c=mxUtils.parseXml(a);null!=c&&(this.editor.setGraphXml(c.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,d))});null!=a&&0<a.length&&(null!=c&&c.isModified()?(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),
|
||||
null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))):e())};EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],d;for(d in a)b.push(d);return b};EditorUi.prototype.addBasenamesForCell=function(a,
|
||||
b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,e=d.getCellStyle(a);c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=
|
||||
function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a)};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,
|
||||
function(a,b,d){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.showLayersDialog()):(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=d?d:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&
|
||||
(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=
|
||||
null,k=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,k);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){function g(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/svg+xml;base64,"==a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==
|
||||
a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=this.editor.graph.decompress(a)))}catch(K){}return a}var h=f.data;if("json"==urlParams.proto){try{h=JSON.parse(h)}catch(J){h=null}if(null==h)return;if("dialog"==h.action){this.showError(null!=h.titleKey?mxResources.get(h.titleKey):h.title,null!=h.messageKey?mxResources.get(h.messageKey):h.message,null!=h.buttonKey?mxResources.get(h.buttonKey):h.button);null!=h.modified&&(this.editor.modified=
|
||||
h.modified);return}if("prompt"==h.action){this.spinner.stop();var k=new FilenameDialog(this,h.defaultValue||"",null!=h.okKey?mxResources.get(h.okKey):null,function(a){null!=a&&l.postMessage(JSON.stringify({event:"prompt",value:a,message:h}),"*")},null!=h.titleKey?mxResources.get(h.titleKey):h.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==h.action){k=null;k="data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):g(h.xml);this.spinner.stop();
|
||||
k=new DraftDialog(this,mxResources.get("draftFound",[h.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"edit",message:h}),"*")}),mxUtils.bind(this,function(){this.hideDialog();l.postMessage(JSON.stringify({event:"draft",result:"discard",message:h}),"*")}),h.editKey?mxResources.get(h.editKey):null,h.discardKey?mxResources.get(h.discardKey):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&
|
||||
this.actions.get("exit").funct()}));try{k.init()}catch(J){l.postMessage(JSON.stringify({event:"draft",error:J.toString(),message:h}),"*")}return}if("template"==h.action){this.spinner.stop();k=new NewDialog(this,!1,null!=h.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=h.callback?l.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}));this.showDialog(k.container,
|
||||
620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("status"==h.action){null!=h.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(h.messageKey))):null!=h.message&&this.editor.setStatus(mxUtils.htmlEntities(h.message));null!=h.modified&&(this.editor.modified=h.modified);return}if("spinner"==h.action){var m=null!=h.messageKey?mxResources.get(h.messageKey):h.message;null==h.show||h.show?this.spinner.spin(document.body,m):this.spinner.stop();
|
||||
return}if("export"==h.action){if("png"==h.format||"xmlpng"==h.format){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,null!=h.spinKey?mxResources.get(h.spinKey):h.spin)){var p=null!=h.xml?h.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var n=this.editor.graph,q=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=h.format;b.xml=encodeURIComponent(p);b.data=a;l.postMessage(JSON.stringify(b),
|
||||
"*")}),u=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==h.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(p))));n!=this.editor.graph&&n.container.parentNode.removeChild(n.container);q(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var n=this.createTemporaryGraph(n.getStylesheet()),y=n.getGlobalVariable,B=this.pages[0];n.getGlobalVariable=function(a){return"page"==a?B.getName():"pagenumber"==
|
||||
a?1:y.apply(this,arguments)};document.body.appendChild(n.container);n.model.setRoot(B.root)}this.exportToCanvas(mxUtils.bind(this,function(a){u(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){u(null)}),null,null,null,null,null,null,n)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==h.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(p)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?q("data:image/png;base64,"+
|
||||
a.getText()):u(null)}),mxUtils.bind(this,function(){u(null)}))}}else{null!=h.xml&&0<h.xml.length&&this.setFileData(h.xml);m=this.createLoadMessage("export");if("html2"==h.format||"html"==h.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=this.getXmlFileData(),m.xml=mxUtils.getXml(k),m.data=this.getFileData(null,null,!0,null,null,null,k),m.format=h.format;else if("html"==h.format)p=this.editor.getGraphXml(),m.data=this.getHtml(p,this.editor.graph),m.xml=mxUtils.getXml(p),m.format=
|
||||
h.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);m.xml=this.getFileData(!0);m.format="svg";if(h.embedImages||null==h.embedImages){if(null==h.spin&&null==h.spinKey||this.spinner.spin(document.body,null!=h.spinKey?mxResources.get(h.spinKey):h.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==h.format?this.getEmbeddedSvg(m.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=
|
||||
this.createSvgDataUri(a);l.postMessage(JSON.stringify(m),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();m.data=this.createSvgDataUri(mxUtils.getXml(a));l.postMessage(JSON.stringify(m),"*")}));return}k="xmlsvg"==h.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));m.data=this.createSvgDataUri(k)}l.postMessage(JSON.stringify(m),"*")}return}if("load"==
|
||||
h.action)d=1==h.autosave,this.hideDialog(),null!=h.modified&&null==urlParams.modified&&(urlParams.modified=h.modified),null!=h.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=h.saveAndExit),null!=h.title&&null!=this.buttonContainer&&(k=document.createElement("span"),mxUtils.write(k,h.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop=
|
||||
"6px"),this.buttonContainer.appendChild(k)),h=null!=h.xmlpng?this.extractGraphModelFromPng(h.xmlpng):null!=h.xml&&"data:image/png;base64,"==h.xml.substring(0,22)?this.extractGraphModelFromPng(h.xml):h.xml;else{l.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(h)}),"*");return}}h=g(h);c=!0;try{a(h,f)}catch(J){this.handleError(J)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var C=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?
|
||||
this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=C();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=C();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",
|
||||
b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||l.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}));var l=window.opener||window.parent,k="json"==urlParams.proto?JSON.stringify({event:"init"}):
|
||||
urlParams.ready||"ready";l.postMessage(k,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" (Ctrl+S)");b.className="geBigButton";b.style.fontSize="12px";
|
||||
b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));a.appendChild(b);"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),
|
||||
a.appendChild(b));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=
|
||||
function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a){try{var b=a.split("\n"),c=[];if(0<b.length){var d={},e=null,k=null,l="auto",m="auto",t=40,r=40,z=0,v=this.editor.graph;v.getGraphBounds();
|
||||
for(var w=function(){v.setSelectionCells(P);v.scrollCellToVisible(v.getSelectionCell())},x=v.getFreeInsertPoint(),D=x.x,A=x.y,x=A,y=null,B="auto",C=[],J=null,K=null,L=0;L<b.length&&"#"==b[L].charAt(0);){a=b[L];for(L++;L<b.length&&"\\"==a.charAt(a.length-1)&&"#"==b[L].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(b[L].substring(1)),L++;if("#"!=a.charAt(1)){var W=a.indexOf(":");if(0<W){var H=mxUtils.trim(a.substring(1,W)),I=mxUtils.trim(a.substring(W+1));"label"==H?y=v.sanitizeHtml(I):"style"==
|
||||
H?e=I:"identity"==H&&0<I.length&&"-"!=I?k=I:"width"==H?l=I:"height"==H?m=I:"ignore"==H?K=I.split(","):"connect"==H?C.push(JSON.parse(I)):"link"==H?J=I:"padding"==H?z=parseFloat(I):"edgespacing"==H?t=parseFloat(I):"nodespacing"==H?r=parseFloat(I):"layout"==H&&(B=I)}}}var T=this.editor.csvToArray(b[L]);a=null;if(null!=k)for(var G=0;G<T.length;G++)if(k==T[G]){a=G;break}null==y&&(y="%"+T[0]+"%");if(null!=C)for(var F=0;F<C.length;F++)null==d[C[F].to]&&(d[C[F].to]={});v.model.beginUpdate();try{for(G=L+
|
||||
1;G<b.length;G++){var N=this.editor.csvToArray(b[G]);if(N.length==T.length){var E=null,S=null!=a?N[a]:null;null!=S&&(E=v.model.getCell(S));null==E&&(E=new mxCell(y,new mxGeometry(D,x,0,0),e||"whiteSpace=wrap;html=1;"),E.vertex=!0,E.id=S);for(var O=0;O<N.length;O++)v.setAttributeForCell(E,T[O],N[O]);v.setAttributeForCell(E,"placeholders","1");E.style=v.replacePlaceholders(E,E.style);for(F=0;F<C.length;F++)d[C[F].to][E.getAttribute(C[F].to)]=E;null!=J&&"link"!=J&&(v.setLinkForCell(E,E.getAttribute(J)),
|
||||
v.setAttributeForCell(E,J,null));var U=this.editor.graph.getPreferredSizeForCell(E);E.geometry.width="auto"==l?U.width+z:parseFloat(l);E.geometry.height="auto"==m?U.height+z:parseFloat(m);x+=E.geometry.height+r;c.push(v.addCell(E))}}null==e&&v.fireEvent(new mxEventObject("cellsInserted","cells",c));for(var Q=c.slice(),P=c.slice(),F=0;F<C.length;F++)for(var R=C[F],G=0;G<c.length;G++){var E=c[G],X=E.getAttribute(R.from);if(null!=X){v.setAttributeForCell(E,R.from,null);for(var V=X.split(","),O=0;O<V.length;O++){var Y=
|
||||
d[R.to][V[O]];null!=Y&&(P.push(v.insertEdge(null,null,R.label||"",R.invert?Y:E,R.invert?E:Y,R.style||v.createCurrentEdgeStyle())),mxUtils.remove(R.invert?E:Y,Q))}}}if(null!=K)for(G=0;G<c.length;G++)for(E=c[G],O=0;O<K.length;O++)v.setAttributeForCell(E,mxUtils.trim(K[O]),null);var Z=new mxParallelEdgeLayout(v);Z.spacing=t;var fa=function(){Z.execute(v.getDefaultParent());for(var a=0;a<c.length;a++){var b=v.getCellGeometry(c[a]);b.x=Math.round(v.snap(b.x));b.y=Math.round(v.snap(b.y));"auto"==l&&(b.width=
|
||||
Math.round(v.snap(b.width)));"auto"==m&&(b.height=Math.round(v.snap(b.height)))}};if("circle"==B){var aa=new mxCircleLayout(v);aa.resetEdges=!1;var ja=aa.isVertexIgnored;aa.isVertexIgnored=function(a){return ja.apply(this,arguments)||0>mxUtils.indexOf(c,a)};this.executeLayout(function(){aa.execute(v.getDefaultParent());fa()},!0,w);w=null}else if("horizontaltree"==B||"verticaltree"==B||"auto"==B&&P.length==2*c.length-1&&1==Q.length){v.view.validate();var ba=new mxCompactTreeLayout(v,"horizontaltree"==
|
||||
B);ba.levelDistance=r;ba.edgeRouting=!1;ba.resetEdges=!1;this.executeLayout(function(){ba.execute(v.getDefaultParent(),0<Q.length?Q[0]:null)},!0,w);w=null}else if("horizontalflow"==B||"verticalflow"==B||"auto"==B&&1==Q.length){v.view.validate();var ga=new mxHierarchicalLayout(v,"horizontalflow"==B?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);ga.intraCellSpacing=r;ga.disableEdgeStyle=!1;this.executeLayout(function(){ga.execute(v.getDefaultParent(),P);v.moveCells(P,D,A)},!0,w);w=null}else if("organic"==
|
||||
B||"auto"==B&&P.length>c.length){v.view.validate();var ca=new mxFastOrganicLayout(v);ca.forceConstant=3*r;ca.resetEdges=!1;var na=ca.isVertexIgnored;ca.isVertexIgnored=function(a){return na.apply(this,arguments)||0>mxUtils.indexOf(c,a)};Z=new mxParallelEdgeLayout(v);Z.spacing=t;this.executeLayout(function(){ca.execute(v.getDefaultParent());fa()},!0,w);w=null}this.hideDialog()}finally{v.model.endUpdate()}null!=w&&w()}}catch(ka){this.handleError(ka)}};EditorUi.prototype.getSearch=function(a){var b=
|
||||
"";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),
|
||||
d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,d){a=new LinkDialog(this,a,b,d,!0);this.showDialog(a.container,420,120,!0,!0);a.init()};var l=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=l.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*
|
||||
b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/
|
||||
a,8/a)};var k=b.init;b.init=function(){k.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=
|
||||
e.pageFormat;f.background=e.background;f.pageVisible=e.pageVisible;f.background=e.background;var g=mxUtils.getCurrentStyle(e.container);f.container.style.backgroundColor=g.backgroundColor;null!=e.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=e.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a){var b=0;null==this.drive&&"function"!==typeof window.DriveClient||
|
||||
b++;null==this.dropbox&&"function"!==typeof window.DropboxClient||b++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||b++;null!=this.gitHub&&b++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&b++;mxClient.IS_IOS||b++;return b};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);
|
||||
var d=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!d);this.actions.get("print").setEnabled(!d);this.menus.get("exportAs").setEnabled(!d);this.menus.get("embed").setEnabled(!d);d="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("openLibraryFrom").setEnabled(d);this.menus.get("newLibrary").setEnabled(d);this.menus.get("extras").setEnabled(d);a="1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=
|
||||
a&&a.isEditable();this.actions.get("image").setEnabled(b);this.actions.get("zoomIn").setEnabled(b);this.actions.get("zoomOut").setEnabled(b);this.actions.get("resetView").setEnabled(b);this.menus.get("edit").setEnabled(b);this.menus.get("view").setEnabled(b);this.menus.get("importFrom").setEnabled(a);this.menus.get("arrange").setEnabled(a);null!=this.toolbar&&(null!=this.toolbar.edgeShapeMenu&&this.toolbar.edgeShapeMenu.setEnabled(a),null!=this.toolbar.edgeStyleMenu&&this.toolbar.edgeStyleMenu.setEnabled(a));
|
||||
if(this.isOfflineApp()){var e=applicationCache;if(null!=e&&null==this.offlineStatus){this.offlineStatus=document.createElement("div");this.offlineStatus.className="geItem";this.offlineStatus.style.position="absolute";this.offlineStatus.style.fontSize="8pt";this.offlineStatus.style.top="2px";this.offlineStatus.style.right="12px";this.offlineStatus.style.color="#666";this.offlineStatus.style.margin="4px";this.offlineStatus.style.padding="2px";this.offlineStatus.style.verticalAlign="middle";this.offlineStatus.innerHTML=
|
||||
"";this.menubarContainer.appendChild(this.offlineStatus);mxEvent.addListener(this.offlineStatus,"click",mxUtils.bind(this,function(){var a=this.offlineStatus.getElementsByTagName("img");null!=a&&0<a.length&&this.alert(a[0].getAttribute("title"))}));var e=window.applicationCache,h=null,b=mxUtils.bind(this,function(){var a=e.status,b;a==e.CHECKING&&(a=e.DOWNLOADING);switch(a){case e.UNCACHED:b="";break;case e.IDLE:b='<img title="draw.io is up to date." border="0" src="'+IMAGE_PATH+'/checkmark.gif"/>';
|
||||
break;case e.DOWNLOADING:b='<img title="Downloading new version..." border="0" src="'+IMAGE_PATH+'/spin.gif"/>';break;case e.UPDATEREADY:b='<img title="'+mxUtils.htmlEntities(mxResources.get("restartForChangeRequired"))+'" border="0" src="'+IMAGE_PATH+'/download.png"/>';break;case e.OBSOLETE:b='<img title="Obsolete" border="0" src="'+IMAGE_PATH+'/clear.gif"/>';break;default:b='<img title="Unknown" border="0" src="'+IMAGE_PATH+'/clear.gif"/>'}a!=h&&(this.offlineStatus.innerHTML=b,h=a)});mxEvent.addListener(e,
|
||||
"checking",b);mxEvent.addListener(e,"noupdate",b);mxEvent.addListener(e,"downloading",b);mxEvent.addListener(e,"progress",b);mxEvent.addListener(e,"cached",b);mxEvent.addListener(e,"updateready",b);mxEvent.addListener(e,"obsolete",b);mxEvent.addListener(e,"error",b);b()}}else this.updateUserElement()};EditorUi.prototype.updateButtonContainer=function(){};EditorUi.prototype.updateUserElement=function(){};var m=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){m.apply(this,
|
||||
arguments);var a=this.editor.graph,b=this.getCurrentFile(),d=null!=b&&b.isEditable()||"1"==urlParams.embed&&this.editor.graph.isEnabled();this.actions.get("pageSetup").setEnabled(d);this.actions.get("autosave").setEnabled(null!=b&&b.isEditable()&&b.isAutosaveOptional());this.actions.get("guides").setEnabled(d);this.actions.get("shadowVisible").setEnabled(d);this.actions.get("connectionArrows").setEnabled(d);this.actions.get("connectionPoints").setEnabled(d);this.actions.get("copyStyle").setEnabled(d&&
|
||||
!a.isSelectionEmpty());this.actions.get("pasteStyle").setEnabled(d&&!a.isSelectionEmpty());this.actions.get("editGeometry").setEnabled(a.getModel().isVertex(a.getSelectionCell()));this.actions.get("createShape").setEnabled(d);this.actions.get("createRevision").setEnabled(d);this.actions.get("moveToFolder").setEnabled(null!=b);this.actions.get("makeCopy").setEnabled(null!=b&&!b.isRestricted());this.actions.get("editDiagram").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&
|
||||
!b.isRestricted());this.actions.get("publishLink").setEnabled(null!=b&&!b.isRestricted());this.actions.get("tags").setEnabled("1"==urlParams.embed&&this.editor.graph.isEnabled()||null!=b&&!b.isRestricted());this.menus.get("publish").setEnabled(null!=b&&!b.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(d&&null!=a&&null!=a.shape&&null!=a.shape.stencil)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=
|
||||
function(a,b,d,e,h,k){var c=a.editor.graph;if("xml"==d)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==d)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(c.getSvg(e,h,k)),"image/svg+xml");else{var f=a.getFileData(!0,null,null,null,null,!0),g=c.getGraphBounds(),l=Math.floor(g.width*h/c.view.scale),m=Math.floor(g.height*h/c.view.scale);f.length<=MAX_REQUEST_SIZE&&l*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,d,function(a,b){return new mxXmlRequest(EXPORT_URL,
|
||||
"format="+d+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=e?e:"none")+"&w="+l+"&h="+m+"&border="+k+"&xml="+encodeURIComponent(f))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};
|
||||
DiagramPage.prototype.getName=function(){return this.node.getAttribute("name")};DiagramPage.prototype.setName=function(a){null==a?this.node.removeAttribute("name"):this.node.setAttribute("name",a)};function RenamePage(a,b,e){this.ui=a;this.page=b;this.previous=e}RenamePage.prototype.execute=function(){var a=this.page.getName();this.page.setName(this.previous);this.previous=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageRenamed"))};
|
||||
function MovePage(a,b,e){this.ui=a;this.oldIndex=b;this.newIndex=e}MovePage.prototype.execute=function(){this.ui.pages.splice(this.newIndex,0,this.ui.pages.splice(this.oldIndex,1)[0]);var a=this.oldIndex;this.oldIndex=this.newIndex;this.newIndex=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageMoved"))};
|
||||
function SelectPage(a,b){this.ui=a;this.previousPage=this.page=b;this.neverShown=!0;null!=b&&(this.neverShown=null==b.viewState,this.ui.updatePageRoot(b))}
|
||||
|
|
Loading…
Reference in a new issue