/* * GoJS v2.0.17 JavaScript Library for HTML Diagrams * Northwoods Software, https://www.nwoods.com/ * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation. * Copyright (C) 1998-2019 by Northwoods Software Corporation. All Rights Reserved. * THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.0.17/license.html. */ (function() { var t;function aa(a){var b=0;return function(){return bc&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c=a.length?a.push(c):a.splice(b,0,c):B("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Ca(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):B("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Da(){var a=Ea.pop();return void 0===a?[]:a}function Ga(a){a.length=0;Ea.push(a)} function Ha(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(ya(a)&&a.constructor)return Ha(a.constructor);return typeof a} function Ja(a){var b=a;ya(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ka(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.aA;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1} function Ma(a,b,c){Object.defineProperty(Na.prototype,a,{get:b,set:c})}function Oa(){var a=Qa;if(0===a.length)for(var b=x.document.getElementsByTagName("canvas"),c=b.length,d=0;dc;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;ec;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;gthis.key)return!1;a=a.j;var b=a.length,c=++this.Sa,d=this.Ye;if(null!==d)for(;cthis.key)return!1;var b=--this.Sa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.xd();return!1};jb.prototype.dd=function(){return this.next()}; jb.prototype.first=function(){var a=this.pb;this.la=a.Ba;var b=a.j;this.Sa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};jb.prototype.any=function(a){var b=this.pb;b.Tg=null;b=b.j;var c=b.length;this.Sa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};jb.prototype.all=function(a){var b=this.pb;b.Tg=null;b=b.j;var c=b.length;this.Sa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0}; jb.prototype.each=function(a){var b=this.pb;b.Tg=null;b=b.j;var c=b.length;this.Sa=c;for(--c;0<=c;c--)a(b[c]);return this};jb.prototype.map=function(a){var b=this.pb;b.Tg=null;var c=[];b=b.j;var d=b.length;this.Sa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.kb();return a.iterator};jb.prototype.filter=function(a){var b=this.pb;b.Tg=null;var c=[];b=b.j;var d=b.length;this.Sa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.kb();return a.iterator}; jb.prototype.xd=function(){this.key=-1;this.value=null;this.la=-1;this.pb.Tg=this};jb.prototype.toString=function(){return"ListIteratorBackwards("+this.Sa+"/"+this.pb.count+")"};ma.Object.defineProperties(jb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.pb.j.length}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.dd;jb.prototype.next=jb.prototype.next;jb.prototype.reset=jb.prototype.reset; jb.className="ListIteratorBackwards";function E(a){ab(this);this.v=!1;this.j=[];this.Ba=0;this.Tg=this.Ja=null;void 0!==a&&("function"===typeof a||"string"===typeof a?xa():this.addAll(a))}t=E.prototype;t.kb=function(){var a=this.Ba;a++;999999999a||a>=b.length)&&va(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.N(a)};t.gd=function(a,b){var c=this.j;(0>a||a>=c.length)&&va(a,"0 <= i < length",E,"setElt:i");this.v&&ua(this,a);c[a]=b};t.set=function(a,b){this.gd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Sb=function(){var a=this.j,b=a.length;return 0a&&va(a,">= 0",E,"insertAt:i");this.v&&ua(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.kb()};t.remove=function(a){if(null===a)return!1;this.v&&ua(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.kb();return!0};t.delete=function(a){return this.remove(a)}; t.mb=function(a){var b=this.j;(0>a||a>=b.length)&&va(a,"0 <= i < length",E,"removeAt:i");this.v&&ua(this,a);a===b.length-1?b.pop():b.splice(a,1);this.kb()};t.removeRange=function(a,b){var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.v&&ua(this);for(var e=a,f=b+1;f=f)return this;(0>b||b>=e-1)&&va(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a=e)for(c=d.slice(b),c.sort(a),a=b;a=this.j.length)return gb;var a=this.Ja;return null!==a?(a.reset(),a):new ib(this)}},iteratorBackwards:{ get:function(){if(0>=this.j.length)return gb;var a=this.Tg;return null!==a?(a.reset(),a):new jb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.Xi;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.Sv;E.prototype.toArray=E.prototype.Na;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.mb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.Ib; E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Sb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.gd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.N;E.prototype.indexOf=E.prototype.indexOf;E.prototype.has=E.prototype.has;E.prototype.contains=E.prototype.contains;E.prototype.clear=E.prototype.clear;E.prototype.addAll=E.prototype.addAll;E.prototype.push=E.prototype.push;E.prototype.add=E.prototype.add;E.prototype.thaw=E.prototype.ha; E.prototype.freeze=E.prototype.freeze;E.className="List";function mb(a){this.ig=a;a.Ja=null;this.la=a.Ba;this.na=null}mb.prototype.reset=function(){var a=this.ig;a.Ja=null;this.la=a.Ba;this.na=null};mb.prototype.next=function(){var a=this.ig;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=b.value,this.key=b.key,!0;this.xd();return!1};mb.prototype.dd=function(){return this.next()}; mb.prototype.first=function(){var a=this.ig;this.la=a.Ba;a=a.fa;if(null!==a){this.na=a;var b=a.value;this.key=a.key;return this.value=b}return null};mb.prototype.any=function(a){var b=this.ig;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};mb.prototype.all=function(a){var b=this.ig;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};mb.prototype.each=function(a){var b=this.ig;this.na=b.Ja=null;for(b=b.fa;null!==b;)a(b.value),b=b.oa;return this}; mb.prototype.map=function(a){var b=this.ig;b.Ja=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};mb.prototype.filter=function(a){var b=this.ig;b.Ja=null;var c=new E;for(b=b.fa;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};mb.prototype.xd=function(){this.value=this.key=null;this.la=-1;this.ig.Ja=this};mb.prototype.toString=function(){return null!==this.na?"SetIterator@"+this.na.value:"SetIterator"}; ma.Object.defineProperties(mb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ig.Cb}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.dd;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;mb.className="SetIterator"; function F(a){ab(this);this.v=!1;this.Db={};this.Cb=0;this.Ja=null;this.Ba=0;this.Ue=this.fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?xa():this.addAll(a))}t=F.prototype;t.kb=function(){var a=this.Ba;a++;999999999=this.Cb)return gb;var a=this.Ja;return null!==a?(a.reset(),a):new mb(this)}}});F.prototype.toList=F.prototype.Rv;F.prototype.toArray=F.prototype.Na;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.Oz;F.prototype.removeAll=F.prototype.pq; F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.ty;F.prototype.containsAll=F.prototype.sy;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.addAll=F.prototype.addAll;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ha;F.prototype.freeze=F.prototype.freeze;var qb=1;F.className="Set";F.uniqueHash=ab;F.hashIdUnique=ob;F.hashId=lb; function rb(a){this.ja=a;this.la=a.Ba;this.na=null}rb.prototype.reset=function(){this.la=this.ja.Ba;this.na=null};rb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=this.key=a=b.key,!0;this.xd();return!1};rb.prototype.dd=function(){return this.next()};rb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;return null!==a?(this.na=a,this.value=this.key=a=a.key):null}; rb.prototype.any=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};rb.prototype.all=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};rb.prototype.each=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;)a(b.key),b=b.oa;return this};rb.prototype.map=function(a){var b=this.ja;this.na=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator}; rb.prototype.filter=function(a){var b=this.ja;this.na=null;var c=new E;for(b=b.fa;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};rb.prototype.xd=function(){this.value=this.key=null;this.la=-1};rb.prototype.toString=function(){return null!==this.na?"MapKeySetIterator@"+this.na.value:"MapKeySetIterator"};ma.Object.defineProperties(rb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Cb}}}); rb.prototype.first=rb.prototype.first;rb.prototype.hasNext=rb.prototype.dd;rb.prototype.next=rb.prototype.next;rb.prototype.reset=rb.prototype.reset;rb.className="MapKeySetIterator";function sb(a){F.call(this);ab(this);this.v=!0;this.ja=a}la(sb,F);t=sb.prototype;t.freeze=function(){return this};t.ha=function(){return this};t.toString=function(){return"MapKeySet("+this.ja.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.ja.contains(a)}; t.has=function(a){return this.contains(a)};t.remove=function(){B("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){B("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ja.fa;return null!==a?a.key:null};sb.prototype.any=function(a){for(var b=this.ja.fa;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};sb.prototype.all=function(a){for(var b=this.ja.fa;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0}; sb.prototype.each=function(a){for(var b=this.ja.fa;null!==b;)a(b.key),b=b.oa;return this};sb.prototype.map=function(a){for(var b=new F,c=this.ja.fa;null!==c;)b.add(a(c.key)),c=c.oa;return b};sb.prototype.filter=function(a){for(var b=new F,c=this.ja.fa;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};sb.prototype.copy=function(){return new sb(this.ja)};sb.prototype.Sv=function(){var a=new F,b=this.ja.Db,c;for(c in b)a.add(b[c].key);return a}; sb.prototype.Na=function(){var a=this.ja.Db,b=Array(this.ja.Cb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};sb.prototype.Rv=function(){var a=new E,b=this.ja.Db,c;for(c in b)a.add(b[c].key);return a};ma.Object.defineProperties(sb.prototype,{count:{get:function(){return this.ja.Cb}},size:{get:function(){return this.ja.Cb}},iterator:{get:function(){return 0>=this.ja.Cb?gb:new rb(this.ja)}}}); sb.prototype.toList=sb.prototype.Rv;sb.prototype.toArray=sb.prototype.Na;sb.prototype.toSet=sb.prototype.Sv;sb.prototype.first=sb.prototype.first;sb.prototype.clear=sb.prototype.clear;sb.prototype["delete"]=sb.prototype.delete;sb.prototype.remove=sb.prototype.remove;sb.prototype.has=sb.prototype.has;sb.prototype.contains=sb.prototype.contains;sb.prototype.add=sb.prototype.add;sb.prototype.thaw=sb.prototype.ha;sb.prototype.freeze=sb.prototype.freeze;sb.className="MapKeySet"; function tb(a){this.ja=a;a.Te=null;this.la=a.Ba;this.na=null}tb.prototype.reset=function(){var a=this.ja;a.Te=null;this.la=a.Ba;this.na=null};tb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=b.value,this.key=b.key,!0;this.xd();return!1};tb.prototype.dd=function(){return this.next()}; tb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;if(null!==a){this.na=a;var b=a.value;this.key=a.key;return this.value=b}return null};tb.prototype.any=function(a){var b=this.ja;this.na=b.Te=null;for(b=b.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};tb.prototype.all=function(a){var b=this.ja;this.na=b.Te=null;for(b=b.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};tb.prototype.each=function(a){var b=this.ja;this.na=b.Te=null;for(b=b.fa;null!==b;)a(b.value),b=b.oa;return this}; tb.prototype.map=function(a){var b=this.ja;this.na=b.Te=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};tb.prototype.filter=function(a){var b=this.ja;this.na=b.Te=null;var c=new E;for(b=b.fa;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};tb.prototype.xd=function(){this.value=this.key=null;this.la=-1;this.ja.Te=this};tb.prototype.toString=function(){return null!==this.na?"MapValueSetIterator@"+this.na.value:"MapValueSetIterator"}; ma.Object.defineProperties(tb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Cb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.dd;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset;tb.className="MapValueSetIterator";function pb(a,b){this.key=a;this.value=b;this.xl=this.oa=null}pb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"}; pb.className="KeyValuePair";function ub(a){this.ja=a;a.Ja=null;this.la=a.Ba;this.na=null}ub.prototype.reset=function(){var a=this.ja;a.Ja=null;this.la=a.Ba;this.na=null};ub.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.key=b.key,this.value=b.value,!0;this.xd();return!1};ub.prototype.dd=function(){return this.next()}; ub.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;return null!==a?(this.na=a,this.key=a.key,this.value=a.value,a):null};ub.prototype.any=function(a){var b=this.ja;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(a(b))return!0;b=b.oa}return!1};ub.prototype.all=function(a){var b=this.ja;this.na=b.Ja=null;for(b=b.fa;null!==b;){if(!a(b))return!1;b=b.oa}return!0};ub.prototype.each=function(a){var b=this.ja;this.na=b.Ja=null;for(b=b.fa;null!==b;)a(b),b=b.oa;return this}; ub.prototype.map=function(a){var b=this.ja;this.na=b.Ja=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};ub.prototype.filter=function(a){var b=this.ja;this.na=b.Ja=null;var c=new E;for(b=b.fa;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};ub.prototype.xd=function(){this.value=this.key=null;this.la=-1;this.ja.Ja=this};ub.prototype.toString=function(){return null!==this.na?"MapIterator@"+this.na:"MapIterator"}; ma.Object.defineProperties(ub.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Cb}}});ub.prototype.first=ub.prototype.first;ub.prototype.hasNext=ub.prototype.dd;ub.prototype.next=ub.prototype.next;ub.prototype.reset=ub.prototype.reset;ub.className="MapIterator"; function vb(a){ab(this);this.v=!1;this.Db={};this.Cb=0;this.Te=this.Ja=null;this.Ba=0;this.Ue=this.fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?xa():this.addAll(a))}t=vb.prototype;t.kb=function(){var a=this.Ba;a++;999999999=this.count)return gb;var a=this.Ja;return null!==a?(a.reset(),a):new ub(this)}},iteratorKeys:{get:function(){return 0>=this.count?gb:new rb(this)}},iteratorValues:{get:function(){if(0>=this.count)return gb; var a=this.Te;return null!==a?(a.reset(),a):new tb(this)}}});vb.prototype.toKeySet=vb.prototype.Yd;vb.prototype.toArray=vb.prototype.Na;vb.prototype.clear=vb.prototype.clear;vb.prototype["delete"]=vb.prototype.delete;vb.prototype.remove=vb.prototype.remove;vb.prototype.get=vb.prototype.get;vb.prototype.getValue=vb.prototype.J;vb.prototype.has=vb.prototype.has;vb.prototype.contains=vb.prototype.contains;vb.prototype.first=vb.prototype.first;vb.prototype.addAll=vb.prototype.addAll; vb.prototype.set=vb.prototype.set;vb.prototype.add=vb.prototype.add;vb.prototype.thaw=vb.prototype.ha;vb.prototype.freeze=vb.prototype.freeze;vb.className="Map";function G(a,b){void 0===a?this.G=this.F=0:"number"===typeof a&&"number"===typeof b?(this.F=a,this.G=b):B("Invalid arguments to Point constructor: "+a+", "+b);this.v=!1}G.prototype.assign=function(a){this.F=a.F;this.G=a.G;return this};G.prototype.h=function(a,b){this.F=a;this.G=b;return this}; G.prototype.xg=function(a,b){this.F=a;this.G=b;return this};G.prototype.set=function(a){this.F=a.F;this.G=a.G;return this};G.prototype.copy=function(){var a=new G;a.F=this.F;a.G=this.G;return a};t=G.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this}; function wb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new G(c,e)}return new G}function xb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof G?this.F===a.x&&this.G===a.y:!1};t.Gi=function(a,b){return this.F===a&&this.G===b};t.Qa=function(a){return H.w(this.F,a.x)&&H.w(this.G,a.y)}; t.add=function(a){this.F+=a.x;this.G+=a.y;return this};t.Xd=function(a){this.F-=a.x;this.G-=a.y;return this};t.offset=function(a,b){this.F+=a;this.G+=b;return this};G.prototype.rotate=function(a){if(0===a)return this;var b=this.F,c=this.G;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.F=a*b-d*c;this.G=d*b+a*c;return this};t=G.prototype; t.scale=function(a,b){this.F*=a;this.G*=b;return this};t.Ce=function(a){var b=a.x-this.F;a=a.y-this.G;return b*b+a*a};t.cd=function(a,b){a-=this.F;b-=this.G;return a*a+b*b};t.normalize=function(){var a=this.F,b=this.G,c=Math.sqrt(a*a+b*b);0b?270:0;if(0===b)return 0a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.Hz=function(a,b,c,d){H.Ti(a,b,c,d,this.F,this.G,this);return this};t.Iz=function(a,b){H.Ti(a.x,a.y,b.x,b.y,this.F,this.G,this);return this};t.Tz=function(a,b,c,d){H.Xp(this.F,this.G,a,b,c,d,this);return this};t.Uz=function(a,b){H.Xp(this.F,this.G,a.x,a.y,b.width,b.height,this);return this}; t.Wi=function(a,b){this.F=a.x+b.x*a.width+b.offsetX;this.G=a.y+b.y*a.height+b.offsetY;return this};t.sk=function(a,b,c,d,e){this.F=a+e.x*c+e.offsetX;this.G=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ta(this);return this};function zb(a,b){b.Ud(a);return a}function Ab(a,b,c,d,e,f){var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}function Bb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b} function Db(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0b?270:0;if(0===b)return 0a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.o=function(){return isFinite(this.x)&&isFinite(this.y)};G.alloc=function(){var a=Eb.pop();return void 0===a?new G:a};G.allocAt=function(a,b){var c=Eb.pop();if(void 0===c)return new G(a,b);c.x=a;c.y=b;return c};G.free=function(a){Eb.push(a)}; ma.Object.defineProperties(G.prototype,{x:{get:function(){return this.F},set:function(a){this.F=a}},y:{get:function(){return this.G},set:function(a){this.G=a}}});G.prototype.isReal=G.prototype.o;G.prototype.setSpot=G.prototype.sk;G.prototype.setRectSpot=G.prototype.Wi;G.prototype.snapToGridPoint=G.prototype.Uz;G.prototype.snapToGrid=G.prototype.Tz;G.prototype.projectOntoLineSegmentPoint=G.prototype.Iz;G.prototype.projectOntoLineSegment=G.prototype.Hz; G.prototype.direction=G.prototype.direction;G.prototype.directionPoint=G.prototype.Wa;G.prototype.normalize=G.prototype.normalize;G.prototype.distanceSquared=G.prototype.cd;G.prototype.distanceSquaredPoint=G.prototype.Ce;G.prototype.scale=G.prototype.scale;G.prototype.rotate=G.prototype.rotate;G.prototype.offset=G.prototype.offset;G.prototype.subtract=G.prototype.Xd;G.prototype.add=G.prototype.add;G.prototype.equalsApprox=G.prototype.Qa;G.prototype.equalTo=G.prototype.Gi;G.prototype.equals=G.prototype.A; G.prototype.set=G.prototype.set;G.prototype.setTo=G.prototype.xg;var Fb=null,Gb=null,Hb=null,Ib=null,Jb=null,Eb=[];G.className="Point";G.parse=wb;G.stringify=xb;G.distanceLineSegmentSquared=Ab;G.distanceSquared=Bb;G.direction=Db;G.Origin=Fb=(new G(0,0)).ga();G.InfiniteTopLeft=Gb=(new G(-Infinity,-Infinity)).ga();G.InfiniteBottomRight=Hb=(new G(Infinity,Infinity)).ga();G.SixPoint=Ib=(new G(6,6)).ga();G.NoPoint=Jb=(new G(NaN,NaN)).ga();G.parse=wb;G.stringify=xb;G.distanceLineSegmentSquared=Ab; G.distanceSquared=Bb;G.direction=Db;function M(a,b){void 0===a?this.Z=this.$=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.$=a,this.Z=b):B("Invalid arguments to Size constructor: "+a+", "+b);this.v=!1}var Kb,Lb,Mb,Ob,Pb,Qb,Rb;M.prototype.assign=function(a){this.$=a.$;this.Z=a.Z;return this};M.prototype.h=function(a,b){this.$=a;this.Z=b;return this};M.prototype.xg=function(a,b){this.$=a;this.Z=b;return this};M.prototype.set=function(a){this.$=a.$;this.Z=a.Z;return this}; M.prototype.copy=function(){var a=new M;a.$=this.$;a.Z=this.Z;return a};t=M.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this}; function Sb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new M(c,e)}return new M}function Tb(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof M?this.$===a.width&&this.Z===a.height:!1};t.Gi=function(a,b){return this.$===a&&this.Z===b}; t.Qa=function(a){return H.w(this.$,a.width)&&H.w(this.Z,a.height)};t.o=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Vb.pop();return void 0===a?new M:a};M.free=function(a){Vb.push(a)}; ma.Object.defineProperties(M.prototype,{width:{get:function(){return this.$},set:function(a){0>a&&va(a,">= 0",M,"width");this.$=a}},height:{get:function(){return this.Z},set:function(a){0>a&&va(a,">= 0",M,"height");this.Z=a}}});M.prototype.isReal=M.prototype.o;M.prototype.equalsApprox=M.prototype.Qa;M.prototype.equalTo=M.prototype.Gi;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.xg; var Vb=[];M.className="Size";M.parse=Sb;M.stringify=Tb;M.ZeroSize=Kb=(new M(0,0)).ga();M.OneSize=Lb=(new M(1,1)).ga();M.SixSize=Mb=(new M(6,6)).ga();M.EightSize=Ob=(new M(8,8)).ga();M.TenSize=Pb=(new M(10,10)).ga();M.InfiniteSize=Qb=(new M(Infinity,Infinity)).ga();M.NoSize=Rb=(new M(NaN,NaN)).ga();M.parse=Sb;M.stringify=Tb; function N(a,b,c,d){void 0===a?this.Z=this.$=this.G=this.F=0:a instanceof G?(c=a.x,a=a.y,b instanceof G?(d=b.x,b=b.y,this.F=Math.min(c,d),this.G=Math.min(a,b),this.$=Math.abs(c-d),this.Z=Math.abs(a-b)):b instanceof M?(this.F=c,this.G=a,this.$=b.$,this.Z=b.Z):B("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.F=a,this.G=b,this.$=c,this.Z=d):B("Invalid arguments to Rect constructor: "+ a+", "+b+", "+c+", "+d);this.v=!1}t=N.prototype;t.assign=function(a){this.F=a.F;this.G=a.G;this.$=a.$;this.Z=a.Z;return this};t.h=function(a,b,c,d){this.F=a;this.G=b;this.$=c;this.Z=d;return this};function Wb(a,b,c){a.$=b;a.Z=c}t.xg=function(a,b,c,d){this.F=a;this.G=b;this.$=c;this.Z=d;return this};t.set=function(a){this.F=a.F;this.G=a.G;this.$=a.$;this.Z=a.Z;return this};t.jd=function(a){this.F=a.x;this.G=a.y;return this};t.Rz=function(a){this.$=a.$;this.Z=a.Z;return this}; N.prototype.copy=function(){var a=new N;a.F=this.F;a.G=this.G;a.$=this.$;a.Z=this.Z;return a};t=N.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this}; function Xb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}function $b(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()} t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof N?this.F===a.x&&this.G===a.y&&this.$===a.width&&this.Z===a.height:!1};t.Gi=function(a,b,c,d){return this.F===a&&this.G===b&&this.$===c&&this.Z===d};t.Qa=function(a){return H.w(this.F,a.x)&&H.w(this.G,a.y)&&H.w(this.$,a.width)&&H.w(this.Z,a.height)};function ac(a,b){return H.ca(a.F,b.x)&&H.ca(a.G,b.y)&&H.ca(a.$,b.width)&&H.ca(a.Z,b.height)} t.da=function(a){return this.F<=a.x&&this.F+this.$>=a.x&&this.G<=a.y&&this.G+this.Z>=a.y};t.nf=function(a){return this.F<=a.x&&a.x+a.width<=this.F+this.$&&this.G<=a.y&&a.y+a.height<=this.G+this.Z};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.F<=a&&a+c<=this.F+this.$&&this.G<=b&&b+d<=this.G+this.Z};t.reset=function(){this.Z=this.$=this.G=this.F=0};t.offset=function(a,b){this.F+=a;this.G+=b;return this};t.Uc=function(a,b){return bc(this,b,a,b,a)}; t.Op=function(a){return bc(this,a.top,a.right,a.bottom,a.left)};t.Qv=function(a){return bc(this,-a.top,-a.right,-a.bottom,-a.left)};t.jz=function(a,b,c,d){return bc(this,a,b,c,d)};function bc(a,b,c,d,e){var f=a.$;c+e<=-f?(a.F+=f/2,a.$=0):(a.F-=e,a.$+=c+e);c=a.Z;b+d<=-c?(a.G+=c/2,a.Z=0):(a.G-=b,a.Z+=b+d);return a}t.nz=function(a){return cc(this,a.x,a.y,a.width,a.height)};t.iv=function(a,b,c,d){return cc(this,a,b,c,d)}; function cc(a,b,c,d,e){var f=Math.max(a.F,b),g=Math.max(a.G,c);b=Math.min(a.F+a.$,b+d);c=Math.min(a.G+a.Z,c+e);a.F=f;a.G=g;a.$=Math.max(0,b-f);a.Z=Math.max(0,c-g);return a}t.Ic=function(a){return this.jv(a.x,a.y,a.width,a.height)};t.jv=function(a,b,c,d){var e=this.$,f=this.F;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.Z;c=this.G;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0}; function dc(a,b,c){var d=a.$,e=a.F,f=b.x-c;if(e>b.width+c+c+f||f>d+e)return!1;d=a.Z;a=a.G;e=b.y-c;return a>b.height+c+c+e||e>d+a?!1:!0}t.Je=function(a){return ec(this,a.x,a.y,0,0)};t.Jc=function(a){return ec(this,a.F,a.G,a.$,a.Z)};t.Xv=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return ec(this,a,b,c,d)};function ec(a,b,c,d,e){var f=Math.min(a.F,b),g=Math.min(a.G,c);b=Math.max(a.F+a.$,b+d);c=Math.max(a.G+a.Z,c+e);a.F=f;a.G=g;a.$=b-f;a.Z=c-g;return a} t.sk=function(a,b,c){this.F=a-c.offsetX-c.x*this.$;this.G=b-c.offsetY-c.y*this.Z;return this};function fc(a,b,c,d,e,f,g,h){void 0===g&&(g=0);void 0===h&&(h=0);return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}function lc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.o=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.pz=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=mc.pop();return void 0===a?new N:a}; N.allocAt=function(a,b,c,d){var e=mc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){mc.push(a)}; ma.Object.defineProperties(N.prototype,{x:{get:function(){return this.F},set:function(a){this.F=a}},y:{get:function(){return this.G},set:function(a){this.G=a}},width:{get:function(){return this.$},set:function(a){0>a&&va(a,">= 0",N,"width");this.$=a}},height:{get:function(){return this.Z},set:function(a){0>a&&va(a,">= 0",N,"height");this.Z=a}},left:{ get:function(){return this.F},set:function(a){this.F=a}},top:{get:function(){return this.G},set:function(a){this.G=a}},right:{get:function(){return this.F+this.$},set:function(a){this.F+=a-(this.F+this.$)}},bottom:{get:function(){return this.G+this.Z},set:function(a){this.G+=a-(this.G+this.Z)}},position:{get:function(){return new G(this.F,this.G)},set:function(a){this.F=a.x;this.G= a.y}},size:{get:function(){return new M(this.$,this.Z)},set:function(a){this.$=a.width;this.Z=a.height}},center:{get:function(){return new G(this.F+this.$/2,this.G+this.Z/2)},set:function(a){this.F=a.x-this.$/2;this.G=a.y-this.Z/2}},centerX:{get:function(){return this.F+this.$/2},set:function(a){this.F=a-this.$/2}},centerY:{get:function(){return this.G+this.Z/2},set:function(a){this.G= a-this.Z/2}}});N.prototype.isEmpty=N.prototype.pz;N.prototype.isReal=N.prototype.o;N.prototype.setSpot=N.prototype.sk;N.prototype.union=N.prototype.Xv;N.prototype.unionRect=N.prototype.Jc;N.prototype.unionPoint=N.prototype.Je;N.prototype.intersects=N.prototype.jv;N.prototype.intersectsRect=N.prototype.Ic;N.prototype.intersect=N.prototype.iv;N.prototype.intersectRect=N.prototype.nz;N.prototype.grow=N.prototype.jz;N.prototype.subtractMargin=N.prototype.Qv;N.prototype.addMargin=N.prototype.Op; N.prototype.inflate=N.prototype.Uc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.nf;N.prototype.containsPoint=N.prototype.da;N.prototype.equalsApprox=N.prototype.Qa;N.prototype.equalTo=N.prototype.Gi;N.prototype.equals=N.prototype.A;N.prototype.setSize=N.prototype.Rz;N.prototype.setPoint=N.prototype.jd;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.xg;var nc=null,oc=null,mc=[];N.className="Rect";N.parse=Xb; N.stringify=$b;N.contains=fc;N.intersects=lc;N.ZeroRect=nc=(new N(0,0,0,0)).ga();N.NoRect=oc=(new N(NaN,NaN,NaN,NaN)).ga();N.parse=Xb;N.stringify=$b;N.contains=fc;N.intersects=lc; function pc(a,b,c,d){void 0===a?this.le=this.be=this.ve=this.xe=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):B("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}pc.prototype.assign=function(a){this.xe=a.xe;this.ve=a.ve;this.be=a.be;this.le=a.le;return this};pc.prototype.xg=function(a,b,c,d){this.xe=a;this.ve=b;this.be=c;this.le=d;return this}; pc.prototype.set=function(a){this.xe=a.xe;this.ve=a.ve;this.be=a.be;this.le=a.le;return this};pc.prototype.copy=function(){var a=new pc;a.xe=this.xe;a.ve=this.ve;a.be=this.be;a.le=this.le;return a};t=pc.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this}; function qc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new pc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new pc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new pc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new pc(c,e):new pc(c,e,f,g)}return new pc} function rc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof pc?this.xe===a.top&&this.ve===a.right&&this.be===a.bottom&&this.le===a.left:!1};t.Gi=function(a,b,c,d){return this.xe===a&&this.ve===b&&this.be===c&&this.le===d}; t.Qa=function(a){return H.w(this.xe,a.top)&&H.w(this.ve,a.right)&&H.w(this.be,a.bottom)&&H.w(this.le,a.left)};t.o=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};pc.alloc=function(){var a=tc.pop();return void 0===a?new pc:a};pc.free=function(a){tc.push(a)}; ma.Object.defineProperties(pc.prototype,{top:{get:function(){return this.xe},set:function(a){this.xe=a}},right:{get:function(){return this.ve},set:function(a){this.ve=a}},bottom:{get:function(){return this.be},set:function(a){this.be=a}},left:{get:function(){return this.le},set:function(a){this.le=a}}});pc.prototype.isReal=pc.prototype.o;pc.prototype.equalsApprox=pc.prototype.Qa; pc.prototype.equalTo=pc.prototype.Gi;pc.prototype.equals=pc.prototype.A;pc.prototype.set=pc.prototype.set;pc.prototype.setTo=pc.prototype.xg;var uc=null,vc=null,tc=[];pc.className="Margin";pc.parse=qc;pc.stringify=rc;pc.ZeroMargin=uc=(new pc(0,0,0,0)).ga();pc.TwoMargin=vc=(new pc(2,2,2,2)).ga();pc.parse=qc;pc.stringify=rc;function wc(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0} wc.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};wc.prototype.copy=function(){var a=new wc;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=wc.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}; t.A=function(a){return a instanceof wc?this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy:!1};t.ct=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this}; t.multiply=function(a){var b=this.m12*a.m11+this.m22*a.m12,c=this.m11*a.m21+this.m21*a.m22,d=this.m12*a.m21+this.m22*a.m22,e=this.m11*a.dx+this.m21*a.dy+this.dx,f=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=this.m11*a.m11+this.m21*a.m12;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this}; t.pv=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this}; t.bt=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this}; wc.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=wc.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this}; t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.ta=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};t.Ud=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))}; t.Wv=function(a){var b=a.F,c=a.G,d=b+a.$,e=c+a.Z,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.F=e;a.G=r;a.$=n-e;a.Z=p-r;return a};wc.alloc=function(){var a=xc.pop();return void 0===a?new wc:a}; wc.free=function(a){xc.push(a)};wc.prototype.transformRect=wc.prototype.Wv;wc.prototype.invertedTransformPoint=wc.prototype.Ud;wc.prototype.transformPoint=wc.prototype.ta;wc.prototype.scale=wc.prototype.scale;wc.prototype.translate=wc.prototype.translate;wc.prototype.rotate=wc.prototype.rotate;wc.prototype.invert=wc.prototype.bt;wc.prototype.multiplyInverted=wc.prototype.pv;wc.prototype.multiply=wc.prototype.multiply;wc.prototype.reset=wc.prototype.reset;wc.prototype.isIdentity=wc.prototype.ct; wc.prototype.equals=wc.prototype.A;wc.prototype.set=wc.prototype.set;var xc=[];wc.className="Transform";wc.xF="54a702f3e53909c447824c6706603faf4c";function O(a,b,c,d){void 0===a?this.Nd=this.Md=this.G=this.F=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.v=!1}var yc,zc,Ac,Dc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Mc,Nc,Oc,Pc,Qc,Rc,Sc,Tc,Vc,Wc,Xc,Yc,Zc,$c,ad,bd,cd,dd,ed,fd,ld,md,nd,od,pd; O.prototype.assign=function(a){this.F=a.F;this.G=a.G;this.Md=a.Md;this.Nd=a.Nd;return this};O.prototype.xg=function(a,b,c,d){this.F=a;this.G=b;this.Md=c;this.Nd=d;return this};O.prototype.set=function(a){this.F=a.F;this.G=a.G;this.Md=a.Md;this.Nd=a.Nd;return this};O.prototype.copy=function(){var a=new O;a.F=this.F;a.G=this.G;a.Md=this.Md;a.Nd=this.Nd;return a};t=O.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()}; t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};function qd(a,b){a.F=NaN;a.G=NaN;a.Md=b;return a} function rd(a){if("string"===typeof a){a=a.trim();if("None"===a)return yc;if("TopLeft"===a)return zc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Ac;if("TopRight"===a)return Dc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Ec;if("Center"===a)return Fc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Gc;if("BottomLeft"===a)return Hc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Ic;if("BottomRight"===a)return Jc;if("TopSide"===a)return Kc;if("LeftSide"=== a)return Mc;if("RightSide"===a)return Nc;if("BottomSide"===a)return Oc;if("TopBottomSides"===a)return Pc;if("LeftRightSides"===a)return Qc;if("TopLeftSides"===a)return Rc;if("TopRightSides"===a)return Sc;if("BottomLeftSides"===a)return Tc;if("BottomRightSides"===a)return Vc;if("NotTopSide"===a)return Wc;if("NotLeftSide"===a)return Xc;if("NotRightSide"===a)return Yc;if("NotBottomSide"===a)return Zc;if("AllSides"===a)return $c;if("Default"===a)return ad;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++; var d=a[b++];void 0!==d&&0=a)return 0;var b=H.ew;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);H.ew=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},w:function(a,b){a-=b;return.5>a&&-.5a&&-5E-8=e&&(e=1E-6);if(am-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},Ks:function(a,b,c,d,e,f,g,h,k,l,m,n){if(H.Tb(a,b,g,h,n,c,d)&&H.Tb(a,b,g,h,n,e,f))return H.Tb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var v=(d+q)/2,w=(c+u)/2;return H.Ks(a, b,p,r,d,c,v,w,k,l,m,n)||H.Ks(v,w,q,u,e,f,g,h,k,l,m,n)},ny:function(a,b,c,d,e,f,g,h,k){var l=(c+e)/2,m=(d+f)/2;k.h((((a+c)/2+l)/2+(l+(e+g)/2)/2)/2,(((b+d)/2+m)/2+(m+(f+h)/2)/2)/2);return k},my:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Db(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Tl:function(a,b,c,d,e,f,g,h,k,l){if(H.Tb(a,b,g,h,k,c,d)&&H.Tb(a,b,g,h,k,e,f))ec(l,a,b,0,0),ec(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/ 2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;H.Tl(a,b,m,n,d,c,q,u,k,l);H.Tl(q,u,p,r,e,f,g,h,k,l)}return l},Ae:function(a,b,c,d,e,f,g,h,k,l){if(H.Tb(a,b,g,h,k,c,d)&&H.Tb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;H.Ae(a,b,m,n,d,c,q,u,k,l);H.Ae(q,u,p,r,e,f,g,h,k,l)}return l},wv:function(a,b,c,d,e,f,g,h,k,l){if(H.Tb(a,b,e,f,l,c,d))return H.Tb(a, b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return H.wv(a,b,m,n,p,r,g,h,k,l)||H.wv(p,r,c,d,e,f,g,h,k,l)},hA:function(a,b,c,d,e,f,g){g.h(((a+c)/2+(c+e)/2)/2,((b+d)/2+(d+f)/2)/2);return g},vv:function(a,b,c,d,e,f,g,h){if(H.Tb(a,b,e,f,g,c,d))ec(h,a,b,0,0),ec(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;H.vv(a,b,k,l,m,n,g,h);H.vv(m,n,c,d,e,f,g,h)}return h},nq:function(a,b,c,d,e,f,g,h){if(H.Tb(a,b,e,f,g,c,d))0===h.length&&(h.push(a), h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;H.nq(a,b,k,l,m,n,g,h);H.nq(m,n,c,d,e,f,g,h)}return h},Pp:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(H.Tb(a,b,g,h,p,c,d)&&H.Tb(a,b,g,h,p,e,f)){var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(bh)return!1}else if(ag)return!1;r.h(p,q);return!0}q= (a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var v=(q+c)/2,w=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var z=(v+c)/2,y=(w+d)/2,A=(m-k)*(m-k)+(n-l)*(n-l),C=!1;H.Pp(a,b,q,u,v,w,z,y,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a=m)return r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(bb)return r}else if(aa)return r;0p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var z=(d+v)/2,y=(c+w)/2;r+=H.Qp(a,b,q,u,d,c,z,y,k,l,m,n,p);r+=H.Qp(z,y,v,w,e,f,g,h,k,l,m,n,p)}return r},Ti:function(a,b,c,d,e,f,g){if(H.ca(a,c)){bb)return g.h(a,b),!1;g.h(a,f);return!0}if(H.ca(b,d)){aa)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(H.ca(h,g))return H.Ti(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(H.ca(g,0)){aa)return k.h(a,b),!1;k.h(e,b);return!0}return H.Ti(a,b,c,d,e,g*(e-a)+b,k)},eA:function(a,b,c,d,e){return H.Ge(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},dA:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k}, Tc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(H.Ge(a,b,a,d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);pl},cA:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f- b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},$s:function(a,b,c){var d=b.x,e=b.y,f=c.x,g=c.y,h=a.left,k=a.right,l=a.top,m=a.bottom;return d===f?(e=l):e===g?(d=h):a.da(b)||a.da(c)||H.Zs(h,l,k,l,d,e,f,g)||H.Zs(k,l,k,m,d,e,f,g)||H.Zs(k,m,h,m,d,e,f,g)||H.Zs(h,m,h,l,d,e,f,g)?!0:!1},Zs:function(a,b,c,d,e,f,g,h){return 0>=H.Ms(a,b,c,d,e,f)*H.Ms(a,b,c,d,g,h)&&0>=H.Ms(e, f,g,h,a,b)*H.Ms(e,f,g,h,c,d)},Ms:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0f&&(f=0)));return 0>f?-1:0a&&(a+=360);360<=a&&(a-=360);return a},Zw:function(a,b,c,d,e,f){var g=Math.PI;f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f; for(;1E-5c,f=0>d;if(al;++l){b=.5*(h+k);if(b===h||b===k)break;var m=a/(b+ e),n=g/(b+f);m=m*m+n*n-1;if(0m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,fa?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case Hd:var b=new N(this.startX,this.startY,0,0);b.Xv(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+ " "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case Id:b=new N(this.startX,this.startY,0,0);b.Xv(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/ 2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case vd:b="";c=this.figures.j;for(var d=c.length,e=0;e=A-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new G(parseFloat(d()),parseFloat(d()));v===v.toLowerCase()&&(a.x=y.x+a.x,a.y=y.y+a.y);return a}function f(){return y=e()}function g(){return z=e()}function h(){var a=w.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?y:new G(2*y.x-z.x,2*y.y-z.y)}void 0===b&&(b=!1);a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm, "$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a=A-1);)if(w=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.ec||!0===p?(Ld(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=y;!c();)r=f(),a.lineTo(r.x,r.y);break; case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)y=new G((v===v.toLowerCase()?y.x:0)+parseFloat(d()),y.y),a.lineTo(y.x,y.y);break;case "V":for(;!c();)y=new G(y.x,(v===v.toLowerCase()?y.y:0)+parseFloat(d())),a.lineTo(y.x,y.y);break;case "C":for(;!c();){r=e();q=g();var C=f();Qd(a,r.x,r.y,q.x,q.y,C.x,C.y)}break;case "S":for(;!c();)r=h(),q=g(),C=f(),Qd(a,r.x,r.y,q.x,q.y,C.x,C.y);break;case "Q":for(;!c();)r=g(),q=f(),Rd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Rd(a, r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());C=parseFloat(d());var I=parseFloat(d()),K=parseFloat(d()),J=K,T=!1;c()||(J=parseFloat(d()),c()||(T=0!==parseFloat(d())));v===v.toLowerCase()&&(C+=y.x,I+=y.y);a.arcTo(r,q,C,I,K,J,T)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),C=parseFloat(d()),I=!!parseFloat(d()),K=!!parseFloat(d()),J=f(),Sd(a,r,q,C,I,K,J.x,J.y);break;case "Z":Td(a);y=m;break;case "F":r="";for(q=1;k[u+q];)if(null!== k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);0>d&& (q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case ae:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);q.radiusY*=Math.sqrt(b*b+d*d);break;default:B("Unknown Segment type: "+ q.type)}}}}this.ra=!0;return this}; t.da=function(a,b,c,d){var e=a.x;a=a.y;for(var f=this.bounds.x-20,g=0,h,k,l,m,n,p=this.figures.j,r=p.length,q=0;q=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(fh)return 0}else{if(bf)return 0}else if(eg)return 0}else if(le)return 0;return 0a?a=0:1=f)return d=(f-g)/m,c=c[h],e=c[2*a],h=c[2*a+1],b.h(e+(c[2*a+2]-e)*d,h+(c[2*a+3]-h)*d),b;g+=m}}b.h(NaN,NaN);return b}; t.kx=function(a){if(this.type===xd){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c=d?d===c?0:1:Math.abs(a-c)/(d-g)}return c===e?(b=d?d===b?0:1:Math.abs(f-b)/(d-g)):((f-b)*(f-b)+(a-c)*(a-c))/((d-b)*(d-b)+(e-c)*(e-c))}}else if(this.type===Hd){g=this.startX;var h=this.startY,k=this.endX;e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d, g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=G.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;na?0:1a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;ea&&(a+=360),this.ue=a,this.pi=0,this.ri=Math.max(d,0),this.ah=Math.max(e,0),this.jl="boolean"===typeof g?!!g:!1,this.Gk=!!h):(this.ue=d,this.pi=e,a===$d&&(f=Math.max(f,0)),this.ri=f,"number"===typeof g?(a===$d&&(g=Math.max(g,0)),this.ah=g):this.ah=0,this.Gk=this.jl=!1);this.nj= !1;this.ra=!0;this.Le=null}le.prototype.copy=function(){var a=new le;a.va=this.va;a.mc=this.mc;a.Bc=this.Bc;a.ue=this.ue;a.pi=this.pi;a.ri=this.ri;a.ah=this.ah;a.jl=this.jl;a.Gk=this.Gk;a.nj=this.nj;a.ra=this.ra;return a};t=le.prototype; t.Qa=function(a){if(!(a instanceof le)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Xd:case Fd:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY);case Yd:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.point1X,a.point1X)&&H.w(this.point1Y,a.point1Y)&&H.w(this.point2X,a.point2X)&&H.w(this.point2Y,a.point2Y);case Zd:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.point1X,a.point1X)&&H.w(this.point1Y,a.point1Y);case $d:return H.w(this.startAngle, a.startAngle)&&H.w(this.sweepAngle,a.sweepAngle)&&H.w(this.centerX,a.centerX)&&H.w(this.centerY,a.centerY)&&H.w(this.radiusX,a.radiusX)&&H.w(this.radiusY,a.radiusY);case ae:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&H.w(this.xAxisRotation,a.xAxisRotation)&&H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.radiusX,a.radiusX)&&H.w(this.radiusY,a.radiusY);default:return!1}};t.fb=function(a){a.classType===le&&(this.type=a)}; t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Xd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Fd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Yd:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+ " "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Zd:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case $d:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+ " "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case ae:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+ " "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.nj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.close=function(){this.nj=!0;return this}; function be(a,b){if(null!==a.Le&&!1===b.ra)return a.Le;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Le=[],a.Le;b=a.ue;var e=a.pi,f=H.Zw(0,0,c=r?g=Math.PI:1<=r&&(g=0);!k&&0g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=H.Zw(0,0,b>f?b:f,m,m+g,!0);f=wc.alloc();f.reset();f.translate(c,d);f.rotate(a.ue,0,0);f.scale(k,r);Vd(b,f);wc.free(f);a.Le=b;return a.Le} ma.Object.defineProperties(le.prototype,{isClosed:{get:function(){return this.nj},set:function(a){this.nj!==a&&(this.nj=a,this.ra=!0)}},type:{get:function(){return this.va},set:function(a){this.v&&ua(this,a);this.va=a;this.ra=!0}},endX:{get:function(){return this.mc},set:function(a){this.v&&ua(this,a);this.mc=a;this.ra=!0}},endY:{get:function(){return this.Bc},set:function(a){this.v&& ua(this,a);this.Bc=a;this.ra=!0}},point1X:{get:function(){return this.ue},set:function(a){this.v&&ua(this,a);this.ue=a;this.ra=!0}},point1Y:{get:function(){return this.pi},set:function(a){this.v&&ua(this,a);this.pi=a;this.ra=!0}},point2X:{get:function(){return this.ri},set:function(a){this.v&&ua(this,a);this.ri=a;this.ra=!0}},point2Y:{get:function(){return this.ah},set:function(a){this.v&& ua(this,a);this.ah=a;this.ra=!0}},centerX:{get:function(){return this.ue},set:function(a){this.v&&ua(this,a);this.ue=a;this.ra=!0}},centerY:{get:function(){return this.pi},set:function(a){this.v&&ua(this,a);this.pi=a;this.ra=!0}},radiusX:{get:function(){return this.ri},set:function(a){0>a&&va(a,">= zero",le,"radiusX");this.v&&ua(this,a);this.ri=a;this.ra=!0}},radiusY:{get:function(){return this.ah}, set:function(a){0>a&&va(a,">= zero",le,"radiusY");this.v&&ua(this,a);this.ah=a;this.ra=!0}},startAngle:{get:function(){return this.mc},set:function(a){this.mc!==a&&(this.v&&ua(this,a),a%=360,0>a&&(a+=360),this.mc=a,this.ra=!0)}},sweepAngle:{get:function(){return this.Bc},set:function(a){this.v&&ua(this,a);360a&&(a=-360);this.Bc=a;this.ra=!0}},isClockwiseArc:{get:function(){return this.Gk},set:function(a){this.v&& ua(this,a);this.Gk=a;this.ra=!0}},isLargeArc:{get:function(){return this.jl},set:function(a){this.v&&ua(this,a);this.jl=a;this.ra=!0}},xAxisRotation:{get:function(){return this.ue},set:function(a){a%=360;0>a&&(a+=360);this.v&&ua(this,a);this.ue=a;this.ra=!0}}});le.prototype.equalsApprox=le.prototype.Qa; var Xd=new D(le,"Move",0),Fd=new D(le,"Line",1),Yd=new D(le,"Bezier",2),Zd=new D(le,"QuadraticBezier",3),$d=new D(le,"Arc",4),ae=new D(le,"SvgArc",4);le.className="PathSegment";le.Move=Xd;le.Line=Fd;le.Bezier=Yd;le.QuadraticBezier=Zd;le.Arc=$d;le.SvgArc=ae;function ne(){this.C=null;this.Du=(new G(0,0)).freeze();this.Tt=(new G(0,0)).freeze();this.Pq=this.Wr=0;this.Qq=1;this.Lr="";this.Fs=this.gr=!1;this.fr=this.Sq=0;this.Eg=this.ur=this.Fr=!1;this.mr=null;this.Ds=0;this.Qd=this.Cs=null} ne.prototype.copy=function(){var a=new ne;return this.clone(a)};ne.prototype.clone=function(a){a.C=this.C;a.Du.assign(this.viewPoint);a.Tt.assign(this.documentPoint);a.Wr=this.Wr;a.Pq=this.Pq;a.Qq=this.Qq;a.Lr=this.Lr;a.gr=this.gr;a.Fs=this.Fs;a.Sq=this.Sq;a.fr=this.fr;a.Fr=this.Fr;a.ur=this.ur;a.Eg=this.Eg;a.mr=this.mr;a.Ds=this.Ds;a.Cs=this.Cs;a.Qd=this.Qd;return a}; ne.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};ne.prototype.$p=function(a,b){var c=this.diagram;if(null===c)return b;oe(c,this.event,a,b);return b}; ne.prototype.az=function(a,b){var c=this.diagram;if(null===c)return b;oe(c,this.event,a,b);b.assign(c.yt(b));return b}; ma.Object.defineProperties(ne.prototype,{diagram:{get:function(){return this.C},set:function(a){this.C=a}},viewPoint:{get:function(){return this.Du},set:function(a){this.Du.assign(a)}},documentPoint:{get:function(){return this.Tt},set:function(a){this.Tt.assign(a)}},modifiers:{get:function(){return this.Wr},set:function(a){this.Wr=a}},button:{get:function(){return this.Pq}, set:function(a){this.Pq=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.Qq},set:function(a){this.Qq=a}},key:{get:function(){return this.Lr},set:function(a){this.Lr=a}},down:{get:function(){return this.gr},set:function(a){this.gr=a}},up:{get:function(){return this.Fs},set:function(a){this.Fs= a}},clickCount:{get:function(){return this.Sq},set:function(a){this.Sq=a}},delta:{get:function(){return this.fr},set:function(a){this.fr=a}},isMultiTouch:{get:function(){return this.Fr},set:function(a){this.Fr=a}},handled:{get:function(){return this.ur},set:function(a){this.ur=a}},bubbles:{get:function(){return this.Eg},set:function(a){this.Eg=a}},event:{ get:function(){return this.mr},set:function(a){this.mr=a}},isTouchEvent:{get:function(){var a=x.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=x.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.Ds},set:function(a){this.Ds=a}},targetDiagram:{get:function(){return this.Cs},set:function(a){this.Cs=a}},targetObject:{ get:function(){return this.Qd},set:function(a){this.Qd=a}},control:{get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers| 2:this.modifiers&-3}},meta:{get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=a?this.buttons|1:this.buttons&-2}},right:{get:function(){var a= this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}}); ne.prototype.getMultiTouchDocumentPoint=ne.prototype.az;ne.prototype.getMultiTouchViewPoint=ne.prototype.$p;ne.className="InputEvent";function pe(){this.C=null;this.Ua="";this.gs=this.As=null}pe.prototype.copy=function(){var a=new pe;a.C=this.C;a.Ua=this.Ua;a.As=this.As;a.gs=this.gs;return a};pe.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a}; ma.Object.defineProperties(pe.prototype,{diagram:{get:function(){return this.C},set:function(a){this.C=a}},name:{get:function(){return this.Ua},set:function(a){this.Ua=a}},subject:{get:function(){return this.As},set:function(a){this.As=a}},parameter:{get:function(){return this.gs},set:function(a){this.gs=a}}});pe.className="DiagramEvent"; function qe(){this.Wm=re;this.Fj=this.Vr="";this.Co=this.Do=this.Io=this.Jo=this.Ho=this.C=this.Zb=null}qe.prototype.clear=function(){this.Co=this.Do=this.Io=this.Jo=this.Ho=this.C=this.Zb=null}; qe.prototype.copy=function(){var a=new qe;a.Wm=this.Wm;a.Vr=this.Vr;a.Fj=this.Fj;a.Zb=this.Zb;a.C=this.C;a.Ho=this.Ho;var b=this.Jo;a.Jo=ya(b)&&"function"===typeof b.I?b.I():b;b=this.Io;a.Io=ya(b)&&"function"===typeof b.I?b.I():b;b=this.Do;a.Do=ya(b)&&"function"===typeof b.I?b.I():b;b=this.Co;a.Co=ya(b)&&"function"===typeof b.I?b.I():b;return a};qe.prototype.fb=function(a){a.classType===qe&&(this.change=a)}; qe.prototype.toString=function(){var a="";a=this.change===se?a+"* ":this.change===re?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===se?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ja(this.object)),null!==this.oldValue&&(a+=" old: "+Ja(this.oldValue)),null!== this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+=" new: "+Ja(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};qe.prototype.J=function(a){return a?this.oldValue:this.newValue};qe.prototype.cz=function(a){return a?this.oldParam:this.newParam};qe.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};qe.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.Tj(this,!0):null!==this.diagram&&this.diagram.Tj(this,!0))}; qe.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};qe.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.Tj(this,!1):null!==this.diagram&&this.diagram.Tj(this,!1))}; ma.Object.defineProperties(qe.prototype,{model:{get:function(){return this.Zb},set:function(a){this.Zb=a}},diagram:{get:function(){return this.C},set:function(a){this.C=a}},change:{get:function(){return this.Wm},set:function(a){this.Wm=a}},modelChange:{get:function(){return this.Vr},set:function(a){this.Vr=a}},propertyName:{get:function(){return this.Fj}, set:function(a){this.Fj=a}},isTransactionFinished:{get:function(){return this.Wm===se&&("CommittedTransaction"===this.Fj||"FinishedUndo"===this.Fj||"FinishedRedo"===this.Fj)}},object:{get:function(){return this.Ho},set:function(a){this.Ho=a}},oldValue:{get:function(){return this.Jo},set:function(a){this.Jo=a}},oldParam:{get:function(){return this.Io},set:function(a){this.Io=a}}, newValue:{get:function(){return this.Do},set:function(a){this.Do=a}},newParam:{get:function(){return this.Co},set:function(a){this.Co=a}}});qe.prototype.redo=qe.prototype.redo;qe.prototype.canRedo=qe.prototype.canRedo;qe.prototype.undo=qe.prototype.undo;qe.prototype.canUndo=qe.prototype.canUndo;qe.prototype.getParam=qe.prototype.cz;qe.prototype.getValue=qe.prototype.J;qe.prototype.clear=qe.prototype.clear; var se=new D(qe,"Transaction",-1),re=new D(qe,"Property",0),te=new D(qe,"Insert",1),ue=new D(qe,"Remove",2);qe.className="ChangedEvent";qe.Transaction=se;qe.Property=re;qe.Insert=te;qe.Remove=ue;function ve(){this.u=(new E).freeze();this.Ua="";this.l=!1}ve.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0a.transactionLevel&&wa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel;d&&b&&a.yb("CommittingTransaction",c,a.currentTransaction);var e=0;if(0a.historyIndex;e--)f=d.N(e),null!==f&&f.clear(),d.mb(e),a.eu=!0;e=a.maxHistoryLength;0<=e&&(0===e?d.clear():d.count>=e&&(f=d.N(0),null!==f&&f.clear(),d.mb(0),a.ge--));0!==e&&(d.add(b),a.ge++);d.freeze();f=b}a.yb("CommittedTransaction",c,f)}else{a.ie=!0;try{a.isEnabled&&null!==f&&(f.isComplete=!0,f.undo())}finally{a.yb("RolledBackTransaction",c,f),a.ie=!1}null!==f&&f.clear()}a.dr=null;return!0}if(a.isEnabled&&!b&&null!==f){a=e;c= f.changes;for(b=c.count-1;b>=a;b--)d=c.N(b),null!==d&&d.undo(),c.ha(),c.mb(b);c.freeze()}return!1}Ce.prototype.canUndo=function(){if(!this.isEnabled||0=this.transactionLevel&&!this.$t&&(a=a.diagram,null!==a&&!1===a.Ri||wa("Change not within a transaction: "+c.toString()))}}; Ce.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1}; ma.Object.defineProperties(Ce.prototype,{models:{get:function(){return this.ku.iterator}},isEnabled:{get:function(){return this.Dc},set:function(a){this.Dc=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.N(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndexe&&(e=-3),0g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0e||Math.abs(b.y-a.y)>d}; ma.Object.defineProperties(Ee.prototype,{diagram:{get:function(){return this.C},set:function(a){a instanceof P&&(this.C=a)}},name:{get:function(){return this.Ua},set:function(a){this.Ua=a}},isEnabled:{get:function(){return this.Dc},set:function(a){this.Dc=a}},isActive:{get:function(){return this.Ub},set:function(a){this.Ub=a}},transactionResult:{get:function(){return this.Cq}, set:function(a){this.Cq=a}}});Ee.prototype.stopTransaction=Ee.prototype.zg;Ee.prototype.startTransaction=Ee.prototype.Aa;Ee.className="Tool";function Na(){Ee.call(this);this.name="ToolManager";this.Kc=new E;this.Vc=new E;this.Ag=new E;this.ba=this.La=850;this.u=(new M(2,2)).ga();this.Vb=5E3;this.Ma=Ie;this.K=Ke;this.cr=this.l=null;this.Mj=-1}la(Na,Ee);Na.prototype.initializeStandardTools=function(){}; Na.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Je&&this.cr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}}; Na.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Le&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Me){b.bubbles=!0;return}if(this.gestureBehavior===Le)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;de.right&&(c.x-=d.width+5/b.scale);c.xe.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.ye&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)} function rf(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.eg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=Ff(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=Ff(a,c.i(c.pointsCount-1),!0),null!==h&&(k=h.part));e.isValidLink(g,f,k,h)?b?(c.defaultFromPoint=c.i(0),c.defaultToPoint=c.i(c.pointsCount-1),c.suspendsRouting=!1,c.fromNode=g,null!==f&&(c.fromPortId=f.portId),c.toNode=k,null!==h&&(c.toPortId=h.portId),c.fromPort!== d.tx&&d.aa("LinkRelinked",c,d.tx),c.toPort!==d.ux&&d.aa("LinkRelinked",c,d.ux)):Gf(e,g,f,k,h):Gf(e,null,null,null,null)}}}}Re.prototype.doDragOver=function(){}; function Hf(a,b){var c=a.diagram;a.dragsLink&&Cf(a,!0);gf(a);var d=Df(c,b,null,function(b){return!Af(a,b)}),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;If(a,e,f);f=Ef(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==$e){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof V&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!== $e){b=N.alloc();for(d=c.selection.iterator;d.next();)e=d.value,e instanceof V&&Jf(a,c,e,b);N.free(b)}}}function If(a,b,c){a=a.diagram;c instanceof S&&null===c.containingGroup&&!(c instanceof U)&&a.handlesDragDropForTopLevelParts&&(c=a.mouseDrop,null!==c&&c(b))} function Jf(a,b,c,d){var e=!1;c.getAvoidableRect(d);b.viewportBounds.nf(d)&&(e=!0);b=b.links;for(a=a.copiedParts||a.draggedParts;b.next();){var f=b.value;if(!e||Kf(f))a.contains(f)&&a.contains(c)||!f.Vd(c)&&f.isAvoiding&&dc(f.actualBounds,d,0)&&f.Ra()}}Re.prototype.doDropOnto=function(){}; Re.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,null,b.targetDiagram||null)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(a.currentCursor="copy",rf(this,!1),cf(a,this.copiedParts),tf(this,this.copiedParts,!1),hf(a,this.copiedParts)):this.mayMove()?(a.currentCursor="",lf(this),tf(this,this.draggedParts,!0)):this.mayDragOut()?(a.currentCursor="no-drop",rf(this,!1),tf(this,this.copiedParts,!1)):lf(this),Bf(this, a.lastInput.documentPoint))}}; Re.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,null,b.documentPoint,b.targetDiagram)){var c=!1;(b=this.mayCopy())&&null!==this.copiedParts?(lf(this),rf(this,!0),cf(a,this.copiedParts),tf(this,this.copiedParts,!1),hf(a,this.copiedParts),null!==this.copiedParts&&a.Iv(this.copiedParts.Yd())):(c=!0,lf(this),this.mayMove()&&(tf(this,this.draggedParts,!0),Bf(this,a.lastInput.documentPoint)));this.yn=!0;Hf(this,a.lastInput.documentPoint); if(this.isActive){var d=b?this.copiedParts.Yd():this.draggedParts.Yd();this.copiedParts=null;if(c&&null!==this.draggedParts)for(c=this.draggedParts.iterator;c.next();){var e=c.key;e instanceof V&&(e=e.containingGroup,null===e||null===e.placeholder||this.draggedParts.contains(e)||e.placeholder.s())}a.Xa();hf(a,this.draggedParts);this.transactionResult=b?"Copy":"Move";a.aa(b?"SelectionCopied":"SelectionMoved",d)}this.stopTool()}}}; Re.prototype.simulatedMouseMove=function(a,b,c){if(null===$e)return!1;var d=$e.diagram;c instanceof P||(c=null);var e=df;c!==e&&(null!==e&&e!==d&&(e.xf(),$e.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),df=c,null!==c&&c!==d&&(of(),e=c.toolManager.findTool("Dragging"),null!==e&&(jf.contains(e)||jf.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!== a?(void 0!==a.targetTouches&&(0=d&&(d=.1);var e=this,f=b.rg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof V){var k=g.ma(Fc,G.alloc()),l=c.x-k.x,m=c.y-k.y;G.free(k);k=l*l+m*m;kc){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.Wp(b).count>=c)return!1}return!0}; Nf.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.toLinkable))return!1;var c=b.toMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalToNode&&b===this.originalToPort)return!0;b=b.portId;null===b&&(b="");if(a.sd(b).count>=c)return!1}return!0}; Nf.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;a=a.part;b=b.part;return null!==a&&a===b};Nf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof V))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof V))return!1;b=b.portId;null===b&&(b="");for(b=d.sd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1}; Nf.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.fromLinkableSelfNode&&d.toLinkableSelfNode||!this.isInSameNode(b,d))&&(b.fromLinkableDuplicates&&d.toLinkableDuplicates||!this.isLinked(b,d)))||null!==this.originalLink&&(null!==a&&this.isLabelDependentOnLink(a,this.originalLink)||null!==c&&this.isLabelDependentOnLink(c,this.originalLink))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a, c,this.originalLink))return!1;if(null!==a){var e=a.linkValidation;if(null!==e&&!e(a,b,c,d,this.originalLink))return!1}if(null!==c&&(e=c.linkValidation,null!==e&&!e(a,b,c,d,this.originalLink)))return!1;e=this.linkValidation;return null!==e?e(a,b,c,d,this.originalLink):!0};Nf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new F;d.add(a);return Of(this,c,b,d)}; function Of(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Of(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Of(a,b.labeledLink,c,d))?!0:!1} Nf.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==Pf){if(d===Qf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!Rf(this,a,b,c,!0)}if(d===Sf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode=== a)return!1;return!Rf(this,a,b,c,!0)}if(d===Tf)return a===b?a=!0:(d=new F,d.add(b),a=Uf(this,d,a,b,c)),!a;if(d===Vf)return!Rf(this,a,b,c,!1);if(d===Wf)return a===b?a=!0:(d=new F,d.add(b),a=jg(this,d,a,b,c)),!a}return!0};function Rf(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&Rf(a,g,c,d,e)))return!0}return!1} function Uf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&Uf(a,b,g,d,e)))return!0}return!1}function jg(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&jg(a,b,h,d,e))return!0}}return!1} ma.Object.defineProperties(Nf.prototype,{portGravity:{get:function(){return this.Ag},set:function(a){0<=a&&(this.Ag=a)}},isUnconnectedLinkValid:{get:function(){return this.ba},set:function(a){this.ba=a}},temporaryLink:{get:function(){return this.Hm},set:function(a){this.Hm=a}},temporaryFromNode:{get:function(){return this.Fm},set:function(a){this.Fm=a}},temporaryFromPort:{ get:function(){return this.Gm},set:function(a){this.Gm=a}},temporaryToNode:{get:function(){return this.Aq},set:function(a){this.Aq=a}},temporaryToPort:{get:function(){return this.Bq},set:function(a){this.Bq=a}},originalLink:{get:function(){return this.Vb},set:function(a){this.Vb=a}},originalFromNode:{get:function(){return this.La},set:function(a){this.La=a}},originalFromPort:{ get:function(){return this.Ma},set:function(a){this.Ma=a}},originalToNode:{get:function(){return this.Kc},set:function(a){this.Kc=a}},originalToPort:{get:function(){return this.Vc},set:function(a){this.Vc=a}},isForwards:{get:function(){return this.K},set:function(a){this.K=a}},validPortsCache:{get:function(){return this.Px}},targetPort:{ get:function(){return this.Em},set:function(a){this.Em=a}},linkValidation:{get:function(){return this.ki},set:function(a){this.ki=a}},portTargeted:{get:function(){return this.Dm},set:function(a){this.Dm=a}}});Nf.className="LinkingBaseTool";function kg(){Nf.call(this);this.name="Linking";this.u={};this.l=null;this.L=lg;this.Eh=null}la(kg,Nf); kg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.dt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()}; kg.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Rb(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof V))return null;a=this.direction;if(a===lg||a===mg){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===lg||a===ng)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null}; kg.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Aa(this.name),a.isMouseCaptured=!0,a.currentCursor="pointer",this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.o()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof V&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort, !1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.o()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof V&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode), null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Ra(),a.add(this.temporaryLink)),this.isActive=!0)};kg.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.zg()};kg.prototype.doStop=function(){Nf.prototype.doStop.call(this);this.startObject=null}; kg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=this.targetPort=this.findTargetPort(this.isForwards);if(null!==f){var g=f.part;g instanceof V&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=g,e=f):(b=g,c=f,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&(b=this.originalFromNode, c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(g=this.insertLink(b,c,d,e),null!==g?(null===f&&(this.isForwards?g.defaultToPoint=a.lastInput.documentPoint:g.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&a.select(g),this.transactionResult=this.name,a.aa("LinkDrawn",g)):(a.model.Nu(),this.doNoLink(b,c,d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null): this.doNoLink(null,null,this.originalToNode,this.originalToPort)}this.stopTool()};kg.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof R)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};kg.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};kg.prototype.doNoLink=function(){}; ma.Object.defineProperties(kg.prototype,{archetypeLinkData:{get:function(){return this.u},set:function(a){this.u=a}},archetypeLabelNodeData:{get:function(){return this.l},set:function(a){this.l=a}},direction:{get:function(){return this.L},set:function(a){this.L=a}},startObject:{get:function(){return this.Eh},set:function(a){this.Eh=a}}}); var lg=new D(kg,"Either",0),mg=new D(kg,"ForwardsOnly",0),ng=new D(kg,"BackwardsOnly",0);kg.className="LinkingTool";kg.Either=lg;kg.ForwardsOnly=mg;kg.BackwardsOnly=ng; function ef(){Nf.call(this);this.name="Relinking";var a=new W;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=0;this.u=a;a=new W;a.figure="Diamond";a.desiredSize=Ob;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=-1;this.Eh=a;this.l=null;this.Gw=new N}la(ef,Nf); ef.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.tf()&&(c=a.bk(b),null===c&&(c=this.makeAdornment(d,!1),a.rh(b,c)))}null===c&&a.vf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.tf()&& (c=a.bk(b),null===c?(c=this.makeAdornment(d,!0),a.rh(b,c)):c.s()));null===c&&a.vf(b)}};ef.prototype.makeAdornment=function(a,b){var c=new Je;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c}; ef.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.dt()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b}; ef.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof Je&&c.adornedPart instanceof R))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Aa(this.name);a.isMouseCaptured=!0;a.currentCursor="pointer"; this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Gw.set(this.originalLink.actualBounds);null!==this.originalLink&&0b.firstPickIndex+1&&c=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize": "e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};yg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1}; yg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(this.vl.set(this.adornedObject.ma(this.handle.alignment.tv())),this.Lo.set(this.adornedObject.part.location),this.Fw.set(this.adornedObject.desiredSize),this.Wt=this.computeCellSize(),this.Yt=this.computeMinSize(),this.Xt=this.computeMaxSize(),a.isMouseCaptured= !0,this.Cw=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Aa(this.name),this.isActive=!0))};yg.prototype.doDeactivate=function(){var a=this.diagram;this.zg();this.$d=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.Cw};yg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()}; yg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Yt,c=this.Xt,d=this.Wt,e=this.adornedObject.Ws(a.lastInput.documentPoint,G.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.fd();G.free(e)}}; yg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Yt,c=this.Xt,d=this.Wt,e=this.adornedObject.Ws(a.lastInput.documentPoint,G.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);G.free(e);a.Xa();this.transactionResult=this.name;a.aa("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()}; yg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject,d=c.part;c.desiredSize=a.size;d.$b();a=this.adornedObject.ma(this.handle.alignment.tv());d instanceof U?(c=new E,c.add(d),b.moveParts(c,this.vl.copy().Xd(a),!0)):d.location=d.location.copy().Xd(a).add(this.vl)}; yg.prototype.computeResize=function(a,b,c,d,e,f){b.jc()&&(b=Fc);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=G.alloc();H.Xp(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n* a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x= Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width), a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height), a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));G.free(p);return a};yg.prototype.computeReshape=function(){var a=Bg;this.adornedObject instanceof W&&(a=Cg(this.adornedObject));return!(a===Dg||this.diagram.lastInput.shift)}; yg.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};yg.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.widthc?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+ d,b.y=-d);return a.ma(b)};Eg.prototype.doDeactivate=function(){var a=this.diagram;this.zg();this.$d=this.handle=null;this.ru=new G(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Eg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Eg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))}; Eg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Xa();this.transactionResult=this.name;a.aa("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};Eg.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.$b();var c=b.locationObject,d=b.rotateObject;if(c===d||c.ug(d))c=this.Lo.copy(),b.location=c.Xd(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint)}}; Eg.prototype.computeRotate=function(a){a=this.rotationPoint.Wa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Mi());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a}; ma.Object.defineProperties(Eg.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.l},set:function(a){if(null!==a&&!(a.part instanceof Je))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{get:function(){return this.$d},set:function(a){if(null!==a&&a.part instanceof Je)throw Error("new handle must not be in an Adornment: "+ a);this.$d=a}},snapAngleMultiple:{get:function(){return this.Ma},set:function(a){this.Ma=a}},snapAngleEpsilon:{get:function(){return this.La},set:function(a){this.La=a}},originalAngle:{get:function(){return this.Ew}},rotationPoint:{get:function(){return this.ru}},handleAngle:{get:function(){return this.K},set:function(a){this.K=a}},handleDistance:{ get:function(){return this.ba},set:function(a){this.ba=a}}});Eg.className="RotatingTool";Ma("rotatingTool",function(){return this.findTool("Rotating")},function(a){Pe(this,"Rotating",a,this.mouseDownTools)});function Fg(){Ee.call(this);this.name="ClickSelecting"}la(Fg,Ee);Fg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0}; Fg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Fg.className="ClickSelectingTool";function Gg(){Ee.call(this);this.name="Action";this.xk=null}la(Gg,Ee); Gg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Rb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.xk=c;a.Lk=a.Rb(b.documentPoint,null,null);return!0}return!1};Gg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.xk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()}; Gg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.xk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Gg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.xk;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()}; Gg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.xk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Gg.prototype.doStop=function(){this.xk=null};Gg.className="ActionTool";function Hg(){Ee.call(this);this.name="ClickCreating";this.bj=null;this.u=!0;this.l=!1;this.ww=new G(0,0)}la(Hg,Ee); Hg.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.ww=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.ww))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.am(a.lastInput.documentPoint,!0)?!1:!0}; Hg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()}; Hg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;this.Aa(this.name);var d=null;c instanceof S?c.bc()&&(Ag(c),d=c.copy(),null!==d&&b.add(d)):null!==c&&(c=b.model.copyNodeData(c),ya(c)&&(b.model.kf(c),d=b.vc(c)));null!==d&&(c=G.allocAt(a.x,a.y),this.isGridSnapEnabled&&Ig(this.diagram,d,a,c),d.location=c,b.allowSelect&&b.select(d),G.free(c));b.Xa();this.transactionResult=this.name;b.aa("PartCreated",d);this.zg();return d}; ma.Object.defineProperties(Hg.prototype,{archetypeNodeData:{get:function(){return this.bj},set:function(a){this.bj=a}},isDoubleClick:{get:function(){return this.u},set:function(a){this.u=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});Hg.className="ClickCreatingTool"; function Jg(){Ee.call(this);this.name="DragSelecting";this.Sk=175;this.u=!1;var a=new S;a.layerName="Tool";a.selectable=!1;var b=new W;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Jg,Ee); Jg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestampe.right&&(c.x-=d.width+5/b.scale);c.xe.bottom&&(c.y-=d.height+5/b.scale);c.ya.lastInput.clickCount?!1:!0};Xg.prototype.doStart=function(){this.isActive||null===this.textBlock||this.doActivate()}; Xg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Rb(a.lastInput.documentPoint));if(null!==b&&b instanceof Yg&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.la=dh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.lh=this.textBlock.copy();var d=new N(this.textBlock.ma(zc),this.textBlock.ma(Jc));a.Hv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Xg.prototype.doCancel=function(){this.stopTool()}; Xg.prototype.doMouseUp=function(){!this.isActive&&this.canStart()&&this.doActivate()};Xg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(ph)}; Xg.prototype.acceptText=function(a){switch(a){case ph:if(this.la===qh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.la===dh||this.la===nh||this.la===eh)this.la=rh,sh(this);break;case th:case bh:case ch:if(bh!==a||!0!==this.textBlock.isMultiline)if(this.la===dh||this.la===nh||this.la===eh)this.la=rh,sh(this)}}; function sh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.Aa(a.name),a.la=qh,a.transactionResult=a.name,b.text=f,null!==b.textEdited&&b.textEdited(b,e,f),null!==c&&c.aa("TextEdited",b,e),a.zg(),a.stopTool(),null!==c&&c.doFocus()):(a.la=nh,null!==b.errorFunction&&b.errorFunction(a,e,f),d.show(b,c,a))}} Xg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.la=$g,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Xg.prototype.isValidText=function(a,b,c){var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};Xg.prototype.sx=function(a){var b=this.lh;b.text=a;b.measure(this.textBlock.kl,Infinity);return b}; ma.Object.defineProperties(Xg.prototype,{textBlock:{get:function(){return this.Ma},set:function(a){this.Ma=a}},currentTextEditor:{get:function(){return this.u},set:function(a){this.u=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.La},set:function(a){this.La=a}},textValidation:{get:function(){return this.yi}, set:function(a){this.yi=a}},minimumEditorScale:{get:function(){return this.K},set:function(a){this.K=a}},selectsTextOnActivate:{get:function(){return this.ba},set:function(a){this.ba=a}},state:{get:function(){return this.la},set:function(a){this.la!==a&&(this.la=a)}}});Xg.prototype.measureTemporaryTextBlock=Xg.prototype.sx; var th=new D(Xg,"LostFocus",0),ph=new D(Xg,"MouseDown",1),ch=new D(Xg,"Tab",2),bh=new D(Xg,"Enter",3),uh=new D(Xg,"SingleClick",0),Zg=new D(Xg,"SingleClickSelected",1),oh=new D(Xg,"DoubleClick",2),$g=new D(Xg,"StateNone",0),dh=new D(Xg,"StateActive",1),eh=new D(Xg,"StateEditing",2),rh=new D(Xg,"StateValidating",3),nh=new D(Xg,"StateInvalid",4),qh=new D(Xg,"StateValidated",5);Xg.className="TextEditingTool";Xg.LostFocus=th;Xg.MouseDown=ph;Xg.Tab=ch;Xg.Enter=bh;Xg.SingleClick=uh; Xg.SingleClickSelected=Zg;Xg.DoubleClick=oh;Xg.StateNone=$g;Xg.StateActive=dh;Xg.StateEditing=eh;Xg.StateValidating=rh;Xg.StateInvalid=nh;Xg.StateValidated=qh;Ma("textEditingTool",function(){return this.findTool("TextEditing")},function(a){Pe(this,"TextEditing",a,this.mouseUpTools)}); function vh(){wh||(xh(),wh=!0);this.ow=yh;this.C=Fe;this.rn=this.sn=null;this.aj=this.tn=this.un=0;this.Ck=this.oi=this.rb=this.Ir=this.Nf=!1;this.Of=this.Dc=!0;this.$q=this.Zq=this.nw=null;this.mw=0;this.br=new vb;this.Vt=600;this.Tx=new G(0,0);this.kw=this.jw=this.Lw=!1;this.ae=new F;this.zj=new vb;this.cs=new F;this.ar=null}function zh(a){a.aj=0;a.br.clear();a.$q=null;a.Zq=null;a.sn=null;a.rn=null;a.un=0;a.tn=0;a.zj.clear();0a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}vh.prototype.canStart=function(){return!0};t=vh.prototype;t.Ui=function(a,b){this.Dc&&(void 0!==b&&(this.ar=b),(this.Of||this.C.Ri)&&this.canStart(a)&&(this.ae.add(a),this.Nf&&this.vd(),this.oi=this.rb=!0))};t.Gz=function(a,b){this.Dc&&(void 0!==b&&(this.ar=b),this.Of||this.C.Ri)&&(this.ae.add(a),this.canStart(a)&&(this.Nf&&this.vd(),this.rb=!0))}; function Ah(a){if(a.Dc)if(a.ae.contains("Model")&&!a.Of||!a.Ck)a.ae.clear(),a.rb=!1,a.oi=!1,zh(a);else if(a.ae.clear(),a.rb&&0===a.aj){var b=+new Date;a.aj=b;x.requestAnimationFrame(function(){if(!1!==a.rb&&!a.Nf&&a.aj===b){var c=a.C;c.Ee("temporaryPixelRatio")&&bf(c);Bh(c);a.rb=!1;a.oi=!1;c.aa("AnimationStarting");Ch(a,b)}})}} t.th=function(a,b,c,d,e,f){if(!(!this.rb||"position"===b&&c.A(d)||a instanceof S&&!a.isAnimated)){var g=this.zj;if(g.contains(a)){var h=g.J(a);g=h.start;var k=h.end;void 0===g[b]&&(g[b]=Dh(c));k[b]=Dh(d)}else h={},k={},h[b]=Dh(c),k[b]=Dh(d),d=h.position,d instanceof G&&!d.o()&&this.ae.contains("Expand SubGraph")&&d.assign(k.position),h=new Eh(h,k,e),g.add(a,h);e&&0===b.indexOf("position:")&&a instanceof S?h.Wu.location=Dh(a.location):e&&(h.Wu[b]=Dh(c));f&&(h.pt=!0);this.Ck=!0}}; function Dh(a){return a instanceof G?a.copy():a instanceof M?a.copy():a}function Fh(a,b){if(!a.Nf)return!1;a=a.zj.J(b);return null!==a&&a.pt} function Ch(a,b){function c(){if(!1!==e.Nf&&e.aj===b){var a=+new Date,f=a>q?l:a-r;Gh(e);Hh(e,d,p,g,f,l);e.Zq&&e.Zq();Lf(d);Ih(e);a>q?Jh(e):x.requestAnimationFrame(c)}}var d=a.C;if(null!==d){var e=a,f=a.ar||{},g=f.bA||a.ow,h=f.fA||null,k=f.gA||null,l=f.duration||a.Vt,m=a.Tx;for(f=a.zj.iterator;f.next();){var n=f.value.start.position;n instanceof G&&(n.o()||n.assign(m))}a.nw=g;a.Zq=h;a.$q=k;a.mw=l;a.br=a.zj;var p=a.br;for(f=p.iterator;f.next();)h=f.value.end,h["position:placeholder"]&&(k=f.key.findVisibleNode(), k instanceof U&&null!==k.placeholder&&(m=k.placeholder,k=m.ma(zc),m=m.padding,k.x+=m.left,k.y+=m.top,h["position:placeholder"]=k));a.Nf=!0;Gh(a);Hh(a,d,p,g,0,l);Lf(a.C,!0);Ih(a);var r=+new Date,q=r+l;e.aj===b&&x.requestAnimationFrame(function(){c()})}}function Gh(a){if(!a.Ir){var b=a.C;a.Lw=b.skipsUndoManager;a.jw=b.skipsModelSourceBindings;a.kw=b.tk;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;b.tk=!0;a.Ir=!0}} function Ih(a){var b=a.C;b.skipsUndoManager=a.Lw;b.skipsModelSourceBindings=a.jw;b.tk=a.kw;a.Ir=!1}function Hh(a,b,c,d,e,f){for(c=c.iterator;c.next();){var g=c.key,h=c.value,k=h.start,l=h.end,m=Kh;for(n in l)"position"===n&&(l["position:placeholder"]||l["position:node"])||null===m.get(n)||m.get(n)(g,k[n],l[n],d,e,f,h)}d=b.lv;b.lv=!0;var n=a.ow;0!==a.un&&0!==a.tn&&(c=a.un,b.Ca=n(e,c,a.tn-c,f));null!==a.sn&&null!==a.rn&&(c=a.sn,a=a.rn,b.sa=new G(n(e,c.x,a.x-c.x,f),n(e,c.y,a.y-c.y,f)));b.lv=d} t.vd=function(){!0===this.rb&&(this.oi=this.rb=!1,this.ae.clear(),this.aj=0,this.Ck&&this.C.cc());this.Nf&&this.Dc&&Jh(this)}; function Jh(a){a.Nf=!1;a.Ck=!1;Gh(a);for(var b=a.C,c=a.nw,d=a.mw,e=a.br,f=a.cs.iterator;f.next();)f.value.s();e=e.iterator;for(f=Kh;e.next();){var g=e.key,h=e.value,k=h.start,l=h.end,m=h.Wu,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Ru||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Ru?k[n]:l[n],c,d,d)}h.Ru&&void 0!==m.location&&g instanceof S&&(g.location=m.location);h.pt&&g instanceof S&&g.Lb(!1)}for(c=a.C.links;c.next();)d=c.value,null!==d.dh&& (d.points=d.dh,d.dh=null);b.gt.clear();mf(b,!1);b.Xa();b.R();b.fd();Lh(b);Ih(a);a.$q&&a.$q();zh(a);b.aa("AnimationFinished");b.cc()} t.Np=function(a,b){if(this.oi&&(this.ae.contains("Expand Tree")||this.ae.contains("Expand SubGraph"))){var c=b.actualBounds,d=null;b instanceof U&&(d=b.placeholder);null!==d?(c=d.ma(zc),d=d.padding,c.x+=d.left,c.y+=d.top,this.th(a,"position",c,a.position,!1)):this.th(a,"position",new G(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.th(a,"scale",.01,a.scale,!1);if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.Np(d,b)}}; t.Mp=function(a,b){if(a.isVisible()&&this.oi&&(this.ae.contains("Collapse Tree")||this.ae.contains("Collapse SubGraph"))){var c=null;b instanceof U&&(c=b.placeholder);null!==c?this.th(a,"position:placeholder",a.position,c,!0):this.th(a,"position:node",a.position,b,!0);this.th(a,"scale",a.scale,.01,!0);this.rb&&(c=this.zj,c.contains(a)&&(c.J(a).pt=!0));if(a instanceof U)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.Mp(c,b)}}; function Mh(a,b,c){a.rb&&!b.A(c)&&(null===a.sn&&b.o()&&null===a.rn&&(a.sn=b.copy()),a.rn=c.copy(),a.Ck=!0)}function Nh(a,b,c){a.rb&&a.C.Ri&&(0===a.un&&0===a.tn&&(a.un=b),a.tn=c,a.Ck=!0)} function xh(){var a=new vb;a.add("position",function(a,c,d,e,f,g){f!==g?a.wt(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g)):a.position=new G(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:placeholder",function(a,c,d,e,f,g){f!==g?a.wt(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g)):a.position=new G(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:node",function(a,c,d,e,f,g){var b=a.actualBounds,k=d.actualBounds;d=k.x+k.width/2-b.width/2;b=k.y+k.height/2-b.height/2;f!==g?a.wt(e(f,c.x,d-c.x,g),e(f, c.y,b-c.y,g)):a.position=new G(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("opacity",function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});a.add("visible",function(a,c,d,e,f,g){a.visible=f!==g?c:d});Kh=a} ma.Object.defineProperties(vh.prototype,{animationReasons:{get:function(){return this.ae}},isEnabled:{get:function(){return this.Dc},set:function(a){this.Dc=a}},duration:{get:function(){return this.Vt},set:function(a){1>a&&va(a,">= 1",vh,"duration");this.Vt=a}},isAnimating:{get:function(){return this.Nf}},isTicking:{get:function(){return this.Ir}},isInitial:{ get:function(){return this.Of},set:function(a){this.Of=a}}});vh.prototype.stopAnimation=vh.prototype.vd;vh.prototype.addToAnimation=vh.prototype.th;vh.prototype.prepareAnimation=vh.prototype.Gz;vh.prototype.prepareAutomaticAnimation=vh.prototype.Ui;var Kh=null,wh=!1;vh.className="AnimationManager";function Eh(a,b,c){this.start=a;this.end=b;this.Wu={};this.Ru=c;this.pt=!1}Eh.className="AnimationStates"; function Oh(){ab(this);this.C=null;this.Fa=new E;this.Ua="";this.lb=1;this.u=!1;this.Dj=this.K=this.Ph=this.Oh=this.Nh=this.Mh=this.Kh=this.Lh=this.Jh=this.Rh=this.Ih=this.Qh=this.Hh=this.Gh=!0;this.l=!1;this.Mo=[]}t=Oh.prototype;t.hb=function(a){this.C=a}; t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Fa.iterator;h.next();){var k=h.value;k instanceof U?e++:k instanceof V?d++:k instanceof R?f++:k instanceof Je?g++:c++}h="";0b.oe||k.height*f>b.oe?h.hc(a,b):Rh(a,h)}}a.globalAlpha=1}}}; function Rh(a,b){var c=b.actualBounds,d=b.naturalBounds;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)&&b.isVisible()){var e=b.transform;null!==b.areaBackground&&(Sh(b,a,b.areaBackground,!0,!0,d,c),a.fillRect(c.x,c.y,c.width,c.height));null===b.areaBackground&&null===b.background&&(Sh(b,a,"rgba(0,0,0,0.3)",!0,!1,d,c),a.fillRect(c.x,c.y,c.width,c.height));null!==b.background&&(a.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),Sh(b,a,b.background,!0,!1,d,c),a.fillRect(0,0,d.width/2,d.height/2), e.ct()||(b=1/(e.m11*e.m22-e.m12*e.m21),a.transform(e.m22*b,-e.m12*b,-e.m21*b,e.m11*b,b*(e.m21*e.dy-e.m22*e.dx),b*(e.m12*e.dx-e.m11*e.dy))))}}t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.ab(re,a,this,b,c,d,e)};t.Qi=function(a,b,c){var d=this.Fa;b.hi=this;if(a>=d.count)a=d.count;else if(d.N(a)===b)return-1;d.Ib(a,b);b.bq(c);d=this.diagram;null!==d&&(c?d.R():d.Qi(b));Th(this,a,b);return a}; t.xc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.xc(a,b,c);var d=this.Fa;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.N(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.cq(c);d.mb(a);d=this.diagram;null!==d&&(c?d.R():d.xc(b));b.hi=null;return a}; function Th(a,b,c){b=Uh(a,b,c);if(c instanceof U&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Fa.j,f=e.length,g=0;gd&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.N(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;hd)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.mb(b);a.Ib(f,c);return f}for(g=NaN;0<=--f&&(g=a.N(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k=d){h--;if(h===b)break;a.mb(b);a.Ib(h,c);return h}for(k=NaN;++h< e&&(k=a.N(h).zOrder,isNaN(k)););}return b}t.clear=function(){for(var a=this.Fa.Na(),b=a.length,c=0;ca||1=a)return b;for(var c=this.Pa.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};P.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)};P.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,d)}; function vi(a){var b=a.Da.Ga;b instanceof HTMLCanvasElement&&(a.Mq?(a.addEventListener(b,"pointerdown",a.jm,!1),a.addEventListener(b,"pointermove",a.km,!1),a.addEventListener(b,"pointerup",a.mm,!1),a.addEventListener(b,"pointerout",a.lm,!1)):(a.addEventListener(b,"touchstart",a.Vv,!1),a.addEventListener(b,"touchmove",a.Uv,!1),a.addEventListener(b,"touchend",a.Tv,!1),a.addEventListener(b,"mousemove",a.kk,!1),a.addEventListener(b,"mousedown",a.jk,!1),a.addEventListener(b,"mouseup",a.mk,!1),a.addEventListener(b, "mouseout",a.lk,!1)),a.addEventListener(b,"mouseenter",a.Cy,!1),a.addEventListener(b,"mouseleave",a.Dy,!1),a.addEventListener(b,"wheel",a.nk,!1),a.addEventListener(b,"keydown",a.sz,!1),a.addEventListener(b,"keyup",a.uz,!1),a.addEventListener(b,"blur",a.oy,!1),a.addEventListener(b,"focus",a.py,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"gesturestart",function(b){a.toolManager.gestureBehavior!== Me&&(a.toolManager.gestureBehavior===Le?b.preventDefault():a.Se&&a.lastInput.handled||(b.preventDefault(),a.Ko=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Me)if(a.toolManager.gestureBehavior===Le)b.preventDefault();else if(!a.Se||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Ko){var e=a.Da.getBoundingClientRect();b=new G(b.pageX-window.scrollX-a.xa/e.width*e.left,b.pageY-window.scrollY-a.wa/e.height* e.top);c=a.Ko*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(x,"resize",a.aw,!1))}function bf(a){30p&&(this.position=q.h(-(this.rs.scrollWidth-this.xa)+u-this.xa/c+k,this.position.y))),a.Wx&&this.allowVerticalScroll&&(fr&&(this.position=q.h(this.position.x, -(this.rs.scrollHeight-this.wa)+a.scrollTop-this.wa/c+d))),G.free(q),Ai(this),this.mj=this.ps=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,r=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.ip.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.ip.style.height="1px"))}};P.prototype.computeBounds=function(){0c&&(b=c),ba.maxScale&&(b=a.maxScale),b):b===Ii?(b=k>h?(g-a.Gb)/d:(f-a.Gb)/e,b>c&&(b=c),ba.maxScale&&(b=a.maxScale),b):a.scale} P.prototype.zoomToFit=function(){var a=this.Ij;this.Ij=Xh;this.scale=Ei(this,Hi);a!==Xh&&(Di(this,!1),Fi(this,this.documentBounds,this.xa/this.Ca,this.wa/this.Ca,this.ej,!1));this.Ij=a};t=P.prototype; t.$z=function(a,b){void 0===b&&(b=Hi);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Hi||b===Ii)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.xa;var f=this.wa;e=b===Ii?f/d>e/c?(f-(this.Rg?this.Gb:0))/d:(e-(this.ai?this.Gb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new G(a.x,a.y)}}; t.jy=function(a,b){this.Sg&&Gi(this,this.computeBounds());var c=this.documentBounds,d=this.viewportBounds;this.position=new G(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))}; function Fi(a,b,c,d,e,f){a.sa.ha();var g=a.sa,h=g.x,k=g.y;if(f||a.scrollMode===Xh)e.gb()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.ui,f=c-b.width,cb.left?h=b.left:hb.top?k=b.top:kb.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.wl[0])b=a.wl[c];else return;c=a.Da;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.xa/c.width*c.left,b.clientY-a.wa/c.height*c.top))}t=P.prototype;t.Xa=function(){this.Sg||(this.Sg=!0,this.cc(!0))};function Lh(a){a.Yb||Bi(a);a.Sg&&Gi(a,a.computeBounds())}t.uf=function(){this.ob||this.Yb||(this.R(),Ti(this),Ai(this),this.Xa(),this.fd())};t.rz=function(){return this.qd}; t.xy=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.vd();b.isEnabled=!1;Lf(this);this.he=!1;b.isEnabled=c;null!==a&&sa(a,1)};t.cc=function(a){void 0===a&&(a=!1);if(!0!==this.qd&&!(this.ob||!1===a&&this.Yb)){this.qd=!0;var b=this;x.requestAnimationFrame(function(){b.qd&&b.fd()})}};t.fd=function(){if(!this.Yk||this.qd)this.Yk&&(this.Yk=!1),Lf(this)};function Ui(a,b){a.animationManager.isAnimating||a.ob||!a.mj||yi(a)||(b&&Bi(a),Di(a,!1))} function Lf(a,b){if(!a.Yb&&(a.qd=!1,null!==a.Ia||a.Hp.o())){a.Yb=!0;var c=a.animationManager,d=a.nu;if(!c.isTicking&&0!==d.length){for(var e=d.j,f=e.length,g=0;gb;b++){var c=a.Dd.iterator;if(null===c||0===a.Dd.count)break;a.Dd=new F;a.$v(c,a.Dd)}a.nodes.each(function(a){a instanceof U&&0!==(a.S&65536)!==!1&&(a.S=a.S^65536)})}} t.$v=function(a,b){for(a.reset();a.next();){var c=a.value;!c.bc()||c instanceof U||(c.Si()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof U&&c.isVisible()&&Zi(this,c);for(a.reset();a.next();)c=a.value,c instanceof R&&c.isVisible()&&(c.Si()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Je&&c.isVisible()&&(c.Si()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}; function Zi(a,b){for(var c=Da(),d=Da(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof U?($i(f)||aj(f)||bj(f))&&Zi(a,f):f instanceof R?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;eh.oe||m.height*g>h.oe?l.hc(a,h):Rh(a,l)}}a.globalAlpha= 1}}}:function(b){b.hc(a,h)};dj(this,a);g=f.length;for(m=0;ma.oe||l.height*f>a.oe?h.hc(b,a):Rh(b,h)}}b.globalAlpha=1}}}}else if(!k&&l){var C=a.grid.part,I=C.layer;A=function(c){c===I?C.hc(b,a):c.hc(b,a,k)}}else A=function(c){c.hc(b,a,k)};for(c=0;cthis.oe||u.height*m>this.oe?v.hc(f,this):Rh(f,v))}f.globalAlpha=1}f.restore();f.Rc(!0);this.bi&&ej(this.bi,this)&&this.ir();this.nc=this.di=!1;this.ot()}Ga(e);Ga(a);this.Yb=!1}}else this.fd();N.free(d);c&&(bf(this),this.fd(),mf(this,!0))}else c?(bf(this),this.fd(),mf(this,!0)):this.fd()}};function Ti(a){!1===a.mj&&(a.mj=!0)}function Ai(a){!1===a.di&&(a.di=!0)}function cj(a){!1!==a.Pn&&(a.Pn=!1,lj(a,a.xa,a.wa))} function lj(a,b,c){var d=a.Mb;a.Da.resize(b*d,c*d,b,c)&&(a.nc=!0,a.Yc.Rc(!0))} function yi(a){var b=a.Da;if(null===b)return!0;var c=a.Ia,d=a.xa,e=a.wa,f=a.Mw.copy();if(!f.o())return!0;var g=!1,h=a.ai?a.Gb:0,k=a.Rg?a.Gb:0,l=c.clientWidth||d+h;c=c.clientHeight||e+k;if(l!==d+h||c!==e+k)a.ai=!1,a.Rg=!1,k=h=0,a.xa=l,a.wa=c,g=a.Pn=!0;a.mj=!1;var m=a.viewportBounds,n=a.documentBounds,p=0,r=0,q=0,u=0;l=m.width;c=m.height;var v=a.ui;a.contentAlignment.gb()?(n.width>l&&(p=v.left,r=v.right),n.height>c&&(q=v.top,u=v.bottom)):(p=v.left,r=v.right,q=v.top,u=v.bottom);v=n.width+p+r;var w=n.height+ q+u;p=n.x-p;var z=m.x;r=n.right+r;var y=m.right+h;q=n.y-q;var A=m.y;n=n.bottom+u;u=m.bottom+k;var C="1px",I="1px";m=a.scale;var K=!(vy+1&&(C=Math.max((r-y)*m+a.xa,C)),l+h+1u+1&&(I=Math.max((n-u)*m+a.wa,I)),c+k+ 1y+1&&(h=Math.max((r-y)*m+a.xa,h)),l+1u+1&&(k=Math.max((n-u)*m+h,k)),c+ 1y+1&&(k=a.position.x*m));if(a.Tn)switch(a.su){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(c+1u+1&&(b.scrollTop=a.position.y*m));l=a.xa;c=a.wa;b.style.width= l+(a.ai?a.Gb:0)+"px";b.style.height=c+(a.Rg?a.Gb:0)+"px";return d!==l||e!==c||a.animationManager.rb?(a.mq(f,a.viewportBounds,m,g),!1):!0} t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&B("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.$l(a.layerName),null===b&&(b=this.$l("")),null===b&&B('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.Qi(99999999,a,a.diagram===this);0<=c&&this.ab(te,"parts",b,null,a,null,c);b.isTemporary||this.Xa();a.B(1);c=a.layerChanged;null!==c&&c(a,null,b)}}; t.Qi=function(a){this.partManager.Qi(a);var b=this;mj(a,function(a){nj(b,a)});(a instanceof Je||a instanceof U&&null!==a.placeholder)&&a.s();null!==a.data&&mj(a,function(a){oj(b.partManager,a)});!0!==aj(a)&&!0!==bj(a)||this.Dd.add(a);pj(a,!0,this);qj(a)?(a.actualBounds.o()&&this.R(kj(a,a.actualBounds)),this.Xa()):a.isVisible()&&a.actualBounds.o()&&this.R(kj(a,a.actualBounds));this.cc()}; t.xc=function(a){a.Uj();this.partManager.xc(a);var b=this;null!==a.data&&mj(a,function(a){rj(b.partManager,a,b)});this.Dd.remove(a);qj(a)?(a.actualBounds.o()&&this.R(kj(a,a.actualBounds)),this.Xa()):a.isVisible()&&a.actualBounds.o()&&this.R(kj(a,a.actualBounds));this.cc()};t.remove=function(a){sj(this,a,!0)}; function sj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.B(2),c&&b.$j(),c=d.xc(-1,b,!1),0<=c&&a.ab(ue,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.rt=function(a,b){if(za(a))for(var c=a.length,d=0;dd&&this.Xa()}; t.by=function(a,b){yj(this,a,b);a.hb(this);var c=this.Pa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Zb&&this.ab(ue,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;fd&&this.Xa()}; t.Kz=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Pa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Fa.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.Zb&&this.ab(ue,"layers",this,a,null,c,null);this.R();this.Xa()}}};t.$l=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null}; t.Sw=function(a){null===this.pe&&(this.pe=new E);this.pe.add(a);this.model.sh(a)};t.Mz=function(a){null!==this.pe&&(this.pe.remove(a),0===this.pe.count&&(this.pe=null));this.model.rk(a)};t.sh=function(a){null===this.Cf&&(this.Cf=new E);this.Cf.add(a)};t.rk=function(a){null!==this.Cf&&(this.Cf.remove(a),0===this.Cf.count&&(this.Cf=null))}; t.Ls=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.hv(a);a.change!==se&&(this.isModified=!0);if(null!==this.Cf)for(var b=this.Cf,c=b.length,d=0;dp.Fa.indexOf(q)&&p.Qi(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Jb(),p.xc(u?r:-1,q,u)))}else p instanceof P?"number"===typeof r&&q instanceof Oh&&(b?(q.hb(this),this.Pa.Ib(r,q)):this.Pa.mb(r)):B("unknown ChangedEvent.Remove object: "+ a.toString());this.isModified=!0}else d!==se&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};t.Aa=function(a){return this.undoManager.Aa(a)};t.Za=function(a){return this.undoManager.Za(a)};t.wf=function(){return this.undoManager.wf()}; P.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Aa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Za(b):this.undoManager.wf(),this.skipsUndoManager=c}};P.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};t=P.prototype;t.xq=function(){this.partManager.xq()}; function Bj(a,b,c){var d=a.animationManager;if(a.ob||a.Yb)a.Ca=c,Nh(d,b,a.Ca);else if(a.ob=!0,null===a.Da)a.Ca=c;else{var e=a.viewportBounds.copy(),f=a.xa,g=a.wa;e.width=a.xa/b;e.height=a.wa/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.sf()?l.rf(Mc)?h=0:l.rf(Nc)&&(h=f-1):h=l.gb()?l.x*(f-1):f/2);isNaN(k)&&(l.sf()?l.rf(Kc)?k=0:l.rf(Oc)&&(k=g-1):k=l.gb()?l.y*(g-1):g/2);null!==a.scaleComputation&&(c=a.scaleComputation(a,c));ca.maxScale&&(c=a.maxScale); f=G.allocAt(a.sa.x+h/b-h/c,a.sa.y+k/b-k/c);a.position=f;G.free(f);a.Ca=c;a.mq(e,a.viewportBounds,b,!1);a.ob=!1;Di(a,!1);Nh(d,b,a.Ca);a.R();Ti(a)}} t.mq=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||Ti(this);Ai(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Yh||d||a.width===b.width&&a.height===b.height||e.B();e=this.currentTool;!0===this.Re&&e instanceof Na&&(this.lastInput.documentPoint=this.yt(this.lastInput.viewPoint),Ne(e,this));this.ob||this.mx(a,b);Wi(this);this.ye.scale=c;this.ye.position.x=a.x;this.ye.position.y=a.y;this.ye.bounds.assign(a);this.ye.ox=d;this.aa("ViewportBoundsChanged",this.ye,a);this.isVirtualized&& this.links.each(function(a){a.isAvoiding&&a.actualBounds.Ic(b)&&a.Ra()})}}; function Wi(a,b){void 0===b&&(b=null);var c=a.Eb;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.Y.j,h=g.length,k=0;km||(Cj(l.figure)?f=f*m/H.jx(f,m):e=e*m/H.jx(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.o()){N.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;N.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=G.alloc();H.Xp(a,g,0,0, d.width,d.height,b);b.offset(-d.width,-d.height);M.free(d);c.part.location=b;G.free(b)}}t.Rp=function(){var a=0=d&&!f.isAnimating&&!f.rb&&(b||f.Ui("Layout"));a.Dg=!1;for(var g=a.Ai.iterator;g.next();)Vj(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Bi(a),e.isValidLayout=!0):a.Dg=!0)}finally{0===d&&a.Za("Layout"),a.Dg=!e.isValidLayout,a.ea=c}}} function Vj(a,b,c,d){if(null!==b){for(var e=b.sl.iterator;e.next();)Vj(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.pk=!b.location.o(),e.doLayout(b),b.B(32),Zi(a,b),e.isValidLayout=!0):a.Dg=!0)}}t.Xy=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Ki()&&a.add(c)}return a.iterator}; function Zh(a){function b(a){var b=a.toLowerCase(),e=new E;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new vb,d=new vb;b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");b("LostFocus");b("Modified"); b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.St=c;a.Rt=d} function hj(a,b){var c=a.Rt.J(b);return null!==c?c:a.Rt.J(b.toLowerCase())}function Wj(a,b){var c=a.St.J(b);if(null!==c)return c;c=a.St.J(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b);return null}t.Pj=function(a,b){a=Wj(this,a);null!==a&&a.add(b)};t.nm=function(a,b){a=Wj(this,a);null!==a&&a.remove(b)}; t.aa=function(a,b,c){var d=Wj(this,a),e=new pe;e.diagram=this;a=hj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.N(0)(e);else if(0!==b)for(d=d.Na(),c=0;c=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=N.allocAt(0,0,e.width*f,e.height*f);var g=G.allocAt(0,0);if(b.x>=e.x&&b.xe.x+e.width-d.right&&(h=Math.max(a.scrollHorizontalLineChange,1),h|=0,g.x+=h,b.x>e.x+e.width-d.right/2&&(g.x+=h),b.x>e.x+e.width-d.right/4&& (g.x+=4*h));b.y>=e.y&&b.ye.y+e.height-d.bottom&&(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y+=a,b.y>e.y+e.height-d.bottom/2&&(g.y+=a),b.y>e.y+e.height-d.bottom/4&&(g.y+=4*a));g.Qa(Fb)||(c=new G(c.x+g.x/f,c.y+g.y/f));N.free(e);G.free(g);return c}t.it=function(){return null};t.ov=function(){return null};t.iy=function(a,b){this.qu.add(a,b)}; function gk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].ol){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Ej.iterator;g.next();)if(!g.value[0].ol){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;x.requestAnimationFrame(function(){d()});return null}t.yz=function(a){if(!Wg)return null;void 0===a&&(a=new db);a.returnType="Image";return this.px(a)}; t.px=function(a){void 0===a&&(a=new db);return gk(this,this.zz,a)}; t.zz=function(a,b,c){var d=hk(c,a,"canvas",null);if(null===d)return null;c=d.W.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&B('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"=== typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e}; function hk(a,b,c,d){a.animationManager.vd();a.fd();if(null===a.Da)return null;"object"!==typeof b&&B("properties argument must be an Object.");var e=b.size||null,f=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(f="NaN");var g=b.maxSize;void 0===b.maxSize&&(g="SVG"===c?new M(Infinity,Infinity):new M(2E3,2E3));var h=b.position||null,k=b.parts||null,l=void 0===b.padding?1:b.padding,m=b.background||null,n=b.omitTemporary;void 0===n&&(n=!0);var p=b.document||document,r=b.elementFinished||null,q=b.showTemporary; void 0===q&&(q=!n);b=b.showGrid;void 0===b&&(b=q);null!==e&&isNaN(e.width)&&isNaN(e.height)&&(e=null);"number"===typeof l?l=new pc(l):l instanceof pc||B("MakeImage padding must be a Margin or a number.");l.left=Math.max(l.left,0);l.right=Math.max(l.right,0);l.top=Math.max(l.top,0);l.bottom=Math.max(l.bottom,0);a.Yc.Rc(!0);n=new ik(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.xa+Math.ceil(l.left+l.right);n.height=a.wa+Math.ceil(l.top+l.bottom);if("SVG"===c){if(null===d)return null;d.resize(n.width, n.height,n.width,n.height);d.ownerDocument=p;d.Up=r;fj(a,d.context,l,new M(n.width,n.height),a.Ca,a.sa,k,m,q,b);return d.context}a.xn=!1;fj(a,u,l,new M(n.width,n.height),a.Ca,a.sa,k,m,q,b);a.xn=!0;return n.context}var v=a.er,w=a.documentBounds.copy();w.Qv(a.eb);if(q)for(var z=a.Pa.j,y=z.length,A=0;Av?(f=v,e=w.width,w=w.height):(e=g.width,w=g.height)):(e=w.width*f,w=w.height*f):(f=v,e=w.width,w=w.height);null!==l?(e+=h,w+=T):l=new pc(0);null!==g&&(v=g.width,g=g.height,isNaN(v)&&(v=2E3),isNaN(g)&&(g=2E3),isFinite(v)&& (e=Math.min(e,v)),isFinite(g)&&(w=Math.min(w,g)));n.width=Math.ceil(e);n.height=Math.ceil(w);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.Up=r;fj(a,d.context,l,new M(Math.ceil(e),Math.ceil(w)),f,z,k,m,q,b);return d.context}a.xn=!1;fj(a,u,l,new M(Math.ceil(e),Math.ceil(w)),f,z,k,m,q,b);a.xn=!0;return n.context} ma.Object.defineProperties(P.prototype,{div:{get:function(){return this.Ia},set:function(a){if(this.Ia!==a){Qa=[];var b=this.Ia;null!==b?(b.C=void 0,b.innerHTML="",null!==this.Da&&(b=this.Da.Ga,this.removeEventListener(b,"touchstart",this.Vv,!1),this.removeEventListener(b,"touchmove",this.Uv,!1),this.removeEventListener(b,"touchend",this.Tv,!1),this.Da.ax()),b=this.toolManager,null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}), b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.Yc=this.Da=null,this.removeEventListener(x,"resize",this.aw,!1),this.removeEventListener(x,"mousemove",this.kk,!0),this.removeEventListener(x,"mousedown",this.jk,!0),this.removeEventListener(x,"mouseup",this.mk,!0),this.removeEventListener(x,"wheel",this.nk,!0),this.removeEventListener(x,"mouseout",this.lk,!0),Fe===this&&(Fe=null)):this.he=!1;this.Ia=null;if(null!==a){if(b=a.C)b.div=null;ii(this, a);this.uf()}}}},Uw:{get:function(){return this.wo}},lv:{get:function(){return this.ob},set:function(a){this.ob=a}},Ri:{get:function(){return this.he}},draggedLink:{get:function(){return this.hr},set:function(a){this.hr!==a&&(this.hr=a,null!==a&&(this.ds=a.fromPort,this.es=a.toPort))}},tx:{get:function(){return this.ds},set:function(a){this.ds=a}},ux:{ get:function(){return this.es},set:function(a){this.es=a}},animationManager:{get:function(){return this.Bk}},undoManager:{get:function(){return this.Zb.undoManager}},skipsUndoManager:{get:function(){return this.fh},set:function(a){this.fh=a;this.Zb.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Qt},set:function(a){this.Qt=a}},validCycle:{ get:function(){return this.Gs},set:function(a){var b=this.Gs;b!==a&&(this.Gs=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Pa.iterator}},isModelReadOnly:{get:function(){var a=this.Zb;return null===a?!1:a.isReadOnly},set:function(a){var b=this.Zb;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("isReadOnly", b,a))}},isEnabled:{get:function(){return this.Dc},set:function(a){var b=this.Dc;b!==a&&(this.Dc=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.Eq},set:function(a){var b=this.Eq;b!==a&&(this.Eq=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.Gh},set:function(a){var b=this.Gh;b!==a&&(this.Gh=a,this.g("allowCopy",b,a))}},allowDelete:{ get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(this.Hh=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.Fq},set:function(a){var b=this.Fq;b!==a&&(this.Fq=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.Gq},set:function(a){var b=this.Gq;b!==a&&(this.Gq=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.Qh},set:function(a){var b= this.Qh;b!==a&&(this.Qh=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Ih},set:function(a){var b=this.Ih;b!==a&&(this.Ih=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Rh},set:function(a){var b=this.Rh;b!==a&&(this.Rh=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.Iq},set:function(a){var b=this.Iq;b!==a&&(this.Iq=a,this.g("allowInsert", b,a))}},allowLink:{get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(this.Jh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Lh},set:function(a){var b=this.Lh;b!==a&&(this.Lh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Kh},set:function(a){var b=this.Kh;b!==a&&(this.Kh=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Mh}, set:function(a){var b=this.Mh;b!==a&&(this.Mh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Nh},set:function(a){var b=this.Nh;b!==a&&(this.Nh=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(this.Oh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Ph},set:function(a){var b=this.Ph;b!==a&&(this.Ph=a, this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.Jq},set:function(a){var b=this.Jq;b!==a&&(this.Jq=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.Lq},set:function(a){var b=this.Lq;b!==a&&(this.Lq=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.xr},set:function(a){var b=this.xr;b!==a&&(this.xr=a,Ti(this),this.R(),this.g("hasVerticalScrollbar", b,a),Di(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.wr},set:function(a){var b=this.wr;b!==a&&(this.wr=a,Ti(this),this.R(),this.g("hasHorizontalScrollbar",b,a),Di(this,!1))}},allowHorizontalScroll:{get:function(){return this.Hq},set:function(a){var b=this.Hq;b!==a&&(this.Hq=a,this.g("allowHorizontalScroll",b,a),Di(this,!1))}},allowVerticalScroll:{get:function(){return this.Kq},set:function(a){var b= this.Kq;b!==a&&(this.Kq=a,this.g("allowVerticalScroll",b,a),Di(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.qs},set:function(a){var b=this.qs;b!==a&&(0>a&&va(a,">= 0",P,"scrollHorizontalLineChange"),this.qs=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.ss},set:function(a){var b=this.ss;b!==a&&(0>a&&va(a,">= 0",P,"scrollVerticalLineChange"),this.ss=a,this.g("scrollVerticalLineChange", b,a))}},lastInput:{get:function(){return this.sj},set:function(a){this.sj=a}},firstInput:{get:function(){return this.Zh},set:function(a){this.Zh=a}},currentCursor:{get:function(){return this.Yq},set:function(a){""===a&&(a=this.qn);if(this.Yq!==a){var b=this.Da,c=this.Ia;if(null!==b){this.Yq=a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor= "-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{get:function(){return this.qn},set:function(a){""===a&&(a="auto");var b=this.qn;b!==a&&(this.qn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Df},set:function(a){var b=this.Df;b!==a&&(this.Df=a,this.g("click",b,a))}},doubleClick:{ get:function(){return this.If},set:function(a){var b=this.If;b!==a&&(this.If=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Ef},set:function(a){var b=this.Ef;b!==a&&(this.Ef=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.Zf},set:function(a){var b=this.Zf;b!==a&&(this.Zf=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.Xf},set:function(a){var b= this.Xf;b!==a&&(this.Xf=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(this.Wf=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.Xr},set:function(a){var b=this.Xr;b!==a&&(this.Xr=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Uf},set:function(a){var b=this.Uf;b!==a&&(this.Uf=a,this.g("mouseDrop",b,a))}}, handlesDragDropForTopLevelParts:{get:function(){return this.vr},set:function(a){var b=this.vr;b!==a&&(this.vr=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.Vf},set:function(a){var b=this.Vf;b!==a&&(this.Vf=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==a&&(this.Yf=a,this.g("mouseLeave",b,a))}},toolTip:{ get:function(){return this.kg},set:function(a){var b=this.kg;b!==a&&(this.kg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Ff},set:function(a){var b=this.Ff;b!==a&&(this.Ff=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a,a.hb(this))}},toolManager:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub= a,a.hb(this))}},defaultTool:{get:function(){return this.La},set:function(a){var b=this.La;b!==a&&(this.La=a,a.hb(this),this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.ba},set:function(a){var b=this.ba;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.ba=a,a.hb(this),a.doStart())}},selection:{get:function(){return this.Cq}}, maxSelectionCount:{get:function(){return this.Tr},set:function(a){var b=this.Tr;if(b!==a)if(0<=a&&!isNaN(a)){if(this.Tr=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0= 0",P,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{ get:function(){return this.$r},set:function(a){var b=this.$r;b!==a&&(this.$r=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.tr},set:function(a){var b=this.tr;b!==a&&(this.tr=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.Pr},set:function(a){var b=this.Pr;b!==a&&(this.Pr=a,this.g("linkSelectionAdornmentTemplate",b, a))}},highlighteds:{get:function(){return this.Aq}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.u&&this.ge!==a.historyIndex:this.u},set:function(a){if(this.u!==a){this.u=a;var b=this.undoManager;!a&&b.isEnabled&&(this.ge=b.historyIndex);a||Dj(this)}}},model:{get:function(){return this.Zb},set:function(a){var b=this.Zb;if(b!==a){this.currentTool.doCancel(); null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&B("Do not replace a Diagram.model while a transaction is in progress.");li(this,!0);this.he=!1;this.Yk=!0;this.ge=-2;this.qd=!1;var c=this.Yb;this.Yb=!0;this.animationManager.Ui("Model");null!==b&&(null!==this.pe&&this.pe.each(function(a){b.rk(a)}),b.rk(this.Dm));this.Zb=a;this.partManager=Ej(this.Zb.constructor.type);a.sh(this.Ag);this.partManager.addAllModeledParts();a.rk(this.Ag);a.sh(this.Dm);null!==this.pe&&this.pe.each(function(b){a.sh(b)}); this.Yb=c;this.ob||this.R();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},ea:{get:function(){return this.Vc},set:function(a){this.Vc=a}},gt:{get:function(){return this.Bq}},skipsModelSourceBindings:{get:function(){return this.Eh},set:function(a){this.Eh=a}},tk:{get:function(){return this.xu},set:function(a){this.xu=a}},nodeTemplate:{get:function(){return this.$f.J("")}, set:function(a){var b=this.$f.J("");b!==a&&(this.$f.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.ud())}},nodeTemplateMap:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.ud())}},groupTemplate:{get:function(){return this.$h.J("")},set:function(a){var b=this.$h.J("");b!==a&&(this.$h.add("",a),this.g("groupTemplate", b,a),this.undoManager.isUndoingRedoing||this.ud())}},groupTemplateMap:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.ud())}},linkTemplate:{get:function(){return this.Vg.J("")},set:function(a){var b=this.Vg.J("");b!==a&&(this.Vg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.ud())}},linkTemplateMap:{ get:function(){return this.Vg},set:function(a){var b=this.Vg;b!==a&&(this.Vg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.ud())}},isMouseOverDiagram:{get:function(){return this.Re},set:function(a){this.Re=a}},isMouseCaptured:{get:function(){return this.Kc},set:function(a){var b=this.Da;null!==b&&(b=b.Ga,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.Mq?(this.removeEventListener(b,"pointermove", this.km,!1),this.removeEventListener(b,"pointerdown",this.jm,!1),this.removeEventListener(b,"pointerup",this.mm,!1),this.removeEventListener(b,"pointerout",this.lm,!1),this.addEventListener(x,"pointermove",this.km,!0),this.addEventListener(x,"pointerdown",this.jm,!0),this.addEventListener(x,"pointerup",this.mm,!0),this.addEventListener(x,"pointerout",this.lm,!0)):(this.removeEventListener(b,"mousemove",this.kk,!1),this.removeEventListener(b,"mousedown",this.jk,!1),this.removeEventListener(b,"mouseup", this.mk,!1),this.removeEventListener(b,"mouseout",this.lk,!1),this.addEventListener(x,"mousemove",this.kk,!0),this.addEventListener(x,"mousedown",this.jk,!0),this.addEventListener(x,"mouseup",this.mk,!0),this.addEventListener(x,"mouseout",this.lk,!0)),this.removeEventListener(b,"wheel",this.nk,!1),this.addEventListener(x,"wheel",this.nk,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.Mq?(this.removeEventListener(x,"pointermove",this.km,!0),this.removeEventListener(x,"pointerdown", this.jm,!0),this.removeEventListener(x,"pointerup",this.mm,!0),this.removeEventListener(x,"pointerout",this.lm,!0),this.addEventListener(b,"pointermove",this.km,!1),this.addEventListener(b,"pointerdown",this.jm,!1),this.addEventListener(b,"pointerup",this.mm,!1),this.addEventListener(b,"pointerout",this.lm,!1)):(this.removeEventListener(x,"mousemove",this.kk,!0),this.removeEventListener(x,"mousedown",this.jk,!0),this.removeEventListener(x,"mouseup",this.mk,!0),this.removeEventListener(x,"mouseout", this.lk,!0),this.addEventListener(b,"mousemove",this.kk,!1),this.addEventListener(b,"mousedown",this.jk,!1),this.addEventListener(b,"mouseup",this.mk,!1),this.addEventListener(b,"mouseout",this.lk,!1)),this.removeEventListener(x,"wheel",this.nk,!0),this.removeEventListener(x,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.nk,!1)),this.Kc=a))}},position:{get:function(){return this.sa},set:function(a){var b=G.alloc().assign(this.sa);if(!b.A(a)){var c= this.viewportBounds.copy();this.sa.assign(a);this.ob||null===this.Da&&!this.Hp.o()||(this.ob=!0,a=this.scale,Fi(this,this.vn,this.xa/a,this.wa/a,this.ej,!1),this.ob=!1);Mh(this.animationManager,b,this.sa);this.ob||this.mq(c,this.viewportBounds,this.Ca,!1)}G.free(b)}},initialPosition:{get:function(){return this.zr},set:function(a){this.zr.A(a)||(this.zr=a.I())}},initialScale:{get:function(){return this.Ar},set:function(a){this.Ar!==a&&(this.Ar= a)}},grid:{get:function(){null===this.Eb&&wi(this);return this.Eb},set:function(a){var b=this.Eb;if(b!==a){null===b&&(wi(this),b=this.Eb);a.type!==X.Grid&&B("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Eb=a;a.name="GRID";null!==c&&c.add(a);Wi(this);this.R();this.g("grid",b,a)}}},viewportBounds:{get:function(){var a=this.Mw,b=this.sa,c=this.Ca;if(null===this.Da)return this.Hp.o()&&a.h(b.x,b.y, this.xa/c,this.wa/c),a;a.h(b.x,b.y,Math.max(this.xa,0)/c,Math.max(this.wa,0)/c);return a}},viewSize:{get:function(){return this.Hp},set:function(a){var b=this.viewSize;b.A(a)||(this.Hp=a=a.I(),this.xa=a.width,this.wa=a.height,this.Xa(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.qr},set:function(a){var b=this.qr;b.A(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"), this.qr=a=a.I(),this.Xa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.ui},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.ui;b.A(a)||(this.ui=a=a.I(),this.g("scrollMargin",b,a),this.uf())}},scrollMode:{get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&(this.Ij=a,a===Xh&&Di(this,!1),this.g("scrollMode",b,a),this.uf())}},scrollsPageOnFocus:{get:function(){return this.ts}, set:function(a){var b=this.ts;b!==a&&(this.ts=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.ks},set:function(a){var b=this.ks;b!==a&&(this.ks=a,Di(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.os},set:function(a){var b=this.os;b!==a&&(this.os=a,Bj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{ get:function(){return this.vn}},isVirtualized:{get:function(){return this.Kr},set:function(a){var b=this.Kr;b!==a&&(this.Kr=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.Ca},set:function(a){var b=this.Ca;b!==a&&Bj(this,b,a)}},defaultScale:{get:function(){return this.er},set:function(a){this.er=a}},autoScale:{get:function(){return this.cj},set:function(a){var b= this.cj;b!==a&&(this.cj=a,this.g("autoScale",b,a),a!==Yh&&Di(this,!1))}},initialAutoScale:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.Br},set:function(a){var b=this.Br;b!==a&&(a.gb()||B("initialViewportSpot must be a specific Spot: "+a),this.Br=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{ get:function(){return this.yr},set:function(a){var b=this.yr;b!==a&&(a.gb()||B("initialViewportSpot must be a specific Spot: "+a),this.yr=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.Ur},set:function(a){var b=this.Ur;b!==a&&(0this.scale&&(this.scale=a)):va(a,"> 0",P,"minScale"))}},maxScale:{get:function(){return this.Sr},set:function(a){var b=this.Sr;b!==a&&(0 0",P,"maxScale"))}},zoomPoint:{get:function(){return this.Js},set:function(a){this.Js.A(a)||(this.Js=a=a.I())}},contentAlignment:{get:function(){return this.ej},set:function(a){var b=this.ej;b.A(a)||(this.ej=a=a.I(),this.g("contentAlignment",b,a),Di(this,!1))}},initialContentAlignment:{get:function(){return this.On},set:function(a){var b=this.On; b.A(a)||(this.On=a=a.I(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.eb},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.eb;b.A(a)||(this.eb=a=a.I(),this.Xa(),this.g("padding",b,a))}},partManager:{get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.hb(null),this.Ma=a,a.hb(this))}},nodes:{ get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.gc},set:function(a){var b=this.gc;b!==a&&(this.gc=a,a.diagram=this,a.group=null,this.Dg=!0,this.g("layout",b,a),this.cc())}},isTreePathToChildren:{get:function(){return this.Jr}, set:function(a){var b=this.Jr;if(b!==a&&(this.Jr=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)jk(a.value)}},treeCollapsePolicy:{get:function(){return this.Es},set:function(a){var b=this.Es;b!==a&&(a!==$h&&a!==kk&&a!==lk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.Es=a,this.g("treeCollapsePolicy",b,a))}},Fe:{get:function(){return this.Vb},set:function(a){this.Vb=a}},autoScrollInterval:{ get:function(){return this.Tm},set:function(a){var b=this.Tm;b!==a&&(this.Tm=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.Um},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.Um;b.A(a)||(this.Um=a=a.I(),this.Xa(),this.g("autoScrollRegion",b,a))}}}); ma.Object.defineProperties(P,{licenseKey:{get:function(){return mk.Sb()},set:function(a){mk.add(a)}},version:{get:function(){return nk}}});P.prototype.makeImageData=P.prototype.px;P.prototype.makeImage=P.prototype.yz;P.prototype.addRenderer=P.prototype.iy;P.prototype.makeSVG=P.prototype.ov;P.prototype.makeSvg=P.prototype.it;P.prototype.stopAutoScroll=P.prototype.xf;P.prototype.doAutoScroll=P.prototype.Os;P.prototype.isUnoccupied=P.prototype.gk; P.prototype.raiseDiagramEvent=P.prototype.aa;P.prototype.removeDiagramListener=P.prototype.nm;P.prototype.addDiagramListener=P.prototype.Pj;P.prototype.findTreeRoots=P.prototype.Xy;P.prototype.layoutDiagram=P.prototype.wz;P.prototype.findTopLevelGroups=P.prototype.Qy;P.prototype.findTopLevelNodesAndLinks=P.prototype.Ry;P.prototype.findLinksByExample=P.prototype.Rs;P.prototype.findNodesByExample=P.prototype.Ss;P.prototype.findLinkForData=P.prototype.uc;P.prototype.findNodeForData=P.prototype.Hi; P.prototype.findPartForData=P.prototype.vc;P.prototype.findNodeForKey=P.prototype.Hb;P.prototype.findPartForKey=P.prototype.findPartForKey;P.prototype.rebuildParts=P.prototype.ud;P.prototype.transformViewToDoc=P.prototype.yt;P.prototype.transformRectDocToView=P.prototype.Xz;P.prototype.transformDocToView=P.prototype.xt;P.prototype.centerRect=P.prototype.Ku;P.prototype.scrollToRect=P.prototype.Hv;P.prototype.scroll=P.prototype.scroll;P.prototype.highlightCollection=P.prototype.lz; P.prototype.highlight=P.prototype.kz;P.prototype.clearHighlighteds=P.prototype.Mu;P.prototype.selectCollection=P.prototype.Iv;P.prototype.select=P.prototype.select;P.prototype.clearSelection=P.prototype.Rp;P.prototype.updateAllRelationshipsFromData=P.prototype.xq;P.prototype.updateAllTargetBindings=P.prototype.updateAllTargetBindings;P.prototype.commit=P.prototype.commit;P.prototype.rollbackTransaction=P.prototype.wf;P.prototype.commitTransaction=P.prototype.Za;P.prototype.startTransaction=P.prototype.Aa; P.prototype.raiseChanged=P.prototype.g;P.prototype.raiseChangedEvent=P.prototype.ab;P.prototype.removeChangedListener=P.prototype.rk;P.prototype.addChangedListener=P.prototype.sh;P.prototype.removeModelChangedListener=P.prototype.Mz;P.prototype.addModelChangedListener=P.prototype.Sw;P.prototype.findLayer=P.prototype.$l;P.prototype.removeLayer=P.prototype.Kz;P.prototype.addLayerAfter=P.prototype.by;P.prototype.addLayerBefore=P.prototype.Qw;P.prototype.addLayer=P.prototype.Rl; P.prototype.moveParts=P.prototype.moveParts;P.prototype.copyParts=P.prototype.Zj;P.prototype.removeParts=P.prototype.rt;P.prototype.remove=P.prototype.remove;P.prototype.add=P.prototype.add;P.prototype.clearDelayedGeometries=P.prototype.Lu;P.prototype.setProperties=P.prototype.Ov;P.prototype.resetInputOptions=P.prototype.Ev;P.prototype.setInputOption=P.prototype.Qz;P.prototype.getInputOption=P.prototype.cm;P.prototype.resetRenderingHints=P.prototype.Fv;P.prototype.setRenderingHint=P.prototype.Gx; P.prototype.getRenderingHint=P.prototype.Ee;P.prototype.maybeUpdate=P.prototype.fd;P.prototype.requestUpdate=P.prototype.cc;P.prototype.delayInitialization=P.prototype.xy;P.prototype.isUpdateRequested=P.prototype.rz;P.prototype.redraw=P.prototype.uf;P.prototype.invalidateDocumentBounds=P.prototype.Xa;P.prototype.findObjectsNear=P.prototype.rg;P.prototype.findPartsNear=P.prototype.Ny;P.prototype.findObjectsIn=P.prototype.qg;P.prototype.findPartsIn=P.prototype.ix;P.prototype.findObjectsAt=P.prototype.Ii; P.prototype.findPartsAt=P.prototype.My;P.prototype.findObjectAt=P.prototype.Rb;P.prototype.findPartAt=P.prototype.am;P.prototype.alignDocument=P.prototype.jy;P.prototype.zoomToRect=P.prototype.$z;P.prototype.zoomToFit=P.prototype.zoomToFit;P.prototype.diagramScroll=P.prototype.$w;P.prototype.focus=P.prototype.focus;P.prototype.reset=P.prototype.reset;P.useDOM=function(a){Wg=a?void 0!==x.document:!1};P.isUsingDOM=function(){return Wg}; var Fe=null,ai=new vb,ui=null,ti=null,Wg=void 0!==x.document,ji=null,ki="",Yh=new D(P,"None",0),Hi=new D(P,"Uniform",1),Ii=new D(P,"UniformToFill",2),Pf=new D(P,"CycleAll",10),Tf=new D(P,"CycleNotDirected",11),Vf=new D(P,"CycleNotDirectedFast",12),Wf=new D(P,"CycleNotUndirected",13),Qf=new D(P,"CycleDestinationTree",14),Sf=new D(P,"CycleSourceTree",15),Xh=new D(P,"DocumentScroll",1),ij=new D(P,"InfiniteScroll",2),$h=new D(P,"TreeParentCollapsed",21),kk=new D(P,"AllParentsCollapsed",22),lk=new D(P, "AnyParentsCollapsed",23),mk=new E,nk="2.0.17",ok=null,Vh=!1; function Wh(){if(Wg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Ra("7ca11abfd022028846");b[c]=Ra("398c3597c01238");for(var d=["5da73c80a36455d4038e4972187c3cae51fd22",qa.Dx+"4ae6247590da4bb21c324ba3a84e385776",wc.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",H.za],e=1;5>e;e++)b[Ra("7ca11abfd7330390")](Ra(d[e-1]),10,15*e);b[c]=Ra("39f046ebb36e4b");for(c=1;5>c;c++)b[Ra("7ca11abfd7330390")](Ra(d[c-1]),10,15*c);ok=a}}P.className="Diagram"; P.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.C instanceof P?b.C:null};P.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};P.None=Yh;P.Uniform=Hi;P.UniformToFill=Ii;P.CycleAll=Pf;P.CycleNotDirected=Tf;P.CycleNotDirectedFast=Vf;P.CycleNotUndirected=Wf; P.CycleDestinationTree=Qf;P.CycleSourceTree=Sf;P.DocumentScroll=Xh;P.InfiniteScroll=ij;P.TreeParentCollapsed=$h;P.AllParentsCollapsed=kk;P.AnyParentsCollapsed=lk;function hi(){this.Xx=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Oe=this.l=!0:this.Oe=null} function ej(a,b){b.Yc.setTransform(b.Mb,0,0,b.Mb,0,0);if(null===a.Oe){b="f";var c=x[Ra("76a715b2f73f148a")][Ra("72ba13b5")];a.Oe=!0;if(Wg){var d=P[Ra("76a115b6ed251eaf4692")];if(d)for(var e=mk.iterator;e.next();){d=e.value;d=Ra(d).split(Ra("39e9"));if(6>d.length)break;var f=Ra(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ra(qa[Ra("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ra("76ad18b4f73e")];for(g=c[Ra("73a612b6fb191d")](Ra("35e7"))+2;gf&&Ra(d[2])!==Ra("7da71ca0ad381e90")&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));0>f&&(f=c[Ra("73a612b6fb191d")](Ra("7baa19a6f76c1988428554")));a.Oe=!(0<=f&&fh.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0, 1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Ra("79a417a0f0181a8946")]=d;if(x.document[Ra("78a712aa")]){x.document[Ra("78a712aa")][Ra("7bb806b6ed32388c4a875b")](g);h=x.getComputedStyle(g).getPropertyValue(Ra("78a704b7e62456904c9b12701b6532a8"));x.document[Ra("78a712aa")][Ra("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.Oe=!1;break}else if(Sa||Ta||Ua||Va)for(d="."+d,f=0;fMath.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&(d=0Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0e||Math.abs(d.y-b.screenY)>e)?a.Fd++:a.Fd=1;c.clickCount=a.Fd;a.ll=b.timeStamp;a.Mr.xg(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():Si(c,b)}};a.km=function(b){if(a.isEnabled){a.Re=!0;var c=a.wl;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId===b.pointerId&& (c=Ri(a,b,b,null!==c[1]),a.doMouseMove(),Si(c,b))}};a.mm=function(b){if(a.isEnabled){a.Re=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.ou;if(c&&a.Nl)delete d[b.pointerId],b.preventDefault();else if(d=a.wl,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=Qi(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.C instanceof P&&e.C!==a&&Ni(e.C,b,d);Ni(a,b,d);d.clickCount=a.Fd;null===e?d.targetDiagram=Oi(b):e.C?d.targetDiagram=e.C:d.targetDiagram=null; d.targetObject=null;a.doMouseUp();Si(d,b);c&&(a.Se=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.lm=function(b){if(a.isEnabled){a.Re=!1;var c=a.ou;c[b.pointerId]&&delete c[b.pointerId];c=a.wl;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.Rc(!0);vi(a)}}hi.className="DiagramHelper"; function ff(a){this.l=void 0===a?new G:a;this.u=new G}ma.Object.defineProperties(ff.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.u},set:function(a){this.u=a}}});ff.className="DraggingInfo";function wj(a,b,c){this.node=a;this.info=b;this.gv=c}wj.className="DraggingNodeInfoPair";function Ye(){this.reset()} Ye.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=zc;this.gridSnapOrigin=(new G(NaN,NaN)).freeze();this.iz=this.dragsTree=this.dragsLink=!1;this.hz=!0}; function pk(a){1this.oe||r.height*l>this.oe?p.hc(b,this):Rh(b,p))}b.globalAlpha=1}}e.drawImage(c.Ga,0,0);c=this.Pa.j;e=c.length;for(d=0;db.maxScale||(b.scale=a))};vk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==Yh)return!1;a=b.scale*a;return ab.maxScale?!1:b.allowZoom}; vk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===Yh&&(a=b.scale*a,ab.maxScale||(b.scale=a))};vk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==Yh)return!1;a=b.scale*a;return ab.maxScale?!1:b.allowZoom};vk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;ab.maxScale||(b.scale=a)}; vk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return ab.maxScale?!1:b.allowZoom};vk.prototype.zoomToFit=function(){var a=this.diagram,b=a.scale,c=a.position;b===this.Fu&&!isNaN(this.fu)&&a.documentBounds.A(this.Eu)?(a.scale=this.fu,a.position=this.zw,this.Fu=NaN,this.Eu=nc):(this.fu=b,this.zw=c.copy(),a.zoomToFit(),this.Fu=a.scale,this.Eu=a.documentBounds.copy())};vk.prototype.canZoomToFit=function(){return this.diagram.allowZoom}; vk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;if(null===a){try{null!==this.gg&&(this.gg.next()?a=this.gg.value:this.gg=null)}catch(k){this.gg=null}null===a&&(0a&&(a+=360));return a}; t.De=function(){if(0!==(this.H&4096)===!1)return this.Uk;var a=this.Ca;return null!==this.panel?a*this.panel.De():a};t.Ws=function(a,b){void 0===b&&(b=new G);b.assign(a);this.rd.Ud(b);return b};t.Tc=function(a,b,c){return this.dk(a.x,a.y,b.x,b.y,c)}; t.dk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);if(null!==this.areaBackground)return f=this.actualBounds,H.Tc(f.left,f.top,f.right,f.bottom,a,b,c,d,e);g=a*h+b*l+n;a=a*k+b*m+p;b=c*h+d*l+n;c=c*k+d*m+p;e.h(0,0);d=this.naturalBounds;c=H.Tc(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c}; Y.prototype.measure=function(a,b,c,d){if(!1!==$i(this)){var e=this.Wg,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof W&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(Pk(this,!0)){case Bg:g=e=0;h&&(b=a=Infinity); break;case wd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Ak:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Bk:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.widthh.height&&k.heighta.height||this.metrics.maxLineWidth>a.width)))c=!0;this.H=c?this.H|256:this.H&-257;this.vb.o()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.vb.toString());this.lt(f,this.vb);Qk(this,!1);N.free(f)};t=Y.prototype;t.vh=function(){}; function Rk(a,b,c,d,e){a.vb.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.pc;c=a.Wg;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=Pk(a,!0);c===d&&f===e&&(b=Bg);switch(b){case Bg:if(c>d||f>e)Vi(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case wd:Vi(a,!0);a.measure(d,e,0,0);break;case Ak:Vi(a,!0);a.measure(d,f,0,0);break;case Bk:Vi(a,!0),a.measure(c,e,0,0)}}} t.lt=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||Sk(c,!0),this.R(),ac(a,b)||(c.Ah(),this.Go(c)))};t.Go=function(a){null!==this.portId&&(Sk(a,!0),a instanceof V&&Tk(a,this))}; t.hc=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.vb;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.bx(a,b))if(c)Uk(this,a,b);else{this instanceof R&&this.ik(!1);c=this.transform;var g=this.panel;0!==(this.H&4096)===!0&&Vk(this);var h=this.part,k=!1,l=0;if(h&&b.Ee("drawShadows")&&(k=h.isShadowed)){var m=h.vi;l=Math.max(m.y,m.x)* b.scale*b.Mb}if(!(m=b.oj)){var n=this.naturalBounds;m=this.Fh;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,v=m.m22,w=m.dy,z,y=z=0;m=z*p+y*r+q;var A=z*u+y*v+w;z=n.width+l;y=0;var C=z*p+y*r+q;z=z*u+y*v+w;y=Math.min(m,C);var I=Math.min(A,z);var K=Math.max(m+0,C)-y;var J=Math.max(A+0,z)-I;m=y;A=I;z=n.width+l;y=n.height+l;C=z*p+y*r+q;z=z*u+y*v+w;y=Math.min(m,C);I=Math.min(A,z);K=Math.max(m+K,C)-y;J=Math.max(A+J,z)-I;m=y;A=I;z=0;y=n.height+l;C=z*p+y*r+q;z=z*u+y*v+w;y=Math.min(m,C);I=Math.min(A,z);K=Math.max(m+K, C)-y;J=Math.max(A+J,z)-I;m=y;A=I;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.$+n||n>K+m||A>l.Z+p||p>J+A)}if(m){m=0!==(this.H&256);a.clipInsteadOfFill&&(m=!1);this instanceof Yg&&(a.font=this.font);if(m){A=g.Zd()?g.naturalBounds:g.actualBounds;null!==this.kd?(n=this.kd,K=n.x,J=n.y,l=n.width,n=n.height):(K=Math.max(d.x,A.x),J=Math.max(d.y,A.y),l=Math.min(d.right,A.right)-K,n=Math.min(d.bottom,A.bottom)-J);if(K>d.width+d.x||d.x>A.width+A.x){1!==e&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(K, J,l,n);a.clip()}if(this.wg()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(A=h.vi,a.Pv(A.x*b.scale*b.Mb,A.y*b.scale*b.Mb,h.Od),Wk(a),a.shadowColor=h.Kj)}!0===this.shadowVisible?Wk(a):!1===this.shadowVisible&&Xk(a);h=this.naturalBounds;null!==this.dc&&(Sh(this,a,this.dc,!0,!0,h,d),this.dc instanceof Yk&&this.dc.type===Zk?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Td(this.dc)):a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.H& 512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.zb()!==this)&&null===this.shadowVisible&&Xk(a);null!==this.ib&&(l=this.naturalBounds,K=A=0,J=l.width,l=l.height,n=0,this instanceof W&&(l=this.qa.bounds,A=l.x,K=l.y,J=l.width,l=l.height,n=this.strokeWidth),Sh(this,a,this.ib,!0,!1,h,d),this.ib instanceof Yk&&this.ib.type===Zk?(a.beginPath(),a.rect(A-n/2,K-n/2,J+n,l+n),a.Td(this.ib)):a.fillRect(A-n/2,K-n/2,J+n,l+n));k&&(null!==this.ib||null!==this.dc||null!==g&&0!==(g.H&512)||null!==g&&(g.type=== X.Auto||g.type===X.Spot)&&g.zb()!==this)?($k(this,!0),null===this.shadowVisible&&Xk(a)):$k(this,!1);this.Fi(a,b);k&&0!==(this.H&512)===!0&&Wk(a);this.wg()&&k&&Xk(a);m?(a.restore(),this instanceof X?a.Rc(!0):a.Rc(!1)):c.ct()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha=f)}}}};t.bx=function(){return!1}; function Uk(a,b,c){var d=a.vb,e=a.qc;null!==a.dc&&(Sh(a,b,a.dc,!0,!0,e,d),a.dc instanceof Yk&&a.dc.type===Zk?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Td(a.dc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.ib&&(Sh(a,b,a.ib,!0,!1,e,d),a.ib instanceof Yk&&a.ib.type===Zk?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Td(a.ib)):b.fillRect(d.x,d.y,d.width,d.height));a.Fi(b,c)}t.Fi=function(){}; function Sh(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===al)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{h=f.width;k=f.height;e&&(h=g.width,k=g.height);if((f=b instanceof bl)&&c.de&&(c.type===cl||c.Ik===h&&c.Lt===k))var l=c.de;else{var m=0,n=0,p=0,r=0,q=0,u=0;u=q=0;e&&(q=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;r=c.end.y*k+c.end.offsetY;m+=q;p+=q;n+=u;r+=u;if(c.type===dl)l= b.createLinearGradient(m,n,p,r);else if(c.type===Zk)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(q=0,u=Math.max(h,k)/2):q=c.startRadius,l=b.createRadialGradient(m,n,q,p,r,u);else if(c.type===cl)try{l=b.createPattern(c.pattern,"repeat")}catch(w){l=null}if(c.type!==cl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.de=l,null!==l&&(c.Ik=h,c.Lt=k),null===l&&c.type===cl&&-1!==c.Ik)){c.Ik=-1;var v=a.diagram;null!==v&&-1===c.Ik&&sa(function(){v.uf()}, 600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.ug=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.tf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.tf():!0};t.vg=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a}; function Vk(a){if(0!==(a.H&2048)===!0){var b=a.tb;b.reset();if(!a.vb.o()||!a.pc.o()){el(a,!1);return}b.translate(a.vb.x-a.pc.x,a.vb.y-a.pc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;Nk(a,b,c.x,c.y,c.width,c.height)}el(a,!1);fl(a,!0)}0!==(a.H&4096)===!0&&(b=a.panel,null===b?(a.Fh.set(a.tb),a.Uk=a.scale,fl(a,!1)):null!==b.rd&&(c=a.Fh,c.reset(),b.Zd()?c.multiply(b.Fh):null!==b.panel&&c.multiply(b.panel.Fh),c.multiply(a.tb),a.Uk=a.scale*b.Uk,fl(a,!1)))} function Nk(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.angle){var g=Fc;a.wg()&&a.locationSpot.gb()&&(g=a.locationSpot);var h=G.alloc();if(a instanceof S&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.sk(d.x,d.y,d.width,d.height,g),c.Rf.ta(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.Rf.ta(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.sk(c,d,e,f,g);b.rotate(a.angle,h.x,h.y);G.free(h)}} t.s=function(a){void 0===a&&(a=!1);if(!0!==$i(this)){Vi(this,!0);Qk(this,!0);var b=this.panel;null===b||a||b.s()}};t.em=function(){!0!==$i(this)&&(Vi(this,!0),Qk(this,!0))};function gl(a){if(!1===aj(a)){var b=a.panel;null!==b?b.s():a.wg()&&(b=a.diagram,null!==b&&(b.Dd.add(a),a instanceof V&&a.ed(),b.cc()));Qk(a,!0)}}t.gl=function(){0!==(this.H&2048)===!1&&(el(this,!0),fl(this,!0))};t.kv=function(){fl(this,!0)};t.R=function(){var a=this.part;null!==a&&a.R()}; function Pk(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return hl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.zb()===a)return il(a,wd,b);if(c===zk){if(null!==d){if(d.type===X.Spot&&d.zb()===a)return il(a,wd,b);c=d.defaultStretch;return c===zk?il(a,Bg,b):il(a,c,b)}return il(a,Bg,b)}return il(a,c,b)} function hl(a,b,c,d){var e=a.stretch;if(e!==zk)return il(a,e,d);var f=e=null;switch(b.stretch){case Bk:f=!0;break;case wd:f=!0}switch(c.stretch){case Ak:e=!0;break;case wd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Ak||b===wd);null===f&&(f=b===Bk||b===wd);return!0===e&&!0===f?il(a,wd,d):!0===e?il(a,Ak,d):!0===f?il(a,Bk,d):il(a,Bg,d)} function il(a,b,c){if(c)return b;if(b===Bg)return Bg;c=a.desiredSize;if(c.o())return Bg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Ak)return Bg;if(b===wd)return Bk}else{if(b===Bk)return Bg;if(b===wd)return Ak}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Bk)return Bg;if(b===wd)return Ak}else{if(b===Ak)return Bg;if(b===wd)return Bk}return b}function $k(a,b){a.H=b?a.H|512:a.H&-513}function Jk(a){return 0!==(a.H&1024)}function jl(a,b){a.H=b?a.H|1024:a.H&-1025} function el(a,b){a.H=b?a.H|2048:a.H&-2049}function fl(a,b){a.H=b?a.H|4096:a.H&-4097}function $i(a){return 0!==(a.H&8192)}function Vi(a,b){a.H=b?a.H|8192:a.H&-8193}function aj(a){return 0!==(a.H&16384)}function Qk(a,b){a.H=b?a.H|16384:a.H&-16385}t.Vi=function(a){this.dg=a};t.Nv=function(){};t.Mv=function(a){this.sa=a;gl(this);return!0};t.wt=function(a,b){this.sa.h(a,b);this.gl()}; function kl(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||Tk(b,a)}}function ll(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof V?a.ed():a.zm(a,function(a){kl(a)}):kl(a))}t.bind=function(a){a.Qd=this;var b=this.Ji();null!==b&&ml(b)&&B("Cannot add a Binding to a template that has already been copied: "+a);null===this.bb&&(this.bb=new E);this.bb.add(a)}; t.Ji=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.Sh)return a;a=a.panel}return null};t.Ov=function(a){gj(this,a)}; function nl(a,b){for(var c=1;ce)&&B("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&B("Must specify non-negative integer column for RowColumnDefinition "+ b+", not: "+e),a.isRow=!1,a.index=e);e=new db;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);gj(a,e)}else gj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function sl(a,b){ol.add(a,b)}function tl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b} ma.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.Dl},set:function(a){var b=this.Dl;b!==a&&(this.Dl=a,this.R(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.O?this.O.Bn:null},set:function(a){Gk(this);var b=this.O.Bn;b!==a&&(this.O.Bn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Bl},set:function(a){var b=this.Bl; b!==a&&(this.Bl=a,this.s(),this.g("segmentOrientation",b,a),a===qg&&(this.angle=0))}},segmentIndex:{get:function(){return this.jp},set:function(a){a=Math.round(a);var b=this.jp;b!==a&&(this.jp=a,this.s(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.zl},set:function(a){isNaN(a)?a=0:0>a?a=0:1a||1=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Ca=a,this.s(),this.g("scale",b,a))}},angle:{get:function(){return this.zc},set:function(a){var b=this.zc;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.zc=a,ll(this),this.s(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Nc},set:function(a){var b=a.width,c=a.height,d=this.Nc,e=d.width,f=d.height;(e===b||isNaN(e)&& isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Nc=a=a.I(),this.s(),this instanceof W&&this.ac(),this.g("desiredSize",d,a),Jk(this)&&(a=this.part,null!==a&&(Kk(this,a,"width"),Kk(this,a,"height"))))}},width:{get:function(){return this.Nc.width},set:function(a){var b=this.Nc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Nc,this.Nc=a=(new M(a,this.Nc.height)).freeze(),this.s(),this instanceof W&&this.ac(),this.g("desiredSize",b,a),Jk(this)&&(a=this.part,null!==a&&Kk(this,a,"width")))}}, height:{get:function(){return this.Nc.height},set:function(a){var b=this.Nc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Nc,this.Nc=a=(new M(this.Nc.width,a)).freeze(),this.s(),this instanceof W&&this.ac(),this.g("desiredSize",b,a),Jk(this)&&(a=this.part,null!==a&&Kk(this,a,"height")))}},minSize:{get:function(){return this.Tf},set:function(a){var b=this.Tf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(), this.Tf=a,this.s(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.Sf},set:function(a){var b=this.Sf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Sf=a,this.s(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.pc}},naturalBounds:{get:function(){return this.qc}},margin:{get:function(){return this.Wg}, set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.Wg;b.A(a)||(this.Wg=a=a.I(),this.s(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.H&2048)===!0&&Vk(this);return this.tb}},rd:{get:function(){0!==(this.H&4096)===!0&&Vk(this);return this.Fh}},alignment:{get:function(){return this.wb},set:function(a){var b=this.wb;b.A(a)||(a.jc()&&!a.Kb()&&B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+ a),this.wb=a=a.I(),gl(this),this.g("alignment",b,a))}},column:{get:function(){return this.Gg},set:function(a){a=Math.round(a);var b=this.Gg;b!==a&&(0>a&&va(a,">= 0",Y,"column"),this.Gg=a,this.s(),this.g("column",b,a))}},columnSpan:{get:function(){return this.Zm},set:function(a){a=Math.round(a);var b=this.Zm;b!==a&&(1>a&&va(a,">= 1",Y,"columnSpan"),this.Zm=a,this.s(),this.g("columnSpan",b,a))}},row:{get:function(){return this.ep}, set:function(a){a=Math.round(a);var b=this.ep;b!==a&&(0>a&&va(a,">= 0",Y,"row"),this.ep=a,this.s(),this.g("row",b,a))}},rowSpan:{get:function(){return this.fp},set:function(a){a=Math.round(a);var b=this.fp;b!==a&&(1>a&&va(a,">= 1",Y,"rowSpan"),this.fp=a,this.s(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.vp},set:function(a){var b=this.vp;b!==a&&(this.vp=a,this.s(),this.g("spanAllocation",b,a))}},alignmentFocus:{ get:function(){return this.zk},set:function(a){var b=this.zk;b.A(a)||(this.zk=a=a.I(),this.s(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.Ro},set:function(a){var b=this.Ro;if(b!==a){var c=this.part;null===c||c instanceof V||(B("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&vl(c,this);this.Ro=a;null!==a&&null!==c&&(c.zh=!0,wl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!== this.P?this.P.oh:yc},set:function(a){this.Hc();var b=this.P.oh;b.A(a)||(a=a.I(),this.P.oh=a,this.g("toSpot",b,a),kl(this))}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.mh:10},set:function(a){this.Hc();var b=this.P.mh;b!==a&&(0>a&&va(a,">= 0",Y,"toEndSegmentLength"),this.P.mh=a,this.g("toEndSegmentLength",b,a),kl(this))}},toShortLength:{get:function(){return null!==this.P?this.P.nh:0},set:function(a){this.Hc();var b=this.P.nh; b!==a&&(this.P.nh=a,this.g("toShortLength",b,a),kl(this))}},toLinkable:{get:function(){return null!==this.P?this.P.Cp:null},set:function(a){this.Hc();var b=this.P.Cp;b!==a&&(this.P.Cp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.P?this.P.Dp:Infinity},set:function(a){this.Hc();var b=this.P.Dp;b!==a&&(0>a&&va(a,">= 0",Y,"toMaxLinks"),this.P.Dp=a,this.g("toMaxLinks",b,a))}},fromSpot:{ get:function(){return null!==this.P?this.P.Pg:yc},set:function(a){this.Hc();var b=this.P.Pg;b.A(a)||(a=a.I(),this.P.Pg=a,this.g("fromSpot",b,a),kl(this))}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Ng:10},set:function(a){this.Hc();var b=this.P.Ng;b!==a&&(0>a&&va(a,">= 0",Y,"fromEndSegmentLength"),this.P.Ng=a,this.g("fromEndSegmentLength",b,a),kl(this))}},fromShortLength:{get:function(){return null!==this.P?this.P.Og: 0},set:function(a){this.Hc();var b=this.P.Og;b!==a&&(this.P.Og=a,this.g("fromShortLength",b,a),kl(this))}},fromLinkable:{get:function(){return null!==this.P?this.P.Dn:null},set:function(a){this.Hc();var b=this.P.Dn;b!==a&&(this.P.Dn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.P?this.P.En:Infinity},set:function(a){this.Hc();var b=this.P.En;b!==a&&(0>a&&va(a,">= 0",Y,"fromMaxLinks"),this.P.En=a,this.g("fromMaxLinks", b,a))}},cursor:{get:function(){return this.jn},set:function(a){var b=this.jn;b!==a&&(this.jn=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.O?this.O.Df:null},set:function(a){Gk(this);var b=this.O.Df;b!==a&&(this.O.Df=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==this.O?this.O.If:null},set:function(a){Gk(this);var b=this.O.If;b!==a&&(this.O.If=a,this.g("doubleClick",b, a))}},contextClick:{get:function(){return null!==this.O?this.O.Ef:null},set:function(a){Gk(this);var b=this.O.Ef;b!==a&&(this.O.Ef=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.O?this.O.Vf:null},set:function(a){Gk(this);var b=this.O.Vf;b!==a&&(this.O.Vf=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return null!==this.O?this.O.Yf:null},set:function(a){Gk(this);var b= this.O.Yf;b!==a&&(this.O.Yf=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.O?this.O.Zf:null},set:function(a){Gk(this);var b=this.O.Zf;b!==a&&(this.O.Zf=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.O?this.O.Xf:null},set:function(a){Gk(this);var b=this.O.Xf;b!==a&&(this.O.Xf=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return null!==this.O?this.O.Wf: null},set:function(a){Gk(this);var b=this.O.Wf;b!==a&&(this.O.Wf=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.O?this.O.to:null},set:function(a){Gk(this);var b=this.O.to;b!==a&&(this.O.to=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.O?this.O.uo:null},set:function(a){Gk(this);var b=this.O.uo;b!==a&&(this.O.uo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{ get:function(){return null!==this.O?this.O.Uf:null},set:function(a){Gk(this);var b=this.O.Uf;b!==a&&(this.O.Uf=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.O?this.O.Jm:null},set:function(a){Gk(this);var b=this.O.Jm;b!==a&&(this.O.Jm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==this.O?this.O.Km:null},set:function(a){Gk(this);var b=this.O.Km;b!==a&&(this.O.Km=a,this.g("actionMove", b,a))}},actionUp:{get:function(){return null!==this.O?this.O.Lm:null},set:function(a){Gk(this);var b=this.O.Lm;b!==a&&(this.O.Lm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.O?this.O.Im:null},set:function(a){Gk(this);var b=this.O.Im;b!==a&&(this.O.Im=a,this.g("actionCancel",b,a))}},toolTip:{get:function(){return null!==this.O?this.O.kg:null},set:function(a){Gk(this);var b=this.O.kg; b!==a&&(this.O.kg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.O?this.O.Ff:null},set:function(a){Gk(this);var b=this.O.Ff;b!==a&&(this.O.Ff=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.Ov;Y.prototype.findTemplateBinder=Y.prototype.Ji;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.vg;Y.prototype.isVisibleObject=Y.prototype.tf;Y.prototype.isContainedBy=Y.prototype.ug; Y.prototype.getNearestIntersectionPoint=Y.prototype.Tc;Y.prototype.getLocalPoint=Y.prototype.Ws;Y.prototype.getDocumentScale=Y.prototype.De;Y.prototype.getDocumentAngle=Y.prototype.Mi;Y.prototype.getDocumentBounds=Y.prototype.Zp;Y.prototype.getDocumentPoint=Y.prototype.ma;Y.prototype.intersectsRect=Y.prototype.Ic;Y.prototype.containedInRect=Y.prototype.wh;Y.prototype.containsRect=Y.prototype.nf;Y.prototype.containsPoint=Y.prototype.da;Y.prototype.raiseChanged=Y.prototype.g; Y.prototype.raiseChangedEvent=Y.prototype.ab;Y.prototype.addCopyProperty=Y.prototype.Pw;var ol=null;Y.className="GraphObject";ol=new vb; sl("Button",function(){function a(a,b){return null!==a.diagram.Rb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=nl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.$a("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD", _buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},nl(W,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new O(0,0,2.76142374915397,2.761423749153969),spot2:new O(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.vg()&&b instanceof X&&(a=b.$a("ButtonBorder"),a instanceof W)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}}; b.mouseLeave=function(a,b){b.vg()&&b instanceof X&&(a=b.$a("ButtonBorder"),a instanceof W&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.vg()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.$a("ButtonBorder");if(c instanceof W){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=d}}}; b.actionUp=function(b,d){if(d.vg()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.$a("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.vg()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.$a("ButtonBorder");if(c instanceof W){var f=b.diagram,g=f.skipsUndoManager; f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.vg()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.$a("ButtonBorder"),b instanceof W))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=d._buttonStrokePressed; b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b}); sl("TreeExpanderButton",function(){var a=nl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},nl(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new si("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).lq()),{visible:!1},(new si("visible","isTreeLeaf",function(a){return!a})).lq());a.click=function(a,c){c=c.part;c instanceof Je&&(c=c.adornedPart);if(c instanceof V){var b=c.diagram; if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a}); sl("SubGraphExpanderButton",function(){var a=nl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},nl(W,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ob},(new si("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).lq()));a.click=function(a,c){c=c.part;c instanceof Je&&(c=c.adornedPart);if(c instanceof U){var b=c.diagram;if(null!==b){b=b.commandHandler;if(c.isSubGraphExpanded){if(!b.canCollapseSubGraph(c))return}else if(!b.canExpandSubGraph(c))return; a.handled=!0;c.isSubGraphExpanded?b.collapseSubGraph(c):b.expandSubGraph(c)}}};return a});sl("ToolTip",function(){return nl(Je,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new G(0,3),shadowBlur:5},nl(W,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new O(0,0,4,6),spot2:new O(1,1,-4,-4)}))}); sl("ContextMenu",function(){return nl(Je,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new G(0,3),shadowBlur:5},new si("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});sl("ContextMenuButton",function(){var a=nl("Button");a.stretch=Ak;var b=a.$a("ButtonBorder");b instanceof W&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new O(0,0,2,3),b.spot2=new O(1,1,-2,-2));return a}); sl("PanelExpanderButton",function(a){var b=tl(a,"COLLAPSIBLE"),c=nl("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},nl(W,{name:"ButtonIcon",strokeWidth:2},(new si("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).lq(b))); a=c.$a("ButtonBorder");a instanceof W&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){a=c.diagram;if(null!==a&&!a.isReadOnly){var d=c.Ji();null===d&&(d=c.part);null!==d&&(c=d.$a(b),null!==c&&(a.Aa("Collapse/Expand Panel"),c.visible=!c.visible,a.Za("Collapse/Expand Panel")))}};return c}); sl("CheckBoxButton",function(a){var b=tl(a);a=nl("Button",{desiredSize:new M(14,14)},nl(W,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:wd,geometryStretch:Dg,visible:!1},""!==b?(new si("visible",b)).qx():[]));a.click=function(a,d){if(d instanceof X){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.$a("ButtonIcon");c.Aa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a, d);c.Za("checkbox")}}};return a}); sl("CheckBox",function(a){a=tl(a);a=nl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new pc(0,1,0,0)});var b=nl(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave, actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=Bg=new D(Y,"None",0);Y.Default=zk=new D(Y,"Default",0);Y.Vertical=Bk=new D(Y,"Vertical",4);Y.Horizontal=Ak=new D(Y,"Horizontal",5);Y.Fill=wd=new D(Y,"Fill",3);Y.Uniform=Dg=new D(Y,"Uniform",1); Y.UniformToFill=Ck=new D(Y,"UniformToFill",2);Y.FlipVertical=Dk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=Ek=new D(Y,"FlipHorizontal",2);Y.FlipBoth=Fk=new D(Y,"FlipBoth",3);Y.make=nl;Y.getBuilders=function(){var a=new vb,b;for(b in ol)if(b!==b.toLowerCase()){var c=ol.J(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=sl;Y.takeBuilderArgument=tl; function Hk(){this.Bn=this.Ff=this.kg=this.Im=this.Lm=this.Km=this.Jm=this.Uf=this.uo=this.to=this.Wf=this.Xf=this.Zf=this.Yf=this.Vf=this.Ef=this.If=this.Df=null}Hk.prototype.copy=function(){var a=new Hk;a.Df=this.Df;a.If=this.If;a.Ef=this.Ef;a.Vf=this.Vf;a.Yf=this.Yf;a.Zf=this.Zf;a.Xf=this.Xf;a.Wf=this.Wf;a.to=this.to;a.uo=this.uo;a.Uf=this.Uf;a.Jm=this.Jm;a.Km=this.Km;a.Lm=this.Lm;a.Im=this.Im;a.kg=this.kg;a.Ff=this.Ff;a.Bn=this.Bn;return a};Hk.className="GraphObjectEventHandlers"; function xl(){this.Oa=[1,0,0,1,0,0]}xl.prototype.copy=function(){var a=new xl;a.Oa[0]=this.Oa[0];a.Oa[1]=this.Oa[1];a.Oa[2]=this.Oa[2];a.Oa[3]=this.Oa[3];a.Oa[4]=this.Oa[4];a.Oa[5]=this.Oa[5];return a};xl.prototype.translate=function(a,b){this.Oa[4]+=this.Oa[0]*a+this.Oa[2]*b;this.Oa[5]+=this.Oa[1]*a+this.Oa[3]*b};xl.prototype.scale=function(a,b){this.Oa[0]*=a;this.Oa[1]*=a;this.Oa[2]*=b;this.Oa[3]*=b};xl.className="STransform"; function yl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Ww=[];this.pattern=null}yl.prototype.addColorStop=function(a,b){this.Ww.push({offset:a,color:b})};yl.className="SGradient"; function jj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.Dz="http://www.w3.org/2000/svg";void 0!==a&&(this.Ga=this.ub("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Up=null;this.context=new zl(this)} jj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.Ga.setAttributeNS(null,"width",c+"px"),this.Ga.setAttributeNS(null,"height",d+"px"),this.Ga.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.hu.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.hu.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1}; jj.prototype.ub=function(a,b,c){a=this.ownerDocument.createElementNS(this.Dz,a);if(ya(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};jj.prototype.getBoundingClientRect=function(){return this.Ga.getBoundingClientRect()};jj.prototype.focus=function(){this.Ga.focus()};jj.prototype.ax=function(){this.ownerDocument=null}; ma.Object.defineProperties(jj.prototype,{width:{get:function(){return this.Ga.width.baseVal.value},set:function(a){this.Ga.width=a}},height:{get:function(){return this.Ga.height.baseVal.value},set:function(a){this.Ga.height=a}},style:{get:function(){return this.Ga.style}}});jj.className="SVGSurface"; function zl(a){this.uk=a;this.svg=a.Ga;this.stack=[];this.wc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.Od=this.qp=this.pp=0;this.fq=null;this.path=[];this.cu=!1;this.hh=null;this.ih=0;this.Sd=new xl; Al(this,1,0,0,1,0,0);var b=qb++,c=this.ub("clipPath",{id:"mainClip"+b});c.appendChild(this.ub("rect",{x:0,y:0,width:a.width,height:a.height}));this.hu=c;this.uk.Ga.appendChild(c);this.wc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.Fz={}}t=zl.prototype; t.reset=function(){this.stack=[];this.wc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.Od=this.qp=this.pp=0;this.fq=null;this.path=[];this.Sd=new xl;Al(this,1,0,0,1,0,0);var a=qb++,b=this.ub("clipPath", {id:"mainClip"+a});b.appendChild(this.ub("rect",{x:0,y:0,width:this.uk.width,height:this.uk.height}));this.hu=b;this.uk.Ga.appendChild(b);this.wc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")}; t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){}; t.clip=function(){this.addPath("clipPath",this.path,this.Sd);this.addPath("clipPath",this.path,new xl)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new yl("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e}; t.createPattern=function(a){var b="";a instanceof HTMLCanvasElement&&(b=a.toDataURL());a instanceof HTMLImageElement&&(b=a.getAttribute("src"));var c=this.Fz;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+qb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.ub("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.ub("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"}; t.createRadialGradient=function(a,b,c,d,e,f){var g=new yl("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g}; t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;l={x:0,y:0,width:m||d,height:n||e,href:l,preserveAspectRatio:"xMidYMid slice"};H.ca(d,h)&&H.ca(e,k)||(l.preserveAspectRatio="none");a="";h/=d;k/=e;if(0!== f||0!==g)a+=" translate("+f+", "+g+")";if(1!==h||1!==k)a+=" scale("+h+", "+k+")";if(0!==b||0!==c)a+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+qb++,g=this.ub("clipPath",{id:f}),g.appendChild(this.ub("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),l["clip-path"]="url(#"+f+")";Bl(this,"image",l,this.Sd,a);this.addElement("image",l)};t.fill=function(){this.addPath("fill",this.path,this.Sd)};t.Td=function(){this.clipInsteadOfFill?this.clip():this.fill()}; t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};Bl(this,"fill",a,this.Sd);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};Bl(this,"fill",b,this.Sd);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};t.moveTo=function(a,b){this.path.push(["M",a,b])}; t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])}; t.restore=function(){this.Sd=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign}; t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;bb.offset?1:-1});for(e=0;ee.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;Al(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.wg()&&!this.isVisible())return!0;a.Sd.Oa=[1,0,0,1,0,0];(this instanceof Yg&&1b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.Ym?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.Ym?this.clip():this.fill()};t.Yi=function(){this.Ym||this.stroke()};t.Pv=function(a,b,c){this.pp=a;this.qp=b;this.Od=c}; t.Ps=function(a,b){var c=this.W;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Ns=function(){var a=this.W;void 0!==a.setLineDash&&(a.setLineDash(Dl),a.lineDashOffset=0)};t.Rc=function(a){a&&(this.Jt="");this.It=this.Kt=""}; ma.Object.defineProperties(bl.prototype,{fillStyle:{get:function(){return this.W.fillStyle},set:function(a){this.It!==a&&(this.It=this.W.fillStyle=a)}},font:{get:function(){return this.W.font},set:function(a){this.Jt!==a&&(this.Jt=this.W.font=a)}},globalAlpha:{get:function(){return this.W.globalAlpha},set:function(a){this.W.globalAlpha=a}},lineCap:{get:function(){return this.W.lineCap}, set:function(a){this.W.lineCap=a}},lineDashOffset:{get:function(){return this.W.lineDashOffset},set:function(a){this.W.lineDashOffset=a}},lineJoin:{get:function(){return this.W.lineJoin},set:function(a){this.W.lineJoin=a}},lineWidth:{get:function(){return this.W.lineWidth},set:function(a){this.W.lineWidth=a}},miterLimit:{get:function(){return this.W.miterLimit},set:function(a){this.W.miterLimit= a}},shadowBlur:{get:function(){return this.W.shadowBlur},set:function(a){this.W.shadowBlur=a}},shadowColor:{get:function(){return this.W.shadowColor},set:function(a){this.W.shadowColor=a}},shadowOffsetX:{get:function(){return this.W.shadowOffsetX},set:function(a){this.W.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.W.shadowOffsetY},set:function(a){this.W.shadowOffsetY= a}},strokeStyle:{get:function(){return this.W.strokeStyle},set:function(a){this.Kt!==a&&(this.Kt=this.W.strokeStyle=a)}},textAlign:{get:function(){return this.W.textAlign},set:function(a){this.W.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.W.imageSmoothingEnabled},set:function(a){this.W.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.Ym}, set:function(a){this.Ym=a}}});var Dl=Object.freeze([]);bl.className="CanvasSurfaceContext";function El(){this.ba=this.u=this.K=this.l=0}El.className="ColorNumbers";function Yk(a){Fl||(Gl(),Fl=!0);ab(this);this.v=!1;void 0===a?(this.va=al,this.Hk="black"):"string"===typeof a?(this.va=al,this.Hk=a):(this.va=a,this.Hk="black");a=this.va;a===dl?(this.Hl=Ac,this.Vk=Ic):this.Vk=a===Zk?this.Hl=Fc:this.Hl=yc;this.zs=0;this.lr=NaN;this.de=this.hs=this.ce=null;this.Lt=this.Ik=0} Yk.prototype.copy=function(){var a=new Yk;a.va=this.va;a.Hk=this.Hk;a.Hl=this.Hl.I();a.Vk=this.Vk.I();a.zs=this.zs;a.lr=this.lr;null!==this.ce&&(a.ce=this.ce.copy());a.hs=this.hs;return a};t=Yk.prototype;t.freeze=function(){this.v=!0;null!==this.ce&&this.ce.freeze();return this};t.ha=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;null!==this.ce&&this.ce.ha();return this};t.fb=function(a){a.classType===Yk&&(this.type=a)}; t.toString=function(){var a="Brush(";if(this.type===al)a+=this.color;else if(a=this.type===dl?a+"Linear ":this.type===Zk?a+"Radial ":this.type===cl?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"}; t.addColorStop=function(a,b){this.v&&ua(this);("number"!==typeof a||!isFinite(a)||1a)&&va(a,"0 <= loc <= 1",Yk,"addColorStop:loc");null===this.ce&&(this.ce=new vb);this.ce.add(a,b);this.va===al&&(this.type=dl);this.de=null;return this}; t.xz=function(a,b){this.v&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Hl:b;if(this.type===al)Il(this.color),this.color=Jl(a,b);else if((this.type===dl||this.type===Zk)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Il(c.value),this.addColorStop(c.key,Jl(a,b));return this};function Kl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Hl:c;Il(a);return Jl(b,c)} t.wy=function(a,b){this.v&&ua(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Hl:b;if(this.type===al)Il(this.color),this.color=Jl(-a,b);else if((this.type===dl||this.type===Zk)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Il(c.value),this.addColorStop(c.key,Jl(-a,b));return this};function Ll(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Hl:c;Il(a);return Jl(-b,c)} function Ml(a,b,c){Il(a);a=Nl.l;var d=Nl.K,e=Nl.u,f=Nl.ba;Il(b);void 0===c&&(c=.5);return"rgba("+Math.round((Nl.l-a)*c+a)+", "+Math.round((Nl.K-d)*c+d)+", "+Math.round((Nl.u-e)*c+e)+", "+Math.round((Nl.ba-f)*c+f)+")"} t.nx=function(){if(this.type===al)return Ol(this.color);if((this.type===dl||this.type===Zk)&&null!==this.colorStops){var a=this.colorStops;if(this.type===Zk)return Ol(a.first().value);if(null!==a.get(.5))return Ol(a.get(.5));if(2===a.count)return a=a.Na(),Ol(Ml(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h=e&&hd&&(c=[d,d=c][0]);b=d-c;return Ol(Ml(a.get(c),a.get(d),1-e/b))}return!1}; function Ol(a){if(null===a)return null;if(a instanceof Yk)return a.nx();Il(a);return 128>(299*Nl.l+587*Nl.K+114*Nl.u)/1E3} function Jl(a,b){switch(b){case Hl:var c=100*Pl(Nl.l);b=100*Pl(Nl.K);var d=100*Pl(Nl.u);Ql.l=.4124564*c+.3575761*b+.1804375*d;Ql.K=.2126729*c+.7151522*b+.072175*d;Ql.u=.0193339*c+.119192*b+.9503041*d;Ql.ba=Nl.ba;c=Rl(Ql.l/Sl[0]);b=Rl(Ql.K/Sl[1]);d=Rl(Ql.u/Sl[2]);Tl.l=116*b-16;Tl.K=500*(c-b);Tl.u=200*(b-d);Tl.ba=Ql.ba;Tl.l=Math.min(100,Math.max(0,Tl.l+100*a));a=(Tl.l+16)/116;c=a-Tl.u/200;Ql.l=Sl[0]*Ul(Tl.K/500+a);Ql.K=Sl[1]*(Tl.l>Vl*Wl?Math.pow(a,3):Tl.l/Vl);Ql.u=Sl[2]*Ul(c);Ql.ba=Tl.ba;a=-.969266* Ql.l+1.8760108*Ql.K+.041556*Ql.u;c=.0556434*Ql.l+-.2040259*Ql.K+1.0572252*Ql.u;Nl.l=255*Xl((3.2404542*Ql.l+-1.5371385*Ql.K+-.4985314*Ql.u)/100);Nl.K=255*Xl(a/100);Nl.u=255*Xl(c/100);Nl.ba=Ql.ba;Nl.l=Math.round(Nl.l);255Nl.l&&(Nl.l=0);Nl.K=Math.round(Nl.K);255Nl.K&&(Nl.K=0);Nl.u=Math.round(Nl.u);255Nl.u&&(Nl.u=0);return"rgba("+Nl.l+", "+Nl.K+", "+Nl.u+", "+Nl.ba+")";case Yl:b=Nl.l/255;d=Nl.K/255;var e=Nl.u/255,f=Math.max(b,d,e),g=Math.min(b,d,e),h= f-g;g=(f+g)/2;if(0===h)c=b=0;else{switch(f){case b:c=(d-e)/h%6;break;case d:c=(e-b)/h+2;break;case e:c=(b-d)/h+4}c*=60;0>c&&(c+=360);b=h/(1-Math.abs(2*g-1))}Zl.l=Math.round(c);Zl.K=Math.round(100*b);Zl.u=Math.round(100*g);Zl.ba=Nl.ba;Zl.u=Math.min(100,Math.max(0,Zl.u+100*a));return"hsla("+Zl.l+", "+Zl.K+"%, "+Zl.u+"%, "+Zl.ba+")";default:return B("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}} function Il(a){Fl||(Gl(),Fl=!0);var b=$l;if(null!==b){b.clearRect(0,0,1,1);b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;b.fillStyle!==c?(b.fillRect(0,0,1,1),a=b.getImageData(0,0,1,1).data,Nl.l=a[0],Nl.K=a[1],Nl.u=a[2],Nl.ba=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,Nl.l=0,Nl.K=0,Nl.u=0,Nl.ba=1)}}function Pl(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Xl(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055} function Rl(a){return a>Wl?Math.pow(a,1/3):(Vl*a+16)/116}function Ul(a){var b=a*a*a;return b>Wl?b:(116*a-16)/Vl}function ul(a,b){"string"!==typeof a&&(a instanceof Yk||B("Value for "+b+" must be a color string or a Brush, not "+a))}function Gl(){$l=Wg?(new ik(null)).context:null} ma.Object.defineProperties(Yk.prototype,{type:{get:function(){return this.va},set:function(a){this.v&&ua(this,a);this.va=a;this.start.jc()&&(a===dl?this.start=Ac:a===Zk&&(this.start=Fc));this.end.jc()&&(a===dl?this.end=Ic:a===Zk&&(this.end=Fc));this.de=null}},color:{get:function(){return this.Hk},set:function(a){this.v&&ua(this,a);this.Hk=a;this.de=null}},start:{get:function(){return this.Hl},set:function(a){this.v&& ua(this,a);this.Hl=a.I();this.de=null}},end:{get:function(){return this.Vk},set:function(a){this.v&&ua(this,a);this.Vk=a.I();this.de=null}},startRadius:{get:function(){return this.zs},set:function(a){this.v&&ua(this,a);0>a&&va(a,">= zero",Yk,"startRadius");this.zs=a;this.de=null}},endRadius:{get:function(){return this.lr},set:function(a){this.v&&ua(this,a);0>a&&va(a,">= zero",Yk,"endRadius");this.lr=a;this.de= null}},colorStops:{get:function(){return this.ce},set:function(a){this.v&&ua(this,a);this.ce=a;this.de=null}},pattern:{get:function(){return this.hs},set:function(a){this.v&&ua(this,a);this.hs=a;this.de=null}}});Yk.prototype.isDark=Yk.prototype.nx;Yk.prototype.darkenBy=Yk.prototype.wy;Yk.prototype.lightenBy=Yk.prototype.xz;Yk.prototype.addColorStop=Yk.prototype.addColorStop; var Wl=216/24389,Vl=24389/27,Sl=[95.047,100,108.883],$l=null,Nl=new El,Zl=new El,Ql=new El,Tl=new El,Fl=!1;Yk.className="Brush";var al;Yk.Solid=al=new D(Yk,"Solid",0);var dl;Yk.Linear=dl=new D(Yk,"Linear",1);var Zk;Yk.Radial=Zk=new D(Yk,"Radial",2);var cl;Yk.Pattern=cl=new D(Yk,"Pattern",4);var Hl;Yk.Lab=Hl=new D(Yk,"Lab",5);var Yl;Yk.HSL=Yl=new D(Yk,"HSL",6); Yk.randomColor=function(a,b){void 0===a&&(a=128);void 0===b&&(b=Math.max(a,255));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+a}; Yk.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;Fl||(Gl(),Fl=!0);var b=$l;if(null===b)return!0;b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;if(b.fillStyle!==c)return!0;b.fillStyle="#FFFFFF";c=b.fillStyle;b.fillStyle=a;return b.fillStyle!==c};Yk.lighten=function(a){return Kl(a)};Yk.lightenBy=Kl;Yk.darken=function(a){return Ll(a)};Yk.darkenBy=Ll;Yk.mix=Ml;Yk.isDark=Ol;function rl(){this.name="Base"}rl.prototype.measure=function(){}; rl.prototype.Az=function(a,b,c,d,e){a.measure(b,c,d,e)};rl.prototype.arrange=function(){};rl.prototype.ly=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};ma.Object.defineProperties(rl.prototype,{classType:{get:function(){return X}}});rl.prototype.arrangeElement=rl.prototype.ly;rl.prototype.measureElement=rl.prototype.Az;rl.className="PanelLayout";function am(){this.name="Base";this.name="Position"}la(am,rl); am.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=bm(a);for(var k=0;kQ&&(kb=Math.max(Q-gh,0));var Ym=0===L.actual;L.actual=L.actual+kb;Q=Math.max(Q-(kb+(Ym?gh:0)),0)}if(1===Bc.columnSpan&&(Cb===Bg||Cb===Bk)){L=a.getColumnDefinition(sc); var Yf=L.tc();kb=Math.max(Uc-L.actual,0);kb+Yf>T&&(kb=Math.max(T-Yf,0));var Gj=0===L.actual;L.actual=L.actual+kb;T=Math.max(T-(kb+(Gj?Yf:0)),0)}vf&&Bc.em()}}}}}Ga(A);var Ub=0,Lc=0;h=a.columnCount;for(var Zb=0;Zb=a.rowCount);ye++)L=a.getRowDefinition(La.row+ye),kb=0, kb=Cb===wd||Cb===Bk?Math.max(L.minimum,0===gd[La.row+ye]?L.maximum:Math.min(gd[La.row+ye],L.maximum)):Math.max(L.minimum,isNaN(L.Pc)?L.maximum:Math.min(L.Pc,L.maximum)),Cd.height+=kb;for(var yf=1;yf=a.columnCount);yf++)L=a.getColumnDefinition(La.column+yf),kb=0,kb=Cb===wd||Cb===Ak?Math.max(L.minimum,0===fe[La.column+yf]?L.maximum:Math.min(fe[La.column+yf],L.maximum)):Math.max(L.minimum,isNaN(L.Pc)?L.maximum:Math.min(L.Pc,L.maximum)),Cd.width+=kb;Za.width+=Cd.width;Za.height+= Cd.height;var We=La.margin,Pd=We.right+We.left,ze=We.top+We.bottom;La.measure(Za.width,Za.height,f,g);for(var Xe=La.measuredBounds,Ae=Math.max(Xe.width+Pd,0),Be=Math.max(Xe.height+ze,0),id=0,eg=0;eg=a.rowCount);eg++)L=a.getRowDefinition(La.row+eg),id+=L.total||0;if(id=he)&&!(La.row+jd>=a.rowCount);jd++){L=a.getRowDefinition(La.row+jd);var fg=L.ka||0,fn=en(La,L,dn);L.actual= Math.min(L.maximum,fg+fn);L.ka!==fg&&(he-=L.ka-fg)}for(;0mh&&(L.actual=Math.min(L.maximum,mh+he),L.ka!==mh&&(he-=L.ka-mh));if(0===L.index)break;L=a.getRowDefinition(L.index-1)}}for(var gg=0,Hj=0;Hj=a.columnCount);Hj++)L=a.getColumnDefinition(La.column+Hj),gg+=L.total||0;if(gg=pi)&&!(La.column+Ij>=a.columnCount);Ij++){L= a.getColumnDefinition(La.column+Ij);var gn=L.ka||0,nt=mt(La,L,lt);L.actual=Math.min(L.maximum,gn+nt);L.ka!==gn&&(pi-=L.ka-gn)}for(;0Jj&&(L.actual=Math.min(L.maximum,Jj+pi),L.ka!==Jj&&(pi-=L.ka-Jj));if(0===L.index)break;L=a.getColumnDefinition(L.index-1)}}}}Ga(C);M.free(Cd);M.free(Za);void 0!==gd&&Ga(gd);void 0!==fe&&Ga(fe);var hg=0,ig=0,Kj=a.desiredSize,Nq=a.maxSize;Cb=Pk(a,!0);var qi=Lc=Ub=0,ri=0;h=a.columnCount;for(var Lj=0;Lj=a.rowCount);J++)K=a.getRowDefinition(q+J),r.height+=K.total;for(J=1;J=a.columnCount);J++)K=a.getColumnDefinition(v+J),r.width+=K.total;var T=w.ka+r.width,Q=u.ka+r.height;J= h;K=k;var ea=T,pa=Q,L=h,Fa=k,Pa=T,eb=Q;h+T>c.width&&(Pa=Math.max(c.width-h,0));k+Q>c.height&&(eb=Math.max(c.height-k,0));var Ia=C.alignment;if(Ia.Kb()){Ia=a.defaultAlignment;Ia.gb()||(Ia=Fc);var nb=Ia.x;var yd=Ia.y;var kb=Ia.offsetX;Ia=Ia.offsetY;var Yb=w.alignment,Ya=u.alignment;Yb.gb()&&(nb=Yb.x,kb=Yb.offsetX);Ya.gb()&&(yd=Ya.y,Ia=Ya.offsetY)}else nb=Ia.x,yd=Ia.y,kb=Ia.offsetX,Ia=Ia.offsetY;if(isNaN(nb)||isNaN(yd))yd=nb=.5,Ia=kb=0;Yb=I.width;Ya=I.height;var Md=C.margin,sc=Md.left+Md.right,uf=Md.top+ Md.bottom,Se=hl(C,u,w,!1);!isNaN(C.desiredSize.width)||Se!==wd&&Se!==Ak||(Yb=Math.max(T-sc,0));!isNaN(C.desiredSize.height)||Se!==wd&&Se!==Bk||(Ya=Math.max(Q-uf,0));T=C.maxSize;Q=C.minSize;Yb=Math.min(T.width,Yb);Ya=Math.min(T.height,Ya);Yb=Math.max(Q.width,Yb);Ya=Math.max(Q.height,Ya);T=Ya+uf;J+=ea*nb-(Yb+sc)*nb+kb+Md.left;K+=pa*yd-T*yd+Ia+Md.top;C.visible&&(fc(L,Fa,Pa,eb,J,K,I.width,I.height)?C.arrange(J,K,Yb,Ya):C.arrange(J,K,Yb,Ya,new N(L,Fa,Pa,eb)))}else C.gl(),C.actualBounds.ha(),ea=C.actualBounds, J=N.allocAt(ea.x,ea.y,ea.width,ea.height),ea.x=K.type===X.TableRow?f:h,ea.y=K.type===X.TableColumn?e:k,ea.width=I.width,ea.height=I.height,C.actualBounds.freeze(),Qk(C,!1),ac(J,ea)||(I=C.part,null!==I&&(I.Ah(),C.Go(I))),N.free(J)}}}M.free(r);for(a=0;af)w.measure(Infinity,Infinity,0,0),z=w.measuredBounds,b.Jc(z),a.l.push(z);else{var y=w.segmentIndex;z=w.segmentFraction;var A=w.alignmentFocus;A.jc()&&(A=Fc);var C=w.segmentOrientation,I=w.segmentOffset;if(y<-f||y>=f){z=k.midPoint;var K=k.midAngle;if(C!==qg){var J=k.computeAngle(w,C, K);w.zc=J}J=z.x-m.x;var T=z.y-m.y}else{J=0;if(0<=y){T=n.N(y);var Q=ypa+10?0<=y?K.Wa(T):T.Wa(K):pa>ea+10?0<=y?Q.Wa(J):J.Wa(Q):0<=y?K.Wa(J):J.Wa(K)}else K=0<=y?T.Wa(Q):Q.Wa(T);C!==qg&&(J=k.computeAngle(w,C,K),w.zc=J);J=T.x+(Q.x-T.x)*z-m.x;T=T.y+(Q.y-T.y)*z-m.y}w.measure(Infinity,Infinity,0,0);z=w.measuredBounds;Q=w.naturalBounds; var L=0;w instanceof W&&(L=w.strokeWidth);ea=Q.width+L;pa=Q.height+L;h.reset();h.translate(-z.x,-z.y);h.scale(w.scale,w.scale);h.rotate(C===qg?w.angle:K,ea/2,pa/2);C!==rm&&C!==sm||h.rotate(90,ea/2,pa/2);C!==tm&&C!==um||h.rotate(-90,ea/2,pa/2);C===vm&&(45K||225K)&&h.rotate(-K,ea/2,pa/2);Q=new N(0,0,ea,pa);q.Wi(Q,A);h.ta(q);A=-q.x+L/2*w.scale;w=-q.y+L/2*w.scale;u.assign(I);L=isNaN(I.x);var Fa=isNaN(I.y);if(L||Fa){ea=ea/2+3;pa=pa/2+3;var Pa=45<=K&&135>=K,eb=225<=K&&315>=K;C===qg&&(Pa|| eb)?(u.x=Fa?ea:I.y,u.y=L?pa:I.x,Pa?0<=y||!L||(u.y=-pa):eb&&(0<=y&&L&&(u.y=-pa),Fa&&(u.x=-ea))):(L&&(u.x=0<=y?ea:-ea),Fa&&(u.y=-pa),u.rotate(K))}else u.rotate(K);J+=u.x;T+=u.y;Q.set(z);Q.h(J+A,T+w,z.width,z.height);a.l.push(Q);b.Jc(Q)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.lg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Wb(e,b.width||0,b.height||0);wc.free(h);G.free(q);G.free(u)}}}}; pm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Je||a instanceof R){var d=null,e=null,f=null;a instanceof R&&(e=d=a);a instanceof Je&&(f=a,d=f.adornedPart);var g=a instanceof Je?null:d.path;if(0!==a.l.length){var h=a.l,k=0;if(null!==g&&k=c){var q=n.midPoint;m=n.midAngle;r!==qg&&(n=n.computeAngle(g,r,m),g.angle=n);n=q.x;var u=q.y}else{var v=0;0<=h?(u=b.j[h],q=hz+10?0<=h?m.Wa(u):u.Wa(m):z>w+10?0<=h?q.Wa(v):v.Wa(q): 0<=h?m.Wa(v):v.Wa(m)}else m=0<=h?u.Wa(q):q.Wa(u);r!==qg&&(n=n.computeAngle(g,r,m),g.angle=n);n=u.x+(q.x-u.x)*p;u=u.y+(q.y-u.y)*p}l.et()?g.location=new G(n,u):(l.jc()&&(l=Fc),q=wc.alloc(),q.reset(),q.scale(g.scale,g.scale),q.rotate(g.angle,0,0),p=g.naturalBounds,p=N.allocAt(0,0,p.width,p.height),r=G.alloc(),r.Wi(p,l),q.ta(r),l=-r.x,v=-r.y,k=k.copy(),isNaN(k.x)&&(0<=h?k.x=r.x+3:k.x=-(r.x+3)),isNaN(k.y)&&(k.y=-(r.y+3)),k.rotate(m),n+=k.x,u+=k.y,q.Wv(p),l+=p.x,v+=p.y,h=G.allocAt(n+l,u+v),g.move(h),G.free(h), G.free(r),N.free(p),wc.free(q))}null!==f?f.ik(!1):null!==e&&e.ik(!1)}};function qm(a,b,c,d){if(!1!==$i(d)){var e=d.strokeWidth;0===e&&a instanceof Je&&a.type===X.Link&&a.adornedObject instanceof W&&(e=a.adornedObject.strokeWidth);e*=d.Ca;a instanceof R&&null!==a.qa?(a=a.qa.bounds,Mk(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Je&&null!==a.adornedPart.qa?(a=a.adornedPart.qa.bounds,Mk(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):Mk(d,-(e/2),-(e/2),b+e,c+e);Vi(d,!1)}} function wm(){this.name="Base";this.name="Graduated"}la(wm,rl); wm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.zb();a.jj=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new N(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.jj.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,v=r.flattenedLengths,w=r.flattenedTotalLength,z=u.length,y=0,A=0,C=Da(),I=0;IL&&(L+=360);J.push(L)}y=ea;A=pa}C.push(J)}if(null===a.Qg){for(var Fa=[],Pa=a.Y.j,eb=Pa.length,Ia=0;Iakb&&yd.push(Md)}}}a.Qg=Fa}var sc=a.Qg;var uf=a.Y.j,Se=uf.length,we=0,fh=0,Bc=w;a.lj=[];for(var vf,Te=0;TeCb*Fj*w/a.graduatedRange)){var wf=v[0][0],zd=0,gc=0;fh=w*Nd.graduatedStart-1E-4;Bc=w*Nd.graduatedEnd+1E-4;var Ue=Cb*Fj,Uc=a.graduatedTickBase;if(Uca.graduatedMin+Ue&&(Uc-=Math.floor((Uc-a.graduatedMin)/Ue)*Ue);for(var gh=sc[Te];Uc<=a.graduatedMax;){a:{for(var Ym=gh.length,Yf=0;Yfw&&(we=w),fh<=we&&we<=Bc)){for(var Ub=C[zd][gc],Lc=v[zd][gc];zdwf&&gcVe?0Cd;Cd++){switch(Cd){case 0:$a.h(Ad,Bd);break;case 1:$a.h(Ad+cg,Bd);break;case 2:$a.h(Ad,Bd+ic);break;case 3:$a.h(Ad+cg,Bd+ic)}$a.rotate(dg+Nb.angle);$a.offset(kh,lh);0===ih&&0===Cd?Od.h($a.x,$a.y,0,0):Od.Je($a);$a.offset(-kh,-lh);$a.rotate(-dg-Nb.angle)}G.free($a);an.jj.push(Od);ec(ni,Od.x,Od.y,Od.width,Od.height)}else if(Nb instanceof Yg){var gd=a,fe=e;null===gd.lh&&(gd.lh=new Yg);var jc=gd.lh;xm(jc,Nb);var oi=Nb.alignmentFocus;oi.jc()&&(oi=Ac);for(var hd=Nb.segmentOrientation,cn=Nb.segmentOffset, ge=null,La=0,Dd=0,kc=0,ye=0,yf=ag.length,We=0;Wekc||225kc)&&id.rotate(-kc,Ae/2,Be/2);var eg=N.allocAt(0,0,Ae,Be),he=G.alloc();he.Wi(eg,oi);id.ta(he);var dn=-he.x,en=-he.y,jd=G.alloc();jd.assign(cn);isNaN(jd.x)&&(jd.x=Ae/2+3);isNaN(jd.y)&&(jd.y=-(Be/2+3));jd.rotate(kc);La+=jd.x+dn;Dd+=jd.y+en;var fg=new N(La,Dd,ze.width,ze.height),fn=new N(ze.x,ze.y,ze.width,ze.height),mh=new N(Xe.x,Xe.y,Xe.width,Xe.height),gg=new ym;gg.Wl(jc.metrics);Pd.push(ye);Pd.push(jc.lineCount);Pd.push(gg);Pd.push(fg);Pd.push(fn);Pd.push(mh);0===We?ge=fg.copy():ge.Jc(fg);G.free(jd); G.free(he);N.free(eg);wc.free(id)}gd.jj.push(ge);ec(fe,ge.x,ge.y,ge.width,ge.height)}Vi(Nb,!1)}}};wm.prototype.arrange=function(a,b,c){if(null!==a.jj){var d=a.zb(),e=a.lj,f=a.jj,g=0,h=f[g];g++;d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l=b&&(b=1);var c=this.gridCellSize,d=c.width;c=c.height;var e=this.naturalBounds,f=this.actualBounds,g=e.width,h=e.height,k=Math.ceil(g/d),l=Math.ceil(h/c),m=this.gridOrigin;a.save();a.beginPath();a.rect(0,0,g,h);a.clip();for(var n=[],p=this.Y.j,r=p.length,q=0;qd*v*b))){u=y.opacity;w=1;if(1!==u){if(0===u)continue;w=a.globalAlpha;a.globalAlpha=w*u}z=n[q];var A=!1,C=y.strokeDashArray;null!==C&&(A=!0,a.Ps(C,y.strokeDashOffset));if("LineV"===y.figure&&null!==y.stroke){a.lineWidth=y.strokeWidth;Sh(this,a,y.stroke,!1,!1,e,f);a.beginPath();for(C=y=Math.floor(-m.x/d);C<=y+k;C++){var I=C*d+m.x;0<=I&&I<=g&&Bm(C,v,z)&&(a.moveTo(I,0),a.lineTo(I,h))}a.stroke()}else if("LineH"===y.figure&&null!==y.stroke){a.lineWidth= y.strokeWidth;Sh(this,a,y.stroke,!1,!1,e,f);a.beginPath();for(C=y=Math.floor(-m.y/c);C<=y+l;C++)I=C*c+m.y,0<=I&&I<=h&&Bm(C,v,z)&&(a.moveTo(0,I),a.lineTo(g,I));a.stroke()}else if("BarV"===y.figure&&null!==y.fill)for(Sh(this,a,y.fill,!0,!1,e,f),y=y.width,isNaN(y)&&(y=d),I=C=Math.floor(-m.x/d);I<=C+k;I++){var K=I*d+m.x;0<=K&&K<=g&&Bm(I,v,z)&&a.fillRect(K,0,y,h)}else if("BarH"===y.figure&&null!==y.fill)for(Sh(this,a,y.fill,!0,!1,e,f),y=y.height,isNaN(y)&&(y=c),I=C=Math.floor(-m.y/c);I<=C+l;I++)K=I*c+ m.y,0<=K&&K<=h&&Bm(I,v,z)&&a.fillRect(0,K,g,y);A&&a.Ns();1!==u&&(a.globalAlpha=w)}}a.restore();a.Rc(!1)}else if(this.va===X.Graduated){d=b.oj;b.oj=!0;e=this.naturalBounds;c=e.width;e=e.height;a.save();a.beginPath();a.rect(-1,-1,c+1,e+1);a.clip();c=this.zb();c.hc(a,b);e=this.De()*b.scale;0>=e&&(e=1);f=c.actualBounds;g=this.Y.j;h=this.lj;k=g.length;for(l=0;lthis.graduatedTickUnit*p.interval*c.geometry.flattenedTotalLength/ this.graduatedRange*e))for(r=p.measuredBounds,q=p.strokeWidth*p.scale,v=p.alignmentFocus,v.jc()&&(v=Ac),u=0;uf.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.Kg:a.Jg);var n=l.separatorStroke;null===n&&(n=c?a.Xh:a.Ig);if(0!==m&&null!==n){Sh(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Wh:a.Vh);null!==p&&(n=!0,b.Ps(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-= p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.eb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.Ns()}}}} function Cm(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;km)){var n=l.tc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Kg:a.Jg);var r=l.separatorStroke;null===r&&(r=c?a.Xh:a.Ig);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.eb,Sh(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+ m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function Bm(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;dd&&e.set(q),G.free(q));G.free(m);f&&e.transform(g);return l}; t.s=function(a){Y.prototype.s.call(this,a);a=null;if(this.va===X.Auto||this.va===X.Link)a=this.zb();for(var b=this.Y.j,c=b.length,d=0;dc||f>d)this.s(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case wd:this.s(!0);this.measure(c+h,d+g,0,0);break;case Ak:this.s(!0);this.measure(c+h,f+g,0,0);break;case Bk:this.s(!0),this.measure(b+h,d+g,0,0)}}this.va.arrange(this,e,this.lg)}}; t.xh=function(a){var b=this.naturalBounds,c=bm(this);if(fc(0,0,b.width,b.height,a.x,a.y)){b=this.Y.j;for(var d=b.length,e=G.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(zb(e.set(a),f.transform),f.da(e))return G.free(e),!0}G.free(e);return null===this.ib&&null===this.dc?!1:!0}return!1};t.Qs=function(a){if(this.Fk===a)return this;for(var b=this.Y.j,c=b.length,d=0;dp.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof X?m:null;p=wc.alloc();p.set(g); if(null!==m?m.qg(a,b,c,d,e,p):Ok(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);wc.free(p)}}}void 0===f&&wc.free(g);return d}void 0===f&&wc.free(g);return!1};function Km(a,b,c,d){for(var e=a.Y.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof X&&Km(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}} t.rg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.Zd(),k=h?a:zb(G.allocAt(a.x,a.y),this.transform),l=h?b:zb(G.allocAt(b.x,b.y),this.transform),m=k.Ce(l),n=0v.width||u.y>v.height||0>u.x+u.width||0>u.y+u.height))if(q.Zd()?(u=q.transform,zb(k.set(a),u),zb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.rg(k,l,c,d,e,f):u.hx(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}G.free(k);G.free(l)}return e?n:g}return!1}; function gm(a){var b=null;a instanceof W&&(b=a.spot1,b===ad&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=zc);return b}function hm(a){var b=null;a instanceof W&&(b=a.spot2,b===ad&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Jc);return b}t.add=function(a){this.Ib(this.Y.count,a)};t.N=function(a){return this.Y.N(a)}; t.Ib=function(a,b){b instanceof S&&B("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.ug(b))this===b&&B("Cannot make a Panel contain itself: "+this.toString()),B("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&B("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString()); this.va!==X.Grid||b instanceof W||B("Can only add Shapes to a Grid Panel, not: "+b);this.va!==X.Graduated||b instanceof W||b instanceof Yg||B("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Vi(this);b.Cj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Ed&&(this.Ed=new vb),this.Ed.add(d,b))}var e=this.Y;d=-1;if(c===this){for(var f=-1,g=this.Y.j,h=g.length,k=0;k=e.count&&a>=e.count)return; e.mb(f);d=f}else B("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Ib(a,b);if(0===a||b.isPanelMain)this.wi=null;$i(this)||this.s();b.s(!1);null!==b.portId?this.zh=!0:b instanceof X&&!0===b.zh&&(this.zh=!0);this.Qg=null;c=this.part;null!==c&&(c.xj=null,c.Xg=NaN,this.zh&&c instanceof V&&(c.zh=!0),c.zh&&c instanceof V&&(c.rc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.ab(ue,"elements",this,b,null,d,null),c.ab(te, "elements",this,null,b,null,a),this.vg()||Lm(this,b,!1)))};function Mm(a,b){a.H=b?a.H|16777216:a.H&-16777217}t.remove=function(a){for(var b=this.Y.j,c=b.length,d=-1,e=0;ea&&va(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.sb;if(void 0===b)return null;if(void 0===b[a]){var c=new Aj;c.Vi(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};X.prototype.Cv=function(a){0>a&&va(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.sb;void 0!==b&&(this.ab(ue,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.s())}; X.prototype.getColumnDefinition=function(a){0>a&&va(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.nb;if(void 0===b)return null;if(void 0===b[a]){var c=new Aj;c.Vi(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=X.prototype;t.Av=function(a){0>a&&va(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.nb;void 0!==b&&(this.ab(ue,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.s())}; t.Oy=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.sb,d=c.length,e=this.zi;ea||this.type!==X.Table)return-1;for(var b=0,c=this.nb,d=c.length,e=this.ii;ea;)this.xc(this.Y.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;cc)){var d=Qm(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.J(d));null===f&&(Rm||(Rm=!0,wa('No item template Panel found for category "'+d+'" on '+a),wa(" Using default item template."),d=new X,e=new Yg,e.bind(new si("text","",Ja)),d.add(e),Sm=d),f=Sm);d=f;null!==d&&(Ag(d),d=d.copy(),0!==(d.H&16777216)&&(e=a.Ji(),null!==e&&Mm(e,!0)),"object"===typeof b&&(null===a.Ed&&(a.Ed=new vb),a.Ed.add(b,d)),e=c+Im(a),a.Ib(e,d),d.jb=b,Tm(a,e,c),d.jb=null,d.data= b)}}function Tm(a,b,c){for(a=a.Y;ba&&va(a,">= 0",X,"padding"),a=new pc(a)):(0>a.left&&va(a.left,">= 0",X,"padding:value.left"),0>a.right&&va(a.right,">= 0",X,"padding:value.right"),0>a.top&&va(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&va(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.eb;b.A(a)||(this.eb=a=a.I(),this.s(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.nn},set:function(a){var b=this.nn;b.A(a)||(this.nn=a=a.I(),this.s(),this.g("defaultAlignment", b,a))}},defaultStretch:{get:function(){return this.Gf},set:function(a){var b=this.Gf;b!==a&&(this.Gf=a,this.s(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.fj?uc:this.fj},set:function(a){if(void 0!==this.fj){"number"===typeof a&&(a=new pc(a));var b=this.fj;b.A(a)||(this.fj=a=a.I(),this.s(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0=== this.Xh?null:this.Xh},set:function(a){var b=this.Xh;b!==a&&(null===a||"string"===typeof a||a instanceof Yk)&&(a instanceof Yk&&a.freeze(),this.Xh=a,this.R(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Kg?1:this.Kg},set:function(a){if(void 0!==this.Kg){var b=this.Kg;b!==a&&isFinite(a)&&0<=a&&(this.Kg=a,this.s(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{ get:function(){return void 0===this.Wh?null:this.Wh},set:function(a){if(void 0!==this.Wh){var b=this.Wh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;ea)&&B("Panel.topIndex must be greater than zero and a real number, not: "+a),this.zi=a,this.s(), this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.ii?0:this.ii},set:function(a){if(void 0!==this.ii){var b=this.ii;b!==a&&((!isFinite(a)||0>a)&&B("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.ii=a,this.s(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.jb},set:function(a){var b=this.jb;if(b!==a){var c=this instanceof S&&!(this instanceof Je);Ag(this);this.jb=a;var d=this.diagram; null!==d&&(c?(c=d.partManager,this instanceof R?(null!==b&&c.Hg.remove(b),null!==a&&c.Hg.add(a,this)):this instanceof S&&(null!==b&&c.Ne.remove(b),null!==a&&c.Ne.add(a,this))):(c=this.panel,null!==c&&null!==c.Ed&&(null!==b&&c.Ed.remove(b),null!==a&&c.Ed.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ea()}}},itemIndex:{get:function(){return this.Zn},set:function(a){var b=this.Zn;b!==a&&(this.Zn=a,this.g("itemIndex",b,a))}},itemArray:{ get:function(){return this.gi},set:function(a){var b=this.gi;if(b!==a||null!==a&&Om(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&rj(c.partManager,this,c),this.gi=a,null!==c&&null!==a&&oj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.nt()}}},itemTemplate:{get:function(){return null===this.je?null:this.je.J("")},set:function(a){if(null===this.je){if(null===a)return;this.je=new vb}var b=this.je.J(""); b!==a&&((a instanceof S||a.isPanelMain)&&B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.je.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.nt())}},itemTemplateMap:{get:function(){return this.je},set:function(a){var b=this.je;if(b!==a){for(var c=a.iterator;c.next(););this.je=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.nt()}}},itemCategoryProperty:{ get:function(){return this.hl},set:function(a){var b=this.hl;b!==a&&(this.hl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.H&1048576)},set:function(a){var b=0!==(this.H&1048576);b!==a&&(this.H^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.H&2097152)},set:function(a){var b=0!==(this.H&2097152);b!==a&&(this.H^=2097152,this.s(),this.g("isClipping",b,a))}},isOpposite:{ get:function(){return 0!==(this.H&33554432)},set:function(a){var b=0!==(this.H&33554432);b!==a&&(this.H^=33554432,this.s(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.H&4194304)},set:function(a){var b=0!==(this.H&4194304);if(b!==a){var c=null===this.panel||this.panel.vg();this.H^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&Lm(this,this,a)}}},alignmentFocusName:{ get:function(){return this.Cg},set:function(a){var b=this.Cg;b!==a&&(this.Cg=a,this.s(),this.g("alignmentFocusName",b,a))}}}); ma.Object.defineProperties(X,{Position:{get:function(){return ql.J("Position")}},Horizontal:{get:function(){return ql.J("Horizontal")}},Vertical:{get:function(){return ql.J("Vertical")}},Spot:{get:function(){return ql.J("Spot")}},Auto:{get:function(){return ql.J("Auto")}},Table:{get:function(){return ql.J("Table")}},Viewbox:{ get:function(){return ql.J("Viewbox")}},TableRow:{get:function(){return ql.J("TableRow")}},TableColumn:{get:function(){return ql.J("TableColumn")}},Link:{get:function(){return ql.J("Link")}},Grid:{get:function(){return ql.J("Grid")}},Graduated:{get:function(){return ql.J("Graduated")}}});X.prototype.findItemPanelForData=X.prototype.gx; X.prototype.rebuildItemElements=X.prototype.nt;X.prototype.updateTargetBindings=X.prototype.Ea;X.prototype.copyTemplate=X.prototype.uy;X.prototype.graduatedValueForPoint=X.prototype.gz;X.prototype.graduatedPointForValue=X.prototype.fz;X.prototype.findColumnForLocalX=X.prototype.Gy;X.prototype.findRowForLocalY=X.prototype.Oy;X.prototype.removeColumnDefinition=X.prototype.Av;X.prototype.removeRowDefinition=X.prototype.Cv;X.prototype.removeAt=X.prototype.mb;X.prototype.remove=X.prototype.remove; X.prototype.insertAt=X.prototype.Ib;X.prototype.elt=X.prototype.N;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.$a;X.prototype.findInVisualTree=X.prototype.Zl;X.prototype.walkVisualTreeFrom=X.prototype.zm;X.prototype.findMainElement=X.prototype.zb;var Rm=!1,Sm=null,ql=new vb;X.className="Panel";X.definePanelLayout=Vm;Vm("Position",new am);Vm("Vertical",new dm);Vm("Auto",new fm);Vm("Link",new pm);Vm("Grid",new om); function Aj(){ab(this);this.dg=null;this.Gr=!0;this.Sa=0;this.Pc=NaN;this.Zg=0;this.Yg=Infinity;this.wb=ad;this.sa=this.ka=0;this.bb=null;this.rp=Wm;this.we=zk;this.np=this.hg=null;this.op=NaN;this.ib=this.Jj=null;this.hn=!1} Aj.prototype.copy=function(){var a=new Aj;a.Gr=this.Gr;a.Sa=this.Sa;a.Pc=this.Pc;a.Zg=this.Zg;a.Yg=this.Yg;a.wb=this.wb;a.ka=this.ka;a.sa=this.sa;a.we=this.we;a.rp=this.rp;null===this.hg?a.hg=null:a.hg=this.hg.I();a.np=this.np;a.op=this.op;a.Jj=null;null!==this.Jj&&(a.separatorDashArray=Aa(this.separatorDashArray));a.ib=this.ib;a.hn=this.hn;a.bb=this.bb;return a};t=Aj.prototype; t.Wl=function(a){a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.hg=null===a.separatorPadding?null:a.separatorPadding.I();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.Jj=null;a.separatorDashArray&&(this.Jj=Aa(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.bb=a.bb}; t.fb=function(a){a.classType===Aj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+lb(this)};t.Vi=function(a){this.dg=a}; t.Pu=function(){var a=0,b=0,c=this.dg,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.sb.length:c.nb.length,f=0;fa&&va(a,">= 0",Aj,"height"),this.Pc=a,this.actual=this.ka,null!==this.panel&&this.panel.s(), this.yb("height",b,a))}},width:{get:function(){return this.Pc},set:function(a){var b=this.Pc;b!==a&&(0>a&&va(a,">= 0",Aj,"width"),this.Pc=a,this.actual=this.ka,null!==this.panel&&this.panel.s(),this.yb("width",b,a))}},minimum:{get:function(){return this.Zg},set:function(a){var b=this.Zg;b!==a&&((0>a||!isFinite(a))&&va(a,">= 0",Aj,"minimum"),this.Zg=a,this.actual=this.ka,null!==this.panel&&this.panel.s(),this.yb("minimum",b,a))}},maximum:{ get:function(){return this.Yg},set:function(a){var b=this.Yg;b!==a&&(0>a&&va(a,">= 0",Aj,"maximum"),this.Yg=a,this.actual=this.ka,null!==this.panel&&this.panel.s(),this.yb("maximum",b,a))}},alignment:{get:function(){return this.wb},set:function(a){var b=this.wb;b.A(a)||(this.wb=a.I(),null!==this.panel&&this.panel.s(),this.yb("alignment",b,a))}},stretch:{get:function(){return this.we},set:function(a){var b=this.we;b!==a&&(this.we= a,null!==this.panel&&this.panel.s(),this.yb("stretch",b,a))}},separatorPadding:{get:function(){return this.hg},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.hg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.I()),this.hg=a,null!==this.panel&&this.panel.s(),this.yb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.np},set:function(a){var b=this.np;b!==a&&(null!==a&&ul(a,"RowColumnDefinition.separatorStroke"), a instanceof Yk&&a.freeze(),this.np=a,null!==this.panel&&this.panel.s(),this.yb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.op},set:function(a){var b=this.op;b!==a&&(this.op=a,null!==this.panel&&this.panel.s(),this.yb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Jj},set:function(a){var b=this.Jj;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;ee)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,v=Da(),w=2;wn&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;w=0;q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];for(var z=0;.1<=u;){0===z&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));if(e> u){Ga(v);return}e>q?(z=e-q,e=q):z=0;var y=Math.sqrt(e*e/(1+p*p));0>n&&(y=-y);h+=y;k+=p*y;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===z&&d.Fi(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){w++;if(w===v.length){Ga(v);return}q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Ga(v)}} t.Fi=function(a,b){var c=this.Gc,d=this.Xk;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&Sh(this,a,d,!0,!1,f,e);null!==c&&Sh(this,a,c,!1,!1,f,e);e=this.part;f=this.jh;0===f&&null!==e&&(f=e instanceof Je&&e.type===X.Link&&"Selection"===e.category&&e.adornedObject instanceof W&&e.adornedPart.zb()===e.adornedObject?e.adornedObject.strokeWidth:0);a.lineWidth=f;a.lineJoin=this.Kl;a.lineCap=this.Jl;a.miterLimit=this.Lj;var g=!1;e&&b.Ee("drawShadows")&&(g=e.isShadowed);var h= !0;null!==c&&null===d&&(h=!1);e=!1;var k=this.strokeDashArray;null!==k&&(e=!0,a.Ps(k,this.ih));var l=this.qa;if(null!==l){if(l.type===xd)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Td(d),0!==f&&null!==c&&a.Yi();else if(l.type===Hd){var m=l.startX,n=l.startY,p=l.endX,r=l.endY;k=Math.min(m,p);l=Math.min(n,r);m=Math.abs(p-m);n=Math.abs(r-n);a.beginPath();a.rect(k,l,m,n);null!==d&&a.Td(d);if(null!==c){p=d=c=0;h&&g&&(c=a.shadowOffsetX,d=a.shadowOffsetY,p=a.shadowBlur, a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0);if(0!==f){if(0===m||0===n)a.beginPath(),a.rect(k,l,Math.max(m,.1),Math.max(n,.1));a.Yi()}h&&g&&(a.shadowOffsetX=c,a.shadowOffsetY=d,a.shadowBlur=p)}}else if(l.type===Id)n=l.startX,k=l.startY,p=l.endX,r=l.endY,l=Math.abs(p-n)/2,m=Math.abs(r-k)/2,n=Math.min(n,p)+l,k=Math.min(k,r)+m,a.beginPath(),a.moveTo(n,k-m),a.bezierCurveTo(n+H.Bg*l,k-m,n+l,k-H.Bg*m,n+l,k),a.bezierCurveTo(n+l,k+H.Bg*m,n+H.Bg*l,k+m,n,k+m),a.bezierCurveTo(n-H.Bg*l,k+m,n-l,k+H.Bg* m,n-l,k),a.bezierCurveTo(n-l,k-H.Bg*m,n-H.Bg*l,k-m,n,k-m),a.closePath(),null!==d&&a.Td(d),0!==f&&null!==c&&(h&&g?(f=a.shadowOffsetX,g=a.shadowOffsetY,c=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0,a.Yi(),a.shadowOffsetX=f,a.shadowOffsetY=g,a.shadowBlur=c):a.Yi());else if(l.type===vd)for(k=l.figures,l=k.length,m=0;mv.sweepAngle,null!==q?q.endX:n.startX,null!==q?q.endY:n.startY)}else if(q=be(v,n),w=q.length,0===w)a.lineTo(v.centerX,v.centerY);else for(var z=0;z(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;N.free(f);return H.Tb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type=== Hd){b=c.startX;var g=c.startY,h=c.endX;c=c.endY;f.x=Math.min(b,h);f.y=Math.min(g,c);f.width=Math.abs(h-b);f.height=Math.abs(c-g);if(null===this.fill){f.Uc(-d,-d);if(f.da(a))return N.free(f),!1;f.Uc(d,d)}null!==this.stroke&&f.Uc(e,e);a=f.da(a);N.free(f);return a}if(c.type===Id){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return N.free(f),!1; g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===vd)return N.free(f),null===this.fill?ie(c,a.x,a.y,e):c.da(a,e,1=this.strokeWidth)m=H.Ge(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),d=m* b);b=Da();a=new G;H.Ge(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new G;H.Ge(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new G;H.Ge(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new G;H.Ge(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Ga(b),!1;m=!0;k=Infinity;for(d=0;dMath.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c* (a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)c?a-c:c-a)<(b>d?b-d:d-b)?(a=ba||H.ca(k.y,a))&&(k.yb||H.ca(k.x,b))&&(k.x=a&&d<=b;a=d&&c<=a} t.hx=function(a,b,c){function d(a,b){for(var c=a.length,d=0;de)return!0;return!1}if(c&&null!==this.fill&&this.xh(a,!0))return!0;var e=a.Ce(b),f=e;1.5=e||Bb(b,f,0,-n)>=e||Bb(b, f,0,n)>=e||Bb(b,f,m,0)>=e?!1:!0}else if(b.type===vd){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.xl&&a.ye&&Ab(a.x,a.y,f,h,k,h)>e&&Ab(a.x,a.y,k,l,f,l)>e&&Ab(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?ie(b,a.x,a.y,f):b.da(a,f,!0))return!0}else{c=b.figures;for(b=0;be)return!1;h=f.segments.j;k=h.length;for(l=0;le)return!1;break;case Yd:var p=Da();H.Ae(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ga(p);if(g)return!1;g=n.endX;m=n.endY;if(a.cd(g,m)>e)return!1;break;case Zd:p=Da();H.nq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ga(p);if(g)return!1;g=n.endX;m=n.endY;if(a.cd(g,m)>e)return!1;break;case $d:case ae:p=n.type===$d?be(n,f):ce(n,f,g,m);var r=p.length;if(0===r){g=n.centerX;m=n.centerY;if(a.cd(g,m)>e)return!1;break}n=null;for(var q=Da(),u=0;u= 0",W,"strokeWidth:value")}},strokeCap:{get:function(){return this.Jl},set:function(a){var b= this.Jl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?va(a,'"butt", "round", or "square"',W,"strokeCap"):(this.Jl=a,this.R(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Kl},set:function(a){var b=this.Kl;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?va(a,'"miter", "bevel", or "round"',W,"strokeJoin"):(this.Kl=a,this.R(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.Lj}, set:function(a){var b=this.Lj;if(b!==a&&1<=a){this.Lj=a;this.R();var c=this.part;null!==c&&(c.Xg=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.hh},set:function(a){var b=this.hh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;ea?a=0:1a?a=0:1p*m*m&&(c=!0);b.Yc!==a&&(c=!1);!1===b.Ee("textGreeking")&& (c=!1);b=this.bf;p=this.cf;switch(this.flip){case Ek:a.translate(e,0);a.scale(-1,1);break;case Dk:a.translate(0,f);a.scale(1,-1);break;case Fk:a.translate(e,f),a.scale(-1,-1)}m=this.oc;n=(b+g+p)*m;f>n&&(d=this.Ci,d=d.y*f-d.y*n+d.offsetY);n=this.nd;for(var r=0;re&&(q=e);d+=b;var u=n.Ac[r],v=a,w=d,z=h,y=0;if(c)"left"===z?y=0:"right"===z?y=e-q:"center"===z&&(y=(e-q)/2),v.fillRect(0+y,w+.25*g,q,1);else{"left"===z?y=0:"right"===z?y=e:"center"===z&&(y=e/2);var A=null!==yn?yn(this, g):.75*g;v.fillText(u,0+y,w+A);u=g/20|0;0===u&&(u=1);"right"===z?y-=q:"center"===z&&(y-=q/2);k&&(z=null!==zn?zn(this,g):.8*g,v.beginPath(),v.lineWidth=u,v.moveTo(0+y,w+z),v.lineTo(0+y+q,w+z),v.stroke());l&&(v.beginPath(),v.lineWidth=u,w=w+g-g/2.2|0,0!==u%2&&(w+=.5),v.moveTo(0+y,w),v.lineTo(0+y+q,w),v.stroke())}d+=g+p}switch(this.flip){case Ek:a.scale(-1,1);a.translate(-e,0);break;case Dk:a.scale(1,-1);a.translate(0,-f);break;case Fk:a.scale(-1,-1),a.translate(-e,-f)}}}; t.im=function(a,b,c,d){this.kl=a;var e=this.fe;null!==An&&Bn!==e&&(Bn=An.font=e);e=this.nd;e.reset();var f;if(isNaN(this.desiredSize.width)){var g=this.Ob.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===g.length)g=0;else if(this.isMultiline){for(var h=f=0,k=!1;!k;){var l=g.indexOf("\n",h);-1===l&&(l=g.length,k=!0);f=Math.max(f,Cn(g.substr(h,l-h).trim()));h=l+1}g=f}else f=g.indexOf("\n",0),0<=f&&(g=g.substr(0,f)),g=Cn(g);g=Math.min(g,a/this.scale);g=Math.max(8,g)}else g=this.desiredSize.width;null!== this.panel&&(g=Math.min(g,this.panel.maxSize.width));f=Dn(this,g,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==e.Ec&&1!==e.Ac.length&&this.bg===En&&(b=this.fe,b=this.bg===En?Fn(b):0,k=this.bf+this.cf,k=Math.max(0,xn(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=e.Ac.length))){k=e.Ac[h];for(b=Math.max(1,a-b);Cn(k)>b&&1=a.ne)null!==e&&e.h(0,h);else{var l=b;if(a.ng===Jn)if(c.mg=1,g=Cn(b),0===k||g<=d)c.Ec=Math.max(c.Ec,g),c.Wc.push(c.Ec),c.Ac.push(b),null!==e&&e.h(g,h);else{f=Kn(a,l);l=l.substr(f.length);b=Kn(a,l);for(g=Cn(f+b);0d&&1d;){var n=1;g=Cn(m.substr(0,n));for(b=0;g<=d;)n++,b=g,g=Cn(m.substr(0,n));1===n?(c.Wc[a.oc+k]=g,f=Math.max(f,g)):(c.Wc[a.oc+k]=b,f=Math.max(f,b));n--;1>n&&(n=1);c.Ac[a.oc+k]=m.substr(0,n);k++;m=m.substr(n);if(a.oc+k>a.ne)break}b=Kn(a,l);for(g=Cn(m+b);0a.ne))break}c.mg=Math.min(a.ne,k);c.Ec=Math.max(c.Ec,f);null!==e&&e.h(c.Ec,h*c.mg)}}}function Kn(a,b){if(a.ng===Ln)return b.substr(0,1);a=b.length;for(var c=0,d=Mn;c=a?b:b.substr(0,c)} function Cn(a){return null===An?8*a.length:An.measureText(a).width}function xn(a){if(null!==a.nd.Kf)return a.nd.Kf;var b=a.fe;if(null===An){var c=16;return a.nd.Kf=c}void 0!==Nn[b]&&5E3>On?c=Nn[b]:(c=1.3*An.measureText("M").width,Nn[b]=c,On++);return a.nd.Kf=c}function Fn(a){if(null===An)return 6;if(void 0!==Pn[a]&&5E3>Qn)var b=Pn[a];else b=An.measureText(Gn).width,Pn[a]=b,Qn++;return b} function Dn(a,b,c){var d=a.Ob.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),e=a.bf+a.cf;e=Math.max(0,xn(a)+e);if(0===d.length)return c.Ec=0,a.oc=1,e;if(!a.isMultiline){var f=d.indexOf("\n",0);0<=f&&(d=d.substr(0,f))}f=0;for(var g=a.oc=0,h,k=!1;!k;){h=d.indexOf("\n",g);-1===h&&(h=d.length,k=!0);if(g<=h){g=d.substr(g,h-g);if(a.ng!==Jn){c.mg=0;var l=M.alloc();In(a,g,c,b,l);f+=l.height;M.free(l);a.oc+=c.mg}else In(a,g,c,b,null),f+=e,a.oc++;a.oc===a.ne&&(k=!0)}g=h+1}return a.Rr=f} function un(){Mn=/[ \u200b\u00ad]/;Nn=new db;Pn=new db;An=Wg?(new ik(null)).context:null} ma.Object.defineProperties(Yg.prototype,{font:{get:function(){return this.fe},set:function(a){var b=this.fe;b!==a&&(this.fe=a,this.nd.Kf=null,this.s(),this.g("font",b,a))}},text:{get:function(){return this.Ob},set:function(a){var b=this.Ob;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Ob=a,this.s(),this.g("text",b,a))}},textAlign:{get:function(){return this.xi},set:function(a){var b=this.xi;b===a||"start"!== a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.xi=a,this.R(),this.g("textAlign",b,a))}},flip:{get:function(){return this.yd},set:function(a){var b=this.yd;b!==a&&(this.yd=a,this.R(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.Ci},set:function(a){var b=this.Ci;b.A(a)||(this.Ci=a=a.I(),gl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.qc.o()){var a= M.alloc();In(this,this.Ob,this.nd,999999,a);var b=a.width;M.free(a);a=Dn(this,b,this.nd);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Wb(this.qc,b,a)}return this.qc}},isMultiline:{get:function(){return this.pj},set:function(a){var b=this.pj;b!==a&&(this.pj=a,this.s(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.R(),this.g("isUnderline", b,a))}},isStrikethrough:{get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(this.ei=a,this.R(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.ng},set:function(a){var b=this.ng;b!==a&&(this.ng=a,this.s(),this.g("wrap",b,a))}},overflow:{get:function(){return this.bg},set:function(a){var b=this.bg;b!==a&&(this.bg=a,this.s(),this.g("overflow",b,a))}},stroke:{ get:function(){return this.Gc},set:function(a){var b=this.Gc;b!==a&&(null!==a&&ul(a,"TextBlock.stroke"),a instanceof Yk&&a.freeze(),this.Gc=a,this.R(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.oc}},editable:{get:function(){return this.An},set:function(a){var b=this.An;b!==a&&(this.An=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.Bp},set:function(a){var b=this.Bp;b!==a&& (this.Bp=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(this.Cc=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Cd},set:function(a){var b=this.Cd;a=Math.floor(a);if(b!==a&&0<=a){this.Cd=a;this.s();var c=this.panel;null!==c&&(c.Qg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Bd},set:function(a){var b= this.Bd;b!==a&&(0>a?a=0:1a?a=0:1=a&&va(a,"> 0",Yg,"maxLines"),this.ne=a,this.g("maxLines",b,a),this.s())}},metrics:{get:function(){return this.nd}},choices:{ get:function(){return this.Xm},set:function(a){var b=this.Xm;b!==a&&(this.Xm=a,this.g("choices",b,a))}}});var yn=null,zn=null,Jn=new D(Yg,"None",0),Hn=new D(Yg,"WrapFit",1),wn=new D(Yg,"WrapDesiredSize",2),Ln=new D(Yg,"WrapBreakAll",3),vn=new D(Yg,"OverflowClip",0),En=new D(Yg,"OverflowEllipsis",1),Mn=null,Nn=null,On=0,Pn=null,Qn=0,Gn="...",Bn="",An=null,tn=!1;Yg.className="TextBlock";Yg.getEllipsis=function(){return Gn};Yg.setEllipsis=function(a){Gn=a;Pn=new db;Qn=0};Yg.getBaseline=function(){return yn}; Yg.setBaseline=function(a){yn=a;a=Oa();for(var b=a.length,c=0;c=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case wd:m=d.width;n=d.height;break;case Dg:case Ck:p===Dg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Ck&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/ n)*g),h*=1/(m/d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.De()*b.scale;var q=m*p*n*p,u=h*g/q,v=c.__goCache;p=null;var w=Vn;if(c.Er&&void 0!==v&&4w*w)for(null===v.Ei&&(Wn(v,4,k,l,c),Wn(v,16,k,l,c)),k=v.Ei,l=k.length,q=0;q=d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*H.Bg;b=(new ud).add((new ke(d,0,!0)).add(new le(Fd,b-d,0)).add(new le(Yd,b,d,b-a,0,b,a)).add(new le(Fd,b,c-d)).add(new le(Yd,b-d,c,b,c-a,b-a,c)).add(new le(Fd,d,c)).add(new le(Yd,0,c-d,a,c,0,c-a)).add(new le(Fd,0,d)).add((new le(Yd,d,0,0,a,a,0)).close()));1e.x&&a.y>e.y&&a.righte.x&&b.y>e.y&&b.right=c.maxSelectionCount)){this.D^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ha();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Jb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.cc(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==(this.D&524288)},set:function(a){var b=0!==(this.D&524288);if(b!==a){this.D^=524288;var c= this.diagram;null!==c&&(c=c.highlighteds,c.ha(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.R();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.D&8192)},set:function(a){var b=0!==(this.D&8192);b!==a&&(this.D^=8192,this.g("isShadowed",b,a),this.R())}},isAnimated:{get:function(){return 0!==(this.D&262144)},set:function(a){var b=0!==(this.D&262144);b!==a&&(this.D^=262144, this.g("isAnimated",b,a))}},highlightedChanged:{get:function(){return this.Nn},set:function(a){var b=this.Nn;b!==a&&(this.Nn=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.mp},set:function(a){var b=this.mp;b!==a&&(this.mp=a,this.eh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp= a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.eh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.$a(a),null!==a?this.eh=a:this.eh=this):this instanceof R?(a=this.path,null!==a?this.eh=a:this.eh=this):this.eh=this}return this.eh}},selectionChanged:{get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(this.lp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{ get:function(){return this.Wo},set:function(a){var b=this.Wo;b!==a&&(this.Wo=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.Yo},set:function(a){var b=this.Yo;b!==a&&(this.Yo=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.$a(a),null!==a)?a:this}},resizeCellSize:{get:function(){return this.Xo}, set:function(a){var b=this.Xo;b.A(a)||(this.Xo=a=a.I(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.Zo},set:function(a){var b=this.Zo;b!==a&&(this.Zo=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.$o},set:function(a){var b=this.$o;b!==a&&(this.$o=a,this.g("rotateObjectName",b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName; return""!==a&&(a=this.$a(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.ap},set:function(a){var b=this.ap;b.A(a)||(this.ap=a=a.I(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Ob},set:function(a){var b=this.Ob;b!==a&&(this.Ob=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.Th},set:function(a){if(this.bc()){var b=this.Th;if(b!==a){null===a||this!==a&&!a.Vd(this)|| (this===a&&B("Cannot make a Group a member of itself: "+this.toString()),B("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.B(2);var c=this.diagram;null!==b?no(b,this):this instanceof U&&null!==c&&c.Ai.remove(this);this.Th=a;null!==a?mo(a,this):this instanceof U&&null!==c&&c.Ai.add(this);this.B(1);if(null!==c){var d=this.data,e=c.model;if(null!==d&&e.fk()){var f=e.pa(null!==a?a.data:null);e.ut(d,f)}}d=this.containingGroupChanged;null!==d&& (e=!0,null!==c&&(e=c.ea,c.ea=!0),d(this,b,a),null!==c&&(c.ea=e));if(this instanceof U)for(c=new F,wk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)so(d.value);if(this instanceof V){for(c=this.linksConnected;c.next();)so(c.value);c=this.labeledLink;null!==c&&so(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&Th(b,-1,a))}}else B("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{ get:function(){return this.$m},set:function(a){var b=this.$m;b!==a&&(this.$m=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.bo},set:function(a){var b=this.bo;b!==a&&(this.bo=a,this.g("layoutConditions",b,a))}},dragComputation:{get:function(){return this.wn}, set:function(a){var b=this.wn;b!==a&&(this.wn=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.vi},set:function(a){var b=this.vi;b.A(a)||(this.vi=a=a.I(),this.R(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Kj},set:function(a){var b=this.Kj;b!==a&&(this.Kj=a,this.R(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.Od},set:function(a){var b= this.Od;b!==a&&(this.Od=a,this.R(),this.g("shadowBlur",b,a))}}});S.prototype.invalidateLayout=S.prototype.B;S.prototype.findCommonContainingGroup=S.prototype.ex;S.prototype.isMemberOf=S.prototype.Vd;S.prototype.findTopLevelPart=S.prototype.Sy;S.prototype.findSubGraphLevel=S.prototype.Py;S.prototype.ensureBounds=S.prototype.$b;S.prototype.getDocumentBounds=S.prototype.Zp;S.prototype.getRelativePoint=S.prototype.qf;S.prototype.findObject=S.prototype.$a;S.prototype.moveTo=S.prototype.moveTo; S.prototype.invalidateAdornments=S.prototype.Jb;S.prototype.clearAdornments=S.prototype.Uj;S.prototype.removeAdornment=S.prototype.vf;S.prototype.addAdornment=S.prototype.rh;S.prototype.findAdornment=S.prototype.bk;S.prototype.updateTargetBindings=S.prototype.Ea;var ko=!1;S.className="Part";S.LayoutNone=0;S.LayoutAdded=1;S.LayoutRemoved=2;S.LayoutShown=4;S.LayoutHidden=8;S.LayoutNodeSized=16;S.LayoutGroupLayout=32;S.LayoutNodeReplaced=64;S.LayoutStandard=127;S.LayoutAll=16777215; function Je(a){S.call(this,a);this.D&=-257;this.Ug="Adornment";this.$d=null;this.Dw=0;this.Ow=!1;this.l=[];this.Va=null}la(Je,S);Je.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Je.prototype.updateRelationshipsFromData=function(){}; Je.prototype.ik=function(a){var b=this.adornedObject.part;if(b instanceof R&&this.adornedObject instanceof W){var c=b.path;b.ik(a);a=c.geometry;b=this.Y.j;c=b.length;for(var d=0;da&&(a=1);var b=this.diagram;if(null!==b&&!b.Fe){b.Fe=!0;var c=new F;c.add(this);Co(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===$h);b.Fe=!1}};function Co(a,b,c,d,e,f,g){if(1a&&(a=2);var b=this.diagram;if(null!==b&&!b.Fe){b.Fe=!0;var c=new F;c.add(this);Eo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===$h);b.Fe=!1}}; function Eo(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Wp():a.sd();k.next();){var l=k.value;l.isTreeLink&&(h||l.Lc||l.Ra(),l=l.Xs(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Lb(!0),l.Ah(),g&&e.Np(l,f)),2e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location, a.h(b.x,b.y,0,0));return a};ma.Object.defineProperties(zg.prototype,{padding:{get:function(){return this.eb},set:function(a){"number"===typeof a&&(a=new pc(a));var b=this.eb;b.A(a)||(this.eb=a=a.I(),this.g("padding",b,a))}}});zg.className="Placeholder"; function R(){S.call(this,X.Link);this.Ta=8;this.Pe=null;this.Qe="";this.gf=this.Fn=null;this.hf="";this.Ep=null;this.Mm=qg;this.gn=0;this.kn=qg;this.ln=NaN;this.Gj=Jo;this.sp=.5;this.$c=null;this.xb=(new E).freeze();this.dh=this.$g=null;this.yl=new N;this.qa=new ud;this.Qn=!0;this.K=this.u=this.Af=this.Jf=null;this.l=[];this.Au=new G;this.rr=this.Kw=this.Jw=null;this.au=NaN;this.P=null}la(R,S); R.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.Ta=this.Ta&-113;a.Qe=this.Qe;a.Fn=this.Fn;a.hf=this.hf;a.Ep=this.Ep;a.Mm=this.Mm;a.gn=this.gn;a.kn=this.kn;a.ln=this.ln;a.Gj=this.Gj;a.sp=this.sp;null!==this.P&&(a.P=this.P.copy())};t=R.prototype;t.pf=function(a){S.prototype.pf.call(this,a);this.Qe=a.Qe;this.hf=a.hf;a.$g=null;a.Ra();a.Af=this.Af;var b=a.fromPort;null!==b&&wo(a.fromNode,b);b=a.toPort;null!==b&&wo(a.toNode,b)}; t.fb=function(a){a.classType===R?2===(a.value&2)?this.routing=a:a===tg||a===pg||a===og?this.curve=a:a===Ko||a===Lo||a===Mo?this.adjusting=a:a!==Jo&&a!==qg&&B("Unknown Link enum value for a Link property: "+a):S.prototype.fb.call(this,a)};t.Hc=function(){null===this.P&&(this.P=new Ik)};t.Si=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(aj(a)||bj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),aj(a)||bj(a))?!1:!0};t.Mv=function(){return!1}; t.Nv=function(){};t.bc=function(){return!1};R.prototype.computeAngle=function(a,b,c){return R.computeAngle(b,c)};R.computeAngle=function(a,b){switch(a){default:case qg:a=0;break;case qn:a=b;break;case rm:a=b+90;break;case tm:a=b-90;break;case No:a=b+180;break;case Oo:a=H.kq(b);90a&&(a-=180);break;case sm:a=H.kq(b+90);90a&&(a-=180);break;case um:a=H.kq(b-90);90a&&(a-=180);break;case vm:a=H.kq(b);if(45a||225a)return 0;90a&&(a-=180)}return H.kq(a)}; function so(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.ex(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Th;if(c!==b){null!==c&&no(c,a);a.Th=b;null!==b&&mo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ea,g.ea=!0);e(a,c,b);null!==g&&(g.ea=f)}!a.Lc||a.Jw!==c&&a.Kw!==c||a.Ra()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=R.prototype; t.Ah=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&S.prototype.Ah.call(this)};t.Xs=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.bz=function(a){var b=this.fromPort;return a===b?this.toPort:b};function zo(a,b){null===a.$c&&(a.$c=new F);a.$c.add(b);a.s()} t.bq=function(a){S.prototype.bq.call(this,a);Po(this)&&this.eq(this.actualBounds);if(!a){a=this.Pe;var b=null;null!==a&&(b=this.fromPort,xo(a,this,b));var c=this.gf;if(null!==c){var d=this.toPort;c===a&&d===b||xo(c,this,d)}Qo(this)}};t.cq=function(a){S.prototype.cq.call(this,a);Po(this)&&this.eq(this.actualBounds);if(!a){a=this.Pe;var b=null;null!==a&&(b=this.fromPort,yo(a,this,b));var c=this.gf;if(null!==c){var d=this.toPort;c===a&&d===b||yo(c,this,d)}Ro(this)}}; t.$j=function(){this.Lc=!0;if(null!==this.$c){var a=this.diagram;if(null!==a)for(var b=this.$c.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};R.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}}; R.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?S.prototype.move.call(this,a,!1):(a=G.allocAt(c.x+d,c.y+e),S.prototype.move.call(this,a,!1),G.free(a));sf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)}; R.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};R.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1}; R.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Jb),a;if(1===b)return a.assign(this.i(0)),a;if(2===b){var c=this.i(0),d=this.i(1);a.h((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===tg))return this.qa.ev(.5,a),a.add(this.i(0)),c=this.qa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===tg){if(3===b)return this.i(1);d=(b-1)/3|0;c=3*(d/2|0);if(1===d%2){d=this.i(c);var e=this.i(c+1), f=this.i(c+2);c=this.i(c+3);H.ny(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;dc/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a}; R.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Wa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===tg)){a:{a=this.qa;var b=.5;0>b?b=0:1=b){b=c[g];c=b[2*a]; d=b[2*a+1];e=b[2*a+2];a=b[2*a+3];a=1>Math.abs(e-c)&&1>Math.abs(a-d)?0:1>Math.abs(e-c)?0<=a-d?90:270:1>Math.abs(a-d)?0<=e-c?0:180:180*Math.atan2(a-d,e-c)/Math.PI;break a}f+=l}}a=NaN}}return a}if(this.computeCurve()===tg&&4<=a){d=(a-1)/3|0;c=3*(d/2|0);if(1===d%2)return c=Math.floor(c),a=this.i(c),d=this.i(c+1),e=this.i(c+2),c=this.i(c+3),H.my(a.x,a.y,d.x,d.y,e.x,e.y,c.x,c.y);if(0e/2)break;b+=f;c++}d=this.i(c);e=this.i(c+1);if(1>Math.abs(d.x-e.x)&&1>Math.abs(d.y-e.y)){if(0Math.abs(d.x-e.x))return d.y>e.y?270:90;if(1>Math.abs(d.y-e.y))return d.x>e.x?180:0}return d.Wa(e)};t=R.prototype;t.i=function(a){return this.xb.j[a]};t.jd=function(a,b){this.xb.gd(a,b)};t.M=function(a,b,c){this.xb.gd(a,new G(b,c))};t.mz=function(a,b){this.xb.Ib(a,b)};t.m=function(a,b,c){this.xb.Ib(a,new G(b,c))};t.ze=function(a){this.xb.add(a)}; t.lf=function(a,b){this.xb.add(new G(a,b))};t.Bv=function(a){this.xb.mb(a)};t.Vj=function(){this.xb.clear()};function sf(a,b,c){if(0!==b||0!==c){for(var d=a.Lc,e=new E,f=a.xb.iterator;f.next();){var g=f.value;e.add((new G(g.x+b,g.y+c)).freeze())}e.freeze();f=a.xb;a.xb=e;isNaN(b)||isNaN(c)||a.diagram.animationManager.rb?a.s():(a.me.h(a.me.x+b,a.me.y+c),a.sa.h(a.sa.x+b,a.sa.y+c),gl(a));d&&So(a);b=a.diagram;null!==b&&b.animationManager.rb&&(a.dh=e);a.g("points",f,e)}} t.Dh=function(){null===this.$g&&(this.$g=this.xb,this.xb=this.xb.copy())}; t.mf=function(){if(null!==this.$g){for(var a=this.$g,b=this.xb,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;gl&&(n=-n),u=(0>k?-1:1)*n+r,v=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var w=r,z=q;H.w(k,0)?z=0k?-1:1)*n+r,z=m*(w-r)+q);this.Vj();this.ze(g);this.lf(u,v);this.lf(w,z);this.ze(p);this.jd(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.jd(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e, f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,H.w(e,0)?h=0f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.ze(d),this.lf(g,h)):this.ze(d),this.ze(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Vj();var y=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)v=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+ a.x&&1===d.y+a.y)&&(r-=m?90:30,0>y&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(v+=Math.abs(y)*(m?1:2)),0===r?q=v:90===r?u=v:180===r?q=-v:270===r?u=-v:(q=v*Math.cos(r*Math.PI/180),u=v*Math.sin(r*Math.PI/180)),d.jc()&&l&&(v=c.ma(Fc,G.alloc()),w=G.allocAt(v.x+1E3*q,v.y+1E3*u),this.getLinkPointFromPoint(b,c,v,w,!0,n),G.free(v),G.free(w));v=this.getLinkPoint(e,f,a,!1,m,b,c);var A=z=w=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);A=this.getLinkDirection(e,f,v,a,!1,m,b,c);l&&(k||d.A(a)||!m&& 1===d.x+a.x&&1===d.y+a.y)&&(A+=m?0:30,0>y&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(y)*(m?1:2));0===A?w=C:90===A?z=C:180===A?w=-C:270===A?z=-C:(w=C*Math.cos(A*Math.PI/180),z=C*Math.sin(A*Math.PI/180));a.jc()&&l&&(a=f.ma(Fc,G.alloc()),d=G.allocAt(a.x+1E3*w,a.y+1E3*z),this.getLinkPointFromPoint(e,f,a,d,!1,v),G.free(a),G.free(d))}a=n;if(m||!h||l)a=new G(n.x+q,n.y+u);d=v;if(m||!k||l)d=new G(v.x+w,v.y+z);!p&&!m&&h&&3Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b} R.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new G);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.Zd()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.rd;e=1/(a.m11*a.m22-a.m12*a.m21);g=a.m22*e;var h=-a.m12*e,k=-a.m21*e,l=a.m11*e,m=e*(a.m21*a.dy-a.m22*a.dx),n=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*g+d.y*k+m;d=d.x*h+d.y*l+n;g=c.x*g+c.y*k+m;c=c.x*h+c.y*l+n}b.dk(e,d,g,c,f);null!== a&&f.transform(a);return f};function Wo(a,b){var c=b.So;null===c&&(c=new Xo,c.port=b,c.node=b.part,b.So=c);return Yo(c,a)} R.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new G);if(c.gb()&&!Uo(c))return b.ma(c,h),h;if(c.sf()){var k=Wo(this,b);if(null!==k){h.assign(k.hq);if(e&&this.routing===Zo){var l=Wo(this,g);if(null!==l&&k.Xl=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.rf(Kc)||c.rf(Oc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);G.free(k);G.free(l)}}return h}}c= b.ma(.5===c.x&&.5===c.y?c:Fc,G.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Vo(c,g.copy()))):(k=this.computeSpot(!d,g),f=G.alloc(),g=g.ma(.5===k.x&&.5===k.y?k:Fc,f),e&&(g=Vo(c,g)),G.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);G.free(c);return h}; R.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.gb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Vo(k,h.copy()):c):(c=G.alloc(),h=h.ma(Fc,c),G.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>= k.x?0:180:h.y>=k.y?90:270;G.free(k);k=c}d.jc()&&g.Vd(a)&&(k+=180,360<=k&&(k-=360));if(Uo(d))return k;a=b.Mi();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};R.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.sf()&&(a=Wo(this,b),null!==a))return a.Vu;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a}; R.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Fc:(b=this.fromSpot,b.Kb()&&(b=a.fromSpot),a=b===ad?yc:b)):(a=b?b:this.toPort,null===a?a=Fc:(b=this.toSpot,b.Kb()&&(b=a.toSpot),a=b===ad?yc:b));return a};function Uo(a){return a===yc||.5===a.x&&.5===a.y}R.prototype.computeOtherPoint=function(a,b){a=b.ma(Fc);b=b.So;b=null!==b?Yo(b,this):null;null!==b&&(a=b.hq);return a}; R.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a}; R.prototype.qg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=wc.alloc(),g.reset());g.multiply(this.transform);if(this.wh(a,g))return Km(this,b,c,e),void 0===f&&wc.free(g),!0;if(this.Ic(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.Y.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=wc.alloc();n.set(g); if(m instanceof X)h=m.qg(a,b,c,d,e,n);else if(this.path===m){if(m instanceof W)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.wh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.nf(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var v=G.alloc(),w=G.alloc(),z=G.alloc(),y=wc.alloc();y.set(q);y.pv(m.transform);y.bt();w.x=p;w.y=u;w.transform(y);v.x=h;v.y=u;v.transform(y);q=!1;on(m,v,w,z)?q=!0:(v.x=p,v.y=r,v.transform(y),on(m,v,w,z)?q=!0:(w.x= h,w.y=r,w.transform(y),on(m,v,w,z)?q=!0:(v.x=h,v.y=u,v.transform(y),on(m,v,w,z)&&(q=!0))));wc.free(y);G.free(v);G.free(w);G.free(z);h=q}}else h=m.wh(h,n)}else h=Ok(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));wc.free(n)}}}void 0===f&&wc.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&wc.free(g);return!1}; R.prototype.computeCurve=function(){if(null===this.Jf){var a=this.fromPort,b=this.isOrthogonal;this.Jf=null!==a&&a===this.toPort&&!b}return this.Jf?tg:this.curve};R.prototype.computeCorner=function(){if(this.curve===tg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a}; R.prototype.findMidLabel=function(){for(var a=this.path,b=this.Y.j,c=b.length,d=0;dk?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);H.ca(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));l=k/l;m= p-m;this.jd(a,b);for(a+=1;ak?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.M(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.jd(c,d)}}return!0;case Mo:f=this.i(a);n=this.i(c);if(!f.Qa(b)||!n.Qa(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.jd(a,b);for(a+=1;ab?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.o()&&h.o()){g.Uc(8,8);h.Uc(8,8);g.Je(a);h.Je(c);if(0===b)if(c.x>a.x||270===d&&c.ya.x||90===d&&c.y>a.y&&h.right>a.x){var k=new G(c.x,a.y);var l=new G(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.ya.y?(k.x=a.xh.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.xh.top&&a.yg.bottom)180===d&&(h.da(a)||g.da(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0): c.ya.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new G(Math.max((a.x+c.x)/2,a.x),a.y),l=new G(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.ya.y&&h.lefta.y?(k.x=a.x>h.right?this.computeMidOrthoPosition(a.x,a.y,h.right,c.y,!1):a.x>h.left&&(270===d&&a.yh.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.left,l.x=k.x,l.y=c.y):180===d&&a.x>h.right&&a.y>h.top&&a.y< h.bottom&&(k.x=a.x,k.y=a.yg.bottom)0===d&&(h.da(a)||g.da(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.ya.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new G(Math.min((a.x+c.x)/2,a.x),a.y),l=new G(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.ya.y||180===d&&c.xa.y||0===d&&c.x>a.x&&h.bottom>a.y)k=new G(a.x,c.y),l=new G((a.x+c.x)/2,c.y),270===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180=== d&&c.xa.x?(k.y=a.yh.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.bottom,l.x=c.x,l.y=k.y):90===d&&a.yh.left&&a.xg.right)270===d&&(h.da(a)||g.da(c))?k.x=this.computeMidOrthoPosition(a.x, a.y,c.x,c.y,!1):c.xa.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new G(a.x,Math.max((a.y+c.y)/2,a.y)),l=new G(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.xa.x&&h.top=a.x?(k.y=a.y>h.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,h.bottom,!0):a.y>h.top&&(180===d&&a.xh.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.top,l.x=c.x,l.y=k.y):270===d&&a.y>h.bottom&&a.x> h.left&&a.xg.right)90===d&&(h.da(a)||g.da(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.xa.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&& k.x=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new G(a.x,Math.min((a.y+c.y)/2,a.y)),l=new G(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x=cp&&(bk(q),h=q.vz,g.Uc(q.Vl*h,q.Ul* h),ap(q,a,b,p,d,g),h=bp(q,p.x,p.y));!q.abort&&h>=cp&&q.Yz&&(bk(q),ap(q,a,b,p,d,q.bounds),h=bp(q,p.x,p.y));if(!q.abort&&hthis.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.M(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)H.w(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.M(2,g,a.y),this.M(3,g,p.y)):H.w(g.y,p.y)?(Math.abs(a.y-g.y)<=q.Ul/2&&(this.M(2,g.x,a.y),this.M(3,p.x,a.y)),this.m(2, g.x,a.y)):this.M(2,a.x,g.y);else if(90===b||270===b)H.w(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.M(2,a.x,g),this.M(3,p.x,g)):H.w(g.x,p.x)?(Math.abs(a.x-g.x)<=q.Vl/2&&(this.M(2,a.x,g.y),this.M(3,a.x,p.y)),this.m(2,a.x,g.y)):this.M(2,g.x,a.y);null!==c&&(a=this.i(1),p=this.i(2),a.x!==p.x&&a.y!==p.y?0===b||180===b?this.m(2,a.x,p.y):this.m(2,p.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.lf(f.x,u.y):this.lf(u.x,f.y));b=!0}else b=!1}}}else b= !1;b||(this.ze(k),this.ze(l))}};R.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;this.hasCurviness()&&(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};function xj(a){if(null===a.diagram||!a.isAvoiding||!Xj(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=Yj(a.diagram,!0,a.containingGroup,null);for(var d=1;dfp&&bp(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>fp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>fp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),bp(b,l,m)===k-1?ep(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90=== e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),bp(b,l,m)===k-1&&ep(a,b,l,m,f,!1)));a.lf(c,d)}R.prototype.Fy=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Ab(b,a,c.x,c.y,d.x,d.y),f=0,g=1;gb)return a.type=xd,this.Qn=!1,a;var c=!1,d=this.diagram;null!==d&&Po(this)&&d.Yh.contains(this)&&(0!==this.yl.width||0!==this.yl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.xb.j;var g=this.computeCurve();if(g===tg&&3<=b&&!H.ca(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;kv?q>r?(g.x=w-y,g.y=r-y,b.x=w+u,b.y= r+u):(g.x=w-y,g.y=r+y,b.x=w+u,b.y=r-u):q>r?(g.x=w+y,g.y=r-y,b.x=w-u,b.y=r+u):(g.x=w+y,g.y=r+y,b.x=w-u,b.y=r-u));H.ca(v,w)&&H.ca(r,q)&&(r>p?(z>w?(g.x=w-y,g.y=r-y,b.x=w+u):(g.x=w+y,g.y=r-y,b.x=w-u),b.y=r+u):(z>w?(g.x=w-y,g.y=r+y,b.x=w+u):(g.x=w+y,g.y=r+y,b.x=w-u),b.y=r-u));if(H.ca(v,w)&&H.ca(w,z)||H.ca(p,r)&&H.ca(r,q))v=.5*(v+z),p=.5*(p+q),g.x=v,g.y=p,b.x=v,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&H.ca(c.x,this.i(0).x)&&H.ca(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Qd(h,e.x- d,e.y-k,g.x-d,g.y-k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=gp(this,e.copy(),!1,Fb));f=.5*(f+e.x);c=.5*(c+e.y);Qd(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=gp(this,g.copy(),!1,Fb)),Qd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=G.alloc();f.assign(this.i(0));g=1;for(e=0;g= b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=gp(this,m.copy(),!1,Fb)),jp(this,h,-d,-k,f,m,c);else if(0===e)for(g=1;gf.x?w=m.x-p:w=m.x+p,n.y>m.y?q=m.y+u:q=m.y-u,jp(this,h,g,l,f,new G(w,r),v),Rd(h,m.x+ g,m.y+l,z+g,q+l),f.h(z,q))):H.w(f.x,m.x)&&H.w(m.y,n.y)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.y-f.y)/2),p=u=Math.min(p,Math.abs(n.x-m.x)/2),H.w(u,0)?(jp(this,h,g,l,f,m,v),f.assign(m)):(w=m.x,r=m.y,z=w,q=r,m.y>f.y?r=m.y-p:r=m.y+p,n.x>m.x?z=m.x+u:z=m.x-u,jp(this,h,g,l,f,new G(w,r),v),Rd(h,m.x+g,m.y+l,z+g,q+l),f.h(z,q))):(jp(this,h,g,l,f,m,v),f.assign(m));g=e}G.free(f)}Ud=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=gp(this,e,!0,f)),0!==this.computeShortLength(!1)&& (h=gp(this,h,!1,f)),a.type=xd,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Qn=!1;return a};function ip(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return H.ca(a,0)?b:H.ca(b,0)?a:Math.sqrt(a*a+b*b)} function gp(a,b,c,d){var e=a.pointsCount;if(2>e)return b;if(c){var f=a.i(1);c=f.x-d.x;f=f.y-d.y;d=ip(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=ip(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b} function hp(a,b,c,d){for(var e=a.pointsCount,f=b;H.ca(b.x,f.x)&&H.ca(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!H.ca(b.x,f.x)&&!H.ca(b.y,f.y))return c-1;for(var g=f;H.ca(b.x,f.x)&&H.ca(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||H.ca(b.y,f.y)&&H.ca(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2} function jp(a,b,c,d,e,f,g){if(!g&&Po(a)){g=[];var h=0;a.isVisible()&&(h=kp(a,e,f,g));if(0 l-10)h--,l=Math.max(k-5,f.x);else break;k=f.y-10+d;l+=c;n=f.y+d;a.curve===pg?Ld(b,l,n,!1):Qd(b,m,k,l,k,l,n)}else if(H.w(e.x,f.x))if(e.yk-10)h--,k=Math.max(l-5,f.y);else break;l=f.x-10+c;n=f.x+c;k+=d;a.curve===pg?Ld(b,n,k,!1):Qd(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)} function kp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Fa.j;for(var g=f.length,h=0;hg.x&&m.x>=l.x||l.xg.y&&m.y>=l.y||l.yq&&Math.min(g,v)n&&!H.w(g,v)){h.x=q;h.y=n;m=!0;break a}}else if(!H.w(n,r)&& H.w(g,v)&&Math.min(n,r)g&&Math.min(q,u)m&&!H.w(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}G.free(h)}function Po(a){a=a.curve;return a===og||a===pg}function To(a,b){if(b||Po(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Yh.contains(a)||0===a.yl.width&&0===a.yl.height||b.Yh.add(a,a.yl.copy())} R.prototype.eq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isAnimating){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Fa.j;for(var g=e.length,h=0;ha&&va(a,">= 0",R,"fromEndSegmentLength"),this.P.Ng=a,this.g("fromEndSegmentLength",b,a),this.Ra())}}, fromShortLength:{get:function(){return null!==this.P?this.P.Og:NaN},set:function(a){this.Hc();var b=this.P.Og;b!==a&&(this.P.Og=a,this.g("fromShortLength",b,a),this.Ra(),this.ac())}},toSpot:{get:function(){return null!==this.P?this.P.oh:ad},set:function(a){this.Hc();var b=this.P.oh;b.A(a)||(a=a.I(),this.P.oh=a,this.g("toSpot",b,a),this.Ra())}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.mh: NaN},set:function(a){this.Hc();var b=this.P.mh;b!==a&&(0>a&&va(a,">= 0",R,"toEndSegmentLength"),this.P.mh=a,this.g("toEndSegmentLength",b,a),this.Ra())}},toShortLength:{get:function(){return null!==this.P?this.P.nh:NaN},set:function(a){this.Hc();var b=this.P.nh;b!==a&&(this.P.nh=a,this.g("toShortLength",b,a),this.Ra(),this.ac())}},isLabeledLink:{get:function(){return null===this.$c?!1:0=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);H.Tl(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Je(f),e=2;ed&&(d=-d)):H.ca(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Ce(e));a.push(d)}}return this.rr}},flattenedTotalLength:{get:function(){var a=this.au;if(isNaN(a)){for(var b=this.flattenedLengths, c=b.length,d=a=0;d=this.pointsCount?0:this.isOrthogonal|| !Uo(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!Uo(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Mm},set:function(a){var b=this.Mm;b!==a&&(this.Mm=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(this.gn=a,this.ac(),this.g("corner",b,a))}},curve:{ get:function(){return this.kn},set:function(a){var b=this.kn;b!==a&&(this.kn=a,this.Ra(),this.ac(),To(this,b===pg||b===og||a===pg||a===og),this.g("curve",b,a))}},curviness:{get:function(){return this.ln},set:function(a){var b=this.ln;b!==a&&(this.ln=a,this.Ra(),this.ac(),this.g("curviness",b,a))}},routing:{get:function(){return this.Gj},set:function(a){var b=this.Gj;b!==a&&(this.Gj=a,this.Jf=null,this.Ra(),To(this,2===(b.value& 2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(this.sp=a,this.ac(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.fm())return a.model.ic(this.data)}}});R.prototype.invalidateOtherJumpOvers=R.prototype.eq;R.prototype.findClosestSegment=R.prototype.Fy;R.prototype.updateRoute=R.prototype.$i;R.prototype.invalidateRoute=R.prototype.Ra; R.prototype.rollbackRoute=R.prototype.zx;R.prototype.commitRoute=R.prototype.mf;R.prototype.startRoute=R.prototype.Dh;R.prototype.clearPoints=R.prototype.Vj;R.prototype.removePoint=R.prototype.Bv;R.prototype.addPointAt=R.prototype.lf;R.prototype.addPoint=R.prototype.ze;R.prototype.insertPointAt=R.prototype.m;R.prototype.insertPoint=R.prototype.mz;R.prototype.setPointAt=R.prototype.M;R.prototype.setPoint=R.prototype.jd;R.prototype.getPoint=R.prototype.i;R.prototype.getOtherPort=R.prototype.bz; R.prototype.getOtherNode=R.prototype.Xs; var Jo=new D(R,"Normal",1),op=new D(R,"Orthogonal",2),pp=new D(R,"AvoidsNodes",6),Zo=new D(R,"AvoidsNodesStraight",7),qg=new D(R,"None",0),tg=new D(R,"Bezier",9),pg=new D(R,"JumpGap",10),og=new D(R,"JumpOver",11),Ko=new D(R,"End",17),Lo=new D(R,"Scale",18),Mo=new D(R,"Stretch",19),qn=new D(R,"OrientAlong",21),rm=new D(R,"OrientPlus90",22),tm=new D(R,"OrientMinus90",23),No=new D(R,"OrientOpposite",24),Oo=new D(R,"OrientUpright",25),sm=new D(R,"OrientPlus90Upright",26),um=new D(R,"OrientMinus90Upright", 27),vm=new D(R,"OrientUpright45",28);R.className="Link";R.Normal=Jo;R.Orthogonal=op;R.AvoidsNodes=pp;R.AvoidsNodesStraight=Zo;R.None=qg;R.Bezier=tg;R.JumpGap=pg;R.JumpOver=og;R.End=Ko;R.Scale=Lo;R.Stretch=Mo;R.OrientAlong=qn;R.OrientPlus90=rm;R.OrientMinus90=tm;R.OrientOpposite=No;R.OrientUpright=Oo;R.OrientPlus90Upright=sm;R.OrientMinus90Upright=um;R.OrientUpright45=vm;function np(a,b,c,d){ab(this);this.ie=this.Cr=!1;this.jt=a;this.vx=b;this.qv=c;this.wx=d;this.links=[]} np.prototype.dm=function(){if(!this.Cr){var a=this.links;0=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Jd=Math.floor((a.x-this.kc)/this.kc)*this.kc;this.Kd=Math.floor((b-this.lc)/this.lc)*this.lc;this.lo=Math.ceil((c+2*this.kc)/this.kc)*this.kc;this.mo=Math.ceil((d+2*this.lc)/this.lc)*this.lc;a=1+(Math.ceil((this.lo-this.Jd)/this.kc)|0);b=1+(Math.ceil((this.mo-this.Kd)/this.lc)|0);if(null===this.Bb||this.Nj=fp&&(a.Bb[b][c]=qp)} Zj.prototype.gk=function(a,b,c,d){if(a>this.lo||a+cthis.mo||b+da&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.Nj)|0;for(c=Math.min(b+e-1,this.Oj)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Bb[a][e]===dp)return!1;return!0}; function rp(a,b,c,d,e,f,g,h,k){if(!(bg||ck)){var l=b|0;var m=c|0;var n=a.Bb[l][m];if(n>=fp&&n=a.Bb[l][m]);)a.Bb[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0l;c+=d)rp(a,b,c,1,!e,f,g,h,k),rp(a,b,c,-1,!e,f,g,h,k);else if(0l;b+=d)rp(a,b,c,1,!e,f,g,h,k),rp(a,b,c,-1,!e,f,g,h, k)}}function sp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=dp,m=fp;for(a.Bb[b][c]=m;l===dp&&b>f&&bh&&cf&&bh&&c=Math.abs(g-b)&&1>=Math.abs(h-d))a.abort=!0;else{var k=f.x,l=f.y,m=f.x+f.width,n=f.y+f.height;k-=a.Jd;k/=a.kc;l-=a.Kd;l/=a.lc;m-=a.Jd;m/=a.kc;n-=a.Kd;n/=a.lc;f=Math.max(0,Math.min(a.Nj,k|0));m=Math.min(a.Nj,Math.max(0,m|0));l=Math.max(0,Math.min(a.Oj,l|0));n=Math.min(a.Oj,Math.max(0,n|0));g|=0;h|=0;b|=0;d|=0;k=0===c||90===c? 1:-1;c=90===c||270===c;a.Bb[g][h]===dp?(sp(a,g,h,k,c,f,m,l,n),sp(a,g,h,1,!c,f,m,l,n),sp(a,g,h,-1,!c,f,m,l,n)):sp(a,g,h,k,c,g,h,g,h);a.Bb[b][d]===dp?(tp(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),tp(a,b,d,1,!(90===e||270===e),f,m,l,n),tp(a,b,d,-1,!(90===e||270===e),f,m,l,n)):tp(a,b,d,k,c,b,d,b,d);a.abort||(rp(a,g,h,1,!1,f,m,l,n),rp(a,g,h,-1,!1,f,m,l,n),rp(a,g,h,1,!0,f,m,l,n),rp(a,g,h,-1,!0,f,m,l,n))}}} ma.Object.defineProperties(Zj.prototype,{bounds:{get:function(){return new N(this.Jd,this.Kd,this.lo-this.Jd,this.mo-this.Kd)}},Vl:{get:function(){return this.kc},set:function(a){0=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case 3:return c>a&&c<=180+a?180:270;case 5:return c>180-a&&c<=360-a?270:0;case 12:return c>a&&c<=180+a?90:0;case 10:return c>180-a&&c<=360-a?180:90;case 7:return 90180+a&&c<=360-a?270:0;case 13:return 180a&&180>=c?90:0;case 14:return c> a&&c<=180-a?90:c>180-a&&270>=c?180:0;case 11:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&15!==b&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}Xo.prototype.dm=function(){this.Wd.length=0}; function Yo(a,b){var c=a.Wd;if(0===c.length){a:if(!a.jq){c=a.jq;a.jq=!0;var d=null,e=a.node;e=e instanceof U?e:null;if(null===e||e.isSubGraphExpanded)var f=a.node.Yu(a.port.portId);else{if(!e.actualBounds.o()){a.jq=c;break a}d=e;f=d.Xu()}var g=a.Wd.length=0,h=a.port.ma(zc,G.alloc()),k=a.port.ma(Jc,G.alloc());e=N.allocAt(h.x,h.y,0,0);e.Je(k);G.free(h);G.free(k);h=G.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Mi();for(f=f.iterator;f.next();){var l=f.value;if(l.isVisible()&&l.fromPort!==l.toPort){var m= l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Vd(d),n=l.computeSpot(m,a.port);if(n.sf()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var r=p.findVisibleNode();null!==r&&r!==p&&(p=r,m=p.port);m=l.computeOtherPoint(p,m);p=h.Wa(m);p-=k;0>p&&(p+=360);n=up(e,n,p,l.isOrthogonal);0===n?(n=4,180Math.abs(u)?(z=Math.abs(u)/p,p=Math.abs(u)):z=1;break;case 2:r>Math.abs(y)?(z=Math.abs(y)/r,r=Math.abs(y)):z=1;break;case 1:n>Math.abs(u)?(z=Math.abs(u)/n,n=Math.abs(u)):z=1;break;default:case 4:m>Math.abs(y)?(z=Math.abs(y)/m,m=Math.abs(y)):z=1}w=0}var I=A.hq;if(d===Go){A=A.link.computeThickness(); A*=z;I.set(C);switch(q){case 8:I.x=C.x+u/2+p/2-w-A/2;break;case 2:I.y=C.y+y/2+r/2-w-A/2;break;case 1:I.x=C.x+u/2-n/2+w+A/2;break;default:case 4:I.y=C.y+y/2-m/2+w+A/2}w+=A}else{var K=.5;d===to&&(K=(A.aq+1)/(A.Xl+1));I.x=C.x+u*K;I.y=C.y+y*K}}}G.free(h);G.free(k);G.free(f);G.free(l);C=a.Wd;for(g=0;gb.yc?1:a.angleb.angle?1:0};Xo.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,yc,b.fromPort===this.port),d=a.aq;if(0>d)return c;var e=a.Xl;if(1>=e||!b.isOrthogonal)return c;b=a.uv;var f=a.hq;if(2===a.yc||8===a.yc)d=e-1-d;return((a=2===a.yc||4===a.yc)?b.y=c-1?(g=0,e=d,f+=h+20,h=0):g++}null!==a&&a.Za("Layout")}this.isValidLayout=!0};gi.prototype.pk=function(a){return!a.location.o()||a instanceof U&&a.pk?!0:!1}; function xp(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof V?k.isLinkLabel||(k instanceof U?null===k.layout?xp(a,b,k.memberParts,!1,e,f,g,h):(yp(k),b.add(k)):(yp(k),b.add(k))):g&&k instanceof R?b.add(k):!h||!k.bc()||k instanceof V||(yp(k),b.add(k)))}}function yp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.$b()} gi.prototype.Oi=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new N),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};gi.prototype.Vw=function(a){var b=new F;a instanceof P?(xp(this,b,a.nodes,!0,null,!0,!0,!0),xp(this,b,a.links,!0,null,!0,!0,!0),xp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof U?xp(this,b,a.memberParts,!1,null,!0,!0,!0):xp(this,b,a.iterator,!1,null,!0,!0,!0);return b}; gi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ma(zc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a}; ma.Object.defineProperties(gi.prototype,{diagram:{get:function(){return this.C},set:function(a){this.C=a}},group:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a,null!==a&&(this.C=a.diagram))}},isOngoing:{get:function(){return this.Sn},set:function(a){this.Sn!==a&&(this.Sn=a)}},isInitial:{get:function(){return this.Of},set:function(a){this.Of=a;a||(this.Xn=!0)}}, isViewportSized:{get:function(){return this.Yn},set:function(a){this.Yn!==a&&(this.Yn=a)&&this.B()}},isRouting:{get:function(){return this.Vn},set:function(a){this.Vn!==a&&(this.Vn=a)}},isRealtime:{get:function(){return this.Un},set:function(a){this.Un!==a&&(this.Un=a)}},isValidLayout:{get:function(){return this.Xn},set:function(a){this.Xn!==a&&(this.Xn=a,a||(a=this.diagram,null!== a&&(a.Dg=!0)))}},network:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a,this.B())}},arrangementOrigin:{get:function(){return this.Qm},set:function(a){this.Qm.A(a)||(this.Qm.assign(a),this.B())}}});gi.prototype.collectParts=gi.prototype.Vw;gi.prototype.getLayoutBounds=gi.prototype.Oi; gi.prototype.invalidateLayout=gi.prototype.B;gi.className="Layout";function wp(a){ab(this);this.gc=a;this.jf=new F;this.ee=new F;this.kt=new vb;this.ft=new vb}wp.prototype.clear=function(){if(this.jf)for(var a=this.jf.iterator;a.next();)a.value.clear();if(this.ee)for(a=this.ee.iterator;a.next();)a.value.clear();this.jf=new F;this.ee=new F;this.kt=new vb;this.ft=new vb}; wp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.layout?"("+this.layout.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.jf.count+" edges: "+this.ee.count;if(1b?1:0):1:null!==b?-1:0} ma.Object.defineProperties(zp.prototype,{sourceEdgesArrayAccess:{get:function(){return this.yg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.pg._dataArray}},data:{get:function(){return this.jb},set:function(a){this.jb=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.u.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{get:function(){return this.mi}, set:function(a){if(this.mi!==a){this.mi=a;a.$b();var b=this.network.layout,c=N.alloc(),d=b.Oi(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);N.free(c);if(!(a instanceof U)&&(a=a.locationObject.ma(Fc),a.o())){this.u.h(a.x-b,a.y-e);return}this.u.h(f/2,d/2)}}},bounds:{get:function(){return this.l},set:function(a){this.l.A(a)||this.l.assign(a)}},focus:{get:function(){return this.u},set:function(a){this.u.A(a)|| this.u.assign(a)}},centerX:{get:function(){return this.l.x+this.u.x},set:function(a){var b=this.l;b.x+this.u.x!==a&&(b.ha(),b.x=a-this.u.x,b.freeze())}},centerY:{get:function(){return this.l.y+this.u.y},set:function(a){var b=this.l;b.y+this.u.y!==a&&(b.ha(),b.y=a-this.u.y,b.freeze())}},focusX:{get:function(){return this.u.x},set:function(a){var b=this.u;b.x!==a&&(b.ha(),b.x=a,b.freeze())}},focusY:{ get:function(){return this.u.y},set:function(a){var b=this.u;b.y!==a&&(b.ha(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ha(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ha(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ha(),b.width= a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ha(),b.height=a,b.freeze())}},network:{get:function(){return this.Vc},set:function(a){this.Vc=a}},sourceVertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new F,b= this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{get:function(){return this.yg.iterator}},destinationEdges:{get:function(){return this.pg.iterator}},edges:{get:function(){for(var a= new E,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{get:function(){return this.yg.count+this.pg.count}}});zp.prototype.deleteDestinationEdge=zp.prototype.Su;zp.prototype.addDestinationEdge=zp.prototype.Gu;zp.prototype.deleteSourceEdge=zp.prototype.Tu;zp.prototype.addSourceEdge=zp.prototype.Iu;zp.className="LayoutVertex";zp.standardComparer=Fp; zp.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.mi;var c=b.mi;if(null!==a){if(null!==c){b=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);a=c.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(c=0;c=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.Aa("Layout");d=[];switch(this.alignment){case Op:var h=b,k=c,l=N.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;nf-1||0g)d.push(new N(0,u,g+h,w)),v=0,q=r,u+=w,w=0;w=Math.max(w,I);switch(p){case Np:A=-A.width;break;default:A= 0}y.moveTo(q+A,u);switch(p){case Np:q-=C;break;default:q+=C}v++}d.push(new N(0,u,g+h,w));N.free(l);break;case Gp:k=g;m=f;n=b;p=c;g=N.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=G.alloc();for(q=0;q=l&&(k-=l);l=y=0;C=Math.max(this.cellSize.height,1);A=f=0;I=!0;v=G.alloc();for(K=0;Km-1||0k){d.push(new N(0,I?z-f:z,k+n,A+f+p));for(J=0;Jl&&(f.width+=f.x-l,f.x=l);N.free(g)}for(h=f=g=e=0;hb?1:0} ma.Object.defineProperties(qk.prototype,{wrappingWidth:{get:function(){return this.Kp},set:function(a){this.Kp!==a&&(0n)){var u=n+Im(q);q.xc(u,!0);Tm(q,u,n)}}b.isModified=!0}}finally{b.ea=!0}}}}};bi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ea(a);for(b=this.nodes.iterator;b.next();)b.value.Ea(a);for(b=this.links.iterator;b.next();)b.value.Ea(a)}; bi.prototype.xq=function(){for(var a=this.C.model,b=new F,c=a.nodeDataArray,d=0;df?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'}; t.Am=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.Am(a.valueOf()):za(a)?rq(this,a):ya(a)?oq(this,a):"function"===typeof a?"null":a.toString()}; function rq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new cb;e.add("[ ");c&&1d)return;Ca(a.Fc,d)}yq(a,"nodeDataArray",ue,"nodeDataArray",a,b,null,d,null);a.wq(b)}t.Nz=function(a){if(za(a))for(var b=a.length,c=0;cb&&(b=a.length);Ba(a,b,c);yq(this,"",te,"",a,null,c,null,b)};t.zv=function(a,b){void 0===b&&(b=-1);a===this.Fc&&B("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ca(a,b);yq(this,"",ue,"",a,c,null,b,null)}; t.Vs=function(a){if(null===a)return"";var b=this.yj;if(""===b)return"";b=Um(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};t.tq=function(a,b){if(null!==a){var c=this.yj;if(""!==c)if(this.Pb(a)){var d=Um(a,c);void 0===d&&(d="");d!==b&&(zj(a,c,b),yq(this,"nodeCategory",re,c,a,d,b))}else zj(a,c,b)}};t.gm=function(){return!1};t.ek=function(){return!1};t.fm=function(){return!1};t.dt=function(){return!1};t.fk=function(){return!1}; function fi(){return new Z}function uq(a,b){if("function"===typeof b){if(b.className)return b.className;if(b.name)return b.name}else if("object"===typeof b&&null!==b&&b.constructor)return uq(a,b.constructor);return typeof b}function Um(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){}return c} function zj(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){}} ma.Object.defineProperties(Z.prototype,{name:{get:function(){return this.Ua},set:function(a){var b=this.Ua;b!==a&&(this.Ua=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.mn},set:function(a){var b=this.mn;b!==a&&(this.mn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("isReadOnly",b,a))}},modelData:{ get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.g("modelData",b,a),this.Ea(a))}},undoManager:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(null!==b&&b.yx(this),this.u=a,null!==a&&a.Rw(this))}},skipsUndoManager:{get:function(){return this.fh},set:function(a){this.fh=a}},nodeKeyProperty:{get:function(){return this.ni},set:function(a){var b=this.ni; b!==a&&(""===a&&B("Model.nodeKeyProperty may not be the empty string"),0d.indexOf(a.newValue)&&d.splice(c, 0,a.newValue));return}}else if(a.change===ue){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;ya(a)&&"number"===typeof c&&(d=this.ic(a),b?(this.Qf.add(a),this.Oc[c]!==a&&this.Oc.splice(c,0,a),void 0!==d&&this.qb.add(d,a)):(this.Qf.remove(a),this.Oc[c]===a&&this.Oc.splice(c,1),void 0!==d&&this.qb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.tg(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue), 0<=c&&d.splice(c,1)));return}}Z.prototype.Tj.call(this,a,b)};t.hm=function(a){if(void 0!==a){var b=this.bj;if(null!==b){var c=this.Qb(a);null===c&&(c=this.copyNodeData(b),zj(c,this.nodeKeyProperty,a),this.kf(c))}return a}};t.Zy=function(a){return bq(this,a,!0)};t.Cx=function(a,b){jq(this,a,b,!0)};t.dz=function(a){return bq(this,a,!1)};t.Hx=function(a,b){jq(this,a,b,!1)}; function bq(a,b,c){if(null!==b&&(a=c?a.Ve:a.We,""!==a&&(a=Um(b,a),void 0!==a))){if(dq(a))return a;B((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}function jq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.Ve:a.We;if(""!==e)if(c=a.hm(c),a.Be(b)){var f=Um(b,e);f!==c&&(hq(a,f,b),zj(b,e,c),null===a.Qb(c)&&iq(a,c,b),yq(a,d?"linkFromKey":"linkToKey",re,e,b,f,c),"string"===typeof e&&a.Ea(b,e))}else zj(b,e,c)}}t.$y=function(a){return aq(this,a,!0)}; t.Ex=function(a,b){kq(this,a,b,!0)};t.ez=function(a){return aq(this,a,!1)};t.Ix=function(a,b){kq(this,a,b,!1)};function aq(a,b,c){if(null===b)return"";a=c?a.uj:a.vj;if(""===a)return"";b=Um(b,a);return void 0===b?"":b}function kq(a,b,c,d){if(null!==b){var e=d?a.uj:a.vj;if(""!==e)if(a.Be(b)){var f=Um(b,e);void 0===f&&(f="");f!==c&&(zj(b,e,c),yq(a,d?"linkFromPortId":"linkToPortId",re,e,b,f,c),"string"===typeof e&&a.Ea(b,e))}else zj(b,e,c)}} t.tg=function(a){if(null===a)return Dq;var b=this.Hd;if(""===b)return Dq;a=Um(a,b);return void 0===a?Dq:a};t.Jv=function(a,b){if(null!==a){var c=this.Hd;if(""!==c)if(this.Be(a)){var d=Um(a,c);void 0===d&&(d=Dq);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;fe||(d.splice(e,1),this.Be(a)&&(hq(this,b,a),yq(this,"linkLabelKeys",ue,c,a,b,null,e,null)))}else void 0!==d&&B(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.ic=function(a){if(null!==a){var b=this.ji;if(""!==b&&(b=Um(a,b),void 0!==b)){if(dq(b))return b;B("Key value for link data "+a+" is not a number or a string: "+b)}}}; t.vt=function(a,b){if(null!==a){var c=this.ji;if(""!==c)if(this.Be(a)){var d=Um(a,c);d!==b&&null===this.yh(b)&&(zj(a,c,b),void 0!==d&&this.qb.remove(d),this.qb.add(b,a),yq(this,"linkKey",re,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else zj(a,c,b)}};t.yh=function(a){null===a&&B("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&dq(a)?this.qb.J(a):null}; t.iq=function(a){if(null!==a){var b=this.ji;if(""!==b){var c=this.ic(a);if(void 0===c||this.qb.contains(c)){var d=this.ql;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.qb.contains(c))){zj(a,b,c);return}if("string"===typeof c){for(d=2;this.qb.contains(c+d);)d++;zj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.qb.count-1;this.qb.contains(c);)c--;zj(a,b,c)}}}}};t.Be=function(a){return null===a?!1:this.Qf.contains(a)};t.Di=function(a){null!==a&&(ob(a),this.Be(a)||fq(this,a,!0))}; function fq(a,b,c){if(""!==a.linkKeyProperty){var d=a.ic(b);if(void 0!==d&&a.qb.J(d)===b)return;a.iq(b);d=a.ic(b);if(void 0===d){B("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.qb.add(d,b)}a.Qf.add(b);d=null;c&&(d=a.Oc.length,a.Oc.splice(d,0,b));yq(a,"linkDataArray",te,"linkDataArray",a,null,b,null,d);Eq(a,b)}t.gy=function(a){if(Array.isArray(a))for(var b=a.length,c=0;cd)return;a.Oc.splice(d,1)}yq(a,"linkDataArray",ue,"linkDataArray",a,b,null,d,null);c=bq(a,b,!0);hq(a,c,b);c=bq(a,b,!1);hq(a,c,b);d=a.tg(b);if(Array.isArray(d))for(var e=d.length,f=0;f=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new E;b.addAll(a.iterator);a=new E;var c=new E;var d=this.sort(b);var e,f,g=this.Xq;var h=this.arrangement;var k=this.nodeDiameterFormula;var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle; isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===Wq&&k===Xq?h=Hq:h===Wq&&k!==Xq&&(h=this.arrangement);if((this.direction===Rq||this.direction===Sq)&&this.sorting!==Kq){for(k=0;!(k>=d.length);k+=2){a.add(d.N(k));if(k+1>=d.length)break;c.add(d.N(k+1))}this.direction===Rq?(this.arrangement===Wq&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Wq&&c.reverse(),d=new E,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r< d.length;r++){var q=n+p*f*(this.direction===Jq?1:-1)/k,u=d.N(r).diameter;isNaN(u)&&(u=Zq(d.N(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Wq){isNaN(b)&&(b=6);if(h!==Hq&&h!==Wq){f=-Infinity;for(g=0;gl?(l=e,f=l*m):g= r/(360<=p?k:k-1)}this.uw=h;this.Xb=l;this.zn=m;this.vw=n;this.kr=p;this.hj=b;this.Rd=f;this.Xq=g;b=d;d=this.uw;h=this.Xb;l=this.vw;m=this.kr;n=this.hj;p=this.Rd;k=this.Xq;if(this.direction!==Rq&&this.direction!==Sq||d!==Wq)if(this.direction===Rq||this.direction===Sq){g=0;switch(d){case Vq:g=180*br(this,h,p,l,k)/Math.PI;break;case Hq:k=b=0;g=a.first();null!==g&&(b=Zq(g,Math.PI/2));g=c.first();null!==g&&(k=Zq(g,Math.PI/2));g=180*br(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Uq:g=m/b.length}if(this.direction=== Rq){switch(d){case Vq:cr(this,a,l,Tq);break;case Hq:dr(this,a,l,Tq);break;case Uq:er(this,a,m/2,l,Tq)}switch(d){case Vq:cr(this,c,l+g,Jq);break;case Hq:dr(this,c,l+g,Jq);break;case Uq:er(this,c,m/2,l+g,Jq)}}else{switch(d){case Vq:cr(this,c,l,Tq);break;case Hq:dr(this,c,l,Tq);break;case Uq:er(this,c,m/2,l,Tq)}switch(d){case Vq:cr(this,a,l+g,Jq);break;case Hq:dr(this,a,l+g,Jq);break;case Uq:er(this,a,m/2,l+g,Jq)}}}else switch(d){case Vq:cr(this,b,l,this.direction);break;case Hq:dr(this,b,l,this.direction); break;case Uq:er(this,b,m,l,this.direction);break;case Wq:fr(this,b,m,l,this.direction)}else fr(this,b,m,l-m/2,Jq)}this.updateParts();this.network=null;this.isValidLayout=!0};function er(a,b,c,d,e){var f=a.kr,g=a.Xb;a=a.Rd;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;kc){for(f=d+(e===Jq?f:-f);0>f;)f+=360;f%=360;180=m.length-1)break;ir(a,k,l,m,n,e,f)||jr(a,k,l,m,n,e,f);k=f.x;l=f.y}G.free(f);a.Aj++;if(!(23Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0Math.abs(p)? 0:p;k=Math.abs(f)>Math.abs(n)?0n:0a.Aj?a.Xb-g/(2*Math.PI):5>m.length&&10=n.length-1)break;ir(a,k,l,n,p,e,m)||jr(a,k,l,n,p,e,m);k=m.x;l=m.y}G.free(m);a.Aj++;if(!(23a.Aj?a.Xb-f/(2*Math.PI):a.Xb-(0h){f=b-a;if(f<-h)return g.x=f,g.y=l,!1;m=!0}}else if(f=b-a,f<-h){f=b+a;if(f>h)return g.x=f,g.y=l,!1;m=!0}l=Math.sqrt(1-Math.min(1,f*f/(h*h)))*k;0>c!==m&&(l=-l);if(Math.abs(c-l)>(d[e].height+d[e+1].height)/2)return g.x=f,g.y=l,!1;g.x=f;g.y=l;return!0} function jr(a,b,c,d,e,f,g){var h=a.Xb,k=a.Rd,l=0;a=(d[e].height+d[e+1].height)/2+a.hj;d=!1;if(0<=b!==(f===Jq)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}Gq.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()}; Gq.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new G(0,0):(c.x=this.arrangementOrigin.x+this.Xb,c.y=this.arrangementOrigin.y+this.Rd);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.$b(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.Xd(c.Xd(a)),this.group.move(b),this.hw=b.Xd(a))}; Gq.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function ar(a,b,c,d,e){var f=a.Ux;if(.001>Math.abs(a.zn-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g} function $q(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?ar(a,1,c,d,e):ar(a,1,c))}function br(a,b,c,d,e){if(.001>Math.abs(a.zn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}} Gq.prototype.sort=function(a){switch(this.sorting){case Pq:break;case Qq:a.reverse();break;case Mq:a.sort(this.comparer);break;case Oq:a.sort(this.comparer);a.reverse();break;case Kq:for(var b=[],c=0;ce&&(e=h,f=g)}else for(g=0;ge&&(e=h,f=g);c.add(a.N(f));b[f]=-1;f=a.N(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<= b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(b=0;ba[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;ba[b[q]].indexOf(b[q===b.length-1?0:q+1])&&r.push(q===b.length-1?0:q+1);if(0===r.length)for(q=0;qb.indexOf(I)||Cb.indexOf(I)||C=u?C+1:C)),w+=C=u&&C++,y>=u&&y++,C>y&&(A=y,y=C,C=A),y-C<(b.length+2)/2===(Cr||r===m||(q=r>m?r-m:m-r,n+=rg-q?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a=a?this.Ll=a:this.Ll=360,this.B())}},arrangement:{get:function(){return this.Ab},set:function(a){this.Ab===a||a!==Wq&&a!==Hq&&a!==Vq&&a!==Uq||(this.Ab=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L===a||a!==Jq&&a!==Tq&&a!==Rq&&a!==Sq||(this.L=a,this.B())}},sorting:{get:function(){return this.Qc},set:function(a){this.Qc===a||a!==Pq&&a!==Qq&& a!==Mq&&!Oq&&a!==Kq||(this.Qc=a,this.B())}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a,this.B())}},spacing:{get:function(){return this.af},set:function(a){this.af!==a&&(this.af=a,this.B())}},nodeDiameterFormula:{get:function(){return this.Eo},set:function(a){this.Eo===a||a!==Lq&&a!==Xq||(this.Eo=a,this.B())}},actualXRadius:{get:function(){return this.Xb}}, actualYRadius:{get:function(){return this.Rd}},actualSpacing:{get:function(){return this.hj}},actualCenter:{get:function(){return this.hw}}}); var Hq=new D(Gq,"ConstantSpacing",0),Vq=new D(Gq,"ConstantDistance",1),Uq=new D(Gq,"ConstantAngle",2),Wq=new D(Gq,"Packed",3),Jq=new D(Gq,"Clockwise",4),Tq=new D(Gq,"Counterclockwise",5),Rq=new D(Gq,"BidirectionalLeft",6),Sq=new D(Gq,"BidirectionalRight",7),Pq=new D(Gq,"Forwards",8),Qq=new D(Gq,"Reverse",9),Mq=new D(Gq,"Ascending",10),Oq=new D(Gq,"Descending",11),Kq=new D(Gq,"Optimized",12),Lq=new D(Gq,"Pythagorean",13),Xq=new D(Gq,"Circular",14);Gq.className="CircularLayout";Gq.ConstantSpacing=Hq; Gq.ConstantDistance=Vq;Gq.ConstantAngle=Uq;Gq.Packed=Wq;Gq.Clockwise=Jq;Gq.Counterclockwise=Tq;Gq.BidirectionalLeft=Rq;Gq.BidirectionalRight=Sq;Gq.Forwards=Pq;Gq.Reverse=Qq;Gq.Ascending=Mq;Gq.Descending=Oq;Gq.Optimized=Kq;Gq.Pythagorean=Lq;Gq.Circular=Xq;function Iq(){this.bm=-Infinity;this.Bm=this.wk=null} Iq.prototype.compare=function(a,b){if(0this.bm||Math.abs(a)a&&0f?(e=r.x+r.width/2,h=r.y+r.height/2,k[0]=new G(r.x+r.width+d.width,r.y),k[1]=new G(r.x,r.y+r.height+d.height),f=2):(m=pr(k,f,e,h,r.width,r.height,d),p=k[m],n=new G(p.x+r.width+d.width,p.y),r=new G(p.x,p.y+r.height+ d.height),m+1this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Ic(c)&&(a++,2a.network.vertexes.count)return!1;a.qh=a.network.vertexes.Na();a=a.qh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.td-a.td});for(b=a.length-1;0<=b&&1>=a[b].td;)b--;return 1=g))){for(var l=h=0,m=k.count-g;mr&& (r=1);h=H.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new N(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new G(p.x+g,p.y+h)}}a.network=d;return c}function tr(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.He){var e=d.He.N(d.Gv);d.td=e.Bt;var f=e.cw,g=e.dw;d.bounds=new N(d.centerX-f,d.centerY-g,e.Ct,e.At);d.focus=new G(f,g);d.Gv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b} function ur(a,b){var c=b.Wj;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.He&&0=n.td?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0>1)+l)*(0===h%2?1:-1);k.centerX=d+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}} function pr(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;lm.y&&a[p].x-m.xm.x&&a[p].y-m.yb+f?(c=d+e-g,a=a-b-f,H.sqrt(c*c+a*a)):a+cg+h?a>b+f?(c=d-g-h,a=a-b-f,H.sqrt(c*c+a*a)):a+cb+f?a-(b+f):a+c=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.centerX,e=d,f=c=c.centerY,g=1;gf-c)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerX-b.centerX}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerY-b.centerY});c=a.Mf;var l=d=h=0;for(f= 0;fc||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=wr(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new yr),q=d.random(), h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):kr?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):kn?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new yr),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;d=0;e=a.moveLimit;for(c=0;ce&&(g=e),k<-e?k=-e:k>e&&(k=e),f.centerX+=g,f.centerY+=k,d=Math.max(d,g*g+k*k));return d>a.epsilonDistance*a.epsilonDistance}mr.prototype.moveFixedVertex=function(){};mr.prototype.commitLayout=function(){this.Lv();this.commitNodes();this.isRouting&&this.commitLinks()};mr.prototype.Lv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=ad,b.toSpot=ad)}}; mr.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=N.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;N.free(c)}c=N.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}N.free(c)};mr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()}; mr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Rk:a};mr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Qk:a};mr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Ok:a};mr.prototype.electricalFieldX=function(){return 0};mr.prototype.electricalFieldY=function(){return 0};mr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Pk:a};mr.prototype.gravitationalFieldX=function(){return 0}; mr.prototype.gravitationalFieldY=function(){return 0};mr.prototype.isFixed=function(a){return a.isFixed}; ma.Object.defineProperties(mr.prototype,{currentIteration:{get:function(){return this.$n}},arrangementSpacing:{get:function(){return this.wd},set:function(a){this.wd.A(a)||(this.wd.assign(a),this.B())}},arrangesToOrigin:{get:function(){return this.Rm},set:function(a){this.Rm!==a&&(this.Rm=a,this.B())}},setsPortSpots:{get:function(){return this.$e},set:function(a){this.$e!==a&&(this.$e= a,this.B())}},comments:{get:function(){return this.Xc},set:function(a){this.Xc!==a&&(this.Xc=a,this.B())}},maxIterations:{get:function(){return this.rl},set:function(a){this.rl!==a&&0<=a&&(this.rl=a,this.B())}},epsilonDistance:{get:function(){return this.Cn},set:function(a){this.Cn!==a&&0u&&0u&&0a[this.od]&&(this.Qr=a[c]-1,this.od=c),a[c]g)for(var m=g+1;mk;m--)n=d[m],n.near===l&&n.Rj===l.Rj||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;lu||n===u&&r>q)&&h++;vn||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;lu||n===u&&m>v)&&h++,qn||u===n&&v>m)&&h++);f[g*e+g]=h;for(k=g+ 1;k=c)for(h=d[g].destinationEdgesArrayAccess,y=d[k].destinationEdgesArrayAccess,l=0;l=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}Lr(a,b,d);return f}function Tr(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&Tr(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&Tr(a,k,c,d,e,f)}} function Ur(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Ur(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Ur(a,b.value.fromVertex,c,d,e,f)}} Br.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Mk){default:case Vr:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==Wr(a);){for(e=Xr(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Xr(a);for(e=Yr(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Yr(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&& k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||fb.toVertex.index&&(a.tm(b),b.rev=!0);break;case Cr:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Yl=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.Ao=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&& Zr(this,b);for(d.reset();d.next();)b=d.value,-1===b.Yl&&Zr(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.Yld){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;cg&&Tr(a,h,0,-1,!0,!1)}for(Tr(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess; e=p.length;for(var r=0;rf)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}} function Jr(a,b,c){return 90===a.L?c&&!b.rev||!c&&b.rev?270:90:180===a.L?c&&!b.rev||!c&&b.rev?0:180:270===a.L?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0} Br.prototype.initializeIndices=function(){switch(this.cl){default:case fs:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.fc[c];this.fc[c]++}break;case Er:a=this.network.vertexes.iterator;for(b=this.ya;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&gs(this,c);break;case hs:for(a=this.network.vertexes.iterator,b=0;b<=this.ya;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&is(this,c)}}; function gs(a,b){var c=b.layer;b.index=a.fc[c];a.fc[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;df.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;cf.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c=g;d--)f=ks(this,d,-1)||f;e=this.countCrossings();e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ks(this,d,1)||f;e=this.countCrossings();e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ks(this,d,1)||f;e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f= ks(this,d,-1)||f;e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ks(this,d,0)||f;e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ks(this,d,0)||f;e>=a?Or(this,b):(a=e,b=Nr(this))}break;default:case Fr:for(c=this.ya,g=0,h=a+1;(d=this.countCrossings())=g;d--)f=ks(this,d,-1)||f;e=this.countCrossings();e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ks(this,d,1)||f;e=this.countCrossings();e>=a?Or(this,b): (a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ks(this,d,1)||f;e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ks(this,d,-1)||f;e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ks(this,d,0)||f;e>=a?Or(this,b):(a=e,b=Nr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ks(this,d,0)||f;e>=a?Or(this,b):(a=e,b=Nr(this))}}Or(this,b)}; function js(a,b,c){var d=Kr(a,b),e=a.fc[b],f=Sr(a,b,c),g=Rr(a,b,c);for(c=0;cf+1&&(p+=4*(z-f),r+=4*(z-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(z=A.value,y=z.toVertex,z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;z===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(z=A.value,y=z.fromVertex,z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;zf+1&&(p+=4*(z-(f+1)),r+=4*(z-f))}A=d[f+1].destinationEdges.iterator; for(A.reset();A.next();)if(z=A.value,y=z.toVertex,z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;z===f&&(p+=1)}z=y=0;A=g[d[f].index];var C=h[d[f].index],I=g[d[f+1].index],K=h[d[f+1].index];-1!==A&&(y+=Math.abs(A-q),z+=Math.abs(A-w));-1!==C&&(y+=Math.abs(C-q),z+=Math.abs(C-w));-1!==I&&(y+=Math.abs(I-u),z+=Math.abs(I-v));-1!==K&&(y+=Math.abs(K-u),z+=Math.abs(K-v));if(r>1)+8*d;this.Ha*=8}if(0!==(this.cg&2))for(c=!0;c;){c=!1;for(b=this.od+1;b<=this.ya;b++)c=ns(this,b,1)||c;for(b= this.od-1;0<=b;b--)c=ns(this,b,-1)||c;c=ns(this,this.od,0)||c}if(0!==(this.cg&4)){for(b=this.od+1;b<=this.ya;b++)os(this,b,1);for(b=this.od-1;0<=b;b--)os(this,b,-1);os(this,this.od,0)}a&&(ps(this,-1),ps(this,1));if(0!==(this.cg&2))for(c=!0;c;){c=!1;c=ns(this,this.od,0)||c;for(b=this.od+1;b<=this.ya;b++)c=ns(this,b,0)||c;for(b=this.od-1;0<=b;b--)c=ns(this,b,0)||c}};function ns(a,b,c){for(var d=!1;qs(a,b,c);)d=!0;return d} function qs(a,b,c){var d,e=Kr(a,b),f=a.fc[b],g=Rr(a,b,-1);if(0c)for(d=0;dd-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=0;if(0>=c)for(var v=e[d].sourceEdges.iterator;v.next();){var w=v.value;var z=w.fromVertex; if(w.valid&&z.layer!==b){var y=Mr(w);var A=w.portFromColOffset;w=w.portToColOffset;z=z.column;p+=(Math.abs(m+w-(z+A))+1)*y;q+=(Math.abs(r+w-(z+A))+1)*y;u+=(Math.abs(n+w-(z+A))+1)*y}}if(0<=c)for(v=e[d].destinationEdges.iterator;v.next();)w=v.value,z=w.toVertex,w.valid&&z.layer!==b&&(y=Mr(w),A=w.portFromColOffset,w=w.portToColOffset,z=z.column,p+=(Math.abs(m+A-(z+w))+1)*y,q+=(Math.abs(r+A-(z+w))+1)*y,u+=(Math.abs(n+A-(z+w))+1)*y);w=A=y=0;v=g[e[d].index];z=h[e[d].index];-1!==v&&(y+=Math.abs(v-m),A+= Math.abs(v-r),w+=Math.abs(v-n));-1!==z&&(y+=Math.abs(z-m),A+=Math.abs(z-r),w+=Math.abs(z-n));if(q=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}Lr(a,b,d);a.normalize()} function rs(a,b){for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a} function ss(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ya;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.ya;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c} function ps(a,b){for(var c=0;c<=a.Ha;c++)for(;rs(a,c););a.normalize();for(c=0;cf?Or(a,e):gb)for(c=a.Ha;0<=c;c--)for(e=Nr(a),f=Qr(a),d=f+1;ff?Or(a,e):gc)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Ld);a.Ld++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Ur(a,b,a.Ld,-1,!0,!0),a.Ld++);var f;b=[];for(f=0;fc)for(g=a.Ha;0c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)} Br.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ir(this,!0),b=Ir(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.Ou();this.isRouting&&this.commitLinks()};function Ir(a,b){return 270===a.L?b?fd:nd:90===a.L?b?nd:fd:180===a.L?b?ld:md:b?md:ld} Br.prototype.commitNodes=function(){this.Gd=[];this.md=[];this.ld=[];this.Ka=[];for(var a=0;a<=this.ya;a++)this.Gd[a]=0,this.md[a]=0,this.ld[a]=0,this.Ka[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Gd[c]=Math.max(this.Gd[c],this.nodeMinLayerSpace(b,!0));this.md[c]=Math.max(this.md[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ke;for(var d=0;d<=this.ya;d++){var e=c;0>=this.Gd[d]+this.md[d]&&(e=0);0=n.bounds.bottom? (n=n.bounds.y+n.bounds.height,b.m(q++,y,n+C),b.m(q++,y,n),b.m(q++,y,n-z)):(b.m(q++,y,A+C),b.m(q++,y,A),b.m(q++,y,A-z)):270===this.L?A<=n.bounds.y?(n=n.bounds.y,b.m(q++,y,n-z),b.m(q++,y,n),b.m(q++,y,n+C)):(b.m(q++,y,A-z),b.m(q++,y,A),b.m(q++,y,A+C)):0===this.L&&(y>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+C,A),b.m(q++,n,A),b.m(q++,n-z,A)):(b.m(q++,y+C,A),b.m(q++,y,A),b.m(q++,y-z,A)));else{b.m(q++,v,w);var I=0;if(180===this.L||0===this.L){if(180===this.L?y>=n.bounds.right:y<=n.bounds.x)I= (0===this.L?-z:C)/2;b.m(q++,v+I,A)}else{if(270===this.L?A>=n.bounds.bottom:A<=n.bounds.y)I=(90===this.L?-z:C)/2;b.m(q++,y,w+I)}b.m(q++,y,A)}}else z=Math.max(10,this.Gd[u.layer]),C=Math.max(10,this.md[u.layer]),180===this.L?(r&&b.m(q++,y-z,A),b.m(q++,y,A),r&&b.m(q++,y+C,A)):90===this.L?(r&&b.m(q++,y,A+C),b.m(q++,y,A),r&&b.m(q++,y,A-z)):270===this.L?(r&&b.m(q++,y,A-z),b.m(q++,y,A),r&&b.m(q++,y,A+C)):(r&&b.m(q++,y+C,A),b.m(q++,y,A),r&&b.m(q++,y-z,A))}n=u}if(null===h||l!==yc||p)if(v=b.i(q-1).x,w=b.i(q- 1).y,y=b.i(q).x,A=b.i(q).y,p)n=this.md[m.layer],180===this.L||0===this.L?(p=w,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.L?y>=m.bounds.x:y<=m.bounds.right)&&(n=m.centerX+(180===this.L?-n:n),p=m.bounds.x&&p<=m.bounds.right&&(270===this.L?A>=m.bounds.y:A<=m.bounds.bottom)&&(n=m.centerY+(270===this.L?-n:n),p=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.M(q-2,n,w),b.M(q-1,n+C,w)):90===this.L&&A<=m.bounds.bottom?(n=m.bounds.y,b.M(q-2,v,n),b.M(q-1,v,n-z)):270===this.L&&A>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.M(q-2,v,n),b.M(q-1,v,n+C)):0===this.L&&y<=m.bounds.right&&(n=m.bounds.x,b.M(q-2,n,w),b.M(q-1,n-z,w));else{z=Math.max(10,this.Gd[m.layer]);C=Math.max(10, this.md[m.layer]);p=0;if(180===this.L||0===this.L){if(180===this.L?y<=m.bounds.x:y>=m.bounds.right)p=(0===this.L?C:-z)/2;b.m(q++,y+p,w)}else{if(270===this.L?A<=m.bounds.y:A>=m.bounds.bottom)p=(90===this.L?C:-z)/2;b.m(q++,v,A+p)}b.m(q++,y,A)}}else{for(;null!==m&&m!==n;){z=u=null;for(m=m.destinationEdges.iterator;m.next()&&(v=m.value,v.link!==c.link||(u=v.toVertex,z=v.fromVertex,null!==z.node&&(z=null),null!==u.node)););u!==n&&(v=b.i(q-1).x,w=b.i(q-1).y,y=u.centerX,A=u.centerY,p?180===this.L||0===this.L? (null!==z?z.centerY:w)!==A&&(z=this.Ka[u.layer]+this.zf.x,q===b.firstPickIndex+1&&(z=0===this.L?Math.max(z,v):Math.min(z,v)),b.m(q++,z,w),b.m(q++,z,A)):(null!==z?z.centerX:v)!==y&&(z=this.Ka[u.layer]+this.zf.y,q===b.firstPickIndex+1&&(z=90===this.L?Math.max(z,w):Math.min(z,w)),b.m(q++,v,z),b.m(q++,y,z)):(z=Math.max(10,this.Gd[u.layer]),C=Math.max(10,this.md[u.layer]),180===this.L?(b.m(q++,y+C,A),r&&b.m(q++,y,A),b.m(q++,y-z,A)):90===this.L?(b.m(q++,y,A-z),r&&b.m(q++,y,A),b.m(q++,y,A+C)):270===this.L? (b.m(q++,y,A+C),r&&b.m(q++,y,A),b.m(q++,y,A-z)):(b.m(q++,y-z,A),r&&b.m(q++,y,A),b.m(q++,y+C,A))));m=u}p&&(v=b.i(q-1).x,w=b.i(q-1).y,y=b.i(q).x,A=b.i(q).y,180===this.L||0===this.L?w!==A&&(z=0===this.L?Math.min(Math.max((y+v)/2,this.Ka[n.layer]+this.zf.x),y):Math.max(Math.min((y+v)/2,this.Ka[n.layer]+this.zf.x),y),b.m(q++,z,w),b.m(q++,z,A)):v!==y&&(z=90===this.L?Math.min(Math.max((A+w)/2,this.Ka[n.layer]+this.zf.y),A):Math.max(Math.min((A+w)/2,this.Ka[n.layer]+this.zf.y),A),b.m(q++,v,z),b.m(q++,y,z)))}null!== d&&r&&(null!==g&&(l===yc&&(l=b.i(0),d=b.i(2),l.A(d)||b.M(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,yc,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.M(0,l.x,l.y)),null!==h&&(k===yc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.M(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,yc,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.M(b.pointsCount-1,e.x,e.y)));b.mf();c.commit()}}}this.avoidOrthogonalOverlaps()}; Br.prototype.avoidOrthogonalOverlaps=function(){for(var a=new E,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0f.y&&(m=l.y>f.y?0:g.xf.x&&(m=l.x>f.x?0:g.yb.layer?1:a.Scb.Sc?1:a.scb.sc?1:0:0};t.Ax=function(a,b){return a instanceof us&&b instanceof us&&a!==b?a.firstb.first||a.lb.l||a.Scb.Sc?1:a.scb.sc?1:0:0}; t.st=function(a,b){return a instanceof us&&b instanceof us&&a!==b?a.Sbb.Sb||a.lb.l||a.Scb.Sc?1:a.scb.sc?1:0:0};t.w=function(a,b){a-=b;return-1a}; t.Xi=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&B("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b=e)for(d=a.slice(c),d.sort(b),b=c;b=a.qe.length){var d=[];for(var e=0;ea&&(this.cg=a,this.B())}},setsPortSpots:{get:function(){return this.$e},set:function(a){this.$e!==a&&(this.$e=a,this.B())}}, linkSpacing:{get:function(){return this.fo},set:function(a){this.fo!==a&&0<=a&&(this.fo=a,this.B())}},maxLayer:{get:function(){return this.ya}},maxIndex:{get:function(){return this.Qr}},maxColumn:{get:function(){return this.Ha}},minIndexLayer:{get:function(){return this.qo}},maxIndexLayer:{get:function(){return this.od}}}); var Cr=new D(Br,"CycleDepthFirst",0),Vr=new D(Br,"CycleGreedy",1),Hr=new D(Br,"CycleFromLayers",2),Dr=new D(Br,"LayerOptimalLinkLength",0),$r=new D(Br,"LayerLongestPathSink",1),bs=new D(Br,"LayerLongestPathSource",2),Er=new D(Br,"InitDepthFirstOut",0),hs=new D(Br,"InitDepthFirstIn",1),fs=new D(Br,"InitNaive",2),ls=new D(Br,"AggressiveNone",0),Fr=new D(Br,"AggressiveLess",1),ms=new D(Br,"AggressiveMore",2);Br.className="LayeredDigraphLayout";Br.CycleDepthFirst=Cr;Br.CycleGreedy=Vr; Br.CycleFromLayers=Hr;Br.LayerOptimalLinkLength=Dr;Br.LayerLongestPathSink=$r;Br.LayerLongestPathSource=bs;Br.InitDepthFirstOut=Er;Br.InitDepthFirstIn=hs;Br.InitNaive=fs;Br.AggressiveNone=ls;Br.AggressiveLess=Fr;Br.AggressiveMore=ms;Br.PackNone=0;Br.PackExpand=1;Br.PackStraighten=2;Br.PackMedian=4;Br.PackAll=7;function us(){this.index=this.sc=this.Sc=this.Sb=this.first=this.layer=0;this.link=null;this.l=0}us.className="SegInfo";function Gr(a){wp.call(this,a)}la(Gr,wp);Gr.prototype.createVertex=function(){return new vs(this)}; Gr.prototype.createEdge=function(){return new ws(this)};Gr.className="LayeredDigraphNetwork";function vs(a){zp.call(this,a);this.Sa=this.Gg=this.hi=-1;this.K=NaN;this.ba=null;this.valid=!1;this.finish=this.Yl=NaN;this.Rj=0;this.rv=this.sv=null}la(vs,zp); ma.Object.defineProperties(vs.prototype,{layer:{get:function(){return this.hi},set:function(a){this.hi!==a&&(this.hi=a)}},column:{get:function(){return this.Gg},set:function(a){this.Gg!==a&&(this.Gg=a)}},index:{get:function(){return this.Sa},set:function(a){this.Sa!==a&&(this.Sa=a)}},component:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},near:{ get:function(){return this.ba},set:function(a){this.ba!==a&&(this.ba=a)}}});vs.className="LayeredDigraphVertex";function ws(a){Ap.call(this,a);this.l=this.Ma=this.Ub=!1;this.La=this.K=NaN;this.ba=this.u=0}la(ws,Ap); ma.Object.defineProperties(ws.prototype,{valid:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub=a)}},rev:{get:function(){return this.Ma},set:function(a){this.Ma!==a&&(this.Ma=a)}},forest:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},portToPos:{ get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},portFromColOffset:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},portToColOffset:{get:function(){return this.ba},set:function(a){this.ba!==a&&(this.ba=a)}}});ws.className="LayeredDigraphEdge"; function xs(){gi.call(this);this.Fb=new F;this.Po=ys;this.Zc=zs;this.Gp=As;this.Or=Bs;this.iw=[];this.Xc=!0;this.Ab=Cs;this.wd=(new M(10,10)).freeze();var a=new Ds(this);this.U=new Es(a);this.V=new Es(a);this.yu=[]}la(xs,gi);xs.prototype.cloneProtected=function(a){gi.prototype.cloneProtected.call(this,a);a.Po=this.Po;a.Gp=this.Gp;a.Or=this.Or;a.Xc=this.Xc;a.Ab=this.Ab;a.wd.assign(this.wd);a.U.copyInheritedPropertiesFrom(this.U);a.V.copyInheritedPropertiesFrom(this.V)}; xs.prototype.fb=function(a){a.classType===xs?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:B("Unknown enum value: "+a):gi.prototype.fb.call(this,a)};xs.prototype.createNetwork=function(){return new Ds(this)}; xs.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof P?(c.og(a.nodes,!0,b),c.og(a.links,!0,b)):a instanceof U?c.og(a.memberParts,!1,b):c.og(a.iterator,!1,b);return c}; xs.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Fs&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof P&&(b=a);this.path===ys&&null!==b?this.Zc=b.isTreePathToChildren?zs:Gs:this.Zc=this.path===ys?zs:this.path;if(0b.level)return!1;a.removeChild(c.parent,c)}return!0}xs.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;ee?rt(a,g,L,w,z):st(a,g,L,w,z);L=z.x;w=z.width;z=z.height;break;case at:for(A=0;An&&(JIa&&(xt(a,-Ia,0,pa,Fa-1),yt(A,-Ia,0),yt(C,-Ia,0),Ia=0)}Pa.T.h(Ia,T);w=Math.max(w,I);z=Math.max(z,y+(0===Q?0:q)+eb.height);J=I}else{0n&&(TIa&&(xt(a,0,-Ia,pa,Fa-1),yt(A,0,-Ia),yt(C,0,-Ia),Ia=0);Pa.T.h(J,Ia);z=Math.max(z,K);w=Math.max(w,y+(0===Q?0:q)+eb.width);T=K}ea++}0l&&(l=0),135u&&(u=0), k===bt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>w&&(w=Dt(k,d-w,0),g=w.x,h=w.y,w=d,l=0):w=Bt(a,w,l),0>l&&(g-=l,l=0),135z&&(z=Dt(k,0,v-z),g=z.x,h=z.y,z=v,u=0):z=Ct(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].ye[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(l+d,0),Q[1].h(Q[0].x,v),Q[2].ye[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].xe[0].y?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(0,u+v),Q[1].h(d,Q[0].y),Q[2].xd?rt(b,e,ea, y,A):st(b,e,ea,y,A);ea=A.x;y=A.width;A=A.height;break;case at:for(a=0;ap&&(Ip&&(Kn&&(n=0),135w&&(w=0));b.ia.h(n,w);b.ua.h(y,A)}} function rt(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return a=b[0],d=a.ua.width,e=a.ua.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===ht(a),l=0,m=0,n=0,p=0;pk&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.T.x&& (c=Gt(a,b.T.x,!1,c,g))):(b.T.h(d+h,c+g/2-b.focus.y-b.ia.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.ia.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.T.y&&(c=Gt(a,b.T.y,!0,c,g))));return new N(c,0,d,e)} function st(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return b=b[0],d=b.ua.width,e=b.ua.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===ht(a),l=0,m=0,n=0,p=0;pm&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height), 0>h.T.x&&(c=Gt(a,h.T.x,!1,c,g))):(h.T.h(-d-l.width-q,c+g/2-h.focus.y-h.ia.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.ia.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.T.y&&(c=Gt(a,h.T.y,!0,c,g))));for(a=0;ab&&(b=c+a.width),0>c&&(b-=c),b;case qt:return a.width>b?a.width:b;case it:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case $s:case Qs:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case at:return a.width-a.focus.x+a.nodeSpacing/2+b;case bt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}} function Ct(a,b,c){switch(a.alignment){case At:case zt:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case qt:return a.height>b?a.height:b;case it:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case $s:case Qs:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case at:return a.height-a.focus.y+a.nodeSpacing/2+b;case bt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}} function Dt(a,b,c){switch(a){case zt:b/=2;c/=2;break;case At:b/=2;c/=2;break;case qt:c=b=0;break;case it:break;default:B("Unhandled alignment value "+a.toString())}return new G(b,c)}function ut(a,b,c,d,e,f){b=Dt(b,c,d);xt(a,b.x,b.y,e,f)}function xt(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].T;f.x+=b;f.y+=c}} function vt(a,b,c,d){var e=b.parent;switch(a.Zc){case zs:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Gs:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:B("Unhandled path value "+a.Zc.toString())}}function yt(a,b,c){for(var d=0;dn.length||null===r||2>r.length))for(e=c=0;cl&&f.yf.y&&lb.length||null===c||2>c.length)d=null;else{m=tt(a,b.length+c.length);for(d=f=k=0;fk;)l=c[f++],m[d++].h(l.x+e,l.y);c=tt(a,d);for(k=0;kn.length||null===f||2>f.length)e=null;else{m=tt(a,n.length+f.length);for(e=l=c=0;cf;)k=n[c++],m[e++].h(k.x,k.y);f=tt(a,e);for(c=0;cn.length||null===r||2>r.length))for(e=c=0;ck&&f.xf.x&&kb.length||null===c||2>c.length)d=null;else{m=tt(a,b.length+c.length);for(d=f=k=0;fk;)l=c[f++],m[d++].h(l.x,l.y+e);c=tt(a,d);for(k=0;kn.length||null===f||2>f.length)e=null;else{m=tt(a,n.length+f.length);for(e=l=c=0;cf;)k=n[c++],m[e++].h(k.x,k.y);f=tt(a,e);for(c=0;c=a?0:135>=a?90:225>=a?180:315>=a?270:0}function jt(a){var b=ht(a);b=90===b||270===b;var c=a.layerSpacing;if(0=a&&(this.U.nodeIndentPastParent=a,this.B())}},nodeSpacing:{get:function(){return this.U.nodeSpacing},set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.B())}},layerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!== a&&(this.U.layerSpacing=a,this.B())}},layerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.B())}},compaction:{get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==et&&a!==gt||(this.U.compaction=a,this.B())}},breadthLimit:{get:function(){return this.U.breadthLimit}, set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.B())}},rowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.B())}},rowIndent:{get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.B())}},commentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!== a&&(this.U.commentSpacing=a,this.B())}},commentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.B())}},setsPortSpot:{get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.B())}},portSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.A(a)||(this.U.portSpot= a,this.B())}},setsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.B())}},childPortSpot:{get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.A(a)||(this.U.childPortSpot=a,this.B())}},alternateSorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==Vs&&a!==Ws&& a!==Xs&&!Ys||(this.V.sorting=a,this.B())}},alternateComparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==a&&(this.V.comparer=a,this.B())}},alternateAngle:{get:function(){return this.V.angle},set:function(a){this.V.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.V.angle=a,this.B())}},alternateAlignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!== a&&(this.V.alignment=a,this.B())}},alternateNodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==a&&0<=a&&(this.V.nodeIndent=a,this.B())}},alternateNodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.B())}},alternateNodeSpacing:{get:function(){return this.V.nodeSpacing}, set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.B())}},alternateLayerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==a&&(this.V.layerSpacing=a,this.B())}},alternateLayerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.B())}},alternateCompaction:{ get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==et&&a!==gt||(this.V.compaction=a,this.B())}},alternateBreadthLimit:{get:function(){return this.V.breadthLimit},set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.B())}},alternateRowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.B())}},alternateRowIndent:{ get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.B())}},alternateCommentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==a&&(this.V.commentSpacing=a,this.B())}},alternateCommentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.B())}},alternateSetsPortSpot:{ get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.B())}},alternatePortSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.A(a)||(this.V.portSpot=a,this.B())}},alternateSetsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.B())}},alternateChildPortSpot:{ get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.A(a)||(this.V.childPortSpot=a,this.B())}}}); var ys=new D(xs,"PathDefault",-1),zs=new D(xs,"PathDestination",0),Gs=new D(xs,"PathSource",1),Vs=new D(xs,"SortingForwards",10),Ws=new D(xs,"SortingReverse",11),Xs=new D(xs,"SortingAscending",12),Ys=new D(xs,"SortingDescending",13),zt=new D(xs,"AlignmentCenterSubtrees",20),At=new D(xs,"AlignmentCenterChildren",21),qt=new D(xs,"AlignmentStart",22),it=new D(xs,"AlignmentEnd",23),$s=new D(xs,"AlignmentBus",24),Qs=new D(xs,"AlignmentBusBranching",25),at=new D(xs,"AlignmentTopLeftBus",26),bt=new D(xs, "AlignmentBottomRightBus",27),et=new D(xs,"CompactionNone",30),gt=new D(xs,"CompactionBlock",31),As=new D(xs,"StyleLayered",40),Us=new D(xs,"StyleLastParents",41),Ts=new D(xs,"StyleAlternating",42),Ss=new D(xs,"StyleRootOnly",43),Cs=new D(xs,"ArrangementVertical",50),It=new D(xs,"ArrangementHorizontal",51),Fs=new D(xs,"ArrangementFixedRoots",52),Bs=new D(xs,"LayerIndividual",60),Os=new D(xs,"LayerSiblings",61),Ns=new D(xs,"LayerUniform",62);xs.className="TreeLayout";xs.PathDefault=ys; xs.PathDestination=zs;xs.PathSource=Gs;xs.SortingForwards=Vs;xs.SortingReverse=Ws;xs.SortingAscending=Xs;xs.SortingDescending=Ys;xs.AlignmentCenterSubtrees=zt;xs.AlignmentCenterChildren=At;xs.AlignmentStart=qt;xs.AlignmentEnd=it;xs.AlignmentBus=$s;xs.AlignmentBusBranching=Qs;xs.AlignmentTopLeftBus=at;xs.AlignmentBottomRightBus=bt;xs.CompactionNone=et;xs.CompactionBlock=gt;xs.StyleLayered=As;xs.StyleLastParents=Us;xs.StyleAlternating=Ts;xs.StyleRootOnly=Ss;xs.ArrangementVertical=Cs; xs.ArrangementHorizontal=It;xs.ArrangementFixedRoots=Fs;xs.LayerIndividual=Bs;xs.LayerSiblings=Os;xs.LayerUniform=Ns;function Ds(a){wp.call(this,a)}la(Ds,wp);Ds.prototype.createVertex=function(){return new Es(this)};Ds.prototype.createEdge=function(){return new Kt(this)};Ds.className="TreeNetwork"; function Es(a){zp.call(this,a);this.La=!1;this.Kc=null;this.K=[];this.Vb=this.Ub=this.ba=this.Ma=0;this.Xc=null;this.T=new G(0,0);this.ua=new M(0,0);this.ia=new G(0,0);this.vm=this.um=this.Pz=!1;this.sq=this.gq=null;this.Qc=Vs;this.Mc=Fp;this.zc=0;this.wb=At;this.Zr=this.Yr=0;this.bs=20;this.ke=50;this.Nr=0;this.Vq=gt;this.Oq=0;this.ns=25;this.Uq=this.ms=10;this.Tq=20;this.ws=!0;this.js=ad;this.vs=!0;this.Rq=ad}la(Es,zp); Es.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Qc=a.sorting,this.Mc=a.comparer,this.zc=a.angle,this.wb=a.alignment,this.Yr=a.nodeIndent,this.Zr=a.nodeIndentPastParent,this.bs=a.nodeSpacing,this.ke=a.layerSpacing,this.Nr=a.layerSpacingParentOverlap,this.Vq=a.compaction,this.Oq=a.breadthLimit,this.ns=a.rowSpacing,this.ms=a.rowIndent,this.Uq=a.commentSpacing,this.Tq=a.commentMargin,this.ws=a.setsPortSpot,this.js=a.portSpot,this.vs=a.setsChildPortSpot,this.Rq=a.childPortSpot)}; ma.Object.defineProperties(Es.prototype,{initialized:{get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},parent:{get:function(){return this.Kc},set:function(a){this.Kc!==a&&(this.Kc=a)}},children:{get:function(){return this.K},set:function(a){if(this.K!==a){if(null!==a)for(var b=a.length,c=0;cp.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-kt(c))))):c.alignment===qt?(e=d.top+b.y,0===b.y&&m.yp.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-kt(c))))):c.alignment===qt?(e=d.left+b.x,0===b.x&&m.xp.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-kt(c))))):c.alignment===qt?(e=d.top+b.y,0===b.y&&m.yp.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-kt(c))))):c.alignment===qt?(e=d.left+b.x,0===b.x&&m.x