text: /*
   * GoJS v2.1.54 JavaScript Library for HTML Diagrams, https://gojs.net
   * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
   * Copyright (C) 1998-2021 by Northwoods Software Corporation.  All Rights Reserved.
   * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.54/license.html.
   * DO NOT MODIFY THIS FILE.  DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
   */
  (function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ca(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa;
  if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ka={};try{ka.__proto__=ia;ha=ka.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var la=fa;
  function ma(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(la)la(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.BB=b.prototype}var na="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,oa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
  function pa(a){if(a){for(var b=na,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&oa(b,c,{writable:!0,value:a})}}pa(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(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<d;c++)this[c]=a;return this}});var x="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===x.requestAnimationFrame&&(void 0===x.setImmediate?x.requestAnimationFrame=function(a){x.setTimeout(a,0)}:x.requestAnimationFrame=x.setImmediate);function ra(){}function sa(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=ta(function(){c=-1;a.apply(d,e)},b)}}
  function ta(a,b){return x.setTimeout(a,b)}function ua(a){return x.document.createElement(a)}function B(a){throw Error(a);}function va(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);B(a)}function wa(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);B(c+" is not in the range "+b+": "+a)}function xa(a){x.console&&x.console.log(a)}
  function ya(){x.console&&x.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function za(a){return"object"===typeof a&&null!==a}function Aa(a){return Array.isArray(a)||x.NodeList&&a instanceof x.NodeList||x.HTMLCollection&&a instanceof x.HTMLCollection}function Ba(a){return Array.prototype.slice.call(a)}
  function Ca(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):B("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Da(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 Ea(){var a=Fa.pop();return void 0===a?[]:a}function Ia(a){a.length=0;Fa.push(a)}
  function Ja(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(za(a)&&a.constructor)return Ja(a.constructor);return typeof a}
  function Ka(a){var b=a;za(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 La(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.nB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
  function Na(a,b,c){Object.defineProperty(Pa.prototype,a,{get:b,set:c})}
  function Qa(a){for(var b=[],c=0;256>c;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;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;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;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
  var Ra=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 9.0"),Sa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("MSIE 10.0"),Ta=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Ua=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Va=void 0!==x.navigator&&void 0!==x.navigator.platform&&0<=x.navigator.platform.toUpperCase().indexOf("MAC"),Wa=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
  Fa=[];Object.freeze([]);ra.className="Util";ra.Dx="32ab5ff3b26f42dc0ed90f21452913b5";ra.adym="gojs.net";ra.vfo="28e647fdb662";ra.className="Util";function D(a,b,c){Xa(this);this.l=a;this.oa=b;this.u=c}D.prototype.toString=function(){return"EnumValue."+this.oa};function Ya(a,b){return void 0===b||null===b||""===b?null:a[b]}
  na.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.oa}},value:{get:function(){return this.u}}});D.className="EnumValue";function Za(){this.qx=[]}Za.prototype.toString=function(){return this.qx.join("")};Za.prototype.add=function(a){""!==a&&this.qx.push(a)};Za.className="StringBuilder";function $a(){}$a.className="PropertyCollection";
  var ab={pB:!1,uB:!1,rB:!1,tB:!1,zB:!1,xB:!1,my:!1,qB:null,trace:function(a){x.console&&x.console.log(a)},sB:function(a,b,c,d){a.strokeStyle="red";a.fillStyle="red";a.font="8px sans-serif";a.beginPath();a.moveTo(-10,0);a.lineTo(10,0);a.moveTo(0,-10);a.lineTo(0,10);a.stroke();a.setTransform(1,0,0,1,0,0);a.scale(c,c);a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);a.lineWidth=2;a.beginPath();a.moveTo(d.left,d.top+20);a.lineTo(d.left,d.top);a.lineTo(d.left+20,d.top);a.moveTo(d.right,d.bottom-20);a.lineTo(d.right,
  d.bottom);a.lineTo(d.right-20,d.bottom);a.stroke();a.fillText("DB: "+Math.round(d.x)+", "+Math.round(d.y)+", "+Math.round(d.width)+", "+Math.round(d.height),d.left,d.top-5)},oB:function(a){var b={},c;for(c in a){b.x=c;if("licenseKey"!==b.x){var d=a[b.x];if(void 0!==d.prototype){b.Jm=Object.getOwnPropertyNames(d.prototype);for(var e={Ak:0};e.Ak<b.Jm.length;e={Ak:e.Ak},e.Ak++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Jm[e.Ak]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
  b.Jm[e.Ak],{set:function(a,b){return function(){throw Error("Property "+a.Jm[b.Ak]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Jm:b.Jm,x:b.x}}}};function cb(){}cb.prototype.reset=function(){};cb.prototype.next=function(){return!1};cb.prototype.rd=function(){return!1};cb.prototype.first=function(){return null};cb.prototype.any=function(){return!1};cb.prototype.all=function(){return!0};cb.prototype.each=function(){return this};cb.prototype.map=function(){return this};cb.prototype.filter=function(){return this};
  cb.prototype.Sd=function(){};cb.prototype.toString=function(){return"EmptyIterator"};na.Object.defineProperties(cb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});cb.prototype.first=cb.prototype.first;cb.prototype.hasNext=cb.prototype.rd;cb.prototype.next=cb.prototype.next;cb.prototype.reset=cb.prototype.reset;var db=null;cb.className="EmptyIterator";db=new cb;function hb(a){this.key=-1;this.value=a}
  hb.prototype.reset=function(){this.key=-1};hb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};hb.prototype.rd=function(){return this.next()};hb.prototype.first=function(){this.key=0;return this.value};hb.prototype.any=function(a){this.key=-1;return a(this.value)};hb.prototype.all=function(a){this.key=-1;return a(this.value)};hb.prototype.each=function(a){this.key=-1;a(this.value);return this};hb.prototype.map=function(a){return new hb(a(this.value))};
  hb.prototype.filter=function(a){return a(this.value)?new hb(this.value):db};hb.prototype.Sd=function(){this.value=null};hb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties(hb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});hb.prototype.first=hb.prototype.first;hb.prototype.hasNext=hb.prototype.rd;hb.prototype.next=hb.prototype.next;
  hb.prototype.reset=hb.prototype.reset;hb.className="SingletonIterator";function ib(a){this.ub=a;this.ff=null;a.Ha=null;this.ia=a.Ba;this.Ra=-1}ib.prototype.reset=function(){var a=this.ub;a.Ha=null;this.ia=a.Ba;this.Ra=-1};ib.prototype.next=function(){var a=this.ub;if(a.Ba!==this.ia&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Ra,d=this.ff;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Ra=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Sd()}return!1};
  ib.prototype.rd=function(){return this.next()};ib.prototype.first=function(){var a=this.ub;this.ia=a.Ba;this.Ra=0;a=a.j;var b=a.length,c=this.ff;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Ra=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};ib.prototype.any=function(a){var b=this.ub;b.Ha=null;this.Ra=-1;b=b.j;for(var c=b.length,d=this.ff,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
  ib.prototype.all=function(a){var b=this.ub;b.Ha=null;this.Ra=-1;b=b.j;for(var c=b.length,d=this.ff,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};ib.prototype.each=function(a){var b=this.ub;b.Ha=null;this.Ra=-1;b=b.j;for(var c=b.length,d=this.ff,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
  ib.prototype.map=function(a){var b=this.ub;b.Ha=null;this.Ra=-1;var c=[];b=b.j;for(var d=b.length,e=this.ff,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.pb();return a.iterator};ib.prototype.filter=function(a){var b=this.ub;b.Ha=null;this.Ra=-1;var c=[];b=b.j;for(var d=b.length,e=this.ff,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.j=c;a.pb();return a.iterator};
  ib.prototype.Sd=function(){this.key=-1;this.value=null;this.ia=-1;this.ff=null;this.ub.Ha=this};ib.prototype.toString=function(){return"ListIterator@"+this.Ra+"/"+this.ub.count};
  na.Object.defineProperties(ib.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.ff},set:function(a){this.ff=a}},count:{get:function(){var a=this.ff;if(null!==a){for(var b=0,c=this.ub.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.ub.j.length}}});ib.prototype.first=ib.prototype.first;ib.prototype.hasNext=ib.prototype.rd;ib.prototype.next=ib.prototype.next;
  ib.prototype.reset=ib.prototype.reset;ib.className="ListIterator";function jb(a){this.ub=a;a.gh=null;this.ia=a.Ba;this.Ra=a.j.length}jb.prototype.reset=function(){var a=this.ub;a.gh=null;this.ia=a.Ba;this.Ra=a.j.length};jb.prototype.next=function(){var a=this.ub;if(a.Ba!==this.ia&&0>this.key)return!1;var b=--this.Ra;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Sd();return!1};jb.prototype.rd=function(){return this.next()};
  jb.prototype.first=function(){var a=this.ub;this.ia=a.Ba;var b=a.j;this.Ra=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.ub;b.gh=null;b=b.j;var c=b.length;this.Ra=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};jb.prototype.all=function(a){var b=this.ub;b.gh=null;b=b.j;var c=b.length;this.Ra=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
  jb.prototype.each=function(a){var b=this.ub;b.gh=null;b=b.j;var c=b.length;this.Ra=c;for(--c;0<=c;c--)a(b[c]);return this};jb.prototype.map=function(a){var b=this.ub;b.gh=null;var c=[];b=b.j;var d=b.length;this.Ra=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.pb();return a.iterator};jb.prototype.filter=function(a){var b=this.ub;b.gh=null;var c=[];b=b.j;var d=b.length;this.Ra=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.pb();return a.iterator};
  jb.prototype.Sd=function(){this.key=-1;this.value=null;this.ia=-1;this.ub.gh=this};jb.prototype.toString=function(){return"ListIteratorBackwards("+this.Ra+"/"+this.ub.count+")"};na.Object.defineProperties(jb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ub.j.length}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.rd;jb.prototype.next=jb.prototype.next;jb.prototype.reset=jb.prototype.reset;
  jb.className="ListIteratorBackwards";function E(a){Xa(this);this.v=!1;this.j=[];this.Ba=0;this.gh=this.Ha=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=E.prototype;t.pb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"List()#"+kb(this)};t.add=function(a){if(null===a)return this;this.v&&va(this,a);this.j.push(a);this.pb();return this};
  t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.v&&va(this);var b=this.j;if(Aa(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.pb();return this};t.clear=function(){this.v&&va(this);this.j.length=0;this.pb()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)};
  t.J=function(a){var b=this.j;(0>a||a>=b.length)&&wa(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.J(a)};t.Pc=function(a,b){var c=this.j;(0>a||a>=c.length)&&wa(a,"0 <= i < length",E,"setElt:i");this.v&&va(this,a);c[a]=b};t.set=function(a,b){this.Pc(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.Xb=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.v&&va(this);var a=this.j;return 0<a.length?a.pop():null};
  E.prototype.any=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};E.prototype.all=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};E.prototype.each=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)a(b[d]);return this};E.prototype.map=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.j=c;b.pb();return b};
  E.prototype.filter=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.j=c;b.pb();return b};t=E.prototype;t.wb=function(a,b){0>a&&wa(a,">= 0",E,"insertAt:i");this.v&&va(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.pb()};t.remove=function(a){if(null===a)return!1;this.v&&va(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.pb();return!0};t.delete=function(a){return this.remove(a)};
  t.cb=function(a){var b=this.j;(0>a||a>=b.length)&&wa(a,"0 <= i < length",E,"removeAt:i");this.v&&va(this,a);a===b.length-1?b.pop():b.splice(a,1);this.pb()};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&&va(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.pb();return this};E.prototype.copy=function(){var a=new E,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};
  t=E.prototype;t.ma=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Lw=function(){for(var a=new G,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.v&&va(this);this.j.sort(a);this.pb();return this};
  t.uj=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.v&&va(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&wa(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.pb()),this;if(0===b)if(c>=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a<c;a++)d[a]=b[a];else if(c>=e)for(c=d.slice(b),c.sort(a),a=b;a<e;a++)d[a]=c[a-b];else for(e=d.slice(b,c),e.sort(a),a=b;a<c;a++)d[a]=e[a-b];this.pb();return this};
  t.reverse=function(){this.v&&va(this);this.j.reverse();this.pb();return this};
  na.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.j}},count:{get:function(){return this.j.length}},size:{get:function(){return this.j.length}},length:{get:function(){return this.j.length}},iterator:{get:function(){if(0>=this.j.length)return db;var a=this.Ha;return null!==a?(a.reset(),a):new ib(this)}},iteratorBackwards:{
  get:function(){if(0>=this.j.length)return db;var a=this.gh;return null!==a?(a.reset(),a):new jb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.uj;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.Lw;E.prototype.toArray=E.prototype.ma;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.cb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.wb;
  E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.Xb;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.Pc;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.J;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.ea;
  E.prototype.freeze=E.prototype.freeze;E.className="List";function lb(a){this.tg=a;a.Ha=null;this.ia=a.Ba;this.ka=null}lb.prototype.reset=function(){var a=this.tg;a.Ha=null;this.ia=a.Ba;this.ka=null};lb.prototype.next=function(){var a=this.tg;if(a.Ba!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.pa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Sd();return!1};lb.prototype.rd=function(){return this.next()};
  lb.prototype.first=function(){var a=this.tg;this.ia=a.Ba;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};lb.prototype.any=function(a){var b=this.tg;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.pa}return!1};lb.prototype.all=function(a){var b=this.tg;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.pa}return!0};lb.prototype.each=function(a){var b=this.tg;this.ka=b.Ha=null;for(b=b.ba;null!==b;)a(b.value),b=b.pa;return this};
  lb.prototype.map=function(a){var b=this.tg;b.Ha=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.pa;return c.iterator};lb.prototype.filter=function(a){var b=this.tg;b.Ha=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.pa}return c.iterator};lb.prototype.Sd=function(){this.value=this.key=null;this.ia=-1;this.tg.Ha=this};lb.prototype.toString=function(){return null!==this.ka?"SetIterator@"+this.ka.value:"SetIterator"};
  na.Object.defineProperties(lb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.tg.Fb}}});lb.prototype.first=lb.prototype.first;lb.prototype.hasNext=lb.prototype.rd;lb.prototype.next=lb.prototype.next;lb.prototype.reset=lb.prototype.reset;lb.className="SetIterator";
  function G(a){Xa(this);this.v=!1;this.Hb={};this.Fb=0;this.Ha=null;this.Ba=0;this.$e=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=G.prototype;t.pb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"Set()#"+kb(this)};
  t.add=function(a){if(null===a)return this;this.v&&va(this,a);var b=a;za(a)&&(b=mb(a));void 0===this.Hb[b]&&(this.Fb++,a=new nb(a,a),this.Hb[b]=a,b=this.$e,null===b?this.ba=a:(a.Xl=b,b.pa=a),this.$e=a,this.pb());return this};t.addAll=function(a){if(null===a)return this;this.v&&va(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
  t.contains=function(a){if(null===a)return!1;var b=a;return za(a)&&(b=kb(a),void 0===b)?!1:void 0!==this.Hb[b]};t.has=function(a){return this.contains(a)};t.Ez=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Fz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ba;return null===a?null:a.value};
  G.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b.value))return!0;b=b.pa}return!1};G.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.pa}return!0};G.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.pa;return this};G.prototype.map=function(a){for(var b=new G,c=this.ba;null!==c;)b.add(a(c.value)),c=c.pa;return b};G.prototype.filter=function(a){for(var b=new G,c=this.ba;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.pa}return b};t=G.prototype;
  t.remove=function(a){if(null===a)return!1;this.v&&va(this,a);var b=a;if(za(a)&&(b=kb(a),void 0===b))return!1;a=this.Hb[b];if(void 0===a)return!1;var c=a.pa,d=a.Xl;null!==c&&(c.Xl=d);null!==d&&(d.pa=c);this.ba===a&&(this.ba=c);this.$e===a&&(this.$e=d);delete this.Hb[b];this.Fb--;this.pb();return!0};t.delete=function(a){return this.remove(a)};
  t.Zq=function(a){if(null===a)return this;this.v&&va(this);if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.YA=function(a){if(null===a||0===this.count)return this;this.v&&va(this);var b=new G;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.Zq(a);return this};t.clear=function(){this.v&&va(this);this.Hb={};this.Fb=0;null!==this.Ha&&this.Ha.reset();this.$e=this.ba=null;this.pb()};
  G.prototype.copy=function(){var a=new G,b=this.Hb,c;for(c in b)a.add(b[c].value);return a};G.prototype.ma=function(){var a=Array(this.Fb),b=this.Hb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};G.prototype.Kw=function(){var a=new E,b=this.Hb,c;for(c in b)a.add(b[c].value);return a};function Xa(a){a.__gohashid=ob++}function mb(a){var b=a.__gohashid;void 0===b&&(b=ob++,a.__gohashid=b);return b}function kb(a){return a.__gohashid}
  na.Object.defineProperties(G.prototype,{count:{get:function(){return this.Fb}},size:{get:function(){return this.Fb}},iterator:{get:function(){if(0>=this.Fb)return db;var a=this.Ha;return null!==a?(a.reset(),a):new lb(this)}}});G.prototype.toList=G.prototype.Kw;G.prototype.toArray=G.prototype.ma;G.prototype.clear=G.prototype.clear;G.prototype.retainAll=G.prototype.YA;G.prototype.removeAll=G.prototype.Zq;
  G.prototype["delete"]=G.prototype.delete;G.prototype.remove=G.prototype.remove;G.prototype.first=G.prototype.first;G.prototype.containsAny=G.prototype.Fz;G.prototype.containsAll=G.prototype.Ez;G.prototype.has=G.prototype.has;G.prototype.contains=G.prototype.contains;G.prototype.addAll=G.prototype.addAll;G.prototype.add=G.prototype.add;G.prototype.thaw=G.prototype.ea;G.prototype.freeze=G.prototype.freeze;var ob=1;G.className="Set";G.uniqueHash=Xa;G.hashIdUnique=mb;G.hashId=kb;
  function pb(a){this.ga=a;this.ia=a.Ba;this.ka=null}pb.prototype.reset=function(){this.ia=this.ga.Ba;this.ka=null};pb.prototype.next=function(){var a=this.ga;if(a.Ba!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.pa;if(null!==b)return this.ka=b,this.value=this.key=a=b.key,!0;this.Sd();return!1};pb.prototype.rd=function(){return this.next()};pb.prototype.first=function(){var a=this.ga;this.ia=a.Ba;a=a.ba;return null!==a?(this.ka=a,this.value=this.key=a=a.key):null};
  pb.prototype.any=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.pa}return!1};pb.prototype.all=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.pa}return!0};pb.prototype.each=function(a){var b=this.ga;this.ka=null;for(b=b.ba;null!==b;)a(b.key),b=b.pa;return this};pb.prototype.map=function(a){var b=this.ga;this.ka=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.pa;return c.iterator};
  pb.prototype.filter=function(a){var b=this.ga;this.ka=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.pa}return c.iterator};pb.prototype.Sd=function(){this.value=this.key=null;this.ia=-1};pb.prototype.toString=function(){return null!==this.ka?"MapKeySetIterator@"+this.ka.value:"MapKeySetIterator"};na.Object.defineProperties(pb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Fb}}});
  pb.prototype.first=pb.prototype.first;pb.prototype.hasNext=pb.prototype.rd;pb.prototype.next=pb.prototype.next;pb.prototype.reset=pb.prototype.reset;pb.className="MapKeySetIterator";function qb(a){G.call(this);Xa(this);this.v=!0;this.ga=a}ma(qb,G);t=qb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.ga.toString()+")"};t.add=function(){B("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.ga.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.ga.ba;return null!==a?a.key:null};qb.prototype.any=function(a){for(var b=this.ga.ba;null!==b;){if(a(b.key))return!0;b=b.pa}return!1};qb.prototype.all=function(a){for(var b=this.ga.ba;null!==b;){if(!a(b.key))return!1;b=b.pa}return!0};
  qb.prototype.each=function(a){for(var b=this.ga.ba;null!==b;)a(b.key),b=b.pa;return this};qb.prototype.map=function(a){for(var b=new G,c=this.ga.ba;null!==c;)b.add(a(c.key)),c=c.pa;return b};qb.prototype.filter=function(a){for(var b=new G,c=this.ga.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.pa}return b};qb.prototype.copy=function(){return new qb(this.ga)};qb.prototype.Lw=function(){var a=new G,b=this.ga.Hb,c;for(c in b)a.add(b[c].key);return a};
  qb.prototype.ma=function(){var a=this.ga.Hb,b=Array(this.ga.Fb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};qb.prototype.Kw=function(){var a=new E,b=this.ga.Hb,c;for(c in b)a.add(b[c].key);return a};na.Object.defineProperties(qb.prototype,{count:{get:function(){return this.ga.Fb}},size:{get:function(){return this.ga.Fb}},iterator:{get:function(){return 0>=this.ga.Fb?db:new pb(this.ga)}}});
  qb.prototype.toList=qb.prototype.Kw;qb.prototype.toArray=qb.prototype.ma;qb.prototype.toSet=qb.prototype.Lw;qb.prototype.first=qb.prototype.first;qb.prototype.clear=qb.prototype.clear;qb.prototype["delete"]=qb.prototype.delete;qb.prototype.remove=qb.prototype.remove;qb.prototype.has=qb.prototype.has;qb.prototype.contains=qb.prototype.contains;qb.prototype.add=qb.prototype.add;qb.prototype.thaw=qb.prototype.ea;qb.prototype.freeze=qb.prototype.freeze;qb.className="MapKeySet";
  function rb(a){this.ga=a;a.Ze=null;this.ia=a.Ba;this.ka=null}rb.prototype.reset=function(){var a=this.ga;a.Ze=null;this.ia=a.Ba;this.ka=null};rb.prototype.next=function(){var a=this.ga;if(a.Ba!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.pa;if(null!==b)return this.ka=b,this.value=b.value,this.key=b.key,!0;this.Sd();return!1};rb.prototype.rd=function(){return this.next()};
  rb.prototype.first=function(){var a=this.ga;this.ia=a.Ba;a=a.ba;if(null!==a){this.ka=a;var b=a.value;this.key=a.key;return this.value=b}return null};rb.prototype.any=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.pa}return!1};rb.prototype.all=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.pa}return!0};rb.prototype.each=function(a){var b=this.ga;this.ka=b.Ze=null;for(b=b.ba;null!==b;)a(b.value),b=b.pa;return this};
  rb.prototype.map=function(a){var b=this.ga;this.ka=b.Ze=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.pa;return c.iterator};rb.prototype.filter=function(a){var b=this.ga;this.ka=b.Ze=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.pa}return c.iterator};rb.prototype.Sd=function(){this.value=this.key=null;this.ia=-1;this.ga.Ze=this};rb.prototype.toString=function(){return null!==this.ka?"MapValueSetIterator@"+this.ka.value:"MapValueSetIterator"};
  na.Object.defineProperties(rb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Fb}}});rb.prototype.first=rb.prototype.first;rb.prototype.hasNext=rb.prototype.rd;rb.prototype.next=rb.prototype.next;rb.prototype.reset=rb.prototype.reset;rb.className="MapValueSetIterator";function nb(a,b){this.key=a;this.value=b;this.Xl=this.pa=null}nb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
  nb.className="KeyValuePair";function sb(a){this.ga=a;a.Ha=null;this.ia=a.Ba;this.ka=null}sb.prototype.reset=function(){var a=this.ga;a.Ha=null;this.ia=a.Ba;this.ka=null};sb.prototype.next=function(){var a=this.ga;if(a.Ba!==this.ia&&null===this.key)return!1;var b=this.ka;b=null===b?a.ba:b.pa;if(null!==b)return this.ka=b,this.key=b.key,this.value=b.value,!0;this.Sd();return!1};sb.prototype.rd=function(){return this.next()};
  sb.prototype.first=function(){var a=this.ga;this.ia=a.Ba;a=a.ba;return null!==a?(this.ka=a,this.key=a.key,this.value=a.value,a):null};sb.prototype.any=function(a){var b=this.ga;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.pa}return!1};sb.prototype.all=function(a){var b=this.ga;this.ka=b.Ha=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.pa}return!0};sb.prototype.each=function(a){var b=this.ga;this.ka=b.Ha=null;for(b=b.ba;null!==b;)a(b),b=b.pa;return this};
  sb.prototype.map=function(a){var b=this.ga;this.ka=b.Ha=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.pa;return c.iterator};sb.prototype.filter=function(a){var b=this.ga;this.ka=b.Ha=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.pa;return c.iterator};sb.prototype.Sd=function(){this.value=this.key=null;this.ia=-1;this.ga.Ha=this};sb.prototype.toString=function(){return null!==this.ka?"MapIterator@"+this.ka:"MapIterator"};
  na.Object.defineProperties(sb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ga.Fb}}});sb.prototype.first=sb.prototype.first;sb.prototype.hasNext=sb.prototype.rd;sb.prototype.next=sb.prototype.next;sb.prototype.reset=sb.prototype.reset;sb.className="MapIterator";
  function H(a){Xa(this);this.v=!1;this.Hb={};this.Fb=0;this.Ze=this.Ha=null;this.Ba=0;this.$e=this.ba=null;void 0!==a&&("function"===typeof a||"string"===typeof a?ya():this.addAll(a))}t=H.prototype;t.pb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.toString=function(){return"Map()#"+kb(this)};
  t.add=function(a,b){this.v&&va(this,a);var c=a;za(a)&&(c=mb(a));var d=this.Hb[c];void 0===d?(this.Fb++,a=new nb(a,b),this.Hb[c]=a,c=this.$e,null===c?this.ba=a:(a.Xl=c,c.pa=a),this.$e=a,this.pb()):d.value=b;return this};t.set=function(a,b){return this.add(a,b)};
  t.addAll=function(a){if(null===a)return this;if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof H)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ba};H.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.pa}return!1};H.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.pa}return!0};
  H.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.pa;return this};H.prototype.map=function(a){for(var b=new H,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.pa;return b};H.prototype.filter=function(a){for(var b=new H,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.pa;return b};t=H.prototype;t.contains=function(a){var b=a;return za(a)&&(b=kb(a),void 0===b)?!1:void 0!==this.Hb[b]};t.has=function(a){return this.contains(a)};
  t.G=function(a){var b=a;if(za(a)&&(b=kb(a),void 0===b))return null;a=this.Hb[b];return void 0===a?null:a.value};t.get=function(a){return this.G(a)};t.remove=function(a){if(null===a)return!1;this.v&&va(this,a);var b=a;if(za(a)&&(b=kb(a),void 0===b))return!1;a=this.Hb[b];if(void 0===a)return!1;var c=a.pa,d=a.Xl;null!==c&&(c.Xl=d);null!==d&&(d.pa=c);this.ba===a&&(this.ba=c);this.$e===a&&(this.$e=d);delete this.Hb[b];this.Fb--;this.pb();return!0};t.delete=function(a){return this.remove(a)};
  t.clear=function(){this.v&&va(this);this.Hb={};this.Fb=0;null!==this.Ha&&this.Ha.reset();null!==this.Ze&&this.Ze.reset();this.$e=this.ba=null;this.pb()};H.prototype.copy=function(){var a=new H,b=this.Hb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};H.prototype.ma=function(){var a=this.Hb,b=Array(this.Fb),c=0,d;for(d in a){var e=a[d];b[c]=new nb(e.key,e.value);c++}return b};H.prototype.Kf=function(){return new qb(this)};
  na.Object.defineProperties(H.prototype,{count:{get:function(){return this.Fb}},size:{get:function(){return this.Fb}},iterator:{get:function(){if(0>=this.count)return db;var a=this.Ha;return null!==a?(a.reset(),a):new sb(this)}},iteratorKeys:{get:function(){return 0>=this.count?db:new pb(this)}},iteratorValues:{get:function(){if(0>=this.count)return db;
  var a=this.Ze;return null!==a?(a.reset(),a):new rb(this)}}});H.prototype.toKeySet=H.prototype.Kf;H.prototype.toArray=H.prototype.ma;H.prototype.clear=H.prototype.clear;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.get=H.prototype.get;H.prototype.getValue=H.prototype.G;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.first=H.prototype.first;H.prototype.addAll=H.prototype.addAll;H.prototype.set=H.prototype.set;
  H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ea;H.prototype.freeze=H.prototype.freeze;H.className="Map";function J(a,b){void 0===a?this.y=this.x=0:"number"===typeof a&&"number"===typeof b?(this.x=a,this.y=b):B("Invalid arguments to Point constructor: "+a+", "+b);this.v=!1}J.prototype.assign=function(a){this.x=a.x;this.y=a.y;return this};J.prototype.h=function(a,b){this.x=a;this.y=b;return this};J.prototype.Ig=function(a,b){this.x=a;this.y=b;return this};
  J.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};J.prototype.copy=function(){var a=new J;a.x=this.x;a.y=this.y;return a};t=J.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.H=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};
  function tb(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 J(c,e)}return new J}function ub(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.w=function(a){return a instanceof J?this.x===a.x&&this.y===a.y:!1};t.fj=function(a,b){return this.x===a&&this.y===b};t.Qa=function(a){return L.A(this.x,a.x)&&L.A(this.y,a.y)};
  t.add=function(a){this.x+=a.x;this.y+=a.y;return this};t.ge=function(a){this.x-=a.x;this.y-=a.y;return this};t.offset=function(a,b){this.x+=a;this.y+=b;return this};J.prototype.rotate=function(a){if(0===a)return this;var b=this.x,c=this.y;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.x=a*b-d*c;this.y=d*b+a*c;return this};t=J.prototype;
  t.scale=function(a,b){this.x*=a;this.y*=b;return this};t.Ie=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.qd=function(a,b){a-=this.x;b-=this.y;return a*a+b*b};t.normalize=function(){var a=this.x,b=this.y,c=Math.sqrt(a*a+b*b);0<c&&(this.x=a/c,this.y=b/c);return this};t.Pa=function(a){return vb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return vb(a-this.x,b-this.y)};
  function vb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.OA=function(a,b,c,d){L.Qh(a,b,c,d,this.x,this.y,this);return this};t.PA=function(a,b){L.Qh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.cB=function(a,b,c,d){L.Gq(this.x,this.y,a,b,c,d,this);return this};t.dB=function(a,b){L.Gq(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};
  t.tj=function(a,b){this.x=a.x+b.x*a.width+b.offsetX;this.y=a.y+b.y*a.height+b.offsetY;return this};t.Uk=function(a,b,c,d,e){this.x=a+e.x*c+e.offsetX;this.y=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ta(this);return this};function wb(a,b){b.Jd(a);return a}function xb(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 yb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
  function zb(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.o=function(){return isFinite(this.x)&&isFinite(this.y)};J.alloc=function(){var a=Ab.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Ab.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Ab.push(a)};J.prototype.isReal=J.prototype.o;
  J.prototype.setSpot=J.prototype.Uk;J.prototype.setRectSpot=J.prototype.tj;J.prototype.snapToGridPoint=J.prototype.dB;J.prototype.snapToGrid=J.prototype.cB;J.prototype.projectOntoLineSegmentPoint=J.prototype.PA;J.prototype.projectOntoLineSegment=J.prototype.OA;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return L.Cm(a,b,c,d,e,f,g,h)};J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Pa;J.prototype.normalize=J.prototype.normalize;
  J.prototype.distanceSquared=J.prototype.qd;J.prototype.distanceSquaredPoint=J.prototype.Ie;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.ge;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Qa;J.prototype.equalTo=J.prototype.fj;J.prototype.equals=J.prototype.w;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Ig;var Bb=null,Cb=null,Fb=null,Gb=null,Hb=null,Ab=[];
  J.className="Point";J.parse=tb;J.stringify=ub;J.distanceLineSegmentSquared=xb;J.distanceSquared=yb;J.direction=zb;J.Origin=Bb=(new J(0,0)).ca();J.InfiniteTopLeft=Cb=(new J(-Infinity,-Infinity)).ca();J.InfiniteBottomRight=Fb=(new J(Infinity,Infinity)).ca();J.SixPoint=Gb=(new J(6,6)).ca();J.NoPoint=Hb=(new J(NaN,NaN)).ca();J.parse=tb;J.stringify=ub;J.distanceLineSegmentSquared=xb;J.distanceSquared=yb;J.direction=zb;
  function M(a,b){void 0===a?this.height=this.width=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.width=a,this.height=b):B("Invalid arguments to Size constructor: "+a+", "+b);this.v=!1}var Ib,Jb,Kb,Lb,Mb,Nb,Ob;M.prototype.assign=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.h=function(a,b){this.width=a;this.height=b;return this};M.prototype.Ig=function(a,b){this.width=a;this.height=b;return this};
  M.prototype.set=function(a){this.width=a.width;this.height=a.height;return this};M.prototype.copy=function(){var a=new M;a.width=this.width;a.height=this.height;return a};t=M.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.H=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};
  function Pb(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 Qb(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.w=function(a){return a instanceof M?this.width===a.width&&this.height===a.height:!1};t.fj=function(a,b){return this.width===a&&this.height===b};
  t.Qa=function(a){return L.A(this.width,a.width)&&L.A(this.height,a.height)};t.o=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Rb.pop();return void 0===a?new M:a};M.free=function(a){Rb.push(a)};M.prototype.isReal=M.prototype.o;M.prototype.equalsApprox=M.prototype.Qa;M.prototype.equalTo=M.prototype.fj;M.prototype.equals=M.prototype.w;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Ig;var Rb=[];M.className="Size";M.parse=Pb;M.stringify=Qb;
  M.ZeroSize=Ib=(new M(0,0)).ca();M.OneSize=Jb=(new M(1,1)).ca();M.SixSize=Kb=(new M(6,6)).ca();M.EightSize=Lb=(new M(8,8)).ca();M.TenSize=Mb=(new M(10,10)).ca();M.InfiniteSize=Nb=(new M(Infinity,Infinity)).ca();M.NoSize=Ob=(new M(NaN,NaN)).ca();M.parse=Pb;M.stringify=Qb;
  function N(a,b,c,d){void 0===a?this.height=this.width=this.y=this.x=0:a instanceof J?(c=a.x,a=a.y,b instanceof J?(d=b.x,b=b.y,this.x=Math.min(c,d),this.y=Math.min(a,b),this.width=Math.abs(c-d),this.height=Math.abs(a-b)):b instanceof M?(this.x=c,this.y=a,this.width=b.width,this.height=b.height):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.x=a,this.y=b,this.width=c,
  this.height=d):B("Invalid arguments to Rect constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}t=N.prototype;t.assign=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};t.h=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};function Sb(a,b,c){a.width=b;a.height=c}t.Ig=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;return this};t.set=function(a){this.x=a.x;this.y=a.y;this.width=a.width;this.height=a.height;return this};
  t.Qc=function(a){this.x=a.x;this.y=a.y;return this};t.bB=function(a){this.width=a.width;this.height=a.height;return this};N.prototype.copy=function(){var a=new N;a.x=this.x;a.y=this.y;a.width=this.width;a.height=this.height;return a};t=N.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.H=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};
  t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};function Tb(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 Ub(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.w=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.fj=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Qa=function(a){return L.A(this.x,a.x)&&L.A(this.y,a.y)&&L.A(this.width,a.width)&&L.A(this.height,a.height)};
  function Vb(a,b){return L.aa(a.x,b.x)&&L.aa(a.y,b.y)&&L.aa(a.width,b.width)&&L.aa(a.height,b.height)}t.$=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y};t.Ge=function(a){return this.x<=a.x&&a.x+a.width<=this.x+this.width&&this.y<=a.y&&a.y+a.height<=this.y+this.height};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.x<=a&&a+c<=this.x+this.width&&this.y<=b&&b+d<=this.y+this.height};
  t.offset=function(a,b){this.x+=a;this.y+=b;return this};t.Jc=function(a,b){return Wb(this,b,a,b,a)};t.uq=function(a){return Wb(this,a.top,a.right,a.bottom,a.left)};t.Jw=function(a){return Wb(this,-a.top,-a.right,-a.bottom,-a.left)};t.sA=function(a,b,c,d){return Wb(this,a,b,c,d)};function Wb(a,b,c,d,e){var f=a.width;c+e<=-f?(a.x+=f/2,a.width=0):(a.x-=e,a.width+=c+e);c=a.height;b+d<=-c?(a.y+=c/2,a.height=0):(a.y-=b,a.height+=b+d);return a}t.Dy=function(a){return $b(this,a.x,a.y,a.width,a.height)};
  t.bw=function(a,b,c,d){return $b(this,a,b,c,d)};function $b(a,b,c,d,e){var f=Math.max(a.x,b),g=Math.max(a.y,c);b=Math.min(a.x+a.width,b+d);c=Math.min(a.y+a.height,c+e);a.x=f;a.y=g;a.width=Math.max(0,b-f);a.height=Math.max(0,c-g);return a}t.Mc=function(a){return this.cw(a.x,a.y,a.width,a.height)};
  t.cw=function(a,b,c,d){var e=this.width,f=this.x;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.height;c=this.y;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};function ac(a,b){var c=a.width,d=a.x,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.height;a=a.y;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Oe=function(a){return bc(this,a.x,a.y,0,0)};t.Rc=function(a){return bc(this,a.x,a.y,a.width,a.height)};
  t.Rw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return bc(this,a,b,c,d)};function bc(a,b,c,d,e){var f=Math.min(a.x,b),g=Math.min(a.y,c);b=Math.max(a.x+a.width,b+d);c=Math.max(a.y+a.height,c+e);a.x=f;a.y=g;a.width=b-f;a.height=c-g;return a}t.Uk=function(a,b,c){this.x=a-c.offsetX-c.x*this.width;this.y=b-c.offsetY-c.y*this.height;return this};function cc(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 dc(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.yA=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=hc.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=hc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){hc.push(a)};
  na.Object.defineProperties(N.prototype,{left:{get:function(){return this.x},set:function(a){this.x=a}},top:{get:function(){return this.y},set:function(a){this.y=a}},right:{get:function(){return this.x+this.width},set:function(a){this.x+=a-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(a){this.y+=a-(this.y+this.height)}},position:{
  get:function(){return new J(this.x,this.y)},set:function(a){this.x=a.x;this.y=a.y}},size:{get:function(){return new M(this.width,this.height)},set:function(a){this.width=a.width;this.height=a.height}},center:{get:function(){return new J(this.x+this.width/2,this.y+this.height/2)},set:function(a){this.x=a.x-this.width/2;this.y=a.y-this.height/2}},centerX:{get:function(){return this.x+this.width/2},
  set:function(a){this.x=a-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(a){this.y=a-this.height/2}}});N.prototype.isEmpty=N.prototype.yA;N.prototype.isReal=N.prototype.o;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return L.Ey(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.Uk;N.prototype.union=N.prototype.Rw;N.prototype.unionRect=N.prototype.Rc;N.prototype.unionPoint=N.prototype.Oe;N.prototype.intersects=N.prototype.cw;
  N.prototype.intersectsRect=N.prototype.Mc;N.prototype.intersect=N.prototype.bw;N.prototype.intersectRect=N.prototype.Dy;N.prototype.grow=N.prototype.sA;N.prototype.subtractMargin=N.prototype.Jw;N.prototype.addMargin=N.prototype.uq;N.prototype.inflate=N.prototype.Jc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.Ge;N.prototype.containsPoint=N.prototype.$;N.prototype.equalsApprox=N.prototype.Qa;N.prototype.equalTo=N.prototype.fj;
  N.prototype.equals=N.prototype.w;N.prototype.setSize=N.prototype.bB;N.prototype.setPoint=N.prototype.Qc;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.Ig;var ic=null,jc=null,hc=[];N.className="Rect";N.parse=Tb;N.stringify=Ub;N.contains=cc;N.intersects=dc;N.ZeroRect=ic=(new N(0,0,0,0)).ca();N.NoRect=jc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Tb;N.stringify=Ub;N.contains=cc;N.intersects=dc;
  function kc(a,b,c,d){void 0===a?this.left=this.bottom=this.right=this.top=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}kc.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
  kc.prototype.Ig=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};kc.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};kc.prototype.copy=function(){var a=new kc;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=kc.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.H=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};
  t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};
  function lc(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 kc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new kc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new kc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new kc(c,e):new kc(c,e,f,g)}return new kc}
  function mc(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.w=function(a){return a instanceof kc?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.fj=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
  t.Qa=function(a){return L.A(this.top,a.top)&&L.A(this.right,a.right)&&L.A(this.bottom,a.bottom)&&L.A(this.left,a.left)};t.o=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};kc.alloc=function(){var a=pc.pop();return void 0===a?new kc:a};kc.free=function(a){pc.push(a)};kc.prototype.isReal=kc.prototype.o;kc.prototype.equalsApprox=kc.prototype.Qa;kc.prototype.equalTo=kc.prototype.fj;kc.prototype.equals=kc.prototype.w;kc.prototype.set=kc.prototype.set;
  kc.prototype.setTo=kc.prototype.Ig;var qc=null,rc=null,pc=[];kc.className="Margin";kc.parse=lc;kc.stringify=mc;kc.ZeroMargin=qc=(new kc(0,0,0,0)).ca();kc.TwoMargin=rc=(new kc(2,2,2,2)).ca();kc.parse=lc;kc.stringify=mc;function O(a,b,c,d){void 0===a?this.offsetY=this.offsetX=this.y=this.x=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 sc,tc,uc,vc,yc,zc,Ac,Bc,Cc,Dc,Ec,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Zc,$c,ad,bd,cd,dd,ed,fd,gd;O.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};O.prototype.Ig=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};O.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
  O.prototype.copy=function(){var a=new O;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=O.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.H=function(){return this.v||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;return this};function hd(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
  function id(a){if("string"===typeof a){a=a.trim();if("None"===a)return sc;if("TopLeft"===a)return tc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return uc;if("TopRight"===a)return vc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return yc;if("Center"===a)return zc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Ac;if("BottomLeft"===a)return Bc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Cc;if("BottomRight"===a)return Dc;if("TopSide"===a)return Ec;if("LeftSide"===
  a)return Gc;if("RightSide"===a)return Hc;if("BottomSide"===a)return Ic;if("TopBottomSides"===a)return Jc;if("LeftRightSides"===a)return Kc;if("TopLeftSides"===a)return Lc;if("TopRightSides"===a)return Mc;if("BottomLeftSides"===a)return Nc;if("BottomRightSides"===a)return Oc;if("NotTopSide"===a)return Qc;if("NotLeftSide"===a)return Rc;if("NotRightSide"===a)return Sc;if("NotBottomSide"===a)return Tc;if("AllSides"===a)return Uc;if("Default"===a)return Vc;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
  var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new O(c,e,f,g)}return new O}function jd(a){return a.kb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
  t.toString=function(){return this.kb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.w(sc)?"None":this.w(tc)?"TopLeft":this.w(uc)?"Top":this.w(vc)?"TopRight":this.w(yc)?"Left":this.w(zc)?"Center":this.w(Ac)?"Right":this.w(Bc)?"BottomLeft":this.w(Cc)?"Bottom":this.w(Dc)?"BottomRight":this.w(Ec)?"TopSide":this.w(Gc)?"LeftSide":this.w(Hc)?"RightSide":this.w(Ic)?"BottomSide":this.w(Jc)?"TopBottomSides":this.w(Kc)?
  "LeftRightSides":this.w(Lc)?"TopLeftSides":this.w(Mc)?"TopRightSides":this.w(Nc)?"BottomLeftSides":this.w(Oc)?"BottomRightSides":this.w(Qc)?"NotTopSide":this.w(Rc)?"NotLeftSide":this.w(Sc)?"NotRightSide":this.w(Tc)?"NotBottomSide":this.w(Uc)?"AllSides":this.w(Vc)?"Default":"None"};t.w=function(a){return a instanceof O?(this.x===a.x||isNaN(this.x)&&isNaN(a.x))&&(this.y===a.y||isNaN(this.y)&&isNaN(a.y))&&this.offsetX===a.offsetX&&this.offsetY===a.offsetY:!1};
  t.mw=function(){return new O(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.Ef=function(a){if(!this.Oc())return!1;if(!a.Oc())if(a.w(Wc))a=Gc;else if(a.w(Zc))a=Hc;else if(a.w($c))a=Ec;else if(a.w(ad))a=Ic;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.kb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.nc=function(){return isNaN(this.x)||isNaN(this.y)};t.Oc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
  t.Vt=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Mb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};O.alloc=function(){var a=kd.pop();return void 0===a?new O:a};O.free=function(a){kd.push(a)};O.prototype.isDefault=O.prototype.Mb;O.prototype.isNone=O.prototype.Vt;O.prototype.isSide=O.prototype.Oc;O.prototype.isNoSpot=O.prototype.nc;O.prototype.isSpot=O.prototype.kb;O.prototype.includesSide=O.prototype.Ef;
  O.prototype.opposite=O.prototype.mw;O.prototype.equals=O.prototype.w;O.prototype.set=O.prototype.set;O.prototype.setTo=O.prototype.Ig;var kd=[];O.className="Spot";O.parse=id;O.stringify=jd;O.None=sc=hd(new O(0,0,0,0),0).ca();O.Default=Vc=hd(new O(0,0,-1,0),-1).ca();O.TopLeft=tc=(new O(0,0,0,0)).ca();O.TopCenter=uc=(new O(.5,0,0,0)).ca();O.TopRight=vc=(new O(1,0,0,0)).ca();O.LeftCenter=yc=(new O(0,.5,0,0)).ca();O.Center=zc=(new O(.5,.5,0,0)).ca();O.RightCenter=Ac=(new O(1,.5,0,0)).ca();
  O.BottomLeft=Bc=(new O(0,1,0,0)).ca();O.BottomCenter=Cc=(new O(.5,1,0,0)).ca();O.BottomRight=Dc=(new O(1,1,0,0)).ca();O.MiddleTop=bd=uc;O.MiddleLeft=cd=yc;O.MiddleRight=dd=Ac;O.MiddleBottom=ed=Cc;O.Top=$c=uc;O.Left=Wc=yc;O.Right=Zc=Ac;O.Bottom=ad=Cc;O.TopSide=Ec=hd(new O(0,0,1,1),1).ca();O.LeftSide=Gc=hd(new O(0,0,1,2),1).ca();O.RightSide=Hc=hd(new O(0,0,1,4),1).ca();O.BottomSide=Ic=hd(new O(0,0,1,8),1).ca();O.TopBottomSides=Jc=hd(new O(0,0,1,9),1).ca();O.LeftRightSides=Kc=hd(new O(0,0,1,6),1).ca();
  O.TopLeftSides=Lc=hd(new O(0,0,1,3),1).ca();O.TopRightSides=Mc=hd(new O(0,0,1,5),1).ca();O.BottomLeftSides=Nc=hd(new O(0,0,1,10),1).ca();O.BottomRightSides=Oc=hd(new O(0,0,1,12),1).ca();O.NotTopSide=Qc=hd(new O(0,0,1,14),1).ca();O.NotLeftSide=Rc=hd(new O(0,0,1,13),1).ca();O.NotRightSide=Sc=hd(new O(0,0,1,11),1).ca();O.NotBottomSide=Tc=hd(new O(0,0,1,7),1).ca();O.AllSides=Uc=hd(new O(0,0,1,15),1).ca();fd=(new O(.156,.156)).ca();gd=(new O(.844,.844)).ca();O.parse=id;O.stringify=jd;
  function ld(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}ld.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};ld.prototype.copy=function(){var a=new ld;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};ld.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
  ld.prototype.w=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};ld.prototype.Tt=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};ld.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
  ld.prototype.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
  ld.prototype.jw=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};
  ld.prototype.St=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};
  ld.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=ld.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.Jd=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.Zx=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=1.25*a.x,d=1.2*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.Pw=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,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.h(e,r,n-e,p-r);return a};ld.alloc=function(){var a=qd.pop();return void 0===a?new ld:a};
  ld.free=function(a){qd.push(a)};ld.prototype.transformRect=ld.prototype.Pw;ld.prototype.transformPoint=ld.prototype.ta;ld.prototype.scale=ld.prototype.scale;ld.prototype.translate=ld.prototype.translate;ld.prototype.rotate=ld.prototype.rotate;ld.prototype.invert=ld.prototype.St;ld.prototype.multiplyInverted=ld.prototype.jw;ld.prototype.multiply=ld.prototype.multiply;ld.prototype.reset=ld.prototype.reset;ld.prototype.isIdentity=ld.prototype.Tt;ld.prototype.equals=ld.prototype.w;ld.prototype.set=ld.prototype.set;
  var qd=[];ld.className="Transform";ld.xF="54a702f3e53909c447824c6706603faf4c";
  var L={lB:"7da71ca0ad381e90",Kg:(Math.sqrt(2)-1)/3*4,jx:null,sqrt:function(a){if(0>=a)return 0;var b=L.jx;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);L.jx=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},aa:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Nb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
  f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-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},yt:function(a,b,c,d,e,f,g,h,k,l,m,n){if(L.Nb(a,b,g,h,n,c,d)&&L.Nb(a,b,g,h,n,e,f))return L.Nb(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 w=(d+q)/2,v=(c+u)/2;return L.yt(a,
  b,p,r,d,c,w,v,k,l,m,n)||L.yt(w,v,q,u,e,f,g,h,k,l,m,n)},yz: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},xz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return zb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},vm:function(a,b,c,d,e,f,g,h,k,l){if(L.Nb(a,b,g,h,k,c,d)&&L.Nb(a,b,g,h,k,e,f))bc(l,a,b,0,0),bc(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;L.vm(a,b,m,n,d,c,q,u,k,l);L.vm(q,u,p,r,e,f,g,h,k,l)}return l},Fe:function(a,b,c,d,e,f,g,h,k,l){if(L.Nb(a,b,g,h,k,c,d)&&L.Nb(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;L.Fe(a,b,m,n,d,c,q,u,k,l);L.Fe(q,u,p,r,e,f,g,h,k,l)}return l},qw:function(a,b,c,d,e,f,g,h,k,l){if(L.Nb(a,b,e,f,l,c,d))return L.Nb(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 L.qw(a,b,m,n,p,r,g,h,k,l)||L.qw(p,r,c,d,e,f,g,h,k,l)},AB: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},pw:function(a,b,c,d,e,f,g,h){if(L.Nb(a,b,e,f,g,c,d))bc(h,a,b,0,0),bc(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;L.pw(a,b,k,l,m,n,g,h);L.pw(m,n,c,d,e,f,g,h)}return h},Vq:function(a,b,c,d,e,f,g,h){if(L.Nb(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;L.Vq(a,b,k,l,m,n,g,h);L.Vq(m,n,c,d,e,f,g,h)}return h},wq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(L.Nb(a,b,g,h,p,c,d)&&L.Nb(a,b,g,h,p,e,f)){if(!L.Cm(a,b,g,h,k,l,m,n))return!1;p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return!1;r.h(((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p);return!0}var q=(a+c)/2,u=(b+d)/2,w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+v)/2;w=(w+e)/
  2;v=(v+f)/2;var y=(d+w)/2,z=(c+v)/2,A=Infinity,C=!1,F=0,Q=0;L.wq(a,b,q,u,d,c,y,z,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<A&&(A=a,C=!0,F=r.x,Q=r.y));L.wq(y,z,w,v,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<A&&(C=!0,F=r.x,Q=r.y);C&&(r.x=F,r.y=Q);return C},xq:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(L.Nb(a,b,g,h,p,c,d)&&L.Nb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;
  if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var w=(c+e)/2,v=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+v)/2;w=(w+e)/2;v=(v+f)/2;var y=(d+w)/2,z=(c+v)/2;r+=L.xq(a,b,q,u,d,c,y,z,k,l,m,n,p);r+=L.xq(y,z,w,v,e,f,g,h,k,l,m,n,p)}return r},Qh:function(a,b,c,d,e,f,g){if(L.aa(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(L.aa(b,d)){a<c?(d=a,a=c):
  d=c;if(e<d)return g.h(d,b),!1;if(e>a)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.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Me:function(a,b,c,d,e,f,g,h,k){if(L.A(a,c)&&L.A(b,d))return k.h(a,b),!1;if(L.aa(e,g))return L.aa(a,c)?(L.Qh(a,b,c,d,e,f,k),!1):L.Qh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(L.aa(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;
  k.h(a,c);return!0}g=(d-b)/(c-a);if(L.aa(h,g))return L.Qh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(L.aa(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return L.Qh(a,b,c,d,e,g*(e-a)+b,k)},yB:function(a,b,c,d,e){return L.Me(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},wB: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<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=e);p=
  (r-p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(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},Cf:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(L.Me(a,b,a,d,e,f,
  g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}L.Me(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));L.Me(a,b,c,b,e,f,g,h,k)&&(b=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));L.Me(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},vB: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},Qt:function(a,b,c){return L.Ey(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Ey:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):cc(a,b,c,d,e,f)||cc(a,b,c,d,g,h)||L.Cm(a,b,k,b,e,f,g,h)||L.Cm(k,b,k,l,e,f,g,h)||L.Cm(k,l,a,l,e,f,g,h)||L.Cm(a,l,a,b,e,f,g,h)?!0:!1},Cm:function(a,b,c,d,e,f,g,h){return 0>=L.Bt(a,b,c,d,e,f)*L.Bt(a,b,c,d,g,h)&&0>=L.Bt(e,f,g,h,a,b)*L.Bt(e,
  f,g,h,c,d)},Bt: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,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},Tq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},hy: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-5<d;)e=l+
  h*Math.min(d,k),f.push(L.Hz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Hz:function(a,b,c,d,e){var f=(c-b)/2,g=a*Math.cos(f),h=a*Math.sin(f),k=-h,l=g*g+k*k,m=l+g*g+k*h;l=4/3*(Math.sqrt(2*l*m)-m)/(g*h-k*g);h=g-l*k;g=k+l*g;k=-g;l=f+b;f=Math.cos(l);l=Math.sin(l);return[d+a*Math.cos(b),e+a*Math.sin(b),d+h*f-g*l,e+h*l+g*f,d+h*f-k*l,e+h*l+k*f,d+a*Math.cos(c),e+a*Math.sin(c)]},Gq:function(a,b,c,d,e,f,g){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/f)*f+d;var h=c;c+e-a<e/2&&(h=c+e);a=d;d+f-b<f/2&&(a=d+f);
  g.h(h,a);return g},uy:function(a,b){var c=Math.max(a,b);a=Math.min(a,b);var d;do b=c%a,c=d=a,a=b;while(0<b);return d},Mz:function(a,b,c,d){var e=0>c,f=0>d;if(a<b){var g=1;var h=0}else g=0,h=1;var k=0===g?a:b;var l=0===g?c:d;if(0===g?e:f)l=-l;g=h;c=0===g?c:d;if(0===g?e:f)c=-c;return L.Nz(k,0===g?a:b,l,c,0,0)},Nz:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++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(0<m)h=b;else if(0>m)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,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},Qe:new $a,dn:new $a,Uh:new $a,Vh:0};L.za=L.lB;
  function rd(a){Xa(this);this.v=!1;void 0===a&&(a=sd);this.qa=a;this.oc=this.hc=this.dd=this.cd=0;this.Jj=new E;this.Xr=this.Jj.Ba;this.Fr=(new N).freeze();this.ra=!0;this.ln=this.al=null;this.mn=NaN;this.pf=tc;this.qf=Dc;this.Cl=this.Dl=NaN;this.Sf=td}
  rd.prototype.copy=function(){var a=new rd;a.qa=this.qa;a.cd=this.cd;a.dd=this.dd;a.hc=this.hc;a.oc=this.oc;for(var b=this.Jj.j,c=b.length,d=a.Jj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Xr=this.Xr;a.Fr.assign(this.Fr);a.ra=this.ra;a.al=this.al;a.ln=this.ln;a.mn=this.mn;a.pf=this.pf.H();a.qf=this.qf.H();a.Dl=this.Dl;a.Cl=this.Cl;a.Sf=this.Sf;return a};t=rd.prototype;t.ca=function(){this.freeze();Object.freeze(this);return this};
  t.freeze=function(){this.v=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;var a=this.figures;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
  t.Qa=function(a){if(!(a instanceof rd))return!1;if(this.type!==a.type)return this.type===ud&&a.type===sd?vd(this,a):a.type===ud&&this.type===sd?vd(a,this):!1;if(this.type===sd){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Qa(a[d]))return!1;return!0}return L.A(this.startX,a.startX)&&L.A(this.startY,a.startY)&&L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)};
  function vd(a,b){return a.type!==ud||b.type!==sd?!1:1===b.figures.count&&(b=b.figures.J(0),1===b.segments.count&&L.A(a.startX,b.startX)&&L.A(a.startY,b.startY)&&(b=b.segments.J(0),b.type===wd&&L.A(a.endX,b.endX)&&L.A(a.endY,b.endY)))?!0:!1}function xd(a){return a.toString()}t.jb=function(a){a.classType===rd&&(this.type=a)};
  t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case ud:return 0>a?"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 yd:var b=new N(this.startX,this.startY,0,0);b.Rw(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 zd:b=new N(this.startX,this.startY,0,0);b.Rw(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 sd:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
  function Dd(a,b){function c(){return u>=A-1?!0:null!==n[u+1].match(C)}function d(){u++;return n[u]}function e(a){var b=parseFloat(d()),c=parseFloat(d());w===w.toLowerCase()&&(b=z.x+b,c=z.y+c);a.h(b,c)}function f(){e(z);return z}function g(){e(y);return y}function h(){var a=v.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new J(2*z.x-y.x,2*z.y-y.y)}void 0===b&&(b=!1);var k=new RegExp("(["+Ed+"])(["+Ed+"])","gm"),l=new RegExp("(["+Ed+"])([^s])","gm"),m=new RegExp("([^s])(["+Ed+"])","gm");
  a=a.replace(/,/gm," ");a=a.replace(k,"$1 $2");a=a.replace(k,"$1 $2");a=a.replace(l,"$1 $2");a=a.replace(m,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var n=a.split(" ");for(a=0;a<n.length;a++)if(l=n[a],null!==l.match(/(\.[0-9]*)(\.)/gm)){k=Ea();m="";for(var p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(k.push(m),m="."):m+=q:(p=!0,m+=q)}k.push(m);n.splice(a,1);for(l=0;l<k.length;l++)n.splice(a+l,0,k[l]);a+=k.length-1;Ia(k)}var u=
  -1,w="",v="";k=new J(0,0);var y=new J(0,0),z=new J(0,0),A=n.length;a=Fd(null);m=l=!1;p=!0;r=null;for(var C=new RegExp("["+Ed+"]");!(u>=A-1);)if(v=w,w=d(),""!==w)switch(w.toUpperCase()){case "X":p=!0;m=l=!1;break;case "M":r=f();null===a.ic||!0===p?(Gd(a,r.x,r.y,l,!m),p=!1):a.moveTo(r.x,r.y);for(k.assign(z);!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();)z=new J((w===w.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=
  new J(z.x,(w===w.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){r=new J;e(r);q=g();var F=f();Hd(a,r.x,r.y,q.x,q.y,F.x,F.y)}break;case "S":for(;!c();)r=h(),q=g(),F=f(),Hd(a,r.x,r.y,q.x,q.y,F.x,F.y);break;case "Q":for(;!c();)r=g(),q=f(),Id(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)y=r=h(),q=f(),Id(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());F=parseFloat(d());var Q=parseFloat(d()),K=parseFloat(d()),T=K,P=!1;c()||(T=parseFloat(d()),
  c()||(P=0!==parseFloat(d())));w===w.toLowerCase()&&(F+=z.x,Q+=z.y);a.arcTo(r,q,F,Q,K,T,P)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),F=parseFloat(d()),K=Q=!1,P=T=0,T=d(),1===T.length?(Q=!!parseFloat(T),K=!!parseFloat(d()),T=parseFloat(d())):2===T.length?(Q=!!parseFloat(T[0]),K=!!parseFloat(T[1]),T=parseFloat(d())):(Q=!!parseFloat(T[0]),K=!!parseFloat(T[1]),T=parseFloat(T.slice(2))),P=parseFloat(d()),w===w.toLowerCase()&&(T=z.x+T,P=z.y+P),z.h(T,P),Ud(a,r,q,F,
  Q,K,T,P);break;case "Z":Vd(a);z.assign(k);break;case "F":r="";for(q=1;n[u+q];)if(null!==n[u+q].match(/[Uu]/))q++;else if(null===n[u+q].match(C))q++;else{r=n[u+q];break}r.match(/[Mm]/)?l=!0:0<a.ic.segments.length&&(a.ic.isFilled=!0);break;case "U":r="";for(q=1;n[u+q];)if(null!==n[u+q].match(/[Ff]/))q++;else if(null===n[u+q].match(C))q++;else{r=n[u+q];break}r.match(/[Mm]/)?m=!0:a.Ym(!1)}k=a.Kt;Wd=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=!0;return k}
  function Xd(a,b){for(var c=a.length,d=J.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ta(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ta(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ta(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ta(d);f[6]=d.x;f[7]=d.y}J.free(d)}t.gw=function(){if(this.ra||this.Xr!==this.figures.Ba)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].gw())return!0;return!1};
  rd.prototype.computeBounds=function(){this.ra=!1;this.ln=this.al=null;this.mn=NaN;this.Xr=this.figures.Ba;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.ra=!1;var e=d.segments;d.bt=e.Ba;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.ra=!1;g.Qd=null}}a=this.Fr;a.ea();isNaN(this.Dl)||isNaN(this.Cl)?a.h(0,0,0,0):a.h(0,0,this.Dl,this.Cl);Yd(this,a,!1);bc(a,0,0,0,0);a.freeze()};rd.prototype.ey=function(){var a=new N;Yd(this,a,!0);return a};
  function Yd(a,b,c){switch(a.type){case ud:case yd:case zd:c?b.h(a.cd,a.dd,0,0):bc(b,a.cd,a.dd,0,0);bc(b,a.hc,a.oc,0,0);break;case sd:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):bc(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case wd:case Zd:k=n.endX;l=n.endY;bc(b,k,l,0,0);break;case $d:L.vm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
  break;case ae:L.pw(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case be:case ce:var p=n.type===be?de(n,f):ee(n,f,k,l),r=p.length;if(0===r){k=n.type===be?n.centerX:n.endX;l=n.type===be?n.centerY:n.endY;bc(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],L.vm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:B("Unknown Segment type: "+n.type)}}}break;default:B("Unknown Geometry type: "+a.type)}}
  rd.prototype.normalize=function(){this.v&&va(this);var a=this.ey();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};rd.prototype.offset=function(a,b){this.v&&va(this);this.transform(1,0,0,1,a,b);return this};rd.prototype.scale=function(a,b){this.v&&va(this);this.transform(a,0,0,b,0,0);return this};rd.prototype.rotate=function(a,b,c){this.v&&va(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=ld.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);ld.free(d);return this};
  t=rd.prototype;
  t.transform=function(a,b,c,d,e,f){switch(this.type){case ud:case yd:case zd:var g=this.cd;var h=this.dd;this.cd=g*a+h*c+e;this.dd=g*b+h*d+f;g=this.hc;h=this.oc;this.hc=g*a+h*c+e;this.oc=g*b+h*d+f;break;case sd:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case wd:case Zd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case $d:g=q.point1X;h=q.point1Y;
  q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case ae:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case be:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(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 ce:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;if(0===q.radiusX||0===q.radiusY)break;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.$=function(a,b){void 0===b&&(b=0);var c=this.cd,d=this.dd,e=this.hc,f=this.oc;switch(this.type){case ud:return L.Nb(c,d,e,f,b,a.x,a.y);case yd:var g=N.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.$(a);N.free(g);return a;case zd:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case sd:return fe(this,a,b,!0,!1);default:return!1}};
  function fe(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.$(f,b,c))return!0;var w=u.segments;k=u.startX;l=u.startY;for(var v=k,y=l,z=w.j,A=0;A<=w.length;A++){var C=void 0;if(A!==w.length){C=z[A];var F=C.type;a=C.endX;n=C.endY}else F=wd,a=v,n=y;switch(F){case Zd:v=ge(f,b,g,b,k,l,v,y);if(isNaN(v))return!0;h+=v;v=a;y=n;break;case wd:k=ge(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case $d:m=L.xq(k,l,C.point1X,
  C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case ae:m=L.xq(k,l,(k+2*C.point1X)/3,(l+2*C.point1Y)/3,(2*C.point1X+a)/3,(2*C.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case be:case ce:F=C.type===be?de(C,u):ee(C,u,k,l);var Q=F.length;if(0===Q){k=ge(f,b,g,b,k,l,C.type===be?C.centerX:C.endX,C.type===be?C.centerY:C.endY);if(isNaN(k))return!0;h+=k;break}C=null;for(var K=0;K<Q;K++){C=F[K];if(0===K){m=ge(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=L.xq(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],
  g,b,f,b,.5);h+=m}null!==C&&(a=C[6],n=C[7]);break;default:B("Unknown Segment type: "+C.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.$(f,b,e?c:c+2))return!0}return 0!==h}
  function ge(a,b,c,d,e,f,g,h){if(L.Nb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}function he(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].$(b,c,d))return!0;return!1}
  t.Xv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===ud)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
  t.vy=function(a){0>a?a=0:1<a&&(a=1);if(this.type===ud)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
  t.Yv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===ud)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*a+
  3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
  t.wy=function(a){if(this.type===ud){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<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=J.alloc();L.Qh(b,c,d,e,f,a,h);a=h.x;f=h.y;J.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===yd){g=this.startX;h=this.startY;var 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=J.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var w=
  p[u],v=p[u+1];if(0!==u){L.Qh(l,m,w,v,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=w;m=v}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
  function ie(a){if(null===a.al){var b=a.al=[],c=a.ln=[],d=[],e=[];if(a.type===ud)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===yd)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
  a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===zd){var f=new je;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new ke(be);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=de(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];L.Fe(g,f,k[2],k[3],
  k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(le(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Zd:4<=d.length&&(b.push(d),c.push(le(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case wd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case $d:L.Fe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
  .5,d);g=p.endX;f=p.endY;break;case ae:L.Vq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case be:var r=de(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var w=r[u];L.Fe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[7]}break;case ce:r=ee(p,e,g,f);q=r.length;u=p.endX;w=p.endY;if(0===q){d.push(u);d.push(w);g=u;f=w;break}for(u=0;u<q;u++)w=r[u],L.Fe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],f=w[7];break;default:B("Segment not of valid type: "+
  p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(le(d)))}}}function le(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&b.push(Math.sqrt(yb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.Jj.add(a);return this};t.Zm=function(a,b,c,d,e,f,g,h){this.v&&va(this);this.pf=(new O(a,b,e,f)).freeze();this.qf=(new O(c,d,g,h)).freeze();return this};
  na.Object.defineProperties(rd.prototype,{flattenedSegments:{get:function(){ie(this);return this.al}},flattenedLengths:{get:function(){ie(this);return this.ln}},flattenedTotalLength:{get:function(){var a=this.mn;if(isNaN(a)){if(this.type===ud){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===yd)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
  this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.mn=a}return a}},type:{get:function(){return this.qa},set:function(a){this.qa!==a&&(this.v&&va(this,a),this.qa=a,this.ra=!0)}},startX:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.v&&va(this,a),this.cd=a,this.ra=!0)}},startY:{get:function(){return this.dd},set:function(a){this.dd!==
  a&&(this.v&&va(this,a),this.dd=a,this.ra=!0)}},endX:{get:function(){return this.hc},set:function(a){this.hc!==a&&(this.v&&va(this,a),this.hc=a,this.ra=!0)}},endY:{get:function(){return this.oc},set:function(a){this.oc!==a&&(this.v&&va(this,a),this.oc=a,this.ra=!0)}},figures:{get:function(){return this.Jj},set:function(a){this.Jj!==a&&(this.v&&va(this,a),this.Jj=a,this.ra=!0)}},spot1:{
  get:function(){return this.pf},set:function(a){this.v&&va(this,a);this.pf=a.H()}},spot2:{get:function(){return this.qf},set:function(a){this.v&&va(this,a);this.qf=a.H()}},defaultStretch:{get:function(){return this.Sf},set:function(a){this.v&&va(this,a);this.Sf=a}},bounds:{get:function(){this.gw()&&this.computeBounds();return this.Fr}}});rd.prototype.setSpots=rd.prototype.Zm;rd.prototype.add=rd.prototype.add;
  rd.prototype.getFractionForPoint=rd.prototype.wy;rd.prototype.getPointAndAngleAlongPath=rd.prototype.Yv;rd.prototype.getAngleAlongPath=rd.prototype.vy;rd.prototype.getPointAlongPath=rd.prototype.Xv;rd.prototype.containsPoint=rd.prototype.$;rd.prototype.transform=rd.prototype.transform;rd.prototype.rotate=rd.prototype.rotate;rd.prototype.scale=rd.prototype.scale;rd.prototype.offset=rd.prototype.offset;rd.prototype.normalize=rd.prototype.normalize;rd.prototype.computeBoundsWithoutOrigin=rd.prototype.ey;
  rd.prototype.equalsApprox=rd.prototype.Qa;var ud=new D(rd,"Line",0),yd=new D(rd,"Rectangle",1),zd=new D(rd,"Ellipse",2),sd=new D(rd,"Path",3),Ed="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";rd.className="Geometry";rd.stringify=xd;rd.fillPath=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};rd.parse=Dd;rd.Line=ud;rd.Rectangle=yd;rd.Ellipse=zd;rd.Path=sd;
  function je(a,b,c,d){Xa(this);this.sx=null;this.v=!1;void 0===c&&(c=!0);this.js=c;void 0===d&&(d=!0);this.os=d;void 0!==a?this.cd=a:this.cd=0;void 0!==b?this.dd=b:this.dd=0;this.dm=new E;this.bt=this.dm.Ba;this.ra=!0}je.prototype.copy=function(){var a=new je;a.js=this.js;a.os=this.os;a.cd=this.cd;a.dd=this.dd;for(var b=this.dm.j,c=b.length,d=a.dm,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.bt=this.bt;a.ra=this.ra;a.sx=this.sx;return a};t=je.prototype;
  t.Qa=function(a){if(!(a instanceof je&&L.A(this.startX,a.startX)&&L.A(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Qa(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"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;e<d;e++)b+=" "+c[e].toString(a);return b};
  t.freeze=function(){this.v=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ea=function(){this.v=!1;var a=this.segments;a.ea();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.gw=function(){if(this.ra)return!0;var a=this.segments;if(this.bt!==a.Ba)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].ra)return!0;return!1};t.add=function(a){this.dm.add(a);return this};
  t.$=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Zd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case wd:if(L.Nb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case $d:if(L.yt(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case ae:if(L.qw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case be:case ce:var n=m.type===
  be?de(m,this):ee(m,this,d,e),p=n.length,r=m.type===be?m.centerX:m.endX,q=m.type===be?m.centerY:m.endY;if(0===p){if(L.Nb(d,e,r,q,c,a,b))return!0;d=r;e=q;break}r=null;for(q=0;q<p;q++)if(r=n[q],0===q&&L.Nb(d,e,r[0],r[1],c,a,b)||L.yt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:B("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&L.Nb(d,e,f,g,c,a,b))return!0}return!1};
  na.Object.defineProperties(je.prototype,{isFilled:{get:function(){return this.js},set:function(a){this.v&&va(this,a);this.js=a}},isShadowed:{get:function(){return this.os},set:function(a){this.v&&va(this,a);this.os=a}},startX:{get:function(){return this.cd},set:function(a){this.v&&va(this,a);this.cd=a;this.ra=!0}},startY:{get:function(){return this.dd},set:function(a){this.v&&va(this,
  a);this.dd=a;this.ra=!0}},segments:{get:function(){return this.dm},set:function(a){this.v&&va(this,a);this.dm=a;this.ra=!0}}});je.prototype.add=je.prototype.add;je.prototype.equalsApprox=je.prototype.Qa;je.className="PathFigure";
  function ke(a,b,c,d,e,f,g,h){Xa(this);this.v=!1;void 0===a&&(a=wd);this.qa=a;void 0!==b?this.hc=b:this.hc=0;void 0!==c?this.oc=c:this.oc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===ce?(a=f%360,0>a&&(a+=360),this.Ce=a,this.Qi=0,this.Ri=Math.max(d,0),this.qh=Math.max(e,0),this.Ll="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.el=!!h):(this.Ce=d,this.Qi=e,a===be&&(f=Math.max(f,0)),this.Ri=f,"number"===typeof g?(a===be&&(g=Math.max(g,0)),this.qh=g):this.qh=0,
  this.el=this.Ll=!1);this.Oj=!1;this.ra=!0;this.Qd=null}ke.prototype.copy=function(){var a=new ke;a.qa=this.qa;a.hc=this.hc;a.oc=this.oc;a.Ce=this.Ce;a.Qi=this.Qi;a.Ri=this.Ri;a.qh=this.qh;a.Ll=this.Ll;a.el=this.el;a.Oj=this.Oj;a.ra=this.ra;return a};t=ke.prototype;
  t.Qa=function(a){if(!(a instanceof ke)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Zd:case wd:return L.A(this.endX,a.endX)&&L.A(this.endY,a.endY);case $d:return L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)&&L.A(this.point1X,a.point1X)&&L.A(this.point1Y,a.point1Y)&&L.A(this.point2X,a.point2X)&&L.A(this.point2Y,a.point2Y);case ae:return L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)&&L.A(this.point1X,a.point1X)&&L.A(this.point1Y,a.point1Y);case be:return L.A(this.startAngle,
  a.startAngle)&&L.A(this.sweepAngle,a.sweepAngle)&&L.A(this.centerX,a.centerX)&&L.A(this.centerY,a.centerY)&&L.A(this.radiusX,a.radiusX)&&L.A(this.radiusY,a.radiusY);case ce:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&L.A(this.xAxisRotation,a.xAxisRotation)&&L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)&&L.A(this.radiusX,a.radiusX)&&L.A(this.radiusY,a.radiusY);default:return!1}};t.jb=function(a){a.classType===ke&&(this.type=a)};
  t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Zd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case wd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case $d: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 ae: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 be: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 ce: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.Oj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.close=function(){this.Oj=!0;return this};
  function de(a,b){if(null!==a.Qd&&!1===b.ra)return a.Qd;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Qd=[],a.Qd;b=a.Ce;var e=a.Qi,f=L.hy(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=ld.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Xd(f,g);ld.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.Qd=f;return a.Qd}
  function ee(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Qd&&!1===b.ra)return a.Qd;if(0===a.radiusX||0===a.radiusY)return a.Qd=[],a.Qd;b=a.Ri;var f=a.qh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Ce,h=a.Ll,k=a.el,l=a.hc,m=a.oc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/
  (b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=L.hy(0,0,b>f?b:f,m,m+g,!0);f=ld.alloc();f.reset();f.translate(c,d);f.rotate(a.Ce,0,0);f.scale(k,r);Xd(b,f);ld.free(f);a.Qd=b;return a.Qd}
  na.Object.defineProperties(ke.prototype,{isClosed:{get:function(){return this.Oj},set:function(a){this.Oj!==a&&(this.Oj=a,this.ra=!0)}},type:{get:function(){return this.qa},set:function(a){this.v&&va(this,a);this.qa=a;this.ra=!0}},endX:{get:function(){return this.hc},set:function(a){this.v&&va(this,a);this.hc=a;this.ra=!0}},endY:{get:function(){return this.oc},set:function(a){this.v&&
  va(this,a);this.oc=a;this.ra=!0}},point1X:{get:function(){return this.Ce},set:function(a){this.v&&va(this,a);this.Ce=a;this.ra=!0}},point1Y:{get:function(){return this.Qi},set:function(a){this.v&&va(this,a);this.Qi=a;this.ra=!0}},point2X:{get:function(){return this.Ri},set:function(a){this.v&&va(this,a);this.Ri=a;this.ra=!0}},point2Y:{get:function(){return this.qh},set:function(a){this.v&&
  va(this,a);this.qh=a;this.ra=!0}},centerX:{get:function(){return this.Ce},set:function(a){this.v&&va(this,a);this.Ce=a;this.ra=!0}},centerY:{get:function(){return this.Qi},set:function(a){this.v&&va(this,a);this.Qi=a;this.ra=!0}},radiusX:{get:function(){return this.Ri},set:function(a){0>a&&wa(a,">= zero",ke,"radiusX");this.v&&va(this,a);this.Ri=a;this.ra=!0}},radiusY:{get:function(){return this.qh},
  set:function(a){0>a&&wa(a,">= zero",ke,"radiusY");this.v&&va(this,a);this.qh=a;this.ra=!0}},startAngle:{get:function(){return this.hc},set:function(a){this.hc!==a&&(this.v&&va(this,a),a%=360,0>a&&(a+=360),this.hc=a,this.ra=!0)}},sweepAngle:{get:function(){return this.oc},set:function(a){this.v&&va(this,a);360<a&&(a=360);-360>a&&(a=-360);this.oc=a;this.ra=!0}},isClockwiseArc:{get:function(){return this.el},set:function(a){this.v&&
  va(this,a);this.el=a;this.ra=!0}},isLargeArc:{get:function(){return this.Ll},set:function(a){this.v&&va(this,a);this.Ll=a;this.ra=!0}},xAxisRotation:{get:function(){return this.Ce},set:function(a){a%=360;0>a&&(a+=360);this.v&&va(this,a);this.Ce=a;this.ra=!0}}});ke.prototype.equalsApprox=ke.prototype.Qa;
  var Zd=new D(ke,"Move",0),wd=new D(ke,"Line",1),$d=new D(ke,"Bezier",2),ae=new D(ke,"QuadraticBezier",3),be=new D(ke,"Arc",4),ce=new D(ke,"SvgArc",4);ke.className="PathSegment";ke.Move=Zd;ke.Line=wd;ke.Bezier=$d;ke.QuadraticBezier=ae;ke.Arc=be;ke.SvgArc=ce;function me(){this.B=null;this.yv=(new J(0,0)).freeze();this.Iu=(new J(0,0)).freeze();this.xr=this.zs=0;this.yr=1;this.Di="";this.st=this.Rr=!1;this.Or=this.Ar=0;this.Pg=this.bs=this.ms=!1;this.Wr=null;this.nt=0;this.pd=this.mt=null}
  me.prototype.copy=function(){var a=new me;return this.clone(a)};me.prototype.clone=function(a){a.B=this.B;a.yv.assign(this.viewPoint);a.Iu.assign(this.documentPoint);a.zs=this.zs;a.xr=this.xr;a.yr=this.yr;a.Di=this.Di;a.Rr=this.Rr;a.st=this.st;a.Ar=this.Ar;a.Or=this.Or;a.ms=this.ms;a.bs=this.bs;a.Pg=this.Pg;a.Wr=this.Wr;a.nt=this.nt;a.mt=this.mt;a.pd=this.pd;return a};
  me.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};me.prototype.Jq=function(a,b){var c=this.diagram;if(null===c)return b;ue(c,this.event,a,b);return b};
  me.prototype.mA=function(a,b){var c=this.diagram;if(null===c)return b;ue(c,this.event,a,b);b.assign(c.ou(b));return b};
  na.Object.defineProperties(me.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{get:function(){return this.yv},set:function(a){this.yv.assign(a)}},documentPoint:{get:function(){return this.Iu},set:function(a){this.Iu.assign(a)}},modifiers:{get:function(){return this.zs},set:function(a){this.zs=a}},button:{get:function(){return this.xr},
  set:function(a){this.xr=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.yr},set:function(a){this.yr=a}},key:{get:function(){return this.Di},set:function(a){this.Di=a}},down:{get:function(){return this.Rr},set:function(a){this.Rr=a}},up:{get:function(){return this.st},set:function(a){this.st=
  a}},clickCount:{get:function(){return this.Ar},set:function(a){this.Ar=a}},delta:{get:function(){return this.Or},set:function(a){this.Or=a}},isMultiTouch:{get:function(){return this.ms},set:function(a){this.ms=a}},handled:{get:function(){return this.bs},set:function(a){this.bs=a}},bubbles:{get:function(){return this.Pg},set:function(a){this.Pg=a}},event:{
  get:function(){return this.Wr},set:function(a){this.Wr=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.nt},set:function(a){this.nt=a}},targetDiagram:{get:function(){return this.mt},set:function(a){this.mt=a}},targetObject:{
  get:function(){return this.pd},set:function(a){this.pd=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}}});
  me.prototype.getMultiTouchDocumentPoint=me.prototype.mA;me.prototype.getMultiTouchViewPoint=me.prototype.Jq;me.className="InputEvent";function ve(){this.B=null;this.oa="";this.Js=this.kt=null}ve.prototype.copy=function(){var a=new ve;a.B=this.B;a.oa=this.oa;a.kt=this.kt;a.Js=this.Js;return a};ve.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
  na.Object.defineProperties(ve.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},name:{get:function(){return this.oa},set:function(a){this.oa=a}},subject:{get:function(){return this.kt},set:function(a){this.kt=a}},parameter:{get:function(){return this.Js},set:function(a){this.Js=a}}});ve.className="DiagramEvent";
  function we(){this.wn=xe;this.gf=this.ys="";this.hp=this.ip=this.op=this.pp=this.np=this.B=this.cc=null}we.prototype.clear=function(){this.hp=this.ip=this.op=this.pp=this.np=this.B=this.cc=null};
  we.prototype.copy=function(){var a=new we;a.wn=this.wn;a.ys=this.ys;a.gf=this.gf;a.cc=this.cc;a.B=this.B;a.np=this.np;var b=this.pp;a.pp=za(b)&&"function"===typeof b.H?b.H():b;b=this.op;a.op=za(b)&&"function"===typeof b.H?b.H():b;b=this.ip;a.ip=za(b)&&"function"===typeof b.H?b.H():b;b=this.hp;a.hp=za(b)&&"function"===typeof b.H?b.H():b;return a};we.prototype.jb=function(a){a.classType===we&&(this.change=a)};
  we.prototype.toString=function(){var a="";a=this.change===ye?a+"* ":this.change===xe?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===ye?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ka(this.object)),null!==this.oldValue&&(a+="  old: "+Ka(this.oldValue)),null!==
  this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Ka(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};we.prototype.G=function(a){return a?this.oldValue:this.newValue};we.prototype.oA=function(a){return a?this.oldParam:this.newParam};we.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
  we.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};we.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};we.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
  na.Object.defineProperties(we.prototype,{model:{get:function(){return this.cc},set:function(a){this.cc=a}},diagram:{get:function(){return this.B},set:function(a){this.B=a}},change:{get:function(){return this.wn},set:function(a){this.wn=a}},modelChange:{get:function(){return this.ys},set:function(a){this.ys=a}},propertyName:{get:function(){return this.gf},
  set:function(a){this.gf=a}},isTransactionFinished:{get:function(){return this.wn===ye&&("CommittedTransaction"===this.gf||"FinishedUndo"===this.gf||"FinishedRedo"===this.gf)}},object:{get:function(){return this.np},set:function(a){this.np=a}},oldValue:{get:function(){return this.pp},set:function(a){this.pp=a}},oldParam:{get:function(){return this.op},set:function(a){this.op=a}},
  newValue:{get:function(){return this.ip},set:function(a){this.ip=a}},newParam:{get:function(){return this.hp},set:function(a){this.hp=a}}});we.prototype.redo=we.prototype.redo;we.prototype.canRedo=we.prototype.canRedo;we.prototype.undo=we.prototype.undo;we.prototype.canUndo=we.prototype.canUndo;we.prototype.getParam=we.prototype.oA;we.prototype.getValue=we.prototype.G;we.prototype.clear=we.prototype.clear;
  var ye=new D(we,"Transaction",-1),xe=new D(we,"Property",0),ze=new D(we,"Insert",1),Ae=new D(we,"Remove",2);we.className="ChangedEvent";we.Transaction=ye;we.Property=xe;we.Insert=ze;we.Remove=Ae;function Be(){this.u=(new E).freeze();this.oa="";this.l=!1}Be.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.J(c);null!==d&&(b+="\n  "+d.toString())}}return b};
  Be.prototype.clear=function(){var a=this.changes;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.J(b);null!==c&&c.clear()}a.clear();a.freeze()};Be.prototype.canUndo=function(){return this.isComplete};Be.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.J(a);null!==b&&b.undo()}};Be.prototype.canRedo=function(){return this.isComplete};
  Be.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.J(b);null!==c&&c.redo()}};
  Be.prototype.nw=function(){if(this.isComplete){var a=this.changes;a.ea();for(var b=new H,c=0;c<a.count;c++){var d=a.J(c);if(null!==d&&d.change===xe&&d.object){var e=b.get(d.object);e||(e=new H,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Pc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.J(c),null!==d&&(c>b&&a.Pc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}};
  na.Object.defineProperties(Be.prototype,{changes:{get:function(){return this.u}},name:{get:function(){return this.oa},set:function(a){this.oa=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});Be.prototype.optimize=Be.prototype.nw;Be.prototype.redo=Be.prototype.redo;Be.prototype.canRedo=Be.prototype.canRedo;Be.prototype.undo=Be.prototype.undo;Be.prototype.canUndo=Be.prototype.canUndo;
  Be.prototype.clear=Be.prototype.clear;Be.className="Transaction";function Ce(){this.gv=new G;this.md=!1;this.I=(new E).freeze();this.Xd=-1;this.u=999;this.se=!1;this.Lr=null;this.Yi=0;this.l=!1;this.ye=(new E).freeze();this.Tl=new E;this.Qu=!0;this.Wu=this.ks=this.$u=this.Zu=!1}
  Ce.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.J(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.J(d).toString(a-1);return b};
  Ce.prototype.clear=function(){var a=this.history;a.ea();for(var b=a.count-1;0<=b;b--){var c=a.J(b);null!==c&&c.clear()}a.clear();this.Xd=-1;a.freeze();this.se=!1;this.Lr=null;this.Yi=0;this.ye.ea();this.ye.clear();this.ye.freeze();this.Tl.clear();this.Wu=this.ks=this.$u=this.Zu=!1};Ce.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Ce.prototype;t.Vx=function(a){this.gv.add(a)};t.Py=function(a){this.gv.remove(a)};
  t.xa=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Qu&&(this.Qu=!1,this.Yi++,this.isInternalTransaction||this.Bb("StartingFirstTransaction",a,this.currentTransaction),0<this.Yi&&this.Yi--);this.isEnabled&&(this.ye.ea(),this.ye.add(a),this.ye.freeze(),null===this.currentTransaction?this.Tl.add(0):this.Tl.add(this.currentTransaction.changes.count));this.Yi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Bb("StartedTransaction",a,this.currentTransaction));
  return b};t.Xa=function(a){void 0===a&&(a="");return De(this,!0,a)};t.If=function(){return De(this,!1,"")};
  function De(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&xa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Bb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.Yi--,a.isEnabled)){var g=a.ye.count;0<g&&(""===c&&(c=a.ye.J(0)),a.ye.ea(),a.ye.cb(g-1),a.ye.freeze());g=a.Tl.count;0<g&&(f=a.Tl.J(g-1),a.Tl.cb(g-1))}if(d){if(b){a.ks=!1;null===e&&""!==
  c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ea();for(d=b.count-1;d>a.historyIndex;d--)f=b.J(d),null!==f&&f.clear(),b.cb(d),a.ks=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.J(0),null!==f&&f.clear(),b.cb(0),a.Xd--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Xd++);b.freeze()}a.isInternalTransaction||a.Bb("CommittedTransaction",c,e)}else{a.se=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
  a.Bb("RolledBackTransaction",c,e),a.se=!1}null!==e&&e.clear()}a.Lr=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.J(e),null!==b&&b.undo(),c.ea(),c.cb(e);c.freeze()}return!1}Ce.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
  Ce.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.se=!0,this.Bb("StartingUndo","Undo",a),this.Xd--,a.undo()}catch(b){xa("undo error: "+b.toString())}finally{this.Bb("FinishedUndo","Undo",a),this.se=!1}}};Ce.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
  Ce.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.se=!0,this.Bb("StartingRedo","Redo",a),this.Xd++,a.redo()}catch(b){xa("redo error: "+b.toString())}finally{this.Bb("FinishedRedo","Redo",a),this.se=!1}}};Ce.prototype.Bb=function(a,b,c){void 0===c&&(c=null);var d=new we;d.change=ye;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.zt(d)};
  Ce.prototype.aw=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Lr=b=new Be);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Qu&&(a=a.diagram,null!==a&&!1===a.pj||xa("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(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
  na.Object.defineProperties(Ce.prototype,{models:{get:function(){return this.gv.iterator}},isEnabled:{get:function(){return this.md},set:function(a){this.md=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.J(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
  1?this.history.J(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.se}},history:{get:function(){return this.I}},maxHistoryLength:{get:function(){return this.u},set:function(a){this.u=a}},historyIndex:{get:function(){return this.Xd}},currentTransaction:{get:function(){return this.Lr}},transactionLevel:{
  get:function(){return this.Yi}},isInTransaction:{get:function(){return 0<this.Yi}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.ye}},isPendingClear:{get:function(){return this.Zu},set:function(a){this.Zu=a}},isPendingUnmodified:{get:function(){return this.$u},set:function(a){this.$u=
  a}},isInternalTransaction:{get:function(){return this.Wu},set:function(a){this.Wu=a}},isJustDiscarded:{get:function(){return this.ks}}});Ce.prototype.handleChanged=Ce.prototype.aw;Ce.prototype.redo=Ce.prototype.redo;Ce.prototype.undo=Ce.prototype.undo;Ce.prototype.canUndo=Ce.prototype.canUndo;Ce.prototype.rollbackTransaction=Ce.prototype.If;Ce.prototype.commitTransaction=Ce.prototype.Xa;Ce.prototype.startTransaction=Ce.prototype.xa;
  Ce.prototype.removeModel=Ce.prototype.Py;Ce.prototype.addModel=Ce.prototype.Vx;Ce.prototype.clear=Ce.prototype.clear;Ce.className="UndoManager";function Ee(){Xa(this);this.B=Fe;this.oa="";this.md=!0;this.Sc=!1;this.ix=null;this.lz=new me;this.vt=-1}Ee.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ja(this.constructor)};Ee.prototype.updateAdornments=function(){};Ee.prototype.canStart=function(){return this.isEnabled};Ee.prototype.doStart=function(){};
  Ee.prototype.doActivate=function(){this.isActive=!0};Ee.prototype.doDeactivate=function(){this.isActive=!1};Ee.prototype.doStop=function(){};Ee.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Ee.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Ee.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Ee.prototype.doMouseMove=function(){};Ee.prototype.doMouseUp=function(){this.stopTool()};
  Ee.prototype.doMouseWheel=function(){};Ee.prototype.canStartMultiTouch=function(){return!0};Ee.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Jq(0,J.allocAt(NaN,NaN)),d=b.Jq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Bm("hasGestureZoom"))){a.Vl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.sv=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
  Ee.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Jq(0,J.allocAt(NaN,NaN)),d=b.Jq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Bm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.sv;e=new J((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.Vl;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}J.free(c);J.free(d)};
  Ee.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Ee.prototype.doKeyUp=function(){};Ee.prototype.xa=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.xa(a)};Ee.prototype.Jg=function(){var a=this.diagram;return null===this.transactionResult?a.If():a.Xa(this.transactionResult)};
  Ee.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.zm(b.documentPoint,!1);if(null!==c)if(Va?b.meta:b.control){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.R("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.R("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.R("ChangedSelection",
  a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(Va?b.meta:b.control)||b.shift||a.clearSelection()}};Ee.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.Vb(d.documentPoint,a,b);d.targetObject=a;Ge(a,d,c);return d.handled};
  function Ge(a,b,c){b.handled=!1;if(null===a||a.Hg()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.R(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.R(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
  a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
  Ee.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.sc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.$(b.documentPoint)?a.Vb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Ej){var f=a.Ej,g=f;a.Ej=d;this.doCurrentObjectChanged(f,d);for(b.handled=!1;null!==f;){var h=f.mouseLeave;if(null!==h){if(d===f)break;if(null!==d&&d.Gg(f))break;h(b,f,d);e=!0;if(b.handled)break}f=f.panel}f=g;for(b.handled=!1;null!==d;){g=
  d.mouseEnter;if(null!==g){if(f===d)break;if(null!==f&&f.Gg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Ej}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Db();a.skipsUndoManager=c}};Ee.prototype.doCurrentObjectChanged=function(){};
  Ee.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.o()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===He&&!b.shift||e===Ie&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===He&&b.shift||e===Ie&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
  if(Sa||Ta||Ua)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(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,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
  (e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.w(d)||(b.bubbles=!1)}}};Ee.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.lz);this.vt=ta(function(){c.doWaitAfter(d)},a)};Ee.prototype.cancelWaitAfter=function(){-1!==this.vt&&x.clearTimeout(this.vt);this.vt=-1};
  Ee.prototype.doWaitAfter=function(){};Ee.prototype.findToolHandleAt=function(a,b){a=this.diagram.Vb(a,function(a){for(;null!==a&&!(a.panel instanceof Je);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};Ee.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
  na.Object.defineProperties(Ee.prototype,{diagram:{get:function(){return this.B},set:function(a){a instanceof R&&(this.B=a)}},name:{get:function(){return this.oa},set:function(a){this.oa=a}},isEnabled:{get:function(){return this.md},set:function(a){this.md=a}},isActive:{get:function(){return this.Sc},set:function(a){this.Sc=a}},transactionResult:{get:function(){return this.ix},
  set:function(a){this.ix=a}}});Ee.prototype.stopTransaction=Ee.prototype.Jg;Ee.prototype.startTransaction=Ee.prototype.xa;Ee.className="Tool";function Pa(){Ee.call(this);this.name="ToolManager";this.Cc=new E;this.Tc=new E;this.Od=new E;this.T=this.Ka=850;this.u=(new M(2,2)).ca();this.eb=5E3;this.La=Ie;this.I=Ke;this.Kr=this.l=null;this.ik=-1}ma(Pa,Ee);Pa.prototype.initializeStandardTools=function(){};
  Pa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Je&&this.Kr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
  Pa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Qe&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Re){b.bubbles=!0;return}if(this.gestureBehavior===Qe)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.J(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===
  e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===Ie?this.mouseWheelBehavior=He:this.mouseWheelBehavior===He&&(this.mouseWheelBehavior=Ie));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
  Pa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Re){b.bubbles=!0;return}if(this.gestureBehavior===Qe)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.J(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Se(this,
  a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Se(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Pa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Je&&(b===a||b.Gg(a))||this.hideToolTip()};
  Pa.prototype.doWaitAfter=function(a){var b=this.diagram;b.ya&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.hk=!0,b.doMouseUp()))};
  Pa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Vb(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
  Pa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Vb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Je)||b!==a&&!b.Gg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
  Pa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Je){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ta();this.positionToolTip(a,b)}else a instanceof Te&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.ik&&(x.clearTimeout(this.ik),
  this.ik=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.ik=ta(function(){e.hideToolTip()},a)}};Pa.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
  Pa.prototype.hideToolTip=function(){-1!==this.ik&&(x.clearTimeout(this.ik),this.ik=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Je?(a.remove(b),null!==this.Kr&&this.Kr.Hf(b.category),b.data=null,b.adornedObject=null):b instanceof Te&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
  Pa.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.J(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Pa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Pa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
  Pa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Pa.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.J(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.J(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.J(c),d.name===a)return d;return null};
  Pa.prototype.replaceTool=function(a,b){null!==b&&(b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.J(d);if(e.name===a)return null!==b?this.mouseDownTools.Pc(d,b):this.mouseDownTools.cb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.J(d),e.name===a)return null!==b?this.mouseMoveTools.Pc(d,b):this.mouseMoveTools.cb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.J(d),e.name===a)return null!==b?this.mouseUpTools.Pc(d,
  b):this.mouseUpTools.cb(d),e;return null};Pa.prototype.Ya=function(a,b,c){null!==b&&(b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
  na.Object.defineProperties(Pa.prototype,{mouseWheelBehavior:{get:function(){return this.La},set:function(a){this.La=a}},gestureBehavior:{get:function(){return this.I},set:function(a){this.I=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.Kr=null!==a&&a instanceof Je?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Cc}},mouseMoveTools:{
  get:function(){return this.Tc}},mouseUpTools:{get:function(){return this.Od}},hoverDelay:{get:function(){return this.Ka},set:function(a){this.Ka=a}},holdDelay:{get:function(){return this.T},set:function(a){this.T=a}},dragSize:{get:function(){return this.u},set:function(a){this.u=a.H()}},toolTipDuration:{get:function(){return this.eb},set:function(a){this.eb=
  a}}});Pa.prototype.replaceStandardTool=Pa.prototype.Ya;var Ie=new D(Pa,"WheelScroll",0),He=new D(Pa,"WheelZoom",1),Ue=new D(Pa,"WheelNone",2),Ke=new D(Pa,"GestureZoom",3),Qe=new D(Pa,"GestureCancel",4),Re=new D(Pa,"GestureNone",5);Pa.className="ToolManager";Pa.WheelScroll=Ie;Pa.WheelZoom=He;Pa.WheelNone=Ue;Pa.GestureZoom=Ke;Pa.GestureCancel=Qe;Pa.GestureNone=Re;
  function Ve(){Ee.call(this);this.name="Dragging";this.I=this.Tc=!0;this.u=this.eb=this.Ka=this.qg=null;this.Tn=this.Od=!1;this.jm=new J(NaN,NaN);this.it=new J;this.Cc=!0;this.pl=100;this.Xg=[];this.lr=(new G).freeze();this.La=new We;this.Fo=null;this.T="copy";this.Wh="";this.Xh="no-drop"}ma(Ve,Ee);
  Ve.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.pl)?!1:null!==this.findDraggablePart()};
  Ve.prototype.findDraggablePart=function(){var a=this.diagram;a=a.zm(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
  Ve.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.zm(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.R("ChangingSelection",a.selection),b=a.lastInput,(Va?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.R("ChangedSelection",a.selection))}}};
  Ve.prototype.doActivate=function(){var a=this.diagram;this.Fo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Xe=null,this.isActive=!0,this.jm.set(a.position),Ye(this,a.selection),this.Xg.length=0,a.animationManager.Bc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.mu=!0,!0===a.Ke("temporaryPixelRatio")&&30<a.Yx&&Ze(a),$e(a,this.draggedParts),this.xa("Drag"),this.startPoint=a.firstInput.documentPoint,
  a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Tn=!1,Xe=this,af=this.diagram,this.doSimulatedDragOut()))};function Ye(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.Ck()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.nk(),a.qg=c.toolManager.findTool("Relinking"),null===a.qg&&(a.qg=new bf,a.qg.diagram=c)):(a.draggedLink=null,a.qg=null))}}
  Ve.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Ve.prototype.Cd=function(a){return void 0===a?new cf(Bb):this.isGridSnapEnabled?new cf(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new cf(a.copy())};
  Ve.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Jf();df(this);ef(a,this.draggedParts);this.draggedParts=this.currentPart=this.Fo=null;this.Tn=this.isDragOutStarted=!1;if(0<jf.count){for(var b=jf,c=b.length,d=0;d<c;d++){var e=b.J(d);kf(e);lf(e);df(e);e.diagram.Jf()}b.clear()}kf(this);this.jm.h(NaN,NaN);Xe=af=null;lf(this);a.isMouseCaptured=!1;a.currentCursor="";a.mu=!1;this.Jg();mf(a,!0)};
  function df(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;nf(a,b.lastInput,null);b.skipsUndoManager=c;a.Xg.length=0}function of(){var a=Xe;lf(a);pf(a);var b=a.diagram;a.jm.o()&&(b.position=a.jm);b.Jf()}Ve.prototype.doCancel=function(){lf(this);pf(this);var a=this.diagram;this.jm.o()&&(a.position=this.jm);this.stopTool()};Ve.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};
  Ve.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};
  function qf(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&&0<d.currentTransaction.changes.count&&(c.undoManager.If(),c.xa("Drag")):pf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Kf():c.selection;b=c.tk(b,c,!0);c=new H;for(d=a.draggedParts.iterator;d.next();){var e=
  d.key;if(e.Nc()&&e.canCopy()){var f=b.G(e);null!==f&&(f.location=e.location,f.Ta(),c.add(f,a.Cd(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof S&&d.canCopy()&&c.add(d,a.Cd());a.copiedParts=c;Ye(a,c.Kf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,rf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
  function lf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.gu(a.copiedParts.Kf(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new J(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
  function kf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.qg){var b=a.qg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.qg=null}}function sf(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.ge(e),c);J.free(f);!0===d.Ke("temporaryPixelRatio")&&null===d.yh&&30<d.Yx&&(Ze(d),d.Yq())}
  Ve.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&tf(d,a,b,this.dragOptions,c)};function pf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Nc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof S&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.Cd());rf(d,-e.x,-e.y)}b.hd()}}
  function uf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),vf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=nf(a,e,d);if(!a.isActive&&null===Xe)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof U)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Xe)return;
  a.doDragOver(b,d);if(!a.isActive&&null===Xe)return}finally{c.skipsUndoManager=f,g&&c.hd()}a.Fo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.Et(e.viewPoint)}Ve.prototype.findDragOverObject=function(a){var b=this;return wf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Je||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
  Ve.prototype.doUpdateCursor=function(a){var b=this.diagram;this.Fo!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
  function nf(a,b,c){var d=!1,e=a.Xg.length,f=0<e?a.Xg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Xg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Xg.length=0;if(!a.isActive&&null===Xe||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Xg.push(e),e=xf(e);e=a.Xg.length;for(c=0;c<e&&(g=a.Xg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
  function xf(a){var b=a.panel;return null!==b?b:a instanceof V&&!(a instanceof U)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function yf(a,b,c){var d=a.qg;if(null===d)return null;var e=a.diagram.Eg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=J.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.da(zc,a);k=b.Ie(k);k<f&&(g=h,f=k)}}J.free(a);return g}
  function vf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.qg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=yf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=yf(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.Ky&&d.R("LinkRelinked",c,d.Ky),c.toPort!==d.Ly&&d.R("LinkRelinked",c,d.Ly)):zf(e,g,f,k,h):zf(e,null,null,null,null)}}}}Ve.prototype.doDragOver=function(){};
  function Af(a,b){var c=a.diagram;a.dragsLink&&vf(a,!0);df(a);var d=a.findDragOverObject(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;Bf(a,e,f);f=xf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Xe){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof W&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Xe){a=N.alloc();for(b=
  c.selection.iterator;b.next();)d=b.value,d instanceof W&&Cf(c,d,a);N.free(a)}}}function Bf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof U||(c=a.mouseDrop,null!==c&&c(b))}function Cf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Ge(c)&&(d=!0);a=a.Vv(c,function(a){return a.part},function(a){return a instanceof S},!0,function(a){return a instanceof S},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Kd(b)&&c.isAvoiding&&c.Ua()}
  Ve.prototype.doDropOnto=function(){};Ve.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(qf(this,!1),$e(a,this.copiedParts),sf(this,this.copiedParts,!1),ef(a,this.copiedParts)):this.mayMove()?(lf(this),sf(this,this.draggedParts,!0)):this.mayDragOut()?(qf(this,!1),sf(this,this.copiedParts,!1)):lf(this),uf(this,a.lastInput.documentPoint))}};
  Ve.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(lf(this),qf(this,!0),$e(a,this.copiedParts),sf(this,this.copiedParts,!1),ef(a,this.copiedParts),null!==this.copiedParts&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,lf(this),this.mayMove()&&(sf(this,this.draggedParts,
  !0),uf(this,a.lastInput.documentPoint)));this.Tn=!0;Af(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Kf():this.draggedParts.Kf();this.copiedParts=null;b&&Df(this);a.Na();ef(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.R(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.R("ChangedSelection",a.selection)}}};
  Ve.prototype.simulatedMouseMove=function(a,b,c){if(null===Xe)return!1;var d=Xe.diagram;c instanceof R||(c=null);var e=af;c!==e&&(null!==e&&e!==d&&(e.Jf(),Xe.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),af=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<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.gr(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
  Ve.prototype.simulatedMouseUp=function(a,b,c){if(null===Xe)return!1;var d=af,e=Xe.diagram;if(null===c)return Xe.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Jf(),Xe.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;af=c;d=c.toolManager.findTool("Dragging");null!==d&&(of(),jf.contains(d)||jf.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
  (a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new J),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.gr(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Xe,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
  function Df(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof W&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.s())}}
  Ve.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Va?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
  Ve.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
  Ve.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canMove())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Ve.prototype.computeBorder=function(a,b,c){return this.Tn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Ve.prototype.lA=function(){return Xe};
  Ve.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Xe;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Ve.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Bc();Hf(a);a.animationManager.Bc();var b=Xe;null!==b&&(b.diagram.mu=!1);this.doUpdateCursor(a.grid)}};
  Ve.prototype.doSimulatedDragLeave=function(){var a=Xe;null!==a&&a.doSimulatedDragOut();this.doCancel()};Ve.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.tn=!0;var b=Xe;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;If(this,b.draggedParts.Kf(),!1,a.firstInput);sf(this,this.copiedParts,!1);uf(this,a.lastInput.documentPoint)}a.animationManager.tn=!1};
  Ve.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Xe;if(null!==b){var c=b.diagram;b.Tn=!0;lf(this);if(!this.mayDragIn())return;a.animationManager.tn=!0;a.R("ChangingSelection",a.selection);this.xa("Drop");If(this,b.draggedParts.Kf(),!0,a.lastInput);sf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Af(this,a.lastInput.documentPoint);a.Na();b=a.selection;null!==this.copiedParts?this.transactionResult=
  "ExternalCopy":b=new G;this.copiedParts=null;a.doFocus();a.R("ExternalObjectsDropped",b,c);this.Jg();a.R("ChangedSelection",a.selection)}a.animationManager.tn=!1};
  function If(a,b,c,d){if(null===a.copiedParts){var e=a.diagram;if(!e.isReadOnly&&!e.isModelReadOnly){e.skipsUndoManager=!c;e.partManager.addsToTemporaryLayer=!c;a.startPoint=d.documentPoint;c=e.tk(b,e,!0);var f=N.alloc();e=d=Infinity;for(var g=-Infinity,h=-Infinity,k=b.iterator;k.next();){var l=k.value;if(l.isVisible()){var m=l.location;l=m.x;m=m.y;isNaN(l)||isNaN(m)||(l<d&&(d=l),m<e&&(e=m),l>g&&(g=l),m>h&&(h=m))}}Infinity===d?f.h(0,0,0,0):f.h(d,e,g-d,h-e);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);
  f=a.it;g=new H;h=J.alloc();for(k=b.iterator;k.next();)l=k.value,l instanceof S&&l.canCopy()&&(m=c.G(l),null!==m&&(m.points=l.points,rf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.Cd())));for(b=b.iterator;b.next();)l=b.value,l.Nc()&&l.canCopy()&&(k=c.G(l),null!==k&&(l=l.location,h.h(f.x-(d-l.x),f.y-(e-l.y)),k.location=h,k.Ta(),g.add(k,a.Cd(h))));J.free(h);a.copiedParts=g;Ye(a,g.Kf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,rf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/
  2)))}}}Ve.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.mu=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Fo=null};Ve.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J};
  na.Object.defineProperties(Ve.prototype,{isCopyEnabled:{get:function(){return this.Tc},set:function(a){this.Tc=a}},copiesEffectiveCollection:{get:function(){return this.I},set:function(a){this.I=a}},dragOptions:{get:function(){return this.La},set:function(a){this.La=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
  a}},isComplexRoutingRealtime:{get:function(){return this.Cc},set:function(a){this.Cc=a}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){this.dragOptions.isGridSnapRealtime=a}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){this.dragOptions.gridSnapCellSize.w(a)||(a=a.H(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
  get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.w(a)||(a=a.H(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.w(a)||(a=a.H(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(a){this.dragOptions.dragsLink=
  a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},copyCursor:{get:function(){return this.T},set:function(a){this.T=a}},moveCursor:{get:function(){return this.Wh},set:function(a){this.Wh=a}},nodropCursor:{get:function(){return this.Xh},set:function(a){this.Xh=a}},currentPart:{get:function(){return this.Ka},
  set:function(a){this.Ka=a}},copiedParts:{get:function(){return this.u},set:function(a){this.u=a}},draggedParts:{get:function(){return this.eb},set:function(a){this.eb=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Kf():null!==this.draggedParts?this.draggedParts.Kf():this.lr}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
  a}},isDragOutStarted:{get:function(){return this.Od},set:function(a){this.Od=a}},startPoint:{get:function(){return this.it},set:function(a){this.it.w(a)||this.it.assign(a)}},delay:{get:function(){return this.pl},set:function(a){this.pl=a}}});Ve.prototype.getDraggingSource=Ve.prototype.lA;var jf=null,Xe=null,af=null;Ve.className="DraggingTool";jf=new E;
  Na("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Ya("Dragging",a,this.mouseMoveTools)});Pa.prototype.doCancel=function(){null!==Xe&&Xe.doCancel();Ee.prototype.doCancel.call(this)};
  function Jf(){Ee.call(this);this.Xh=100;this.La=!1;this.oi="pointer";var a=new S,b=new Kf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Kf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.gx=a;a=new W;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Jb;a.add(b);a.selectable=!1;a.layerName="Tool";this.ex=a;this.l=b;a=new W;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=
  2;b.desiredSize=Jb;a.add(b);a.selectable=!1;a.layerName="Tool";this.hx=a;this.u=b;this.Wh=this.Od=this.Cc=this.eb=this.Tc=null;this.Ka=!0;this.cz=new H;this.lr=this.Ii=this.bx=null}ma(Jf,Ee);Jf.prototype.doStop=function(){this.diagram.Jf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
  Jf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Af(),g=M.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;M.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=zc;f=J.alloc();c.location=b.da(zc,f);J.free(f);d.angle=b.lj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
  Jf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Jb,b.fromSpot=sc,b.toSpot=sc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Jf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
  Jf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof W){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
  !0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Et(a.lastInput.viewPoint)}};Jf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof W))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof W)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
  Jf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Eg(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 W){var k=g.da(zc,J.alloc()),l=c.x-k.x,m=c.y-k.y;J.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.G(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
  g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof W&&(null===c.layer||c.layer.allowLink))?b:null};
  Jf.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.fromLinkable))return!1;var c=b.fromMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.Fq(b).count>=c)return!1}return!0};
  Jf.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.Hd(b).count>=c)return!1}return!0};
  Jf.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};Jf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof W))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof W))return!1;b=b.portId;null===b&&(b="");for(b=d.Hd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
  Jf.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};Jf.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 G;d.add(a);return Lf(this,c,b,d)};
  function Lf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Lf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Lf(a,b.labeledLink,c,d))?!0:!1}
  Jf.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!==Mf){if(d===Nf){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!Of(this,a,b,c,!0)}if(d===Pf){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!Of(this,a,b,c,!0)}if(d===Qf)return a===b?a=!0:(d=new G,d.add(b),a=Rf(this,d,a,b,c)),!a;if(d===Sf)return!Of(this,a,b,c,!1);if(d===Tf)return a===b?a=!0:(d=new G,d.add(b),a=Uf(this,d,a,b,c)),!a}return!0};function Of(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&&Of(a,g,c,d,e)))return!0}return!1}
  function Rf(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&&Rf(a,b,g,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){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&Uf(a,b,h,d,e))return!0}}return!1}
  na.Object.defineProperties(Jf.prototype,{portGravity:{get:function(){return this.Xh},set:function(a){0<=a&&(this.Xh=a)}},isUnconnectedLinkValid:{get:function(){return this.La},set:function(a){this.La=a}},linkingCursor:{get:function(){return this.oi},set:function(a){this.oi=a}},temporaryLink:{get:function(){return this.gx},set:function(a){this.gx=a}},temporaryFromNode:{
  get:function(){return this.ex},set:function(a){if(this.ex=a)this.l=a.port}},temporaryFromPort:{get:function(){return this.l},set:function(a){if(null!==this.l){var b=this.l.panel;if(null!==b){var c=b.W.indexOf(this.l);b.cb(c);b.wb(c,a)}}this.l=a}},temporaryToNode:{get:function(){return this.hx},set:function(a){if(this.hx=a)this.u=a.port}},temporaryToPort:{get:function(){return this.u},set:function(a){if(null!==
  this.u){var b=this.u.panel;if(null!==b){var c=b.W.indexOf(this.u);b.cb(c);b.wb(c,a)}}this.u=a}},originalLink:{get:function(){return this.Tc},set:function(a){this.Tc=a}},originalFromNode:{get:function(){return this.eb},set:function(a){this.eb=a}},originalFromPort:{get:function(){return this.Cc},set:function(a){this.Cc=a}},originalToNode:{get:function(){return this.Od},set:function(a){this.Od=
  a}},originalToPort:{get:function(){return this.Wh},set:function(a){this.Wh=a}},isForwards:{get:function(){return this.Ka},set:function(a){this.Ka=a}},validPortsCache:{get:function(){return this.cz}},targetPort:{get:function(){return this.bx},set:function(a){this.bx=a}},linkValidation:{get:function(){return this.Ii},set:function(a){this.Ii=a}},portTargeted:{
  get:function(){return this.lr},set:function(a){this.lr=a}}});Jf.className="LinkingBaseTool";function Vf(){Jf.call(this);this.name="Linking";this.T={};this.I=null;this.K=Wf;this.en=null}ma(Vf,Jf);Vf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Ut()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
  Vf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Vb(a.firstInput.documentPoint,null,null));if(null===b)return null;a=b.part;if(!(a instanceof W))return null;var c=this.direction;if(c===Wf||c===Xf){var d=this.findValidLinkablePort(b,!1);if(null!==d||this.startObject===a&&(d=a.port,this.findValidLinkablePort(d,!1)))return this.isForwards=!0,d}if(c===Wf||c===Yf)if(b=this.findValidLinkablePort(b,!0),null!==b||this.startObject===a&&(b=a.port,this.findValidLinkablePort(b,
  !0)))return this.isForwards=!1,b;return null};
  Vf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.xa(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.o()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof W&&(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 W&&(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.Ua(),a.add(this.temporaryLink)),this.isActive=!0)};Vf.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.Jg()};
  Vf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.startObject=null};
  Vf.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof W&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,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?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint.copy():f.defaultFromPoint=a.lastInput.documentPoint.copy()),a.allowSelect&&(a.R("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.R("LinkDrawn",f)):this.doNoLink(b,c,
  d,e)):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.R("ChangedSelection",a.selection)}}};
  Vf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof S)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};Vf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Vf.prototype.doNoLink=function(){};
  na.Object.defineProperties(Vf.prototype,{archetypeLinkData:{get:function(){return this.T},set:function(a){this.T=a}},archetypeLabelNodeData:{get:function(){return this.I},set:function(a){this.I=a}},direction:{get:function(){return this.K},set:function(a){this.K=a}},startObject:{get:function(){return this.en},set:function(a){this.en=a}}});
  var Wf=new D(Vf,"Either",0),Xf=new D(Vf,"ForwardsOnly",0),Yf=new D(Vf,"BackwardsOnly",0);Vf.className="LinkingTool";Vf.Either=Wf;Vf.ForwardsOnly=Xf;Vf.BackwardsOnly=Yf;
  function bf(){Jf.call(this);this.name="Relinking";var a=new Kf;a.figure="Diamond";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.T=a;a=new Kf;a.figure="Diamond";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.en=a;this.I=null;this.Hx=new N}ma(bf,Jf);
  bf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){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.Gf()&&(c=a.wk(b),null===c&&(c=this.makeAdornment(d,!1),a.Gh(b,c)))}null===c&&a.Hf(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.Gf()&&
  (c=a.wk(b),null===c?(c=this.makeAdornment(d,!0),a.Gh(b,c)):c.s()));null===c&&a.Hf(b)}};bf.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};
  bf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Ut()||!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};
  bf.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 S))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.xa(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
  this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Hx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Ib),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
  (null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Ib),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1))));this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1);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.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.Ua(),a.add(this.temporaryLink));this.isActive=!0};
  bf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Zf||c===$f)c=ag;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
  bf.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.Jg()};bf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.handle=null};
  bf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof W&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
  this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint.copy():f.defaultFromPoint=a.lastInput.documentPoint.copy(),f.Ua()),this.transactionResult=this.name,a.R("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Oq(this.Hx)}this.stopTool()};
  bf.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};bf.prototype.doNoRelink=function(){};
  function zf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
  na.Object.defineProperties(bf.prototype,{fromHandleArchetype:{get:function(){return this.T},set:function(a){this.T=a}},toHandleArchetype:{get:function(){return this.en},set:function(a){this.en=a}},handle:{get:function(){return this.I},set:function(a){if(null!==a&&!(a.part instanceof Je))throw Error("new handle is not in an Adornment: "+a);this.I=a}}});bf.className="RelinkingTool";
  Na("linkingTool",function(){return this.findTool("Linking")},function(a){this.Ya("Linking",a,this.mouseMoveTools)});Na("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Ya("Relinking",a,this.mouseDownTools)});
  function bg(){Ee.call(this);this.name="LinkReshaping";var a=new Kf;a.figure="Rectangle";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";this.u=a;a=new Kf;a.figure="Diamond";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.I=a;this.T=3;this.wu=this.l=null;this.Ix=new J;this.Is=new E}ma(bg,Ee);bg.prototype.Zv=function(a){return a&&a.Os&&0!==a.Os.value?a.Os:cg};bg.prototype.Xm=function(a,b){a.Os=b};
  bg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.o()&&a.isVisible()&&c.actualBounds.o()&&c.Gf()&&(b=a.wk(this.name),null===b||b.Ex!==a.pointsCount||b.Sx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Ex=a.pointsCount,b.Sx=a.resegmentable,a.Gh(this.name,b)))}null===b&&a.Hf(this.name)}};
  bg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Je;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==dg)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);L.A(k.x,l.x)&&
  L.A(k.y,l.y)&&(l=b.i(c-1));L.A(k.x,l.x)?(this.Xm(h,eg),h.cursor="n-resize"):L.A(k.y,l.y)&&(this.Xm(h,fg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),L.A(k.x,l.x)&&L.A(k.y,l.y)&&(k=b.i(f+1)),L.A(k.x,l.x)?(this.Xm(h,eg),h.cursor="n-resize"):L.A(k.y,l.y)&&(this.Xm(h,fg),h.cursor="w-resize")):g!==f&&(this.Xm(h,tg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};bg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
  bg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};bg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
  bg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof S){this.wu=b;a.isMouseCaptured=!0;this.xa(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.wb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.wb(this.handle.segmentIndex+1,d);b.points=c;b.Lb();b.updateAdornments();
  this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.Ix=b.i(this.handle.segmentIndex);this.Is=b.points.copy();this.isActive=!0}}};bg.prototype.doDeactivate=function(){this.Jg();this.wu=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};bg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Is);this.stopTool()};bg.prototype.getResegmentingPoint=function(){return this.handle.da(zc)};
  bg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
  bg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(ug(this,g,d,e,f,!0)||ug(this,g,d,e,f,!1))){var h=b.points.copy();ug(this,g,d,
  e,f,!0)?(h.Pc(c-2,new J(g.x,(f.y+g.y)/2)),h.Pc(c+1,new J(f.x,(f.y+g.y)/2))):(h.Pc(c-2,new J((f.x+g.x)/2,g.y)),h.Pc(c+1,new J((f.x+g.x)/2,f.y)));h.cb(c);h.cb(c-1);b.points=h;b.Lb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(ug(this,d,e,f,g,!0)||ug(this,d,e,f,g,!1))&&(h=b.points.copy(),ug(this,d,e,f,g,!0)?(h.Pc(c-1,new J(d.x,(d.y+g.y)/2)),h.Pc(c+2,new J(g.x,(d.y+g.y)/2))):(h.Pc(c-1,new J((d.x+g.x)/2,d.y)),h.Pc(c+2,new J((d.x+g.x)/2,g.y))),
  h.cb(c+1),h.cb(c),b.points=h,b.Lb())}}else g=J.alloc(),L.Qh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Ie(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.cb(c),b.points=d,b.Lb()),J.free(g)}a.Na();this.transactionResult=this.name;a.R("LinkReshaped",this.adornedLink,this.Is)}this.stopTool()};
  function ug(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
  bg.prototype.reshape=function(a){var b=this.adornedLink;b.Th();var c=this.handle.segmentIndex,d=this.Zv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===eg?(b.L(c,b.i(c-1).x,a.y),b.L(c+1,b.i(c+2).x,a.y)):d===fg&&(b.L(c,a.x,b.i(c-1).y),b.L(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===eg?(b.L(c-1,b.i(c-2).x,a.y),b.L(c,b.i(c+1).x,a.y)):d===fg&&(b.L(c-1,a.x,b.i(c-2).y),b.L(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);L.A(f.x,
  e.x)&&L.A(e.y,g.y)?(L.A(f.x,b.i(d-2).x)&&!L.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.L(d-1,a.x,f.y),L.A(g.y,b.i(d+2).y)&&!L.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.L(d+1,g.x,a.y)):L.A(f.y,e.y)&&L.A(e.x,g.x)?(L.A(f.y,b.i(d-2).y)&&!L.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.L(d-1,f.x,a.y),L.A(g.x,b.i(d+2).x)&&!L.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.L(d+1,a.x,g.y)):L.A(f.x,e.x)&&L.A(e.x,g.x)?(L.A(f.x,b.i(d-2).x)&&!L.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.L(d-1,a.x,f.y),L.A(g.x,b.i(d+2).x)&&
  !L.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.L(d+1,a.x,g.y)):L.A(f.y,e.y)&&L.A(e.y,g.y)&&(L.A(f.y,b.i(d-2).y)&&!L.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.L(d-1,f.x,a.y),L.A(g.y,b.i(d+2).y)&&!L.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.L(d+1,g.x,a.y));b.L(c,a.x,a.y)}else b.L(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).nc()&&(f=e.da(zc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.L(0,d.x,d.y),J.free(f),
  J.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).nc()&&(c=e.da(zc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.L(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.xf()};bg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Zv(this.handle)){case tg:return a;case eg:return new J(b.i(c).x,a.y);case fg:return new J(a.x,b.i(c).y);default:case cg:return b.i(c)}};
  na.Object.defineProperties(bg.prototype,{handleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},midHandleArchetype:{get:function(){return this.I},set:function(a){this.I=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}},adornedLink:{get:function(){return this.wu}},
  resegmentingDistance:{get:function(){return this.T},set:function(a){this.T=a}},originalPoint:{get:function(){return this.Ix}},originalPoints:{get:function(){return this.Is}}});bg.prototype.setReshapingBehavior=bg.prototype.Xm;bg.prototype.getReshapingBehavior=bg.prototype.Zv;var cg=new D(bg,"None",0),fg=new D(bg,"Horizontal",1),eg=new D(bg,"Vertical",2),tg=new D(bg,"All",3);bg.className="LinkReshapingTool";
  bg.None=cg;bg.Horizontal=fg;bg.Vertical=eg;bg.All=tg;Na("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Ya("LinkReshaping",a,this.mouseDownTools)});
  function vg(){Ee.call(this);this.name="Resizing";this.fg=(new M(1,1)).freeze();this.eg=(new M(9999,9999)).freeze();this.Qg=(new M(NaN,NaN)).freeze();this.I=!1;this.T=!0;this.ie=null;var a=new Kf;a.alignmentFocus=zc;a.figure="Rectangle";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.u=a;this.l=null;this.Hs=new J;this.Gx=new M;this.qp=new J;this.Nu=new M(0,0);this.Mu=new M(Infinity,Infinity);this.Lu=new M(1,1)}ma(vg,Ee);
  vg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.wk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Gf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.lj();wg(a)&&this.updateResizeHandles(c,b);a.Gh(this.name,c);return}}}a.Hf(this.name)}};
  vg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Je;b.type=X.Spot;b.locationSpot=zc;var c=new xg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,tc));b.add(this.makeHandle(a,vc));b.add(this.makeHandle(a,Dc));b.add(this.makeHandle(a,Bc));b.add(this.makeHandle(a,bd));b.add(this.makeHandle(a,dd));b.add(this.makeHandle(a,ed));b.add(this.makeHandle(a,cd))}else if(yg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
  vg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
  vg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Mb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.nc()&&(c=zc);if(0>=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)};vg.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};
  vg.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&&(a.isMouseCaptured=!0,a.animationManager.Bc(),this.xa(this.name),this.Hs.set(this.adornedObject.da(this.handle.alignment.mw())),this.qp.set(this.adornedObject.part.location),this.Gx.set(this.adornedObject.desiredSize),this.Lu=this.computeCellSize(),this.Nu=
  this.computeMinSize(),this.Mu=this.computeMaxSize(),this.isActive=!0))};vg.prototype.doDeactivate=function(){var a=this.diagram;this.Jg();this.ie=this.handle=null;this.isActive=a.isMouseCaptured=!1};vg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
  vg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Nu,c=this.Mu,d=this.Lu,e=this.adornedObject.Mt(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.hd();J.free(e)}};
  vg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Nu,c=this.Mu,d=this.Lu,e=this.adornedObject.Mt(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);J.free(e);a.Na();this.transactionResult=this.name;a.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
  vg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ta();c=c.da(this.handle.alignment.mw());if(a instanceof U){var d=new E;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new We;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().ge(c),!0,e)}else a.location=a.location.copy().ge(c).add(this.oppositePoint);b.hd()}};
  vg.prototype.computeResize=function(a,b,c,d,e,f){b.nc()&&(b=zc);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=J.alloc();L.Gq(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)));J.free(p);return a};vg.prototype.computeReshape=function(){var a=zg;this.adornedObject instanceof Kf&&(a=Ag(this.adornedObject));return!(a===Bg||this.diagram.lastInput.shift)};
  vg.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};vg.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
  vg.prototype.computeCellSize=function(){var a=new M(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
  !isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
  na.Object.defineProperties(vg.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.ie},set:function(a){if(null!==a&&a.part instanceof Je)throw Error("new handle must not be in an Adornment: "+
  a);this.ie=a}},minSize:{get:function(){return this.fg},set:function(a){if(!this.fg.w(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.fg.h(b,a)}}},maxSize:{get:function(){return this.eg},set:function(a){if(!this.eg.w(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.eg.h(b,a)}}},cellSize:{get:function(){return this.Qg},set:function(a){this.Qg.w(a)||this.Qg.assign(a)}},
  isGridSnapEnabled:{get:function(){return this.I},set:function(a){this.I=a}},dragsMembers:{get:function(){return this.T},set:function(a){this.T=a}},oppositePoint:{get:function(){return this.Hs},set:function(a){this.Hs.w(a)||this.Hs.assign(a)}},originalDesiredSize:{get:function(){return this.Gx}},originalLocation:{get:function(){return this.qp}}});
  vg.className="ResizingTool";Na("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Ya("Resizing",a,this.mouseDownTools)});function Cg(){Ee.call(this);this.name="Rotating";this.La=45;this.Ka=2;this.qp=new J;this.ie=null;var a=new Kf;a.figure="Ellipse";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.u=a;this.l=null;this.Fx=0;this.Ps=new J(NaN,NaN);this.I=0;this.T=50}ma(Cg,Ee);
  Cg.prototype.updateAdornments=function(a){if(null!==a){if(a.Ph()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Gf())){var c=a.wk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.lj();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Gh(this.name,c);return}}a.Hf(this.name)}};
  Cg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Je;b.type=X.Position;b.locationSpot=zc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(yg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Cg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
  Cg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(a.isMouseCaptured=!0,a.delaysLayout=!0,this.xa(this.name),this.Fx=this.adornedObject.angle,this.Ps=this.computeRotationPoint(this.adornedObject),this.qp=this.adornedObject.part.location.copy(),this.isActive=!0)};
  Cg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.kb()?a.da(b.rotationSpot):a===b||a===c?c.da(b.locationSpot):a.da(zc)};
  Cg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.o()||(b=this.computeRotationPoint(a));b=a.Mt(b);var c=this.handleAngle;0>c?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.da(b)};Cg.prototype.doDeactivate=function(){var a=this.diagram;this.Jg();this.ie=this.handle=null;this.Ps=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Cg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Cg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
  Cg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Na();this.transactionResult=this.name;a.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
  Cg.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ta();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Gg(d))c=this.qp.copy(),b.location=c.ge(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.hd()}};
  Cg.prototype.computeRotate=function(a){a=this.rotationPoint.Pa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.lj());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&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
  na.Object.defineProperties(Cg.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.ie},set:function(a){if(null!==a&&a.part instanceof Je)throw Error("new handle must not be in an Adornment: "+
  a);this.ie=a}},snapAngleMultiple:{get:function(){return this.La},set:function(a){this.La=a}},snapAngleEpsilon:{get:function(){return this.Ka},set:function(a){this.Ka=a}},originalAngle:{get:function(){return this.Fx}},rotationPoint:{get:function(){return this.Ps},set:function(a){this.Ps=a.copy()}},handleAngle:{get:function(){return this.I},set:function(a){this.I=
  a}},handleDistance:{get:function(){return this.T},set:function(a){this.T=a}}});Cg.className="RotatingTool";Na("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Ya("Rotating",a,this.mouseDownTools)});function Dg(){Ee.call(this);this.name="ClickSelecting"}ma(Dg,Ee);Dg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
  Dg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Dg.className="ClickSelectingTool";function Eg(){Ee.call(this);this.name="Action";this.Xk=null}ma(Eg,Ee);
  Eg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Vb(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.Ej=a.Vb(b.documentPoint,null,null);return!0}return!1};Eg.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()};
  Eg.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))}};Eg.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()};
  Eg.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())};Eg.prototype.doStop=function(){this.Xk=null};Eg.className="ActionTool";function Fg(){Ee.call(this);this.name="ClickCreating";this.Aj=null;this.u=!0;this.l=!1;this.xx=new J(0,0)}ma(Fg,Ee);
  Fg.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.xx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.xx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.zm(a.lastInput.documentPoint,!0)?!1:!0};
  Fg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
  Fg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.R("ChangingSelection",b.selection);this.xa(this.name);if(c instanceof V)c.Nc()&&(yg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.uf(e),d=b.zc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&Gg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Na();this.transactionResult=
  this.name;b.R("PartCreated",d)}finally{this.Jg(),b.R("ChangedSelection",b.selection)}return d};na.Object.defineProperties(Fg.prototype,{archetypeNodeData:{get:function(){return this.Aj},set:function(a){this.Aj=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}}});Fg.className="ClickCreatingTool";
  function Hg(){Ee.call(this);this.name="DragSelecting";this.pl=175;this.u=!1;var a=new V;a.layerName="Tool";a.selectable=!1;var b=new Kf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}ma(Hg,Ee);
  Hg.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.timestamp<this.delay||null!==a.zm(b.documentPoint,!0))?!1:!0};Hg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
  Hg.prototype.doDeactivate=function(){var a=this.diagram;a.Jf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Hg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.bb("SHAPE");null===c&&(c=this.box.tb());var d=M.alloc().h(b.width,b.height);b=J.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;M.free(d);J.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Et(a.lastInput.viewPoint)}};
  Hg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.R("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.R("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Hg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
  Hg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.ty(a,this.isPartialInclusion);if(Va?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new E;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
  a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};na.Object.defineProperties(Hg.prototype,{delay:{get:function(){return this.pl},set:function(a){this.pl=a}},isPartialInclusion:{get:function(){return this.u},set:function(a){this.u=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});Hg.className="DragSelectingTool";
  function Ig(){Ee.call(this);this.name="Panning";this.kv=new J;this.kz=new J;this.Pg=!1;var a=this;this.Lx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.Lx,!1);a.stopTool()}}ma(Ig,Ee);Ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
  Ig.prototype.doActivate=function(){var a=this.diagram;this.Pg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.Lx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.kv.assign(a.position));this.isActive=!0};Ig.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Ig.prototype.doCancel=function(){var a=this.diagram;a.position=this.kv;a.isMouseCaptured=!1;this.stopTool()};Ig.prototype.doMouseMove=function(){this.move()};
  Ig.prototype.doMouseUp=function(){this.move();this.stopTool()};Ig.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Pg)a.lastInput.bubbles=!0;else{var b=a.position,c=a.firstInput.documentPoint,d=a.lastInput.documentPoint,e=b.x+c.x-d.x;c=b.y+c.y-d.y;a.allowHorizontalScroll||(e=b.x);a.allowVerticalScroll||(c=b.y);a.position=this.kz.h(e,c)}};
  na.Object.defineProperties(Ig.prototype,{bubbles:{get:function(){return this.Pg},set:function(a){this.Pg=a}},originalPosition:{get:function(){return this.kv}}});Ig.className="PanningTool";Na("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Ya("ClickCreating",a,this.mouseUpTools)});Na("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Ya("ClickSelecting",a,this.mouseUpTools)});
  Na("panningTool",function(){return this.findTool("Panning")},function(a){this.Ya("Panning",a,this.mouseMoveTools)});Na("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Ya("DragSelecting",a,this.mouseMoveTools)});Na("actionTool",function(){return this.findTool("Action")},function(a){this.Ya("Action",a,this.mouseDownTools)});function Te(){this.T=this.I=this.l=this.u=null}
  na.Object.defineProperties(Te.prototype,{mainElement:{get:function(){return this.I},set:function(a){this.I=a}},show:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.T},set:function(a){this.T=a}}});Te.className="HTMLInfo";
  function Jg(a,b,c){this.text=a;this.by=b;this.visible=c}Jg.className="ContextMenuButtonInfo";function Kg(){Ee.call(this);this.name="ContextMenu";this.u=this.Cu=this.l=null;this.Cx=new J;this.Du=null;this.Yu=!1;var a=this;this.wv=function(){a.stopTool()}}ma(Kg,Ee);
  function Lg(a){var b=new Te;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Mg=b;a.wv=function(){a.stopTool()};b=ua("div");var c=ua("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
  var d=ua("style");x.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Ng,!1),d.addEventListener(b,"selectstart",
  Ng,!1),d.addEventListener(c,"contextmenu",Ng,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Og=b;Pg=c;Qg=!0}function Ng(a){a.preventDefault();return!1}
  Kg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right||1<a.lastInput.clickCount?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};Kg.prototype.doStart=function(){this.Cx.set(this.diagram.firstInput.documentPoint)};Kg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
  Kg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof R||(a instanceof Y?d=a:d=b.Vb(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Kg.prototype.doActivate=function(){};
  Kg.prototype.doMouseDown=function(){Ee.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Je){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Rg(this)};
  Kg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Je){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Rg(this)};
  function Rg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Te)){var d=b.Vb(b.lastInput.documentPoint,null,null);null!==d&&d.Gg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Sg(a,!0),a.isActive||a.stopTool())}
  function Sg(a,b,c){void 0===c&&(c=null);if(!a.Yu&&(a.Yu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Yu=!1,!b)){a.isActive=!0;b=Mg;null===c&&(c=a.findObjectWithContextMenu());if(null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null);a.currentContextMenu instanceof Je&&!a.currentContextMenu.visible&&a.stopTool()}}
  Kg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
  Kg.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Je){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ta();this.positionContextMenu(a,b)}else a instanceof Te&&a.show(b,c,this);this.currentContextMenu=a};
  Kg.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
  Kg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Je?(a.remove(b),null!==this.Cu&&this.Cu.Hf(b.category),b.data=null,b.adornedObject=null):b instanceof Te&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
  function Tg(a){var b=new E;b.add(new Jg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Jg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Jg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Jg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
  b.add(new Jg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Jg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Jg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Jg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Jg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
  function(a){return a.commandHandler.canZoomToFit()}));b.add(new Jg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Jg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Jg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Jg("Edit Text",function(a){a.commandHandler.editTextBlock()},
  function(a){return a.commandHandler.canEditTextBlock()}));return b}
  Kg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Du&&(this.Du=Tg(this));Og.innerHTML="";Pg.addEventListener("click",this.wv,!1);var b=this,c=ua("ul");c.className="goCXul";Og.appendChild(c);c.innerHTML="";for(var d=this.Du.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.by&&("function"!==typeof f||f(a))){f=ua("li");f.className="goCXli";var g=ua("a");g.className="goCXa";g.href="#";g.dz=e.by;g.addEventListener("click",function(c){this.dz(a);b.stopTool();
  c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Og.style.display="block";Pg.style.display="block"};Kg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Mg){Og.style.display="none";Pg.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Pg,"click",this.wv,!1);this.currentContextMenu=null}};
  na.Object.defineProperties(Kg.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.Cu=a instanceof Je?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Qg&&null===Mg&&Ug&&Lg(this);return Mg},set:function(a){null===a&&(Qg=!0);Mg=a}},currentObject:{get:function(){return this.u},set:function(a){this.u=a}},mouseDownPoint:{get:function(){return this.Cx}}});
  var Mg=null,Qg=!1,Pg=null,Og=null;Kg.className="ContextMenuTool";Na("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Ya("ContextMenu",a,this.mouseUpTools)});function Vg(){Ee.call(this);this.name="TextEditing";this.zh=new Wg;this.La=null;this.Ka=Xg;this.Wi=null;this.ia=Yg;this.I=1;this.T=!0;this.u=null;this.l=new Te;this.Hu=null;Zg(this,this.l)}ma(Vg,Ee);
  function Zg(a,b){if(Ug){var c=ua("textarea");a.Hu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Jy(this.value);this.style.width=20+b.measuredBounds.width*this.eB+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.key;"Enter"===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText($g)):"Tab"===c?(a.acceptText(ah),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
  function(){if(null!==a.currentTextEditor&&a.state!==Yg){var b=a.Hu;a.ia===bh&&(a.ia=ch);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Yg){var b=a.Hu;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
  b,f){if(a instanceof Wg&&f instanceof Vg)if(f.state===dh)c.style.border="3px solid red",c.focus();else{var d=a.da(zc),e=b.position,k=b.scale,l=a.Af()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+
  "px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.eB=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
  Vg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||eh&&eh!==this&&(eh.acceptText(fh),eh&&eh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Vb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Wg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Xg&&!b.isSelected||this.starting===gh&&2>a.lastInput.clickCount?!1:!0};Vg.prototype.doStart=function(){eh=this;null!==this.textBlock&&this.doActivate()};
  Vg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Vb(a.lastInput.documentPoint));if(null!==b&&b instanceof Wg&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.ia=bh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.zh=this.textBlock.copy();var d=new N(this.textBlock.da(tc),this.textBlock.da(Dc));a.Aw(d);c.show(b,a,this);this.currentTextEditor=c}}}};Vg.prototype.doCancel=function(){this.stopTool()};
  Vg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Vg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(fh)};Vg.prototype.acceptText=function(a){switch(a){case fh:if(this.ia===hh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ia===bh||this.ia===dh||this.ia===ch)this.ia=ih,jh(this);break;case kh:case $g:case ah:if($g!==a||!0!==this.textBlock.isMultiline)if(this.ia===bh||this.ia===dh||this.ia===ch)this.ia=ih,jh(this)}};
  function jh(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.xa(a.name),a.ia=hh,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.R("TextEdited",b,e),a.Jg(),a.stopTool(),null!==c&&c.doFocus()):(a.ia=dh,a.doError(e,f))}}
  Vg.prototype.doError=function(a,b){var c=this.textBlock;null!==c.errorFunction&&c.errorFunction(this,a,b);(a=this.currentTextEditor)&&a.show(c,this.diagram,this)};Vg.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Vg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ia=Yg,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Vg.prototype.doStop=function(){eh=null};
  Vg.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};Vg.prototype.Jy=function(a){var b=this.zh;b.text=a;b.measure(this.textBlock.Ei,Infinity);return b};
  na.Object.defineProperties(Vg.prototype,{textBlock:{get:function(){return this.La},set:function(a){this.La=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.Ka},set:function(a){this.Ka=a}},textValidation:{get:function(){return this.Wi},
  set:function(a){this.Wi=a}},minimumEditorScale:{get:function(){return this.I},set:function(a){this.I=a}},selectsTextOnActivate:{get:function(){return this.T},set:function(a){this.T=a}},state:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.ia=a)}}});Vg.prototype.measureTemporaryTextBlock=Vg.prototype.Jy;
  var kh=new D(Vg,"LostFocus",0),fh=new D(Vg,"MouseDown",1),ah=new D(Vg,"Tab",2),$g=new D(Vg,"Enter",3),lh=new D(Vg,"SingleClick",0),Xg=new D(Vg,"SingleClickSelected",1),gh=new D(Vg,"DoubleClick",2),Yg=new D(Vg,"StateNone",0),bh=new D(Vg,"StateActive",1),ch=new D(Vg,"StateEditing",2),ih=new D(Vg,"StateValidating",3),dh=new D(Vg,"StateInvalid",4),hh=new D(Vg,"StateValidated",5),eh=null;Vg.className="TextEditingTool";Vg.LostFocus=kh;Vg.MouseDown=fh;Vg.Tab=ah;Vg.Enter=$g;Vg.SingleClick=lh;
  Vg.SingleClickSelected=Xg;Vg.DoubleClick=gh;Vg.StateNone=Yg;Vg.StateActive=bh;Vg.StateEditing=ch;Vg.StateValidating=ih;Vg.StateInvalid=dh;Vg.StateValidated=hh;Na("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Ya("TextEditing",a,this.mouseUpTools)});
  function mh(){nh||(oh(),nh=!0);this.B=Fe;this.zl=this.ef=this.sc=this.ps=this.jc=!1;this.Qx=!0;this.Al=ph;this.tn=!1;this.zi=this.md=!0;this.Yg=600;this.ox=this.Px=!1;this.Re=new G;this.Rd=new qh;this.Rd.Uc=this;this.yj=new G;this.tv=new G;this.ot=new G;this.$l=new G}mh.prototype.ee=function(a){this.B=a};mh.prototype.canStart=function(){return!0};function rh(a,b){sh(a,b)&&(a.ef=!0)}
  function sh(a,b){if(!a.md||!a.canStart(b))return!1;a.Re.add(b);a.defaultAnimation.isAnimating&&a.Bc();th(a.B);return a.sc=!0}
  function uh(a){if(a.md&&a.sc){var b=a.Rd,c=a.B,d=a.Re.contains("Model");d&&(a.zl=!0,a.Al===ph?(b.isViewportUnconstrained=!0,b.lc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.Al===vh&&b.lc.clear(),a.Qx=a.Al===wh&&c.Ts.w(c.la)?!0:!1,c.R("InitialAnimationStarting",a));d&&!a.zi||0===b.lc.count?(a.Re.clear(),a.sc=!1,a.ef=!1,b.lc.clear(),xh(b,c),a.zl=!1,c.M()):(a.Re.clear(),c.Ee=!1,d=b.lc.get(c),c.autoScale!==Kh&&null!==d&&(delete d.start.scale,delete d.end.scale),
  x.requestAnimationFrame(function(){!1===a.sc||b.jc||(c.Ke("temporaryPixelRatio")&&Ze(c),Lh(c),a.sc=!1,a.ef=!1,b.start(),Mh(a),c.Na(),Nh(b,0),Hf(c,!0),Oh(a),c.R("AnimationStarting",a))}))}}function Ph(a,b,c,d){a.isTicking||b instanceof S&&(null!==b.fromNode||null!==b.toNode)||a.Rd.add(b,"position",c,d,!1)}t=mh.prototype;t.cu=function(a){return this.Rd.cu(a)};t.ew=function(a){return this.Rd.ew(a)};
  function Qh(a,b){function c(){0<e.ot.count&&(d.addAll(e.ot),e.ot.clear(),e.jc=!0);if(!1!==e.jc&&0!==d.count){e.tv.addAll(d);for(var a=e.tv.iterator;a.next();){var b=a.value;if(!1!==b.jc){a:if(0<b.qm.count)var h=!0;else{for(h=b.lc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof R){h=!0;break a}}h=!1}h?Rh(b,!1):b.Il=!0}}e.tv.clear();Mh(e);Hf(e.B);Oh(e);x.requestAnimationFrame(c)}}var d=a.yj,e=a;a.jc?a.ot.add(b):(a.jc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
  function Sh(a){for(a=a.yj.iterator;a.next();)a.value.Il=!1}function Mh(a){if(!a.ps){var b=a.B;a.Px=b.skipsUndoManager;a.ox=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.ps=!0}}function Oh(a){var b=a.B;b.skipsUndoManager=a.Px;b.skipsModelSourceBindings=a.ox;a.ps=!1}
  t.Bc=function(a){var b=this.Rd;!0===this.sc&&(this.zl=this.ef=this.sc=!1,this.Re.clear(),0<b.lc.count&&this.B.Db());if(this.jc){if(b.xm(!0),b.lc.clear(),xh(b,null),!0===a)for(a=this.yj.ma(),b=0;b<a.length;b++)a[b].xm(!0)}else b.lc.clear(),xh(b,this.B)};t.xm=function(a){a===this.defaultAnimation&&this.defaultAnimation.lc.clear();this.yj.remove(a);0===this.yj.count&&(this.jc=!1,this.B.Db());a===this.defaultAnimation&&(this.defaultAnimation.lc.clear(),this.B.R("AnimationFinished",this))};
  t.lk=function(a,b){this.ef&&(this.Re.contains("Expand Tree")||this.Re.contains("Expand SubGraph"))&&(this.Rd.lk(a,b),Th(this,a))};t.jk=function(a,b){this.ef&&(this.Re.contains("Collapse Tree")||this.Re.contains("Collapse SubGraph"))&&(this.Rd.jk(a,b),Uh(this.Rd,b,"position",b.position,b.position),Th(this,a))};function Vh(a,b,c){a.ef&&!b.w(c)&&(a.B.pj||(b=c.copy()),Uh(a.Rd,a.B,"position",b,c))}
  function Th(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.jf=c.points.copy();a.$l.add(c)}}function Wh(a,b,c,d,e){null===a&&(a=[0,0,0,0]);null===b&&(b=[0,0,0,0]);var f=a[0],g=a[1],h=a[2];a=a[3];var k=b[0],l=b[1],m=b[2];b=b[3];if(0===h||100===h)f=k,g=l;else if(0===m||100===m)k=f,l=g;180<Math.abs(k-f)&&(k>f?f+=360:k+=360);f=e(c,f,k-f,d)%360;g=e(c,g,l-g,d);h=e(c,h,m-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
  function oh(){function a(a,b,e,f,g,h){a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))}var b=new H;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.er(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("location",function(a,b,e,f,g,h){g<h?a.er(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!0):a.location=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:placeholder",function(a,b,e,f,
  g,h){g<h?a.er(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:nodeCollapse",function(a,b,e,f,g,h){var c=a.actualBounds,d=e.actualBounds;e=d.x+d.width/2-c.width/2;c=d.y+d.height/2-c.height/2;g<h?a.er(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h),!1):a.position=new J(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h))});b.add("desiredSize",function(a,b,e,f,g,h){a.desiredSize=new N(f(g,b.width,e.width-b.width,h),f(g,b.height,e.height-b.height,h))});b.add("width",
  function(a,b,e,f,g,h){a.width=f(g,b,e-b,h)});b.add("height",function(a,b,e,f,g,h){a.height=f(g,b,e-b,h)});b.add("fill",function(a,b,e,f,g,h){a.fill=Wh(b,e,g,h,f)});b.add("stroke",function(a,b,e,f,g,h){a.stroke=Wh(b,e,g,h,f)});b.add("strokeWidth",function(a,b,e,f,g,h){a.strokeWidth=f(g,b,e-b,h)});b.add("strokeDashOffset",function(a,b,e,f,g,h){a.strokeDashOffset=f(g,b,e-b,h)});b.add("background",function(a,b,e,f,g,h){a.background=Wh(b,e,g,h,f)});b.add("areaBackground",function(a,b,e,f,g,h){a.areaBackground=
  Wh(b,e,g,h,f)});b.add("opacity",function(a,b,e,f,g,h){a.opacity=f(g,b,e-b,h)});b.add("scale",function(a,b,e,f,g,h){a.scale=f(g,b,e-b,h)});b.add("angle",function(a,b,e,f,g,h){a.angle=f(g,b,e-b,h)});Xh=b}
  na.Object.defineProperties(mh.prototype,{animationReasons:{get:function(){return this.Re}},isEnabled:{get:function(){return this.md},set:function(a){(this.md=a)&&this.yj.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{get:function(){return this.Yg},set:function(a){1>a&&wa(a,">= 1",mh,"duration");this.Yg=a}},isAnimating:{get:function(){return this.jc}},
  isTicking:{get:function(){return this.ps}},isInitial:{get:function(){return this.zi},set:function(a){this.zi=a}},defaultAnimation:{get:function(){return this.Rd}},activeAnimations:{get:function(){return this.yj}},initialAnimationStyle:{get:function(){return this.Al},set:function(a){this.Al=a}}});mh.prototype.stopAnimation=mh.prototype.Bc;
  var Xh=null,nh=!1,ph=new D(mh,"Default",1),wh=new D(mh,"AnimateLocations",2),vh=new D(mh,"None",3);mh.className="AnimationManager";mh.defineAnimationEffect=function(a,b){nh||(oh(),nh=!0);Xh.add(a,b)};mh.Default=ph;mh.AnimateLocations=wh;mh.None=vh;
  function qh(){this.xv=this.Ox=this.Uc=this.B=null;this.Il=this.jc=this.l=!1;this.Zn=this.Dd=0;this.Ir=this.Ku=Yh;this.Hl=this.Fp=!1;this.nv=1;this.mv=0;this.vd=this.Yg=NaN;this.tx=0;this.$n=null;this.u=Bb;this.lc=new H;this.iv=new H;this.qm=new G;this.jv=new G;this.px=Zh}qh.prototype.suspend=function(){this.Il=!0};qh.prototype.advanceTo=function(a,b){b&&(this.Il=!1);this.Fp&&a>=this.vd&&(this.Hl=!0,a-=this.vd);this.tx=a;Rh(this,!0);Mh(this.Uc);Hf(this.B);Oh(this.Uc);this.B.redraw()};
  function xh(a,b){a.iv.clear();a.Hl=!1;a.mv=0;a.vd=NaN;0<a.qm.count&&a.qm.clear();0<a.jv.count&&a.jv.clear();if(null!==b)for(a=b.links;a.next();)a.value.jf=null}t=qh.prototype;
  t.start=function(){if(0!==this.lc.count&&!this.jc){for(var a=this.B,b=this.lc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof U&&null!==e.placeholder){var f=e.placeholder;e=f.da(tc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof R?a=d:d instanceof Y&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Uc=a.animationManager,!1!==b.isEnabled&&(this.vd=isNaN(this.Yg)?b.duration:this.Yg,this.Ir=this.Ku,
  b.zl&&b.Al===ph&&this===b.defaultAnimation&&(this.Ir=$h,this.vd=isNaN(this.Yg)?600===b.duration?900:b.duration:this.Yg),this.px=a.scrollMode,this.isViewportUnconstrained&&(a.Ti=ai),Mh(b),this.qm.each(function(b){b.data=null;a.add(b)}),Oh(b),this.jc=!0,this.Dd=+new Date,this.Zn=this.Dd+this.vd,Qh(b,this)))}};t.sz=function(a,b){a.Nc()&&(this.qm.add(a),this.B=b)};
  t.add=function(a,b,c,d,e){if("position"!==b||!c.w(d)){null===this.B&&(a instanceof R?this.B=a:a instanceof Y&&null!==a.diagram&&(this.B=a.diagram));if(a instanceof V){if(!a.isAnimated)return;"position"===b&&(b="position:part")}Uh(this,a,b,c,d,e)}};
  function Uh(a,b,c,d,e,f){var g=a.lc;b instanceof R&&"position"===c&&(c="position:diagram");if("fill"===c||"stroke"===c||"background"===c||"areaBackground"===c)bi(d),ci(),d=[di.l,di.I,di.u,di.T],bi(e),ci(),e=[di.l,di.I,di.u,di.T];if(g.contains(b)){var h=g.G(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=ei(d));l[c]=ei(e)}else k={},l={},k[c]=ei(d),l[c]=ei(e),h=k.position,b instanceof Y&&h instanceof J&&!h.o()&&b.diagram.animationManager.Re.contains("Expand SubGraph")&&h.assign(l.position),h=new fi(k,
  l,f),g.add(b,h);g=k[c];g instanceof J&&!g.o()&&g.assign(a.u);f&&0===c.indexOf("position:")&&b instanceof V?h.Qv.location=ei(b.location):f&&(h.Qv[c]=ei(d))}function ei(a){return a instanceof J?a.copy():a instanceof M?a.copy():a}t.cu=function(a){if(!this.jc)return!1;a=this.lc.G(a);return null!==a&&a.sw};t.ew=function(a){if(!this.jc)return!1;a=this.lc.G(a);return null!==a&&(a.start.position||a.start.location)};
  function Rh(a,b){if(!a.Il||b){var c=a.Uc;if(!1!==a.jc){var d=+new Date,e=d>a.Zn?a.vd:d-a.Dd;b&&(e=a.tx,e<a.vd?(a.Dd=+new Date-e,a.Zn=a.Dd+a.vd):e=a.vd);Mh(c);Nh(a,e);Hf(a.B,!0);Oh(c);d>a.Zn&&(a.Fp&&!a.Hl?(a.Dd=+new Date,a.Zn=a.Dd+a.vd,a.Hl=!0):a.xm(!1))}}}
  function Nh(a,b){for(var c=a.vd,d=a.lc.iterator,e=a.Hl;d.next();){var f=d.key;if(!(f instanceof Y&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=Xh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:nodeCollapse"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Ir,b,c,a)}}}t.stop=function(){this.jc&&this.xm(!0)};
  t.xm=function(a){null!==this.xv&&this.xv.Mp.remove(this.Ox);if(this.jc){var b=this.B,c=this.Uc;this.Il=this.jc=c.zl=!1;Mh(c);for(var d=this.lc,e=this.qm.iterator;e.next();)b.remove(e.value);for(e=this.jv.iterator;e.next();)e.value.s();e=this.Fp;d=d.iterator;for(var f=Xh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Qv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Kv||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:
  h.Kv?k[n]:l[n],this.Ir,this.vd,this.vd,this)}h.Kv&&void 0!==m.location&&g instanceof V&&(g.location=m.location);h.sw&&g instanceof V&&g.Ob(!1)}b.Yt.clear();mf(b,!1);b.Na();b.M();Hf(b,!0);if(c.defaultAnimation===this){for(n=c.$l.iterator;n.next();)e=n.value,null!==e.jf&&(e.points=e.jf,e.jf=null);c.$l.clear()}this.isViewportUnconstrained&&(b.scrollMode=this.px);Oh(c);this.mv++;!a&&this.nv>this.mv?(this.Hl=!1,this.start()):(this.$n&&this.$n(this),xh(this,null),c.xm(this),b.Db())}};
  t.lk=function(a,b){var c=b.actualBounds,d=null;b instanceof U&&(d=b.placeholder);null!==d?(c=d.da(tc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new J(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value,d instanceof W&&this.lk(d,b)};
  t.jk=function(a,b){if(a.isVisible()){var c=null;b instanceof U&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:nodeCollapse",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.lc;c.contains(a)&&(c.G(a).sw=!0);if(a instanceof U)for(a=a.memberParts;a.next();)c=a.value,c instanceof W&&this.jk(c,b)}};t.pA=function(a){var b=this.iv.get(a);null===b&&(b={},this.iv.add(a,b));return b};
  na.Object.defineProperties(qh.prototype,{duration:{get:function(){return this.Yg},set:function(a){1>a&&wa(a,">= 1",qh,"duration");this.Yg=a}},reversible:{get:function(){return this.Fp},set:function(a){this.Fp=a}},runCount:{get:function(){return this.nv},set:function(a){0<a?this.nv=a:B("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.$n},
  set:function(a){this.$n!==a&&(this.$n=a)}},easing:{get:function(){return this.Ku},set:function(a){this.Ku=a}},isViewportUnconstrained:{get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{get:function(){return this.jc}}});qh.prototype.getTemporaryState=qh.prototype.pA;qh.prototype.stop=qh.prototype.stop;qh.prototype.add=qh.prototype.add;qh.prototype.addTemporaryPart=qh.prototype.sz;
  function Yh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function $h(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}qh.className="Animation";qh.EaseLinear=function(a,b,c,d){return c*a/d+b};qh.EaseInOutQuad=Yh;qh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};qh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};qh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};qh.EaseOutExpo=$h;
  function fi(a,b,c){this.start=a;this.end=b;this.Qv={};this.Kv=c;this.sw=!1}fi.className="AnimationState";function gi(a,b,c){this.pd=null;this.gf=a;this.cq=c||hi;this.bl=null;void 0!==b&&(this.bl=b,void 0===c&&(this.cq=ii))}gi.prototype.copy=function(){var a=new gi(this.gf);a.cq=this.cq;var b=this.bl;if(null!==b){var c={};void 0!==b.duration&&(c.ny=b.duration);void 0!==b.finished&&(c.ny=b.finished);void 0!==b.easing&&(c.ny=b.easing);a.bl=c}return a};
  function ji(a,b){a=a.bl;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}na.Object.defineProperties(gi.prototype,{propertyName:{get:function(){return this.gf},set:function(a){this.gf=a}},animationSettings:{get:function(){return this.bl},set:function(a){this.bl=a}},startCondition:{get:function(){return this.cq},set:function(a){this.cq=a}}});
  var hi=new D(gi,"Default",1),ii=new D(gi,"Immediate",2),ki=new D(gi,"Bundled",3);gi.className="AnimationTrigger";gi.Default=hi;gi.Immediate=ii;gi.Bundled=ki;function li(){Xa(this);this.B=null;this.Fa=new E;this.oa="";this.hb=1;this.u=!1;this.l=this.Pi=this.I=this.ii=this.hi=this.gi=this.fi=this.di=this.ei=this.ci=this.ki=this.bi=this.ji=this.ai=this.$h=!0;this.rp=[]}t=li.prototype;t.clear=function(){this.Fa.clear();this.rp.length=0};t.ee=function(a){this.B=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 W?d++:k instanceof S?f++:k instanceof Je?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Fa.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&kb(d)&&(h+=" #"+kb(d)),c instanceof W?h+=" "+
  Ka(d):c instanceof S&&(h+=" "+Ka(c.fromNode)+" "+Ka(c.toNode));return b+" "+this.Fa.count+": "+h};t.Vb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Pi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(d=!0);for(var e=J.alloc(),f=this.Fa.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==wg(h))&&h.isVisible()&&(e.assign(a),wb(e,h.Fd),h=h.Vb(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return J.free(e),h}J.free(e);return null};
  t.hj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof G||(d=new G);if(!1===this.Pi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(e=!0);for(var f=J.alloc(),g=this.Fa.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==wg(k))&&k.isVisible()){f.assign(a);wb(f,k.Fd);var l=k;k.hj(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
  t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof G||(e=new G);if(!1===this.Pi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Ge(a)&&(f=!0);for(var g=this.Fa.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==wg(k))&&k.isVisible()){var l=k;k.zf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
  t.Vv=function(a,b,c,d,e,f,g){if(!1===this.Pi)return e;for(var h=this.Fa.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==wg(l))&&f(l)&&l.isVisible()){var m=l;l.zf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
  t.Eg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof G)f=e;e=!0}f instanceof E||f instanceof G||(f=new G);if(!1===this.Pi)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Fa.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==wg(n))&&n.isVisible()){h.assign(a);wb(h,n.Fd);k.h(a.x+b,a.y);wb(k,n.Fd);var p=n;n.Eg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
  p||null!==d&&!d(p)||f.add(p))}}J.free(h);J.free(k);return f};
  t.Nd=function(a,b){if(this.visible){var c=this.Fa.j,d=c.length;if(0!==d){a=Ea();for(var e=Ea(),f=0;f<d;f++){var g=c[f];g.zx=f;if(g instanceof S){if(!1===g.ud)continue}else if(g instanceof Je&&null!==g.adornedPart)continue;ac(g.actualBounds,b)?(g.Nd(!0),a.push(g)):(g.Nd(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],mi(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Nd(!0);for(b=0;b<e.length;b++)mi(e[b]);Ia(a);Ia(e)}}};
  function ni(a,b){var c=1;1!==a.hb&&(c=b.globalAlpha,b.globalAlpha=c*a.hb);return c}t.mc=function(a,b,c){if(this.visible&&0!==this.hb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Fa.j;var d=c.length;if(0!==d){var e=ni(this,a),f=this.rp;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.dj(a,c[k],b,f,g,h,!0);N.free(h);a.globalAlpha=e}}};
  t.dj=function(a,b,c,d,e,f,g){if(!g||wg(b)){if(null!==d&&b instanceof S&&(b.isOrthogonal&&d.push(b),!1===b.ud))return;g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.Za&&f.Dy(d.Za):null!==d.Za&&(g=!0,f.assign(d.Za)),d=d.containingGroup;var h=b.actualBounds;d=!1;if(g&&b.isVisible()){if(!f.Mc(h))return;d=!f.Ge(h)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());h.width*e>c.Xo||h.height*e>c.Xo?b.mc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||0===e.height||isNaN(e.x)||
  isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&(oi(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(oi(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),oi(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Tt()||(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))))));d&&(a.restore(),a.uc(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.Va(xe,a,this,b,c,d,e)};t.oj=function(a,b,c){var d=this.Fa;b.Fi=this;if(a>=d.count)a=d.count;else if(d.J(a)===b)return-1;d.wb(a,b);b.Mq(c);d=this.diagram;null!==d&&(c?d.M():d.oj(b));pi(this,a,b);return a};
  t.Lc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Lc(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.J(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Nq(c);d.cb(a);d=this.diagram;null!==d&&(c?d.M():d.Lc(b));b.Fi=null;return a};
  function pi(a,b,c){b=qi(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;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Fa,e.cb(b),e.wb(d,c))}c=c.containingGroup;null!==c&&pi(a,-1,c)}}
  function qi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Fa;var e=a.count;if(1>=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.J(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.J(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.cb(b);a.wb(f,c);return f}for(g=NaN;0<=--f&&(g=a.J(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.cb(b);a.wb(h,c);return h}for(k=NaN;++h<
  e&&(k=a.J(h).zOrder,isNaN(k)););}return b}
  na.Object.defineProperties(li.prototype,{parts:{get:function(){return this.Fa.iterator}},partsBackwards:{get:function(){return this.Fa.iteratorBackwards}},diagram:{get:function(){return this.B}},name:{get:function(){return this.oa},set:function(a){var b=this.oa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&B("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
  a&&B("Layer.name is already present in this diagram: "+a);this.oa=a;this.g("name",b,a);for(a=this.Fa.iterator;a.next();)a.value.layerName=this.oa}}},opacity:{get:function(){return this.hb},set:function(a){var b=this.hb;b!==a&&((0>a||1<a)&&wa(a,"0 <= value <= 1",li,"opacity"),this.hb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.M())}},isTemporary:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(this.u=a,this.isInDocumentBounds=
  !1,this.g("isTemporary",b,a))}},visible:{get:function(){return this.I},set:function(a){var b=this.I;if(b!==a){this.I=a;this.g("visible",b,a);for(b=this.Fa.iterator;b.next();)b.value.Ob(a);a=this.diagram;null!==a&&a.M()}}},pickable:{get:function(){return this.Pi},set:function(a){var b=this.Pi;b!==a&&(this.Pi=a,this.g("pickable",b,a))}},isInDocumentBounds:{get:function(){return this.l},set:function(a){this.l!==
  a&&(this.l=a,null!==this.diagram&&this.diagram.Na())}},allowCopy:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(this.ji=a,this.g("allowTextEdit",b,
  a))}},allowGroup:{get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(this.ki=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(this.ci=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.ei},
  set:function(a){var b=this.ei;b!==a&&(this.ei=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(this.di=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(this.gi=a,this.g("allowResize",
  b,a))}},allowRotate:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("allowSelect",b,a))}}});li.prototype.findObjectsNear=li.prototype.Eg;li.prototype.findObjectsIn=li.prototype.zf;li.prototype.findObjectsAt=li.prototype.hj;li.prototype.findObjectAt=li.prototype.Vb;li.className="Layer";
  function R(a){1<arguments.length&&B("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");ri||(si(),ri=!0);Xa(this);Fe=this;this.Sb=!0;this.Uc=new mh;this.Uc.ee(this);this.rb=17;this.Gl=this.pv=!1;this.Ss="default";this.Da=null;if(Ug){var b=this,c=function(){b.removeEventListener(x.document,"DOMContentLoaded",c,!1);b.setRTL()};null!==x.document.body?this.setRTL():b.addEventListener(x.document,"DOMContentLoaded",c,!1)}this.Ma=new E;this.ua=this.va=0;this.Zl=this.ya=
  null;this.Kx=new H;this.hf=this.Gb=null;this.xw();this.Nj=null;this.ww();this.hb=1;this.la=(new J(NaN,NaN)).freeze();this.Ts=new J(NaN,NaN);this.Qn=this.Aa=1;this.es=(new J(NaN,NaN)).freeze();this.fs=NaN;this.xs=1E-4;this.vs=100;this.sb=new ld;this.xt=(new J(NaN,NaN)).freeze();this.Zr=(new N(NaN,NaN,NaN,NaN)).freeze();this.Si=(new kc(0,0,0,0)).freeze();this.Ti=Zh;this.at=!1;this.Us=this.Ns=null;this.Og=Kh;this.Dj=Vc;this.Yf=Kh;this.to=Vc;this.gs=this.ds=tc;this.Dc=!0;this.El=!1;this.wd=new G;this.Vg=
  new H;this.rl=!0;this.qn=250;this.Bj=-1;this.sn=(new kc(16,16,16,16)).freeze();this.Hj=this.Ee=!1;this.Kj=!0;this.Wf=new me;this.Wf.diagram=this;this.od=new me;this.od.diagram=this;this.hh=new me;this.hh.diagram=this;this.we=this.Of=null;this.hk=!1;this.Pr=this.Qr=null;this.zj=x.PointerEvent&&(Sa||Ta||Ua)&&x.navigator&&!1!==x.navigator.msPointerEnabled;ti(this);this.Dh=new G;this.qs=!0;this.rt=ui;this.Uu=!1;this.tt=Mf;this.La=null;vi.add("Model",wi);this.Jr=this.Mr=this.pt=null;this.Pn=this.Hr="auto";
  this.gg=this.As=this.ig=this.jg=this.lg=this.Qf=this.Uf=this.Pf=null;this.cs=!1;this.Rf=this.wg=this.kg=this.hg=null;this.Bs=!1;this.Ls={};this.bk=[null,null];this.Br=null;this.Nr=this.gt=this.rv=this.vg=!1;this.av=!0;this.yi=this.ac=!1;this.cc=null;var d=this;this.Cc=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===xe&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.Z=!0}}};this.Tc=function(a){d.partManager.doModelChanged(a)};
  this.zv=!0;this.Xd=-2;this.pg=new H;this.Wl=new E;this.$f=!1;this.ai=this.$h=this.nr=this.md=!0;this.pr=!1;this.vr=this.tr=this.ii=this.hi=this.gi=this.fi=this.di=this.ei=this.ci=this.sr=this.ki=this.bi=this.ji=this.qr=!0;this.Zf=this.Xu=!1;this.ur=this.rr=this.wl=this.vl=!0;this.$s=this.Ws=16;this.Vs=this.Op=!1;this.Pp=this.Ys=null;this.Xs=this.Zs=0;this.ib=(new kc(5)).freeze();this.qv=(new G).freeze();this.ws=999999999;this.Su=(new G).freeze();this.xi=this.wi=this.vi=!0;this.Ye=this.pe=!1;this.kc=
  null;this.Ng=!0;this.qe=!1;this.Ax=new G;this.Tu=new G;this.Gc=null;this.Vl=1;this.sv=0;this.Ic={scale:1,position:new J,bounds:new N,Gv:new M,kw:new M,hw:!1};this.Rx=(new N(NaN,NaN,NaN,NaN)).freeze();this.sm=(new M(NaN,NaN)).freeze();this.Rn=(new N(NaN,NaN,NaN,NaN)).freeze();this.rs=!1;this.Lo=this.qo=this.kp=this.Fu=this.Eu=this.Gu=this.bg=this.fh=this.df=this.Tr=null;xi(this);this.Ib=null;this.po=!1;this.Ej=null;this.partManager=new wi;this.toolManager=new Pa;this.toolManager.initializeStandardTools();
  this.currentTool=this.defaultTool=this.toolManager;this.Sr=null;this.kl=new We;this.Gs=this.Fs=null;this.fq=!1;this.commandHandler=yi();this.model=zi();this.vg=!0;Ai(this);this.layout=new Bi;this.vg=!1;this.ux=this.Ju=null;this.Tb=1;this.yh=null;this.Xo=1;this.cp=0;this.hv=[0,0,0,0,0];this.ep=0;this.xd=1;this.Sj=0;this.Go=new J;this.qt=500;this.rn=new J;this.re=!1;this.Qk=this.Rk=this.Pk=this.Ok=this.Jk=this.Lk=this.Kk=this.Hk=this.Ik=this.Ww=this.Mw=this.Nw=this.Ow=null;this.Yq=function(){};this.preventDefault=
  null;this.wo=!1;this.ui=new Ci;this.gq=!1;void 0!==a&&Di(this,a);this.ao=null;this.bo=Hb;this.Sb=!1}R.prototype.clear=function(){this.animationManager.Bc();this.model.clear();Ei=null;Fi="";Gi(this,!1);this.Wl.clear();Hi();this.pg.clear();this.Na();this.Ta();this.M()};
  function Gi(a,b){a.animationManager.Bc(!0);a.qv=(new G).freeze();a.Su=(new G).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Ib&&(d=a.Ib.part,null!==d&&a.remove(d));var e=[],f=a.Ma.length;if(b){for(b=0;b<f;b++)for(var g=a.Ma.j[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.Ma.j[b].clear();a.partManager.clear();a.wd.clear();a.Vg.clear();a.Dh.clear();a.Ej=null;a.Wl.clear();Hi();
  a.pg.clear();Fa=[];null!==d&&(a.add(d),a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function yi(){return null}
  R.prototype.reset=function(){this.clear();this.Sb=!0;this.Uc=new mh;this.Uc.ee(this);this.rb=17;this.Gl=this.pv=!1;this.Ss="default";this.Ma=new E;this.Kx=new H;this.hf=null;this.xw();this.Nj=null;this.ww();this.hb=1;this.la=(new J(NaN,NaN)).freeze();this.Ts=new J(NaN,NaN);this.Qn=this.Aa=1;this.es=(new J(NaN,NaN)).freeze();this.fs=NaN;this.xs=1E-4;this.vs=100;this.sb=new ld;this.xt=(new J(NaN,NaN)).freeze();this.Zr=(new N(NaN,NaN,NaN,NaN)).freeze();this.Si=(new kc(0,0,0,0)).freeze();this.Ti=Zh;this.at=
  !1;this.Us=this.Ns=null;this.Og=Kh;this.Dj=Vc;this.Yf=Kh;this.to=Vc;this.gs=this.ds=tc;this.Dc=!0;this.El=!1;this.wd=new G;this.Vg=new H;this.rl=!0;this.qn=250;this.Bj=-1;this.sn=(new kc(16,16,16,16)).freeze();this.Hj=this.Ee=!1;this.Kj=!0;this.Wf=new me;this.Wf.diagram=this;this.od=new me;this.od.diagram=this;this.hh=new me;this.hh.diagram=this;this.we=this.Of=null;this.hk=!1;this.Pr=this.Qr=null;this.zj=x.PointerEvent&&(Sa||Ta||Ua)&&x.navigator&&!1!==x.navigator.msPointerEnabled;ti(this);this.Dh=
  new G;this.qs=!0;this.rt=ui;this.Uu=!1;this.tt=Mf;this.Jr=this.Mr=this.pt=null;this.Pn=this.Hr="auto";this.gg=this.As=this.ig=this.jg=this.lg=this.Qf=this.Uf=this.Pf=null;this.cs=!1;this.Rf=this.wg=this.kg=this.hg=null;this.Bs=!1;this.Ls={};this.bk=[null,null];this.Br=null;this.Nr=this.gt=this.rv=this.vg=!1;this.av=!0;this.yi=this.ac=!1;this.zv=!0;this.Xd=-2;this.pg=new H;this.Wl=new E;this.$f=!1;this.ai=this.$h=this.nr=this.md=!0;this.pr=!1;this.vr=this.tr=this.ii=this.hi=this.gi=this.fi=this.di=
  this.ei=this.ci=this.sr=this.ki=this.bi=this.ji=this.qr=!0;this.Zf=this.Xu=!1;this.ur=this.rr=this.wl=this.vl=!0;this.$s=this.Ws=16;this.Vs=this.Op=!1;this.Xs=this.Zs=0;this.ib=(new kc(5)).freeze();this.qv=(new G).freeze();this.ws=999999999;this.Su=(new G).freeze();this.xi=this.wi=this.vi=!0;this.Ye=this.pe=!1;this.kc=null;this.Ng=!0;this.qe=!1;this.Ax=new G;this.Tu=new G;this.Gc=null;this.Vl=1;this.sv=0;this.Ic={scale:1,position:new J,bounds:new N,Gv:new M,kw:new M,hw:!1};this.Rx=(new N(NaN,NaN,
  NaN,NaN)).freeze();this.sm=(new M(NaN,NaN)).freeze();this.Rn=(new N(NaN,NaN,NaN,NaN)).freeze();this.rs=!1;this.Lo=this.qo=this.kp=this.Fu=this.Eu=this.Gu=this.bg=this.fh=this.df=null;xi(this);this.Ib=null;this.po=!1;this.Ej=null;this.partManager=new wi;this.toolManager=new Pa;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Sr=null;this.kl=new We;this.Gs=this.Fs=null;this.fq=!1;this.commandHandler=yi();this.vg=!0;Ai(this);this.layout=new Bi;this.vg=
  !1;this.model=zi();this.model.undoManager=new Ce;this.qe=!1;this.Kj=!0;this.Ee=!1;this.Tb=1;this.yh=null;this.Xo=1;this.cp=0;this.hv=[0,0,0,0,0];this.ep=0;this.xd=1;this.Sj=0;this.Go=new J;this.qt=500;this.rn=new J;this.gq=this.wo=this.re=!1;this.ao=null;this.bo=Hb;this.Sb=!1;this.M()};
  function xi(a){a.df=new H;var b=new W,c=new Wg;c.bind(new Ii("text","",Ka));b.add(c);a.Gu=b;a.df.add("",b);b=new W;c=new Wg;c.stroke="brown";c.bind(new Ii("text","",Ka));b.add(c);a.df.add("Comment",b);b=new W;b.selectable=!1;b.avoidable=!1;c=new Kf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new M(3,3)).ca();b.add(c);a.df.add("LinkLabel",b);a.fh=new H;b=new U;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Wg;c.font="bold 12pt sans-serif";c.bind(new Ii("text","",Ka));
  b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new Kf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new xg;d.padding=(new kc(5,5,5,5)).ca();c.add(d);b.add(c);a.Eu=b;a.fh.add("",b);a.bg=new H;b=new S;c=new Kf;c.isPanelMain=!0;b.add(c);c=new Kf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Fu=b;a.bg.add("",b);b=new S;c=new Kf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.bg.add("Comment",b);b=new Je;b.type=X.Auto;c=new Kf;c.fill=null;
  c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new xg;c.margin=(new kc(1.5,1.5,1.5,1.5)).ca();b.add(c);a.kp=b;a.qo=b;b=new Je;b.type=X.Link;c=new Kf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Lo=b}
  R.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=ua("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.Ss=c};
  R.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Ug){var c=Pi;b=Qi;null===c&&(c=Pi=ua("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Qi=ua("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
  b.clientWidth);a.removeChild(b);b=d-c;0!==b||Wa||(b=11)}this.rb=b;this.pv=!0};R.prototype.jb=function(a){a.classType===R&&(this.autoScale=a)};R.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Ma.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};R.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
  R.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
  function Ri(a){var b=a.ya.Ja;b instanceof HTMLCanvasElement&&(a.zj?(a.addEventListener(b,"pointerdown",a.Ok,!1),a.addEventListener(b,"pointermove",a.Pk,!1),a.addEventListener(b,"pointerup",a.Rk,!1),a.addEventListener(b,"pointerout",a.Qk,!1)):(a.addEventListener(b,"touchstart",a.Ow,!1),a.addEventListener(b,"touchmove",a.Nw,!1),a.addEventListener(b,"touchend",a.Mw,!1),a.addEventListener(b,"mousemove",a.Ik,!1),a.addEventListener(b,"mousedown",a.Hk,!1),a.addEventListener(b,"mouseup",a.Kk,!1),a.addEventListener(b,
  "mouseout",a.Jk,!1)),a.addEventListener(b,"mouseenter",a.Oz,!1),a.addEventListener(b,"mouseleave",a.Pz,!1),a.addEventListener(b,"wheel",a.Lk,!1),a.addEventListener(b,"keydown",a.BA,!1),a.addEventListener(b,"keyup",a.CA,!1),a.addEventListener(b,"blur",a.Az,!1),a.addEventListener(b,"focus",a.Bz,!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!==
  Re&&(a.toolManager.gestureBehavior===Qe?b.preventDefault():a.re&&a.lastInput.handled||(b.preventDefault(),a.Vl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==Re)if(a.toolManager.gestureBehavior===Qe)b.preventDefault();else if(!a.re||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Vl){var e=a.ya.getBoundingClientRect();b=new J(b.pageX-x.scrollX-a.va/e.width*e.left,b.pageY-x.scrollY-a.ua/e.height*e.top);
  c=a.Vl*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.Ww,!1))}function Ze(a){30<a.cp&&(a.yh=1)}function mf(a,b){null!==a.yh&&(a.yh=null,b&&a.Yq(),ab&&ab.my||(a.cp=0,a.hv=[0,0,0,0,0],a.ep=0))}R.prototype.computePixelRatio=function(){return null!==this.yh?this.yh:x.devicePixelRatio||1};R.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};R.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
  R.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};R.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};R.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};R.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};R.prototype.doFocus=function(){this.focus()};R.prototype.focus=function(){if(this.ya)if(this.scrollsPageOnFocus)this.ya.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.ya.focus();x.scrollTo(a,b)}};R.prototype.Bz=function(){this.B.R("GainedFocus")};
  R.prototype.Az=function(){this.B.R("LostFocus")};function Lh(a){if(null!==a.ya){var b=a.Da;if(0!==b.clientWidth&&0!==b.clientHeight){a.pv||a.setScrollWidth();var c=a.Ye?a.rb:0,d=a.pe?a.rb:0,e=a.Tb;a.Tb=a.computePixelRatio();a.Tb!==e&&(a.El=!0,a.Db());if(b.clientWidth!==a.va+c||b.clientHeight!==a.ua+d)a.wi=!0,a.Dc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Kh&&(a.Hj=!0,b.C()),a.ac||a.Db()}}}
  function Ai(a){var b=new li;b.name="Background";a.um(b);b=new li;b.name="";a.um(b);b=new li;b.name="Foreground";a.um(b);b=new li;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.um(b);b=new li;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.um(b);b=new li;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.Ux(b,a.xk("Background"))}
  function Si(a){a.Ib=new X(X.Grid);a.Ib.name="GRID";var b=new Kf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ib.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ib.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ib.add(b);b=new Kf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ib.add(b);b=new Kf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ib.add(b);b=new Kf;b.figure=
  "LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ib.add(b);b=new V;b.add(a.Ib);b.layerName="Grid";b.zOrder=0;b.isInDocumentBounds=!1;b.isAnimated=!1;b.pickable=!1;b.locationObjectName="GRID";a.add(b);a.partManager.parts.remove(b);a.Ib.visible=!1}function Ti(){this.B.Vs?this.B.Vs=!1:this.B.isEnabled?this.B.iy(this):Ui(this.B)}function Vi(a){this.B.isEnabled?(this.B.Zs=a.target.scrollTop,this.B.Xs=a.target.scrollLeft):Ui(this.B)}
  R.prototype.iy=function(a){if(null!==this.ya){this.Op=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Si,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.Gl)switch(this.Ss){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=J.allocAt(this.position.x,this.position.y),
  this.allowHorizontalScroll&&this.Xs!==u&&(q.x=u/c+e,this.Xs=u),this.allowVerticalScroll&&this.Zs!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.Zs=a.scrollTop),this.position=q,J.free(q),this.wi=this.Op=!1):(q=J.alloc(),a.hz&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Ys.scrollWidth-this.va)+u-this.va/c+k,this.position.y))),a.iz&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
  -(this.Ys.scrollHeight-this.ua)+a.scrollTop-this.ua/c+d))),J.free(q),Wi(this),this.wi=this.Op=!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.Pp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Pp.style.height="1px"))}};R.prototype.computeBounds=function(){0<this.wd.count&&th(this);return Xi(this)};
  function Xi(a){if(a.fixedBounds.o()){var b=a.fixedBounds.copy();b.uq(a.ib);return b}for(var c=!0,d=a.Ma.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Fa.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.o()&&(c?(c=!1,b=l.copy()):b.Rc(l)))}}}c&&(b=new N(0,0,0,0));b.uq(a.ib);return b}
  R.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Aa(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof S||(e.Ta(),null===c?c=e.actualBounds.copy():c.Rc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.Ta(),null===c?c=d.actualBounds.copy():c.Rc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
  function Yi(a,b){if((b||a.qe)&&!a.Sb&&null!==a.ya&&a.documentBounds.o()){if(b){var c=a.initialPosition;if(c.o()){a.position=c;return}c=J.alloc();c.tj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=J.alloc();e.tj(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;N.free(d);J.free(e);J.free(c)}a.Sb=!0;c=a.Og;b&&a.Yf!==Kh&&(c=a.Yf);d=c!==Kh?Zi(a,c):a.scale;c=a.viewportBounds.copy();e=a.va/d;var f=a.ua/d,g=a.Dj,h=a.to;b&&!g.kb()&&(h.kb()||
  h.Mb())&&(g=h.Mb()?zc:h);$i(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Sb=!1;d=a.viewportBounds;if(!d.Qa(c))a.onViewportBoundsChanged(c,d,b,!1);aj(a);bj(a,!0,!1)}}
  function Zi(a,b){var c=a.Qn;if(null===a.ya)return c;a.Ta();var d=a.documentBounds;if(!d.o())return c;var e=d.width;d=d.height;var f=a.va+(a.Ye?a.rb:0),g=a.ua+(a.pe?a.rb:0),h=f/e,k=g/d;return b===cj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===dj?(b=k>h?(g-a.rb)/d:(f-a.rb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
  R.prototype.zoomToFit=function(){var a=this.Ti;this.Ti=Zh;this.scale=Zi(this,cj);a!==Zh&&(Yi(this,!1),$i(this,this.documentBounds,this.va/this.Aa,this.ua/this.Aa,this.Dj,!1));this.Ti=a};t=R.prototype;
  t.mB=function(a,b){void 0===b&&(b=cj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===cj||b===dj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.va;var f=this.ua;e=b===dj?f/d>e/c?(f-(this.pe?this.rb:0))/d:(e-(this.Ye?this.rb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
  t.uz=function(a,b){this.Ta();var c=this.documentBounds,d=this.viewportBounds;this.position=new J(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))};t.kA=function(a){if(a instanceof Y){this.ao=a;var b=J.alloc();this.bo=this.gr(a.da(tc,b));J.free(b)}else this.ao=null,this.bo=Hb};
  function $i(a,b,c,d,e,f){var g=J.allocAt(a.la.x,a.la.y),h=g.x,k=g.y;if(null!==a.ao){var l=J.alloc();l=a.ao.da(tc,l);h=l.x-a.bo.x/a.scale;k=l.y-a.bo.y/a.scale;e=sc;J.free(l)}if(f||a.scrollMode===Zh)e.kb()&&(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.Si,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-
  c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.ib.left;g.y=isFinite(k)?k:-a.ib.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Uc.sc&&Vh(a.Uc,a.la,g);a.la.h(g.x,g.y);J.free(g)}
  t.zm=function(a,b){void 0===b&&(b=!0);if(b){if(a=wf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof V)return a}else if(a=wf(this,a,function(a){return a.part}),a instanceof V)return a;return null};t.Vb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);th(this);for(var d=this.Ma.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Vb(a,b,c),null!==e))return e}return null};
  function wf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);th(a);for(a=a.Ma.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Vb(b,c,d),null!==e))return e}return null}t.Zz=function(a,b,c){void 0===b&&(b=!0);return ej(this,a,function(a){return a.part},b?function(a){return a instanceof V&&a.canSelect()}:null,c)};
  function ej(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof G||(e=new G);th(a);for(a=a.Ma.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.hj(b,c,d,e)}return e}t.hj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof G||(d=new G);th(this);for(var e=this.Ma.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.hj(a,b,c,d)}return d};
  t.ty=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return fj(this,a,function(a){return a instanceof V&&(!c||a.canSelect())},b,d)};t.zf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof G||(e=new G);th(this);for(var f=this.Ma.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.zf(a,b,c,d,e)}return e};
  t.Vv=function(a,b,c,d,e,f){var g=new G;th(this);for(var h=this.Ma.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Vv(a,b,c,d,g,e,f)}return g};function fj(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof G||(e=new G);th(a);for(a=a.Ma.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.zf(b,f,c,d,e)}return e}
  t.$z=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return gj(this,a,b,function(a){return a instanceof V&&(!d||a.canSelect())},c,e)};t.Eg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof G)f=e;e=!0}f instanceof E||f instanceof G||(f=new G);th(this);for(var g=this.Ma.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Eg(a,b,c,d,e,f)}return f};
  function gj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof G)f=e;e=!0}f instanceof E||f instanceof G||(f=new G);th(a);for(a=a.Ma.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Eg(b,c,g,d,e,f)}return f}R.prototype.acceptEvent=function(a){return hj(this,a,a instanceof MouseEvent)};
  function hj(a,b,c){var d=a.od;a.od=a.hh;a.hh=d;d.diagram=a;d.event=b;c?ij(a,b,d):(d.viewPoint=a.od.viewPoint,d.documentPoint=a.od.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||Ra||(d.buttons=b.buttons);Va&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=jj(b);d.targetObject=null;return d}
  function jj(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function kj(a,b,c,d){var e=lj(a,b,!0,!1,!0,d);ij(a,c,e);e.targetDiagram=jj(b);e.targetObject=null;d||e.clone(a.Wf);return e}
  function mj(a,b,c,d){d=lj(a,b,!1,!1,!1,d);if(null!==c){var e=x.document.elementFromPoint(c.clientX,c.clientY);null!==e&&void 0!==e.shadowRoot&&null!==e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(c.clientX,c.clientY));e&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a);d.targetDiagram=c;ij(a,b,d)}else null!==a.od?(d.documentPoint=a.od.documentPoint,d.viewPoint=a.od.viewPoint,d.targetDiagram=a.od.targetDiagram):null!==a.Wf&&(d.documentPoint=a.Wf.documentPoint,d.viewPoint=a.Wf.viewPoint,
  d.targetDiagram=a.Wf.targetDiagram);d.targetObject=null;return d}
  function lj(a,b,c,d,e,f){var g=a.od;a.od=a.hh;a.hh=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.zj&&b instanceof x.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Ra||(g.buttons=b.buttons),Va&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
  function nj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();!1!==b.cancelable&&b.preventDefault();b.cancelBubble=!0;return!1}
  R.prototype.BA=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=hj(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
  "Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return nj(c,a)};
  R.prototype.CA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=hj(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return nj(c,a)};
  R.prototype.Oz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=hj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return nj(c,a)};R.prototype.Pz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=hj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return nj(c,a)};
  R.prototype.getMouse=function(a){var b=this.ya;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.va/c.width*c.left;a=a.clientY-this.ua/c.height*c.top;return null!==this.sb?wb(new J(b,a),this.sb):new J(b,a)};
  function ij(a,b,c){var d=a.ya,e=a.va,f=a.ua,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.sb?(b=J.allocAt(g,h),a.sb.Jd(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
  function ue(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.bk[0])b=a.bk[c];else return;c=a.ya;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.va/c.width*c.left,b.clientY-a.ua/c.height*c.top))}R.prototype.Na=function(){this.vi||(this.vi=!0,this.Db(!0))};function oj(a){a.ac||th(a);a.Ta()}R.prototype.redraw=function(){this.Sb||this.ac||(this.M(),aj(this),Wi(this),this.Na(),this.hd())};t=R.prototype;t.AA=function(){return this.Ee};
  t.Jz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Bc();b.isEnabled=!1;Hf(this);this.qe=!1;this.Ts=new J(NaN,NaN);b.isEnabled=c;this.ac=!0;var d=this;null!==a&&ta(function(){d.ac=!1;rh(b,"Model");a(d)},1)};t.Db=function(a){void 0===a&&(a=!1);if(!0!==this.Ee&&!(this.Sb||!1===a&&this.ac)){this.Ee=!0;var b=this;x.requestAnimationFrame(function(){b.Ee&&b.hd()})}};t.hd=function(){if(!this.Kj||this.Ee)this.Kj&&(this.Kj=!1),Hf(this)};
  function bj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Sb||!a.wi||Ui(a)||(b&&th(a),c&&Yi(a,!1))}
  function Hf(a,b){if(!a.ac&&(a.Ee=!1,null!==a.Da||a.sm.o())){a.ac=!0;var c=a.animationManager,d=a.Wl;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];pj(h,!1);h.s()}d.clear()}d=a.Tu;0<d.count&&(d.each(function(a){a.Vw()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.sc||Lh(a);bj(a,!1,!0);null!==a.Ib&&(a.Ib.visible&&!a.po&&(qj(a),a.po=!0),!a.Ib.visible&&a.po&&(a.po=!1));th(a);f=!1;if(!a.qe||a.Ng)a.qe?rj(a,!a.Hj):
  (a.xa("Initial Layout"),!1===c.isEnabled&&c.Bc(),rj(a,!1)),f=!0;a.Hj=!1;th(a);a.gt||oj(a);bj(a,!0,!1);g=!1;f?(c=N.alloc(),c.assign(a.viewportBounds),a.qe||(g=a.qe=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,sj(a)),a.R("LayoutCompleted"),c.w(a.viewportBounds)||bj(a,!0,!1),N.free(c)):c.zl&&c.Qx&&(a.Yf!==Kh?a.scale=Zi(a,a.Yf):a.Og!==Kh?a.scale=Zi(a,a.Og):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Yi(a,!0));th(a);f&&g&&a.Xa("Initial Layout");a.Hv();
  b||a.mc(a.Gb);e&&(a.skipsUndoManager=d);a.ac=!1}}function sj(a){var b=a.Aa;if(a.Yf!==Kh)a.scale=Zi(a,a.Yf);else if(a.Og!==Kh)a.scale=Zi(a,a.Og);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.Aa!==b&&(aj(a),bj(a,!0,!1));Yi(a,!0);b=a.Ma.j;a.Nd(b,b.length,a);a.R("InitialLayoutCompleted");a.Ts.assign(a.la);qj(a)}
  function th(a){if((a.ac||!a.animationManager.isTicking)&&0!==a.wd.count){for(var b=0;23>b;b++){var c=a.wd.iterator;if(null===c||0===a.wd.count)break;a.wd=new G;a.Vw(c,a.wd)}a.nodes.each(function(a){a instanceof U&&0!==(a.P&65536)!==!1&&(a.P=a.P^65536)})}}
  t.Vw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Nc()||c instanceof U||(c.rj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof U&&c.isVisible()&&tj(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.rj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Je&&c.isVisible()&&(c.rj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
  function tj(a,b){for(var c=Ea(),d=Ea(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof U?(uj(f)||vj(f)||wj(f))&&tj(a,f):f instanceof S?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Ia(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Ia(d)}
  t.Nd=function(a,b,c,d){if(this.xi||this.animationManager.isAnimating){void 0===d&&(d=c.viewportBounds);for(var e=0;e<b;e++)a[e].Nd(c,d)}};
  t.mc=function(a,b){void 0===b&&(b=null);if(null!==this.Da){null===this.ya&&B("No canvas specified");var c=this.animationManager;if(!c.sc&&(!c.isAnimating||c.isTicking)){var d=new Date;xj(this);if("0"!==this.Da.style.opacity){var e=a!==this.Gb,f=this.Ma.j,g=f.length,h=this;this.Nd(f,g,h);if(e)a.uc(!0),Wi(this);else if(!this.Dc&&null===b&&!c.isAnimating)return;g=this.la;var k=this.Aa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.sb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
  k=this.Tb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.va,this.ua);1!==this.hb&&(a.globalAlpha=this.hb);yj(this,a);l=null!==b?function(c){var d=b;if(c.visible&&0!==c.hb){var e=c.Fa.j,f=e.length;if(0!==f){var g=ni(c,a),k=c.rp;k.length=0;for(var l=h.scale,m=N.alloc(),n=0;n<f;n++){var A=e[n];d.contains(A)||c.dj(a,A,h,k,l,m,!0)}N.free(m);a.globalAlpha=g}}}:function(b){b.mc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(1,0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,
  c.dy),l(f[m]);f=!1;this.ui?zj(this.ui,this)&&(f=this.Tr()):f=!0;f&&(ld.prototype.Jd=ld.prototype.Zx);e?(this.Gb.uc(!0),Wi(this)):this.Dc=this.xi=!1;f=+new Date-+d;e=ab&&ab.my;d=this.hv;if(e||null===this.yh){d[this.ep]=f;this.ep=(this.ep+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.cp=f/d.length}1!==this.hb&&(a.globalAlpha=1);if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(),20,150+ +(20*e))}}}};
  function Aj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Da){null===a.ya&&B("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);xj(a);a.Gb.uc(!0);Wi(a);a.yi=!0;var m=a.Aa;a.Aa=e;var n=a.Ma.j,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.uq(c);qj(a,q);th(a);a.Nd(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.Tb;b.scale(u,u);var w=ld.alloc();
  w.reset();w.translate(c.left,c.top);w.scale(e);0===f.x&&0===f.y||w.translate(-f.x,-f.y);b.setTransform(w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);ld.free(w);yj(a,b);b.globalAlpha=a.hb;var v=a.xk("Grid");if(g){var y=new G,z=g.iterator;for(z.reset();z.next();){var A=z.value;A instanceof V&&(l||A.layer!==v)&&y.add(A)}for(l=0;l<p;l++){var C=n[l];v=b;var F=a;if(C.visible&&0!==C.hb&&(k||!C.isTemporary)){var Q=C.Fa.j,K=Q.length;if(0!==K){var T=ni(C,v),P=C.rp;P.length=0;var I=F.scale,ja=N.alloc();for(c=0;c<K;c++){var ba=
  Q[c];y.contains(ba)&&C.dj(v,ba,F,P,I,ja,!1)}N.free(ja);v.globalAlpha=T}}}}else for(y=0;y<p;y++)F=n[y],F===v?l&&F.mc(b,a,!0):F.mc(b,a,k);a.yi=!1;a.ui&&zj(a.ui,a)&&a.Tr()}finally{a.Aa=m,a.Gb.uc(!0),Wi(a),a.Nd(n,p,a),qj(a)}}}t.Ke=function(a){return this.hf[a]};t.Ty=function(a,b){"minDrawingLength"===a&&(this.Xo=b);this.hf[a]=b;this.redraw()};
  t.xw=function(){this.hf=new $a;this.hf.drawShadows=!0;this.hf.textGreeking=!0;this.hf.viewportOptimizations=Wa||Sa||Ta?!1:!0;this.hf.temporaryPixelRatio=!0;this.hf.pictureRatioOptimization=!0;this.Xo=this.hf.minDrawingLength=1};function yj(a,b){a=a.hf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Sy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Bm=function(a){return this.Nj[a]};t.aB=function(a,b){this.Nj[a]=b};
  t.ww=function(){this.Nj=new $a;this.Nj.extraTouchArea=10;this.Nj.extraTouchThreshold=10;this.Nj.hasGestureZoom=!0};t.Fw=function(a){Bj(this,a)};
  function Bj(a,b){var c=a instanceof X,d=a instanceof R,e;for(e in b){""===e&&B("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.bb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];za(f)?g=e.substr(h+1):B("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!La(f,g))if(d&&"ModelChanged"===g){a.Wx(b[g]);continue}else if(d&&"Changed"===g){a.Hh(b[g]);continue}else if(d&&
  La(a.toolManager,g))f=a.toolManager;else if(d&&Cj(a,g)){a.kk(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.Hh(b[g]);continue}else B('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.Tx(g)}}t.Hv=function(){if(0===this.undoManager.transactionLevel&&0!==this.Vg.count){for(;0<this.Vg.count;){var a=this.Vg;this.Vg=new H;for(a=a.iterator;a.next();){var b=a.key;b.Oq(a.value);b.dc()}}this.M()}};
  t.M=function(a){void 0===a&&(a=null);if(null===a)this.Dc=!0,this.Db();else{var b=this.viewportBounds;null!==a&&a.o()&&b.Mc(a)&&(this.Dc=!0,this.Db())}this.R("InvalidateDraw")};
  R.prototype.invalidateViewport=function(a,b){if(!0!==this.Dc){this.Dc=!0;var c=!0===this.Ke("temporaryPixelRatio");if(!0===this.Ke("viewportOptimizations")&&this.scrollMode!==ai&&this.Si.fj(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=N.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.gq&&0<d.width&&0<d.height){if(!(this.ac||(this.Ee=!1,null===this.Da||(this.ac=
  !0,this.Hv(),this.documentBounds.o()||Dj(this,this.computeBounds()),e=this.ya,null===e||e instanceof Ej)))){var g=this.Tb;f=this.va*g;var h=this.ua*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.Ju;a=this.ux;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Ja,n,p,r,q,0,0,r,q);zj(this.ui,this)&&a.clearRect(0,
  0,k,m);e=Ea();a=Ea();q=Math.abs(l);r=Math.abs(b);var u=0===n?0:f-q;n=J.allocAt(u,0);q=J.allocAt(q+u,h);a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var w=this.sb;w.reset();w.scale(g,g);1!==this.Aa&&w.scale(this.Aa);g=this.la;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&w.translate(-g.x,-g.y);wb(n,w);wb(q,w);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);q.h(f,r+u);a.push(new N(Math.min(n.x,
  q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));wb(n,w);wb(q,w);e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));zj(this.ui,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),wb(n,w),wb(q,w),e.push(new N(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));J.free(n);J.free(q);bj(this,!1,!0);null===this.Da&&B("No div specified");null===this.ya&&
  B("No canvas specified");if(!this.animationManager.sc&&(f=this.Gb,this.Dc)){xj(this);h=this.Tb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.va*h,this.ua*h);f.drawImage(this.Ju.Ja,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.la;g=this.Aa;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.sb;b.reset();1!==g&&b.scale(g);0===l.x&&0===l.y||b.translate(-k,-m);f.save();f.beginPath();l=a.length;for(g=0;g<l;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),Math.floor(k.y),Math.ceil(k.width),
  Math.ceil(k.height));f.clip();f.setTransform(1,0,0,1,0,0);f.scale(h,h);f.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);b=this.Ma.j;l=b.length;this.Nd(b,l,this);yj(this,f);f.globalAlpha=this.hb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.hb){m=ni(g,f);p=g.rp;p.length=0;n=this.scale;r=N.alloc();q=g.Fa.j;w=q.length;u=k.length;for(var v=0;v<w;v++){var y=q[v],z=Fj(y,y.actualBounds);a:{for(var A=2/n,C=4/n,F=0;F<u;F++){var Q=k[F];if(0!==Q.width&&0!==Q.height&&z.cw(Q.x-A,Q.y-A,Q.width+C,Q.height+C)){z=
  !0;break a}}z=!1}z&&g.dj(f,y,this,p,n,r,!0)}N.free(r);f.globalAlpha=m}f.restore();f.uc(!0);this.ui&&zj(this.ui,this)&&this.Tr();this.Dc=this.xi=!1;this.Yq()}Ia(e);Ia(a);this.ac=!1}}else this.hd();N.free(d);c&&(Ze(this),this.hd(),mf(this,!0))}else c?(Ze(this),this.hd(),mf(this,!0)):this.hd()}};function aj(a){!1===a.wi&&(a.wi=!0)}function Wi(a){!1===a.xi&&(a.xi=!0)}function xj(a){!1!==a.El&&(a.El=!1,Gj(a,a.va,a.ua))}function Gj(a,b,c){var d=a.Tb;a.ya.resize(b*d,c*d,b,c)&&(a.Dc=!0,a.Gb.uc(!0))}
  function Ui(a){var b=a.ya;if(null===b||a.sm.o())return!0;var c=a.Da,d=a.va,e=a.ua,f=a.viewportBounds.copy();if(!f.o())return!0;var g=!1,h=a.Ye?a.rb:0,k=a.pe?a.rb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.Ye=!1,a.pe=!1,k=h=0,a.va=l,a.ua=m,g=a.El=!0;if(!(g||a.Ye||a.pe||a.vl||a.wl))return!0;a.wi=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,w=0;c=n.width;var v=n.height,y=a.Si;a.contentAlignment.kb()?(p.width>c&&(r=y.left,q=y.right),p.height>v&&(u=y.top,w=y.bottom)):
  (r=y.left,q=y.right,u=y.top,w=y.bottom);y=p.width+r+q;var z=p.height+u+w;r=p.x-r;var A=n.x;q=p.right+q;var C=n.right+h;u=p.y-u;var F=n.y;p=p.bottom+w;n=n.bottom+k;var Q="1px",K="1px";w=a.scale;l=y>l/w;m=z>m/w;a.scrollMode===Zh&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<A&&(l=Math.max((A-r)*w+a.va,l)),q>C+1&&(l=Math.max((q-C)*w+a.va,l)),c+h+1<y&&(l=Math.max((y-c)*w+a.va,l)),Q=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<F&&(l=Math.max((F-
  u)*w+a.ua,l)),p>n+1&&(l=Math.max((p-n)*w+a.ua,l)),v+k+1<z&&(l=Math.max((z-v)*w+a.ua,l)),K=l.toString()+"px"));l="1px"!==Q;m="1px"!==K;l&&m||!l&&!m||(m&&(C-=a.rb),l&&(n-=a.rb),y<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<A&&(h=Math.max((A-r)*w+a.va,h)),q>C+1&&(h=Math.max((q-C)*w+a.va,h)),c+1<y&&(h=Math.max((y-c)*w+a.va,h)),Q=h.toString()+"px"),l="1px"!==Q,h=a.ua,l!==a.pe&&(h=l?a.ua-a.rb:a.ua+a.rb),z<v+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<F&&(k=Math.max((F-
  u)*w+h,k)),p>n+1&&(k=Math.max((p-n)*w+h,k)),v+1<z&&(k=Math.max((z-v)*w+h,k)),K=k.toString()+"px"),m="1px"!==K);if(a.Op&&l===a.pe&&m===a.Ye)return d===a.va&&e===a.ua||a.hd(),!1;l!==a.pe&&("1px"===Q?a.ua=a.ua+a.rb:a.ua=Math.max(a.ua-a.rb,1),g=!0);a.pe=l;a.Pp.style.width=Q;m!==a.Ye&&("1px"===K?a.va=a.va+a.rb:a.va=Math.max(a.va-a.rb,1),g=!0,a.Gl&&(k=J.alloc(),m?(b.style.left=a.rb+"px",a.position=k.h(a.la.x+a.rb/a.scale,a.la.y)):(b.style.left="0px",a.position=k.h(a.la.x-a.rb/a.scale,a.la.y)),J.free(k)));
  a.Ye=m;a.Pp.style.height=K;a.Vs=!0;g&&(a.El=!0);b=a.Ys;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<y?k=(a.position.x-r)*w:r+1<A?k=b.scrollWidth-b.clientWidth:q>C+1&&(k=a.position.x*w));if(a.Gl)switch(a.Ss){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(v+1<z?b.scrollTop=(a.position.y-u)*w:u+1<F?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=
  a.position.y*w));l=a.va;m=a.ua;b.style.width=l+(a.Ye?a.rb:0)+"px";b.style.height=m+(a.pe?a.rb:0)+"px";return d!==l||e!==m||a.animationManager.sc?(a.onViewportBoundsChanged(f,a.viewportBounds,w,g),!1):!0}t=R.prototype;
  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.xk(a.layerName),null===b&&(b=this.xk("")),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.oj(99999999,a,a.diagram===this);0<=c&&this.Va(ze,"parts",b,null,a,null,c);b.isTemporary||this.Na();a.C(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
  t.oj=function(a){this.partManager.oj(a);var b=this;Hj(a,function(a){Ij(b,a)});(a instanceof Je||a instanceof U&&null!==a.placeholder)&&a.s();null!==a.data&&Hj(a,function(a){Jj(b.partManager,a)});!0!==vj(a)&&!0!==wj(a)||this.wd.add(a);Kj(a,!0,this);Lj(a)?(a.actualBounds.o()&&this.M(Fj(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.o()&&this.M(Fj(a,a.actualBounds));this.Db()};
  t.Lc=function(a){a.nk();this.partManager.Lc(a);var b=this;null!==a.data&&Hj(a,function(a){Mj(b.partManager,a,b)});this.wd.remove(a);Lj(a)?(a.actualBounds.o()&&this.M(Fj(a,a.actualBounds)),this.Na()):a.isVisible()&&a.actualBounds.o()&&this.M(Fj(a,a.actualBounds));this.Db()};t.remove=function(a){Nj(this,a,!0)};
  function Nj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.uk(),c=d.Lc(-1,b,!1),0<=c&&a.Va(Ae,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.gu=function(a,b){void 0===b&&(b=!1);if(Aa(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new G,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.tk=function(a,b,c){void 0===c&&(c=!1);return this.partManager.tk(a,b,c)};
  R.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Oj(this));if(null!==this.toolManager){var e=new H;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Pj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Pj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Pj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Pj(this,e,a.value,c,d);for(a=this.links;a.next();)Pj(this,e,a.value,c,d)}tf(this,e,b,d,c)}};
  function Pj(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Oj(a)),c instanceof W){b.add(c,a.Cd(e,c,c.location));if(c instanceof U&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Pj(a,b,f.value,d,e,e.groupsAlwaysMove);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Pj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Wv();c.next();)Pj(a,b,c.value,
  d,e)}else if(c instanceof S)for(b.add(c,a.Cd(e,c)),c=c.labelNodes;c.next();)Pj(a,b,c.value,d,e);else c instanceof Je||b.add(c,a.Cd(e,c,c.location))}
  function tf(a,b,c,d,e){if(null!==b&&0!==b.count){var f=J.alloc(),g=J.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.fq)||$e(a,b);for(var h=Ea(),k=Ea(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.Nc()){var r=Qj(a,n,b);if(null!==r)h.push(new Rj(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new J),p.shifted.assign(m.ge(r))}else l.key instanceof S&&k.push(l.ka)}J.free(m);e=h.length;for(l=
  0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.$v.shifted&&(n.$v.shifted=new J),n.node.location=f.add(n.$v.shifted);e=J.alloc();l=J.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof S)if(r.suspendsRouting){r.jf=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.Cd(d,r,g)),rf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.o()&&q.assign(m);var w=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
  (d.isGridSnapRealtime||a.lastInput.up)&&(w=J.alloc(),Gg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).ge(q);b.add(r,a.Cd(d,r,m));rf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);w!==m&&J.free(w)}else null!==m&&(e.assign(m.location),w=b.G(m),null!==w&&e.ge(w.point)),null!==u&&(l.assign(u.location),w=b.G(u),null!==w&&l.ge(w.point)),null!==m&&null!==u?e.Qa(l)?(m=q.value.point,u=f,u.assign(e),u.ge(m),b.add(r,a.Cd(d,r,e)),rf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ua()):(q=q.value.point,m=null!==m?e:null!==u?l:
  g,b.add(r,a.Cd(d,r,m)),rf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.Cd(d,r,g)),rf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Ia(h);Ia(k);c||(th(a),ef(a,b))}}
  R.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new J);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=J.alloc(),Gg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(1E3*a.location.x)/1E3:a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(1E3*a.location.y)/1E3:a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(1E3*a.location.x)/1E3:a.location.x);
  k=k.y;isNaN(k)&&(k=f?Math.round(1E3*a.location.y)/1E3:a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&J.free(e);return d};function Oj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.kl}
  function Gg(a,b,c,d,e){void 0===e&&(e=Oj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=J.allocAt(0,0);f.Uk(0,0,a,b,e);L.Gq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function $e(a,b){if(null!==b)for(a.fq=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
  function ef(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Sj(c)&&c.Ua())}a.fq=!1}}function Qj(a,b,c){b=b.containingGroup;if(null!==b){a=Qj(a,b,c);if(null!==a)return a;a=c.G(b);if(null!==a)return a}return null}t=R.prototype;t.Cd=function(a,b,c){if(void 0===c)return new cf(Bb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new cf(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new cf(c.copy())};
  function Tj(a,b,c){null!==b.diagram&&b.diagram!==a&&B("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&B("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&B("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&B("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Ma;c=a.count;for(var d=0;d<c;d++)a.J(d).name===b&&B("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
  t.um=function(a){Tj(this,a,null);a.ee(this);var b=this.Ma,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.J(c).isTemporary;)c--;b.wb(c+1,a);null!==this.cc&&this.Va(ze,"layers",this,null,a,null,c+1);this.M();this.Na()};t.Ux=function(a,b){Tj(this,a,b);a.ee(this);var c=this.Ma,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.cc&&this.Va(Ae,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.wb(f,a);break}null!==this.cc&&this.Va(ze,"layers",this,null,a,null,f);this.M();0>d&&this.Na()};
  t.nz=function(a,b){Tj(this,a,b);a.ee(this);var c=this.Ma,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.cc&&this.Va(Ae,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.wb(f+1,a);break}null!==this.cc&&this.Va(ze,"layers",this,null,a,null,f+1);this.M();0>d&&this.Na()};
  t.TA=function(a){a.diagram!==this&&B("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ma,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.cc&&this.Va(Ae,"layers",this,a,null,c,null);this.M();this.Na()}}};t.xk=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
  t.Wx=function(a){null===this.we&&(this.we=new E);this.we.add(a);this.model.Hh(a)};t.VA=function(a){null!==this.we&&(this.we.remove(a),0===this.we.count&&(this.we=null));this.model.Tk(a)};t.Hh=function(a){null===this.Of&&(this.Of=new E);this.Of.add(a)};t.Tk=function(a){null!==this.Of&&(this.Of.remove(a),0===this.Of.count&&(this.Of=null))};
  t.zt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.aw(a);a.change!==ye&&(this.isModified=!0);if(null!==this.Of)for(var b=this.Of,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Va=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new we;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.zt(h)};t.g=function(a,b,c,d,e){this.Va(xe,a,this,b,c,d,e)};
  R.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===xe){var e=a.object;Uj(e,a.propertyName,a.G(b));if(e instanceof Y){var f=e.part;null!==f&&f.Lb()}this.isModified=!0}else if(d===ze){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.Lc(h):g.wb(h,k);var l=g.part;null!==l&&l.Lb()}else"number"===typeof h&&k instanceof Vj&&(k.isRow?Wj(g,h,
  b?void 0:k):Xj(g,h,b?void 0:k));else if(g instanceof li){var m=!0===a.oldParam;"number"===typeof h&&k instanceof V&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Lb(),g.Lc(m?h:-1,k,m)):g.oj(h,k,m))}else g instanceof R?"number"===typeof h&&k instanceof li&&(b?this.Ma.cb(h):(k.ee(this),this.Ma.wb(h,k))):B("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===Ae){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof X)"number"===typeof p&&r instanceof Y?b?n.wb(p,r):n.Lc(p):
  "number"===typeof p&&r instanceof Vj&&(r.isRow?Wj(n,p,b?r:void 0):Xj(n,p,b?r:void 0));else if(n instanceof li){var q=!0===a.newParam;"number"===typeof p&&r instanceof V&&(b?0>n.Fa.indexOf(r)&&n.oj(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Lb(),n.Lc(q?p:-1,r,q)))}else n instanceof R?"number"===typeof p&&r instanceof li&&(b?(r.ee(this),this.Ma.wb(p,r)):this.Ma.cb(p)):B("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==ye&&B("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=
  c}}};R.prototype.xa=function(a){return this.undoManager.xa(a)};R.prototype.Xa=function(a){return this.undoManager.Xa(a)};R.prototype.If=function(){return this.undoManager.If()};R.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.xa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.If(),this.skipsUndoManager=c}};R.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};
  R.prototype.ir=function(){this.partManager.ir()};
  function Yj(a,b,c){var d=a.animationManager;if(a.Sb||a.ac)a.Aa=c,d.ef&&d.Rd.add(d.B,"scale",b,a.Aa);else if(null===a.ya)a.Aa=c;else{a.Sb=!0;var e=a.viewportBounds.copy(),f=a.va,g=a.ua;e.width=a.va/b;e.height=a.ua/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Oc()?l.Ef(Gc)?h=0:l.Ef(Hc)&&(h=f-1):h=l.kb()?l.x*(f-1):f/2);isNaN(k)&&(l.Oc()?l.Ef(Ec)?k=0:l.Ef(Ic)&&(k=g-1):k=l.kb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.defaultAnimation.isAnimating||(c=a.scaleComputation(a,
  c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=J.allocAt(a.la.x+h/b-h/c,a.la.y+k/b-k/c);a.position=f;J.free(f);a.Aa=c;a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);a.Sb=!1;Yi(a,!1);d.ef&&d.Rd.add(d.B,"scale",b,a.Aa);a.M();aj(a)}}
  R.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.w(b)){void 0===d&&(d=!1);d||aj(this);Wi(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Kh||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Zf&&e instanceof Pa&&(this.lastInput.documentPoint=this.ou(this.lastInput.viewPoint),Se(e,this));this.Sb||this.invalidateViewport(a,b);qj(this);this.Ic.scale=c;this.Ic.position.x=a.x;this.Ic.position.y=a.y;this.Ic.bounds.assign(a);this.Ic.Gv.width=
  Math.round(a.width*c);this.Ic.Gv.height=Math.round(a.height*c);this.Ic.kw.width=this.va;this.Ic.kw.height=this.ua;this.Ic.hw=d;this.R("ViewportBoundsChanged",this.Ic,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Mc(b)&&a.Ua()})}};
  function qj(a,b){void 0===b&&(b=null);var c=a.Ib;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.W.j,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(Zj(l.figure)?f=f*m/L.uy(f,m):e=e*m/L.uy(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=J.alloc();L.Gq(a,
  g,0,0,d.width,d.height,b);b.offset(-d.width,-d.height);M.free(d);c.part.location=b;J.free(b)}}R.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.R("ChangingSelection",b);for(var c=b.ma(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.R("ChangedSelection",b)}};
  R.prototype.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.R("ChangedSelection",this.selection))};
  R.prototype.$A=function(a){this.R("ChangingSelection",this.selection);this.clearSelection(!0);if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof V||B("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof V||B("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.R("ChangedSelection",this.selection)};
  R.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.ma(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=R.prototype;t.uA=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
  t.vA=function(a){a=(new G).addAll(a);for(var b=this.highlighteds.copy().Zq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof V||B("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
  t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=J.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
  d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));J.free(d);return}B("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:B("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
  t.Aw=function(a){var b=this.viewportBounds;b.Ge(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.At=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.gr=function(a){var b=this.sb;b.reset();1!==this.Aa&&b.scale(this.Aa);var c=this.la;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.sb)};
  t.iB=function(a){var b=this.sb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new N(f,r,p-f,b-r)};
  t.ou=function(a){var b=this.sb;b.reset();1!==this.Aa&&b.scale(this.Aa);var c=this.la;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return wb(a.copy(),this.sb)};function ak(a){var b=a.isModified;a.zv!==b&&(a.zv=b,a.R("Modified"))}function bk(a){a=vi.get(a);return null!==a?new a:new wi}
  R.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===ye&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.ac||this.qe||(this.Hj=!0,this.Kj&&(this.Ee=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
  a.Bc(),this.R("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Bc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===ye){if("FinishedUndo"===d||"FinishedRedo"===d)this.R("ChangedSelection",this.selection),th(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.Bc();this.Hj=!0;this.hd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||uh(f);"CommittedTransaction"===
  d&&this.undoManager.isJustDiscarded&&(this.Xd=Math.min(this.Xd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(ak(this),this.Yt.clear(),Sh(this.animationManager));if(!this.Bs&&g&&this.lastInput.targetDiagram){this.Bs=!0;var h=this;ta(function(){h.currentTool.standardMouseOver();h.Bs=!1},10)}}}finally{this.Z=!0}}}};
  function Ij(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)ck(a,b[d])}function ck(a,b){if(b instanceof dk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.Wg instanceof G&&c.Wg.add(a);var d=b.Zg;null!==d&&!0===d.ls&&null!==b.diagram&&b.diagram.Wl.add(b);if(c.io)if(c=c.getAttribute("src"),d=a.pg.G(c),null===d)d=[],d.push(b),a.pg.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
  function ek(a,b){if(b instanceof dk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&(c.Wg instanceof G&&c.Wg.remove(a),fk(c),c.io)){c=c.getAttribute("src");var d=a.pg.G(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.pg.remove(c),Hi(c));break}}}}R.prototype.Md=function(){this.partManager.Md()};R.prototype.jk=function(a,b){this.Uc.jk(a,b)};R.prototype.lk=function(a,b){this.Uc.lk(a,b)};R.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};
  R.prototype.Cb=function(a){return this.partManager.Cb(a)};R.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=R.prototype;t.zc=function(a){return this.partManager.zc(a)};t.gj=function(a){return this.partManager.gj(a)};t.yc=function(a){return this.partManager.yc(a)};t.It=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.It.apply(this.partManager,b instanceof Array?b:da(ca(b)))};
  t.Ht=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Ht.apply(this.partManager,b instanceof Array?b:da(ca(b)))};function Dj(a,b){a.vi=!1;var c=a.Rn;c.w(b)||(b=b.H(),a.Rn=b,Yi(a,!1),a.R("DocumentBoundsChanged",null,c.copy()),aj(a))}t.Ta=function(){this.vi&&Dj(this,this.computeBounds())};t.dA=function(){for(var a=new G,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};
  t.cA=function(){return this.Dh.iterator};t.EA=function(a){th(this);a&&gk(this,!0);this.ac?rj(this,!1):(this.Hj=!0,Hf(this))};function gk(a,b){for(var c=a.Dh.iterator;c.next();)hk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}function hk(a,b,c){if(null!==b){for(var d=b.Sl.iterator;d.next();)hk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
  function rj(a,b){if(a.Ng&&!a.Nr){var c=a.Z;a.Z=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.xa("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.sc&&(b||rh(f,"Layout"));a.Ng=!1;for(var g=a.Dh.iterator;g.next();)pk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),th(a),e.isValidLayout=!0):a.Ng=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.Xa("Layout"),a.undoManager.isInternalTransaction=
  !1),!b||0!==d&&1!==d||uh(f),a.Z=c}}}function pk(a,b,c,d){if(null!==b){for(var e=b.Sl.iterator;e.next();)pk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Rh=!b.location.o(),e.doLayout(b),b.C(32),tj(a,b),e.isValidLayout=!0):a.Ng=!0)}}t.jA=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.jj()&&a.add(c)}return a.iterator};
  function ti(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 H,d=new H;b("InitialAnimationStarting");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.Qr=c;a.Pr=d}
  function Cj(a,b){var c=a.Pr.G(b);return null!==c?c:a.Pr.G(b.toLowerCase())}function tk(a,b){var c=a.Qr.G(b);if(null!==c)return c;c=a.Qr.G(b.toLowerCase());if(null!==c)return c;B("Unknown DiagramEvent name: "+b)}t.kk=function(a,b){a=tk(this,a);null!==a&&a.add(b)};t.Lm=function(a,b){a=tk(this,a);null!==a&&a.remove(b)};
  t.R=function(a,b,c){var d=tk(this,a),e=new ve;e.diagram=this;a=Cj(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.J(0)(e);else if(0!==b)for(d=d.ma(),c=0;c<b;c++)(0,d[c])(e)};function uk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.fq||b.isComplexRoutingRealtime:!0}t.Ek=function(a,b){void 0===b&&(b=null);return vk(this,!1,null,b).Ek(a.x,a.y,a.width,a.height)};
  R.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.vi?Xi(this):this.documentBounds.copy()};
  function vk(a,b,c,d){null===a.Gc&&(a.Gc=new wk);if(a.Gc.Rt||a.Gc.group!==c||a.Gc.Vy!==d){null!==c&&(c=xk(a,c));if(null===c){b=a.computeOccupiedArea();b.Jc(100,100);a.Gc.initialize(b);b=N.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&yk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Jc(20,20),a.Gc.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof W&&yk(a,f,d,b);N.free(b)}a.Gc.group=
  c;a.Gc.Vy=d;a.Gc.Rt=!1}else b&&zk(a.Gc);return a.Gc}function xk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?xk(a,b.containingGroup):null}
  function yk(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.Gc;var e=b.x,f=b.y;if(Ak(a,e,f))for(c=(f-a.Bd)/a.gc|0,d=Math.min((e+b.width-a.Ad)/a.fc|0,a.Zi),b=Math.min((f+b.height-a.Bd)/a.gc|0,a.$i),e=(e-a.Ad)/a.fc|0;e<=d;e++)if(f=a.Rb[e],f.fill)f.fill(Bk,c,b+1);else for(var g=c;g<=b;g++)f[g]=Bk}else if(b instanceof U)for(b=b.memberParts;b.next();)e=b.value,e instanceof W&&yk(a,e,c,d)}
  function Ck(a,b){null!==a.Gc&&!a.Gc.Rt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Gc.Rt=!0)}R.prototype.Et=function(a){this.rn.assign(a);this.computeAutoScrollPosition(this.rn).Qa(this.position)?this.Jf():Dk(this)};
  function Dk(a){-1===a.Bj&&(a.Bj=ta(function(){if(-1!==a.Bj&&(a.Jf(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.rn);b.Qa(a.position)||(a.position=b,a.lastInput.documentPoint=a.ou(a.rn),a.doMouseMove(),a.vi=!0,Dj(a,a.documentBounds.copy().Rc(a.computeBounds())),a.Dc=!0,a.hd(),Dk(a))}},a.qn))}R.prototype.Jf=function(){-1!==this.Bj&&(x.clearTimeout(this.Bj),this.Bj=-1)};
  R.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.sn;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=N.allocAt(0,0,d.width*e,d.height*e);var f=J.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left&&this.allowHorizontalScroll){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&this.allowHorizontalScroll&&(g=Math.max(this.scrollHorizontalLineChange,
  1),g|=0,f.x+=g,a.x>d.x+d.width-c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top&&this.allowVerticalScroll?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&this.allowVerticalScroll&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Qa(Bb)||(b=new J(b.x+f.x/e,b.y+f.y/e));
  N.free(d);J.free(f);return b};t=R.prototype;t.$t=function(){return null};t.iw=function(){return null};t.rz=function(a,b){this.Kx.add(a,b)};
  function Ek(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.pg.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.GA=function(a){if(!Ug)return null;void 0===a&&(a=new $a);a.returnType="Image";return this.Hy(a)};
  t.Hy=function(a){void 0===a&&(a=new $a);return Ek(this,this.HA,a)};
  t.HA=function(a,b,c){var d=Fk(c,a,"canvas",null);if(null===d)return null;c=d.Y.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case Gk+"data":e=d.getImageData(0,0,c.width,c.height);break;case Gk: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 Fk(a,b,c,d){a.animationManager.Bc();a.hd();if(null===a.ya)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 kc(l):l instanceof kc||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.Gb.uc(!0);n=new Hk(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.va+Math.ceil(l.left+l.right);n.height=a.ua+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.Dq=r;Aj(a,d.context,l,new M(n.width,n.height),a.Aa,a.la,k,m,q,b);return d.context}a.rl=!1;Aj(a,u,l,new M(n.width,n.height),a.Aa,a.la,k,m,q,b);a.rl=!0;return n.context}var w=a.Qn,v=a.documentBounds.copy();v.Jw(a.ib);if(q)for(var y=a.Ma.j,z=y.length,A=0;A<z;A++){var C=y[A];if(C.visible&&C.isTemporary){C=C.Fa.j;for(var F=C.length,Q=0;Q<F;Q++){var K=C[Q];K.isInDocumentBounds&&K.isVisible()&&(K=K.actualBounds,K.o()&&v.Rc(K))}}}y=new J(v.x,v.y);if(null!==k){z=
  !0;A=k.iterator;for(A.reset();A.next();)if(C=A.value,C instanceof V&&(F=C.layer,(null===F||F.visible)&&(null===F||q||!F.isTemporary)&&C.isVisible()&&(C=C.actualBounds,C.o())))if(z){z=!1;var T=C.copy()}else T.Rc(C);z&&(T=new N(0,0,0,0));v.width=T.width;v.height=T.height;y.x=T.x;y.y=T.y}null!==h&&h.o()&&(y=h,f||(f=w));T=h=0;null!==l&&(h=l.left+l.right,T=l.top+l.bottom);z=A=0;null!==e&&(A=e.width,z=e.height,isFinite(A)&&(A=Math.max(0,A-h)),isFinite(z)&&(z=Math.max(0,z-T)));null!==e&&null!==f?("NaN"===
  f&&(f=w),e.o()?(e=A,v=z):isNaN(z)?(e=A,v=v.height*f):(e=v.width*f,v=z)):null!==e?e.o()?(f=Math.min(A/v.width,z/v.height),e=A,v=z):isNaN(z)?(f=A/v.width,e=A,v=v.height*f):(f=z/v.height,e=v.width*f,v=z):null!==f?"NaN"===f&&g.o()?(f=Math.min((g.width-h)/v.width,(g.height-T)/v.height),f>w?(f=w,e=v.width,v=v.height):(e=g.width,v=g.height)):(e=v.width*f,v=v.height*f):(f=w,e=v.width,v=v.height);null!==l?(e+=h,v+=T):l=new kc(0);null!==g&&(w=g.width,g=g.height,isNaN(w)&&(w=2E3),isNaN(g)&&(g=2E3),isFinite(w)&&
  (e=Math.min(e,w)),isFinite(g)&&(v=Math.min(v,g)));n.width=Math.ceil(e);n.height=Math.ceil(v);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.Dq=r;Aj(a,d.context,l,new M(Math.ceil(e),Math.ceil(v)),f,y,k,m,q,b);return d.context}a.rl=!1;Aj(a,u,l,new M(Math.ceil(e),Math.ceil(v)),f,y,k,m,q,b);a.rl=!0;return n.context}
  na.Object.defineProperties(R.prototype,{div:{get:function(){return this.Da},set:function(a){if(this.Da!==a){var b=this.Da;null!==b?(b.B=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.ya&&(b=this.ya.Ja,this.zj?(this.removeEventListener(b,"pointermove",this.Pk,!1),this.removeEventListener(b,"pointerdown",this.Ok,!1),this.removeEventListener(b,"pointerup",this.Rk,!1),this.removeEventListener(b,"pointerout",this.Qk,!1)):(this.removeEventListener(b,"touchstart",this.Ow,
  !1),this.removeEventListener(b,"touchmove",this.Nw,!1),this.removeEventListener(b,"touchend",this.Mw,!1)),this.ya.ky()),this.Zl&&(this.Zl.disconnect(),this.Zl=null),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.Gb=this.ya=null,this.removeEventListener(x,"resize",this.Ww,!1),this.zj||(this.removeEventListener(x,
  "mousemove",this.Ik,!0),this.removeEventListener(x,"mousedown",this.Hk,!0),this.removeEventListener(x,"mouseup",this.Kk,!0),this.removeEventListener(x,"mouseout",this.Jk,!0)),this.removeEventListener(x,"wheel",this.Lk,!0),Fe===this&&(Fe=null)):this.qe=!1;this.Da=null;if(null!==a){if(b=a.B)b.div=null;Di(this,a);this.redraw()}}}},Yx:{get:function(){return this.cp}},pj:{get:function(){return this.qe}},draggedLink:{
  get:function(){return this.Sr},set:function(a){this.Sr!==a&&(this.Sr=a,null!==a&&(this.Fs=a.fromPort,this.Gs=a.toPort))}},Ky:{get:function(){return this.Fs},set:function(a){this.Fs=a}},Ly:{get:function(){return this.Gs},set:function(a){this.Gs=a}},animationManager:{get:function(){return this.Uc}},undoManager:{get:function(){return this.cc.undoManager}},skipsUndoManager:{
  get:function(){return this.vg},set:function(a){this.vg=a;this.cc.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Nr},set:function(a){this.Nr=a}},opacity:{get:function(){return this.hb},set:function(a){var b=this.hb;b!==a&&((0>a||1<a)&&wa(a,"0 <= value <= 1",R,"opacity"),this.hb=a,this.g("opacity",b,a),this.M())}},validCycle:{get:function(){return this.tt},set:function(a){var b=this.tt;
  b!==a&&(this.tt=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Ma.iterator}},isModelReadOnly:{get:function(){var a=this.cc;return null===a?!1:a.isReadOnly},set:function(a){var b=this.cc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.md},
  set:function(a){var b=this.md;b!==a&&(this.md=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.nr},set:function(a){var b=this.nr;b!==a&&(this.nr=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,
  this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.pr},set:function(a){var b=this.pr;b!==a&&(this.pr=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.qr},set:function(a){var b=this.qr;b!==a&&(this.qr=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(this.ji=a,this.g("allowTextEdit",b,a))}},allowGroup:{
  get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(this.bi=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(this.ki=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.sr},set:function(a){var b=this.sr;b!==a&&(this.sr=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.ci},set:function(a){var b=
  this.ci;b!==a&&(this.ci=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(this.ei=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(this.di=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("allowReshape",b,a))}},
  allowResize:{get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(this.gi=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(this.ii=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.tr},
  set:function(a){var b=this.tr;b!==a&&(this.tr=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.vr},set:function(a){var b=this.vr;b!==a&&(this.vr=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.wl},set:function(a){var b=this.wl;b!==a&&(this.wl=a,aj(this),this.M(),this.g("hasVerticalScrollbar",b,a),Yi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.vl},
  set:function(a){var b=this.vl;b!==a&&(this.vl=a,aj(this),this.M(),this.g("hasHorizontalScrollbar",b,a),Yi(this,!1))}},allowHorizontalScroll:{get:function(){return this.rr},set:function(a){var b=this.rr;b!==a&&(this.rr=a,this.g("allowHorizontalScroll",b,a),Yi(this,!1))}},allowVerticalScroll:{get:function(){return this.ur},set:function(a){var b=this.ur;b!==a&&(this.ur=a,this.g("allowVerticalScroll",b,a),Yi(this,!1))}},scrollHorizontalLineChange:{
  get:function(){return this.Ws},set:function(a){var b=this.Ws;b!==a&&(0>a&&wa(a,">= 0",R,"scrollHorizontalLineChange"),this.Ws=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.$s},set:function(a){var b=this.$s;b!==a&&(0>a&&wa(a,">= 0",R,"scrollVerticalLineChange"),this.$s=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{get:function(){return this.hh},set:function(a){this.hh=
  a}},previousInput:{get:function(){return this.od},set:function(a){this.od=a}},firstInput:{get:function(){return this.Wf},set:function(a){this.Wf=a}},currentCursor:{get:function(){return this.Hr},set:function(a){""===a&&(a=this.Pn);if(this.Hr!==a){var b=this.ya,c=this.Da;if(null!==b){this.Hr=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.Pn},set:function(a){""===a&&(a="auto");var b=this.Pn;b!==a&&(this.Pn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("click",b,a))}},doubleClick:{
  get:function(){return this.Uf},set:function(a){var b=this.Uf;b!==a&&(this.Uf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(this.Qf=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(this.lg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.jg},set:function(a){var b=
  this.jg;b!==a&&(this.jg=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.ig},set:function(a){var b=this.ig;b!==a&&(this.ig=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.As},set:function(a){var b=this.As;b!==a&&(this.As=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.gg},set:function(a){var b=this.gg;b!==a&&(this.gg=a,this.g("mouseDrop",b,a))}},
  handlesDragDropForTopLevelParts:{get:function(){return this.cs},set:function(a){var b=this.cs;b!==a&&(this.cs=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(this.hg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.kg},set:function(a){var b=this.kg;b!==a&&(this.kg=a,this.g("mouseLeave",b,a))}},toolTip:{
  get:function(){return this.wg},set:function(a){var b=this.wg;b!==a&&(this.wg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.Rf},set:function(a){var b=this.Rf;b!==a&&(this.Rf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.Br},set:function(a){this.Br!==a&&(this.Br=a,a.ee(this))}},toolManager:{get:function(){return this.pt},set:function(a){this.pt!==a&&
  (this.pt=a,a.diagram=this)}},defaultTool:{get:function(){return this.Mr},set:function(a){var b=this.Mr;b!==a&&(this.Mr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.Jr},set:function(a){var b=this.Jr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.Jr=a,a.diagram=this,a.doStart())}},selection:{
  get:function(){return this.qv}},maxSelectionCount:{get:function(){return this.ws},set:function(a){var b=this.ws;if(b!==a)if(0<=a&&!isNaN(a)){if(this.ws=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.R("ChangingSelection",this.selection);b=this.selection.ma();for(var c=0;c<a;c++)b[c].isSelected=!1;this.R("ChangedSelection",this.selection)}}else wa(a,">= 0",R,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{
  get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.qo},set:function(a){var b=this.qo;b!==a&&(this.qo=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.Lo},set:function(a){var b=this.Lo;b!==a&&(this.Lo=a,this.g("linkSelectionAdornmentTemplate",
  b,a))}},highlighteds:{get:function(){return this.Su}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.wo&&this.Xd!==a.historyIndex:this.wo},set:function(a){if(this.wo!==a){this.wo=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Xd=b.historyIndex);a||ak(this)}}},model:{get:function(){return this.cc},set:function(a){var b=this.cc;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.");this.animationManager.Bc(!0);var c=Gi(this,!0);this.qe=!1;this.Kj=!0;this.Xd=-2;this.Ee=!1;var d=this.ac;this.ac=!0;rh(this.animationManager,"Model");null!==b&&(null!==this.we&&this.we.each(function(a){b.Tk(a)}),b.Tk(this.Tc));this.cc=a;this.partManager=bk(this.cc.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Hh(this.Cc);this.partManager.addAllModeledParts();
  a.Tk(this.Cc);a.Hh(this.Tc);null!==this.we&&this.we.each(function(b){a.Hh(b)});this.ac=d;this.Na();this.Sb||this.M();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.av},set:function(a){this.av=a}},Yt:{get:function(){return this.Ax}},skipsModelSourceBindings:{get:function(){return this.rv},set:function(a){this.rv=a}},mu:{get:function(){return this.gt},
  set:function(a){this.gt=a}},nodeTemplate:{get:function(){return this.df.G("")},set:function(a){var b=this.df.G("");b!==a&&(this.df.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Md())}},nodeTemplateMap:{get:function(){return this.df},set:function(a){var b=this.df;b!==a&&(this.df=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Md())}},groupTemplate:{get:function(){return this.fh.G("")},
  set:function(a){var b=this.fh.G("");b!==a&&(this.fh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Md())}},groupTemplateMap:{get:function(){return this.fh},set:function(a){var b=this.fh;b!==a&&(this.fh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Md())}},linkTemplate:{get:function(){return this.bg.G("")},set:function(a){var b=this.bg.G("");b!==a&&(this.bg.add("",a),this.g("linkTemplate",
  b,a),this.undoManager.isUndoingRedoing||this.Md())}},linkTemplateMap:{get:function(){return this.bg},set:function(a){var b=this.bg;b!==a&&(this.bg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Md())}},isMouseCaptured:{get:function(){return this.Xu},set:function(a){var b=this.ya;null!==b&&(b=b.Ja,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.zj?(this.removeEventListener(b,"pointermove",this.Pk,!1),this.removeEventListener(b,
  "pointerdown",this.Ok,!1),this.removeEventListener(b,"pointerup",this.Rk,!1),this.removeEventListener(b,"pointerout",this.Qk,!1),this.addEventListener(x,"pointermove",this.Pk,!0),this.addEventListener(x,"pointerdown",this.Ok,!0),this.addEventListener(x,"pointerup",this.Rk,!0),this.addEventListener(x,"pointerout",this.Qk,!0)):(this.removeEventListener(b,"mousemove",this.Ik,!1),this.removeEventListener(b,"mousedown",this.Hk,!1),this.removeEventListener(b,"mouseup",this.Kk,!1),this.removeEventListener(b,
  "mouseout",this.Jk,!1),this.addEventListener(x,"mousemove",this.Ik,!0),this.addEventListener(x,"mousedown",this.Hk,!0),this.addEventListener(x,"mouseup",this.Kk,!0),this.addEventListener(x,"mouseout",this.Jk,!0)),this.removeEventListener(b,"wheel",this.Lk,!1),this.addEventListener(x,"wheel",this.Lk,!0),this.addEventListener(x,"selectstart",this.preventDefault,!1)):(this.zj?(this.removeEventListener(x,"pointermove",this.Pk,!0),this.removeEventListener(x,"pointerdown",this.Ok,!0),this.removeEventListener(x,
  "pointerup",this.Rk,!0),this.removeEventListener(x,"pointerout",this.Qk,!0),this.addEventListener(b,"pointermove",this.Pk,!1),this.addEventListener(b,"pointerdown",this.Ok,!1),this.addEventListener(b,"pointerup",this.Rk,!1),this.addEventListener(b,"pointerout",this.Qk,!1)):(this.removeEventListener(x,"mousemove",this.Ik,!0),this.removeEventListener(x,"mousedown",this.Hk,!0),this.removeEventListener(x,"mouseup",this.Kk,!0),this.removeEventListener(x,"mouseout",this.Jk,!0),this.addEventListener(b,"mousemove",
  this.Ik,!1),this.addEventListener(b,"mousedown",this.Hk,!1),this.addEventListener(b,"mouseup",this.Kk,!1),this.addEventListener(b,"mouseout",this.Jk,!1)),this.removeEventListener(x,"wheel",this.Lk,!0),this.removeEventListener(x,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Lk,!1)),this.Xu=a))}},position:{get:function(){return this.la},set:function(a){var b=J.alloc().assign(this.la);if(!b.w(a)){var c=this.viewportBounds.copy();this.la.assign(a);
  Vh(this.animationManager,b,this.la);this.Sb||null===this.ya&&!this.sm.o()||(this.Sb=!0,a=this.scale,$i(this,this.Rn,this.va/a,this.ua/a,this.Dj,!1),this.Sb=!1);if(!this.Sb)this.onViewportBoundsChanged(c,this.viewportBounds,this.Aa,!1)}J.free(b)}},initialPosition:{get:function(){return this.es},set:function(a){this.es.w(a)||(this.es=a.H())}},initialScale:{get:function(){return this.fs},set:function(a){this.fs!==a&&(this.fs=a)}},grid:{
  get:function(){null===this.Ib&&Si(this);return this.Ib},set:function(a){var b=this.Ib;if(b!==a){null===b&&(Si(this),b=this.Ib);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.Ib=a;a.name="GRID";null!==c&&c.add(a);qj(this);this.M();this.g("grid",b,a)}}},viewportBounds:{get:function(){var a=this.Rx,b=this.la,c=this.Aa;a.h(b.x,b.y,Math.max(this.va,0)/c,Math.max(this.ua,0)/c);return a}},viewSize:{
  get:function(){return this.sm},set:function(a){var b=this.viewSize;b.w(a)||(this.sm=a=a.H(),this.ua=this.va=0,a.o()?(this.va=a.width,this.ua=a.height):null!==this.Da&&(this.va=this.Da.clientWidth||1,this.ua=this.Da.clientHeight||1),this.Na(),this.g("viewSize",b,a),this.redraw())}},fixedBounds:{get:function(){return this.Zr},set:function(a){var b=this.Zr;b.w(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||B("fixedBounds width/height must not be Infinity"),
  this.Zr=a=a.H(),this.Na(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.Si},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.Si;b.w(a)||(this.Si=a=a.H(),this.g("scrollMargin",b,a),this.Yq())}},scrollMode:{get:function(){return this.Ti},set:function(a){var b=this.Ti;b!==a&&(this.Ti=a,a===Zh&&Yi(this,!1),this.g("scrollMode",b,a),this.M())}},scrollsPageOnFocus:{get:function(){return this.at},
  set:function(a){var b=this.at;b!==a&&(this.at=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.Ns},set:function(a){var b=this.Ns;b!==a&&(this.Ns=a,Yi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.Us},set:function(a){var b=this.Us;b!==a&&(this.Us=a,Yj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{
  get:function(){return this.Rn}},isVirtualized:{get:function(){return this.rs},set:function(a){var b=this.rs;b!==a&&(this.rs=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.Aa},set:function(a){var b=this.Aa;b!==a&&Yj(this,b,a)}},defaultScale:{get:function(){return this.Qn},set:function(a){this.Qn=a}},autoScale:{get:function(){return this.Og},set:function(a){var b=
  this.Og;b!==a&&(this.Og=a,this.g("autoScale",b,a),a!==Kh&&Yi(this,!1))}},initialAutoScale:{get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==a&&(this.Yf=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.gs},set:function(a){var b=this.gs;b!==a&&(a.kb()||B("initialViewportSpot must be a specific Spot: "+a),this.gs=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{
  get:function(){return this.ds},set:function(a){var b=this.ds;b!==a&&(a.kb()||B("initialViewportSpot must be a specific Spot: "+a),this.ds=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.xs},set:function(a){var b=this.xs;b!==a&&(0<a?(this.xs=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):wa(a,"> 0",R,"minScale"))}},maxScale:{get:function(){return this.vs},set:function(a){var b=this.vs;b!==a&&(0<a?(this.vs=
  a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):wa(a,"> 0",R,"maxScale"))}},zoomPoint:{get:function(){return this.xt},set:function(a){this.xt.w(a)||(this.xt=a=a.H())}},contentAlignment:{get:function(){return this.Dj},set:function(a){var b=this.Dj;b.w(a)||(this.Dj=a=a.H(),this.g("contentAlignment",b,a),Yi(this,!1))}},initialContentAlignment:{get:function(){return this.to},set:function(a){var b=this.to;
  b.w(a)||(this.to=a=a.H(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.ib},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.ib;b.w(a)||(this.ib=a=a.H(),this.Na(),this.g("padding",b,a))}},partManager:{get:function(){return this.La},set:function(a){var b=this.La;b!==a&&(null!==a.diagram&&B("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.ee(null),this.La=a,a.ee(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.kc},set:function(a){var b=this.kc;b!==a&&(this.kc=a,a.diagram=this,a.group=null,this.Ng=!0,this.g("layout",b,a),this.Db())}},isTreePathToChildren:{get:function(){return this.qs},
  set:function(a){var b=this.qs;if(b!==a&&(this.qs=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Ik(a.value)}},treeCollapsePolicy:{get:function(){return this.rt},set:function(a){var b=this.rt;b!==a&&(a!==ui&&a!==Jk&&a!==Kk&&B("Unknown Diagram.treeCollapsePolicy: "+a),this.rt=a,this.g("treeCollapsePolicy",b,a))}},Le:{get:function(){return this.Uu},set:function(a){this.Uu=a}},autoScrollInterval:{
  get:function(){return this.qn},set:function(a){var b=this.qn;b!==a&&(this.qn=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.sn},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.sn;b.w(a)||(this.sn=a=a.H(),this.Na(),this.g("autoScrollRegion",b,a))}}});
  na.Object.defineProperties(R,{licenseKey:{get:function(){return Lk.Xb()},set:function(a){Lk.add(a)}},version:{get:function(){return Mk}}});R.prototype.makeImageData=R.prototype.Hy;R.prototype.makeImage=R.prototype.GA;R.prototype.addRenderer=R.prototype.rz;R.prototype.makeSVG=R.prototype.iw;R.prototype.makeSvg=R.prototype.$t;R.prototype.stopAutoScroll=R.prototype.Jf;R.prototype.doAutoScroll=R.prototype.Et;R.prototype.isUnoccupied=R.prototype.Ek;
  R.prototype.raiseDiagramEvent=R.prototype.R;R.prototype.removeDiagramListener=R.prototype.Lm;R.prototype.addDiagramListener=R.prototype.kk;R.prototype.findTreeRoots=R.prototype.jA;R.prototype.layoutDiagram=R.prototype.EA;R.prototype.findTopLevelGroups=R.prototype.cA;R.prototype.findTopLevelNodesAndLinks=R.prototype.dA;R.prototype.ensureBounds=R.prototype.Ta;R.prototype.findLinksByExample=R.prototype.Ht;R.prototype.findNodesByExample=R.prototype.It;R.prototype.findLinkForData=R.prototype.yc;
  R.prototype.findNodeForData=R.prototype.gj;R.prototype.findPartForData=R.prototype.zc;R.prototype.findLinkForKey=R.prototype.findLinkForKey;R.prototype.findNodeForKey=R.prototype.Cb;R.prototype.findPartForKey=R.prototype.findPartForKey;R.prototype.rebuildParts=R.prototype.Md;R.prototype.transformViewToDoc=R.prototype.ou;R.prototype.transformRectDocToView=R.prototype.iB;R.prototype.transformDocToView=R.prototype.gr;R.prototype.centerRect=R.prototype.At;R.prototype.scrollToRect=R.prototype.Aw;
  R.prototype.scroll=R.prototype.scroll;R.prototype.highlightCollection=R.prototype.vA;R.prototype.highlight=R.prototype.uA;R.prototype.selectCollection=R.prototype.$A;R.prototype.select=R.prototype.select;R.prototype.updateAllRelationshipsFromData=R.prototype.ir;R.prototype.updateAllTargetBindings=R.prototype.updateAllTargetBindings;R.prototype.commit=R.prototype.commit;R.prototype.rollbackTransaction=R.prototype.If;R.prototype.commitTransaction=R.prototype.Xa;R.prototype.startTransaction=R.prototype.xa;
  R.prototype.raiseChanged=R.prototype.g;R.prototype.raiseChangedEvent=R.prototype.Va;R.prototype.removeChangedListener=R.prototype.Tk;R.prototype.addChangedListener=R.prototype.Hh;R.prototype.removeModelChangedListener=R.prototype.VA;R.prototype.addModelChangedListener=R.prototype.Wx;R.prototype.findLayer=R.prototype.xk;R.prototype.removeLayer=R.prototype.TA;R.prototype.addLayerAfter=R.prototype.nz;R.prototype.addLayerBefore=R.prototype.Ux;R.prototype.addLayer=R.prototype.um;
  R.prototype.moveParts=R.prototype.moveParts;R.prototype.copyParts=R.prototype.tk;R.prototype.removeParts=R.prototype.gu;R.prototype.remove=R.prototype.remove;R.prototype.add=R.prototype.add;R.prototype.clearDelayedGeometries=R.prototype.Hv;R.prototype.setProperties=R.prototype.Fw;R.prototype.resetInputOptions=R.prototype.ww;R.prototype.setInputOption=R.prototype.aB;R.prototype.getInputOption=R.prototype.Bm;R.prototype.resetRenderingHints=R.prototype.xw;R.prototype.setRenderingHint=R.prototype.Ty;
  R.prototype.getRenderingHint=R.prototype.Ke;R.prototype.maybeUpdate=R.prototype.hd;R.prototype.requestUpdate=R.prototype.Db;R.prototype.delayInitialization=R.prototype.Jz;R.prototype.isUpdateRequested=R.prototype.AA;R.prototype.invalidateDocumentBounds=R.prototype.Na;R.prototype.findObjectsNear=R.prototype.Eg;R.prototype.findPartsNear=R.prototype.$z;R.prototype.findObjectsIn=R.prototype.zf;R.prototype.findPartsIn=R.prototype.ty;R.prototype.findObjectsAt=R.prototype.hj;R.prototype.findPartsAt=R.prototype.Zz;
  R.prototype.findObjectAt=R.prototype.Vb;R.prototype.findPartAt=R.prototype.zm;R.prototype.focusObject=R.prototype.kA;R.prototype.alignDocument=R.prototype.uz;R.prototype.zoomToRect=R.prototype.mB;R.prototype.zoomToFit=R.prototype.zoomToFit;R.prototype.diagramScroll=R.prototype.iy;R.prototype.focus=R.prototype.focus;R.useDOM=function(a){Ug=a?void 0!==x.document:!1};R.isUsingDOM=function(){return Ug};
  var Fe=null,vi=new H,Qi=null,Pi=null,Ug=void 0!==x.document,Ei=null,Fi="",Kh=new D(R,"None",0),cj=new D(R,"Uniform",1),dj=new D(R,"UniformToFill",2),Mf=new D(R,"CycleAll",10),Qf=new D(R,"CycleNotDirected",11),Sf=new D(R,"CycleNotDirectedFast",12),Tf=new D(R,"CycleNotUndirected",13),Nf=new D(R,"CycleDestinationTree",14),Pf=new D(R,"CycleSourceTree",15),Zh=new D(R,"DocumentScroll",1),ai=new D(R,"InfiniteScroll",2),ui=new D(R,"TreeParentCollapsed",21),Jk=new D(R,"AllParentsCollapsed",22),Kk=new D(R,
  "AnyParentsCollapsed",23),Lk=new E,Mk="2.1.54",Gk="image",Nk=null,ri=!1;
  function si(){if(Ug){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Qa("7ca11abfd022028846");b[c]=Qa("398c3597c01238");for(var d=["5da73c80a36455d5038e4972187c3cae51fd22",ra.Dx+"4ae6247590da4bb21c324ba3a84e385776",ld.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],e=1;5>e;e++)b[Qa("7ca11abfd7330390")](Qa(d[e-1]),10,15*e);b[c]=Qa("39f046ebb36e4b");for(c=1;5>c;c++)b[Qa("7ca11abfd7330390")](Qa(d[c-1]),10,15*c);if(4!==d.length||"5"!==d[0][0]||"7"!==d[3][0])ld.prototype.Jd=ld.prototype.Zx;
  Nk=a}}R.className="Diagram";R.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof R?b.B:null};R.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};R.None=Kh;R.Uniform=cj;R.UniformToFill=dj;R.CycleAll=Mf;R.CycleNotDirected=Qf;R.CycleNotDirectedFast=Sf;
  R.CycleNotUndirected=Tf;R.CycleDestinationTree=Nf;R.CycleSourceTree=Pf;R.DocumentScroll=Zh;R.InfiniteScroll=ai;R.TreeParentCollapsed=ui;R.AllParentsCollapsed=Jk;R.AnyParentsCollapsed=Kk;function Ci(){this.jz=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Ve=this.l=!0:this.Ve=null}
  function zj(a,b){b.Gb.setTransform(b.Tb,0,0,b.Tb,0,0);if(null===a.Ve)a:{b="f";var c=x[Qa("76a715b2f73f148a")][Qa("72ba13b5")];a.Ve=!0;if(Ug){var d=R[Qa("76a115b6ed251eaf4692")];if(d)for(var e=Lk.iterator;e.next();){d=e.value;d=Qa(d).split(Qa("39e9"));if(6>d.length)break;var f=Qa(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Qa(ra[Qa("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Qa("76ad18b4f73e")];for(g=c[Qa("73a612b6fb191d")](Qa("35e7"))+2;g<f;g++)b+=c[g];f=b[Qa("73a612b6fb191d")](Qa(d[2]));
  0>f&&Qa(d[2])!==Qa("7da71ca0ad381e90")&&(f=b[Qa("73a612b6fb191d")](Qa("76a715b2ef3e149757")));0>f&&(f=b[Qa("73a612b6fb191d")](Qa("76a715b2ef3e149757")));0>f&&(f=c[Qa("73a612b6fb191d")](Qa("7baa19a6f76c1988428554")));a.Ve=!(0<=f&&f<b[Qa("73a612b6fb191d")](Qa("35"))||-1===b[Qa("73a612b6fb191d")](Qa("35")));if(!a.Ve)break;f=Qa(d[2]);if("#"===f[0]){g=x.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.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[Qa("79a417a0f0181a8946")]=d;if(x.document[Qa("78a712aa")]){if(x.document[Qa("78a712aa")][Qa("7bb806b6ed32388c4a875b")](g),h=x.getComputedStyle(g).getPropertyValue(Qa("78a704b7e62456904c9b12701b6532a8")),x.document[Qa("78a712aa")][Qa("68ad1bbcf533388c4a875b")](g),h)if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.Ve=!1;break}else if(Ra||Sa||Ta||Ua)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=
  document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.Ve=!1;break a}}}else a.Ve=null,a.Ve=!1}}}else{k=c[Qa("76ad18b4f73e")];for(e=c[Qa("73a612b6fb191d")](Qa("35e7"))+2;e<k;e++)b+=c[e];c=b[Qa("73a612b6fb191d")](Qa("7da71ca0ad381e90"));a.Ve=!(0<=c&&c<b[Qa("73a612b6fb191d")](Qa("35")))}}}return 0<a.Ve&&a!==a.jz?!0:!1}
  function Di(a,b){if(Ug){void 0!==b&&null!==b||B("Diagram setup requires an argument DIV.");null!==a.Da&&B("Diagram has already completed setup.");"string"===typeof b?a.Da=x.document.getElementById(b):b instanceof HTMLDivElement?a.Da=b:B("No DIV or DIV id supplied: "+b);null===a.Da&&B("Invalid DIV id; could not get element with id: "+b);void 0!==a.Da.B&&B("Invalid div id; div already has a Diagram associated with it.");if(!a.Zl&&x.ResizeObserver){var c=sa(function(){a.Db()},250);a.Zl=new x.ResizeObserver(function(){c()});
  a.Zl.observe(a.Da)}"static"===x.getComputedStyle(a.Da,null).position&&(a.Da.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.Da.style["-webkit-tap-highlight-color"]=d;a.Da.style["-ms-touch-action"]="none";a.Da.innerHTML="";a.Da.B=a;a.Da.goDiagram=a;a.Da.go=x.go;var e=a.gq?new Ej(a):new Hk(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===x.getComputedStyle(a.Da,null).getPropertyValue("direction")&&(a.Gl=!0),e.style.zIndex="2",e.style.userSelect=
  "none",e.style.MozUserSelect="none");a.ya=e;a.Gb=e.context;d=a.Gb;a.Tb=a.computePixelRatio();a.viewSize.o()||(a.va=a.Da.clientWidth||1,a.ua=a.Da.clientHeight||1);Gj(a,a.va,a.ua);a.Da.insertBefore(e.Ja,a.Da.firstChild);e=new Hk(null);e.width=1;e.height=1;a.Ju=e;a.ux=e.context;if(Ug){e=ua("div");var f=ua("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.va+"px";e.style.height=a.ua+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.Da.appendChild(e);
  e.appendChild(f);e.onscroll=Ti;e.addEventListener("mousedown",Vi);e.addEventListener("touchstart",Vi,{passive:!0});e.B=a;e.hz=!0;e.iz=!0;a.Ys=e;a.Pp=f}a.Yq=sa(function(){a.yh=null;a.M()},300);a.Ww=sa(function(){Lh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Ik=function(b){if(a.isEnabled){a.Zf=!0;var c=hj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.xd=0);nj(c,b)}};a.Hk=function(b){if(a.isEnabled)if(a.Zf=!0,a.re)b.preventDefault();else{var c=hj(a,b,!0);c.down=
  !0;c.clickCount=b.detail;if(Sa||Ta)b.timeStamp-a.Sj<a.qt&&!a.currentTool.isBeyondDragSize()?a.xd++:a.xd=1,a.Sj=b.timeStamp,c.clickCount=a.xd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():nj(c,b)}};a.Kk=function(b){if(a.isEnabled)if(a.re&&2===b.button)b.preventDefault();else if(a.re&&0===b.button&&(a.re=!1),a.hk)b.preventDefault();else{a.Zf=!0;var c=hj(a,b,!0);c.up=!0;c.clickCount=b.detail;if(Sa||Ta)c.clickCount=a.xd;c.bubbles=b.bubbles;c.targetDiagram=jj(b);a.doMouseUp();a.Jf();
  nj(c,b)}};a.Lk=function(b){if(a.isEnabled){var c=hj(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?(0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&(d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();nj(c,
  b)}};a.Jk=function(b){a.isEnabled&&(a.Zf=!1,hj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Ow=function(b){if(a.isEnabled){a.hk=!1;a.re=!0;var c=kj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var f=a.Go;b.timeStamp-a.Sj<a.qt&&!(25<Math.abs(f.x-e)||25<Math.abs(f.y-d))?a.xd++:a.xd=1;c.clickCount=a.xd;a.Sj=b.timeStamp;a.Go.h(e,d)}a.doMouseDown();
  nj(c,b)}};a.Nw=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]:0<b.changedTouches.length&&(c=b.changedTouches[0]);c=mj(a,b,c,1<b.touches.length);a.doMouseMove();nj(c,b)}};a.Mw=function(b){if(a.isEnabled)if(a.hk)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);var e=lj(a,b,!1,!0,!1,!1);null!==d&&(c=x.document.elementFromPoint(d.clientX,d.clientY),
  null!==c&&void 0!==c.shadowRoot&&null!==c&&null!==c.shadowRoot&&(c=c.shadowRoot.elementFromPoint(d.clientX,d.clientY)),null!==c&&c.B instanceof R&&c.B!==a&&ij(c.B,d,e),ij(a,d,e),e.clickCount=a.xd);null===c?e.targetDiagram=jj(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();nj(e,b);a.re=!1}};a.Ok=function(b){if(a.isEnabled){a.Zf=!0;var c=a.Ls;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.bk;var d=!1;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,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.hk=!1,a.re=!0;c=kj(a,b,b,d);d=a.Go;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Sj<a.qt&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.xd++:a.xd=1;c.clickCount=a.xd;a.Sj=b.timeStamp;a.Go.Ig(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():nj(c,b)}};a.Pk=
  function(b){if(a.isEnabled){a.Zf=!0;var c=a.bk;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=mj(a,b,b,null!==c[1]),c.targetDiagram=jj(b),a.doMouseMove(),nj(c,b))}};a.Rk=function(b){if(a.isEnabled){a.Zf=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Ls;if(c&&a.hk)delete d[b.pointerId],b.preventDefault();else if(d=a.bk,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=
  null;d=lj(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof R&&e.B!==a&&ij(e.B,b,d);ij(a,b,d);d.clickCount=a.xd;null===e?d.targetDiagram=jj(b):e.B?d.targetDiagram=e.B:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();nj(d,b);c&&(a.re=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.Qk=function(b){if(a.isEnabled){a.Zf=!1;var c=a.Ls;c[b.pointerId]&&delete c[b.pointerId];c=a.bk;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())}};a.Tr=d.Y["d"+Ok[1]+Ok[2]+"wI"+Gk.slice(1,5)]["b"+Pk.slice(1,b)](d.Y,Nk,b,b);d.uc(!0);Ri(a)}}Ci.className="DiagramHelper";function cf(a){this.l=void 0===a?new J:a;this.u=new J}
  na.Object.defineProperties(cf.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}}});var Ok="DraggingInfo";cf.className="DraggingInfo";function Rj(a,b,c){this.node=a;this.info=b;this.$v=c}Rj.className="DraggingNodeInfoPair";function We(){this.reset()}
  We.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=tc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};We.className="DraggingOptions";function Qk(a){1<arguments.length&&B("Palette constructor can only take one optional argument, the DIV HTML element or its id.");R.call(this,a);Rk(this)}ma(Qk,R);
  function Rk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=uc;a.layout=new Sk}Qk.prototype.reset=function(){R.prototype.reset.call(this);Rk(this)};Qk.className="Palette";
  function Tk(a){1<arguments.length&&B("Overview constructor can only take one optional argument, the DIV HTML element or its id.");R.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Sb=!0;this.Ka=null;this.wl=this.vl=!1;this.I=this.T=!0;this.eb=0;this.u=!1;this.fm=null;this.Ty("drawShadows",!1);var c=new V,d=new Kf;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE";
  c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new kc(0,0,0,0);this.la.h(0,0);this.toolManager.Ya("Dragging",new Uk,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new J(d.x-c.width/2,d.y-c.height/2)}};this.Xh=function(){b.Na();Vk(b)};this.Wh=function(){null!==b.observed&&(b.Na(),b.M())};this.Sc=function(){1>
  b.updateDelay?b.M():b.u||(b.u=!0,setTimeout(function(){return b.redraw()},b.updateDelay))};this.Od=function(){null!==b.observed&&Vk(b)};this.autoScale=cj;this.Sb=!1}ma(Tk,R);Tk.prototype.computePixelRatio=function(){return 1};
  Tk.prototype.redraw=function(){if(this.u&&1<=this.updateDelay){this.u=!1;var a=this.ya,b=this.Gb;if(null!==a&&null!==b){xj(this);if(null===this.fm){var c=new Hk(null);c.width=a.width;c.height=a.height;this.fm=c}try{this.ya=this.fm,this.Gb=this.ya.context,this.Gb.uc(!0),this.Gb.setTransform(1,0,0,1,0,0),this.Gb.clearRect(0,0,this.ya.width,this.ya.height),Wk(this)}finally{this.ya=a,this.Gb=b}}}R.prototype.redraw.call(this)};
  Tk.prototype.mc=function(){null===this.Da&&B("No div specified");null===this.ya&&B("No canvas specified");if(!(this.ya instanceof Ej)&&(mi(this.box),this.Dc)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.pj){xj(this);var b=this.ya;a=this.Gb;a.uc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Wk(this):null!==this.fm&&(a.drawImage(this.fm.Ja,0,0),b=this.sb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&
  0===this.position.y||b.translate(-this.position.x,-this.position.y),a.scale(this.Tb,this.Tb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Ma.j;for(var c=b.length,d=0;d<c;d++)b[d].mc(a,this);this.Dc=this.xi=!1}}};
  function Wk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=N.alloc().assign(a.viewportBounds).Rc(b.viewportBounds),qj(b,e),N.free(e),th(b));var f=a.sb;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.Gb;e.scale(a.Tb,a.Tb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Ma.j;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
  0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=ni(h,e),l.mc(e,k),e.globalAlpha=h);else{for(var m=ni(h,e),n=k.scale,p=N.alloc(),r=h.Fa.j,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.dj(e,w,k,null,n,p,!1)}N.free(p);e.globalAlpha=m}}}}}
  function Vk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Dc=!0;c=c.viewportBounds;var d=b.selectionObject,e=M.alloc();e.h(c.width,c.height);d.desiredSize=e;M.free(e);a=2/a.scale;d instanceof Kf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Tk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return ic;var b=a.documentBounds.copy();b.Rc(a.viewportBounds);return b};Tk.prototype.invalidateViewport=function(){!0!==this.Dc&&(this.Dc=!0,this.Db())};
  Tk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.Sb||(Wi(this),this.M(),aj(this),this.Na(),Vk(this),this.Ic.scale=c,this.Ic.position.x=a.x,this.Ic.position.y=a.y,this.Ic.bounds.assign(a),this.Ic.hw=d,this.R("ViewportBoundsChanged",this.Ic,a))};
  na.Object.defineProperties(Tk.prototype,{observed:{get:function(){return this.Ka},set:function(a){var b=this.Ka;a instanceof Tk&&B("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Lm("ViewportBoundsChanged",this.Xh),b.Lm("DocumentBoundsChanged",this.Wh),b.Lm("InvalidateDraw",this.Sc),b.Lm("AnimationFinished",this.Od));this.Ka=a;null!==a&&(a.kk("ViewportBoundsChanged",this.Xh),a.kk("DocumentBoundsChanged",this.Wh),
  a.kk("InvalidateDraw",this.Sc),a.kk("AnimationFinished",this.Od),this.add(this.box));this.Na();if(null===a){this.fm=null;var c=this.ya,d=this.Gb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.Sc(null),Vk(this),this.M();this.g("observed",b,a)}}},box:{get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),Vk(this),this.g("box",b,a))}},drawsTemporaryLayers:{
  get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a,this.redraw())}},drawsGrid:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a,this.redraw())}},updateDelay:{get:function(){return this.eb},set:function(a){0>a&&(a=0);this.eb!==a&&(this.eb=a)}}});Tk.className="Overview";function Uk(){Ve.call(this);this.l=null}ma(Uk,Ve);
  Uk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.l.x,a.y-this.l.y));return!0};
  Uk.prototype.doActivate=function(){this.l=null;Ve.prototype.doActivate.call(this)};Uk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Uk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.l.x,a.y-this.l.y)}}};Uk.className="OverviewDraggingTool";
  function Xk(){Xa(this);this.B=Fe;this.eb=this.I=this.u=!0;this.T=this.Ka=this.Sc=this.La=!1;this.Ki=this.l=null;this.Od=1.05;this.bv=NaN;this.yx=null;this.Bv=NaN;this.Av=ic;this.Cc=!0;this.rg=null;this.Tc=200}Xk.prototype.toString=function(){return"CommandHandler"};Xk.prototype.ee=function(a){this.B=a};
  Xk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Va?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
  this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
  a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
  this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():"F2"===f||b.event&&"F2"===b.event.key?this.canEditTextBlock()&&this.editTextBlock():"ContextMenu"===f||b.event&&"ContextMenu"===b.event.key?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
  Xk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Xk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Pa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Xk.prototype.canStopCommand=function(){return!0};
  Xk.prototype.selectAll=function(){var a=this.diagram;a.M();try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.R("ChangedSelection",a.selection),a.currentCursor=""}};Xk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
  Xk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.xa("Delete");a.R("SelectionDeleting",a.selection);for(var b=new G,c=a.selection.iterator;c.next();)Yk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.gu(b,!0);a.R("SelectionDeleted",b)}finally{a.Xa("Delete"),a.R("ChangedSelection",a.selection),a.currentCursor=""}};
  Xk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Xk.prototype.copySelection=function(){var a=this.diagram,b=new G;for(a=a.selection.iterator;a.next();)Yk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Xk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
  Xk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Xk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
  Xk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ei=null,Fi="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Em()&&(d=c.sk,c.sk=this.copiesParentKey),c.Ck()&&(e=c.rk,c.rk=this.copiesGroupKey),f=b.tk(a,null,!0)}finally{c.Em()&&(c.sk=d),c.Ck()&&(c.rk=e),c=new E,c.addAll(f),Ei=c,Fi=b.model.dataFormat}}b.R("ClipboardChanged",c)};
  Xk.prototype.pasteFromClipboard=function(){var a=new G,b=Ei;if(null===b)return a;var c=this.diagram;if(Fi!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Em()&&(e=d.sk,d.sk=this.copiesParentKey),d.Ck()&&(f=d.rk,d.rk=this.copiesGroupKey),g=c.tk(b,c,!1)}finally{for(d.Em()&&(d.sk=e),d.Ck()&&(d.rk=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.o()||(d.location.o()?c.location=d.location:!c.position.o()&&d.position.o()&&(c.position=d.position)),a.add(c)}return a};
  Xk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.xa("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.o()){var f=this.computeEffectiveCollection(b.selection,b.kl);tf(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.kl,!1)}}b.R("ClipboardPasted",c)}finally{b.Xa("Paste"),b.R("ChangedSelection",
  b.selection),b.currentCursor=""}};Xk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ei||0===Ei.count||Fi!==a.model.dataFormat?!1:!0};Xk.prototype.undo=function(){this.diagram.undoManager.undo()};Xk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Xk.prototype.redo=function(){this.diagram.undoManager.redo()};
  Xk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Xk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===Kh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Xk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==Kh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
  Xk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===Kh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Xk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==Kh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Xk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
  Xk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
  Xk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Bc();a.redraw();var c=a.position,d=a.scale;rh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.Bv&&!isNaN(this.bv)&&a.documentBounds.w(this.Av)?(a.scale=this.bv,a.position=this.yx,this.Bv=NaN,this.Av=ic):(this.bv=d,this.yx=c.copy(),a.zoomToFit(),this.Bv=a.scale,this.Av=a.documentBounds.copy());uh(b)};Xk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
  Xk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;b.Ta();if(null===a){try{null!==this.rg&&(this.rg.next()?a=this.rg.value:this.rg=null)}catch(k){this.rg=null}null===a&&(0<b.highlighteds.count?this.rg=b.highlighteds.iterator:0<b.selection.count&&(this.rg=b.selection.iterator),null!==this.rg&&this.rg.next()&&(a=this.rg.value))}if(null!==a){var c=b.animationManager;rh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Zk(this,a,[a]);if(1===e.length)b.xa(),b.At(a.actualBounds),
  b.Xa("Scroll To Part");else{var f=function(){b.xa();for(var a=e.pop();0<e.length&&a instanceof W&&a.isTreeExpanded&&(!(a instanceof U)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof V&&b.Aw(a.actualBounds),a instanceof W&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof U&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof V&&b.At(a.actualBounds),b.Lm("LayoutCompleted",g));b.Xa("Scroll To Part")},g=function(){ta(f,(c.isEnabled?c.duration:0)+d)};b.kk("LayoutCompleted",
  g);f()}}else{var h=b.position.copy();b.At(a.actualBounds);h.Qa(b.position)&&c.Bc()}}};
  function Zk(a,b,c){if(b.isVisible())return c;if(b instanceof Je)Zk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Zk(a,d,c);b=b.toNode;null!==b&&Zk(a,b,c)}else b instanceof W&&(d=b.labeledLink,null!==d&&Zk(a,d,c),d=b.Fg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Zk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Zk(a,b,c));return c}
  Xk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof V))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
  Xk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Collapse Tree");rh(b.animationManager,"Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.R("TreeCollapsed",c)}finally{b.Xa("Collapse Tree")}};
  Xk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W&&a.isTreeExpanded))return!1;if(0<a.Hq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&b.isTreeExpanded&&0<b.Hq().count)return!0;return!1};
  Xk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Expand Tree");rh(b.animationManager,"Expand Tree");var c=new E;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof W&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.R("TreeExpanded",c)}finally{b.Xa("Expand Tree")}};
  Xk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof W)||a.isTreeExpanded)return!1;if(0<a.Hq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&!b.isTreeExpanded&&0<b.Hq().count)return!0;return!1};
  Xk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.Dk()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.R("ChangingSelection",a.selection);a.xa("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Nc()&&g.canGroup()&&e.add(g)}for(var h=new E,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Kd(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
  n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Kd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof U)yg(c),d=c.copy(),null!==d&&a.add(d);else if(b.fw(c)){var r=b.copyNodeData(c);za(r)&&(b.uf(r),d=a.gj(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.R("SelectionGrouped",d)}finally{a.Xa("Group"),a.R("ChangedSelection",a.selection),
  a.currentCursor=""}}}};Xk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.Dk()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Nc()&&b.canGroup())return!0}return!1};
  function $k(a){var b=Ea();for(a=a.iterator;a.next();){var c=a.value;c instanceof S||b.push(c)}a=new G;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Kd(b[g])){f=!1;break}f&&a.add(e)}Ia(b);return a}
  Xk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.Kd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
  Xk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.Dk())try{b.currentCursor="wait";b.R("ChangingSelection",b.selection);b.xa("Ungroup");var d=new E;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof U&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.ja(l.data):void 0;g.addAll(k.memberParts);
  for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof S)){var r=p.data;null!==r?c.dr(r,m):p.containingGroup=l}}b.remove(k)}}b.R("SelectionUngrouped",d,g)}finally{b.Xa("Ungroup"),b.R("ChangedSelection",b.selection),b.currentCursor=""}};
  Xk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.Dk())return!1;if(null!==a){if(!(a instanceof U))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.canUngroup())return!0;return!1};
  Xk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=$k(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
  Xk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Collapse SubGraph");rh(b.animationManager,"Collapse SubGraph");var c=new E;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.R("SubGraphCollapsed",c)}finally{b.Xa("Collapse SubGraph")}};
  Xk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof U&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.isSubGraphExpanded)return!0;return!1};
  Xk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.xa("Expand SubGraph");rh(b.animationManager,"Expand SubGraph");var c=new E;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.R("SubGraphExpanded",c)}finally{b.Xa("Expand SubGraph")}};
  Xk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof U&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&!b.isSubGraphExpanded)return!0;return!1};
  Xk.prototype.editTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.ym(function(a){return a instanceof Wg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
  Xk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Wg))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.ym(function(a){return a instanceof Wg&&a.editable}),null!==a))return!0;return!1};
  Xk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.da(zc):b.viewportBounds.$(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.gr(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Sg(c,!1,a)}};
  Xk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
  Xk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.kl);d=new H;if(null===a)return d;for(var f=a.iterator;f.next();)Pj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof S&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
  na.Object.defineProperties(Xk.prototype,{diagram:{get:function(){return this.B}},copiesClipboardData:{get:function(){return this.u},set:function(a){this.u=a}},copiesConnectedLinks:{get:function(){return this.I},set:function(a){this.I=a}},deletesConnectedLinks:{get:function(){return this.eb},set:function(a){this.eb=a}},copiesTree:{get:function(){return this.La},
  set:function(a){this.La=a}},deletesTree:{get:function(){return this.Sc},set:function(a){this.Sc=a}},copiesParentKey:{get:function(){return this.Ka},set:function(a){this.Ka=a}},copiesGroupKey:{get:function(){return this.T},set:function(a){this.T=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.Ki},
  set:function(a){this.Ki=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Od},set:function(a){1<a||B("zoomFactor must be larger than 1.0, not: "+a);this.Od=a}},isZoomToFitRestoreEnabled:{get:function(){return this.Cc},set:function(a){this.Cc=a}},scrollToPartPause:{get:function(){return this.Tc},
  set:function(a){this.Tc=a}}});Xk.className="CommandHandler";yi=function(){return new Xk};
  function Y(){Xa(this);this.F=4225027;this.hb=1;this.og=null;this.oa="";this.ec=this.mb=null;this.la=(new J(NaN,NaN)).freeze();this.Xc=Ob;this.fg=Ib;this.eg=Nb;this.sb=new ld;this.Zh=new ld;this.cg=new ld;this.Aa=this.ql=1;this.Yb=0;this.De=al;this.jh=qc;this.qc=(new N(NaN,NaN,NaN,NaN)).freeze();this.xb=(new N(NaN,NaN,NaN,NaN)).freeze();this.rc=(new N(0,0,NaN,NaN)).freeze();this.O=this.xp=this.yp=null;this.$k=this.yb=Vc;this.Jp=0;this.Kp=1;this.Rg=0;this.zn=1;this.aq=null;this.Qp=-Infinity;this.am=
  0;this.bm=Bb;this.cm=ag;this.oi="";this.fb=this.N=null;this.dl=-1;this.em=this.Za=this.ni=this.im=null;this.Os=zg;this.Mp=this.Mg=this.ak=null}var td,zg,Bg,al,bl,cl,dl,el,fl,gl;
  Y.prototype.cloneProtected=function(a){a.F=this.F|6144;a.hb=this.hb;a.oa=this.oa;a.mb=this.mb;a.ec=this.ec;a.Mg=this.Mg;a.la.assign(this.la);a.Xc=this.Xc.H();a.fg=this.fg.H();a.eg=this.eg.H();a.cg=this.cg.copy();a.Aa=this.Aa;a.Yb=this.Yb;a.De=this.De;a.jh=this.jh.H();a.qc.assign(this.qc);a.xb.assign(this.xb);a.rc.assign(this.rc);a.xp=this.xp;null!==this.O&&(a.O=this.O.copy());a.yb=this.yb.H();a.$k=this.$k.H();a.Jp=this.Jp;a.Kp=this.Kp;a.Rg=this.Rg;a.zn=this.zn;a.aq=this.aq;a.Qp=this.Qp;a.am=this.am;
  a.bm=this.bm.H();a.cm=this.cm;a.oi=this.oi;null!==this.N&&(a.N=this.N.copy());a.fb=this.fb;a.dl=this.dl;null!==this.ni&&(a.ni=Ba(this.ni));null!==this.Za&&(a.Za=this.Za.copy());a.em=this.em};Y.prototype.Tx=function(a){var b=this.ni;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.ni=b=[];b.push(a)};Y.prototype.yf=function(a){a.yp=null;a.ak=null;a.s()};
  Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.ni)for(var b=0;b<this.ni.length;b++){var c=this.ni[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.jb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:B("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ja(this.constructor)+"#"+kb(this)};
  function hl(a){null===a.N&&(a.N=new il)}t.Kc=function(){if(null===this.O){var a=new jl;a.bh=sc;a.Ch=sc;a.$g=10;a.Ah=10;a.ah=0;a.Bh=0;this.O=a}};
  t.Va=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.Sk(a,b,c,d,e,f,g),c===this&&a===xe&&kl(this)&&ll(this,h,b),f=this.diagram,null===this.Mg||null===f||!f.pj||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.tn||(a=this.Mg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.Mp&&(this.Mp=new H),g=0===f.undoManager.transactionLevel,a.startCondition===ii?g=!0:a.startCondition===ki&&(g=!1),g?(f=new qh,ji(a,f),g=this.Mp.get(a),
  null!==g&&g.stop(),this.Mp.add(a,f),f.xv=this,f.Ox=a,f.add(this,b,d,e),f.start()):(sh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.F&16777216)&&null!==h.data))for(c=this.W.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&Hj(h,function(a){null!==a.data&&0!==(a.F&16777216)&&a.Ea(b)})};
  function ll(a,b,c){var d=a.ij();if(null!==d)for(var e=a.fb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=ml(f,d,a);if(null===g)continue;f.jr(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.jr(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.jr(a,h,c,d)}g===a&&(h=d.Gt(f.wj),null!==h&&f.Tw(h,g,c))}}t.Gt=function(a){return this.dl===a?this:null};
  t.g=function(a,b,c){this.Va(xe,a,this,b,c)};function nl(a,b,c,d,e){var f=a.qc,g=a.cg;g.reset();ol(a,g,b,c,d,e);a.cg=g;f.h(b,c,d,e);g.Tt()||g.Pw(f)}function pl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Mc(b,d):a.Jh(b,d)}
  t.sy=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Ie(b);return c?xb(a.x,a.y,0,0,0,d.height)<=b||xb(a.x,a.y,0,d.height,d.width,d.height)<=b||xb(a.x,a.y,d.width,d.height,d.width,0)<=b||xb(a.x,a.y,d.width,0,0,0)<=b:a.qd(0,0)<=b&&a.qd(0,d.height)<=b&&a.qd(d.width,0)<=b&&a.qd(d.width,d.height)<=b};t.he=function(){return!0};
  t.$=function(a){var b=J.alloc();b.assign(a);this.transform.ta(b);var c=this.actualBounds;if(!c.o())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.re){var e=d.Bm("extraTouchThreshold"),f=d.Bm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Af()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=cc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),J.free(b),a}e=!1;if(this instanceof Je||this instanceof Kf?cc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.$(b))this.Za&&!this.Za.$(b)?e=
  !1:null!==this.ec&&c.$(b)?e=!0:null!==this.mb&&this.rc.$(a)?e=!0:e=this.Kh(a);J.free(b);return e};t.Kh=function(a){var b=this.naturalBounds;return cc(0,0,b.width,b.height,a.x,a.y)};t.Ge=function(a){if(0===this.angle)return this.actualBounds.Ge(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.$(c.Jd(e))&&(e.h(a.x,a.bottom),b.$(c.Jd(e))&&(e.h(a.right,a.bottom),b.$(c.Jd(e))&&(e.h(a.right,a.y),b.$(c.Jd(e))&&(d=!0))));J.free(e);N.free(b);return d};
  t.Jh=function(a,b){if(void 0===b)return a.Ge(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.$(b.ta(e))&&(e.h(0,c.height),a.$(b.ta(e))&&(e.h(c.width,c.height),a.$(b.ta(e))&&(e.h(c.width,0),a.$(b.ta(e))&&(d=!0))));J.free(e);return d};
  t.Mc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Mc(this.actualBounds);var c=this.naturalBounds,d=J.allocAt(0,0),e=J.allocAt(0,c.height),f=J.allocAt(c.width,c.height),g=J.allocAt(c.width,0),h=!1;if(a.$(b.ta(d))||a.$(b.ta(e))||a.$(b.ta(f))||a.$(b.ta(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.$(b.Jd(k))?h=!0:(k.h(a.x,a.bottom),c.$(b.Jd(k))?h=!0:(k.h(a.right,a.bottom),c.$(b.Jd(k))?h=!0:(k.h(a.right,a.y),c.$(b.Jd(k))&&(h=!0))));J.free(k);N.free(c);
  !h&&(L.Qt(a,d,e)||L.Qt(a,e,f)||L.Qt(a,f,g)||L.Qt(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.da=function(a,b){void 0===b&&(b=new J);if(a instanceof O){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.Fd.ta(b);return b};
  t.mj=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.Fd,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);bc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);bc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);bc(a,d.x,d.y,0,0);J.free(d);return a};t.lj=function(){var a=this.Fd;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
  t.Af=function(){if(0!==(this.F&4096)===!1)return this.ql;var a=this.Aa;return null!==this.panel?a*this.panel.Af():a};t.Mt=function(a,b){void 0===b&&(b=new J);b.assign(a);this.Fd.Jd(b);return b};t.Nt=function(a,b,c){return this.zk(a.x,a.y,b.x,b.y,c)};
  t.zk=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,L.Cf(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=L.Cf(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!==uj(this)){var e=this.jh,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 Kf&&(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(ql(this,!0)){case zg:g=e=0;h&&(b=a=Infinity);
  break;case td:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case bl:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case cl:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
  b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.qc.ea();this.Hm(a,b,c,d);this.qc.freeze();this.qc.o()||B("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.qc.toString());pj(this,!1)}};Y.prototype.Hm=function(){};Y.prototype.Ff=function(){return!1};
  Y.prototype.arrange=function(a,b,c,d,e){this.Fl();var f=N.alloc();f.assign(this.xb);this.xb.ea();!1===vj(this)?this.xb.h(a,b,c,d):this.Ih(a,b,c,d);this.xb.freeze();void 0===e?this.Za=null:this.Za=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.rc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.xb),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Wg&&(a=this.naturalBounds,
  this.us>a.height||this.vb>a.width)))c=!0;this.F=c?this.F|256:this.F&-257;this.xb.o()||B("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.xb.toString());this.Im(f,this.xb);rl(this,!1);N.free(f)};t=Y.prototype;t.Ih=function(){};
  function sl(a,b,c,d,e){a.xb.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.qc;c=a.jh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=ql(a,!0);c===d&&f===e&&(b=zg);switch(b){case zg:if(c>d||f>e)pj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case td:pj(a,!0);a.measure(d,e,0,0);break;case bl:pj(a,!0);a.measure(d,f,0,0);break;case cl:pj(a,!0),a.measure(c,e,0,0)}}}
  t.Im=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||tl(c,!0),this.M(),Vb(a,b)||(c.Oh(),this.mp(c)))};t.mp=function(a){null!==this.portId&&(tl(a,!0),a instanceof W&&ul(a,this))};
  t.mc=function(a,b){if(this.visible){var c=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),d=this.xb;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.ly(a,b))if(c)vl(this,a,b);else{this instanceof S&&this.Gk(!1);c=this.transform;var g=this.panel;0!==(this.F&4096)===!0&&wl(this);var h=this.part,k=!1,l=0;if(h&&b.Ke("drawShadows")&&(k=h.isShadowed)){var m=h.shadowOffset;l=Math.max(m.y,
  m.x)*b.scale*b.Tb}if(!(m=b.yi||!this.Ff())){var n=this.naturalBounds;m=this.Zh;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,w=m.m22,v=m.dy,y,z=y=0;m=y*p+z*r+q;var A=y*u+z*w+v;y=n.width+l;z=0;var C=y*p+z*r+q;y=y*u+z*w+v;z=Math.min(m,C);var F=Math.min(A,y);var Q=Math.max(m+0,C)-z;var K=Math.max(A+0,y)-F;m=z;A=F;y=n.width+l;z=n.height+l;C=y*p+z*r+q;y=y*u+z*w+v;z=Math.min(m,C);F=Math.min(A,y);Q=Math.max(m+Q,C)-z;K=Math.max(A+K,y)-F;m=z;A=F;y=0;z=n.height+l;C=y*p+z*r+q;y=y*u+z*w+v;z=Math.min(m,C);F=Math.min(A,y);
  Q=Math.max(m+Q,C)-z;K=Math.max(A+K,y)-F;m=z;A=F;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>Q+m||A>l.height+p||p>K+A)}if(m){m=0!==(this.F&256);a.clipInsteadOfFill&&(m=!1);this instanceof Wg&&(a.font=this.font);if(m){A=g.he()?g.naturalBounds:g.actualBounds;null!==this.Za?(n=this.Za,Q=n.x,K=n.y,l=n.width,n=n.height):(Q=Math.max(d.x,A.x),K=Math.max(d.y,A.y),l=Math.min(d.right,A.right)-Q,n=Math.min(d.bottom,A.bottom)-K);if(Q>d.width+d.x||d.x>A.width+A.x){1!==e&&(a.globalAlpha=f);return}a.save();
  a.beginPath();a.rect(Q,K,l,n);a.clip()}if(this.Ff()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(A=h.shadowOffset,a.Iw(A.x*b.scale*b.Tb,A.y*b.scale*b.Tb,h.shadowBlur),xl(a),a.shadowColor=h.shadowColor)}k&&!0===this.shadowVisible?xl(a):k&&!1===this.shadowVisible&&yl(a);h=this.naturalBounds;null!==this.ec&&(oi(this,a,this.ec,!0,!0,h,d),this.ec instanceof zl&&this.ec.type===Al?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Je(this.ec)):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.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.tb()!==this)&&null===this.shadowVisible&&yl(a);null!==this.mb&&(l=this.naturalBounds,Q=A=0,K=l.width,l=l.height,n=0,this instanceof Kf&&(l=this.na.bounds,A=l.x,Q=l.y,K=l.width,l=l.height,n=this.strokeWidth),oi(this,a,this.mb,!0,!1,h,d),this.mb instanceof zl&&this.mb.type===Al?(a.beginPath(),a.rect(A-n/2,Q-n/2,K+n,l+n),a.Je(this.mb)):a.fillRect(A-n/2,Q-n/2,K+n,l+n));k&&(null!==this.mb||null!==
  this.ec||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.tb()!==this)?(Bl(this,!0),null===this.shadowVisible&&yl(a)):Bl(this,!1);this.ej(a,b);k&&0!==(this.F&512)===!0&&xl(a);this.Ff()&&k&&yl(a);m?(a.restore(),this instanceof X?a.uc(!0):a.uc(!1)):c.Tt()||(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.ly=function(){return!1};
  function vl(a,b,c){var d=a.xb,e=a.rc;null!==a.ec&&(oi(a,b,a.ec,!0,!0,e,d),a.ec instanceof zl&&a.ec.type===Al?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Je(a.ec)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.mb&&(oi(a,b,a.mb,!0,!1,e,d),a.mb instanceof zl&&a.mb.type===Al?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Je(a.mb)):b.fillRect(d.x,d.y,d.width,d.height));a.ej(b,c)}t.ej=function(){};
  function oi(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===Cl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof Kf&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof Dl)&&c.ke&&(c.type===El||c.gl===h&&c.Au===k))var m=c.ke;else{var n=0,p=0,r=0,q=0,u=0,w=0;w=u=0;e?(u=g.x,w=g.y):d||(u-=l/2,w-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
  c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=w;q+=w;if(c.type===Fl)m=b.createLinearGradient(n,p,r,q);else if(c.type===Al)w=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,w=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,w);else if(c.type===El)try{m=b.createPattern(c.pattern,"repeat")}catch(y){m=null}if(c.type!==El&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.ke=m,null!==m&&(c.gl=h,c.Au=k),null===
  m&&c.type===El&&-1!==c.gl)){c.gl=-1;var v=a.diagram;null!==v&&-1===c.gl&&ta(function(){v.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Gg=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.Gf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Gf():!0};t.Hg=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
  function wl(a){if(0!==(a.F&2048)===!0){var b=a.sb;b.reset();if(!a.xb.o()||!a.qc.o()){Gl(a,!1);return}b.translate(a.xb.x-a.qc.x,a.xb.y-a.qc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;ol(a,b,c.x,c.y,c.width,c.height)}Gl(a,!1);Hl(a,!0)}0!==(a.F&4096)===!0&&(b=a.panel,null===b?(a.Zh.set(a.sb),a.ql=a.scale,Hl(a,!1)):null!==b.Fd&&(c=a.Zh,c.reset(),b.he()?c.multiply(b.Zh):null!==b.panel&&c.multiply(b.panel.Zh),c.multiply(a.sb),a.ql=a.scale*b.ql,Hl(a,!1)))}
  function ol(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.Yb){var g=zc;a.Ff()&&a.locationSpot.kb()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof V&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.Uk(d.x,d.y,d.width,d.height,g),c.cg.ta(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.cg.ta(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.Uk(c,d,e,f,g);b.rotate(a.Yb,h.x,h.y);J.free(h)}}
  t.s=function(a){if(!uj(this)){void 0===a&&(a=!1);pj(this,!0);rl(this,!0);var b=this.panel;null===b||a||b.s()}};t.Bk=function(){uj(this)||(pj(this,!0),rl(this,!0))};function Il(a){if(!vj(a)){var b=a.panel;null!==b?b.s():a.Ff()&&(b=a.diagram,null!==b&&(b.wd.add(a),a instanceof W&&a.sd(),b.Db()));rl(a,!0)}}t.Fl=function(){0!==(this.F&2048)===!1&&(Gl(this,!0),Hl(this,!0))};t.dw=function(){Hl(this,!0)};t.M=function(){var a=this.part;null!==a&&a.M()};
  function ql(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return Jl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.tb()===a)return Kl(a,td,b);if(c===al){if(null!==d){if(d.type===X.Spot&&d.tb()===a)return Kl(a,td,b);c=d.defaultStretch;return c===al?Kl(a,zg,b):Kl(a,c,b)}return Kl(a,zg,b)}return Kl(a,c,b)}
  function Jl(a,b,c,d){var e=a.stretch;if(e!==al)return Kl(a,e,d);var f=e=null;switch(b.stretch){case cl:f=!0;break;case td:f=!0}switch(c.stretch){case bl:e=!0;break;case td:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===bl||b===td);null===f&&(f=b===cl||b===td);return!0===e&&!0===f?Kl(a,td,d):!0===e?Kl(a,bl,d):!0===f?Kl(a,cl,d):Kl(a,zg,d)}
  function Kl(a,b,c){if(c)return b;if(b===zg)return zg;c=a.desiredSize;if(c.o())return zg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===bl)return zg;if(b===td)return cl}else{if(b===cl)return zg;if(b===td)return bl}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===cl)return zg;if(b===td)return bl}else{if(b===bl)return zg;if(b===td)return cl}return b}function Bl(a,b){a.F=b?a.F|512:a.F&-513}function kl(a){return 0!==(a.F&1024)}function Ll(a,b){a.F=b?a.F|1024:a.F&-1025}
  function Gl(a,b){a.F=b?a.F|2048:a.F&-2049}function Hl(a,b){a.F=b?a.F|4096:a.F&-4097}function uj(a){return 0!==(a.F&8192)}function pj(a,b){a.F=b?a.F|8192:a.F&-8193}function vj(a){return 0!==(a.F&16384)}function rl(a,b){a.F=b?a.F|16384:a.F&-16385}t.sj=function(a){this.og=a};t.lu=function(){};t.Ew=function(a){this.la.assign(a);Il(this);return!0};t.er=function(a,b){if(this.la.x!==a||this.la.y!==b)this.la.h(a,b),this.Fl()};
  function Ml(a){var b=a.part;if(b instanceof W&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ul(b,a)}}function Nl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof W?a.sd():a.an(a,function(a){Ml(a)}):Ml(a))}t.bind=function(a){a.pd=this;var b=this.ij();null!==b&&Ol(b)&&B("Cannot add a Binding to a template that has already been copied: "+a);null===this.fb&&(this.fb=new E);this.fb.add(a)};
  t.ij=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.li)return a;a=a.panel}return null};t.Fw=function(a){Bj(this,a)};t.Qw=function(a){a.pd=this;null===this.Mg&&(this.Mg=new H);this.Mg.add(a.propertyName,a)};
  function Pl(a,b){for(var c=1;c<arguments.length;++c);c=arguments;var d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=Ql.G(a);"function"===typeof f?(c=Ba(arguments),d=f(c),za(d)||B('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=x.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||B("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof R&&1<c.length){f=
  d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Di(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?B("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Rl(d,f);return d}
  function Rl(a,b){if("string"===typeof b)if(a instanceof Wg)a.text=b;else if(a instanceof Kf)a.figure=b;else if(a instanceof dk)a.source=b;else if(a instanceof X)b=Sl.G(b),null!==b&&(a.type=b);else if(a instanceof zl){var c=Ya(zl,b);null!==c?a.type=c:B("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof rd?(b=Ya(rd,b),null!==b&&(a.type=b)):a instanceof ke&&(b=Ya(ke,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||B("A GraphObject can only be added to a Panel, not to: "+
  a),a.add(b);else if(b instanceof Vj){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof Vj?d.gy(b):B("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.jb&&a.jb(b);else if(b instanceof Tl)a.type=b;else if(b instanceof Ii)a instanceof Y?a.bind(b):a instanceof
  Vj?a.bind(b):B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof gi)a instanceof Y?a.Qw(b):B("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof je)a instanceof rd?a.figures.add(b):B("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof ke)a instanceof je?a.segments.add(b):B("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Bi)a instanceof R?
  a.layout=b:a instanceof U?a.layout=b:B("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)Rl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof zl){c=new $a;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Bj(a,c)}else if(a instanceof Vj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&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 $a;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Bj(a,e)}else Bj(a,b);else B('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Ul(a,b){Ql.add(a,b)}
  function Vl(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}
  na.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.em},set:function(a){var b=this.em;b!==a&&(this.em=a,this.M(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.N?this.N.Wn:null},set:function(a){hl(this);var b=this.N.Wn;b!==a&&(this.N.Wn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.cm},set:function(a){var b=this.cm;
  b!==a&&(this.cm=a,this.s(),this.g("segmentOrientation",b,a),a===ag&&(this.angle=0))}},segmentIndex:{get:function(){return this.Qp},set:function(a){a=Math.round(a);var b=this.Qp;b!==a&&(this.Qp=a,this.s(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.am},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.am;b!==a&&(this.am=a,this.s(),this.g("segmentFraction",b,a))}},segmentOffset:{
  get:function(){return this.bm},set:function(a){var b=this.bm;b.w(a)||(this.bm=a=a.H(),this.s(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.De},set:function(a){var b=this.De;b!==a&&(this.De=a,this.s(),this.g("stretch",b,a))}},name:{get:function(){return this.oa},set:function(a){var b=this.oa;b!==a&&(this.oa=a,null!==this.part&&(this.part.Xj=null),this.g("name",b,a))}},opacity:{get:function(){return this.hb},
  set:function(a){var b=this.hb;b!==a&&((0>a||1<a)&&wa(a,"0 <= value <= 1",Y,"opacity"),this.hb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.M(Fj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(this.F^=1,this.g("visible",b,a),b=this.panel,null!==b?b.s():this.Ff()&&this.Ob(a),this.M(),Nl(this))}},pickable:{get:function(){return 0!==(this.F&2)},set:function(a){var b=
  0!==(this.F&2);b!==a&&(this.F^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(this.F^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(this.F^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
  (this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(this.F^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(this.F^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);b!==a&&(this.F^=64,this.s(),this.g("isPanelMain",b,a))}},isActionable:{
  get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(this.F^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.ec},set:function(a){var b=this.ec;b!==a&&(null!==a&&Wl(a,"GraphObject.areaBackground"),a instanceof zl&&a.freeze(),this.ec=a,this.M(),this.g("areaBackground",b,a))}},background:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&(null!==a&&Wl(a,"GraphObject.background"),
  a instanceof zl&&a.freeze(),this.mb=a,this.M(),this.g("background",b,a))}},part:{get:function(){if(this.Ff())return this;if(null!==this.ak)return this.ak;var a;for(a=this.panel;a;){if(a instanceof V)return this.ak=a;a=a.panel}return null}},svg:{get:function(){return this.gq},set:function(a){this.gq=a}},panel:{get:function(){return this.og}},layer:{get:function(){var a=this.part;
  return null!==a?a.layer:null}},diagram:{get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{get:function(){return this.la},set:function(a){var b=a.x,c=a.y,d=this.la,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.lu():(a=a.copy(),this.Ew(a,d)&&this.g("position",d.copy(),a.copy()))}},actualBounds:{get:function(){return this.xb}},scale:{
  get:function(){return this.Aa},set:function(a){var b=this.Aa;b!==a&&(0>=a&&B("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Aa=a,this.s(),this.g("scale",b,a))}},angle:{get:function(){return this.Yb},set:function(a){var b=this.Yb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.Yb=a,Nl(this),this.s(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Xc},set:function(a){var b=a.width,c=a.height,d=this.Xc,e=
  d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Xc=a=a.H(),this.s(),this instanceof Kf&&this.dc(),this.g("desiredSize",d,a),kl(this)&&(a=this.part,null!==a&&(ll(this,a,"width"),ll(this,a,"height"))))}},width:{get:function(){return this.Xc.width},set:function(a){var b=this.Xc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Xc,this.Xc=a=(new M(a,this.Xc.height)).freeze(),this.s(),this instanceof Kf&&this.dc(),this.g("desiredSize",b,a),kl(this)&&
  (a=this.part,null!==a&&ll(this,a,"width")))}},height:{get:function(){return this.Xc.height},set:function(a){var b=this.Xc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Xc,this.Xc=a=(new M(this.Xc.width,a)).freeze(),this.s(),this instanceof Kf&&this.dc(),this.g("desiredSize",b,a),kl(this)&&(a=this.part,null!==a&&ll(this,a,"height")))}},minSize:{get:function(){return this.fg},set:function(a){var b=this.fg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=
  0),isNaN(a.height)&&(a.height=0),a.freeze(),this.fg=a,this.s(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.eg},set:function(a){var b=this.eg;b.w(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.eg=a,this.s(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.qc}},naturalBounds:{get:function(){return this.rc}},margin:{
  get:function(){return this.jh},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.jh;b.w(a)||(this.jh=a=a.H(),this.s(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.F&2048)===!0&&wl(this);return this.sb}},Fd:{get:function(){0!==(this.F&4096)===!0&&wl(this);return this.Zh}},alignment:{get:function(){return this.yb},set:function(a){var b=this.yb;b.w(a)||(a.nc()&&!a.Mb()&&
  B("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.yb=a=a.H(),Il(this),this.g("alignment",b,a))}},column:{get:function(){return this.Rg},set:function(a){a=Math.round(a);var b=this.Rg;b!==a&&(0>a&&wa(a,">= 0",Y,"column"),this.Rg=a,this.s(),this.g("column",b,a))}},columnSpan:{get:function(){return this.zn},set:function(a){a=Math.round(a);var b=this.zn;b!==a&&(1>a&&wa(a,">= 1",Y,"columnSpan"),this.zn=a,
  this.s(),this.g("columnSpan",b,a))}},row:{get:function(){return this.Jp},set:function(a){a=Math.round(a);var b=this.Jp;b!==a&&(0>a&&wa(a,">= 0",Y,"row"),this.Jp=a,this.s(),this.g("row",b,a))}},rowSpan:{get:function(){return this.Kp},set:function(a){a=Math.round(a);var b=this.Kp;b!==a&&(1>a&&wa(a,">= 1",Y,"rowSpan"),this.Kp=a,this.s(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.aq},set:function(a){var b=
  this.aq;b!==a&&(this.aq=a,this.s(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.$k},set:function(a){var b=this.$k;b.w(a)||(this.$k=a=a.H(),this.s(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.xp},set:function(a){var b=this.xp;if(b!==a){var c=this.part;null===c||c instanceof W||(B("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&Xl(c,this);this.xp=a;null!==a&&null!==c&&(c.Nh=
  !0,Yl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.O?this.O.Ch:sc},set:function(a){this.Kc();var b=this.O.Ch;b.w(a)||(a=a.H(),this.O.Ch=a,this.g("toSpot",b,a),Ml(this))}},toEndSegmentLength:{get:function(){return null!==this.O?this.O.Ah:10},set:function(a){this.Kc();var b=this.O.Ah;b!==a&&(0>a&&wa(a,">= 0",Y,"toEndSegmentLength"),this.O.Ah=a,this.g("toEndSegmentLength",b,a),Ml(this))}},toShortLength:{
  get:function(){return null!==this.O?this.O.Bh:0},set:function(a){this.Kc();var b=this.O.Bh;b!==a&&(this.O.Bh=a,this.g("toShortLength",b,a),Ml(this))}},toLinkable:{get:function(){return null!==this.O?this.O.kq:null},set:function(a){this.Kc();var b=this.O.kq;b!==a&&(this.O.kq=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.O?this.O.lq:Infinity},set:function(a){this.Kc();var b=this.O.lq;b!==a&&(0>a&&
  wa(a,">= 0",Y,"toMaxLinks"),this.O.lq=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.O?this.O.bh:sc},set:function(a){this.Kc();var b=this.O.bh;b.w(a)||(a=a.H(),this.O.bh=a,this.g("fromSpot",b,a),Ml(this))}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.$g:10},set:function(a){this.Kc();var b=this.O.$g;b!==a&&(0>a&&wa(a,">= 0",Y,"fromEndSegmentLength"),this.O.$g=a,this.g("fromEndSegmentLength",
  b,a),Ml(this))}},fromShortLength:{get:function(){return null!==this.O?this.O.ah:0},set:function(a){this.Kc();var b=this.O.ah;b!==a&&(this.O.ah=a,this.g("fromShortLength",b,a),Ml(this))}},fromLinkable:{get:function(){return null!==this.O?this.O.co:null},set:function(a){this.Kc();var b=this.O.co;b!==a&&(this.O.co=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.O?this.O.eo:Infinity},
  set:function(a){this.Kc();var b=this.O.eo;b!==a&&(0>a&&wa(a,">= 0",Y,"fromMaxLinks"),this.O.eo=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(this.oi=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.N?this.N.Pf:null},set:function(a){hl(this);var b=this.N.Pf;b!==a&&(this.N.Pf=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==
  this.N?this.N.Uf:null},set:function(a){hl(this);var b=this.N.Uf;b!==a&&(this.N.Uf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==this.N?this.N.Qf:null},set:function(a){hl(this);var b=this.N.Qf;b!==a&&(this.N.Qf=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.N?this.N.hg:null},set:function(a){hl(this);var b=this.N.hg;b!==a&&(this.N.hg=a,this.g("mouseEnter",b,a))}},mouseLeave:{
  get:function(){return null!==this.N?this.N.kg:null},set:function(a){hl(this);var b=this.N.kg;b!==a&&(this.N.kg=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.N?this.N.lg:null},set:function(a){hl(this);var b=this.N.lg;b!==a&&(this.N.lg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.N?this.N.jg:null},set:function(a){hl(this);var b=this.N.jg;b!==a&&(this.N.jg=a,this.g("mouseHover",
  b,a))}},mouseHold:{get:function(){return null!==this.N?this.N.ig:null},set:function(a){hl(this);var b=this.N.ig;b!==a&&(this.N.ig=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.N?this.N.$o:null},set:function(a){hl(this);var b=this.N.$o;b!==a&&(this.N.$o=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.N?this.N.ap:null},set:function(a){hl(this);
  var b=this.N.ap;b!==a&&(this.N.ap=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.N?this.N.gg:null},set:function(a){hl(this);var b=this.N.gg;b!==a&&(this.N.gg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.N?this.N.gn:null},set:function(a){hl(this);var b=this.N.gn;b!==a&&(this.N.gn=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==
  this.N?this.N.hn:null},set:function(a){hl(this);var b=this.N.hn;b!==a&&(this.N.hn=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.N?this.N.jn:null},set:function(a){hl(this);var b=this.N.jn;b!==a&&(this.N.jn=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.N?this.N.fn:null},set:function(a){hl(this);var b=this.N.fn;b!==a&&(this.N.fn=a,this.g("actionCancel",b,a))}},toolTip:{
  get:function(){return null!==this.N?this.N.wg:null},set:function(a){hl(this);var b=this.N.wg;b!==a&&(this.N.wg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.N?this.N.Rf:null},set:function(a){hl(this);var b=this.N.Rf;b!==a&&(this.N.Rf=a,this.g("contextMenu",b,a))}}});Y.prototype.trigger=Y.prototype.Qw;Y.prototype.setProperties=Y.prototype.Fw;Y.prototype.findTemplateBinder=Y.prototype.ij;Y.prototype.bind=Y.prototype.bind;
  Y.prototype.isEnabledObject=Y.prototype.Hg;Y.prototype.isVisibleObject=Y.prototype.Gf;Y.prototype.isContainedBy=Y.prototype.Gg;Y.prototype.getNearestIntersectionPoint=Y.prototype.Nt;Y.prototype.getLocalPoint=Y.prototype.Mt;Y.prototype.getDocumentScale=Y.prototype.Af;Y.prototype.getDocumentAngle=Y.prototype.lj;Y.prototype.getDocumentBounds=Y.prototype.mj;Y.prototype.getDocumentPoint=Y.prototype.da;Y.prototype.intersectsRect=Y.prototype.Mc;Y.prototype.containedInRect=Y.prototype.Jh;
  Y.prototype.containsRect=Y.prototype.Ge;Y.prototype.containsPoint=Y.prototype.$;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.Va;Y.prototype.addCopyProperty=Y.prototype.Tx;var Ql=null;Y.className="GraphObject";Ql=new H;
  Ul("Button",function(){function a(a,b){return null!==a.diagram.Vb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Pl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.bb("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"},Pl(Kf,{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.Hg()&&b instanceof X&&(a=b.bb("ButtonBorder"),a instanceof Kf)){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.Hg()&&b instanceof X&&(a=b.bb("ButtonBorder"),a instanceof Kf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Hg()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.bb("ButtonBorder");if(c instanceof Kf){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.Hg()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.bb("ButtonBorder");if(c instanceof Kf){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.Hg()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.bb("ButtonBorder");if(c instanceof Kf){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.Hg()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.bb("ButtonBorder"),b instanceof Kf))){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});
  Ul("TreeExpanderButton",function(){var a=Pl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Pl(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Lb},(new Ii("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Uq()),{visible:!1},(new Ii("visible","isTreeLeaf",function(a){return!a})).Uq());a.click=function(a,c){c=c.part;c instanceof Je&&(c=c.adornedPart);if(c instanceof W){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});
  Ul("SubGraphExpanderButton",function(){var a=Pl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Pl(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Lb},(new Ii("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Uq()));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});Ul("ToolTip",function(){return Pl(Je,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Pl(Kf,{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)}))});
  Ul("ContextMenu",function(){return Pl(Je,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new Ii("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Ul("ContextMenuButton",function(){var a=Pl("Button");a.stretch=bl;var b=a.bb("ButtonBorder");b instanceof Kf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new O(0,0,2,3),b.spot2=new O(1,1,-2,-2));return a});
  Ul("PanelExpanderButton",function(a){var b=Vl(a,"COLLAPSIBLE"),c=Pl("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},Pl(Kf,{name:"ButtonIcon",strokeWidth:2},(new Ii("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Uq(b)));
  a=c.bb("ButtonBorder");a instanceof Kf&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.ij();null===e&&(e=c.part);null!==e&&(c=e.bb(b),null!==c&&(a.handled=!0,d.xa("Collapse/Expand Panel"),c.visible=!c.visible,d.Xa("Collapse/Expand Panel")))}};return c});
  Ul("CheckBoxButton",function(a){var b=Vl(a);a=Pl("Button",{desiredSize:new M(14,14)},Pl(Kf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:td,geometryStretch:Bg,visible:!1},""!==b?(new Ii("visible",b)).Iy():[]));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.bb("ButtonIcon");c.xa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
  d);c.Xa("checkbox")}}};return a});
  Ul("CheckBox",function(a){a=Vl(a);a=Pl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new kc(0,1,0,0)});var b=Pl(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=zg=new D(Y,"None",0);Y.Default=al=new D(Y,"Default",0);Y.Vertical=cl=new D(Y,"Vertical",4);Y.Horizontal=bl=new D(Y,"Horizontal",5);Y.Fill=td=new D(Y,"Fill",3);Y.Uniform=Bg=new D(Y,"Uniform",1);
  Y.UniformToFill=dl=new D(Y,"UniformToFill",2);Y.FlipVertical=el=new D(Y,"FlipVertical",1);Y.FlipHorizontal=fl=new D(Y,"FlipHorizontal",2);Y.FlipBoth=gl=new D(Y,"FlipBoth",3);Y.make=Pl;Y.getBuilders=function(){var a=new H,b;for(b in Ql)if(b!==b.toLowerCase()){var c=Ql.G(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Ul;Y.takeBuilderArgument=Vl;
  function il(){this.Wn=this.Rf=this.wg=this.fn=this.jn=this.hn=this.gn=this.gg=this.ap=this.$o=this.ig=this.jg=this.lg=this.kg=this.hg=this.Qf=this.Uf=this.Pf=null}il.prototype.copy=function(){var a=new il;a.Pf=this.Pf;a.Uf=this.Uf;a.Qf=this.Qf;a.hg=this.hg;a.kg=this.kg;a.lg=this.lg;a.jg=this.jg;a.ig=this.ig;a.$o=this.$o;a.ap=this.ap;a.gg=this.gg;a.gn=this.gn;a.hn=this.hn;a.jn=this.jn;a.fn=this.fn;a.wg=this.wg;a.Rf=this.Rf;a.Wn=this.Wn;return a};il.className="GraphObjectEventHandlers";
  function Zl(){this.Oa=[1,0,0,1,0,0]}Zl.prototype.copy=function(){var a=new Zl;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};Zl.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};Zl.prototype.scale=function(a,b){this.Oa[0]*=a;this.Oa[1]*=a;this.Oa[2]*=b;this.Oa[3]*=b};Zl.className="STransform";
  function $l(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.ay=[];this.pattern=null}$l.prototype.addColorStop=function(a,b){this.ay.push({offset:a,color:b})};$l.className="SGradient";
  function Ej(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.LA="http://www.w3.org/2000/svg";void 0!==a&&(this.Ja=this.Pb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ja.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ja.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Dq=null;this.context=new am(this)}
  Ej.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.Ja.setAttributeNS(null,"width",c+"px"),this.Ja.setAttributeNS(null,"height",d+"px"),this.Ja.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Bx.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Bx.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
  Ej.prototype.Pb=function(a,b,c){a=this.ownerDocument.createElementNS(this.LA,a);if(za(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};Ej.prototype.getBoundingClientRect=function(){return this.Ja.getBoundingClientRect()};Ej.prototype.focus=function(){this.Ja.focus()};Ej.prototype.ky=function(){this.ownerDocument=null};
  na.Object.defineProperties(Ej.prototype,{width:{get:function(){return this.Ja.width.baseVal.value},set:function(a){this.Ja.width=a}},height:{get:function(){return this.Ja.height.baseVal.value},set:function(a){this.Ja.height=a}},style:{get:function(){return this.Ja.style}}});Ej.className="SVGSurface";
  function am(a){this.nu=a;this.svg=a.Ja;this.stack=[];this.gd=[];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.ug=this.ft=this.et=0;this.Wt=null;this.path=[];this.Vu=!1;this.uh=null;this.vh=0;this.He=new Zl;
  bm(this,1,0,0,1,0,0);var b=ob++,c=this.Pb("clipPath",{id:"mainClip"+b});c.appendChild(this.Pb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Bx=c;this.nu.Ja.appendChild(c);this.gd[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.NA={}}t=am.prototype;
  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-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(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<d&&this.path.push(["A",c,c,0,+(d>=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.He)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new $l("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.NA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+ob++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Pb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Pb(Gk,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
  t.createRadialGradient=function(a,b,c,d,e,f){var g=new $l("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;a={x:0,y:0,width:m||d,height:n||e,href:l};L.aa(d,h)&&L.aa(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
  "xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+ob++,g=this.Pb("clipPath",{id:f}),g.appendChild(this.Pb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";cm(this,Gk,a,this.He,l);this.addElement(Gk,a)};t.fill=function(){this.addPath("fill",this.path,this.He)};
  t.Je=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]};cm(this,"fill",a,this.He);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};cm(this,"fill",b,this.He);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.He=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;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.He.copy())};
  t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||bm(this,a,b,c,d,e,f)};t.scale=function(a,b){this.He.scale(a,b)};t.translate=function(a,b){this.He.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.He)};t.vj=function(){this.clipInsteadOfFill||this.stroke()};t.Pb=function(a,b,c){return this.nu.Pb(a,b,c)};
  t.addElement=function(a,b,c){a=this.Pb(a,b,c);0<this.gd.length?this.gd[this.gd.length-1].appendChild(a):this.svg.appendChild(a);return this.Wt=a};
  function cm(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof $l?c.fill=dm(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof $l?c.stroke=dm(a,a.strokeStyle):/^rgba\(/.test(a.strokeStyle)?(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
  c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]):c.stroke=a.strokeStyle,c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);d=d.Oa;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
  function dm(a,b){var c="GRAD"+ob++;if("linear"===b.type)var d=a.Pb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Pb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.ay;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
  h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.Pb("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
  t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ba(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};"stroke"===a&&this.Vu&&(b["stroke-dasharray"]=this.uh.toString(),b["stroke-dashoffset"]=this.vh);cm(this,a,b,c);"clipPath"===a?(a="CLIP"+ob++,c=this.Pb("clipPath",{id:a}),c.appendChild(this.Pb("path",b)),this.svg.appendChild(c),
  0<this.gd.length&&this.gd[this.gd.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function bm(a,b,c,d,e,f,g){var h=new Zl;h.Oa=[b,c,d,e,f,g];b={};cm(a,"g",b,h);h=a.addElement("g",b);a.gd.push(h)}
  t.Ym=function(a){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var b="SHADOW"+ob++,c=this.addElement("filter",{id:b,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var d=a.computePixelRatio();a=this.Pb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",stdDeviation:this.shadowBlur/2/d});var e=this.Pb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var f=this.Pb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});d=this.Pb("feOffset",
  {"in":"comp",result:"offsetBlur",dx:this.shadowOffsetX/d,dy:this.shadowOffsetY/d});var g=this.Pb("feMerge",{});g.appendChild(this.Pb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Pb("feMergeNode",{"in":"SourceGraphic"}));c.appendChild(a);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(g);0<this.gd.length&&this.gd[this.gd.length-1].setAttributeNS(null,"filter","url(#"+b+")")}};t.Iw=function(a,b,c){this.et=a;this.ft=b;this.ug=c};
  function yl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}function xl(a){a.shadowOffsetX=a.et;a.shadowOffsetY=a.ft;a.shadowBlur=a.ug}t.Ft=function(a,b){this.Vu=!0;this.uh=a;this.vh=b};t.Dt=function(){this.Vu=!1};t.uc=function(){};t.Sy=function(){};am.prototype.rotate=function(){};am.prototype.getImageData=function(){return null};am.prototype.measureText=function(){return null};am.className="SVGContext";
  R.prototype.$t=function(a){var b=new Ej(this,x.document);void 0===a&&(a=new $a);var c=this;return Ek(this,function(a,e){a=Fk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};R.prototype.makeSvg=R.prototype.$t;R.prototype.iw=function(a){return this.$t(a)};R.prototype.makeSVG=R.prototype.iw;
  Y.prototype.ly=function(a,b){if(!(a instanceof am))return!1;if(!this.visible)return!0;var c=null,d=a.Wt;if(this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn))return vl(this,a,b),!0;var e=this.xb;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.F&4096)===!0&&wl(this);var h=0!==(this.F&256);a.clipInsteadOfFill&&(h=!1);var k=!1;this instanceof Wg&&(a.font=this.font);if(h){k=g.he()?g.naturalBounds:g.actualBounds;if(null!==this.Za){var l=
  this.Za;var m=l.x;var n=l.y;var p=l.width;l=l.height}else m=Math.max(e.x,k.x),n=Math.max(e.y,k.y),p=Math.min(e.right,k.right)-m,l=Math.min(e.bottom,k.bottom)-n;if(m>e.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;bm(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Ff()&&!this.isVisible())return!0;a.He.Oa=[1,0,0,1,0,0];(this instanceof Wg&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)&&bm(a,1,0,0,1,0,0);m=!1;this.Ff()&&this.isShadowed&&
  b.Ke("drawShadows")&&(n=this.shadowOffset,a.Iw(n.x*b.scale*b.Tb,n.y*b.scale*b.Tb,this.shadowBlur),xl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ke("drawShadows")&&(n=this.part.isShadowed);a.clipInsteadOfFill&&(n=!1);!0===this.shadowVisible?(xl(a),!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Ym(b),m=!0)):!1===this.shadowVisible&&yl(a);p=this.naturalBounds;null!==this.areaBackground&&(oi(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Ym(b),m=!0),this.areaBackground instanceof zl&&
  this.areaBackground.type===Al?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Je(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof X?bm(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):(a.He.Oa=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy],!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Ym(b),m=!0));if(null!==this.background){!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Ym(b),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof Kf&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,
  u=this.strokeWidth);oi(this,a,this.background,!0,!1,p,e);this.background instanceof zl&&this.background.type===Al?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.Je(this.background)):a.fillRect(f-u/2,l-u/2,q+u,r+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.F&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.tb()!==this)?(Bl(this,!0),null===this.shadowVisible&&yl(a)):Bl(this,!1);this.ej(a,b);n&&0!==(this.F&512)===!0&&xl(a);this.Ff()&&n&&yl(a);h&&(a.restore(),k&&a.gd.pop());
  this instanceof X&&(c=a.gd.pop());!0===m&&a.gd.pop();if(this instanceof Wg&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)c=a.gd.pop();null!==a.nu.Dq&&(null===c&&(d===a.Wt?(bm(a,1,0,0,1,0,0),c=a.gd.pop()):c=a.Wt),a.nu.Dq(this,c));this.svg=c;return!0};
  function Hk(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.Dq=null;b=b.createElement("canvas");b.tabIndex=0;this.Ja=b;this.Ja.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Dl(b);b.B=a}Hk.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.width=a,this.height=b,this.style.width=c+"px",this.style.height=d+"px",!0):!1};Hk.prototype.toDataURL=function(a,b){return this.Ja.toDataURL(a,b)};
  Hk.prototype.getBoundingClientRect=function(){return this.Ja.getBoundingClientRect()};Hk.prototype.focus=function(){this.Ja.focus()};Hk.prototype.ky=function(){this.ownerDocument=this.Ja.B=null};na.Object.defineProperties(Hk.prototype,{width:{get:function(){return this.Ja.width},set:function(a){this.Ja.width=a}},height:{get:function(){return this.Ja.height},set:function(a){this.Ja.height=a}},style:{get:function(){return this.Ja.style}}});
  Hk.className="CanvasSurface";function Dl(a){a.getContext&&a.getContext("2d")||B("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.xu=this.zu=this.yu="";this.yn=!1;this.ug=this.ft=this.et=0}t=Dl.prototype;t.Sy=function(a){this.Y.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.Y.arc(a,b,c,d,e,f)};t.beginPath=function(){this.Y.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.Y.bezierCurveTo(a,b,c,d,e,f)};
  t.clearRect=function(a,b,c,d){this.Y.clearRect(a,b,c,d)};t.clip=function(){this.Y.clip()};t.closePath=function(){this.Y.closePath()};t.createLinearGradient=function(a,b,c,d){return this.Y.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.Y.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.Y.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.Y.drawImage(a,b,c):this.Y.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.Y.fill()};
  t.fillRect=function(a,b,c,d){this.Y.fillRect(a,b,c,d)};t.fillText=function(a,b,c){this.Y.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.Y.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.Y.lineTo(a,b)};t.measureText=function(a){return this.Y.measureText(a)};t.moveTo=function(a,b){this.Y.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.Y.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.Y.rect(a,b,c,d)};t.restore=function(){this.Y.restore()};Dl.prototype.rotate=function(a){this.Y.rotate(a)};
  t=Dl.prototype;t.save=function(){this.Y.save()};t.setTransform=function(a,b,c,d,e,f){this.Y.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Y.scale(a,b)};t.stroke=function(){this.Y.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.Y.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.Y.translate(a,b)};
  t.Je=function(a){if(a instanceof zl&&a.type===Al){var b=a.gl;a=a.Au;a>b?(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.yn?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.yn?this.clip():this.fill()};t.vj=function(){this.yn||this.stroke()};t.Iw=function(a,b,c){this.et=a;this.ft=b;this.ug=c};
  t.Ft=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Dt=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash(em),a.lineDashOffset=0)};t.uc=function(a){a&&(this.yu="");this.xu=this.zu=""};
  na.Object.defineProperties(Dl.prototype,{fillStyle:{get:function(){return this.Y.fillStyle},set:function(a){this.xu!==a&&(this.xu=this.Y.fillStyle=a)}},font:{get:function(){return this.Y.font},set:function(a){this.yu!==a&&(this.yu=this.Y.font=a)}},globalAlpha:{get:function(){return this.Y.globalAlpha},set:function(a){this.Y.globalAlpha=a}},lineCap:{get:function(){return this.Y.lineCap},
  set:function(a){this.Y.lineCap=a}},lineDashOffset:{get:function(){return this.Y.lineDashOffset},set:function(a){this.Y.lineDashOffset=a}},lineJoin:{get:function(){return this.Y.lineJoin},set:function(a){this.Y.lineJoin=a}},lineWidth:{get:function(){return this.Y.lineWidth},set:function(a){this.Y.lineWidth=a}},miterLimit:{get:function(){return this.Y.miterLimit},set:function(a){this.Y.miterLimit=
  a}},shadowBlur:{get:function(){return this.Y.shadowBlur},set:function(a){this.Y.shadowBlur=a}},shadowColor:{get:function(){return this.Y.shadowColor},set:function(a){this.Y.shadowColor=a}},shadowOffsetX:{get:function(){return this.Y.shadowOffsetX},set:function(a){this.Y.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.Y.shadowOffsetY},set:function(a){this.Y.shadowOffsetY=
  a}},strokeStyle:{get:function(){return this.Y.strokeStyle},set:function(a){this.zu!==a&&(this.zu=this.Y.strokeStyle=a)}},textAlign:{get:function(){return this.Y.textAlign},set:function(a){this.Y.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.Y.imageSmoothingEnabled},set:function(a){this.Y.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.yn},
  set:function(a){this.yn=a}}});var em=Object.freeze([]);Dl.className="CanvasSurfaceContext";function fm(){this.T=this.u=this.I=this.l=0}fm.className="ColorNumbers";function zl(a){gm||(hm(),gm=!0);Xa(this);this.v=!1;void 0===a?(this.qa=Cl,this.fl="black"):"string"===typeof a?(this.qa=Cl,this.fl=a):(this.qa=a,this.fl="black");a=this.qa;a===Fl?(this.Dd=uc,this.sl=Cc):this.sl=a===Al?this.Dd=zc:this.Dd=sc;this.jt=0;this.Vr=NaN;this.ke=this.Ks=this.je=null;this.Au=this.gl=0}
  zl.prototype.copy=function(){var a=new zl;a.qa=this.qa;a.fl=this.fl;a.Dd=this.Dd.H();a.sl=this.sl.H();a.jt=this.jt;a.Vr=this.Vr;null!==this.je&&(a.je=this.je.copy());a.Ks=this.Ks;return a};t=zl.prototype;t.freeze=function(){this.v=!0;null!==this.je&&this.je.freeze();return this};t.ea=function(){Object.isFrozen(this)&&B("cannot thaw constant: "+this);this.v=!1;null!==this.je&&this.je.ea();return this};t.jb=function(a){a.classType===zl&&(this.type=a)};
  t.toString=function(){var a="Brush(";if(this.type===Cl)a+=this.color;else if(a=this.type===Fl?a+"Linear ":this.type===Al?a+"Radial ":this.type===El?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&&va(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&wa(a,"0 <= loc <= 1",zl,"addColorStop:loc");null===this.je&&(this.je=new H);this.je.add(a,b);this.qa===Cl&&(this.type=Fl);this.ke=null;return this};
  t.FA=function(a,b){this.v&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?im:b;if(this.type===Cl)bi(this.color),this.color=jm(a,b);else if((this.type===Fl||this.type===Al)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)bi(c.value),this.addColorStop(c.key,jm(a,b));return this};function km(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?im:c;bi(a);return jm(b,c)}
  t.Iz=function(a,b){this.v&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?im:b;if(this.type===Cl)bi(this.color),this.color=jm(-a,b);else if((this.type===Fl||this.type===Al)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)bi(c.value),this.addColorStop(c.key,jm(-a,b));return this};function lm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?im:c;bi(a);return jm(-b,c)}
  function mm(a,b,c){bi(a);a=nm.l;var d=nm.I,e=nm.u,f=nm.T;bi(b);void 0===c&&(c=.5);return"rgba("+Math.round((nm.l-a)*c+a)+", "+Math.round((nm.I-d)*c+d)+", "+Math.round((nm.u-e)*c+e)+", "+Math.round((nm.T-f)*c+f)+")"}
  t.Fy=function(){if(this.type===Cl)return om(this.color);if((this.type===Fl||this.type===Al)&&null!==this.colorStops){var a=this.colorStops;if(this.type===Al)return om(a.first().value);if(null!==a.get(.5))return om(a.get(.5));if(2===a.count)return a=a.ma(),om(mm(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?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(f=c,c=d,d=f,f=e);e=d-c;return om(mm(a.get(c),a.get(d),1-f/e))}return!1};
  function om(a){if(!a)return!1;if(a instanceof zl)return a.Fy();bi(a);return 128>(299*nm.l+587*nm.I+114*nm.u)/1E3}
  function jm(a,b){switch(b){case im:b=100*pm(nm.l);var c=100*pm(nm.I),d=100*pm(nm.u);qm.l=.4124564*b+.3575761*c+.1804375*d;qm.I=.2126729*b+.7151522*c+.072175*d;qm.u=.0193339*b+.119192*c+.9503041*d;qm.T=nm.T;b=rm(qm.l/sm[0]);c=rm(qm.I/sm[1]);d=rm(qm.u/sm[2]);tm.l=116*c-16;tm.I=500*(b-c);tm.u=200*(c-d);tm.T=qm.T;tm.l=Math.min(100,Math.max(0,tm.l+100*a));a=(tm.l+16)/116;b=a-tm.u/200;qm.l=sm[0]*um(tm.I/500+a);qm.I=sm[1]*(tm.l>vm*wm?Math.pow(a,3):tm.l/vm);qm.u=sm[2]*um(b);qm.T=tm.T;a=-.969266*qm.l+1.8760108*
  qm.I+.041556*qm.u;b=.0556434*qm.l+-.2040259*qm.I+1.0572252*qm.u;nm.l=255*xm((3.2404542*qm.l+-1.5371385*qm.I+-.4985314*qm.u)/100);nm.I=255*xm(a/100);nm.u=255*xm(b/100);nm.T=qm.T;nm.l=Math.round(nm.l);255<nm.l?nm.l=255:0>nm.l&&(nm.l=0);nm.I=Math.round(nm.I);255<nm.I?nm.I=255:0>nm.I&&(nm.I=0);nm.u=Math.round(nm.u);255<nm.u?nm.u=255:0>nm.u&&(nm.u=0);return"rgba("+nm.l+", "+nm.I+", "+nm.u+", "+nm.T+")";case ym:return ci(),di.u=Math.min(100,Math.max(0,di.u+100*a)),"hsla("+di.l+", "+di.I+"%, "+di.u+"%, "+
  di.T+")";default:return B("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function bi(a){gm||(hm(),gm=!0);var b=zm;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,nm.l=a[0],nm.I=a[1],nm.u=a[2],nm.T=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,nm.l=0,nm.I=0,nm.u=0,nm.T=1)}}
  function ci(){var a=nm.l/255,b=nm.I/255,c=nm.u/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}di.l=Math.round(g);di.I=Math.round(100*a);di.u=Math.round(100*e);di.T=nm.T}function pm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function xm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
  function rm(a){return a>wm?Math.pow(a,1/3):(vm*a+16)/116}function um(a){var b=a*a*a;return b>wm?b:(116*a-16)/vm}function Wl(a,b){"string"!==typeof a&&(a instanceof zl||B("Value for "+b+" must be a color string or a Brush, not "+a))}function hm(){zm=Ug?(new Hk(null)).context:null}
  na.Object.defineProperties(zl.prototype,{type:{get:function(){return this.qa},set:function(a){this.v&&va(this,a);this.qa=a;this.start.nc()&&(a===Fl?this.start=uc:a===Al&&(this.start=zc));this.end.nc()&&(a===Fl?this.end=Cc:a===Al&&(this.end=zc));this.ke=null}},color:{get:function(){return this.fl},set:function(a){this.v&&va(this,a);this.fl=a;this.ke=null}},start:{get:function(){return this.Dd},set:function(a){this.v&&
  va(this,a);this.Dd=a.H();this.ke=null}},end:{get:function(){return this.sl},set:function(a){this.v&&va(this,a);this.sl=a.H();this.ke=null}},startRadius:{get:function(){return this.jt},set:function(a){this.v&&va(this,a);0>a&&wa(a,">= zero",zl,"startRadius");this.jt=a;this.ke=null}},endRadius:{get:function(){return this.Vr},set:function(a){this.v&&va(this,a);0>a&&wa(a,">= zero",zl,"endRadius");this.Vr=a;this.ke=
  null}},colorStops:{get:function(){return this.je},set:function(a){this.v&&va(this,a);this.je=a;this.ke=null}},pattern:{get:function(){return this.Ks},set:function(a){this.v&&va(this,a);this.Ks=a;this.ke=null}}});zl.prototype.isDark=zl.prototype.Fy;zl.prototype.darkenBy=zl.prototype.Iz;zl.prototype.lightenBy=zl.prototype.FA;zl.prototype.addColorStop=zl.prototype.addColorStop;
  var wm=216/24389,vm=24389/27,sm=[95.047,100,108.883],zm=null,nm=new fm,di=new fm,qm=new fm,tm=new fm,gm=!1;zl.className="Brush";var Cl;zl.Solid=Cl=new D(zl,"Solid",0);var Fl;zl.Linear=Fl=new D(zl,"Linear",1);var Al;zl.Radial=Al=new D(zl,"Radial",2);var El;zl.Pattern=El=new D(zl,"Pattern",4);var im;zl.Lab=im=new D(zl,"Lab",5);var ym;zl.HSL=ym=new D(zl,"HSL",6);
  zl.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};
  zl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;gm||(hm(),gm=!0);var b=zm;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};zl.lighten=function(a){return km(a)};zl.lightenBy=km;zl.darken=function(a){return lm(a)};zl.darkenBy=lm;zl.mix=mm;zl.isDark=om;function Tl(){this.oa="Base"}Tl.prototype.measure=function(){};
  Tl.prototype.IA=function(a,b,c,d,e){a.measure(b,c,d,e)};Tl.prototype.arrange=function(){};Tl.prototype.wz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Tl.prototype.RA=function(a){a.Bk()};Tl.prototype.mc=function(){};na.Object.defineProperties(Tl.prototype,{name:{get:function(){return this.oa},set:function(a){this.oa=a}},classType:{get:function(){return X}}});Tl.prototype.remeasureObject=Tl.prototype.RA;Tl.prototype.arrangeElement=Tl.prototype.wz;
  Tl.prototype.measureElement=Tl.prototype.IA;Tl.className="PanelLayout";function Am(){this.oa="Base"}ma(Am,Tl);
  Am.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Bm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof Kf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);bc(e,p,r,n,m)}}};
  Am.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof Kf&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function Cm(){this.oa="Base"}ma(Cm,Tl);
  Cm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ea();f=Bm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=ql(l,!1);if(m!==zg&&m!==bl)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
  b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Ia(b)};
  Cm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,w=ql(m,!1);if(isNaN(m.desiredSize.height)&&w===td||w===cl)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.kb()||(q=zc);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
  p.left+p.right)}}};function Dm(){this.oa="Base"}ma(Dm,Tl);
  Dm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ea();for(var h=Bm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=ql(l,!1);if(m!==zg&&m!==cl)c.push(l);else{var n=l.margin;m=n.right+n.left;n=n.top+n.bottom;l.measure(b,Infinity,f,0);l=l.measuredBounds;Sb(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
  c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Ia(c)}};
  Dm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,w=ql(m,!1);if(isNaN(m.desiredSize.width)&&w===td||w===bl)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Mb()&&(q=a.defaultAlignment);q.kb()||(q=zc);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
  p.bottom+p.top)}}};function Em(){this.oa="Base"}ma(Em,Tl);
  Em.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.tb(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);for(var u=a.isClipping,w=N.allocAt(-l.left,-l.top,r,q),v=!0,y=Bm(a),z=0;z<h;z++){var A=d[z];if(A!==k&&(A.visible||A===y)){l=A.margin;r=l.right+l.left;q=l.top+l.bottom;p=ql(A,!1);switch(p){case td:b=f;c=g;break;case bl:b=f;break;case cl:c=g}A.measure(b,c,0,0);p=A.measuredBounds;r=
  Math.max(p.width+r,0);q=Math.max(p.height+q,0);var C=A.alignment;C.Mb()&&(C=a.defaultAlignment);C.kb()||(C=zc);var F=A.alignmentFocus;F.Mb()&&(F=zc);var Q=null;A instanceof X&&""!==A.Lg&&(A.arrange(0,0,p.width,p.height),Q=A.bb(A.Lg),Q===A&&(Q=null));if(null!==Q){l=Q.naturalBounds;p=Q.margin;for(l=J.allocAt(F.x*l.width-F.offsetX-p.left,F.y*l.height-F.offsetY-p.top);Q!==A;)Q.transform.ta(l),Q=Q.panel;A=C.x*f+C.offsetX-l.x;p=C.y*g+C.offsetY-l.y;J.free(l)}else A=C.x*f+C.offsetX-(F.x*p.width+F.offsetX)-
  l.left,p=C.y*g+C.offsetY-(F.y*p.height+F.offsetY)-l.top;v?(v=!1,e.h(A,p,r,q)):bc(e,A,p,r,q)}}v?e.assign(w):u?e.bw(w.x,w.y,w.width,w.height):bc(e,w.x,w.y,w.width,w.height);N.free(w);p=k.stretch;p===al&&(p=ql(k,!1));switch(p){case zg:return;case td:if(!isFinite(b)&&!isFinite(c))return;break;case bl:if(!isFinite(b))return;break;case cl:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0);q=Math.max(g+n,0);l=k.margin;w=N.allocAt(-l.left,-l.top,r,q);for(b=0;b<h;b++)c=d[b],c===
  k||!c.visible&&c!==y||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Mb()&&(m=a.defaultAlignment),m.kb()||(m=zc),c=c.alignmentFocus,c.Mb()&&(c=zc),v?(v=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):bc(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));v?e.assign(w):u?e.bw(w.x,w.y,w.width,w.height):bc(e,w.x,
  w.y,w.width,w.height);N.free(w)};
  Em.prototype.arrange=function(a,b,c){var d=b.length,e=a.tb(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var r=p.measuredBounds,q=r.width;r=r.height;m=p.alignment;m.Mb()&&(m=a.defaultAlignment);m.kb()||(m=zc);var u=p.alignmentFocus;u.Mb()&&(u=zc);l=null;p instanceof X&&""!==p.Lg&&(l=p.bb(p.Lg),l===p&&(l=null));if(null!==l){var w=l.naturalBounds;for(u=J.allocAt(u.x*w.width-u.offsetX,u.y*w.height-
  u.offsetY);l!==p;)l.transform.ta(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;J.free(u)}else l=m.x*g+m.offsetX-(u.x*q+u.offsetX),m=m.y*f+m.offsetY-(u.y*r+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,q,r)}}};function Fm(){this.oa="Base"}ma(Fm,Tl);
  Fm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.tb(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof Kf&&(u=k,q=u.strokeWidth*u.scale);var w=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var v=Gm(k),y=v.x*w+v.offsetX;v=v.y*l+v.offsetY;var z=Hm(k),A=z.x*w+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-A)-q,0));isFinite(c)&&(n=Math.max(Math.abs(v-z)-q,0));q=M.alloc();q.h(0,0);a=Bm(a);for(z=0;z<h;z++)v=
  d[z],v===k||!v.visible&&v!==a||(l=v.margin,w=l.right+l.left,y=l.top+l.bottom,v.measure(m,n,0,0),l=v.measuredBounds,w=Math.max(l.width+w,0),l=Math.max(l.height+y,0),q.h(Math.max(w,q.width),Math.max(l,q.height)));if(1===h)e.width=w,e.height=l,M.free(q);else{v=Gm(k);z=Hm(k);h=d=0;z.x!==v.x&&z.y!==v.y&&(d=q.width/Math.abs(z.x-v.x),h=q.height/Math.abs(z.y-v.y));M.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,Ag(u)===Bg&&(d=h=Math.max(d,h)));d+=Math.abs(v.offsetX)+Math.abs(z.offsetX)+q;h+=Math.abs(v.offsetY)+
  Math.abs(z.offsetY)+q;u=k.stretch;u===al&&(u=ql(k,!1));switch(u){case zg:g=f=0;break;case td:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case bl:isFinite(b)&&(d=b);g=0;break;case cl:f=0,isFinite(c)&&(h=c)}k.Bk();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
  Fm.prototype.arrange=function(a,b){var c=b.length,d=a.tb(),e=d.measuredBounds,f=N.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=Gm(d),n=Hm(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;bc(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
  p.Mb()&&(p=a.defaultAlignment),p.kb()||(p=zc),k=f.width*p.x+p.offsetX-k*p.x+g.left+f.x,g=f.height*p.y+p.offsetY-m*p.y+g.top+f.y,h.visible&&(cc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new N(f.x,f.y,f.width,f.height))));N.free(f)};function Im(){this.oa="Base";this.name="Table"}ma(Im,Tl);
  Im.prototype.measure=function(a,b,c,d,e){for(var f=d.length,g=Ea(),h=Ea(),k=0;k<f;k++){var l=d[k],m=l instanceof X?l:null;if(null===m||m.type!==X.TableRow&&m.type!==X.TableColumn||!l.visible)g.push(l);else{h.push(m);for(var n=m.W.j,p=n.length,r=0;r<p;r++){var q=n[r];m.type===X.TableRow?q.row=l.row:m.type===X.TableColumn&&(q.column=l.column);g.push(q)}}}f=g.length;0===f&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var u=[],w=0;w<f;w++){var v=g[w];pj(v,!0);rl(v,!0);u[v.row]||(u[v.row]=[]);
  u[v.row][v.column]||(u[v.row][v.column]=[]);u[v.row][v.column].push(v)}Ia(g);var y=Ea(),z=Ea(),A=Ea(),C={count:0},F={count:0},Q=b,K=c,T=a.qb;f=T.length;for(var P=0;P<f;P++){var I=T[P];void 0!==I&&(I.actual=0)}T=a.nb;f=T.length;for(var ja=0;ja<f;ja++)I=T[ja],void 0!==I&&(I.actual=0);for(var ba=u.length,qa=0,Ma=0;Ma<ba;Ma++)u[Ma]&&(qa=Math.max(qa,u[Ma].length));var eb=Math.min(a.topIndex,ba-1),Ga=Math.min(a.leftIndex,qa-1),Ha=0;ba=u.length;for(var Ad=Bm(a),Xb=0;Xb<ba;Xb++)if(u[Xb]){qa=u[Xb].length;
  var Yb=a.getRowDefinition(Xb);Yb.actual=0;for(var fb=Yb.bc=0;fb<qa;fb++)if(u[Xb][fb]){var Bd=a.getColumnDefinition(fb);void 0===y[fb]&&(Bd.actual=0,Bd.bc=0,y[fb]=!0);for(var gg=u[Xb][fb],hg=gg.length,Le=0;Le<hg;Le++){var Db=gg[Le];if(Db.visible||Db===Ad){var yh=1<Db.rowSpan||1<Db.columnSpan;yh&&(Xb<eb||fb<Ga||z.push(Db));var ig=Db.margin,zh=ig.right+ig.left,Ah=ig.top+ig.bottom;var bb=Jl(Db,Yb,Bd,!1);var Ji=Db.desiredSize,ik=!isNaN(Ji.height),jg=!isNaN(Ji.width)&&ik;yh||bb===zg||jg||Xb<eb||fb<Ga||
  (void 0!==C[fb]||bb!==td&&bb!==bl||(C[fb]=-1,C.count++),void 0!==F[Xb]||bb!==td&&bb!==cl||(F[Xb]=-1,F.count++),A.push(Db));Db.measure(Infinity,Infinity,0,0);if(!(Xb<eb||fb<Ga)){var md=Db.measuredBounds,nc=Math.max(md.width+zh,0),Ef=Math.max(md.height+Ah,0);if(1===Db.rowSpan&&(bb===zg||bb===bl)){I=a.getRowDefinition(Xb);var wc=I.wc();Ha=Math.max(Ef-I.actual,0);Ha+wc>K&&(Ha=Math.max(K-wc,0));var kg=0===I.ha;I.bc=I.bc+Ha;I.actual=I.ha+Ha;K=Math.max(K-(Ha+(kg?wc:0)),0)}if(1===Db.columnSpan&&(bb===zg||
  bb===cl)){I=a.getColumnDefinition(fb);var Bh=I.wc();Ha=Math.max(nc-I.actual,0);Ha+Bh>Q&&(Ha=Math.max(Q-Bh,0));var Bn=0===I.ha;I.bc=I.bc+Ha;I.actual=I.ha+Ha;Q=Math.max(Q-(Ha+(Bn?Bh:0)),0)}yh&&Db.Bk()}}}}}Ia(y);var Jd=0,ne=0;f=a.columnCount;for(var lg=0;lg<f;lg++){var mg=a.nb[lg];void 0!==mg&&(Jd+=mg.bc,0!==mg.bc&&(Jd+=mg.wc()))}f=a.rowCount;for(var Xc=0;Xc<f;Xc++){var oe=a.qb[Xc];void 0!==oe&&(ne+=oe.bc,0!==oe.bc&&(ne+=oe.wc()))}Q=Math.max(b-Jd,0);var ec=K=Math.max(c-ne,0),Ch=Q;f=A.length;for(var Dh=
  0;Dh<f;Dh++){var Yc=A[Dh],Ki=a.getRowDefinition(Yc.row),pe=a.getColumnDefinition(Yc.column),ff=Yc.measuredBounds,Cd=Yc.margin,jk=Cd.right+Cd.left,Cn=Cd.top+Cd.bottom;C[Yc.column]=0===pe.bc&&void 0!==C[Yc.column]?Math.max(ff.width+jk,C[Yc.column]):null;F[Yc.row]=0===Ki.bc&&void 0!==F[Yc.row]?Math.max(ff.height+Cn,F[Yc.row]):null}var Ff=0,Eb=0,Kd;for(Kd in F)"count"!==Kd&&(Ff+=F[Kd]);for(Kd in C)"count"!==Kd&&(Eb+=C[Kd]);for(var gb=M.alloc(),Li=0;Li<f;Li++){var Zb=A[Li];if(Zb.visible||Zb===Ad){var xc=
  a.getRowDefinition(Zb.row),oc=a.getColumnDefinition(Zb.column),Ld=0;isFinite(oc.width)?Ld=oc.width:(isFinite(Q)&&null!==C[Zb.column]?0===Eb?Ld=oc.actual+Q:Ld=C[Zb.column]/Eb*Ch:null!==C[Zb.column]?Ld=Q:Ld=oc.actual||Q,Ld=Math.max(0,Ld-oc.wc()));var Md=0;isFinite(xc.height)?Md=xc.height:(isFinite(K)&&null!==F[Zb.row]?0===Ff?Md=xc.actual+K:Md=F[Zb.row]/Ff*ec:null!==F[Zb.row]?Md=K:Md=xc.actual||K,Md=Math.max(0,Md-xc.wc()));gb.h(Math.max(oc.minimum,Math.min(Ld,oc.maximum)),Math.max(xc.minimum,Math.min(Md,
  xc.maximum)));bb=Jl(Zb,xc,oc,!1);switch(bb){case bl:gb.height=Math.max(gb.height,xc.actual+K);break;case cl:gb.width=Math.max(gb.width,oc.actual+Q)}var ng=Zb.margin,Fc=ng.right+ng.left,Eh=ng.top+ng.bottom;Zb.Bk();Zb.measure(gb.width,gb.height,oc.minimum,xc.minimum);var og=Zb.measuredBounds,Nd=Math.max(og.width+Fc,0),Fh=Math.max(og.height+Eh,0);isFinite(Q)&&(Nd=Math.min(Nd,gb.width));isFinite(K)&&(Fh=Math.min(Fh,gb.height));var gf=0;gf=xc.actual;xc.actual=Math.max(xc.actual,Fh);xc.bc=Math.max(xc.bc,
  Fh);Ha=xc.actual-gf;K=Math.max(K-Ha,0);null===F[Zb.row]&&(ec=Math.max(ec-Ha,0));gf=oc.actual;oc.actual=Math.max(oc.actual,Nd);oc.bc=Math.max(oc.bc,Nd);Ha=oc.actual-gf;Q=Math.max(Q-Ha,0);null===C[Zb.column]&&(Ch=Math.max(Ch-Ha,0))}}Ia(A);var Od=M.alloc(),Pd=Ea(),Qd=Ea();f=z.length;if(0!==f)for(var Me=0;Me<ba;Me++)if(u[Me]){qa=u[Me].length;var Gh=a.getRowDefinition(Me);Pd[Me]=Gh.actual;for(var qe=0;qe<qa;qe++)if(u[Me][qe]){var Dn=a.getColumnDefinition(qe);Qd[qe]=Dn.actual}}for(var fc=0;fc<f;fc++){var Oa=
  z[fc];if(Oa.visible||Oa===Ad){var gc=a.getRowDefinition(Oa.row),Rd=a.getColumnDefinition(Oa.column);gb.h(Math.max(Rd.minimum,Math.min(b,Rd.maximum)),Math.max(gc.minimum,Math.min(c,gc.maximum)));bb=Jl(Oa,gc,Rd,!1);switch(bb){case td:0!==Qd[Rd.index]&&(gb.width=Math.min(gb.width,Qd[Rd.index]));0!==Pd[gc.index]&&(gb.height=Math.min(gb.height,Pd[gc.index]));break;case bl:0!==Qd[Rd.index]&&(gb.width=Math.min(gb.width,Qd[Rd.index]));break;case cl:0!==Pd[gc.index]&&(gb.height=Math.min(gb.height,Pd[gc.index]))}isFinite(Rd.width)&&
  (gb.width=Rd.width);isFinite(gc.height)&&(gb.height=gc.height);Od.h(0,0);for(var Ne=Rd.minimum,Hh=gc.minimum,Oe=1;Oe<Oa.rowSpan&&!(Oa.row+Oe>=a.rowCount);Oe++)I=a.getRowDefinition(Oa.row+Oe),Ha=0,Ha=bb===td||bb===cl?Math.max(I.minimum,0===Pd[Oa.row+Oe]?I.maximum:Math.min(Pd[Oa.row+Oe],I.maximum)):Math.max(I.minimum,isNaN(I.ad)?I.maximum:Math.min(I.ad,I.maximum)),Od.height+=Ha,Hh+=I.minimum;for(var Pc=1;Pc<Oa.columnSpan&&!(Oa.column+Pc>=a.columnCount);Pc++)I=a.getColumnDefinition(Oa.column+Pc),Ha=
  0,Ha=bb===td||bb===bl?Math.max(I.minimum,0===Qd[Oa.column+Pc]?I.maximum:Math.min(Qd[Oa.column+Pc],I.maximum)):Math.max(I.minimum,isNaN(I.ad)?I.maximum:Math.min(I.ad,I.maximum)),Od.width+=Ha,Ne+=I.minimum;gb.width+=Od.width;gb.height+=Od.height;var hf=Oa.margin,Ih=hf.right+hf.left,En=hf.top+hf.bottom;Oa.measure(gb.width,gb.height,Ne,Hh);for(var pg=Oa.measuredBounds,nd=Math.max(pg.width+Ih,0),Sd=Math.max(pg.height+En,0),re=0,se=0;se<Oa.rowSpan&&!(Oa.row+se>=a.rowCount);se++)I=a.getRowDefinition(Oa.row+
  se),re+=I.total||0;if(re<Sd){var Td=Sd-re,te=Sd-re;if(null!==Oa.spanAllocation)for(var kk=Oa.spanAllocation,Pe=0;Pe<Oa.rowSpan&&!(0>=Td)&&!(Oa.row+Pe>=a.rowCount);Pe++){I=a.getRowDefinition(Oa.row+Pe);var Mi=I.ha||0,Fn=kk(Oa,I,te);I.actual=Math.min(I.maximum,Mi+Fn);I.ha!==Mi&&(Td-=I.ha-Mi)}for(;0<Td;){var od=I.ha||0;isNaN(I.height)&&I.maximum>od&&(I.actual=Math.min(I.maximum,od+Td),I.ha!==od&&(Td-=I.ha-od));if(0===I.index)break;I=a.getRowDefinition(I.index-1)}}for(var Gf=0,Jh=0;Jh<Oa.columnSpan&&
  !(Oa.column+Jh>=a.columnCount);Jh++)I=a.getColumnDefinition(Oa.column+Jh),Gf+=I.total||0;if(Gf<nd){var qg=nd-Gf,eu=nd-Gf;if(null!==Oa.spanAllocation)for(var fu=Oa.spanAllocation,lk=0;lk<Oa.columnSpan&&!(0>=qg)&&!(Oa.column+lk>=a.columnCount);lk++){I=a.getColumnDefinition(Oa.column+lk);var Gn=I.ha||0,gu=fu(Oa,I,eu);I.actual=Math.min(I.maximum,Gn+gu);I.ha!==Gn&&(qg-=I.ha-Gn)}for(;0<qg;){var mk=I.ha||0;isNaN(I.width)&&I.maximum>mk&&(I.actual=Math.min(I.maximum,mk+qg),I.ha!==mk&&(qg-=I.ha-mk));if(0===
  I.index)break;I=a.getColumnDefinition(I.index-1)}}}}Ia(z);M.free(Od);M.free(gb);void 0!==Pd&&Ia(Pd);void 0!==Qd&&Ia(Qd);var rg=0,sg=0,nk=a.desiredSize,sr=a.maxSize;bb=ql(a,!0);var Ni=ne=Jd=0,Oi=0;f=a.columnCount;for(var ok=0;ok<f;ok++)void 0!==a.nb[ok]&&(I=a.getColumnDefinition(ok),isFinite(I.width)?(Ni+=I.width,Ni+=I.wc()):Jm(I)===Km?(Ni+=I.ha,Ni+=I.wc()):0!==I.ha&&(Jd+=I.ha,Jd+=I.wc()));isFinite(nk.width)?rg=Math.min(nk.width,sr.width):rg=bb!==zg&&isFinite(b)?b:Jd;rg=Math.max(rg,a.minSize.width);
  rg=Math.max(rg-Ni,0);for(var hu=0===Jd?1:Math.max(rg/Jd,1),qk=0;qk<f;qk++)void 0!==a.nb[qk]&&(I=a.getColumnDefinition(qk),isFinite(I.width)||Jm(I)===Km||(I.actual=I.ha*hu),I.position=e.width,0!==I.ha&&(e.width+=I.ha,e.width+=I.wc()));f=a.rowCount;for(var rk=0;rk<f;rk++)void 0!==a.qb[rk]&&(I=a.getRowDefinition(rk),isFinite(I.height)?(Oi+=I.height,Oi+=I.wc()):Jm(I)===Km?(Oi+=I.ha,Oi+=I.wc()):0!==I.ha&&(ne+=I.ha,0!==I.ha&&(ne+=I.wc())));isFinite(nk.height)?sg=Math.min(nk.height,sr.height):sg=bb!==zg&&
  isFinite(c)?c:ne;sg=Math.max(sg,a.minSize.height);sg=Math.max(sg-Oi,0);for(var iu=0===ne?1:Math.max(sg/ne,1),sk=0;sk<f;sk++)void 0!==a.qb[sk]&&(I=a.getRowDefinition(sk),isFinite(I.height)||Jm(I)===Km||(I.actual=I.ha*iu),I.position=e.height,0!==I.ha&&(e.height+=I.ha,0!==I.ha&&(e.height+=I.wc())));f=h.length;for(var Hn=0;Hn<f;Hn++){var pd=h[Hn],In=0,Jn=0;pd.type===X.TableRow?(In=e.width,I=a.getRowDefinition(pd.row),Jn=I.actual):(I=a.getColumnDefinition(pd.column),In=I.actual,Jn=e.height);pd.measuredBounds.h(0,
  0,In,Jn);pj(pd,!1);u[pd.row]||(u[pd.row]=[]);u[pd.row][pd.column]||(u[pd.row][pd.column]=[]);u[pd.row][pd.column].push(pd)}Ia(h);a.Lp=u};
  Im.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Lp,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.qb[n]||0===a.qb[n].ha);)n++;n=Math.min(n,l-1);n=-a.qb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.nb[h]||0===a.nb[h].ha);)h++;h=Math.min(h,m-1);for(var p=-a.nb[h].position,r=M.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.ha&&
  (k+=u.Jv());for(var w=0;w<m;w++)if(g[q][w]){var v=a.getColumnDefinition(w);h=v.position+p+f;0!==v.ha&&(h+=v.Jv());for(var y=g[q][w],z=y.length,A=0;A<z;A++){var C=y[A],F=C.measuredBounds,Q=C instanceof X?C:null;if(null===Q||Q.type!==X.TableRow&&Q.type!==X.TableColumn){r.h(0,0);for(var K=1;K<C.rowSpan&&!(q+K>=a.rowCount);K++)Q=a.getRowDefinition(q+K),r.height+=Q.total;for(K=1;K<C.columnSpan&&!(w+K>=a.columnCount);K++)Q=a.getColumnDefinition(w+K),r.width+=Q.total;var T=v.ha+r.width,P=u.ha+r.height;K=
  h;Q=k;var I=T,ja=P,ba=h,qa=k,Ma=T,eb=P;h+T>c.width&&(Ma=Math.max(c.width-h,0));k+P>c.height&&(eb=Math.max(c.height-k,0));var Ga=C.alignment;if(Ga.Mb()){Ga=a.defaultAlignment;Ga.kb()||(Ga=zc);var Ha=Ga.x;var Ad=Ga.y;var Xb=Ga.offsetX;Ga=Ga.offsetY;var Yb=v.alignment,fb=u.alignment;Yb.kb()&&(Ha=Yb.x,Xb=Yb.offsetX);fb.kb()&&(Ad=fb.y,Ga=fb.offsetY)}else Ha=Ga.x,Ad=Ga.y,Xb=Ga.offsetX,Ga=Ga.offsetY;if(isNaN(Ha)||isNaN(Ad))Ad=Ha=.5,Ga=Xb=0;Yb=F.width;fb=F.height;var Bd=C.margin,gg=Bd.left+Bd.right,hg=Bd.top+
  Bd.bottom,Le=Jl(C,u,v,!1);!isNaN(C.desiredSize.width)||Le!==td&&Le!==bl||(Yb=Math.max(T-gg,0));!isNaN(C.desiredSize.height)||Le!==td&&Le!==cl||(fb=Math.max(P-hg,0));T=C.maxSize;P=C.minSize;Yb=Math.min(T.width,Yb);fb=Math.min(T.height,fb);Yb=Math.max(P.width,Yb);fb=Math.max(P.height,fb);T=fb+hg;K+=I*Ha-(Yb+gg)*Ha+Xb+Bd.left;Q+=ja*Ad-T*Ad+Ga+Bd.top;C.visible&&(cc(ba,qa,Ma,eb,K,Q,F.width,F.height)?C.arrange(K,Q,Yb,fb):C.arrange(K,Q,Yb,fb,new N(ba,qa,Ma,eb)))}else C.Fl(),C.actualBounds.ea(),I=C.actualBounds,
  K=N.allocAt(I.x,I.y,I.width,I.height),I.x=Q.type===X.TableRow?f:h,I.y=Q.type===X.TableColumn?e:k,I.width=F.width,I.height=F.height,C.actualBounds.freeze(),rl(C,!1),Vb(K,I)||(F=C.part,null!==F&&(F.Oh(),C.mp(F))),N.free(K)}}}M.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof X?c:null,null===f||f.type!==X.TableRow&&f.type!==X.TableColumn||(f=c.actualBounds,c.naturalBounds.ea(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Lm(){this.oa="Base"}ma(Lm,Tl);
  Lm.prototype.measure=function(){};Lm.prototype.arrange=function(){};function Mm(){this.oa="Base"}ma(Mm,Tl);Mm.prototype.measure=function(){};Mm.prototype.arrange=function(){};function Nm(){this.oa="Base"}ma(Nm,Tl);
  Nm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&B("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.Aa=1;d.Bk();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),r=Math.max(c-k,0),q=1;a.viewboxStretch===Bg?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.Aa*=q;m!==d.scale&&(pj(d,!0),d.measure(Infinity,
  Infinity,f,g))}h=d.measuredBounds;e.width=isFinite(b)?b:Math.max(h.width+l,0);e.height=isFinite(c)?c:Math.max(h.height+k,0)};Nm.prototype.arrange=function(a,b,c){b=b[0];var d=b.measuredBounds,e=b.margin,f=Math.max(d.width+(e.right+e.left),0);e=Math.max(d.height+(e.top+e.bottom),0);var g=b.alignment;g.Mb()&&(g=a.defaultAlignment);g.kb()||(g=zc);b.arrange(c.width*g.x-f*g.x+g.offsetX,c.height*g.y-e*g.y+g.offsetY,d.width,d.height)};function Om(){this.oa="Base"}ma(Om,Tl);Om.prototype.measure=function(){};
  Om.prototype.arrange=function(){};
  Om.prototype.mc=function(a,b,c){c=a.Af()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin,p=n.x;n=n.y;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var r=[],q=a.W.j,u=q.length,w=0;w<u;w++){var v=q[w],y=[];r.push(y);if(v.visible){var z=v.interval;if(!(0>z)){v=Zj(v.figure);for(var A=0;A<u;A++)if(A!==w){var C=q[A];C.visible&&Zj(C.figure)===v&&(C=C.interval,C>z&&y.push(C))}}}}q=
  a.W.j;u=q.length;for(w=0;w<u;w++){var F=q[w];if(F.visible&&(y=F.interval||1,v=Math.abs(y),!(2>e*v*c))){z=F.segmentIndex;if(!isFinite(z)||isNaN(z))z=0;0>z&&(z=v-Math.min(-z,v));z=Math.round(z%v);v=F.opacity;A=1;if(1!==v){if(0===v)continue;A=b.globalAlpha;b.globalAlpha=A*v}C=r[w];var Q=!1,K=F.strokeDashArray;null!==K&&(Q=!0,b.Ft(K,F.strokeDashOffset));if("LineV"===F.figure&&null!==F.stroke&&0<F.strokeWidth){b.lineWidth=F.strokeWidth;oi(a,b,F.stroke,!1,!1,f,g);b.beginPath();for(K=F=Math.floor((p-e)/
  e);K<=F+l;K++){var T=K*e+p;0<=T&&T<=h&&Pm(K,y,z,C)&&(b.moveTo(T,0),b.lineTo(T,k))}b.stroke()}else if("LineH"===F.figure&&null!==F.stroke&&0<F.strokeWidth){b.lineWidth=F.strokeWidth;oi(a,b,F.stroke,!1,!1,f,g);b.beginPath();for(K=F=Math.floor((n-d)/d);K<=F+m;K++)T=K*d+n,0<=T&&T<=k&&Pm(K,y,z,C)&&(b.moveTo(0,T),b.lineTo(h,T));b.stroke()}else if("BarV"===F.figure&&null!==F.fill)for(oi(a,b,F.fill,!0,!1,f,g),F=F.width,isNaN(F)&&(F=e),T=K=Math.floor((p-e)/e);T<=K+l;T++){var P=T*e+p;0<=P+F&&P<=h&&Pm(T,y,z,
  C)&&b.fillRect(P,0,F,k)}else if("BarH"===F.figure&&null!==F.fill)for(oi(a,b,F.fill,!0,!1,f,g),F=F.height,isNaN(F)&&(F=d),T=K=Math.floor((n-d)/d);T<=K+m;T++)P=T*d+n,0<=P+F&&P<=k&&Pm(T,y,z,C)&&b.fillRect(0,P,h,F);Q&&b.Dt();1!==v&&(b.globalAlpha=A)}}b.restore();b.uc(!1)};function Pm(a,b,c,d){if(0>b)return a%b===c;if(a%b!==c)return!1;b=d.length;for(var e=0;e<b;e++)if(a%d[e]===c)return!1;return!0}function Qm(){this.oa="Base"}ma(Qm,Tl);
  Qm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Je||a instanceof S){var f=null,g=null,h=null;a instanceof S&&(g=f=a);a instanceof Je&&(h=a,f=h.adornedPart);if(f instanceof S){var k=f;if(0===c)Sb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Je?null:f.path,m=f.routeBounds;b=a.xg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.Gk(!1):null!==g&&g.Gk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(Rm(a,p,r,l),
  h=l.measuredBounds,b.Rc(h),a.l.push(h));h=ld.alloc();for(var q=J.alloc(),u=J.alloc(),w=0;w<c;w++){var v=d[w];if(v!==l)if(v.isPanelMain&&v instanceof Kf){Rm(a,p,r,v);var y=v.measuredBounds;b.Rc(y);a.l.push(y)}else if(2>f)v.measure(Infinity,Infinity,0,0),y=v.measuredBounds,b.Rc(y),a.l.push(y);else{var z=v.segmentIndex,A=v.segmentFraction,C=v.alignmentFocus;C.nc()&&(C=zc);var F=v.segmentOrientation,Q=v.segmentOffset;if(isNaN(z)){var K=k.na;y=Ea();K.Yv(A,y);var T=J.allocAt(y[0],y[1]);T.add(k.i(0));K.type===
  ud?T.offset(-K.startX,-K.startY):(K=K.figures.first(),T.offset(-K.startX,-K.startY));K=y[2];if(F!==ag){var P=k.computeAngle(v,F,K);v.Yb=P}P=T.x-m.x;var I=T.y-m.y;J.free(T);Ia(y)}else if(z<-f||z>=f)I=k.midPoint,K=k.midAngle,F!==ag&&(P=k.computeAngle(v,F,K),v.Yb=P),P=I.x-m.x,I=I.y-m.y;else{P=0;0<=z?(I=n.J(z),y=z<f-1?n.J(z+1):I):(P=f+z,I=n.J(P),y=0<P?n.J(P-1):I);if(I.Qa(y)){0<=z?(K=0<z?n.J(z-1):I,P=z<f-2?n.J(z+2):y):(K=P<f-1?n.J(P+1):I,P=1<P?n.J(P-2):y);T=K.Ie(I);var ja=y.Ie(P);K=T>ja+10?0<=z?K.Pa(I):
  I.Pa(K):ja>T+10?0<=z?y.Pa(P):P.Pa(y):0<=z?K.Pa(P):P.Pa(K)}else K=0<=z?I.Pa(y):y.Pa(I);F!==ag&&(P=k.computeAngle(v,F,K),v.Yb=P);P=I.x+(y.x-I.x)*A-m.x;I=I.y+(y.y-I.y)*A-m.y}v.measure(Infinity,Infinity,0,0);y=v.measuredBounds;T=v.naturalBounds;var ba=0;v instanceof Kf&&(ba=v.strokeWidth);ja=T.width+ba;var qa=T.height+ba;h.reset();h.translate(-y.x,-y.y);h.scale(v.scale,v.scale);h.rotate(F===ag?v.angle:K,ja/2,qa/2);F!==Sm&&F!==Tm||h.rotate(90,ja/2,qa/2);F!==Um&&F!==Vm||h.rotate(-90,ja/2,qa/2);F===Wm&&
  (45<K&&135>K||225<K&&315>K)&&h.rotate(-K,ja/2,qa/2);T=new N(0,0,ja,qa);q.tj(T,C);h.ta(q);C=-q.x+ba/2*v.scale;v=-q.y+ba/2*v.scale;u.assign(Q);ba=isNaN(Q.x);var Ma=isNaN(Q.y);if(ba||Ma){ja=ja/2+3;qa=qa/2+3;var eb=45<=K&&135>=K,Ga=225<=K&&315>=K;F===ag&&(eb||Ga)?(u.x=Ma?ja:Q.y,u.y=ba?qa:Q.x,eb?0<=z||isNaN(z)&&.5>A||!ba||(u.y=-qa):Ga&&((0<=z||isNaN(z)&&.5>A)&&ba&&(u.y=-qa),Ma&&(u.x=-ja))):(ba&&(u.x=0<=z||isNaN(z)&&.5>A?ja:-ja),Ma&&(u.y=-qa),u.rotate(K))}else u.rotate(K);P+=u.x;I+=u.y;T.set(y);T.h(P+C,
  I+v,y.width,y.height);a.l.push(T);b.Rc(T)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.xg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Sb(e,b.width||0,b.height||0);ld.free(h);J.free(q);J.free(u)}}}};
  Qm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Je||a instanceof S){var d=null,e=null,f=null;a instanceof S&&(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<a.l.length){var l=h[k];k++;g.arrange(l.x-a.xg.x,l.y-a.xg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.l.length){var n=h[k];k++;m.arrange(n.x-a.xg.x,n.y-a.xg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof S)for(d=
  a.labelNodes;d.next();){var p=a;g=d.value;h=g.segmentIndex;k=g.segmentFraction;var r=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){n=p.na;var q=Ea();n.Yv(k,q);var u=J.allocAt(q[0],q[1]);u.add(p.i(0));n.type===ud?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var w=u.y;J.free(u);Ia(q)}else if(h<-c||h>=c)w=p.midPoint,n=p.midAngle,l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p),p=w.x,w=w.y;
  else{u=0;0<=h?(q=b.j[h],w=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],w=0<u?b.j[u-1]:q);if(q.Qa(w)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:w):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:w);var v=n.Ie(q),y=w.Ie(u);n=v>y+10?0<=h?n.Pa(q):q.Pa(n):y>v+10?0<=h?w.Pa(u):u.Pa(w):0<=h?n.Pa(u):u.Pa(n)}else n=0<=h?q.Pa(w):w.Pa(q);l!==ag&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(w.x-q.x)*k;w=q.y+(w.y-q.y)*k}if(r.Vt())g.location=new J(p,w);else{r.nc()&&(r=zc);q=ld.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,0,
  0);var z=g.naturalBounds;u=N.allocAt(0,0,z.width,z.height);v=J.alloc();v.tj(u,r);q.ta(v);r=-v.x;y=-v.y;var A=z.width,C=z.height;z=J.alloc();z.assign(m);var F=isNaN(m.x),Q=isNaN(m.y);if(F||Q){A=A/2+3;C=C/2+3;var K=45<=n&&135>=n,T=225<=n&&315>=n;l===ag&&(K||T)?(z.x=Q?A:m.y,z.y=F?C:m.x,K?0<=h||isNaN(h)&&.5>k||!F||(z.y=-C):T&&((0<=h||isNaN(h)&&.5>k)&&F&&(z.y=-C),Q&&(z.x=-A))):(F&&(z.x=0<=h||isNaN(h)&&.5>k?A:-A),Q&&(z.y=-C),z.rotate(n))}else z.rotate(n);p+=z.x;w+=z.y;q.Pw(u);r+=u.x;y+=u.y;h=J.allocAt(p+
  r,w+y);g.move(h);J.free(h);J.free(z);J.free(v);N.free(u);ld.free(q)}}null!==f?f.Gk(!1):null!==e&&e.Gk(!1)}};
  function Rm(a,b,c,d){if(!1!==uj(d)){var e=d.strokeWidth;0===e&&a instanceof Je&&a.type===X.Link&&a.adornedObject instanceof Kf&&(e=a.adornedObject.strokeWidth);e*=d.Aa;a instanceof S&&null!==a.na?(a=a.na.bounds,nl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Je&&null!==a.adornedPart.na?(a=a.adornedPart.na.bounds,nl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):nl(d,-(e/2),-(e/2),b+e,c+e);pj(d,!1)}}function Xm(){this.oa="Base"}ma(Xm,Tl);
  Xm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.tb();a.dh=[];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.dh.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,w=r.flattenedLengths,v=r.flattenedTotalLength,y=u.length,z=0,A=0,C=Ea(),F=0;F<y;F++){var Q=u[F],K=[];A=z=0;for(var T=Q.length,P=0;P<T;P+=2){var I=Q[P],ja=Q[P+1];if(0!==P){var ba=180*Math.atan2(ja-
  A,I-z)/Math.PI;0>ba&&(ba+=360);K.push(ba)}z=I;A=ja}C.push(K)}if(null===a.eh){for(var qa=[],Ma=a.W.j,eb=Ma.length,Ga=0;Ga<eb;Ga++){var Ha=Ma[Ga],Ad=[];qa.push(Ad);if(Ha.visible){var Xb=Ha.interval;if(!(0>Xb))for(var Yb=0;Yb<eb;Yb++)if(Yb!==Ga){var fb=Ma[Yb];if(fb.visible&&Ha.constructor===fb.constructor){var Bd=fb.interval;Bd>Xb&&Ad.push(Bd)}}}}a.eh=qa}var gg=a.eh;var hg=a.W.j,Le=hg.length,Db=0,yh=0,ig=v;a.Mj=[];for(var zh,Ah=0;Ah<Le;Ah++){var bb=hg[Ah];zh=[];if(bb.visible&&bb!==h){var Ji=Math.abs(bb.interval),
  ik=a.graduatedTickUnit;if(!(2>ik*Ji*v/a.graduatedRange)){var jg=w[0][0],md=0,nc=0;yh=v*bb.graduatedStart-1E-4;ig=v*bb.graduatedEnd+1E-4;var Ef=ik*Ji,wc=a.graduatedTickBase;if(wc<a.graduatedMin){var kg=(a.graduatedMin-wc)/Ef;kg=0===kg%1?kg:Math.floor(kg+1);wc+=kg*Ef}else wc>a.graduatedMin+Ef&&(wc-=Math.floor((wc-a.graduatedMin)/Ef)*Ef);for(var Bh=gg[Ah],Bn=wc,Jd=1;wc<a.graduatedMax+5E-8;Jd++){a:{for(var ne=Bh.length,lg=0;lg<ne;lg++)if(L.aa((wc-a.graduatedTickBase)%(Bh[lg]*a.graduatedTickUnit),0)){var mg=
  !1;break a}mg=!0}if(mg&&(null===bb.graduatedSkip||!bb.graduatedSkip(wc))&&(Db=(wc-a.graduatedMin)*v/a.graduatedRange,Db>v&&(Db=v),yh<=Db&&Db<=ig)){for(var Xc=C[md][nc],oe=w[md][nc];md<w.length;){for(;Db>jg&&nc<w[md].length-1;)nc++,Xc=C[md][nc],oe=w[md][nc],jg+=oe;if(Db<=jg)break;md++;nc=0;Xc=C[md][nc];oe=w[md][nc];jg+=oe}var ec=u[md],Ch=ec[2*nc],Dh=ec[2*nc+1],Yc=(Db-(jg-oe))/oe,Ki=new J(Ch+(ec[2*nc+2]-Ch)*Yc+q/2-r.bounds.x,Dh+(ec[2*nc+3]-Dh)*Yc+q/2-r.bounds.y);Ki.scale(h.scale,h.scale);var pe=Xc,
  ff=C[md];1E-4>Yc?0<nc?pe=ff[nc-1]:L.aa(ec[0],ec[ec.length-2])&&L.aa(ec[1],ec[ec.length-1])&&(pe=ff[ff.length-1]):.9999<Yc&&(nc+1<ff.length?pe=ff[nc+1]:L.aa(ec[0],ec[ec.length-2])&&L.aa(ec[1],ec[ec.length-1])&&(pe=ff[0]));Xc!==pe&&(180<Math.abs(Xc-pe)&&(Xc<pe?Xc+=360:pe+=360),Xc=(Xc+pe)/2%360);if(bb instanceof Wg){var Cd="";null!==bb.graduatedFunction?(Cd=bb.graduatedFunction(wc),Cd=null!==Cd&&void 0!==Cd?Cd.toString():""):Cd=(+wc.toFixed(2)).toString();""!==Cd&&zh.push({Km:Ki,angle:Xc,text:Cd})}else zh.push({Km:Ki,
  angle:Xc})}wc=Bn+Jd*Ef}}}a.Mj.push(zh)}Ia(C);var jk=a.Mj;if(null!==jk)for(var Cn=d.length,Ff=0;Ff<Cn;Ff++){var Eb=d[Ff],Kd=jk[Ff];if(Eb.visible&&Eb!==h&&0!==Kd.length){if(Eb instanceof Kf){var gb=a,Li=e,Zb=Eb.alignmentFocus;Zb.nc()&&(Zb=uc);var xc=Eb.angle;Eb.Yb=0;Eb.measure(Infinity,Infinity,0,0);Eb.Yb=xc;var oc=Eb.measuredBounds,Ld=oc.width,Md=oc.height,ng=N.allocAt(0,0,Ld,Md),Fc=J.alloc();Fc.tj(ng,Zb);N.free(ng);for(var Eh=-Fc.x,og=-Fc.y,Nd=new N,Fh=Kd.length,gf=0;gf<Fh;gf++)for(var Od=Kd[gf],
  Pd=Od.Km.x,Qd=Od.Km.y,Me=Od.angle,Gh=0;4>Gh;Gh++){switch(Gh){case 0:Fc.h(Eh,og);break;case 1:Fc.h(Eh+Ld,og);break;case 2:Fc.h(Eh,og+Md);break;case 3:Fc.h(Eh+Ld,og+Md)}Fc.rotate(Me+Eb.angle);Fc.offset(Pd,Qd);0===gf&&0===Gh?Nd.h(Fc.x,Fc.y,0,0):Nd.Oe(Fc);Fc.offset(-Pd,-Qd);Fc.rotate(-Me-Eb.angle)}J.free(Fc);null!==gb.dh&&gb.dh.push(Nd);bc(Li,Nd.x,Nd.y,Nd.width,Nd.height)}else if(Eb instanceof Wg){var qe=a,Dn=e;null===qe.zh&&(qe.zh=new Wg);var fc=qe.zh;Ym(fc,Eb);var Oa=Eb.alignmentFocus;Oa.nc()&&(Oa=
  uc);for(var gc=Eb.segmentOrientation,Rd=Eb.segmentOffset,Ne=new N,Hh=0,Oe=0,Pc=0,hf=0,Ih=0,En=Kd.length,pg=0;pg<En;pg++){var nd=Kd[pg];Hh=nd.Km.x;Oe=nd.Km.y;Pc=nd.angle;Ih=hf=Eb.angle;gc!==ag&&(Ih=gc===Zm||gc===$m?Pc+Eb.angle:Pc,hf=S.computeAngle(gc,Ih));fc.Yb=hf;fc.text=nd.text||"";fc.measure(Infinity,Infinity,0,0);var Sd=fc.measuredBounds,re=fc.naturalBounds,se=re.width,Td=re.height,te=ld.alloc();te.reset();te.translate(-Sd.x,-Sd.y);te.scale(fc.scale,fc.scale);te.rotate(Ih,se/2,Td/2);gc!==Sm&&gc!==
  Tm||te.rotate(90,se/2,Td/2);gc!==Um&&gc!==Vm||te.rotate(-90,se/2,Td/2);gc===Wm&&(45<Pc&&135>Pc||225<Pc&&315>Pc)&&te.rotate(-Pc,se/2,Td/2);var kk=N.allocAt(0,0,se,Td),Pe=J.alloc();Pe.tj(kk,Oa);te.ta(Pe);var Mi=-Pe.x,Fn=-Pe.y,od=J.alloc();od.assign(Rd);isNaN(od.x)&&(od.x=se/2+3);isNaN(od.y)&&(od.y=-(Td/2+3));od.rotate(Pc);Hh+=od.x+Mi;Oe+=od.y+Fn;var Gf=new N(Hh,Oe,Sd.width,Sd.height),Jh=new N(Sd.x,Sd.y,Sd.width,Sd.height),qg=new N(re.x,re.y,re.width,re.height);nd.DA=hf;nd.lineCount=fc.lineCount;nd.lines=
  [fc.vb,fc.Ei,fc.oe,fc.Be,fc.Qb,fc.lb,fc.me];nd.actualBounds=Gf;nd.measuredBounds=Jh;nd.naturalBounds=qg;0===pg?Ne.assign(Gf):Ne.Rc(Gf);J.free(od);J.free(Pe);N.free(kk);ld.free(te)}null!==qe.dh&&qe.dh.push(Ne);bc(Dn,Ne.x,Ne.y,Ne.width,Ne.height)}pj(Eb,!1)}}};
  Xm.prototype.arrange=function(a,b,c){if(null!==a.dh){var d=a.tb(),e=a.Mj;if(null!==e){var f=a.dh,g=0,h=f[g];g++;null!==d&&d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.dh=null}}};
  Xm.prototype.mc=function(a,b,c){var d=c.yi;c.yi=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.tb();f.mc(b,c);e=a.Af()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.W.j,k=a.Mj,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof Kf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,w=n.alignmentFocus;w.nc()&&
  (w=uc);for(var v=0;v<r;v++){var y=p[v].Km,z=p[v].angle,A=w,C=n.sb;C.reset();C.translate(y.x+g.x,y.y+g.y);C.rotate(z+n.angle,0,0);C.translate(-q.width*A.x+A.offsetX+u/2,-q.height*A.y+A.offsetY+u/2);C.scale(n.scale,n.scale);Gl(n,!1);n.Zh.set(n.sb);n.ql=n.scale;Hl(n,!1);n.mc(b,c);n.sb.reset()}}}else if(n instanceof Wg)for(null===a.zh&&(a.zh=new Wg),q=a.zh,Ym(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Ub=u.text||"",q.Yb=u.DA||0,q.Zc=u.lineCount||0,w=u.lines,void 0!==
  w&&(q.vb=w[0],q.Ei=w[1],q.oe=w[2],q.Be=w[3],q.Qb=w[4],q.lb=w[5],q.me=w[6]),u.naturalBounds&&(q.rc=u.naturalBounds),u.actualBounds&&(w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height)),w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height),v=u.measuredBounds,u=u.naturalBounds,y=q.sb,y.reset(),y.translate(w.x+g.x,w.y+g.y),y.translate(-v.x,-v.y),ol(q,y,u.x,u.y,u.width,u.height),Gl(q,!1),q.Zh.set(q.sb),q.ql=q.scale,Hl(q,!1),q.mc(b,c))}c.yi=d;b.restore();b.uc(!0)};
  function X(a){Y.call(this);this.qa=void 0===a?X.Position:a;null===this.qa&&B("Panel type not specified or PanelLayout not loaded: "+a);this.W=new E;this.ib=qc;this.qa===X.Grid&&(this.isAtomic=!0);this.Mn=Vc;this.Sf=al;this.qa===X.Table&&an(this);this.pq=Bg;this.no=Mb;this.oo=Bb;this.ko=0;this.jo=100;this.mo=10;this.lo=0;this.li=this.ob=this.eh=this.dh=this.Mj=null;this.Do=NaN;this.te=this.Ci=null;this.Jl="category";this.Zd=null;this.xg=new N(NaN,NaN,NaN,NaN);this.zh=this.Lp=this.Ui=null;this.Lg=""}
  ma(X,Y);function an(a){a.Fj=qc;a.Ug=1;a.si=null;a.ri=null;a.Tg=1;a.Sg=null;a.pi=null;a.qb=[];a.nb=[];a.dk=bn;a.Cj=bn;a.Xi=0;a.Gi=0}
  X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.qa=this.qa;a.ib=this.ib.H();a.Mn=this.Mn.H();a.Sf=this.Sf;if(a.qa===X.Table){a.Fj=this.Fj.H();a.Ug=this.Ug;a.si=this.si;a.ri=this.ri;a.Tg=this.Tg;a.Sg=this.Sg;a.pi=this.pi;var b=[];if(0<this.qb.length)for(var c=this.qb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.sj(a);b[e]=f}a.qb=b;b=[];if(0<this.nb.length)for(c=this.nb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.sj(a),b[e]=f);a.nb=b;a.dk=
  this.dk;a.Cj=this.Cj;a.Xi=this.Xi;a.Gi=this.Gi}a.pq=this.pq;a.no=this.no.H();a.oo=this.oo.H();a.ko=this.ko;a.jo=this.jo;a.mo=this.mo;a.lo=this.lo;a.Mj=this.Mj;a.eh=this.eh;a.ob=this.ob;a.li=this.li;a.Do=this.Do;a.Ci=this.Ci;a.te=this.te;a.Jl=this.Jl;a.xg.assign(this.xg);a.Lg=this.Lg;null!==this.Lp&&(a.Lp=this.Lp)};X.prototype.yf=function(a){Y.prototype.yf.call(this,a);a.W=this.W;for(var b=a.W.j,c=b.length,d=0;d<c;d++)b[d].og=a;a.Ui=null};
  X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.sj(a);e.ak=null;var f=a.W,g=f.count;f.wb(g,e);f=a.part;if(null!==f){f.Xj=null;null!==e.portId&&f instanceof W&&(f.Nh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.Va(ze,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+kb(this)};
  t.mp=function(a){Y.prototype.mp.call(this,a);for(var b=this.W.j,c=b.length,d=0;d<c;d++)b[d].mp(a)};
  t.ej=function(a,b){if(this.qa===X.Grid)this.qa.mc(this,a,b);else if(this.qa===X.Graduated)this.qa.mc(this,a,b);else{this.qa===X.Table&&(a.lineCap="butt",cn(this,a,!0,this.qb,!0),cn(this,a,!1,this.nb,!0),dn(this,a,!0,this.qb),dn(this,a,!1,this.nb),cn(this,a,!0,this.qb,!1),cn(this,a,!1,this.nb,!1));var c=this.isClipping&&this.qa===X.Spot;c&&a.save();for(var d=this.tb(),e=this.W.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.mc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),
  a.uc(!0))}};
  function dn(a,b,c,d){for(var e=d.length,f=a.actualBounds,g=a.naturalBounds,h=!0,k=0;k<e;k++){var l=d[k];if(void 0!==l)if(h)h=!1;else if(0!==l.actual){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.Ug:a.Tg);var n=l.separatorStroke;null===n&&(n=c?a.si:a.Sg);if(0!==m&&null!==n){oi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.ri:a.pi);null!==p&&(n=!0,b.Ft(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.ib;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.Dt()}}}}
  function cn(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.wc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Ug:a.Tg);var r=l.separatorStroke;null===r&&(r=c?a.si:a.Sg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.ib,oi(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 Zj(a){return"LineV"===a||"BarV"===a}
  t.zk=function(a,b,c,d,e){var f=this.he(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,L.Cf(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+r,a=c*k+d*m+p,k=c*l+d*n+r,e.h(0,0),c=this.naturalBounds,f=L.Cf(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b*
  n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.W.j;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.qa===X.Spot;u&&(q=J.alloc(),p=this.tb(),(l=p.zk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var w=0;w<r;w++){var v=n[w];v.visible&&v!==p&&v.zk(h,a,k,c,m)&&(l=!0,v=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),v<d&&(d=v,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l};
  t.s=function(a){if(!uj(this)){Y.prototype.s.call(this,a);a=null;if(this.qa===X.Auto||this.qa===X.Link)a=this.tb();for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.s(!0);if(!e.desiredSize.o()){var f=ql(e,!1);(e instanceof xg||e instanceof X||e instanceof Wg||f!==zg)&&e.s(!0)}}}};t.Bk=function(){if(!uj(this)){pj(this,!0);rl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].Bk()}};
  t.Fl=function(){if(0!==(this.F&2048)===!1){Gl(this,!0);Hl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].dw()}};t.dw=function(){Hl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].dw()};
  t.Hm=function(a,b,c,d){var e=this.xg;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.ib;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.W.j;0!==l.length&&this.qa.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
  isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);Sb(e,a,k);Sb(this.naturalBounds,a,k);nl(this,0,0,a,k)};t.tb=function(){if(null===this.Ui){var a=this.W.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Ui=d}this.Ui=a[0]}return this.Ui};function Bm(a){return null!==a.part?a.part.locationObject:null}
  t.Ih=function(a,b,c,d){var e=this.W.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.o()){a=ql(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.jh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=zg);switch(a){case zg:if(b>c||f>d)this.s(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case td:this.s(!0);this.measure(c+h,d+g,0,0);break;case bl:this.s(!0);this.measure(c+h,f+g,0,0);break;case cl:this.s(!0),this.measure(b+h,d+g,0,0)}}this.qa.arrange(this,e,this.xg)}};
  t.Kh=function(a){var b=this.naturalBounds,c=Bm(this);if(cc(0,0,b.width,b.height,a.x,a.y)){b=this.W.j;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(wb(e.set(a),f.transform),f.$(e))return J.free(e),!0}J.free(e);return null===this.mb&&null===this.ec?!1:!0}return!1};t.Gt=function(a){if(this.dl===a)return this;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].Gt(a);if(null!==e)return e}return null};
  t.an=function(a,b){b(this,a);if(a instanceof X){a=a.W.j;for(var c=a.length,d=0;d<c;d++)this.an(a[d],b)}};function Hj(a,b){en(a,a,b)}function en(a,b,c){c(b);b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&en(a,f,c)}}function fn(a,b){gn(a,a,b)}function gn(a,b,c){c(b);if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++)gn(a,b[e],c)}}t.ym=function(a){return hn(this,this,a)};
  function hn(a,b,c){if(c(b))return b;if(b instanceof X){b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=hn(a,b[e],c);if(null!==f)return f}}return null}t.bb=function(a){if(this.name===a)return this;var b=this.W.j,c=b.length;null===this.Ci&&null===this.te||(c=jn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.bb(a);if(null!==f)return f}if(e.name===a)return e}return null};
  function kn(a){a=a.W.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,kn(e)):e instanceof Kf&&(c=Math.max(c,e.wh/2*e.gk*e.Af()))}return c}t.he=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
  t.Vb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(vj(this))return null;var d=this.naturalBounds,e=1/this.Af(),f=this.he(),g=f?a:wb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Bm("extraTouchArea"),l=k/2);if(cc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.W.j;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.qa===X.Spot)?this.tb():null;if(k&&(l.he()?wb(h.set(a),l.transform):h.set(a),!l.$(h)))return J.free(h),
  f||J.free(g),null;for(var n=Bm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.he()?wb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Vb(h,b,c):!0===p.pickable&&p.$(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return J.free(h),f||J.free(g),r}}J.free(h)}if(null===this.background&&null===this.areaBackground)return f||J.free(g),null;a=cc(0,0,d.width,d.height,g.x,g.y)?this:null;f||J.free(g);return a}f||J.free(g);return null};
  t.hj=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.he(),g=f?a:wb(J.allocAt(a.x,a.y),this.transform);e=cc(0,0,e.width,e.height,g.x,g.y);if(this.type===X.TableRow||this.type===X.TableColumn||e){if(!this.isAtomic){for(var h=this.W.j,k=h.length,l=J.alloc(),m=Bm(this);k--;){var n=h[k];if(n.visible||n===m){n.he()?wb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.hj(l,b,c,d):p.$(l))&&!1!==p.pickable&&
  (null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}J.free(l)}f||J.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||J.free(g);return!1};
  t.zf=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=ld.alloc(),g.reset());g.multiply(this.transform);if(this.Jh(a,g))return ln(this,b,c,e),void 0===f&&ld.free(g),!0;if(this.Mc(a,g)){if(!this.isAtomic)for(var h=Bm(this),k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){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=m;m=m instanceof X?m:null;p=ld.alloc();p.set(g);
  if(null!==m?m.zf(a,b,c,d,e,p):pl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);ld.free(p)}}}void 0===f&&ld.free(g);return d}void 0===f&&ld.free(g);return!1};function ln(a,b,c,d){for(var e=a.W.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&&ln(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
  t.Eg=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.he(),k=h?a:wb(J.allocAt(a.x,a.y),this.transform),l=h?b:wb(J.allocAt(b.x,b.y),this.transform),m=k.Ie(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||xb(k.x,k.y,0,0,0,g.height)<=m||xb(k.x,k.y,0,g.height,g.width,g.height)<=m||xb(k.x,k.y,g.width,g.height,g.width,0)<=m||xb(k.x,k.y,g.width,0,0,0)<=m;g=k.qd(0,0)<=m&&k.qd(0,g.height)<=m&&k.qd(g.width,0)<=m&&k.qd(g.width,g.height)<=
  m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=Bm(this);for(var p=this.W.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,w=this.naturalBounds;if(!h||!(u.x>w.width||u.y>w.height||0>u.x+u.width||0>u.y+u.height))if(q.he()?(u=q.transform,wb(k.set(a),u),wb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.Eg(k,l,c,d,e,f):u.sy(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}J.free(k);J.free(l)}return e?n:g}return!1};
  function Gm(a){var b=null;a instanceof Kf&&(b=a.spot1,b===Vc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=tc);return b}function Hm(a){var b=null;a instanceof Kf&&(b=a.spot2,b===Vc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Dc);return b}t.add=function(a){this.wb(this.W.count,a)};t.J=function(a){return this.W.J(a)};
  t.wb=function(a,b){b instanceof V&&B("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Gg(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.qa!==X.Grid||b instanceof Kf||B("Can only add Shapes to a Grid Panel, not: "+b);this.qa!==X.Graduated||b instanceof Kf||b instanceof Wg||B("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.sj(this);b.ak=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Zd&&(this.Zd=new H),this.Zd.add(d,b))}var e=this.W;d=-1;if(c===this){for(var f=-1,g=this.W.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
  e.cb(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.wb(a,b);if(0===a||b.isPanelMain)this.Ui=null;uj(this)||this.s();b.s(!1);null!==b.portId?this.Nh=!0:b instanceof X&&!0===b.Nh&&(this.Nh=!0);this.eh=null;c=this.part;null!==c&&(c.Xj=null,c.kh=NaN,this.Nh&&c instanceof W&&(c.Nh=!0),c.Nh&&c instanceof W&&(c.tc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.Va(Ae,"elements",this,b,null,d,null),c.Va(ze,
  "elements",this,null,b,null,a),this.Hg()||mn(this,b,!1)))};function nn(a,b){a.F=b?a.F|16777216:a.F&-16777217}t.remove=function(a){for(var b=this.W.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Lc(d,!0)};t.cb=function(a){0<=a&&this.Lc(a,!0)};
  t.Lc=function(a,b){var c=this.W,d=c.J(a);d.ak=null;d.sj(null);if(null!==this.Zd){var e=d.data;"object"===typeof e&&this.Zd.remove(e)}c.cb(a);pj(this,!1);this.s();this.Ui===d&&(this.Ui=null);this.eh=null;var f=this.part;null!==f&&(f.Xj=null,f.kh=NaN,f.Lb(),f instanceof W&&(d instanceof X?d.an(d,function(a,c){Xl(f,c,b)}):Xl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.Va(Ae,"elements",this,d,null,a,null))};
  X.prototype.getRowDefinition=function(a){0>a&&wa(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.qb;if(void 0===b)return null;if(void 0===b[a]){var c=new Vj;c.sj(this);c.isRow=!0;c.index=a;b[a]=c;this.Va(ze,"rowdefs",this,null,c,null,a)}return b[a]};
  X.prototype.XA=function(a){0>a&&wa(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.qb;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.Va(Ae,"rowdefs",this,c,null,a,null);this.s()}}};function Wj(a,b,c){var d=a.qb;if(d&&!(0>b)){d[b]=c instanceof Vj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
  X.prototype.getColumnDefinition=function(a){0>a&&wa(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 Vj;c.sj(this);c.isRow=!1;c.index=a;b[a]=c;this.Va(ze,"coldefs",this,null,c,null,a)}return b[a]};t=X.prototype;
  t.SA=function(a){0>a&&wa(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.nb;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.Va(Ae,"coldefs",this,c,null,a,null);this.s()}}};function Xj(a,b,c){var d=a.nb;if(d&&!(0>b)){d[b]=c instanceof Vj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
  t.aA=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.qb,d=c.length,e=this.Xi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Tz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.nb,d=c.length,e=this.Gi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
  t.qA=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.tb();c.geometry.Xv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ta(b)};t.rA=function(a){if(this.type!==X.Graduated)return NaN;var b=this.tb();b.transform.Jd(a);return b.geometry.wy(a)*this.graduatedRange+this.graduatedMin};function Ol(a){a=a.li;return null!==a&&a.v}
  function yg(a){var b=a.li;if(null===b)null!==a.data&&B("Template cannot have .data be non-null: "+a),a.li=b=new E;else if(b.v)return;var c=new E;nn(a,!1);a.an(a,function(a,d){var e=d.fb;if(null!==e)for(Ll(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===on&&Ll(d,!0);var g=f.sourceName;null!==g&&("/"===g&&nn(a,!0),g=ml(f,a,d),null!==g&&(c.add(g),null===g.im&&(g.im=new E),g.im.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.qb.length)for(a=d.qb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
  g&&null!==g.fb)for(var h=g.fb.iterator;h.next();){var k=h.value;k.pd=g;k.hq=2;k.om=g.index;b.add(k)}if(0<d.nb.length)for(d=d.nb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.fb)for(g=f.fb.iterator;g.next();)h=g.value,h.pd=f,h.hq=1,h.om=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.im){Ll(e,!0);for(var f=e.im.iterator;f.next();){var g=f.value;null===e.fb&&(e.fb=new E);e.fb.add(g)}}e.im=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.pd,null!==f){e.pd=null;var h=
  e.targetProperty,k=h.indexOf(".");0<k&&f instanceof X&&(g=h.substring(0,k),h=h.substr(k+1),k=f.bb(g),null!==k?(f=k,e.targetProperty=h):xa('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Vj?(g=kb(f.panel),e.wj=void 0===g?-1:g,f.panel.dl=e.wj):f instanceof Y?(g=kb(f),e.wj=void 0===g?-1:g,f.dl=e.wj):B("Unknown type of binding target: "+f)}b.freeze();a instanceof V&&a.Nc()&&a.Ta()}
  t.Gz=function(a){void 0===a&&(a=!1);var b=this.copy();fn(b,function(a){a instanceof X&&(a.li=null,a.ob=null);var b=a.fb;null!==b&&(a.fb=null,b.each(function(b){a.bind(b.copy())}));b=a.Mg;null!==b&&(a.Mg=null,b.each(function(b){a.Qw(b.value.copy())}))});a&&yg(b);return b};
  t.Ea=function(a){var b=this.li;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)if(""===e)d=this;else if("/"===e)d=this;else if("."===e)d=this;else if(".."===e)d=this;else{if(d=this.bb(e),null===d)continue}else if(c.isToModel)if(d=this.diagram,null!==d)d=d.model.modelData;else continue;var f=this,g=c.wj;if(-1!==g){if(f=this.Gt(g),null===f)continue}else null!==
  c.pd&&(f=c.pd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.hq;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.om):2===e&&(f=f.getRowDefinition(c.om))}void 0!==f&&c.Tw(f,d)}}};function pn(a,b){a=a.W.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof X&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof X)||f.data!==b[g])return!0;e++;g++}return!1}
  function jn(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.W.length,1);if(a.type===X.Link){a=a.W;for(var b=a.length,c=0;c<b;c++){var d=a.J(c);if(!(d instanceof Kf&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.W.length&&(a=a.W.J(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.eu=function(){for(var a=jn(this);this.W.length>a;)this.Lc(this.W.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)qn(this,a[c],c)};
  t.qy=function(a){return void 0===a||null===a||null===this.Zd?null:this.Zd.G(a)};
  function qn(a,b,c){if(!(void 0===b||null===b||0>c)){var d=rn(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.G(d));null===f&&(null!==e&&(f=e.G("")),null===f&&(sn||(sn=!0,xa('No item template Panel found for category "'+d+'" on '+a),xa("  Using default item template."),d=new X,e=new Wg,e.bind(new Ii("text","",Ka)),d.add(e),tn=d),f=tn));d=f;null!==d&&(yg(d),d=d.copy(),0!==(d.F&16777216)&&(e=a.ij(),null!==e&&nn(e,!0)),"object"===typeof b&&(null===a.Zd&&(a.Zd=new H),a.Zd.add(b,d)),e=c+jn(a),a.wb(e,d),
  d.ob=b,un(a,e,c),d.ob=null,d.data=b)}}function un(a,b,c){for(a=a.W;b<a.length;){var d=a.J(b);if(d instanceof X){var e=b,f=c;d.type===X.TableRow?d.row=e:d.type===X.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}
  function rn(a,b){if(null===b)return"";a=a.Jl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=vn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;B("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}function mn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.W.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||mn(a,f,c)}}}
  function wn(a,b){b.name=a;Sl.add(a,b)}
  na.Object.defineProperties(X.prototype,{type:{get:function(){return this.qa},set:function(a){var b=this.qa;b!==a&&(this.qa=a,this.qa===X.Grid?this.isAtomic=!0:this.qa===X.Table&&an(this),this.s(),this.g("type",b,a))}},elements:{get:function(){return this.W.iterator}},naturalBounds:{get:function(){return this.rc}},padding:{get:function(){return this.ib},set:function(a){"number"===
  typeof a?(0>a&&wa(a,">= 0",X,"padding"),a=new kc(a)):(0>a.left&&wa(a.left,">= 0",X,"padding:value.left"),0>a.right&&wa(a.right,">= 0",X,"padding:value.right"),0>a.top&&wa(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&wa(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.ib;b.w(a)||(this.ib=a=a.H(),this.s(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.Mn},set:function(a){var b=this.Mn;b.w(a)||(this.Mn=a=a.H(),this.s(),this.g("defaultAlignment",
  b,a))}},defaultStretch:{get:function(){return this.Sf},set:function(a){var b=this.Sf;b!==a&&(this.Sf=a,this.s(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.Fj?qc:this.Fj},set:function(a){if(void 0!==this.Fj){"number"===typeof a&&(a=new kc(a));var b=this.Fj;b.w(a)||(this.Fj=a=a.H(),this.s(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
  this.si?null:this.si},set:function(a){var b=this.si;b!==a&&(null===a||"string"===typeof a||a instanceof zl)&&(a instanceof zl&&a.freeze(),this.si=a,this.M(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Ug?1:this.Ug},set:function(a){if(void 0!==this.Ug){var b=this.Ug;b!==a&&isFinite(a)&&0<=a&&(this.Ug=a,this.s(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
  get:function(){return void 0===this.ri?null:this.ri},set:function(a){if(void 0!==this.ri){var b=this.ri;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||B("defaultRowSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.ri=a;this.M();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
  this.Sg?null:this.Sg},set:function(a){if(void 0!==this.Sg){var b=this.Sg;b!==a&&(null===a||"string"===typeof a||a instanceof zl)&&(a instanceof zl&&a.freeze(),this.Sg=a,this.M(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Tg?1:this.Tg},set:function(a){if(void 0!==this.Tg){var b=this.Tg;b!==a&&isFinite(a)&&0<=a&&(this.Tg=a,this.s(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
  get:function(){return void 0===this.pi?null:this.pi},set:function(a){if(void 0!==this.pi){var b=this.pi;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||B("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.pi=a;this.M();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.pq},
  set:function(a){var b=this.pq;b!==a&&(this.pq=a,this.s(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.no},set:function(a){var b=this.no;if(!b.w(a)){a.o()&&0!==a.width&&0!==a.height||B("Invalid Panel.gridCellSize: "+a);this.no=a.H();var c=this.diagram;null!==c&&this===c.grid&&qj(c);this.M();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.oo},set:function(a){var b=this.oo;if(!b.w(a)){a.o()||
  B("Invalid Panel.gridOrigin: "+a);this.oo=a.H();var c=this.diagram;null!==c&&this===c.grid&&qj(c);this.M();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.ko},set:function(a){var b=this.ko;b!==a&&(this.ko=a,this.s(),this.g("graduatedMin",b,a),kl(this)&&(a=this.part,null!==a&&ll(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.jo},set:function(a){var b=this.jo;b!==a&&(this.jo=a,this.s(),this.g("graduatedMax",
  b,a),kl(this)&&(a=this.part,null!==a&&ll(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.mo},set:function(a){var b=this.mo;b!==a&&0<a&&(this.mo=a,this.s(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.lo},set:function(a){var b=this.lo;b!==a&&(this.lo=a,this.s(),this.g("graduatedTickBase",
  b,a))}},Nh:{get:function(){return 0!==(this.F&8388608)},set:function(a){0!==(this.F&8388608)!==a&&(this.F^=8388608)}},rowCount:{get:function(){return void 0===this.qb?0:this.qb.length}},columnCount:{get:function(){return void 0===this.nb?0:this.nb.length}},rowSizing:{get:function(){return void 0===this.dk?bn:this.dk},set:function(a){if(void 0!==this.dk){var b=this.dk;b!==a&&(this.dk=
  a,this.s(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.Cj?bn:this.Cj},set:function(a){if(void 0!==this.Cj){var b=this.Cj;b!==a&&(this.Cj=a,this.s(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.Xi?0:this.Xi},set:function(a){if(void 0!==this.Xi){var b=this.Xi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Xi=a,this.s(),
  this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.Gi?0:this.Gi},set:function(a){if(void 0!==this.Gi){var b=this.Gi;b!==a&&((!isFinite(a)||0>a)&&B("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.Gi=a,this.s(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.ob},set:function(a){var b=this.ob;if(b!==a){var c=this instanceof V&&!(this instanceof Je);yg(this);this.ob=a;var d=this.diagram;
  null!==d&&(c?(c=d.partManager,this instanceof S?(null!==b&&c.Te.remove(b),null!==a&&c.Te.add(a,this)):this instanceof V&&(null!==b&&c.Ue.remove(b),null!==a&&c.Ue.add(a,this))):(c=this.panel,null!==c&&null!==c.Zd&&(null!==b&&c.Zd.remove(b),null!==a&&c.Zd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ea()}}},itemIndex:{get:function(){return this.Do},set:function(a){var b=this.Do;b!==a&&(this.Do=a,this.g("itemIndex",b,a))}},itemArray:{
  get:function(){return this.Ci},set:function(a){var b=this.Ci;if(b!==a||null!==a&&pn(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Mj(c.partManager,this,c),this.Ci=a,null!==c&&null!==a&&Jj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.eu()}}},itemTemplate:{get:function(){return null===this.te?null:this.te.G("")},set:function(a){if(null===this.te){if(null===a)return;this.te=new H}var b=this.te.G("");
  b!==a&&((a instanceof V||a.isPanelMain)&&B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.te.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.eu())}},itemTemplateMap:{get:function(){return this.te},set:function(a){var b=this.te;if(b!==a){for(var c=a.iterator;c.next(););this.te=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.eu()}}},itemCategoryProperty:{
  get:function(){return this.Jl},set:function(a){var b=this.Jl;b!==a&&(this.Jl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.F&1048576)},set:function(a){var b=0!==(this.F&1048576);b!==a&&(this.F^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.F&2097152)},set:function(a){var b=0!==(this.F&2097152);b!==a&&(!a||this.type===X.Spot||this instanceof U||xa("Warning: Panel.isClipping set on non-Spot Panel: "+
  this.toString()),this.F^=2097152,this instanceof U&&(this.Za=null),this.s(),this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.F&33554432)},set:function(a){var b=0!==(this.F&33554432);b!==a&&(this.F^=33554432,this.s(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.F&4194304)},set:function(a){var b=0!==(this.F&4194304);if(b!==a){var c=null===this.panel||this.panel.Hg();this.F^=4194304;this.g("isEnabled",
  b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&mn(this,this,a)}}},alignmentFocusName:{get:function(){return this.Lg},set:function(a){var b=this.Lg;b!==a&&(this.Lg=a,this.s(),this.g("alignmentFocusName",b,a))}}});
  na.Object.defineProperties(X,{Position:{get:function(){return Sl.G("Position")}},Horizontal:{get:function(){return Sl.G("Horizontal")}},Vertical:{get:function(){return Sl.G("Vertical")}},Spot:{get:function(){return Sl.G("Spot")}},Auto:{get:function(){return Sl.G("Auto")}},Table:{get:function(){return Sl.G("Table")}},Viewbox:{
  get:function(){return Sl.G("Viewbox")}},TableRow:{get:function(){return Sl.G("TableRow")}},TableColumn:{get:function(){return Sl.G("TableColumn")}},Link:{get:function(){return Sl.G("Link")}},Grid:{get:function(){return Sl.G("Grid")}},Graduated:{get:function(){return Sl.G("Graduated")}}});X.prototype.findItemPanelForData=X.prototype.qy;
  X.prototype.rebuildItemElements=X.prototype.eu;X.prototype.updateTargetBindings=X.prototype.Ea;X.prototype.copyTemplate=X.prototype.Gz;X.prototype.graduatedValueForPoint=X.prototype.rA;X.prototype.graduatedPointForValue=X.prototype.qA;X.prototype.findColumnForLocalX=X.prototype.Tz;X.prototype.findRowForLocalY=X.prototype.aA;X.prototype.removeColumnDefinition=X.prototype.SA;X.prototype.removeRowDefinition=X.prototype.XA;X.prototype.removeAt=X.prototype.cb;X.prototype.remove=X.prototype.remove;
  X.prototype.insertAt=X.prototype.wb;X.prototype.elt=X.prototype.J;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.bb;X.prototype.findInVisualTree=X.prototype.ym;X.prototype.walkVisualTreeFrom=X.prototype.an;X.prototype.findMainElement=X.prototype.tb;var sn=!1,tn=null,Sl=new H;X.className="Panel";X.definePanelLayout=wn;wn("Position",new Am);wn("Vertical",new Dm);wn("Auto",new Fm);wn("Link",new Qm);
  function Vj(){Xa(this);this.og=null;this.ns=!0;this.Ra=0;this.ad=NaN;this.nh=0;this.lh=Infinity;this.yb=Vc;this.la=this.bc=this.ha=0;this.fb=null;this.Yp=xn;this.De=al;this.Up=this.sg=null;this.Vp=NaN;this.mb=this.fk=null;this.In=!1}
  Vj.prototype.copy=function(){var a=new Vj;a.ns=this.ns;a.Ra=this.Ra;a.ad=this.ad;a.nh=this.nh;a.lh=this.lh;a.yb=this.yb;a.ha=this.ha;a.bc=this.bc;a.la=this.la;a.De=this.De;a.Yp=this.Yp;null===this.sg?a.sg=null:a.sg=this.sg.H();a.Up=this.Up;a.Vp=this.Vp;a.fk=null;null!==this.fk&&(a.separatorDashArray=Ba(this.separatorDashArray));a.mb=this.mb;a.In=this.In;a.fb=this.fb;return a};t=Vj.prototype;
  t.gy=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.sg=null===a.separatorPadding?null:a.separatorPadding.H();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.fk=null;a.separatorDashArray&&(this.fk=Ba(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.fb=a.fb};
  t.jb=function(a){a.classType===Vj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+kb(this)};t.sj=function(a){this.og=a};
  t.Jv=function(){var a=0,b=0,c=this.og,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.qb.length:c.nb.length,f=0;f<e;f++){var g=d?c.qb[f]:c.nb[f];if(void 0!==g){b=g.index;break}}this.index!==b&&(b=this.separatorStroke,null===b&&null!==c&&(b=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==b&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==c?a=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:a=0)));b=this.sg;if(null===b)if(null!==c)b=
  c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
  t.wc=function(){var a=0,b=this.og,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.qb.length:b.nb.length,f=0;f<e;f++){var g=d?b.qb[f]:b.nb[f];if(void 0!==g){c=g.index;break}}this.index!==c&&(c=this.separatorStroke,null===c&&null!==b&&(c=d?b.defaultRowSeparatorStroke:b.defaultColumnSeparatorStroke),null!==c&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==b?a=d?b.defaultRowSeparatorStrokeWidth:b.defaultColumnSeparatorStrokeWidth:a=0)));d=this.sg;if(null===d)if(null!==b)d=b.defaultSeparatorPadding;
  else return a;return a+(this.isRow?d.top+d.bottom:d.left+d.right)};t.Bb=function(a,b,c){var d=this.og;if(null!==d&&(d.Va(xe,a,this,b,c,void 0,void 0),null!==this.fb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.ij(),null!==d&&(b=d.data,null!==b)))))for(c=this.fb.iterator;c.next();)c.value.jr(this,b,a,d)};function Jm(a){if(a.sizing===xn){var b=a.og;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
  t.bind=function(a){a.pd=this;var b=this.panel;if(null!==b){var c=b.ij();null!==c&&Ol(c)&&B("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.fb&&(this.fb=new E);this.fb.add(a)};
  na.Object.defineProperties(Vj.prototype,{panel:{get:function(){return this.og}},isRow:{get:function(){return this.ns},set:function(a){this.ns=a}},index:{get:function(){return this.Ra},set:function(a){this.Ra=a}},height:{get:function(){return this.ad},set:function(a){var b=this.ad;b!==a&&(0>a&&wa(a,">= 0",Vj,"height"),this.ad=a,this.actual=this.ha,null!==this.panel&&this.panel.s(),
  this.Bb("height",b,a))}},width:{get:function(){return this.ad},set:function(a){var b=this.ad;b!==a&&(0>a&&wa(a,">= 0",Vj,"width"),this.ad=a,this.actual=this.ha,null!==this.panel&&this.panel.s(),this.Bb("width",b,a))}},minimum:{get:function(){return this.nh},set:function(a){var b=this.nh;b!==a&&((0>a||!isFinite(a))&&wa(a,">= 0",Vj,"minimum"),this.nh=a,this.actual=this.ha,null!==this.panel&&this.panel.s(),this.Bb("minimum",b,a))}},maximum:{
  get:function(){return this.lh},set:function(a){var b=this.lh;b!==a&&(0>a&&wa(a,">= 0",Vj,"maximum"),this.lh=a,this.actual=this.ha,null!==this.panel&&this.panel.s(),this.Bb("maximum",b,a))}},alignment:{get:function(){return this.yb},set:function(a){var b=this.yb;b.w(a)||(this.yb=a.H(),null!==this.panel&&this.panel.s(),this.Bb("alignment",b,a))}},stretch:{get:function(){return this.De},set:function(a){var b=this.De;b!==a&&(this.De=
  a,null!==this.panel&&this.panel.s(),this.Bb("stretch",b,a))}},separatorPadding:{get:function(){return this.sg},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.sg;null!==a&&null!==b&&b.w(a)||(null!==a&&(a=a.H()),this.sg=a,null!==this.panel&&this.panel.s(),this.Bb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.Up},set:function(a){var b=this.Up;b!==a&&(null!==a&&Wl(a,"RowColumnDefinition.separatorStroke"),
  a instanceof zl&&a.freeze(),this.Up=a,null!==this.panel&&this.panel.s(),this.Bb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.Vp},set:function(a){var b=this.Vp;b!==a&&(this.Vp=a,null!==this.panel&&this.panel.s(),this.Bb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.fk},set:function(a){var b=this.fk;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===
  typeof f&&0<=f&&isFinite(f)||B("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.fk=a;null!==this.panel&&this.panel.M();this.Bb("separatorDashArray",b,a)}}},background:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&(null!==a&&Wl(a,"RowColumnDefinition.background"),a instanceof zl&&a.freeze(),this.mb=a,null!==this.panel&&this.panel.M(),this.Bb("background",b,a))}},coversSeparators:{
  get:function(){return this.In},set:function(a){var b=this.In;b!==a&&(this.In=a,null!==this.panel&&this.panel.M(),this.Bb("coversSeparators",b,a))}},sizing:{get:function(){return this.Yp},set:function(a){var b=this.Yp;b!==a&&(this.Yp=a,null!==this.panel&&this.panel.s(),this.Bb("sizing",b,a))}},actual:{get:function(){return this.ha},set:function(a){this.ha=isNaN(this.ad)?Math.max(Math.min(this.lh,a),this.nh):Math.max(Math.min(this.lh,
  this.ad),this.nh)}},measured:{get:function(){return this.bc},set:function(a){this.bc=a}},total:{get:function(){return this.ha+this.wc()},set:function(a){this.ha=isNaN(this.ad)?Math.max(Math.min(this.lh,a),this.nh):Math.max(Math.min(this.lh,this.ad),this.nh);this.ha=Math.max(0,this.ha-this.wc())}},position:{get:function(){return this.la},set:function(a){this.la=a}}});Vj.prototype.bind=Vj.prototype.bind;
  Vj.prototype.computeEffectiveSpacing=Vj.prototype.wc;Vj.prototype.computeEffectiveSpacingTop=Vj.prototype.Jv;var xn=new D(Vj,"Default",0),Km=new D(Vj,"None",1),bn=new D(Vj,"ProportionalExtra",2);Vj.className="RowColumnDefinition";Vj.Default=xn;Vj.None=Km;Vj.ProportionalExtra=bn;
  function Kf(){Y.call(this);this.Ed=this.na=null;this.Yn="None";this.ho=al;this.Hc=this.tl="black";this.wh=1;this.km="butt";this.lm="miter";this.gk=10;this.uh=null;this.vh=0;this.qf=this.pf=Vc;this.tp=this.sp=NaN;this.vo=!1;this.wp=null;this.ul=this.rm="None";this.Yd=1;this.Wd=0;this.Ud=1;this.Vd=null}ma(Kf,Y);
  Kf.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.na=this.na;a.Yn=this.Yn;a.ho=this.ho;a.Ed=this.Ed;a.tl=this.tl;a.Hc=this.Hc;a.wh=this.wh;a.km=this.km;a.lm=this.lm;a.gk=this.gk;null!==this.uh&&(a.uh=Ba(this.uh));a.vh=this.vh;a.pf=this.pf.H();a.qf=this.qf.H();a.sp=this.sp;a.tp=this.tp;a.vo=this.vo;a.wp=this.wp;a.rm=this.rm;a.ul=this.ul;a.Yd=this.Yd;a.Wd=this.Wd;a.Ud=this.Ud;a.Vd=this.Vd};t=Kf.prototype;
  t.jb=function(a){a===zg||a===Bg||a===dl||a===al?this.geometryStretch=a:Y.prototype.jb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+kb(this)};
  function yn(a,b,c,d){var e=c.length;if(!(4>e)){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,w=Ea(),v=2;v<e;v+=2)l=c[v],m=c[v+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),w.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Kf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;v=0;q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];for(var y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
  if(e>u){Ia(w);return}e>q?(y=e-q,e=q):y=0;var z=Math.sqrt(e*e/(1+p*p));0>n&&(z=-z);h+=z;k+=p*z;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===y&&d.ej(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==y){v++;if(v===w.length){Ia(w);return}q=w[v];n=q[0];r=q[1];p=q[2];q=q[3];e=y}}Ia(w)}}
  t.ej=function(a,b){var c=this.Hc,d=this.tl;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&oi(this,a,d,!0,!1,f,e);var g=this.part,h=this.wh;null===c||0!==h||null===g||!this.isPanelMain&&g.tb()!==this||(h=g.type===X.Link&&g instanceof Je&&"Selection"===g.category&&g.adornedObject instanceof Kf&&g.adornedPart.tb()===g.adornedObject?g.adornedObject.strokeWidth:0);0===h&&(c=null);null!==c&&0!==h&&(oi(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.lm,a.lineCap=this.km,
  a.miterLimit=this.gk);e=!1;g&&b.Ke("drawShadows")&&(e=g.isShadowed);g=!0;null===c||null!==d&&"transparent"!==d||(g=!1);f=!1;h=this.strokeDashArray;null!==h&&(f=!0,a.Ft(h,this.vh));var k=this.na;if(null!==k){if(k.type===ud)a.beginPath(),a.moveTo(k.startX,k.startY),a.lineTo(k.endX,k.endY),null!==c&&a.vj();else if(k.type===yd){var l=k.startX;h=k.startY;var m=k.endX,n=k.endY;k=Math.min(l,m);var p=Math.min(h,n);l=Math.abs(m-l);h=Math.abs(n-h);a.beginPath();a.rect(k,p,l,h);null!==d&&a.Je(d);if(null!==c){g&&
  e&&yl(a);if(0===l||0===h)a.beginPath(),a.rect(k,p,Math.max(l,.1),Math.max(h,.1));a.vj();g&&e&&xl(a)}}else if(k.type===zd)l=k.startX,h=k.startY,m=k.endX,n=k.endY,k=Math.abs(m-l)/2,p=Math.abs(n-h)/2,l=Math.min(l,m)+k,h=Math.min(h,n)+p,a.beginPath(),a.moveTo(l,h-p),a.bezierCurveTo(l+L.Kg*k,h-p,l+k,h-L.Kg*p,l+k,h),a.bezierCurveTo(l+k,h+L.Kg*p,l+L.Kg*k,h+p,l,h+p),a.bezierCurveTo(l-L.Kg*k,h+p,l-k,h+L.Kg*p,l-k,h),a.bezierCurveTo(l-k,h-L.Kg*p,l-L.Kg*k,h-p,l,h-p),a.closePath(),null!==d&&a.Je(d),null!==c&&
  (g&&e?(yl(a),a.vj(),xl(a)):a.vj());else if(k.type===sd)for(h=k.figures,k=h.length,p=0;p<k;p++){l=h.j[p];a.beginPath();a.moveTo(l.startX,l.startY);m=l.segments.j;n=m.length;for(var r=null,q=0;q<n;q++){var u=m[q];switch(u.type){case Zd:a.moveTo(u.endX,u.endY);break;case wd:a.lineTo(u.endX,u.endY);break;case $d:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case ae:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case be:if(u.radiusX===u.radiusY){var w=Math.PI/
  180;a.arc(u.point1X,u.point1Y,u.radiusX,u.startAngle*w,(u.startAngle+u.sweepAngle)*w,0>u.sweepAngle,null!==r?r.endX:l.startX,null!==r?r.endY:l.startY)}else if(r=de(u,l),w=r.length,0===w)a.lineTo(u.centerX,u.centerY);else for(var v=0;v<w;v++){var y=r[v];0===v&&a.lineTo(y[0],y[1]);a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[7])}break;case ce:v=w=0;if(null!==r&&r.type===be){r=de(r,l);y=r.length;if(0===y){a.lineTo(u.endX,u.endY);break}r=r[y-1]||null;null!==r&&(w=r[6],v=r[7])}else w=null!==r?r.endX:l.startX,
  v=null!==r?r.endY:l.startY;r=ee(u,l,w,v);w=r.length;if(0===w){a.lineTo(u.endX,u.endY);break}for(v=0;v<w;v++)y=r[v],a.bezierCurveTo(y[2],y[3],y[4],y[5],y[6],y[7]);break;default:B("Segment not of valid type: "+u.type)}u.isClosed&&a.closePath();r=u}m=l.isFilled;e?l.isShadowed?(!0===m&&"transparent"!==d&&null!==d&&a.Je(d),null!==c&&(m&&g&&yl(a),a.vj(),m&&g&&xl(a))):(yl(a),m&&"transparent"!==d&&null!==d&&a.Je(d),null!==c&&a.vj(),xl(a)):(m&&null!==d&&a.Je(d),null!==c&&a.vj())}f&&a.Dt();if(null!==this.pathPattern){c=
  this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);e=this.geometry;a.save();a.beginPath();d=Ea();if(e.type===ud)d.push(e.startX),d.push(e.startY),d.push(e.endX),d.push(e.endY),yn(a,b,d,c);else if(e.type===sd)for(e=e.figures.iterator;e.next();){g=e.value;d.length=0;d.push(g.startX);d.push(g.startY);f=g.startX;h=g.startY;k=f;p=h;l=g.segments.j;m=l.length;for(n=0;n<m;n++){q=l[n];switch(q.type){case Zd:yn(a,b,d,c);d.length=0;d.push(q.endX);d.push(q.endY);
  f=q.endX;h=q.endY;k=f;p=h;break;case wd:d.push(q.endX);d.push(q.endY);f=q.endX;h=q.endY;break;case $d:L.Fe(f,h,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);f=q.endX;h=q.endY;break;case ae:L.Vq(f,h,q.point1X,q.point1Y,q.endX,q.endY,.5,d);f=q.endX;h=q.endY;break;case be:u=de(q,g);r=u.length;if(0===r){d.push(q.centerX);d.push(q.centerY);f=q.centerX;h=q.centerY;break}for(w=0;w<r;w++)v=u[w],L.Fe(f,h,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),f=v[6],h=v[7];break;case ce:u=ee(q,g,f,h);r=u.length;
  if(0===r){d.push(q.endX);d.push(q.endY);f=q.endX;h=q.endY;break}for(w=0;w<r;w++)v=u[w],L.Fe(f,h,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),f=v[6],h=v[7];break;default:B("Segment not of valid type: "+q.type)}q.isClosed&&(d.push(k),d.push(p),yn(a,b,d,c))}yn(a,b,d,c)}else if(e.type===yd)d.push(e.startX),d.push(e.startY),d.push(e.endX),d.push(e.startY),d.push(e.endX),d.push(e.endY),d.push(e.startX),d.push(e.endY),d.push(e.startX),d.push(e.startY),yn(a,b,d,c);else if(e.type===zd){h=new je;h.startX=e.endX;h.startY=
  (e.startY+e.endY)/2;f=new ke(be);f.startAngle=0;f.sweepAngle=360;f.centerX=(e.startX+e.endX)/2;f.centerY=(e.startY+e.endY)/2;f.radiusX=Math.abs(e.startX-e.endX)/2;f.radiusY=Math.abs(e.startY-e.endY)/2;h.add(f);e=de(f,h);g=e.length;if(0===g)d.push(f.centerX),d.push(f.centerY);else for(f=h.startX,h=h.startY,k=0;k<g;k++)p=e[k],L.Fe(f,h,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),f=p[6],h=p[7];yn(a,b,d,c)}Ia(d);a.restore();a.uc(!1)}}}};
  t.da=function(a,b){void 0===b&&(b=new J);if(a instanceof O){a.nc()&&B("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.Fd.ta(b);return b};
  t.mj=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.Fd;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Jc(d/2,d/2);d=J.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);bc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);bc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);bc(a,d.x,d.y,0,0);N.free(b);J.free(d);return a};
  t.Kh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==ud||b||(e+=2);var f=N.alloc();f.assign(d);f.Jc(e+2,e+2);if(!f.$(a))return N.free(f),!1;d=e+1E-4;if(c.type===ud){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;N.free(f);return L.Nb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
  yd){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.Jc(-d,-d);if(f.$(a))return N.free(f),!1;f.Jc(d,d)}null!==this.stroke&&f.Jc(e,e);a=f.$(a);N.free(f);return a}if(c.type===zd){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===sd)return N.free(f),null===this.fill?he(c,a.x,a.y,e):fe(c,a,e,1<this.strokeWidth,b);B("Unknown Geometry type: "+c.type);return!1};
  t.Hm=function(a,b,c,d){var e=this.desiredSize,f=this.wh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Ed)var g=this.geometry.bounds;else{var h=this.figure,k=zn[h];if(void 0===k){var l=L.Qe[h];"string"===typeof l&&(l=L.Qe[l]);"function"===typeof l?(k=l(null,100,100),zn[h]=k):B("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(ql(this,!0)){case zg:d=c=0;break;case td:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case bl:l=Math.max(a-f,0);d=0;break;case cl:c=0,m=
  Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=Ag(this);switch(c){case zg:break;case td:h=l;k=m;break;case Bg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:B(c+" is not a valid geometryStretch.")}null!==this.Ed?(0===h&&(h=.001),0===k&&(k=.001),
  c=null!==this.Ed?this.Ed:this.na,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),this.na=1===d&&1===e?c:c.copy().scale(d,e)):null!==this.na&&L.aa(this.na.Dl,a-f)&&L.aa(this.na.Cl,b-f)||(this.na=Kf.makeGeometry(this,h,k));g=this.na.bounds;Infinity===a||Infinity===b?nl(this,g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):nl(this,-(f/2),-(f/2),l+f,m+f)};
  function Ag(a){var b=a.geometryStretch;return null!==a.Ed?b===al?td:b:b===al?zn[a.figure].defaultStretch:b}t.Ih=function(a,b,c,d){sl(this,a,b,c,d)};t.Nt=function(a,b,c){return this.zk(a.x,a.y,b.x,b.y,c)};
  t.zk=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);f=a*h+b*l+n;g=a*k+b*m+p;h=c*h+d*l+n;k=c*k+d*m+p;n=this.wh/2;l=this.na;null===l&&(this.measure(Infinity,Infinity),l=this.na);var r=l.bounds;m=!1;if(l.type===ud)if(1.5>=this.strokeWidth)m=L.Me(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=Ea();a=new J;L.Me(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;L.Me(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;L.Me(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;L.Me(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 Ia(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Ia(b)}else if(l.type===yd)m=L.Cf(r.x-n,r.y-n,r.x+r.width+
  n,r.y+r.height+n,f,g,h,k,e);else if(l.type===zd){b=N.allocAt(r.x,r.y,r.width,r.height).Jc(n,n);a:if(0===b.width)m=L.Me(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=L.Me(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.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))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>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)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}N.free(b)}else if(l.type===sd){p=J.alloc();var q=h-f;var u=k-g,w=q*q+u*u,v=f,y=g;if(0<w&&r.contains(v,y)&&(p.x=v,p.y=y,this.$(p)))for(0!==q&&.5>Math.abs(q)?(u*=.5/q,q=.5):0!==u&&.5>Math.abs(u)&&(q*=.5/u,u=.5),v-=q,y-=u;r.contains(v,
  y);)v-=q,y-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var z=l.figures.j[u],A=z.isFilled?v:f,C=z.isFilled?y:g,F=z.segments;r=z.startX;q=z.startY;for(var Q=r,K=q,T=0;T<F.count;T++){var P=F.j[T],I=P.type;var ja=P.endX;var ba=P.endY;var qa=!1;switch(I){case Zd:Q=ja;K=ba;break;case wd:qa=An(r,q,ja,ba,A,C,h,k,p);break;case $d:qa=L.wq(r,q,P.point1X,P.point1Y,P.point2X,P.point2Y,ja,ba,A,C,h,k,.6,p);break;case ae:qa=L.wq(r,q,r+2/3*(P.point1X-r),q+2/3*(P.point1Y-q),ja+2/3*(P.point1X-ja),ba+2/3*(P.point1Y-
  ba),ja,ba,A,C,h,k,.6,p);break;case be:case ce:I=P.type===be?de(P,z):ee(P,z,r,q);var Ma=I.length;if(0===Ma){qa=An(r,q,P.type===be?P.centerX:P.endX,P.type===be?P.centerY:P.endY,A,C,h,k,p);break}ba=null;for(ja=0;ja<Ma;ja++){ba=I[ja];if(0===ja&&An(r,q,ba[0],ba[1],A,C,h,k,p)){var eb=Kn(A,C,p,w,e);eb<w&&(w=eb,m=!0)}L.wq(ba[0],ba[1],ba[2],ba[3],ba[4],ba[5],ba[6],ba[7],A,C,h,k,.6,p)&&(eb=Kn(A,C,p,w,e),eb<w&&(w=eb,m=!0))}ja=ba[6];ba=ba[7];break;default:B("Unknown Segment type: "+I)}r=ja;q=ba;qa&&(qa=Kn(A,
  C,p,w,e),qa<w&&(w=qa,m=!0));P.isClosed&&(ja=Q,ba=K,An(r,q,ja,ba,A,C,h,k,p)&&(P=Kn(A,C,p,w,e),P<w&&(w=P,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;J.free(p)}else B("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ta(e);return!0};function Kn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}
  function An(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||L.aa(k.y,a))&&(k.y<b||L.aa(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||L.aa(k.x,b))&&(k.x<a||L.aa(k.x,a))&&(l=!0));return l}
  t.Jh=function(a,b){if(void 0===b)return a.Ge(this.actualBounds);var c=this.na;null===c&&(this.measure(Infinity,Infinity),c=this.na);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.$(b.ta(f))&&(f.h(c.x-d,c.bottom+d),a.$(b.ta(f))&&(f.h(c.right+d,c.bottom+d),a.$(b.ta(f))&&(f.h(c.right+d,c.y-d),a.$(b.ta(f))&&(e=!0))));J.free(f);return e};
  t.Mc=function(a,b){if(this.Jh(a,b)||void 0===b&&(b=this.transform,a.Ge(this.actualBounds)))return!0;var c=ld.alloc();c.set(b);c.St();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.ta(g);if(this.Kh(g,!0))return J.free(g),!0;g.h(e,f);c.ta(g);if(this.Kh(g,!0))return J.free(g),!0;g.h(d,a);c.ta(g);if(this.Kh(g,!0))return J.free(g),!0;g.h(e,a);c.ta(g);if(this.Kh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.jw(this.transform);c.St();h.x=e;h.y=f;h.transform(c);g.x=
  d;g.y=f;g.transform(c);b=!1;Ln(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Ln(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Ln(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Ln(this,g,h,k)&&(b=!0))));J.free(g);ld.free(c);J.free(h);J.free(k);return b};function Ln(a,b,c,d){if(!a.Nt(b,c,d))return!1;a=b.x;b=b.y;var e=c.x,f=c.y;c=d.x;d=d.y;if(a===e)return b<f?(a=b,b=f):a=f,d>=a&&d<=b;a<e?(d=a,a=e):d=e;return c>=d&&c<=a}
  t.sy=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.qd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Kh(a,!0))return!0;var e=a.Ie(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.na;if(null===b&&(this.measure(Infinity,Infinity),b=this.na,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(yb(a.x,a.y,h,k)<=e&&yb(a.x,a.y,l,k)<=e&&yb(a.x,a.y,h,g)<=e&&yb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
  b.endX;g=b.endY;if(b.type===ud){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),xb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===yd)return b=!1,c&&(b=xb(a.x,a.y,h,k,h,g)<=e||xb(a.x,a.y,h,k,l,k)<=e||xb(a.x,a.y,l,k,l,g)<=e||xb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===zd){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return xb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=L.Mz(m,n,b,f),a*a<=e)return!0}else return yb(b,f,-m,0)>=e||yb(b,f,0,-n)>=e||yb(b,
  f,0,n)>=e||yb(b,f,m,0)>=e?!1:!0}else if(b.type===sd){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.x<f&&a.y>l&&a.y<h&&xb(a.x,a.y,f,h,f,l)>e&&xb(a.x,a.y,f,h,k,h)>e&&xb(a.x,a.y,k,l,f,l)>e&&xb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?he(b,a.x,a.y,f):fe(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.qd(g,m)>e)return!1;h=f.segments.j;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Zd:case wd:g=n.endX;
  m=n.endY;if(a.qd(g,m)>e)return!1;break;case $d:var p=Ea();L.Fe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Ia(p);if(g)return!1;g=n.endX;m=n.endY;if(a.qd(g,m)>e)return!1;break;case ae:p=Ea();L.Vq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Ia(p);if(g)return!1;g=n.endX;m=n.endY;if(a.qd(g,m)>e)return!1;break;case be:case ce:p=n.type===be?de(n,f):ee(n,f,g,m);var r=p.length;if(0===r){g=n.type===be?n.centerX:n.endX;m=n.type===be?n.centerY:n.endY;if(a.qd(g,m)>e)return!1;
  break}n=null;for(var q=Ea(),u=0;u<r;u++)if(n=p[u],q.length=0,L.Fe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Ia(q),!1;Ia(q);null!==n&&(g=n[6],m=n[7]);break;default:B("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.dc=function(){this.na=null};function Mn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Zm,"None"!==a.rm?(a.segmentIndex=-1,a.alignmentFocus=dd):"None"!==a.ul&&(a.segmentIndex=0,a.alignmentFocus=new O(1-dd.x,dd.y)))}
  Kf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Nn[a.toArrow];else"None"!==a.fromArrow?d=Nn[a.fromArrow]:(d=L.Qe[a.figure],"string"===typeof d&&(d=L.Qe[d]),void 0===d&&B("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.Dl=b,d.Cl=c);if(null===d){var e=L.Qe.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
  function On(a){var b=Nn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Nn[c];if(void 0===b){var d=null,e;for(e in L.dn)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Dd(L.dn[d],!1),Nn[d]=a,c!==d&&(Nn[c]=d),d}}return"string"===typeof b?b:b instanceof rd?a:null}
  na.Object.defineProperties(Kf.prototype,{geometry:{get:function(){return null!==this.na?this.na:this.Ed},set:function(a){var b=this.na,c=this.Ed;if(b!==a){null!==a?this.Ed=this.na=a.freeze():this.Ed=this.na=null;var d=this.part;null!==d&&(d.kh=NaN);this.s();this.g("geometry",b||c,a);kl(this)&&(a=this.part,null!==a&&ll(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
  Dd(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.free(a)}},isGeometryPositioned:{get:function(){return this.vo},set:function(a){var b=this.vo;b!==a&&(this.vo=a,this.s(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.tl},set:function(a){var b=this.tl;b!==a&&(null!==a&&Wl(a,"Shape.fill"),a instanceof zl&&a.freeze(),this.tl=a,this.M(),this.g("fill",b,a))}},stroke:{
  get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Wl(a,"Shape.stroke"),a instanceof zl&&a.freeze(),this.Hc=a,this.M(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.wh},set:function(a){var b=this.wh;if(b!==a)if(0<=a){this.wh=a;this.s();var c=this.part;null!==c&&(c.kh=NaN);this.g("strokeWidth",b,a)}else wa(a,"value >= 0",Kf,"strokeWidth:value")}},strokeCap:{get:function(){return this.km},set:function(a){var b=
  this.km;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?wa(a,'"butt", "round", or "square"',Kf,"strokeCap"):(this.km=a,this.M(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.lm},set:function(a){var b=this.lm;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?wa(a,'"miter", "bevel", or "round"',Kf,"strokeJoin"):(this.lm=a,this.M(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.gk},
  set:function(a){var b=this.gk;if(b!==a&&1<=a){this.gk=a;this.M();var c=this.part;null!==c&&(c.kh=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.uh},set:function(a){var b=this.uh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];0<=f&&isFinite(f)||B("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.uh=a;this.M();this.g("strokeDashArray",
  b,a)}}},strokeDashOffset:{get:function(){return this.vh},set:function(a){var b=this.vh;b!==a&&0<=a&&(this.vh=a,this.M(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Yn},set:function(a){var b=this.Yn;if(b!==a){var c=L.Qe[a];"function"===typeof c?c=a:(c=L.Qe[a.toLowerCase()])||B("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.kh=NaN),this.Yn=c,this.Ed=null,this.dc(),this.s(),this.g("figure",b,c))}}},toArrow:{
  get:function(){return this.rm},set:function(a){var b=this.rm;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=On(a);null===c?B("Unknown Shape.toArrow: "+a):b!==c&&(this.rm=c,this.Ed=null,this.dc(),this.s(),Mn(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.ul},set:function(a){var b=this.ul;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=On(a);null===c?B("Unknown Shape.fromArrow: "+a):b!==c&&(this.ul=c,this.Ed=null,this.dc(),this.s(),
  Mn(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.pf},set:function(a){var b=this.pf;b.w(a)||(this.pf=a=a.H(),this.s(),this.g("spot1",b,a))}},spot2:{get:function(){return this.qf},set:function(a){var b=this.qf;b.w(a)||(this.qf=a=a.H(),this.s(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(this.sp=a,this.dc(),this.s(),this.g("parameter1",
  b,a))}},parameter2:{get:function(){return this.tp},set:function(a){var b=this.tp;b!==a&&(this.tp=a,this.dc(),this.s(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){var a=this.desiredSize;return a.o()||null===this.na?new N(0,0,a.width,a.height):(this.rc.assign(this.na.bounds),this.rc)}},pathPattern:{get:function(){return this.wp},set:function(a){var b=this.wp;b!==a&&(this.wp=a,this.M(),this.g("pathPattern",
  b,a))}},geometryStretch:{get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(this.ho=a,this.s(),this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Yd},set:function(a){var b=this.Yd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Yd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&qj(c);this.s();c=this.panel;null!==c&&(c.eh=null);this.g("interval",b,a)}}},graduatedStart:{
  get:function(){return this.Wd},set:function(a){var b=this.Wd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Wd=a,this.s(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==a&&(0>a?a=0:1<a&&(a=1),this.Ud=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Vd},set:function(a){var b=this.Vd;b!==a&&(this.Vd=a,this.s(),this.g("graduatedSkip",b,a))}}});
  Kf.prototype.intersectsRect=Kf.prototype.Mc;Kf.prototype.containedInRect=Kf.prototype.Jh;Kf.prototype.getNearestIntersectionPoint=Kf.prototype.Nt;Kf.prototype.getDocumentBounds=Kf.prototype.mj;Kf.prototype.getDocumentPoint=Kf.prototype.da;var Nn=new $a,zn=new $a;Kf.className="Shape";Kf.getFigureGenerators=function(){var a=new H,b;for(b in L.Qe)b!==b.toLowerCase()&&a.add(b,L.Qe[b]);a.freeze();return a};Kf.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=L.Qe;d[a]=b;d[c]=a};
  Kf.getArrowheadGeometries=function(){var a=new H;for(d in L.dn)if(void 0===Nn[d]){var b=Dd(L.dn[d],!1);Nn[d]=b;b=d.toLowerCase();b!==d&&(Nn[b]=d)}for(var c in Nn)if(c!==c.toLowerCase()){var d=Nn[c];d instanceof rd&&a.add(c,d)}a.freeze();return a};Kf.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=Dd(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||B("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Nn;d[a]=c;d[b]=a};
  function Wg(){Y.call(this);Pn||(Qn=Ug?(new Hk(null)).context:null,Pn=!0);this.Jx=this.Ub="";this.Hc="black";this.ne="13px sans-serif";this.Vi="start";this.Td=zg;this.aj=$c;this.Pj=!0;this.Ai=this.Bi=!1;this.mg=Rn;this.zg=Sn;this.us=this.vb=this.Zc=0;this.ev=this.fv=null;this.Vn=!1;this.ld=this.xn=this.iq=this.Wi=this.jq=null;this.nf=this.mf=0;this.ti=Tn;this.ve=Infinity;this.Ei=0;this.oe=null;this.Be=0;this.me=this.lb=this.Qb=null;this.Yd=1;this.Wd=0;this.Ud=1;this.Vd=this.Lj=null}ma(Wg,Y);
  Wg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Ub=this.Ub;a.Jx=this.Jx;a.Hc=this.Hc;a.ne=this.ne;a.Vi=this.Vi;a.Td=this.Td;a.aj=this.aj;a.Pj=this.Pj;a.Bi=this.Bi;a.Ai=this.Ai;a.mg=this.mg;a.zg=this.zg;a.Zc=this.Zc;a.us=this.us;a.vb=this.vb;a.fv=this.fv;a.ev=this.ev;a.Vn=this.Vn;a.jq=this.jq;a.Wi=this.Wi;a.iq=this.iq;a.xn=this.xn;a.ld=this.ld;a.mf=this.mf;a.nf=this.nf;a.ti=this.ti;a.ve=this.ve;a.oe=this.oe;a.Be=this.Be;a.Qb=this.Qb;a.lb=this.lb;a.me=this.me;a.Ei=
  this.Ei;a.Yd=this.Yd;a.Wd=this.Wd;a.Ud=this.Ud;a.Lj=this.Lj;a.Vd=this.Vd};
  function Ym(a,b){a.F=b.F|6144;a.hb=b.opacity;a.mb=b.background;a.ec=b.areaBackground;a.Xc=b.desiredSize.H();a.fg=b.minSize.H();a.eg=b.maxSize.H();a.cg=b.cg.copy();a.Aa=b.scale;a.Yb=b.angle;a.De=b.stretch;a.jh=b.margin.H();a.yb=b.alignment.H();a.$k=b.alignmentFocus.H();a.am=b.segmentFraction;a.bm=b.segmentOffset.H();a.cm=b.segmentOrientation;null!==b.Za&&(a.Za=b.Za.copy());a.em=b.shadowVisible;b instanceof Wg&&(a.Ub=b.Ub,a.Hc=b.Hc,a.ne=b.ne,a.Vi=b.Vi,a.Td=b.Td,a.aj=b.aj,a.Pj=b.Pj,a.Bi=b.Bi,a.Ai=b.Ai,
  a.mg=b.mg,a.zg=b.zg,a.oe=null,a.mf=b.mf,a.nf=b.nf,a.ve=b.ve,a.Ei=b.Ei,a.Yd=b.Yd,a.Wd=b.Wd,a.Ud=b.Ud,a.Lj=b.Lj,a.Vd=b.Vd)}t=Wg.prototype;t.jb=function(a){a.classType===Wg?this.wrap=a:Y.prototype.jb.call(this,a)};t.toString=function(){return 22<this.Ub.length?'TextBlock("'+this.Ub.substring(0,20)+'"...)':'TextBlock("'+this.Ub+'")'};t.s=function(){Y.prototype.s.call(this);this.ev=this.fv=null};
  t.ej=function(a,b){if(null!==this.Hc&&0!==this.Ub.length&&null!==this.ne){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=Un(this),h=a.textAlign=this.Vi,k=b.Gl;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.Bi;var l=this.Ai;oi(this,a,this.Hc,!0,!1,c,d);(k||l)&&oi(this,a,this.Hc,!1,!1,c,d);d=0;c=!1;var m=J.allocAt(0,0);this.Fd.ta(m);var n=J.allocAt(0,g);this.Fd.ta(n);var p=m.Ie(n);J.free(m);J.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Gb!==a&&(c=!1);!1===b.Ke("textGreeking")&&
  (c=!1);b=this.mf;p=this.nf;switch(this.flip){case fl:a.translate(e,0);a.scale(-1,1);break;case el:a.translate(0,f);a.scale(1,-1);break;case gl:a.translate(e,f),a.scale(-1,-1)}m=this.Zc;n=(b+g+p)*m;f>n&&(d=this.aj,d=d.y*f-d.y*n+d.offsetY);if(1===m&&null!==this.me)p=this.vb,p>e&&(p=e),this.dj(this.me,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Qb&&null!==this.lb)for(n=0;n<m;n++){var r=this.Qb[n];r>e&&(r=e);d+=b;this.dj(this.lb[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case fl:a.scale(-1,1);a.translate(-e,
  0);break;case el:a.scale(1,-1);a.translate(0,-f);break;case gl:a.scale(-1,-1),a.translate(-e,-f)}}};
  t.dj=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==Vn?Vn(this,f):.75*f,b.fillText(a,c+n,d+e),a=f/20|0,0===a&&(a=1),"right"===k?n-=g:"center"===k&&(n-=g/2),l&&(k=null!==Wn?Wn(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
  n+g,d),b.stroke()))};
  t.Hm=function(a,b,c,d){this.Ei=a;var e=this.ne;null!==Qn&&Xn!==e&&(Xn=Qn.font=e);this.vb=this.Be=0;this.me=this.lb=this.Qb=this.oe=null;var f;if(isNaN(this.desiredSize.width)){e=this.Ub.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);g=e.substr(g,k-g);this.ti===Tn&&(g=g.trim());f=Math.max(f,Yn(g));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Yn(e);e=Math.min(e,a/this.scale);
  e=Math.max(8,e)}else e=this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=Zn(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==this.vb&&null!==this.Qb&&null!==this.lb&&this.mg===$n&&(b=this.ne,b=this.mg===$n?ao(b):0,k=this.mf+this.nf,k=Math.max(0,Un(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=this.lb.length))){k=this.lb[h];for(b=Math.max(1,a-b);Yn(k)>b&&1<k.length;)k=k.substr(0,
  k.length-1);k+=bo;b=Yn(k);this.lb[h]=k;this.lb=this.lb.slice(0,h+1);this.Qb[h]=b;this.Qb=this.Qb.slice(0,h+1);this.Be=this.lb.length;this.vb=Math.max(this.vb,b);this.Zc=this.Be;1===this.Zc&&(this.me=this.lb[0])}if(this.wrap===co||isNaN(this.desiredSize.width))e=isNaN(a)?this.vb:Math.min(a,this.vb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Sb(this.rc,e,f);nl(this,0,0,e,f)};t.Ih=function(a,b,c,d){sl(this,a,b,c,d)};
  function eo(a,b,c){if(null===a.me)a.me=b,a.vb=c;else{if(null===a.lb||null===a.Qb)a.lb=[],a.Qb=[],a.lb.push(a.me),a.Qb.push(a.vb);a.lb.push(b);a.Qb.push(c)}}
  function fo(a,b,c,d){var e=a.ti===Tn;e&&(b=b.trim());var f=0,g=a.ne,h=a.mf+a.nf;h=Math.max(0,Un(a)+h);var k=a.mg===$n?ao(g):0;if(a.Zc>=a.ve)null!==d&&d.h(0,h);else if(g=b,a.zg===go){a.Be=1;var l=Yn(b);if(0===k||l<=c)a.vb=Math.max(a.vb,l),eo(a,b,a.vb),null!==d&&d.h(l,h);else{f=ho(a,g);g=g.substr(f.length);b=ho(a,g);for(l=Yn(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=ho(a,g),l=f+b,e&&(l=l.trim()),l=Yn(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);Yn(f)>c&&1<f.length;)f=f.substr(0,f.length-1);
  f+=bo;var m=Yn(f);a.vb=m;eo(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,eo(a,g,0));for(;0<g.length;){b=ho(a,g);for(g=g.substr(b.length);Yn(b)>c;){var n=1;l=Yn(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=Yn(b.substr(0,n));if(1===n){var p=l;f=Math.max(f,l)}else p=m,f=Math.max(f,m);n--;1>n&&(n=1);eo(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.Zc+k>a.ve)break}m=ho(a,g);for(l=Yn(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=ho(a,g),l=b+m,e&&(l=l.trim()),l=Yn(l);e&&(b=b.trim());if(""!==b&&("\u00ad"===
  b[b.length-1]&&(b=b.substring(0,b.length-1)+"\u2010"),0===m.length?(n=l,f=Math.max(f,l)):(n=m=Yn(b),f=Math.max(f,m)),eo(a,b,n),k++,a.Zc+k>a.ve))break}a.Be=Math.min(a.ve,k);a.vb=Math.max(a.vb,f);null!==d&&d.h(a.vb,h*a.Be)}}function ho(a,b){if(a.zg===io)return b.substr(0,1);for(var c=b.length,d=0,e=jo;d<c&&!e.test(b.charAt(d));)d++;for(a.ti===ko&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function Yn(a){return null===Qn?8*a.length:Qn.measureText(a).width}
  function Un(a){if(null!==a.oe)return a.oe;var b=a.ne;if(null===Qn){var c=16;return a.oe=c}void 0!==lo[b]&&5E3>mo?c=lo[b]:(c=1.3*Qn.measureText("M").width,lo[b]=c,mo++);return a.oe=c}function ao(a){if(null===Qn)return 6;if(void 0!==no[a]&&5E3>oo)var b=no[a];else b=Qn.measureText(bo).width,no[a]=b,oo++;return b}
  function Zn(a,b){var c=a.Ub.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.mf+a.nf;d=Math.max(0,Un(a)+d);if(0===c.length)return a.vb=0,a.Zc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Zc=0,g,h=!1;!h;){g=c.indexOf("\n",f);-1===g&&(g=c.length,h=!0);if(f<=g){f=c.substr(f,g-f);if(a.zg!==go){a.Be=0;var k=M.alloc();fo(a,f,b,k);e+=k.height;M.free(k);a.Zc+=a.Be}else fo(a,f,b,null),e+=d,a.Zc++;a.Zc===a.ve&&(h=!0)}f=g+1}return a.us=e}
  na.Object.defineProperties(Wg.prototype,{font:{get:function(){return this.ne},set:function(a){var b=this.ne;b!==a&&(this.ne=a,this.oe=null,this.s(),this.g("font",b,a))}},text:{get:function(){return this.Ub},set:function(a){var b=this.Ub;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Ub=a,this.s(),this.g("text",b,a))}},textAlign:{get:function(){return this.Vi},set:function(a){var b=this.Vi;b===a||"start"!==
  a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.Vi=a,this.M(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(this.Td=a,this.M(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.aj},set:function(a){var b=this.aj;b.w(a)||(this.aj=a=a.H(),Il(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.rc.o()){var a=
  M.alloc();fo(this,this.Ub,999999,a);var b=a.width;M.free(a);a=Zn(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Sb(this.rc,b,a)}return this.rc}},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.Bi},set:function(a){var b=this.Bi;b!==a&&(this.Bi=a,this.M(),this.g("isUnderline",b,
  a))}},isStrikethrough:{get:function(){return this.Ai},set:function(a){var b=this.Ai;b!==a&&(this.Ai=a,this.M(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.zg},set:function(a){var b=this.zg;b!==a&&(this.zg=a,this.s(),this.g("wrap",b,a))}},overflow:{get:function(){return this.mg},set:function(a){var b=this.mg;b!==a&&(this.mg=a,this.s(),this.g("overflow",b,a))}},stroke:{
  get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(null!==a&&Wl(a,"TextBlock.stroke"),a instanceof zl&&a.freeze(),this.Hc=a,this.M(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Zc}},editable:{get:function(){return this.Vn},set:function(a){var b=this.Vn;b!==a&&(this.Vn=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.jq},set:function(a){var b=this.jq;b!==a&&
  (this.jq=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.ld},set:function(a){var b=this.ld;b!==a&&(this.ld=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Yd},set:function(a){var b=this.Yd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Yd=a;this.s();var c=this.panel;null!==c&&(c.eh=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Wd},
  set:function(a){var b=this.Wd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Wd=a,this.s(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==a&&(0>a?a=0:1<a&&(a=1),this.Ud=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.Lj},set:function(a){var b=this.Lj;b!==a&&(this.Lj=a,this.s(),this.g("graduatedFunction",b,a))}},graduatedSkip:{
  get:function(){return this.Vd},set:function(a){var b=this.Vd;b!==a&&(this.Vd=a,this.s(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.Wi},set:function(a){var b=this.Wi;b!==a&&(this.Wi=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.iq},set:function(a){var b=this.iq;b!==a&&(this.iq=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return this.mf},set:function(a){var b=
  this.mf;b!==a&&(this.mf=a,this.s(),this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.nf},set:function(a){var b=this.nf;b!==a&&(this.nf=a,this.s(),this.g("spacingBelow",b,a))}},formatting:{get:function(){return this.ti},set:function(a){var b=this.ti;b!==a&&(this.ti=a,this.s(),this.g("formatting",b,a))}},maxLines:{get:function(){return this.ve},set:function(a){var b=this.ve;b!==a&&(a=Math.floor(a),
  0>=a&&wa(a,"> 0",Wg,"maxLines"),this.ve=a,this.s(),this.g("maxLines",b,a))}},metrics:{get:function(){return{arrSize:null!==this.Qb?this.Qb:[this.vb],arrText:null!==this.lb?this.lb:[this.me],maxLineWidth:this.vb,fontHeight:this.oe}}},choices:{get:function(){return this.xn},set:function(a){var b=this.xn;b!==a&&(this.xn=a,this.g("choices",b,a))}}});
  var Vn=null,Wn=null,go=new D(Wg,"None",0),co=new D(Wg,"WrapFit",1),Sn=new D(Wg,"WrapDesiredSize",2),io=new D(Wg,"WrapBreakAll",3),Rn=new D(Wg,"OverflowClip",0),$n=new D(Wg,"OverflowEllipsis",1),Tn=new D(Wg,"FormatTrim",0),ko=new D(Wg,"FormatNone",0),jo=/[ \u200b\u00ad]/,lo=new $a,mo=0,no=new $a,oo=0,bo="...",Xn="",Qn=null,Pn=!1;Wg.className="TextBlock";Wg.getEllipsis=function(){return bo};Wg.setEllipsis=function(a){bo=a;no=new $a;oo=0};Wg.getBaseline=function(){return Vn};
  Wg.setBaseline=function(a){Vn=a};Wg.getUnderline=function(){return Wn};Wg.setUnderline=function(a){Wn=a};Wg.isValidFont=function(a){Pn||(Qn=Ug?(new Hk(null)).context:null,Pn=!0);if(null===Qn)return!0;var b=Qn.font;if(a===b||"10px sans-serif"===a)return!0;Qn.font="10px sans-serif";Qn.font=a;var c=Qn.font;if("10px sans-serif"!==c)return Qn.font=b,!0;Qn.font="19px serif";var d=Qn.font;Qn.font=a;c=Qn.font;Qn.font=b;return c!==d};Wg.None=go;Wg.WrapFit=co;Wg.WrapDesiredSize=Sn;Wg.WrapBreakAll=io;
  Wg.OverflowClip=Rn;Wg.OverflowEllipsis=$n;function po(){this.Qb=[];this.lb=[]}po.prototype.reset=function(){this.Qb=[];this.lb=[]};po.prototype.gy=function(a){this.Qb=Ba(a.Qb);this.lb=Ba(a.lb)};po.className="TextBlockMetrics";function dk(){Y.call(this);this.Zg=null;this.$p="";this.th=jc;this.yl=td;this.xh=this.ld=null;this.xl=zc;this.Td=zg;this.nm=null;this.uo=!1;this.Yr=!0;this.Ol=!1;this.gm=null}ma(dk,Y);
  dk.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Zg;a.$p=this.$p;a.th=this.th.H();a.yl=this.yl;a.Td=this.Td;a.ld=this.ld;a.xh=this.xh;a.xl=this.xl.H();a.Yr=this.Yr;a.gm=this.gm};dk.prototype.jb=function(a){a===zg||a===Bg||a===dl?this.imageStretch=a:Y.prototype.jb.call(this,a)};dk.prototype.toString=function(){return"Picture("+this.source+")#"+kb(this)};function Hi(a){void 0===a&&(a="");""!==a?qo[a]&&(delete qo[a],ro--):(qo=new $a,ro=0)}
  function so(a,b){b.fz||(b.dv=function(c){b.ls=!0;b.ro=!1;var d=b.Wg.copy();if(null!==d&&void 0!==d){for(d=d.iterator;d.next();){var e=d.value;var f=b.getAttribute("src");var g=e.pg.G(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.Wl.add(f),e.Db(),b.io&&(void 0===b.ov&&(b.ov=c),null!==f.xh&&f.xh(f,c))}b.Wg=null}a.desiredSize.o()||(pj(a,!1),a.s())},b.Pu=function(a){b.ro=a;var c=b.Wg.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src");var g=e.pg.G(f);
  if(null!==g){e=g.length;f=Ea();for(var h=0;h<e;h++)f.push(g[h]);if(b.io)for(h=0;h<e;h++)g=f[h],null!==g.ld&&g.ld(g,a);Ia(f)}}b.Wg=null}},b.addEventListener("load",b.dv),b.addEventListener("error",b.Pu),b.fz=!0)}function fk(a){a.removeEventListener("load",a.dv);a.removeEventListener("error",a.Pu);delete a.dv;delete a.Pu}dk.prototype.QA=function(){if(""!==this.source){Hi(this.source);var a=this.source;this.source="";this.source=a}};dk.prototype.redraw=function(){this.M()};
  dk.prototype.ej=function(a,b){var c=this.Zg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.ro instanceof Event&&a instanceof Dl)){d=this.naturalBounds;var e=0,f=0,g=this.uo,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.o()&&(e=this.th.x,f=this.th.y,h=this.th.width,g=this.th.height);
  var m=h,n=g,p=this.yl,r=this.xl;switch(p){case zg:if(this.sourceRect.o())break;m>=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 td:m=d.width;n=d.height;break;case Bg:case dl:p===Bg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===dl&&(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.Af()*b.scale;var q=m*p*n*p,u=h*g/q,w=c.__goCache;p=null;var v=to;if(c.ls&&void 0!==w&&4<q&&u>v*v)for(null===w.cj&&(uo(w,4,k,l,c),uo(w,16,k,l,c)),k=w.cj,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.rl){if(null===this.nm)if(null===this.Zg)this.nm=!1;else{k=(new Hk(null)).context;k.drawImage(this.Zg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.nm=!1),this.nm=!1}catch(y){this.nm=!0}}if(this.nm)return}k=0;m<d.width&&
  (k=r.offsetX+(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case fl:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case el:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case gl:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Ke("pictureRatioOptimization")&&!b.yi&&void 0!==w&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/b),k,l,
  Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.Yr=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(y){this.Yr=!1}switch(this.flip){case fl:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case el:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case gl:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
  dk.prototype.Hm=function(a,b,c,d){var e=this.desiredSize,f=ql(this,!0),g=this.Zg,h=this.uo;if(h||!this.Ol&&g&&g.complete)this.Ol=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===td||f===bl?(isFinite(a)||(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.Ol&&(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===td||f===cl?(isFinite(b)||(b=this.sourceRect.o()?this.sourceRect.height:
  h?+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.Ol&&(b=this.sourceRect.o()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));Sb(this.rc,a,b);nl(this,0,0,a,b)};dk.prototype.Ih=function(a,b,c,d){sl(this,a,b,c,d)};
  na.Object.defineProperties(dk.prototype,{element:{get:function(){return this.Zg},set:function(a){var b=this.Zg;if(b!==a){this.uo=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;b instanceof HTMLImageElement&&fk(b);null===a||c||a instanceof HTMLVideoElement||this.uo||B("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&ek(d,this);this.Zg=a;null!==a&&c&&void 0===a.Wg&&(a.Wg=new G);null!==d&&c&&ck(d,
  this);null!==a&&(this.uo||!0===a.complete?(a.io&&(a.ro instanceof Event&&null!==this.ld?this.ld(this,a.ro):!0===a.ls&&!a.ro&&null!==this.xh&&a.ov&&this.xh(this,a.ov)),a.ls=!0,this.desiredSize.o()||(pj(this,!1),this.s())):c&&so(this,a));this.g("element",b,a);this.M()}}},source:{get:function(){return this.$p},set:function(a){var b=this.$p;if(b!==a){this.$p=a;var c=qo;if(Ug){var d=null;if(void 0!==c[a])d=c[a];else if(""!==a){30<ro&&(Hi(),c=qo);d=ua("img");d.io=!0;so(this,
  d);var e=this.gm;null!==e&&(d.crossOrigin=e(this));d.src=a;c[a]=d;ro++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new vo);this.s();this.M()}this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.gm},set:function(a){if(this.gm!==a&&(this.gm=a,null!==this.element)){var b=this.element.getAttribute("src");null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}}},sourceRect:{
  get:function(){return this.th},set:function(a){var b=this.th;b.w(a)||(this.th=a=a.H(),this.M(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.yl},set:function(a){var b=this.yl;b!==a&&(this.yl=a,this.M(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(this.Td=a,this.M(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.xl},
  set:function(a){var b=this.xl;b.w(a)||(this.xl=a=a.H(),this.M(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.ld},set:function(a){var b=this.ld;b!==a&&(this.ld=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.xh},set:function(a){var b=this.xh;b!==a&&(this.xh=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.rc}}});
  dk.prototype.redraw=dk.prototype.redraw;dk.prototype.reloadSource=dk.prototype.QA;var qo=null,ro=0,to=4;dk.className="Picture";qo=new $a;dk.clearCache=Hi;function vo(){this.cj=null}function uo(a,b,c,d,e){null===a.cj&&(a.cj=[]);var f=new Hk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new wo(f.Ja,b),c=1,0<a.cj.length&&(c=a.cj[a.cj.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.cj.push(b))}vo.className="PictureCacheArray";
  function wo(a,b){this.source=a;this.ratio=b}wo.className="PictureCacheInstance";function xo(){this.Kt=new rd;this.ic=null}xo.prototype.reset=function(a){null!==a?(a.ea(),this.Kt=a,a.figures.clear()):this.Kt=new rd;this.ic=null};function Gd(a,b,c,d,e){a.ic=new je;a.ic.startX=b;a.ic.startY=c;a.ic.isFilled=d;a.Kt.figures.add(a.ic);void 0!==e&&(a.ic.isShadowed=e)}function Vd(a){var b=a.ic.segments.length;0<b&&a.ic.segments.J(b-1).close()}xo.prototype.Ym=function(a){this.ic.isShadowed=a};
  xo.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new ke(Zd);d.endX=a;d.endY=b;c&&d.close();this.ic.segments.add(d)};xo.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new ke(wd);d.endX=a;d.endY=b;c&&d.close();this.ic.segments.add(d)};function Hd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new ke($d);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.ic.segments.add(k)}
  function Id(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new ke(ae);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.ic.segments.add(g)}xo.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new ke(be);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.ic.segments.add(h)};function Ud(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new ke(ce,g,h,b,c,d,e,f);k&&b.close();a.ic.segments.add(b)}
  function Fd(a){var b=Wd;if(null!==b)return Wd=null,b.reset(a),b;b=new xo;b.reset(a);return b}var Wd=null;xo.className="StreamGeometryContext";function yo(a,b){var c=a.toLowerCase(),d=L.Qe;d[a]=b;d[c]=a}yo("Rectangle",function(a,b,c){a="r"+b+","+c;var d=L.Uh[a];if(void 0!==d)return d;d=new rd(yd);d.endX=b;d.endY=c;50>L.Vh&&(L.Uh[a]=d,L.Vh++);return d});
  yo("Square",function(a,b,c){a="s"+b+","+c;var d=L.Uh[a];if(void 0!==d)return d;d=new rd(yd);d.endX=b;d.endY=c;d.defaultStretch=Bg;50>L.Vh&&(L.Uh[a]=d,L.Vh++);return d});
  yo("RoundedRectangle",function(a,b,c){var d=a?a.parameter1:NaN;if(isNaN(d)||0>d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*L.Kg;b=(new rd).add((new je(d,0,!0)).add(new ke(wd,b-d,0)).add(new ke($d,b,d,b-a,0,b,a)).add(new ke(wd,b,c-d)).add(new ke($d,b-d,c,b,c-a,b-a,c)).add(new ke(wd,d,c)).add(new ke($d,0,c-d,a,c,0,c-a)).add(new ke(wd,0,d)).add((new ke($d,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new O(0,0,a,a),b.spot2=new O(1,1,-a,-a));return b});yo("Border","RoundedRectangle");
  yo("Ellipse",function(a,b,c){a="e"+b+","+c;var d=L.Uh[a];if(void 0!==d)return d;d=new rd(zd);d.endX=b;d.endY=c;d.spot1=fd;d.spot2=gd;50>L.Vh&&(L.Uh[a]=d,L.Vh++);return d});yo("Circle",function(a,b,c){a="c"+b+","+c;var d=L.Uh[a];if(void 0!==d)return d;d=new rd(zd);d.endX=b;d.endY=c;d.spot1=fd;d.spot2=gd;d.defaultStretch=Bg;50>L.Vh&&(L.Uh[a]=d,L.Vh++);return d});yo("TriangleRight",function(a,b,c){return(new rd).add((new je(0,0)).add(new ke(wd,b,.5*c)).add((new ke(wd,0,c)).close())).Zm(0,.25,.5,.75)});
  yo("TriangleDown",function(a,b,c){return(new rd).add((new je(0,0)).add(new ke(wd,b,0)).add((new ke(wd,.5*b,c)).close())).Zm(.25,0,.75,.5)});yo("TriangleLeft",function(a,b,c){return(new rd).add((new je(b,c)).add(new ke(wd,0,.5*c)).add((new ke(wd,b,0)).close())).Zm(.5,.25,1,.75)});yo("TriangleUp",function(a,b,c){return(new rd).add((new je(b,c)).add(new ke(wd,0,c)).add((new ke(wd,.5*b,0)).close())).Zm(.25,.5,.75,1)});yo("Triangle","TriangleUp");
  yo("Diamond",function(a,b,c){return(new rd).add((new je(.5*b,0)).add(new ke(wd,0,.5*c)).add(new ke(wd,.5*b,c)).add((new ke(wd,b,.5*c)).close())).Zm(.25,.25,.75,.75)});yo("LineH",function(a,b,c){a=new rd(ud);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});yo("LineV",function(a,b,c){a=new rd(ud);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});yo("None","Rectangle");yo("BarH","Rectangle");yo("BarV","Rectangle");yo("MinusLine","LineH");
  yo("PlusLine",function(a,b,c){return(new rd).add((new je(0,c/2,!1)).add(new ke(wd,b,c/2)).add(new ke(Zd,b/2,0)).add(new ke(wd,b/2,c)))});yo("XLine",function(a,b,c){return(new rd).add((new je(0,c,!1)).add(new ke(wd,b,0)).add(new ke(Zd,0,0)).add(new ke(wd,b,c)))});
  L.dn={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
  BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
  BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
  TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
  BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
  DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
  TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
  OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
  OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
  function V(a){X.call(this,a);this.D=2408959;this.ih=this.Nf="";this.Gp=this.Cp=this.Rp=this.Ho=null;this.Tp="";this.Lf=this.so=this.Sp=this.sh=null;this.Ep="";this.Dp=Ob;this.Ub=this.Hp="";this.Fi=this.An=this.mi=null;this.dg=(new J(NaN,NaN)).freeze();this.Oo="";this.cf=null;this.Po=tc;this.Ip=Vc;this.Yo=Cb;this.Qo=Fb;this.Sn=null;this.Io=127;this.Xp=Gb;this.Wp="gray";this.ug=4;this.zx=-1;this.tq=NaN;this.ez=new N;this.Xj=null;this.kh=NaN}ma(V,X);
  V.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.D=this.D&-4097|49152;a.Nf=this.Nf;a.ih=this.ih;a.Ho=this.Ho;a.Rp=this.Rp;a.Cp=this.Cp;a.Gp=this.Gp;a.Tp=this.Tp;a.Sp=this.Sp;a.so=this.so;a.Lf=null;a.Ep=this.Ep;a.Dp=this.Dp.H();a.Hp=this.Hp;a.Ip=this.Ip.H();a.Ub=this.Ub;a.An=this.An;a.dg.assign(this.dg);a.Oo=this.Oo;a.Po=this.Po.H();a.Yo=this.Yo.H();a.Qo=this.Qo.H();a.Sn=this.Sn;a.Io=this.Io;a.Xp=this.Xp.H();a.Wp=this.Wp;a.ug=this.ug;a.tq=this.tq};
  V.prototype.yf=function(a){X.prototype.yf.call(this,a);a.Oh();a.sh=null;a.cf=null;a.Xj=null};V.prototype.toString=function(){var a=Ja(this.constructor)+"#"+kb(this);null!==this.data&&(a+="("+Ka(this.data)+")");return a};V.prototype.Sk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===ze&&"elements"===b?e instanceof X?Hj(e,function(a){Jj(h.partManager,a);Ij(h,a)}):ck(h,e):a===Ae&&"elements"===b&&(e instanceof X?Hj(e,function(a){Mj(h.partManager,a,h)}):ek(h,e)),h.Va(a,b,c,d,e,f,g))};
  V.prototype.Ea=function(a){X.prototype.Ea.call(this,a);if(null!==this.data){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&Hj(e,function(a){null!==a.data&&a.Ea()})}for(b=this.adornments;b.next();)b.value.Ea(a)}};V.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};V.prototype.wk=function(a){var b=this.Lf;return null===b?null:b.G(a)};
  V.prototype.Gh=function(a,b){if(null!==b){var c=null,d=this.Lf;null!==d&&(c=d.G(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Lf=d=new H);b.Nf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.ij(),null!==a&&(b.data=a.data)))}}};V.prototype.Hf=function(a){var b=this.Lf;if(null!==b){var c=b.G(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Lf=null)}};
  V.prototype.nk=function(){var a=this.Lf;if(null!==a){var b=Ea();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Hf(b[c]);Ia(b)}};
  V.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.s();c.placeholder&&c.placeholder.s()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.o()&&this.isVisible()&&b.Gf()&&b.actualBounds.o())){c=this.wk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Ph()?a.linkSelectionAdornmentTemplate:this instanceof U?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
  if(!(c instanceof Je))break a;yg(c);c=c.copy();null!==c&&(this.Ph()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.s();this.Gh("Selection",c);break a}}this.Hf("Selection")}zo(this,a);for(b=this.adornments;b.next();)b.value.Ea()}};V.prototype.Lb=function(){var a=this.diagram;null!==a&&(Wi(a),0!==(this.D&16384)!==!0&&(this.D|=16384,a.Db()))};function mi(a){0!==(a.D&16384)!==!1&&(a.updateAdornments(),a.D&=-16385)}
  function zo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Ao(a){if(!1===wj(a)){Bo(a,!0);a.Fl();var b=a.diagram;null!==b&&(b.wd.add(a),b.Db())}}function Co(a){a.D|=2097152;if(!1!==wj(a)){var b=a.position,c=a.location;c.o()&&b.o()||Do(a,b,c);c=a.xb;var d=N.alloc().assign(c);c.ea();c.x=b.x;c.y=b.y;c.freeze();a.Im(d,c);N.free(d);Bo(a,!1)}}V.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};
  V.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};V.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.cu(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=V.prototype;t.Ob=function(a){var b=this.diagram;a?(this.C(4),this.Lb(),null!==b&&b.wd.add(this)):(this.C(8),this.nk());this.Oh();null!==b&&(b.Na(),b.M())};
  t.bb=function(a){if(this.name===a)return this;var b=this.Xj;null===b&&(this.Xj=b=new H);if(null!==b.G(a))return b.G(a);var c=X.prototype.bb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.Df=function(a,b,c){void 0===c&&(c=new J);b=b.nc()?zc:b;var d=a.naturalBounds;c.h(d.width*b.x+b.offsetX,d.height*b.y+b.offsetY);if(null===a||a===this)return c;a.transform.ta(c);for(a=a.panel;null!==a&&a!==this;)a.transform.ta(c),a=a.panel;this.cg.ta(c);c.offset(-this.qc.x,-this.qc.y);return c};
  t.mj=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};t.Ta=function(){!0===uj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Fj(a,b){var c=a.ez;isNaN(a.kh)&&(a.kh=kn(a));var d=a.kh;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
  V.prototype.arrange=function(){if(!1===vj(this))Co(this);else{rl(this,!1);var a=this.xb,b=N.alloc();b.assign(a);var c=wg(this);this.Ih(0,0,this.qc.width,this.qc.height);var d=this.position;Do(this,d,this.location);a.ea();a.x=d.x;a.y=d.y;a.freeze();this.Im(b,a);b.w(a)?this.Nd(c):!this.Nc()||L.A(b.width,a.width)&&L.A(b.height,a.height)||0<=this.zx&&this.C(16);N.free(b);Bo(this,!1)}};t=V.prototype;
  t.Im=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.vi&&a.o()){var e=N.alloc();e.assign(c.documentBounds);e.Jw(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);N.free(e)}0!==(this.D&65536)!==!0&&a.w(b)||Kj(this,d,c);c.M();!a.o()&&!b.o()||Vb(a,b)||(this instanceof W&&!c.undoManager.isUndoingRedoing&&this.sd(),this.Oh())}};
  t.Ew=function(a,b){if(this.Ph()||!a.o())return!1;var c=this.diagram;null!==c&&Eo(this,c,a,b);this.la=a;this.D&=-2097153;var d=this.dg;!d.o()||null!==c&&!c.animationManager.isTicking&&c.undoManager.isUndoingRedoing||(c=d.copy(),d.h(d.x+(a.x-b.x),d.y+(a.y-b.y)),this.g("location",c,d.copy()));!1===wj(this)&&!1===vj(this)&&(Ao(this),Co(this));return!0};function Eo(a,b,c,d){null===b||a instanceof Je||(b=b.animationManager,b.ef&&Ph(b,a,d.copy(),c.copy()))}
  t.er=function(a,b,c){var d=this.dg,e=this.la;if(c){if(d.x===a&&d.y===b)return;wj(this)||vj(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;wj(this)||vj(this)?this.lu():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Ao(this)};t.lu=function(){this.D&=-2097153;Ao(this)};
  function Do(a,b,c){var d=J.alloc(),e=a.locationSpot,f=a.locationObject;e.nc()&&B("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof Kf?f.strokeWidth:0;d.Uk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.ta(d),e=f.panel;null!==e&&e!==a;)e.transform.ta(d),e=e.panel;a.cg.ta(d);d.offset(-a.qc.x,-a.qc.y);e=a.diagram;f=c.o();g=b.o();f&&g?0!==(a.D&2097152)?Fo(a,b,c,e,d):Go(a,b,c,e,d):f?Fo(a,b,c,e,d):g&&Go(a,b,c,e,d);a.D|=2097152;
  J.free(d);a.Fl()}function Fo(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(d=c.defaultAnimation.isAnimating)||!c.ef||a instanceof Je||Ph(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function Go(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.w(f)||null===d||a.g("location",f,c.copy())}
  function Kj(a,b,c){tl(a,!1);a instanceof W&&Ck(c,a);a.layer.isTemporary||b||c.Na();b=a.xb;var d=c.viewportBounds;d.o()?wg(a)?(ac(b,d)||a.Nd(!1),a.updateAdornments()):b.Mc(d)?(a.Nd(!0),a.updateAdornments()):a.Lb():c.xi=!0}t.rj=function(){return!0};t.Nc=function(){return!0};t.Ph=function(){return!1};t.Ff=function(){return!0};
  function Ho(a,b,c,d){b.constructor===a.constructor||Io||(Io=!0,xa('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),xa("  Old class: "+Ja(a.constructor)+", new class: "+Ja(b.constructor)+", part: "+a.toString()));a.nk();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof W&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.yf(a);b.cloneProtected(a);a.Nf=d;a.s();a.M();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
  b.skipsUndoManager=!0);a.ob=e;a.D=f?a.D|4096:a.D&-4097;a.D=g?a.D|524288:a.D&-524289;a instanceof W&&(a.P=h?a.P|4:a.P&-5,a.P=k?a.P|1:a.P&-2,a.P=l?a.P|2:a.P&-3);null!==e&&a.Ea();e=a.layerName;e!==c&&(a.ih=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Nc()&&a.C(64)}V.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
  V.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};V.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
  V.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};V.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
  V.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};V.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
  V.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};V.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function wj(a){return 0!==(a.D&32768)}function Bo(a,b){a.D=b?a.D|32768:a.D&-32769}function tl(a,b){a.D=b?a.D|65536:a.D&-65537}
  function wg(a){return 0!==(a.D&131072)}t=V.prototype;t.Nd=function(a){this.D=a?this.D|131072:this.D&-131073};function Jo(a,b){a.D=b?a.D|1048576:a.D&-1048577}t.Oh=function(){var a=this.containingGroup;null!==a&&(a.s(),null!==a.placeholder&&a.placeholder.s(),a.sd())};t.M=function(){var a=this.diagram;null!==a&&!vj(this)&&!wj(this)&&this.isVisible()&&this.xb.o()&&a.M(Fj(this,this.xb))};
  t.s=function(){X.prototype.s.call(this);var a=this.diagram;null!==a&&(a.wd.add(this),this instanceof W&&null!==this.labeledLink&&Il(this.labeledLink),a.Db(!0))};t.Mq=function(a){a||(a=this.mi,null!==a&&Ko(a,this))};t.Nq=function(a){a||(a=this.mi,null!==a&&Lo(a,this))};t.uk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Nm(a))}};t.bA=function(){return Mo(this,this)};
  function Mo(a,b){var c=b.containingGroup;return null!==c?1+Mo(a,c):b instanceof W&&(b=b.labeledLink,null!==b)?Mo(a,b):0}t.eA=function(){return No(this,this)};function No(a,b){var c=b.containingGroup;return null!==c||b instanceof W&&(c=b.labeledLink,null!==c)?No(a,c):b}t.Kd=function(a){return a instanceof U?Oo(this,this,a):!1};function Oo(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Oo(a,d,c)?b instanceof W&&(b=b.labeledLink,null!==b)?Oo(a,b,c):!1:!0}
  t.oy=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof U&&Jo(b,!0);if(b instanceof W){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b instanceof W&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof U&&Jo(b,!1),b instanceof W&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
  V.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof W&&this.isLinkLabel?!1:!0};
  V.prototype.C=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof W&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.mi,null!==b){var c=b.layout;null!==c?c.C():b.C(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.C())};function Lj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
  function Yk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Je))if(a.add(b),b instanceof W){if(c&&b instanceof U)for(var g=b.memberParts;g.next();)Yk(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&Yk(a,h,c,d,e,f)}}if(1<d)for(b=b.Wv();b.next();)Yk(a,b.value,c,d-1,e,f)}else if(b instanceof S)for(b=b.labelNodes;b.next();)Yk(a,
  b.value,c,d,e,f)}
  na.Object.defineProperties(V.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.ja(this.data)}},adornments:{get:function(){return null===this.Lf?db:this.Lf.iteratorValues}},layer:{get:function(){return this.Fi}},diagram:{get:function(){var a=this.Fi;return null!==a?a.diagram:null}},layerName:{get:function(){return this.ih},set:function(a){var b=
  this.ih;if(b!==a){var c=this.diagram;if(null===c||null!==c.xk(a)&&!c.partManager.addsToTemporaryLayer)if(this.ih=a,null!==c&&c.Na(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.xk(a),null!==a&&a!==b))){var d=b.Lc(-1,this,!0);0<=d&&c.Va(Ae,"parts",b,this,null,d,!0);d=a.oj(99999999,this,!0);b.visible!==a.visible&&this.Ob(a.visible);0<=d&&c.Va(ze,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.Z;c.Z=!0;d(this,b,a);c.Z=e}}}}},layerChanged:{
  get:function(){return this.Ho},set:function(a){var b=this.Ho;b!==a&&(this.Ho=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.tq},set:function(a){var b=this.tq;if(b!==a){this.tq=a;var c=this.layer;null!==c&&pi(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.M()}}},locationObject:{get:function(){if(null===this.cf){var a=this.locationObjectName;""!==a?(a=this.bb(a),null!==a?this.cf=a:this.cf=this):
  this instanceof Je?this.type!==X.Link&&null!==this.placeholder?this.cf=this.placeholder:this.cf=this:this.cf=this}return this.cf.visible?this.cf:this}},minLocation:{get:function(){return this.Yo},set:function(a){var b=this.Yo;b.w(a)||(this.Yo=a=a.H(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.Qo},set:function(a){var b=this.Qo;b.w(a)||(this.Qo=a=a.H(),this.g("maxLocation",b,a))}},locationObjectName:{
  get:function(){return this.Oo},set:function(a){var b=this.Oo;b!==a&&(this.Oo=a,this.cf=null,this.s(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.Po},set:function(a){var b=this.Po;b.w(a)||(this.Po=a=a.H(),this.s(),this.g("locationSpot",b,a))}},location:{get:function(){return this.dg},set:function(a){var b=a.x,c=a.y,d=this.dg,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||
  (a=a.copy(),b=a,this.Ph()?b=!1:(this.dg=b,this.D|=2097152,!1===vj(this)&&(Ao(this),c=this.la,c.o()&&(e=this.diagram,null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing))&&(f=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),Eo(this,e,c,f),this.g("position",f,c.copy())),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{get:function(){return this.Nf},set:function(a){var b=this.Nf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&
  !(this instanceof Je)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.Nf=a;this.g("category",b,a);null===c||null===d||this instanceof Je?this instanceof Je&&(e=this.adornedPart,null!==e&&(a=e.Lf,null!==a&&a.remove(b),e.Gh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Ph()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(yg(c),c=c.copy(),null!==c&&Ho(this,c,b,a))):(null!==
  f&&f.Um(d,a),c=Po(c.partManager,d,a),null!==c&&(yg(c),c=c.copy(),null===c||c instanceof S||(d=this.location.copy(),Ho(this,c,b,a),this.location.o()||(this.location=d)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){Ho(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.D&1)},set:function(a){var b=0!==(this.D&1);b!==a&&(this.D^=1,this.g("copyable",
  b,a))}},deletable:{get:function(){return 0!==(this.D&2)},set:function(a){var b=0!==(this.D&2);b!==a&&(this.D^=2,this.g("deletable",b,a))}},textEditable:{get:function(){return 0!==(this.D&4)},set:function(a){var b=0!==(this.D&4);b!==a&&(this.D^=4,this.g("textEditable",b,a),this.Lb())}},groupable:{get:function(){return 0!==(this.D&8)},set:function(a){var b=0!==(this.D&8);b!==a&&(this.D^=8,this.g("groupable",b,
  a))}},movable:{get:function(){return 0!==(this.D&16)},set:function(a){var b=0!==(this.D&16);b!==a&&(this.D^=16,this.g("movable",b,a))}},selectionAdorned:{get:function(){return 0!==(this.D&32)},set:function(a){var b=0!==(this.D&32);b!==a&&(this.D^=32,this.g("selectionAdorned",b,a),this.Lb())}},isInDocumentBounds:{get:function(){return 0!==(this.D&64)},set:function(a){var b=0!==(this.D&64);if(b!==a){this.D^=64;
  var c=this.diagram;null!==c&&c.Na();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.D&128)},set:function(a){var b=0!==(this.D&128);b!==a&&(this.D^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{get:function(){return 0!==(this.D&256)},set:function(a){var b=0!==(this.D&256);b!==a&&(this.D^=256,this.g("selectable",b,a),this.Lb())}},reshapable:{get:function(){return 0!==
  (this.D&512)},set:function(a){var b=0!==(this.D&512);b!==a&&(this.D^=512,this.g("reshapable",b,a),this.Lb())}},resizable:{get:function(){return 0!==(this.D&1024)},set:function(a){var b=0!==(this.D&1024);b!==a&&(this.D^=1024,this.g("resizable",b,a),this.Lb())}},rotatable:{get:function(){return 0!==(this.D&2048)},set:function(a){var b=0!==(this.D&2048);b!==a&&(this.D^=2048,this.g("rotatable",b,a),this.Lb())}},isSelected:{
  get:function(){return 0!==(this.D&4096)},set:function(a){var b=0!==(this.D&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.D^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ea();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Lb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Db(),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.ea(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.M();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.M())}},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.so},set:function(a){var b=this.so;b!==a&&(this.so=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.Tp},set:function(a){var b=this.Tp;b!==a&&(this.Tp=a,this.sh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
  get:function(){return this.Rp},set:function(a){var b=this.Rp;b!==a&&(this.Rp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.sh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.bb(a),null!==a?this.sh=a:this.sh=this):this instanceof S?(a=this.path,null!==a?this.sh=a:this.sh=this):this.sh=this}return this.sh}},selectionChanged:{get:function(){return this.Sp},set:function(a){var b=this.Sp;
  b!==a&&(this.Sp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.Cp},set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.Ep},set:function(a){var b=this.Ep;b!==a&&(this.Ep=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.bb(a),
  null!==a)?a:this}},resizeCellSize:{get:function(){return this.Dp},set:function(a){var b=this.Dp;b.w(a)||(this.Dp=a=a.H(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.Gp},set:function(a){var b=this.Gp;b!==a&&(this.Gp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.Hp},set:function(a){var b=this.Hp;b!==a&&(this.Hp=a,this.g("rotateObjectName",
  b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.bb(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.Ip},set:function(a){var b=this.Ip;b.w(a)||(this.Ip=a=a.H(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Ub},set:function(a){var b=this.Ub;b!==a&&(this.Ub=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.mi},
  set:function(a){if(this.Nc()){var b=this.mi;if(b!==a){null===a||this!==a&&!a.Kd(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.C(2);var c=this.diagram;null!==b?Lo(b,this):this instanceof U&&null!==c&&c.Dh.remove(this);this.mi=a;null!==a?Ko(a,this):this instanceof U&&null!==c&&c.Dh.add(this);this.C(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
  e.Dk()){var f=e.ja(null!==a?a.data:null);e.dr(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.Z,c.Z=!0),d(this,b,a),null!==c&&(c.Z=e));if(this instanceof U)for(c=new G,Yk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof W)for(d=d.linksConnected;d.next();)Qo(d.value);if(this instanceof W){for(c=this.linksConnected;c.next();)Qo(c.value);c=this.labeledLink;null!==c&&Qo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&pi(b,-1,a))}}else B("cannot set the Part.containingGroup of a Link or Adornment")}},
  containingGroupChanged:{get:function(){return this.An},set:function(a){var b=this.An;b!==a&&(this.An=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof W&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.Io},set:function(a){var b=this.Io;b!==a&&(this.Io=a,this.g("layoutConditions",b,a))}},dragComputation:{
  get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(this.Sn=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.Xp},set:function(a){var b=this.Xp;b.w(a)||(this.Xp=a=a.H(),this.M(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Wp},set:function(a){var b=this.Wp;b!==a&&(this.Wp=a,this.M(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.ug},
  set:function(a){var b=this.ug;b!==a&&(this.ug=a,this.M(),this.g("shadowBlur",b,a))}}});V.prototype.invalidateLayout=V.prototype.C;V.prototype.findCommonContainingGroup=V.prototype.oy;V.prototype.isMemberOf=V.prototype.Kd;V.prototype.findTopLevelPart=V.prototype.eA;V.prototype.findSubGraphLevel=V.prototype.bA;V.prototype.ensureBounds=V.prototype.Ta;V.prototype.getDocumentBounds=V.prototype.mj;V.prototype.getRelativePoint=V.prototype.Df;V.prototype.findObject=V.prototype.bb;V.prototype.moveTo=V.prototype.moveTo;
  V.prototype.invalidateAdornments=V.prototype.Lb;V.prototype.clearAdornments=V.prototype.nk;V.prototype.removeAdornment=V.prototype.Hf;V.prototype.addAdornment=V.prototype.Gh;V.prototype.findAdornment=V.prototype.wk;V.prototype.updateTargetBindings=V.prototype.Ea;var Io=!1;V.className="Part";V.LayoutNone=0;V.LayoutAdded=1;V.LayoutRemoved=2;V.LayoutShown=4;V.LayoutHidden=8;V.LayoutNodeSized=16;V.LayoutGroupLayout=32;V.LayoutNodeReplaced=64;V.LayoutStandard=127;V.LayoutAll=16777215;
  function Je(a){V.call(this,a);this.D&=-257;this.ih="Adornment";this.ie=null;this.Ex=0;this.Sx=!1;this.l=a instanceof Qm?[]:Ro;this.Sa=null}ma(Je,V);Je.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Je.prototype.updateRelationshipsFromData=function(){};
  Je.prototype.Gk=function(a){var b=this.adornedObject.part;if(b instanceof S&&this.adornedObject instanceof Kf){var c=b.path;b.Gk(a);a=c.geometry;b=this.W.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Kf&&(e.na=a)}}};Je.prototype.rj=function(){var a=this.ie;if(null===a)return!0;a=a.part;return null===a||!vj(a)};Je.prototype.Nc=function(){return!1};
  Je.prototype.Sk=function(a,b,c,d,e,f,g){if(a===ze&&"elements"===b)if(e instanceof xg)null===this.Sa&&(this.Sa=e);else{if(e instanceof X){var h=e.ym(function(a){return a instanceof xg});h instanceof xg&&null===this.Sa&&(this.Sa=h)}}else a===Ae&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.Gg(d)&&(this.Sa=null));V.prototype.Sk.call(this,a,b,c,d,e,f,g)};Je.prototype.updateAdornments=function(){};Je.prototype.uk=function(){};
  na.Object.defineProperties(Je.prototype,{placeholder:{get:function(){return this.Sa}},adornedObject:{get:function(){return this.ie},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Hf(this.category);this.ie=a;null!==c&&c.Gh(this.category,this)}},adornedPart:{get:function(){var a=this.ie;return null!==a?a.part:null}},containingGroup:{
  get:function(){return null}}});var Ro=[];Je.className="Adornment";function W(a){V.call(this,a);this.P=13;this.$a=new E;this.nq=this.Kl=this.Ii=this.Ko=this.Jo=null;this.cl=rc;this.tc=this.Se=null;this.zp=So;this.Eh=!1}ma(W,V);W.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.P=this.P;a.P=this.P&-17;a.Jo=this.Jo;a.Ko=this.Ko;a.Ii=this.Ii;a.nq=this.nq;a.cl=this.cl.H();a.zp=this.zp};t=W.prototype;t.yf=function(a){V.prototype.yf.call(this,a);a.sd();a.Se=this.Se;a.tc=null};
  function To(a,b){null!==b&&(null===a.Se&&(a.Se=new G),a.Se.add(b))}function Uo(a,b,c,d){if(null===b||null===a.Se)return null;for(var e=a.Se.iterator;e.next();){var f=e.value;if(f.au===a&&f.lw===b&&f.My===c&&f.Ny===d||f.au===b&&f.lw===a&&f.My===d&&f.Ny===c)return f}return null}t.xA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Uo(this,a,b,c);null!==a&&a.Dm()};
  t.Sk=function(a,b,c,d,e,f,g){a===ze&&"elements"===b?this.tc=null:a===Ae&&"elements"===b&&(this.tc=null);V.prototype.Sk.call(this,a,b,c,d,e,f,g)};t.sd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(Vo(c.fromPort),Vo(c.toPort),c.Ua())}};function ul(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)Vo(c.fromPort),Vo(c.toPort),c.Ua()}}
  function Vo(a){if(null!==a){var b=a.yp;null!==b&&b.Dm();a=a.part;b=a.containingGroup;null===b||a.isVisible()||Vo(b.port)}}t.rj=function(){return!0};W.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.uq(this.cl);return a};W.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
  W.prototype.isVisible=function(){if(!V.prototype.isVisible.call(this))return!1;var a=!0,b=ui,c=this.diagram;if(null!==c){if(c.animationManager.cu(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ui){if(a=this.Fg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Jk){if(a=a?this.Tv():this.Uv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Kk&&(a=a?this.Tv():this.Uv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
  return null!==a?a.isVisible():!0};W.prototype.Ob=function(a){V.prototype.Ob.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.Kq(this);null===d||d.Kd(this.containingGroup)||c.Ua()}c.Ob(a)}};W.prototype.py=function(){var a=new G,b=new G;Wo(this,this,a,b);return b.iterator};
  function Wo(a,b,c,d){if(null!==b&&!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&Wo(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}W.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.$a.iterator;var b=new ib(this.$a),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=W.prototype;
  t.Fq=function(a){void 0===a&&(a=null);var b=new ib(this.$a),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Hd=function(a){void 0===a&&(a=null);var b=new ib(this.$a),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
  t.Sv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.$a.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new hb(c):db};
  t.Uv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.$a.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new hb(c):db};
  t.Tv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.$a.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new G,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new hb(c):db};
  t.Xz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ib(this.$a),e=this;d.predicate=function(d){return(d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c)&&(d.fromNode!==a||d.toNode!==e||null!==c&&d.fromPortId!==c||null!==b&&d.toPortId!==b)?!1:!0};return d};
  t.Yz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ib(this.$a),e=this;d.predicate=function(d){return d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c?!1:!0};return d};
  function Xo(a,b,c){Vo(c);var d=a.$a.contains(b);d||a.$a.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,b,c);null!==g&&(g.Z=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.Eh||(e.Eh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
  function Yo(a,b,c){Vo(c);var d=a.$a.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.Z,e.Z=!0);f(a,b,c);null!==e&&(e.Z=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.Eh=!1),null===b||b.isTreeLeaf||(0===b.$a.count?(b.Eh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Ik(b)))}
  function Ik(a){a.Eh=!1;if(0!==a.$a.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.$a.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}W.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=W.prototype;
  t.Mq=function(a){V.prototype.Mq.call(this,a);a||(Ik(this),a=this.Kl,null!==a&&Zo(a,this))};t.Nq=function(a){V.prototype.Nq.call(this,a);a||(a=this.Kl,null!==a&&null!==a.nd&&(a.nd.remove(this),a.s()))};
  t.uk=function(){if(0<this.$a.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.$a.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;V.prototype.uk.call(this)};t.Jt=function(a){if(null===this.tc){if(""===a&&!1===this.Nh)return this;$o(this)}var b=this.tc.G(a);return null!==b||""!==a&&(b=this.tc.G(""),null!==b)?b:this};
  function $o(a){null===a.tc?a.tc=new H:a.tc.clear();a.an(a,function(a,c){Yl(a,c)});0===a.tc.count&&a.tc.add("",a)}function Yl(a,b){var c=b.portId;null!==c&&null!==a.tc&&a.tc.add(c,b)}function Xl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.tc&&a.tc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Ea()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ia(c)}}}
  t.zA=function(a){if(null===a||a===this)return!1;var b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this;if(b)for(;c!==a;){b=null;for(var d=c.$a.iterator;d.next();){var e=d.value;if(e.isTreeLink&&(b=e.fromNode,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.$a.iterator;d.next()&&(e=d.value,!e.isTreeLink||(b=e.toNode,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
  t.iA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.$a.iterator;c.next();){var d=c.value;if(d.isTreeLink&&(a=d.fromNode,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.$a.iterator;c.next()&&(d=c.value,!d.isTreeLink||(a=d.toNode,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
  t.Uz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)Jo(b,!0),b=b.Fg();var c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b=b.Fg()}for(b=this;null!==b;)Jo(b,!1),b=b.Fg();return c};t.jj=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.$a.iterator;if(a)for(;b.next();){if(a=b.value,a.isTreeLink&&a.fromNode!==this)return a}else for(;b.next();)if(a=b.value,a.isTreeLink&&a.toNode!==this)return a;return null};
  t.Fg=function(){var a=this.Eh;if(null===a)return null;if(a instanceof W)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.$a.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Eh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Eh=b;return this.Eh=null};t.gA=function(){function a(b,d){if(null!==b){d.add(b);var c=b.jj();null!==c&&(d.add(c),a(b.Fg(),d))}}var b=new G;a(this,b);return b};
  t.fA=function(){return ap(this,this)};function ap(a,b){b=b.Fg();return null===b?0:1+ap(a,b)}t.Hq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new ib(this.$a);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
  t.Wv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.$a.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new hb(c):db};
  t.hA=function(a){void 0===a&&(a=Infinity);var b=new G;Yk(b,this,!1,a,!0);return b};W.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Le){b.Le=!0;var c=new G;c.add(this);bp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ui);b.Le=!1}};function bp(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Fq():a.Hd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Kq(a),null===k||k===a||b.contains(k)||(b.add(k),bp(k,b,c,d-1,e,f,g)))}else cp(a,b,c,e,f,g)}
  function cp(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Fq():a.Hd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Kq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.jk(k,e),k.Oh(),k.Ob(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||cp(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
  W.prototype.expandTree=function(a){void 0===a&&(a=2);2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Le){b.Le=!0;var c=new G;c.add(this);dp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ui);b.Le=!1}};
  function dp(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Fq():a.Hd();k.next();){var l=k.value;l.isTreeLink&&(h||l.ud||l.Ua(),l=l.Kq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ob(!0),l.Oh(),g&&e.lk(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,dp(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
  na.Object.defineProperties(W.prototype,{portSpreading:{get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(this.zp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.sd())}},avoidable:{get:function(){return 0!==(this.P&8)},set:function(a){var b=0!==(this.P&8);if(b!==a){this.P^=8;var c=this.diagram;null!==c&&Ck(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
  get:function(){return this.cl},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.cl;if(!b.w(a)){this.cl=a=a.H();var c=this.diagram;null!==c&&Ck(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.$a.iterator}},linkConnected:{get:function(){return this.Jo},set:function(a){var b=this.Jo;b!==a&&(this.Jo=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.Ko},
  set:function(a){var b=this.Ko;b!==a&&(this.Ko=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.Ii},set:function(a){var b=this.Ii;b!==a&&(this.Ii=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.Kl}},labeledLink:{get:function(){return this.Kl},set:function(a){var b=this.Kl;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.nd&&(b.nd.remove(this),
  b.s());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.qj()){var g=f.ja(d);void 0!==g&&f.Oy(e,g)}}this.containingGroup=null}this.Kl=a;null!==a&&(Zo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.qj()&&(d=c.ja(d),void 0!==d&&c.Dv(e,d))),this.containingGroup=a.containingGroup);Il(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.Jt("")}},ports:{
  get:function(){null===this.tc&&$o(this);return this.tc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.P&1)},set:function(a){var b=0!==(this.P&1);if(b!==a){this.P^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ob(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
  get:function(){return 0!==(this.P&2)},set:function(a){var b=0!==(this.P&2);b!==a&&(this.P^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.nq},set:function(a){var b=this.nq;b!==a&&(this.nq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.P&4)},set:function(a){var b=0!==(this.P&4);b!==a&&(this.P^=4,this.g("isTreeLeaf",b,a))}}});W.prototype.expandTree=W.prototype.expandTree;
  W.prototype.collapseTree=W.prototype.collapseTree;W.prototype.findTreeParts=W.prototype.hA;W.prototype.findTreeChildrenNodes=W.prototype.Wv;W.prototype.findTreeChildrenLinks=W.prototype.Hq;W.prototype.findTreeLevel=W.prototype.fA;W.prototype.findTreeParentChain=W.prototype.gA;W.prototype.findTreeParentNode=W.prototype.Fg;W.prototype.findTreeParentLink=W.prototype.jj;W.prototype.findCommonTreeParent=W.prototype.Uz;W.prototype.findTreeRoot=W.prototype.iA;W.prototype.isInTreeOf=W.prototype.zA;
  W.prototype.findPort=W.prototype.Jt;W.prototype.findLinksTo=W.prototype.Yz;W.prototype.findLinksBetween=W.prototype.Xz;W.prototype.findNodesInto=W.prototype.Tv;W.prototype.findNodesOutOf=W.prototype.Uv;W.prototype.findNodesConnected=W.prototype.Sv;W.prototype.findLinksInto=W.prototype.Hd;W.prototype.findLinksOutOf=W.prototype.Fq;W.prototype.findExternalTreeLinksConnected=W.prototype.py;W.prototype.invalidateConnectedLinks=W.prototype.sd;W.prototype.invalidateLinkBundle=W.prototype.xA;
  var ep=new D(W,"SpreadingNone",10),So=new D(W,"SpreadingEvenly",11),fp=new D(W,"SpreadingPacked",12);W.className="Node";W.SpreadingNone=ep;W.SpreadingEvenly=So;W.SpreadingPacked=fp;function U(a){W.call(this,a);this.P|=4608;this.Vo=new G;this.Sl=new G;this.Sa=this.eq=this.Ki=this.Wo=this.Uo=this.Za=null;this.kc=new Bi;this.kc.group=this}ma(U,W);
  U.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);this.P=this.P&-32769;null!==this.Za&&(a.Za=this.Za.copy());a.Uo=this.Uo;a.Wo=this.Wo;a.Ki=this.Ki;a.eq=this.eq;var b=a.ym(function(a){return a instanceof xg});b instanceof xg?a.Sa=b:a.Sa=null;null!==this.kc?(a.kc=this.kc.copy(),a.kc.group=a):(null!==a.kc&&(a.kc.group=null),a.kc=null)};t=U.prototype;
  t.yf=function(a){W.prototype.yf.call(this,a);var b=a.yk();for(a=a.memberParts;a.next();){var c=a.value;c.s();c.C(8);c.nk();if(c instanceof W)c.sd(b);else if(c instanceof S)for(c=c.labelNodes;c.next();)c.value.sd(b)}};
  t.Sk=function(a,b,c,d,e,f,g){if(a===ze&&"elements"===b)if(e instanceof xg)null===this.Sa?this.Sa=e:this.Sa!==e&&B("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.ym(function(a){return a instanceof xg});h instanceof xg&&(null===this.Sa?this.Sa=h:this.Sa!==h&&B("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===Ae&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.Gg(d)&&(this.Sa=null));
  W.prototype.Sk.call(this,a,b,c,d,e,f,g)};t.Im=function(a,b){W.prototype.Im.call(this,a,b);this.isClipping&&this.type!==X.Spot&&(a=this.resizeObject,a instanceof X&&(a=a.tb()),null===this.Za&&(this.Za=new N),a.mj(this.Za),a instanceof Kf&&this.Za.Jc(-a.strokeWidth,-a.strokeWidth))};t.Ih=function(a,b,c,d){this.cf=this.Sa;W.prototype.Ih.call(this,a,b,c,d)};t.Ta=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof S||b.Ta()});W.prototype.Ta.call(this)};
  t.rj=function(){if(!W.prototype.rj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof W){if(b.isVisible()&&vj(b))return!1}else if(b instanceof S&&b.isVisible()&&vj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
  function Ko(a,b){if(a.Vo.add(b)){b instanceof U&&a.Sl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!1)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.s())}
  function Lo(a,b){if(a.Vo.remove(b)){b instanceof U&&a.Sl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.Z,e.Z=!0);c(a,b);null!==e&&(e.Z=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ob(!0)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.s())}t.uk=function(){if(0<this.Vo.count){var a=this.diagram;if(null!==a)for(var b=this.Vo.copy().iterator;b.next();)a.remove(b.value)}W.prototype.uk.call(this)};
  U.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=$k(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};U.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=$k(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
  U.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var a=this.layer;if(null!==a&&!a.allowUngroup)return!1;a=a.diagram;return null===a||a.allowUngroup?!0:!1};t=U.prototype;
  t.sd=function(a){void 0===a&&(a=null);var b=0!==(this.P&65536);W.prototype.sd.call(this,a);if(!b)for(0!==(this.P&65536)!==!0&&(this.P=this.P^65536),b=this.Rv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Kd(this)&&!d.isVisible()?(Vo(c.fromPort),Vo(c.toPort),c.Ua()):(d=c.toNode,null!==d&&d!==this&&d.Kd(this)&&!d.isVisible()&&(Vo(c.fromPort),Vo(c.toPort),c.Ua()))}}};
  t.Rv=function(){var a=this.yk();a.add(this);for(var b=new G,c=a.iterator;c.next();){var d=c.value;if(d instanceof W)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Wz=function(){var a=this.yk();a.add(this);for(var b=new G,c=a.iterator;c.next();){var d=c.value;if(d instanceof W)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;null===f||a.contains(f)&&f!==this||b.add(f);e=e.toNode;null===e||a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
  t.Vz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new G;a(this,b);return b};t.yk=function(){var a=new G;Yk(a,this,!0,0,!0);a.remove(this);return a};t.Ob=function(a){W.prototype.Ob.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ob(a)};U.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Le){a.Le=!0;var b=this.yk();gp(this,b,a,this);a.Le=!1}};
  function gp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!1);f instanceof U&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,gp(f,b,c,d));if(f instanceof W)f.sd(b),c.jk(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.sd(b)}a.isSubGraphExpanded=!1}U.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Le){a.Le=!0;var b=this.yk();hp(this,b,a,this);a.Le=!1}};
  function hp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ob(!0);f instanceof U&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,hp(f,b,c,d));if(f instanceof W)f.sd(b),c.lk(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.sd(b)}a.isSubGraphExpanded=!0}
  U.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=J.alloc();W.prototype.move.call(this,a,b);a=new G;for(b=this.yk().iterator;b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting&&a.add(e),e.ud||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Ph()||e instanceof W&&e.isLinkLabel)){var g=
  e.position,h=e.location;g.o()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.o()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof S&&(e.suspendsRouting=a.contains(e),e.ud||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.o()?e.move(f):e.Ua(),Sj(e)&&e.Ua();J.free(f)}};
  na.Object.defineProperties(U.prototype,{placeholder:{get:function(){return this.Sa}},computesBoundsAfterDrag:{get:function(){return 0!==(this.P&2048)},set:function(a){var b=0!==(this.P&2048);b!==a&&(this.P^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.P&4096)},set:function(a){var b=0!==(this.P&4096);b!==a&&(this.P^=4096,this.g("computesBoundsIncludingLinks",
  b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.P&8192)},set:function(a){var b=0!==(this.P&8192);b!==a&&(this.P^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.P&16384)},set:function(a){var b=0!==(this.P&16384);b!==a&&(this.P^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.Vo.iterator}},
  layout:{get:function(){return this.kc},set:function(a){var b=this.kc;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.kc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Ng=!0);this.g("layout",b,a);null!==c&&c.Db()}}},memberAdded:{get:function(){return this.Uo},set:function(a){var b=this.Uo;b!==a&&(this.Uo=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.Wo},
  set:function(a){var b=this.Wo;b!==a&&(this.Wo=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.Ki},set:function(a){var b=this.Ki;b!==a&&(this.Ki=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.P&256)},set:function(a){var b=0!==(this.P&256);b!==a&&(this.P^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.P&512)},
  set:function(a){var b=0!==(this.P&512);if(b!==a){this.P^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.Z,c.Z=!0);b(this);null!==c&&(c.Z=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Sa&&this.Sa.s(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.P&1024)},set:function(a){var b=
  0!==(this.P&1024);b!==a&&(this.P^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.eq},set:function(a){var b=this.eq;b!==a&&(this.eq=a,this.g("subGraphExpandedChanged",b,a))}},Rh:{get:function(){return 0!==(this.P&32768)},set:function(a){0!==(this.P&32768)!==a&&(this.P^=32768)}}});U.prototype.expandSubGraph=U.prototype.expandSubGraph;U.prototype.collapseSubGraph=U.prototype.collapseSubGraph;
  U.prototype.findSubGraphParts=U.prototype.yk;U.prototype.findContainingGroupChain=U.prototype.Vz;U.prototype.findExternalNodesConnected=U.prototype.Wz;U.prototype.findExternalLinksConnected=U.prototype.Rv;U.prototype.ensureBounds=U.prototype.Ta;U.className="Group";function xg(){Y.call(this);this.ib=qc;this.Np=new N(NaN,NaN,NaN,NaN)}ma(xg,Y);xg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ib=this.ib.H();a.Np=this.Np.copy()};
  xg.prototype.Kh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return cc(0,0,b.width,b.height,a.x,a.y)};
  xg.prototype.Hm=function(){var a=this.part;null!==a&&(a instanceof U||a instanceof Je)||B("Placeholder is not inside a Group or Adornment.");if(a instanceof U){var b=this.computeBorder(this.Np),c=this.minSize,d=this.rc;Sb(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);nl(this,0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.ew(a)||isNaN(b.x)||
  isNaN(b.y)||(c=J.alloc(),c.tj(b,a.locationSpot),c.w(a.location)||(a.location=new J(c.x,c.y)),J.free(c))}else{b=this.rc;c=this.ib;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.lj();var g=0;f instanceof Kf&&(g=f.strokeWidth);var h=f.Af(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.da("Selection"===a.category?tc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.da(tc,J.alloc()),f=N.allocAt(l.x,l.y,0,0),f.Oe(a.da(Dc,
  l)),f.Oe(a.da(vc,l)),f.Oe(a.da(Bc,l)),Sb(b,f.width+d||0,f.height+e||0),nl(this,-c.left,-c.top,b.width,b.height),J.free(l),N.free(f)):(Sb(b,l+d||0,g+e||0),nl(this,-c.left,-c.top,b.width,b.height))}};xg.prototype.Ih=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
  xg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof U&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Np.o()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Np,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.ib;b instanceof U&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));N.free(c);
  b instanceof U&&b.computesBoundsIncludingLocation&&b.location.o()&&a.Oe(b.location);return a};
  xg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof U))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof S){if(!b.computesBoundsIncludingLinks)continue;if(uj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(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};na.Object.defineProperties(xg.prototype,{padding:{get:function(){return this.ib},set:function(a){"number"===typeof a&&(a=new kc(a));var b=this.ib;b.w(a)||(this.ib=a=a.H(),this.g("padding",b,a),this.s())}}});xg.className="Placeholder";
  function S(){V.call(this,X.Link);this.Ga=8;this.We=null;this.Xe="";this.rf=this.fo=null;this.sf="";this.mq=null;this.Yk=ag;this.Hn=0;this.Jn=ag;this.Kn=NaN;this.ck=ip;this.Zp=.5;this.nd=null;this.Ab=(new E).freeze();this.jf=this.ph=null;this.Yl=new N;this.na=new rd;this.I=this.u=this.Mf=this.Vf=null;this.l=[];this.vv=new J;this.$r=this.Nx=this.Mx=null;this.Ru=NaN;this.O=null}ma(S,V);
  S.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.Ga=this.Ga&-113;a.Xe=this.Xe;a.fo=this.fo;a.sf=this.sf;a.mq=this.mq;a.Yk=this.Yk;a.Hn=this.Hn;a.Jn=this.Jn;a.Kn=this.Kn;a.ck=this.ck;a.Zp=this.Zp;null!==this.O&&(a.O=this.O.copy())};t=S.prototype;t.yf=function(a){V.prototype.yf.call(this,a);this.Xe=a.Xe;this.sf=a.sf;a.ph=null;a.Ua();a.Mf=this.Mf;var b=a.fromPort;null!==b&&Vo(b);a=a.toPort;null!==a&&Vo(a)};
  t.jb=function(a){a.classType===S?2===(a.value&2)?this.routing=a:a===dg||a===$f||a===Zf?this.curve=a:a===jp||a===kp||a===lp?this.adjusting=a:a!==ip&&a!==ag&&B("Unknown Link enum value for a Link property: "+a):V.prototype.jb.call(this,a)};t.Kc=function(){null===this.O&&(this.O=new jl)};t.rj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(vj(a)||wj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),vj(a)||wj(a))?!1:!0};t.Ew=function(){return!1};
  t.lu=function(){};t.Nc=function(){return!1};S.prototype.computeAngle=function(a,b,c){return S.computeAngle(b,c)};S.computeAngle=function(a,b){switch(a){default:case ag:a=0;break;case Zm:a=b;break;case Sm:a=b+90;break;case Um:a=b-90;break;case mp:a=b+180;break;case $m:a=L.Tq(b);90<a&&270>a&&(a-=180);break;case Tm:a=L.Tq(b+90);90<a&&270>a&&(a-=180);break;case Vm:a=L.Tq(b-90);90<a&&270>a&&(a-=180);break;case Wm:a=L.Tq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return L.Tq(a)};
  function Qo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.oy(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.mi;if(c!==b){null!==c&&Lo(c,a);a.mi=b;null!==b&&Ko(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.Z,g.Z=!0);e(a,c,b);null!==g&&(g.Z=f)}!a.ud||a.Mx!==c&&a.Nx!==c||a.Ua()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=S.prototype;
  t.Oh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&V.prototype.Oh.call(this)};t.Kq=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.nA=function(a){var b=this.fromPort;return a===b?this.toPort:b};function Zo(a,b){null===a.nd&&(a.nd=new G);a.nd.add(b);a.s()}
  t.Mq=function(a){V.prototype.Mq.call(this,a);np(this)&&this.Oq(this.actualBounds);if(!a){a=this.We;var b=null;null!==a&&(b=this.fromPort,Xo(a,this,b));var c=this.rf;if(null!==c){var d=this.toPort;c===a&&d===b||Xo(c,this,d)}op(this)}};t.Nq=function(a){V.prototype.Nq.call(this,a);np(this)&&this.Oq(this.actualBounds);if(!a){a=this.We;var b=null;null!==a&&(b=this.fromPort,Yo(a,this,b));var c=this.rf;if(null!==c){var d=this.toPort;c===a&&d===b||Yo(c,this,d)}pp(this)}};
  t.uk=function(){this.ud=!0;if(null!==this.nd){var a=this.diagram;if(null!==a)for(var b=this.nd.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};S.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
  S.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?V.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),V.prototype.move.call(this,a,!1),J.free(a));rf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
  S.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};S.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};
  S.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Hb),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()===dg))return this.na.Xv(.5,a),a.add(this.i(0)),c=this.na.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===dg){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);L.yz(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;d<c/2&&f<b;){e=g[f];if(d+e>c/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};
  S.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Pa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===dg))return this.na.vy(.5);if(this.computeCurve()===dg&&4<=a){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){c=Math.floor(c);a=this.i(c);b=this.i(c+1);var d=this.i(c+2);c=this.i(c+3);return L.xz(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Pa(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength;
  var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Pa(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Pa(d)};t=S.prototype;t.i=function(a){return this.Ab.j[a]};t.Qc=function(a,b){this.Ab.Pc(a,b)};t.L=function(a,b,c){this.Ab.Pc(a,new J(b,c))};t.wA=function(a,b){this.Ab.wb(a,b)};
  t.m=function(a,b,c){this.Ab.wb(a,new J(b,c))};t.ce=function(a){this.Ab.add(a)};t.vf=function(a,b){this.Ab.add(new J(a,b))};t.uw=function(a){this.Ab.cb(a)};t.pk=function(){this.Ab.clear()};
  function rf(a,b,c){if(0!==b||0!==c)if(0===a.pointsCount)a.defaultFromPoint&&a.defaultFromPoint.copy().offset(b,c),a.defaultToPoint&&a.defaultToPoint.copy().offset(b,c);else{for(var d=a.ud,e=new E,f=a.Ab.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Ab;a.Ab=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.sc?a.s():(a.dg.h(a.dg.x+b,a.dg.y+c),a.la.h(a.la.x+b,a.la.y+c),Il(a));d?qp(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&
  (a.defaultToPoint=a.i(a.pointsCount-1)));null!==g&&g.animationManager.sc&&(b=g.animationManager,a.jf=e,b.$l.add(a));a.g("points",f,e)}}t.Th=function(){null===this.ph&&(this.ph=this.Ab,this.Ab=this.Ab.copy())};
  t.xf=function(){if(null!==this.ph){for(var a=this.ph,b=this.Ab,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.j,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.dc();break}}else this.dc();this.ph=null;c=this.diagram;null!==c&&c.animationManager.sc&&(c=c.animationManager,this.jf=b,c.$l.add(this));qp(this);
  this.g("points",a,b)}};t.yw=function(){null!==this.ph&&(this.Ab=this.ph,this.ph=null)};function qp(a){0===a.Ab.count?a.ud=!1:(a.ud=!0,a.$r=null,a.Ru=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),rp(a,!1))}
  t.Ua=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Yt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.jf&&!a.isTicking&&a.isAnimating&&(this.jf=null)}a=this.path;null!==a&&(this.ud=!1,this.s(),a.s())}};t.xj=function(){if(!this.ud&&!this.Ct){var a=!0;try{this.Ct=!0,this.Th(),a=this.computePoints()}catch(b){this.Ct=!1,this.yw()}finally{this.Ct=!1,a?this.xf():this.yw()}}};
  S.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(sp||(sp=new W,sp.desiredSize=Ib,sp.Ta()),this.defaultFromPoint&&(sp.location=this.defaultFromPoint,sp.Ta(),b=a=sp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.Mx=a;if(null===a||!a.location.o())return!1;for(;!(null===b||b.actualBounds.o()&&b.Gf());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(tp||(tp=new W,
  tp.desiredSize=Ib,tp.Ta()),this.defaultToPoint&&(tp.location=this.defaultToPoint,tp.Ta(),e=d=tp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.Nx=d;if(null===d||!d.location.o())return!1;for(;!(null===e||e.actualBounds.o()&&e.Gf());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=up(g),k=up(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===dg;this.Vf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===
  ag||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=f&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),h=this.adjustPoints(0,p,f-1,k))&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),this.adjustPoints(0,p,f-1,k)),!h)if(this.pk(),n){f=this.getLinkPoint(a,b,g,!0,!1,d,e);p=this.getLinkPoint(d,e,c,!1,!1,a,b);h=p.x-f.x;k=p.y-f.y;l=this.computeCurviness();n=m=0;var r=f.x+h/3,q=f.y+k/3,u=r,w=q;L.A(k,0)?w=0<h?w-l:w+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=
  (0>k?-1:1)*n+r,w=m*(u-r)+q);r=f.x+2*h/3;q=f.y+2*k/3;var v=r,y=q;L.A(k,0)?y=0<h?y-l:y+l:(v=(0>k?-1:1)*n+r,y=m*(v-r)+q);this.pk();this.ce(f);this.vf(u,w);this.vf(v,y);this.ce(p);this.Qc(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.Qc(3,this.getLinkPoint(d,e,c,!1,!1,a,b))}else if(f=d,p=e,d=this.getLinkPoint(a,b,g,!0,!1,f,p),e=this.getLinkPoint(f,p,c,!1,!1,a,b),this.hasCurviness())p=e.x-d.x,c=e.y-d.y,g=this.computeCurviness(),a=d.x+p/2,b=d.y+c/2,f=a,h=b,L.A(c,0)?h=0<p?h-g:h+g:(p=-p/c,f=Math.sqrt(g*g/(p*
  p+1)),0>g&&(f=-f),f=(0>c?-1:1)*f+a,h=p*(f-a)+b),this.ce(d),this.vf(f,h),this.ce(e);else{this.ce(d);this.ce(e);h=N.alloc();b.mj(h);k=h.$(e);p.mj(h);l=h.$(d);if(k||l)g=b.da(vp(g),new J),this.Qc(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.da(vp(c),new J),this.Qc(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));N.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.pk();var z=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);r=u=q=0;if(m||!h||l)w=this.computeEndSegmentLength(a,b,g,!0),r=this.getLinkDirection(a,
  b,n,g,!0,m,d,e),l&&(h||g.w(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(r-=m?90:30,0>z&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(w+=Math.abs(z)*(m?1:2)),0===r?q=w:90===r?u=w:180===r?q=-w:270===r?u=-w:(q=w*Math.cos(r*Math.PI/180),u=w*Math.sin(r*Math.PI/180)),g.nc()&&l&&(w=b.da(zc,J.alloc()),v=J.allocAt(w.x+1E3*q,w.y+1E3*u),this.getLinkPointFromPoint(a,b,w,v,!0,n),J.free(w),J.free(v));w=this.getLinkPoint(d,e,c,!1,m,a,b);var A=y=v=0;if(m||!k||l){var C=this.computeEndSegmentLength(d,e,c,!1);A=this.getLinkDirection(d,
  e,w,c,!1,m,a,b);l&&(k||g.w(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(A+=m?0:30,0>z&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(C+=Math.abs(z)*(m?1:2));0===A?v=C:90===A?y=C:180===A?v=-C:270===A?y=-C:(v=C*Math.cos(A*Math.PI/180),y=C*Math.sin(A*Math.PI/180));c.nc()&&l&&(c=e.da(zc,J.alloc()),g=J.allocAt(c.x+1E3*v,c.y+1E3*y),this.getLinkPointFromPoint(d,e,c,g,!1,w),J.free(c),J.free(g))}c=n;if(m||!h||l)c=new J(n.x+q,n.y+u);g=w;if(m||!k||l)g=new J(w.x+v,w.y+y);!p&&!m&&h&&3<f&&this.adjustPoints(0,n,f-2,g)?this.Qc(f-
  1,w):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,w)?this.Qc(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.Qc(0,n),this.Qc(f-1,w)):(this.pk(),this.ce(n),(m||!h||l)&&this.ce(c),m&&this.addOrthoPoints(c,r,g,A,a,d),(m||!k||l)&&this.ce(g),this.ce(w))}return!0};function wp(a,b){Math.abs(b.x-a.x)>Math.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}
  S.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new J);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.he()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.Fd;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.zk(e,d,g,c,f);null!==
  a&&f.transform(a);return f};function xp(a,b){var c=b.yp;null===c&&(c=new yp,c.port=b,c.node=b.part,b.yp=c);return zp(c,a)}
  S.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.kb()&&!up(c))return b.da(c,h),h;if(c.Oc()){var k=xp(this,b);if(null!==k){h.assign(k.Qq);if(e&&this.routing===Ap){var l=xp(this,g);if(null!==l&&k.wm<l.wm){k=J.alloc();l=J.alloc();var m=new N(b.da(tc,k),b.da(Dc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Ef(Gc)||c.Ef(Hc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Ef(Ec)||c.Ef(Ic))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
  b.da(vp(c),J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=wp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.da(vp(k),f),e&&(g=wp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
  S.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.kb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.Oc()&&(k=xp(this,b),null!==k))switch(k.Ac){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.da(zc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?wp(k,h.copy()):c):(c=J.alloc(),h=h.da(zc,c),J.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;J.free(k);k=c}d.nc()&&g.Kd(a)&&(k+=180,360<=k&&(k-=360));if(up(d))return k;a=b.lj();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};S.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Oc()&&(a=xp(this,b),null!==a))return a.Pv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
  S.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=zc:(b=this.fromSpot,b.Mb()&&(b=a.fromSpot),a=b===Vc?sc:b)):(a=b?b:this.toPort,null===a?a=zc:(b=this.toSpot,b.Mb()&&(b=a.toSpot),a=b===Vc?sc:b));return a};function up(a){return a===sc||.5===a.x&&.5===a.y}function vp(a){return.5===a.x&&.5===a.y?a:zc}
  S.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==ag&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.yp;a=null!==a?zp(a,this):null;return null!==a?a.Qq:b.da(zc)};S.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};
  S.prototype.zf=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=ld.alloc(),g.reset());g.multiply(this.transform);if(this.Jh(a,g))return ln(this,b,c,e),void 0===f&&ld.free(g),!0;if(this.Mc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.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=ld.alloc();n.set(g);
  if(m instanceof X)h=m.zf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Kf)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.Jh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Ge(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var w=J.alloc(),v=J.alloc(),y=J.alloc(),z=ld.alloc();z.set(q);z.jw(m.transform);z.St();v.x=p;v.y=u;v.transform(z);w.x=h;w.y=u;w.transform(z);q=!1;Ln(m,w,v,y)?q=!0:(w.x=p,w.y=r,w.transform(z),Ln(m,w,v,y)?q=!0:(v.x=
  h,v.y=r,v.transform(z),Ln(m,w,v,y)?q=!0:(w.x=h,w.y=u,w.transform(z),Ln(m,w,v,y)&&(q=!0))));ld.free(z);J.free(w);J.free(v);J.free(y);h=q}}else h=m.Jh(h,n)}else h=pl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));ld.free(n)}}}void 0===f&&ld.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&ld.free(g);return!1};
  S.prototype.computeCurve=function(){if(null===this.Vf){var a=this.fromPort,b=this.isOrthogonal;this.Vf=null!==a&&a===this.toPort&&!b}return this.Vf?dg:this.curve};S.prototype.computeCorner=function(){if(this.curve===dg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
  S.prototype.findMidLabel=function(){for(var a=this.path,b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
  S.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Bp;a=Math.max(a,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===Zm||d===$m||d===mp?a=Math.max(a,e):d===Um||d===Vm||d===Sm||d===Tm?a=Math.max(a,g):(b=b.da(zc).Pa(c.da(zc))/180*Math.PI,a=Math.max(a,
  Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===dg&&(a*=1.333)}}return a};S.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===ag&&c.Ua()}};
  S.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=Cp;var b=this.Mf;if(null!==b){for(var c=Ea(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.au===this.fromNode&&(a=-a);Ia(c)}}return a};S.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
  S.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Mf};
  S.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===kp)return!1;e===lp&&(e=jp)}switch(e){case kp:var f=this.i(a),g=this.i(c);if(!f.Qa(b)||!g.Qa(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!L.aa(l,0)){if(L.aa(h,0))var m=0>k?-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);L.aa(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.Qc(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),L.aa(b,0)||(L.aa(h,0)?k=0>k?-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.L(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.Qc(c,d)}}return!0;case lp: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.Qc(a,b);for(a+=1;a<c;a++){b=this.i(a);
  var u=b.x,w=b.y,v=.5;0!==l&&(v=((e-u)*(e-g)+(f-w)*(f-n))/l);var y=e+v*(g-e),z=f+v*(n-f);b=Math.sqrt((u-y)*(u-y)+(w-z)*(w-z));w<q*(u-y)+z&&(b=-b);0<q&&(b=-b);u=h+v*(k-h);v=m+v*(p-m);0!==q?(b=u+b/r,this.L(a,b,v-(b-u)/q)):this.L(a,u,v+b)}this.Qc(c,d)}return!0;case jp:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,L.A(e.y,f.y)?L.A(f.x,g.x)?m=b.y:L.A(f.y,g.y)&&(h=b.x):L.A(e.x,f.x)&&(L.A(f.y,g.y)?h=b.x:L.A(f.x,g.x)&&(m=b.y)),this.L(a+1,h,m),e=this.i(c),f=this.i(c-
  1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,L.A(e.y,f.y)?L.A(f.x,g.x)?m=d.y:L.A(f.y,g.y)&&(h=d.x):L.A(e.x,f.x)&&(L.A(f.y,g.y)?h=d.x:L.A(f.x,g.x)&&(m=d.y)),this.L(c-1,h,m),Sj(this))){this.L(a+1,n,l);this.L(c-1,k,p);c=!1;break a}this.Qc(a,b);this.Qc(c,d);c=!0}return c;default:return!1}};
  S.prototype.addOrthoPoints=function(a,b,c,d,e,f){0>b?b+=360:360<=b&&(b-=360);0>d?d+=360:360<=d&&(d-=360);var g=d;b=315<=b||45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=315<=d||45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.actualBounds.copy(),k=f.actualBounds.copy();if(h.o()&&k.o()){h.Jc(Dp,Dp);k.Jc(Dp,Dp);h.Oe(a);k.Oe(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x){var l=new J(c.x,a.y);var m=new J(c.x,(a.y+c.y)/2);180===d?(l.x=this.computeMidOrthoPosition(a.x,
  a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,a.y,k.left,c.y,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y)}else{l=new J(a.x,c.y);m=new J((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.$(a)||h.$(c))?
  l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l=new J(Math.max((a.x+c.x)/2,a.x),a.y),m=new J(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top,
  k.top)):Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||90===d&&c.y>a.y&&k.left<a.x)l=new J(c.x,a.y),m=new J(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,a.y,k.right,c.y,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.left,
  m.x=l.x,m.y=c.y):180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l=new J(a.x,c.y);m=new J((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.$(a)||h.$(c))?l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,
  k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l=new J(Math.min((a.x+c.x)/2,a.x),a.y),m=new J(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l=new J(a.x,c.y),m=new J((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.x,
  a.y,c.x,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.x,a.y,c.x,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l=new J(c.x,a.y);m=new J(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.$(a)||h.$(c))?
  l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l=new J(a.x,Math.max((a.y+c.y)/2,a.y)),m=new J(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,
  k.left)):Math.max(c.x,90===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l=new J(a.x,c.y),m=new J((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.top,m.x=c.x,m.y=l.y):
  270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l=new J(c.x,a.y);m=new J(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.$(a)||h.$(c))?l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=
  l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&&c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l=new J(a.x,Math.min((a.y+c.y)/2,a.y)),m=new J(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}var n=l,p=m,r=c;if(this.isAvoiding){var q=this.diagram;if(null===q||e===f||this.layer.isTemporary||!uk(q)||h.$(r)&&!f.Kd(e)||k.$(a)&&!e.Kd(f))b=!1;else{var u=vk(q,!0,this.containingGroup,
  null);if(17!==this.segmentIndex&&u.Ek(Math.min(a.x,n.x),Math.min(a.y,n.y),Math.abs(a.x-n.x),Math.abs(a.y-n.y))&&u.Ek(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y))&&u.Ek(Math.min(p.x,r.x),Math.min(p.y,r.y),Math.abs(p.x-r.x),Math.abs(p.y-r.y)))b=!1;else{e=a;f=r;var w=c=null;if(q.isVirtualized){q=u.bounds.copy();q.Jc(-u.zq,-u.yq);var v=J.alloc();Ak(u,a.x,a.y)||(L.Cf(q.x,q.y,q.x+q.width,q.y+q.height,a.x,a.y,n.x,n.y,v)?(c=a=v.copy(),b=v.Pa(n)):L.Cf(q.x,q.y,q.x+q.width,q.y+q.height,
  n.x,n.y,p.x,p.y,v)?(c=a=v.copy(),b=v.Pa(p)):L.Cf(q.x,q.y,q.x+q.width,q.y+q.height,p.x,p.y,r.x,r.y,v)&&(c=a=v.copy(),b=v.Pa(r)));Ak(u,r.x,r.y)||(L.Cf(q.x,q.y,q.x+q.width,q.y+q.height,r.x,r.y,p.x,p.y,v)?(w=r=v.copy(),d=p.Pa(v)):L.Cf(q.x,q.y,q.x+q.width,q.y+q.height,p.x,p.y,n.x,n.y,v)?(w=r=v.copy(),d=n.Pa(v)):L.Cf(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,a.x,a.y,v)&&(w=r=v.copy(),d=a.Pa(v)));J.free(v)}h=h.copy().Rc(k);h.Jc(u.zq*u.Wy,u.yq*u.Wy);Ep(u,a,b,r,d,h,!0);k=Fp(u,r.x,r.y);!u.abort&&k>=Gp&&(zk(u),
  h.Jc(u.zq*u.Gy,u.yq*u.Gy),Ep(u,a,b,r,d,h,!1),k=Fp(u,r.x,r.y));if(!u.abort&&k<Gp&&Fp(u,r.x,r.y)!==Bk){Hp(this,u,r.x,r.y,d,!0,g);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=r.y):(h.x=r.x,h.y=a.y),this.L(2,h.x,h.y),this.m(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)L.A(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.L(2,h,a.y),this.L(3,h,g.y)):L.A(h.y,g.y)?(Math.abs(a.y-h.y)<=u.yq/2&&(this.L(2,h.x,a.y),this.L(3,g.x,a.y)),this.m(2,h.x,a.y)):this.L(2,a.x,h.y);else if(90===
  b||270===b)L.A(h.y,g.y)?(h=90===b?Math.max(h.y,a.y):Math.min(h.y,a.y),this.L(2,a.x,h),this.L(3,g.x,h)):L.A(h.x,g.x)?(Math.abs(a.x-h.x)<=u.zq/2&&(this.L(2,a.x,h.y),this.L(3,a.x,g.y)),this.m(2,a.x,h.y)):this.L(2,h.x,a.y);null!==c&&(a=this.i(1),g=this.i(2),a.x!==g.x&&a.y!==g.y?0===b||180===b?this.m(2,a.x,g.y):this.m(2,g.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==w&&(0===d||180===d?this.vf(f.x,w.y):this.vf(w.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.ce(l),this.ce(m))}};
  S.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Oc()||this.computeSpot(!1,this.toPort).Oc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
  function Sj(a){if(null===a.diagram||!a.isAvoiding||!uk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=vk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.Ek(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
  function Hp(a,b,c,d,e,f,g){var h=b.zq,k=b.yq,l=Fp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>Ip&&Fp(b,m,n)!==l-1&&(Fp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):Fp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):Fp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):Fp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>Ip&&Fp(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,--l;if(f){if(l>Ip)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/
  k)*k+k/2;l>Ip&&(f=e,g=c,m=d,0===e?(f=90,m+=k):90===e?(f=180,g-=h):180===e?(f=270,m-=k):270===e&&(f=0,g+=h),Fp(b,g,m)===l-1?Hp(a,b,g,m,f,!1,f):(g=c,m=d,0===e?(f=270,m-=k):90===e?(f=0,g+=h):180===e?(f=90,m+=k):270===e&&(f=180,g-=h),Fp(b,g,m)===l-1&&Hp(a,b,g,m,f,!1,f)));a.vf(c,d)}S.prototype.Sz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=xb(b,a,c.x,c.y,d.x,d.y),f=0,g=1;g<this.pointsCount-1;g++){c=this.i(g+1);var h=xb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};
  S.prototype.dc=function(){this.$m=!1;this.s()};S.prototype.Gk=function(a){if(!a){if(!1===this.ud)return;a=this.tb();if(this.$m&&(null===a||null!==a.geometry))return}this.na=this.makeGeometry();a=this.path;if(null!==a){a.na=this.na;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Kf&&(e.na=this.na)}}};
  S.prototype.makeGeometry=function(){var a=this.na,b=this.pointsCount;if(2>b)return a.type=ud,this.$m=!0,a;var c=!1,d=this.diagram;null!==d&&np(this)&&d.Vg.contains(this)&&(0!==this.Yl.width||0!==this.Yl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Ab.j;var g=this.computeCurve();if(g===dg&&3<=b&&!L.aa(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;k++)h=d[k],f.x=
  Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=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;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.vv.x;k-=this.vv.y;e.x-=d;e.y-=k;if(2!==b||np(this)){a.type=sd;h=Fd(a);0!==this.computeShortLength(!0)&&(e=Jp(this,e,!0,f));Gd(h,e.x,e.y,!1);if(g===dg&&3<=b&&!L.aa(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
  (e=Jp(this,e,!1,f)),Hd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new J(d,k);e=this.i(1).copy();g=new J(d,k);b=new J(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,r=l,q=this.i(Kp(this,l,n,!1));if(!L.aa(p.x,r.x)||!L.aa(r.x,q.x))if(!L.aa(p.y,r.y)||!L.aa(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var w=p.x;p=p.y;var v=r.x;r=r.y;var y=q.x;q=q.y;var z=u*Lp(w,p,v,r);u*=Lp(v,r,y,q);L.aa(p,r)&&L.aa(v,y)&&(v>w?q>r?(g.x=v-z,g.y=r-z,b.x=v+u,b.y=
  r+u):(g.x=v-z,g.y=r+z,b.x=v+u,b.y=r-u):q>r?(g.x=v+z,g.y=r-z,b.x=v-u,b.y=r+u):(g.x=v+z,g.y=r+z,b.x=v-u,b.y=r-u));L.aa(w,v)&&L.aa(r,q)&&(r>p?(y>v?(g.x=v-z,g.y=r-z,b.x=v+u):(g.x=v+z,g.y=r-z,b.x=v-u),b.y=r+u):(y>v?(g.x=v-z,g.y=r+z,b.x=v+u):(g.x=v+z,g.y=r+z,b.x=v-u),b.y=r-u));if(L.aa(w,v)&&L.aa(v,y)||L.aa(p,r)&&L.aa(r,q))w=.5*(w+y),p=.5*(p+q),g.x=w,g.y=p,b.x=w,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&L.aa(c.x,this.i(0).x)&&L.aa(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Hd(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=Jp(this,e.copy(),!1,Bb));f=.5*(f+e.x);c=.5*(c+e.y);Hd(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=Jp(this,g.copy(),!1,Bb)),Hd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=J.alloc();f.assign(this.i(0));e=J.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=
  0;n<b;){n=Kp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.w(m))0!==this.computeShortLength(!1)&&(m=Jp(this,m.copy(),!1,Bb)),Mp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Mp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Kp(this,m,n+1,n<b-3);n=-d;w=-k;p=m;u=this.i(l);v=c;if(L.A(f.y,p.y)&&L.A(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=y=Math.min(r,Math.abs(u.y-p.y)/2),L.A(r,0))Mp(this,h,n,w,f,p,v),f.assign(p);else{q=p.x;z=p.y;var A=q,C=z;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?C=p.y+
  y:C=p.y-y;Mp(this,h,n,w,f,new J(q,z),v);Id(h,p.x+n,p.y+w,A+n,C+w);f.h(A,C)}else L.A(f.x,p.x)&&L.A(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=y=Math.min(r,Math.abs(u.x-p.x)/2),L.A(y,0)?(Mp(this,h,n,w,f,p,v),f.assign(p)):(q=p.x,z=p.y,A=q,C=z,p.y>f.y?z=p.y-r:z=p.y+r,u.x>p.x?A=p.x+y:A=p.x-y,Mp(this,h,n,w,f,new J(q,z),v),Id(h,p.x+n,p.y+w,A+n,C+w),f.h(A,C))):(Mp(this,h,n,w,f,p,v),f.assign(p));e.assign(m);n=l}J.free(f)}Wd=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Jp(this,
  e,!0,f)),0!==this.computeShortLength(!1)&&(h=Jp(this,h,!1,f)),a.type=ud,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.$m=!0;return a};function Lp(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 L.aa(a,0)?b:L.aa(b,0)?a:Math.sqrt(a*a+b*b)}
  function Jp(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=Lp(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=Lp(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 Kp(a,b,c,d){for(var e=a.pointsCount,f=b;L.aa(b.x,f.x)&&L.aa(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!L.aa(b.x,f.x)&&!L.aa(b.y,f.y))return c-1;for(var g=f;L.aa(b.x,f.x)&&L.aa(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||L.aa(b.y,f.y)&&L.aa(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}S.prototype.computeJumpLength=function(){return 10};
  function Mp(a,b,c,d,e,f,g){if(!g&&np(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=Np(a,e,f,k));if(0<l)if(L.A(e.y,f.y))if(e.x<f.x)for(var m=0;m<l;){var n=Math.max(e.x,Math.min(k[m++]-h,f.x-g));b.lineTo(n+c,f.y+d);var p=n+c;for(var r=Math.min(n+g,f.x);m<l;)if(n=k[m],n<r+g)m++,r=Math.min(n+h,f.x);else break;n=f.y-g+d;r+=c;var q=f.y+d;a.curve===$f?Gd(b,r,q,!1):Hd(b,p,n,r,n,r,q)}else for(--l;0<=l;){m=Math.min(e.x,Math.max(k[l--]+h,f.x+g));b.lineTo(m+c,f.y+d);p=m+c;for(n=Math.max(m-
  g,f.x);0<=l;)if(m=k[l],m>n-g)l--,n=Math.max(m-h,f.x);else break;m=f.y-g+d;n+=c;r=f.y+d;a.curve===$f?Gd(b,n,r,!1):Hd(b,p,m,n,m,n,r)}else if(L.A(e.x,f.x))if(e.y<f.y)for(m=0;m<l;){n=Math.max(e.y,Math.min(k[m++]-h,f.y-g));b.lineTo(f.x+c,n+d);p=n+d;for(n=Math.min(n+g,f.y);m<l;)if(r=k[m],r<n+g)m++,n=Math.min(r+h,f.y);else break;r=f.x-g+c;q=f.x+c;n+=d;a.curve===$f?Gd(b,q,n,!1):Hd(b,r,p,r,n,q,n)}else for(--l;0<=l;){m=Math.min(e.y,Math.max(k[l--]+h,f.y+g));b.lineTo(f.x+c,m+d);p=m+d;for(m=Math.max(m-g,f.y);0<=
  l;)if(n=k[l],n>m-g)l--,m=Math.max(n-h,f.y);else break;n=f.x-g+c;r=f.x+c;m+=d;a.curve===$f?Gd(b,r,m,!1):Hd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)}
  function Np(a,b,c,d){var e=a.diagram;if(null===e||b.w(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;h<g;h++){var k=f[h];if(k instanceof S){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&np(k)){var l=k.routeBounds;l.o()&&a.routeBounds.Mc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Gf()&&Op(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
  function Op(a,b,c,d){for(var e=L.A(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,w=l.y;if(!L.A(m,p)){if(L.A(n,r)&&L.A(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,w)<n&&Math.max(g,w)>n&&!L.A(g,w)){h.x=q;h.y=n;m=!0;break a}}else if(!L.A(n,r)&&
  L.A(g,w)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!L.A(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}J.free(h)}function np(a){a=a.curve;return a===Zf||a===$f}function rp(a,b){if(b||np(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Vg.contains(a)||0===a.Yl.width&&0===a.Yl.height||b.Vg.add(a,a.Yl.copy())}
  S.prototype.Oq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){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;h<g;h++){var k=e[h];k instanceof S&&(k===this?f=!0:f&&Pp(this,k,a))}}else if(d)for(f=e.Fa.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof S&&Pp(this,h,a)}}}};
  function Pp(a,b,c){if(null!==b&&b.$m&&b.ud&&np(b)){var d=b.routeBounds;d.o()&&(a.routeBounds.Mc(d)||c.Mc(d))&&(a.usesSamePort(b)||b.dc())}}S.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Qa(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Qa(a)||d.Qa(a)||b.Qa(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
  S.prototype.isVisible=function(){if(!V.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
  this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};S.prototype.Ob=function(a){V.prototype.Ob.call(this,a);null!==this.Mf&&this.Mf.Dm();if(null!==this.nd)for(var b=this.nd.iterator;b.next();)b.value.Ob(a)};S.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?jp:this.Yk};
  function op(a){var b=a.We;if(null!==b){var c=a.rf;if(null!==c&&isNaN(a.curviness)){for(var d=a.Xe,e=a.sf,f=a=null,g=b.$a.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.We===b&&l.Xe===d&&l.rf===c&&l.sf===e||l.We===c&&l.Xe===e&&l.rf===b&&l.sf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Uo(b,c,d,e);null===f&&(f=new Qp(b,d,c,e),To(b,f),To(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Mf=f;f.Dm()}}}}
  function pp(a){var b=a.Mf;null!==b&&isNaN(a.curviness)&&(a.Mf=null,a=b.links.indexOf(a),0<=a&&(Da(b.links,a),b.Dm()))}S.prototype.Ph=function(){return!0};
  na.Object.defineProperties(S.prototype,{fromNode:{get:function(){return this.We},set:function(a){var b=this.We;if(b!==a){var c=this.fromPort;null!==b&&(this.rf!==b&&Yo(b,this,c),pp(this),this.C(2));this.We=a;null!==a&&this.Ob(a.isVisible());this.Vf=null;this.Ua();var d=this.diagram;null!==d&&d.Z&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&
  (this.rf!==a&&Xo(a,this,e),op(this),this.C(1));this.g("fromNode",b,a);Qo(this)}}},fromPortId:{get:function(){return this.Xe},set:function(a){var b=this.Xe;if(b!==a){var c=this.fromPort;null!==c&&Vo(c);pp(this);this.Xe=a;var d=this.fromPort;null!==d&&Vo(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.qj()&&g.Cw(f,a)}c!==d&&(this.Vf=null,this.Ua(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));op(this);
  this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.We;return null===a?null:a.Jt(this.Xe)}},fromPortChanged:{get:function(){return this.fo},set:function(a){var b=this.fo;b!==a&&(this.fo=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.rf},set:function(a){var b=this.rf;if(b!==a){var c=this.toPort;null!==b&&(this.We!==b&&Yo(b,this,c),pp(this),this.C(2));this.rf=a;null!==a&&this.Ob(a.isVisible());
  this.Vf=null;this.Ua();var d=this.diagram;null!==d&&d.Z&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.Z,d.Z=!0);f(this,c,e);null!==d&&(d.Z=g)}null!==a&&(this.We!==a&&Xo(a,this,e),op(this),this.C(1));this.g("toNode",b,a);Qo(this)}}},toPortId:{get:function(){return this.sf},set:function(a){var b=this.sf;if(b!==a){var c=this.toPort;null!==c&&Vo(c);pp(this);this.sf=a;var d=this.toPort;null!==d&&Vo(d);
  var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.qj()&&g.Hw(f,a)}c!==d&&(this.Vf=null,this.Ua(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.Z,e.Z=!0),f(this,c,d),null!==e&&(e.Z=g)));op(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.rf;return null===a?null:a.Jt(this.sf)}},toPortChanged:{get:function(){return this.mq},set:function(a){var b=this.mq;b!==a&&(this.mq=a,this.g("toPortChanged",b,a))}},
  fromSpot:{get:function(){return null!==this.O?this.O.bh:Vc},set:function(a){this.Kc();var b=this.O.bh;b.w(a)||(a=a.H(),this.O.bh=a,this.g("fromSpot",b,a),(b.Oc()||a.Oc())&&null!==this.fromNode&&Vo(this.fromPort),this.Ua())}},fromEndSegmentLength:{get:function(){return null!==this.O?this.O.$g:NaN},set:function(a){this.Kc();var b=this.O.$g;b!==a&&(0>a&&wa(a,">= 0",S,"fromEndSegmentLength"),this.O.$g=a,this.g("fromEndSegmentLength",b,a),this.Ua())}},
  fromShortLength:{get:function(){return null!==this.O?this.O.ah:NaN},set:function(a){this.Kc();var b=this.O.ah;b!==a&&(this.O.ah=a,this.dc(),this.g("fromShortLength",b,a))}},toSpot:{get:function(){return null!==this.O?this.O.Ch:Vc},set:function(a){this.Kc();var b=this.O.Ch;b.w(a)||(a=a.H(),this.O.Ch=a,this.g("toSpot",b,a),(b.Oc()||a.Oc())&&null!==this.toNode&&Vo(this.toPort),this.Ua())}},toEndSegmentLength:{get:function(){return null!==
  this.O?this.O.Ah:NaN},set:function(a){this.Kc();var b=this.O.Ah;b!==a&&(0>a&&wa(a,">= 0",S,"toEndSegmentLength"),this.O.Ah=a,this.g("toEndSegmentLength",b,a),this.Ua())}},toShortLength:{get:function(){return null!==this.O?this.O.Bh:NaN},set:function(a){this.Kc();var b=this.O.Bh;b!==a&&(this.O.Bh=a,this.dc(),this.g("toShortLength",b,a))}},isLabeledLink:{get:function(){return null===this.nd?!1:0<this.nd.count}},labelNodes:{
  get:function(){return null===this.nd?db:this.nd.iterator}},relinkableFrom:{get:function(){return 0!==(this.Ga&1)},set:function(a){var b=0!==(this.Ga&1);b!==a&&(this.Ga^=1,this.g("relinkableFrom",b,a),this.Lb())}},relinkableTo:{get:function(){return 0!==(this.Ga&2)},set:function(a){var b=0!==(this.Ga&2);b!==a&&(this.Ga^=2,this.g("relinkableTo",b,a),this.Lb())}},resegmentable:{get:function(){return 0!==
  (this.Ga&4)},set:function(a){var b=0!==(this.Ga&4);b!==a&&(this.Ga^=4,this.g("resegmentable",b,a),this.Lb())}},isTreeLink:{get:function(){return 0!==(this.Ga&8)},set:function(a){var b=0!==(this.Ga&8);b!==a&&(this.Ga^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Ik(this.fromNode),null!==this.toNode&&Ik(this.toNode))}},path:{get:function(){var a=this.tb();return a instanceof Kf?a:null}},routeBounds:{get:function(){this.xj();
  var a=this.Yl,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Oe(e)}else if(this.computeCurve()===dg&&3<=d&&!this.isOrthogonal)if(e=this.i(0),b=e.x,c=e.y,a.h(b,c,0,0),3===d){d=this.i(1);b=Math.min(d.x,b);c=Math.min(d.y,c);var f=this.i(2);b=Math.min(f.x,b);c=Math.min(f.y,c);L.vm(e.x,e.y,d.x,d.y,d.x,d.y,
  f.x,f.y,.5,a)}else for(f=3;f<d;f+=3){var g=this.i(f-2);f+3>=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);L.vm(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.Oe(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Oe(f);this.vv.h(b-a.x,c-a.y)}return a}},midPoint:{get:function(){this.xj();return this.computeMidPoint(new J)}},midAngle:{
  get:function(){this.xj();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.$r){this.ud||qp(this);for(var a=this.$r=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);L.aa(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):L.aa(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Ie(e));a.push(d)}}return this.$r}},flattenedTotalLength:{get:function(){var a=this.Ru;if(isNaN(a)){for(var b=this.flattenedLengths,
  c=b.length,d=a=0;d<c;d++)a+=b[d];this.Ru=a}return a}},points:{get:function(){return this.Ab},set:function(a){var b=this.Ab;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new E,d=0;d<a.length/2;d++)e=(new J(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=a[e];if(!za(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=
  !1;break}}if(d)for(c=new E,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze())}}else if(a instanceof E)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else B("Link.points value is not an instance of List or Array: "+a);c.freeze();this.Ab=c;this.dc();qp(this);a=this.diagram;null!==a&&(a.pj||a.undoManager.isUndoingRedoing||a.Yt.add(this),a.animationManager.sc&&(a=a.animationManager,this.jf=c,a.$l.add(this)));this.g("points",b,c)}}},pointsCount:{get:function(){return this.Ab.count}},
  ud:{get:function(){return 0!==(this.Ga&16)},set:function(a){0!==(this.Ga&16)!==a&&(this.Ga^=16)}},suspendsRouting:{get:function(){return 0!==(this.Ga&32)},set:function(a){0!==(this.Ga&32)!==a&&(this.Ga^=32)}},Ct:{get:function(){return 0!==(this.Ga&64)},set:function(a){0!==(this.Ga&64)!==a&&(this.Ga^=64)}},defaultFromPoint:{get:function(){return this.u},set:function(a){this.u=a.copy()}},
  defaultToPoint:{get:function(){return this.I},set:function(a){this.I=a.copy()}},isOrthogonal:{get:function(){return 2===(this.ck.value&2)}},isAvoiding:{get:function(){return 4===(this.ck.value&4)}},$m:{get:function(){return 0!==(this.Ga&128)},set:function(a){0!==(this.Ga&128)!==a&&(this.Ga^=128)}},geometry:{get:function(){this.$m||(this.xj(),this.na=
  this.makeGeometry());return this.na}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!up(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!up(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Yk},set:function(a){var b=this.Yk;b!==a&&(this.Yk=a,this.g("adjusting",b,a))}},corner:{
  get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(this.Hn=a,this.dc(),this.g("corner",b,a))}},curve:{get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&(this.Jn=a,this.Ua(),this.dc(),rp(this,b===$f||b===Zf||a===$f||a===Zf),this.g("curve",b,a))}},curviness:{get:function(){return this.Kn},set:function(a){var b=this.Kn;b!==a&&(this.Kn=a,this.Ua(),this.dc(),this.g("curviness",b,a))}},routing:{
  get:function(){return this.ck},set:function(a){var b=this.ck;b!==a&&(this.ck=a,this.Vf=null,this.Ua(),rp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.Zp},set:function(a){var b=this.Zp;b!==a&&(this.Zp=a,this.dc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.qj())return a.model.Wb(this.data)}}});
  S.prototype.invalidateOtherJumpOvers=S.prototype.Oq;S.prototype.findClosestSegment=S.prototype.Sz;S.prototype.updateRoute=S.prototype.xj;S.prototype.invalidateRoute=S.prototype.Ua;S.prototype.rollbackRoute=S.prototype.yw;S.prototype.commitRoute=S.prototype.xf;S.prototype.startRoute=S.prototype.Th;S.prototype.clearPoints=S.prototype.pk;S.prototype.removePoint=S.prototype.uw;S.prototype.addPointAt=S.prototype.vf;S.prototype.addPoint=S.prototype.ce;S.prototype.insertPointAt=S.prototype.m;
  S.prototype.insertPoint=S.prototype.wA;S.prototype.setPointAt=S.prototype.L;S.prototype.setPoint=S.prototype.Qc;S.prototype.getPoint=S.prototype.i;S.prototype.getOtherPort=S.prototype.nA;S.prototype.getOtherNode=S.prototype.Kq;
  var sp=null,tp=null,ip=new D(S,"Normal",1),Rp=new D(S,"Orthogonal",2),Sp=new D(S,"AvoidsNodes",6),Ap=new D(S,"AvoidsNodesStraight",7),ag=new D(S,"None",0),dg=new D(S,"Bezier",9),$f=new D(S,"JumpGap",10),Zf=new D(S,"JumpOver",11),jp=new D(S,"End",17),kp=new D(S,"Scale",18),lp=new D(S,"Stretch",19),Zm=new D(S,"OrientAlong",21),Sm=new D(S,"OrientPlus90",22),Um=new D(S,"OrientMinus90",23),mp=new D(S,"OrientOpposite",24),$m=new D(S,"OrientUpright",25),Tm=new D(S,"OrientPlus90Upright",26),Vm=new D(S,"OrientMinus90Upright",
  27),Wm=new D(S,"OrientUpright45",28),Cp=16,Bp=14,Dp=8;S.className="Link";S.Normal=ip;S.Orthogonal=Rp;S.AvoidsNodes=Sp;S.AvoidsNodesStraight=Ap;S.None=ag;S.Bezier=dg;S.JumpGap=$f;S.JumpOver=Zf;S.End=jp;S.Scale=kp;S.Stretch=lp;S.OrientAlong=Zm;S.OrientPlus90=Sm;S.OrientMinus90=Um;S.OrientOpposite=mp;S.OrientUpright=$m;S.OrientPlus90Upright=Tm;S.OrientMinus90Upright=Vm;S.OrientUpright45=Wm;S.EndSegmentStep=8;S.CurvinessStart=Cp;S.SpacingMin=Bp;S.OrthoShortCut=Dp;S.AvoidanceCell=8;S.AvoidanceLimit=999;
  function Qp(a,b,c,d){Xa(this);this.se=this.hs=!1;this.au=a;this.My=b;this.lw=c;this.Ny=d;this.links=[]}Qp.prototype.Dm=function(){if(!this.hs){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Tu.add(this),this.se=a.undoManager.isUndoingRedoing))}this.hs=!0};
  Qp.prototype.Vw=function(){if(this.hs){this.hs=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.pj&&!this.se;this.se=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Mf=null,a.length=0)}0===a.length&&(a=this.au,null!==this&&null!==a.Se&&a.Se.remove(this),a=this.lw,null!==this&&null!==a.Se&&a.Se.remove(this))}};Qp.className="LinkBundle";
  function wk(){Xa(this);this.Vy=this.group=null;this.Rt=!0;this.abort=!1;this.Bd=this.Ad=1;this.So=this.Ro=-1;this.gc=this.fc=8;this.Rb=null;this.$i=this.Zi=0;this.Wy=11;this.Gy=124}
  wk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Ad=Math.floor((a.x-this.fc)/this.fc)*this.fc;this.Bd=Math.floor((b-this.gc)/this.gc)*this.gc;this.Ro=Math.ceil((c+2*this.fc)/this.fc)*this.fc;this.So=Math.ceil((d+2*this.gc)/this.gc)*this.gc;a=1+(Math.ceil((this.Ro-this.Ad)/this.fc)|0);b=1+(Math.ceil((this.So-this.Bd)/this.gc)|0);if(null===this.Rb||this.Zi<a-1||this.$i<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Rb=c;this.Zi=
  a-1;this.$i=b-1}a=Tp;if(null!==this.Rb)for(b=0;b<=this.Zi;b++)if(c=this.Rb[b],c.fill)c.fill(a);else for(d=0;d<=this.$i;d++)c[d]=a}};function Ak(a,b,c){return a.Ad<=b&&b<=a.Ro&&a.Bd<=c&&c<=a.So}function Fp(a,b,c){if(!Ak(a,b,c))return Tp;b-=a.Ad;b/=a.fc;c-=a.Bd;c/=a.gc;return a.Rb[b|0][c|0]}function zk(a){if(null!==a.Rb)for(var b=0;b<=a.Zi;b++)for(var c=a.Rb[b],d=0;d<=a.$i;d++)c[d]>=Ip&&(c[d]=Tp)}
  wk.prototype.Ek=function(a,b,c,d){if(a>this.Ro||a+c<this.Ad||b>this.So||b+d<this.Bd)return!0;a=(a-this.Ad)/this.fc|0;b=(b-this.Bd)/this.gc|0;c=Math.max(0,c)/this.fc+1|0;var e=Math.max(0,d)/this.gc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.Zi)|0;for(c=Math.min(b+e-1,this.$i)|0;a<=d;a++){e=this.Rb[a];for(var f=b;f<=c;f++)if(e[f]===Bk)return!1}return!0};
  function Up(a,b,c,d,e,f,g,h,k){if(!(b<f||b>g||c<h||c>k)){var l=b|0;var m=c|0;var n=a.Rb[l][m];if(n>=Ip&&n<Gp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Rb[l][m]);)a.Rb[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0<d)for(c+=d;c<l;c+=d)Up(a,b,c,1,!e,f,g,h,k),Up(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Up(a,b,c,1,!e,f,g,h,k),Up(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Up(a,b,c,1,!e,f,g,h,k),Up(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Up(a,b,c,1,!e,f,g,h,k),Up(a,b,c,-1,!e,f,g,h,
  k)}}function Vp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Bk,m=Ip;for(a.Rb[b][c]=m;l===Bk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Rb[b][c]=m,e?c+=d:b+=d,l=a.Rb[b][c]}function Wp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Bk,m=Gp;for(a.Rb[b][c]=m;l===Bk&&b>f&&b<g&&c>h&&c<k;)a.Rb[b][c]=m,e?c+=d:b+=d,l=a.Rb[b][c]}
  function Ep(a,b,c,d,e,f,g){if(null!==a.Rb){a.abort=!1;var h=b.x,k=b.y;if(Ak(a,h,k)){h-=a.Ad;h/=a.fc;k-=a.Bd;k/=a.gc;var l=d.x,m=d.y;if(Ak(a,l,m))if(l-=a.Ad,l/=a.fc,m-=a.Bd,m/=a.gc,1>=Math.abs(h-l)&&1>=Math.abs(k-m))a.abort=!0;else{var n=f.x;d=f.y;b=f.x+f.width;var p=f.y+f.height;n-=a.Ad;n/=a.fc;d-=a.Bd;d/=a.gc;b-=a.Ad;b/=a.fc;p-=a.Bd;p/=a.gc;f=Math.max(0,Math.min(a.Zi,n|0));b=Math.min(a.Zi,Math.max(0,b|0));n=Math.max(0,Math.min(a.$i,d|0));p=Math.min(a.$i,Math.max(0,p|0));d=a.Rb;h|=0;k|=0;l|=0;m|=
  0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===Bk?(Vp(a,h,k,r,c,f,b,n,p),Vp(a,h,k,1,!c,f,b,n,p),Vp(a,h,k,-1,!c,f,b,n,p)):Vp(a,h,k,r,c,h,k,h,k);d[l][m]===Bk?(Wp(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),Wp(a,l,m,1,!(90===e||270===e),f,b,n,p),Wp(a,l,m,-1,!(90===e||270===e),f,b,n,p)):Wp(a,l,m,r,c,l,m,l,m);c=Ea();if(g&&Xp(a,l,m,e,h,k,c)){if(c[0]!==l||c[1]!==m)c.unshift(m),c.unshift(l);if(c[c.length-2]!==h||c[c.length-1]!==k)c.push(h),c.push(k);a=Ip;e=c[c.length-2];g=c[c.length-1];d[e][g]=
  a++;for(f=c.length-4;0<=f;f-=2)for(e=c[f+2],g=c[f+3],b=c[f],l=c[f+1];b>e?e++:b<e?e--:l>g?g++:l<g&&g--,d[e][g]=a++,e!==b||g!==l;);}else Up(a,h,k,1,!1,f,b,n,p),Up(a,h,k,-1,!1,f,b,n,p),Up(a,h,k,1,!0,f,b,n,p),Up(a,h,k,-1,!0,f,b,n,p);Ia(c)}}}}
  function Xp(a,b,c,d,e,f,g){for(var h=a.Rb,k=b,l=c;;){if(k===e&&l===f)return!0;var m=k,n=l;if(0===d)if(m<e)m++;else break;else if(90===d)if(n<f)n++;else break;else if(180===d)if(m>e)m--;else break;else if(n>f)n--;else break;var p=h[m][n];if(0===p||p===Yp)break;k=m;l=n}for(;;){m=d;n=k;p=l;0===d?p<f?(m=90,p++):p>f&&(m=270,p--):90===d?n<e?(m=0,n++):n>e&&(m=180,n--):180===d?p<f?(m=90,p++):p>f&&(m=270,p--):n<e?(m=0,n++):n>e&&(m=180,n--);n=h[n][p];if(m!==d&&0!==n&&n!==Yp){g.push(k);g.push(l);if(Xp(a,k,l,
  m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=Yp;if(0===d){if(k===b)return!1;k--}else if(90===d){if(l===c)return!1;l--}else if(180===d){if(k===b)return!1;k++}else{if(l===c)return!1;l++}}}
  na.Object.defineProperties(wk.prototype,{bounds:{get:function(){return new N(this.Ad,this.Bd,this.Ro-this.Ad,this.So-this.Bd)}},zq:{get:function(){return this.fc},set:function(a){0<a&&a!==this.fc&&(this.fc=a,this.initialize(this.bounds))}},yq:{get:function(){return this.gc},set:function(a){0<a&&a!==this.gc&&(this.gc=a,this.initialize(this.bounds))}}});var Bk=0,Ip=1,Gp=999999,Tp=Gp+1,Yp=Gp+2;wk.className="PositionArray";
  function yp(){Xa(this);this.port=this.node=null;this.de=[];this.Sq=!1}yp.prototype.toString=function(){for(var a=this.de,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
  function Zp(a,b,c,d){b=b.offsetY;switch(b){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(b){case 9:return 180<c?270:90;case 6:return 90<c&&270>=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 90<c&&c<=180+a?180:c>180+a&&c<=360-a?270:0;case 13:return 180<c&&c<=360-a?270:c>a&&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}yp.prototype.Dm=function(){this.de.length=0};
  function zp(a,b){var c=a.de;if(0===c.length){a:if(!a.Sq){c=a.Sq;a.Sq=!0;var d=null,e=a.node,f=e instanceof U?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.py();else{if(!f.actualBounds.o()){a.Sq=c;break a}d=f;g=d.Rv()}f=a.de.length=0;var h=a.port.da(tc,J.alloc()),k=a.port.da(Dc,J.alloc());e=N.allocAt(h.x,h.y,0,0);e.Oe(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.lj();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&&
  l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Kd(d),n=l.computeSpot(m,a.port);if(n.Oc()){var p=m?l.toPort:l.fromPort;if(null!==p&&(m=p.part,null!==m)){var r=m.findVisibleNode();null!==r&&r!==m&&(m=r,p=m.port);m=l.computeOtherPoint(m,p);p=h.Pa(p.da(zc));p+=(h.Pa(m)-p)/360;p-=k;0>p?p+=360:360<=p&&(p-=360);n=Zp(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):90===n?(n=8,270<p&&(p-=360)):180===n?n=2:(n=1,90>p&&(p+=360));r=a.de[f];void 0===r?(r=new $p(l,p,n),a.de[f]=
  r):(r.link=l,r.angle=p,r.Ac=n);r.ow.set(m);f++}}}}J.free(h);a.de.sort(yp.prototype.l);k=a.de.length;d=-1;for(f=h=0;f<k;f++)g=a.de[f],void 0!==g&&(g.Ac!==d&&(d=g.Ac,h=0),g.Lq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.de[f],void 0!==k&&(k.Ac!==d&&(d=k.Ac,h=k.Lq+1),k.wm=h);f=a.de;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.da(tc,h);n.da(vc,k);n.da(Dc,g);n.da(Bc,l);r=p=m=n=0;if(d===fp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var w=u.link.computeThickness();
  switch(u.Ac){case 8:p+=w;break;case 2:r+=w;break;case 1:n+=w;break;default:case 4:m+=w}}}var v=q=0,y=1,z=u=0;for(w=0;w<f.length;w++){var A=f[w];if(null!==A){if(q!==A.Ac){q=A.Ac;switch(q){case 8:var C=g;v=l;break;case 2:C=l;v=h;break;case 1:C=h;v=k;break;default:case 4:C=k,v=g}u=v.x-C.x;z=v.y-C.y;switch(q){case 8:p>Math.abs(u)?(y=Math.abs(u)/p,p=Math.abs(u)):y=1;break;case 2:r>Math.abs(z)?(y=Math.abs(z)/r,r=Math.abs(z)):y=1;break;case 1:n>Math.abs(u)?(y=Math.abs(u)/n,n=Math.abs(u)):y=1;break;default:case 4:m>
  Math.abs(z)?(y=Math.abs(z)/m,m=Math.abs(z)):y=1}v=0}var F=A.Qq;if(d===fp){A=A.link.computeThickness();A*=y;F.set(C);switch(q){case 8:F.x=C.x+u/2+p/2-v-A/2;break;case 2:F.y=C.y+z/2+r/2-v-A/2;break;case 1:F.x=C.x+u/2-n/2+v+A/2;break;default:case 4:F.y=C.y+z/2-m/2+v+A/2}v+=A}else{var Q=.5;d===So&&(Q=(A.Lq+1)/(A.wm+1));F.x=C.x+u*Q;F.y=C.y+z*Q}}}J.free(h);J.free(k);J.free(g);J.free(l);C=a.de;for(f=0;f<C.length;f++)d=C[f],null!==d&&(d.Pv=a.computeEndSegmentLength(d));a.Sq=c;N.free(e)}c=a.de}for(a=0;a<c.length;a++)if(e=
  c[a],null!==e&&e.link===b)return e;return null}yp.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
  yp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,sc,b.fromPort===this.port),d=a.Lq;if(0>d)return c;var e=a.wm;if(1>=e||!b.isOrthogonal)return c;b=a.ow;var f=a.Qq;if(2===a.Ac||8===a.Ac)d=e-1-d;return((a=2===a.Ac||4===a.Ac)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};yp.className="Knot";function $p(a,b,c){this.link=a;this.angle=b;this.Ac=c;this.ow=new J;this.wm=this.Lq=0;this.Qq=new J;this.Pv=0}
  $p.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ac.toString()+":"+this.Lq.toString()+"/"+this.wm.toString()+" "+this.Qq.toString()+" "+this.Pv.toString()+" "+this.ow.toString()};$p.className="LinkInfo";function jl(){this.Ch=this.bh=Vc;this.Bh=this.ah=this.Ah=this.$g=NaN;this.kq=this.co=null;this.lq=this.eo=Infinity}
  jl.prototype.copy=function(){var a=new jl;a.bh=this.bh.H();a.Ch=this.Ch.H();a.$g=this.$g;a.Ah=this.Ah;a.ah=this.ah;a.Bh=this.Bh;a.co=this.co;a.kq=this.kq;a.eo=this.eo;a.lq=this.lq;return a};jl.className="LinkSettings";function Bi(){Xa(this);this.u=this.B=null;this.zi=this.xo=!0;this.Co=!1;this.nn=(new J(0,0)).freeze();this.zo=!0;this.vn=this.yo=null;this.Bo=!1;this.l=null;this.I=0;this.To=this.qq=null;this.wt=!1;this.yg=this.ek=null;this.lt=!1}
  Bi.prototype.cloneProtected=function(a){a.xo=this.xo;a.zi=this.zi;a.Co=this.Co;a.nn.assign(this.nn);a.zo=this.zo;a.yo=this.yo;a.vn=this.vn;a.Bo=!0;a.To=this.To;a.qq=this.qq};Bi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Bi.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
  Bi.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new J(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};Bi.prototype.jb=function(){};Bi.prototype.toString=function(){var a=Ja(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
  Bi.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.Bc(),this.isOngoing&&a.pj||this.isInitial&&!a.pj)&&(this.isValidLayout=!1,a.Db())}}};Bi.prototype.createNetwork=function(){return new aq(this)};Bi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof R?(b.Ag(a.nodes,!0),b.Ag(a.links,!0)):a instanceof U?b.Ag(a.memberParts):b.Ag(a.iterator);return b};
  Bi.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}try{null!==a&&a.xa("Layout"),this.commitLayout()}finally{null!==a&&a.Xa("Layout")}}};Bi.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
  Bi.prototype.doLayout=function(a){var b=new G;a instanceof R?(bq(this,b,a.nodes,!0,this.Rh,!0,!1,!0),bq(this,b,a.parts,!0,this.Rh,!0,!1,!0)):a instanceof U?bq(this,b,a.memberParts,!1,this.Rh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.xa("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.Xa("Layout"));this.isValidLayout=!0};
  Bi.prototype.doMinimalNoNetworkLayout=function(a){var b=Math.ceil(Math.sqrt(a.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var c=this.arrangementOrigin.x,d=c,e=this.arrangementOrigin.y,f=0,g=0;for(a=a.iterator;a.next();){var h=a.value;cq(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof U&&(h.Rh=!1);d+=Math.max(l,50)+20;g=Math.max(g,Math.max(k,50));f>=b-1?(f=0,d=c,e+=g+20,g=0):f++}};
  Bi.prototype.doMinimalNetworkLayout=function(){var a=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var b=this.arrangementOrigin.x,c=b,d=this.arrangementOrigin.y,e=0,f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value.node;if(!(null===h||h instanceof S)&&(cq(h),this.Rh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof U&&(h.Rh=!1);c+=Math.max(l,50)+20;f=Math.max(f,Math.max(k,50));e>=a-1?(e=
  0,c=b,d+=f+20,f=0):e++}}};Bi.prototype.Rh=function(a){return!a.location.o()||a instanceof U&&a.Rh?!0:!1};function bq(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 W?k.isLinkLabel||(k instanceof U?null===k.layout?bq(a,b,k.memberParts,!1,e,f,g,h):(cq(k),b.add(k)):(cq(k),b.add(k))):g&&k instanceof S?b.add(k):!h||!k.Nc()||k instanceof W||(cq(k),b.add(k)))}}
  function cq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ta()}Bi.prototype.nj=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};
  Bi.prototype.$x=function(a){var b=new G;a instanceof R?(bq(this,b,a.nodes,!0,null,!0,!0,!0),bq(this,b,a.links,!0,null,!0,!0,!0),bq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof U?bq(this,b,a.memberParts,!1,null,!0,!0,!0):bq(this,b,a.iterator,!1,null,!0,!0,!0);return b};
  Bi.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.da(tc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};Bi.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};Bi.prototype.workerLayout=function(){return!1};
  function dq(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.ek&&(c.running=eq(a.ek));null!==a.yg&&(c.waiting=eq(a.yg));a.workerStateChanged(c,a)}}function eq(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}Bi.prototype.zz=function(){var a=fq(this.constructor);a&&(null!==a.Pe&&a.Pe.terminate(),a.Pe=null,a.Fm.iteratorValues.each(function(a){a.wt=!1;a.ek=null;a.yg=null;a.lt=!1;dq(a)}),a.Fm.clear())};
  function gq(a,b){var c=fq(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function fq(a){var b=null;if("function"===typeof a){if(b=hq.get(a),!b){var c=Ja(a);b=hq.get(c);b||(b=new iq,b.Lv=a,b.name=c,b.l=a.name,b.Cy=jq,hq.set(c,b),hq.set(a,b),hq.set(a.name,b))}}else"string"===typeof a&&(b=hq.get(a));return b}
  Bi.prototype.Uw=function(){if("undefined"===typeof Worker||!kq||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.wt&&(this.lt=!0,this.yg=this.ek=null,dq(this)),!1;var a=fq(this.constructor);if(null===a)return!1;null===a.Pe&&(a.Pe=new Worker(kq),a.Pe.onerror=function(a){a.preventDefault();xa("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.Pe.l=function(a){xa("Worker serialization error: "+a)},a.Pe.onmessage=
  function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version&&R.version&&c.version!==R.version)xa("Failure: GoJS v"+R.version+"  Worker v"+c.version);else if(b=a.Fm.get(c.id)){a.Fm.remove(c.id);b.wt=!1;b.ek=null;if(b.lt)b.lt=!1,b.yg=null;else{var d=lq(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}dq(b,c.time);c=b.yg;if(null!==c)b.yg=null;else for(d=a.Fm.iteratorValues;d.next();){var e=d.value;c=e.yg;if(null!==c){e.yg=null;break}}null!==c&&mq(b,c)}},a.Pe.postMessage({_GoJS:"_GoJS",
  url:a.Cy}),Array.isArray(a.scripts)&&a.scripts.forEach(function(b){a.Pe.postMessage({_GoJS:"_GoJS",url:b})}),a.Pe.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.ek?this.yg=this.network:mq(this,this.network);dq(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function mq(a,b){a.wt=!0;var c=fq(a.constructor),d=nq(a,b,!0);d._GoJS="_GoJS";c.Pe.postMessage(d);c.Fm.set(kb(a),a);a.ek=b}
  function nq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?kb(a):a.id,layout:Ja(a.constructor),p:d,jB:e,Qz:f};a.onNetworkSerialization(2,c,b,d);return d}
  function lq(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.jB,g=new H;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Cb(a.key));null!==b?b=e.mk(b):(b=e.createVertex(),e.Bg(b));c&&null!==a.key&&(b.data={Di:a.key});g.set(a.id,b)});var h=b.Qz,k=new H;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));var f=e.createEdge();e.tm(f);f.link=b;c&&null!==a.key&&(f.data={Di:a.key});k.set(a.id,f)});
  f&&f.forEach(function(a){var b=g.get(a.id);b&&b.Cq(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.deserializeLayoutProperties(b.p,g,k,c,e);a.onNetworkSerialization(4,c,e,b);return e}Bi.prototype.onNetworkSerialization=function(){};
  na.Object.defineProperties(Bi.prototype,{diagram:{get:function(){return this.B},set:function(a){this.B=a}},group:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a,null!==a&&(this.B=a.diagram))}},isOngoing:{get:function(){return this.xo},set:function(a){this.xo!==a&&(this.xo=a)}},isInitial:{get:function(){return this.zi},set:function(a){this.zi=a;a||(this.Bo=!0)}},
  isViewportSized:{get:function(){return this.Co},set:function(a){this.Co!==a&&(this.Co=a)&&this.C()}},isRouting:{get:function(){return this.zo},set:function(a){this.zo!==a&&(this.zo=a)}},isRealtime:{get:function(){return this.yo},set:function(a){this.yo!==a&&(this.yo=a)}},isValidLayout:{get:function(){return this.Bo},set:function(a){this.Bo!==a&&(this.Bo=a,a||(a=this.diagram,null!==
  a&&(a.Ng=!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.vn},set:function(a){this.vn!==a&&(this.vn=a,this.C())}},arrangementOrigin:{get:function(){return this.nn},set:function(a){this.nn.w(a)||(this.nn.assign(a),this.C())}},id:{get:function(){return this.I},set:function(a){this.I=
  a}},mayUseWorkerFunction:{get:function(){return this.To},set:function(a){this.To!==a&&(this.To=a)}},workerStateChanged:{get:function(){return this.qq},set:function(a){this.qq!==a&&(this.qq=a)}}});Bi.prototype.useWorker=Bi.prototype.Uw;Bi.declareWorkerLayout=gq;Bi.prototype.cancelWorker=Bi.prototype.zz;Bi.prototype.collectParts=Bi.prototype.$x;Bi.prototype.getLayoutBounds=Bi.prototype.nj;Bi.prototype.invalidateLayout=Bi.prototype.C;
  var hq=new H,jq="object"===typeof x.document&&x.document.currentScript?x.document.currentScript.src:"",kq="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";Bi.className="Layout";Bi.GoJSScriptURL=jq;Bi.declareWorkerLayout=gq;
  "undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:R.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=fq(a.layout));var d=null;c&&c.Lv&&(d=new c.Lv);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=lq(d,a,!0);
  d.workerLayout=function(){var a=nq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new E)}});function iq(){this.Lv=null;this.Cy=this.l=this.name="";this.scripts=[];this.Pe=null;this.Fm=new H}function aq(a){Xa(this);this.kc=a;this.tf=new G;this.le=new G;this.bu=new H;this.Xt=new H}
  aq.prototype.clear=function(){if(this.tf)for(var a=this.tf.iterator;a.next();)a.value.clear();if(this.le)for(a=this.le.iterator;a.next();)a.value.clear();this.tf=new G;this.le=new G;this.bu=new H;this.Xt=new H};
  aq.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.tf.count+" edges: "+this.le.count;if(1<a){for(var c=this.tf.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.le.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};aq.prototype.createVertex=function(){return new oq(this)};aq.prototype.createEdge=function(){return new pq(this)};
  aq.prototype.Ag=function(a,b,c){if(null!==a){void 0===b&&(b=!1);void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof W)return!a.isLinkLabel;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof W&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof U&&null===d.layout)this.Ag(d.memberParts,!1);else if(null===this.kj(d)){var e=this.createVertex();e.node=
  d;this.Bg(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof S&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Eq(d)){var f=d.fromNode;e=d.toNode;null!==f&&null!==e&&f!==e&&(f=this.findGroupVertex(f),e=this.findGroupVertex(e),null!==f&&null!==e&&this.Fk(f,e,d))}}};aq.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.kj(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.kj(b);if(null!==a)return a;b=b.containingGroup}return null};
  t=aq.prototype;t.Bg=function(a){if(null!==a){this.tf.add(a);var b=a.node;null!==b&&this.bu.add(b,a);a.network=this}};t.mk=function(a){if(null===a)return null;var b=this.kj(a);null===b&&(b=this.createVertex(),b.node=a,this.Bg(b));return b};t.Ov=function(a){if(null!==a&&qq(this,a)){for(var b=a.td,c=b.count-1;0<=c;c--){var d=b.J(c);this.vk(d)}b=a.Gd;for(a=b.count-1;0<=a;a--)c=b.J(a),this.vk(c)}};
  function qq(a,b){if(null===b)return!1;var c=a.tf.remove(b);c&&(b=b.node,null!==b&&a.bu.remove(b));return c}t.Lz=function(a){null!==a&&(a=this.kj(a),null!==a&&this.Ov(a))};t.kj=function(a){return null===a?null:this.bu.G(a)};t.tm=function(a){if(null!==a){rq(this,a);var b=a.toVertex;null!==b&&b.Ev(a);b=a.fromVertex;null!==b&&b.Cv(a)}};function rq(a,b){if(null!==b){a.le.add(b);var c=b.link;null!==c&&null===a.Eq(c)&&a.Xt.add(c,b);b.network=a}}
  t.oz=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Eq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.mk(b)),null!==c&&(d.toVertex=this.mk(c)),this.tm(d)):(null!==b?d.fromVertex=this.mk(b):d.fromVertex=null,null!==c?d.toVertex=this.mk(c):d.toVertex=null);return d};t.vk=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Nv(a);b=a.fromVertex;null!==b&&b.Mv(a);sq(this,a)}};
  function sq(a,b){null!==b&&a.le.remove(b)&&(b=b.link,null!==b&&a.Xt.remove(b))}t.Kz=function(a){null!==a&&(a=this.Eq(a),null!==a&&this.vk(a))};t.Eq=function(a){return null===a?null:this.Xt.G(a)};t.Fk=function(a,b,c){if(null===a||null===b)return null;if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.tm(d);return d}return null};t.Rm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Mv(a),c.Nv(a),a.Rm(),b.Ev(a),c.Cv(a))}};
  t.Bq=function(){for(var a=Ea(),b=this.le.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.vk(a[c]);Ia(a)};aq.prototype.deleteArtificialVertexes=function(){for(var a=Ea(),b=this.tf.iterator;b.next();){var c=b.value;null===c.node&&null===c.data&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Ov(a[b]);b=Ea();for(c=this.le.iterator;c.next();){var d=c.value;null===d.link&&null===d.data&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.vk(b[d]);Ia(a);Ia(b)};
  function tq(a){for(var b=Ea(),c=a.le.iterator;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.vk(b[d]);Ia(b)}
  aq.prototype.Xy=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),tq(this),this.Bq());a=new E;for(var b=!0;b;){b=!1;for(var c=this.tf.iterator;c.next();){var d=c.value;if(0<d.td.count||0<d.Gd.count){b=this.layout.createNetwork();a.add(b);uq(this,b,d);b=!0;break}}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
  function uq(a,b,c){if(null!==c&&c.network!==b){qq(a,c);b.Bg(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(sq(a,e),rq(b,e),uq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(sq(a,c),rq(b,c),uq(a,b,c.toVertex))}}aq.prototype.Rz=function(){for(var a=new G,b=this.tf.iterator;b.next();)a.add(b.value.node);for(b=this.le.iterator;b.next();)a.add(b.value.link);return a};
  na.Object.defineProperties(aq.prototype,{layout:{get:function(){return this.kc},set:function(a){null!==a&&(this.kc=a)}},vertexes:{get:function(){return this.tf}},edges:{get:function(){return this.le}}});aq.prototype.findAllParts=aq.prototype.Rz;aq.prototype.splitIntoSubNetworks=aq.prototype.Xy;aq.prototype.deleteSelfEdges=aq.prototype.Bq;aq.prototype.reverseEdge=aq.prototype.Rm;aq.prototype.linkVertexes=aq.prototype.Fk;
  aq.prototype.findEdge=aq.prototype.Eq;aq.prototype.deleteLink=aq.prototype.Kz;aq.prototype.deleteEdge=aq.prototype.vk;aq.prototype.addLink=aq.prototype.oz;aq.prototype.addEdge=aq.prototype.tm;aq.prototype.findVertex=aq.prototype.kj;aq.prototype.deleteNode=aq.prototype.Lz;aq.prototype.deleteVertex=aq.prototype.Ov;aq.prototype.addNode=aq.prototype.mk;aq.prototype.addVertex=aq.prototype.Bg;aq.prototype.addParts=aq.prototype.Ag;aq.className="LayoutNetwork";
  function oq(a){Xa(this);this.Tc=a;this.l=(new N(0,0,10,10)).freeze();this.u=(new J(5,5)).freeze();this.Mi=this.ob=null;this.td=new E;this.Gd=new E}
  oq.prototype.serializeVertexProperties=function(a){a.id=kb(this);a.key=this.node?this.node.key:this.data?this.data.Di:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.kB=this.bounds.width;a.tA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.td.each(function(a){b.push(kb(a))});a.Uy=b;var c=[];this.Gd.each(function(a){c.push(kb(a))});a.jy=c};
  oq.prototype.Cq=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.kB;this.height=a.tA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.Uy&&a.Uy.forEach(function(a){(a=c.get(a))&&d.td.add(a)});a.jy&&a.jy.forEach(function(a){(a=c.get(a))&&d.Gd.add(a)})}};oq.prototype.clear=function(){this.Mi=this.ob=null;this.td=new E;this.Gd=new E};
  oq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+kb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.td.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Gd.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
  oq.prototype.commit=function(){var a=this.ob;if(null!==a){var b=this.bounds,c=a.bounds;za(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof U)){c=N.alloc();var d=this.network.layout.nj(a,c),e=a.locationObject.da(zc);if(d.o()&&e.o()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));N.free(c);return}N.free(c)}a.moveTo(b.x,b.y)}};oq.prototype.Ev=function(a){null!==a&&(this.td.contains(a)||this.td.add(a))};
  oq.prototype.Nv=function(a){null!==a&&this.td.remove(a)};oq.prototype.Cv=function(a){null!==a&&(this.Gd.contains(a)||this.Gd.add(a))};oq.prototype.Mv=function(a){null!==a&&this.Gd.remove(a)};function vq(a,b){a=a.Mi;b=b.Mi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
  na.Object.defineProperties(oq.prototype,{sourceEdgesArrayAccess:{get:function(){return this.td._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.Gd._dataArray}},data:{get:function(){return this.ob},set:function(a){this.ob=a;if(null!==a&&a.bounds){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.Ta();var b=this.network.layout,c=N.alloc(),d=b.nj(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.da(zc),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.w(a)||this.l.assign(a)}},focus:{get:function(){return this.u},set:function(a){this.u.w(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.ea(),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.ea(),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.ea(),b.x=a,b.freeze())}},focusY:{
  get:function(){return this.u.y},set:function(a){var b=this.u;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ea(),b.width=
  a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Tc},set:function(a){this.Tc=a}},sourceVertexes:{get:function(){for(var a=new G,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new G,b=
  this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new G,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.td.iterator}},destinationEdges:{get:function(){return this.Gd.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.td.count+this.Gd.count}}});oq.prototype.deleteDestinationEdge=oq.prototype.Mv;oq.prototype.addDestinationEdge=oq.prototype.Cv;oq.prototype.deleteSourceEdge=oq.prototype.Nv;oq.prototype.addSourceEdge=oq.prototype.Ev;oq.className="LayoutVertex";oq.standardComparer=vq;
  oq.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<b.length;c++)if(""!==a[c]&&void 0!==a[c]){var d=parseFloat(b[c]),e=parseFloat(a[c]);if(isNaN(d))if(isNaN(e)){if(0!==b[c].localeCompare(a[c]))return b[c].localeCompare(a[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-
  e}}else if(""!==b[c])return 1;return""!==a[c]&&void 0!==a[c]?-1:0}return 1}return null!==c?-1:0}return 1}return null!==b?-1:0};function pq(a){Xa(this);this.Sc=a;this.ed=this.Yc=this.Nl=this.ob=null}pq.prototype.clear=function(){this.ed=this.Yc=this.Nl=this.ob=null};
  pq.prototype.serializeEdgeProperties=function(a){a.id=kb(this);a.key=this.link?this.link.key:this.data?this.data.Di:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?kb(this.fromVertex):null;a.fB=this.toVertex?kb(this.toVertex):null};pq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.fB))this.toVertex=a}};
  pq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+kb(this);0<a&&(b+=null!==this.Nl?"("+this.Nl.toString()+")":"",1<a&&(b+=" "+(this.Yc?this.Yc.toString():"null")+" --\x3e "+(this.ed?this.ed.toString():"null")));return b};pq.prototype.Rm=function(){var a=this.Yc;this.Yc=this.ed;this.ed=a};pq.prototype.commit=function(){};pq.prototype.zy=function(a){return this.ed===a?this.Yc:this.Yc===a?this.ed:null};
  na.Object.defineProperties(pq.prototype,{network:{get:function(){return this.Sc},set:function(a){this.Sc=a}},data:{get:function(){return this.ob},set:function(a){this.ob!==a&&(this.ob=a)}},link:{get:function(){return this.Nl},set:function(a){this.Nl!==a&&(this.Nl=a)}},fromVertex:{get:function(){return this.Yc},set:function(a){this.Yc!==a&&(this.Yc=a)}},toVertex:{
  get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a)}}});pq.prototype.getOtherVertex=pq.prototype.zy;pq.className="LayoutEdge";function Sk(){Bi.call(this);this.isViewportSized=!0;this.rq=this.sq=NaN;this.Qg=(new M(NaN,NaN)).freeze();this.lf=(new M(10,10)).freeze();this.yb=wq;this.Eb=xq;this.bd=yq;this.Wc=zq}ma(Sk,Bi);
  Sk.prototype.cloneProtected=function(a){Bi.prototype.cloneProtected.call(this,a);a.sq=this.sq;a.rq=this.rq;a.Qg.assign(this.Qg);a.lf.assign(this.lf);a.yb=this.yb;a.Eb=this.Eb;a.bd=this.bd;a.Wc=this.Wc};Sk.prototype.jb=function(a){a.classType===Sk?a===yq||a===Aq||a===Bq||a===Cq?this.sorting=a:a===xq||a===Dq?this.arrangement=a:a===wq||a===Eq?this.alignment=a:B("Unknown enum value: "+a):Bi.prototype.jb.call(this,a)};
  Sk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.$x(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Ph()||null===d.fromNode&&null===d.toNode){if(d.Ta(),d instanceof U)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ma();if(0!==e.length){switch(this.sorting){case Cq:e.reverse();break;case yq:e.sort(this.comparer);break;case Aq:e.sort(this.comparer),e.reverse()}var f=this.wrappingColumn;
  isNaN(f)&&(f=0);var g=this.wrappingWidth;isNaN(g)&&null!==a?(b=a.padding,g=Math.max(a.viewportBounds.width-b.left-b.right,0)):g=Math.max(this.wrappingWidth,0);0>=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.xa("Layout");d=[];switch(this.alignment){case Eq:var h=b,k=c,l=N.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.nj(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,
  1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var r=this.nj(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,w=0,v=0,y=0;y<e.length;y++){var z=e[y],A=this.nj(z,l),C=Math.ceil((A.width+h)/m)*m,F=Math.ceil((A.height+k)/n)*n;switch(p){case Dq:var Q=Math.abs(q-A.width);break;default:Q=q+A.width}if(0<f&&w>f-1||0<g&&0<w&&Q-r>g)d.push(new N(0,u,g+h,v)),w=0,q=r,u+=v,v=0;v=Math.max(v,F);switch(p){case Dq:A=-A.width;break;default:A=
  0}z.moveTo(q+A,u);switch(p){case Dq:q-=C;break;default:q+=C}w++}d.push(new N(0,u,g+h,v));N.free(l);break;case wq:k=g;m=f;n=b;p=c;g=N.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)v=e[q],w=this.nj(v,g),v=v.Df(v.locationObject,v.locationSpot,h),l=Math.max(l,v.x),u=Math.max(u,w.width-v.x),f=Math.max(f,v.y);q=this.arrangement;switch(q){case Dq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var K=v=this.arrangementOrigin.x;y=this.arrangementOrigin.y;
  u=0;k>=l&&(k-=l);l=z=0;C=Math.max(this.cellSize.height,1);A=f=0;F=!0;w=J.alloc();for(Q=0;Q<e.length;Q++){var T=e[Q],P=this.nj(T,g),I=T.Df(T.locationObject,T.locationSpot,h);if(0<u)switch(q){case Dq:K=(K-v-(P.width-I.x))/r;K=L.aa(Math.round(K),K)?Math.round(K):Math.floor(K);K=K*r+v;break;default:K=(K-v+I.x)/r,K=L.aa(Math.round(K),K)?Math.round(K):Math.ceil(K),K=K*r+v}else switch(q){case Dq:z=K+I.x+P.width;break;default:z=K-I.x}switch(q){case Dq:var ja=-(K+I.x)+z;break;default:ja=K+P.width-I.x-z}if(0<
  m&&u>m-1||0<k&&0<u&&ja>k){d.push(new N(0,F?y-f:y,k+n,A+f+p));for(K=0;K<u&&Q!==u;K++){ja=e[Q-u+K];var ba=ja.Df(ja.locationObject,ja.locationSpot,w);ja.moveTo(ja.position.x,ja.position.y+f-ba.y)}A+=p;y=F?y+A:y+(A+f);u=A=f=0;K=v;F=!1}K===v&&(l=q===Dq?Math.max(l,P.width-I.x):Math.min(l,-I.x));f=Math.max(f,I.y);A=Math.max(A,P.height-I.y);isFinite(C)&&(A=Math.max(A,Math.max(P.height,C)-I.y));F?T.moveTo(K-I.x,y-I.y):T.moveTo(K-I.x,y);switch(q){case Dq:K-=I.x+n;break;default:K+=P.width-I.x+n}u++}d.push(new N(0,
  y,k+n,(F?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.Df(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(w);if(q===Dq)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);N.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===Dq?this.commitLayers(d,new J(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new J(e-
  b/2,g-c/2));null!==a&&a.Xa("Layout");this.isValidLayout=!0}};Sk.prototype.commitLayers=function(){};function zq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
  na.Object.defineProperties(Sk.prototype,{wrappingWidth:{get:function(){return this.sq},set:function(a){this.sq!==a&&(0<a||isNaN(a))&&(this.sq=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{get:function(){return this.rq},set:function(a){this.rq!==a&&(0<a||isNaN(a))&&(this.rq=a,this.C())}},cellSize:{get:function(){return this.Qg},set:function(a){this.Qg.w(a)||(this.Qg.assign(a),this.C())}},spacing:{
  get:function(){return this.lf},set:function(a){this.lf.w(a)||(this.lf.assign(a),this.C())}},alignment:{get:function(){return this.yb},set:function(a){this.yb===a||a!==wq&&a!==Eq||(this.yb=a,this.C())}},arrangement:{get:function(){return this.Eb},set:function(a){this.Eb===a||a!==xq&&a!==Dq||(this.Eb=a,this.C())}},sorting:{get:function(){return this.bd},set:function(a){this.bd===a||a!==Bq&&a!==Cq&&
  a!==yq&&a!==Aq||(this.bd=a,this.C())}},comparer:{get:function(){return this.Wc},set:function(a){this.Wc!==a&&(this.Wc=a,this.C())}}});var Eq=new D(Sk,"Position",0),wq=new D(Sk,"Location",1),xq=new D(Sk,"LeftToRight",2),Dq=new D(Sk,"RightToLeft",3),Bq=new D(Sk,"Forward",4),Cq=new D(Sk,"Reverse",5),yq=new D(Sk,"Ascending",6),Aq=new D(Sk,"Descending",7);Sk.className="GridLayout";Sk.standardComparer=zq;
  Sk.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==
  b[c]&&void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};Sk.Position=Eq;Sk.Location=wq;Sk.LeftToRight=xq;Sk.RightToLeft=Dq;Sk.Forward=Bq;Sk.Reverse=Cq;Sk.Ascending=yq;Sk.Descending=Aq;function wi(){this.lp=new G;this.No=new G;this.Fa=new G;this.Ue=new H;this.Te=new H;this.Qj=new H;this.B=null;this.mr=!1}t=wi.prototype;t.clear=function(){this.lp.clear();this.No.clear();this.Fa.clear();this.Ue.clear();this.Te.clear();this.Qj.clear()};t.ee=function(a){this.B=a};
  t.oj=function(a){if(a instanceof W){if(this.lp.add(a),a instanceof U){var b=a.containingGroup;null===b?this.B.Dh.add(a):b.Sl.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof S?this.No.add(a):a instanceof Je||this.Fa.add(a);b=a.data;null===b||a instanceof Je||(a instanceof S?this.Te.add(b,a):this.Ue.add(b,a))};
  t.Lc=function(a){a.nk();if(a instanceof W){if(this.lp.remove(a),a instanceof U){var b=a.containingGroup;null===b?this.B.Dh.remove(a):b.Sl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof S?this.No.remove(a):a instanceof Je||this.Fa.remove(a);b=a.data;null===b||a instanceof Je||(a instanceof S?this.Te.remove(b):this.Ue.remove(b))};
  t.Md=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Nc()||b instanceof U)&&B('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.B.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof U||B('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.B.linkTemplateMap.iterator;a.next();)b=
  a.value,c=a.key,b instanceof S||B('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ea();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ea();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ea();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
  c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.zc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.zc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.zc(c[d]),null!==e&&(e.location=c[d+1]);Ia(a);Ia(b);Ia(c)};wi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
  wi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.ab(a)&&Fq(c,a,!1)});a.forEach(function(a){d.ab(a)&&c.resolveReferencesForData(a)});!1!==b&&gk(this.diagram,!1)};
  function Fq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ue.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.Ue.contains(b)){var d=a.Iq(b);var e=Po(a,b,d);if(null!==e&&(yg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Nf=d;e.ob=b;a.mr&&(e.ih="Tool");a.diagram.add(e);e.ob=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
  wi.prototype.insertLink=function(){return null};wi.prototype.resolveReferencesForData=function(){};wi.prototype.Iq=function(a){return this.B.model.Iq(a)};
  function Po(a,b,c){a=a.B;var d=a.model;d.Dk()&&d.fw(b)?(b=a.groupTemplateMap.G(c),null===b&&(b=a.groupTemplateMap.G(""),null===b&&(Gq||(Gq=!0,xa('No Group template found for category "'+c+'"'),xa("  Using default group template")),b=a.Eu))):(b=a.nodeTemplateMap.G(c),null===b&&(b=a.nodeTemplateMap.G(""),null===b&&(Hq||(Hq=!0,xa('No Node template found for category "'+c+'"'),xa("  Using default node template")),b=a.Gu)));return b}wi.prototype.getLinkCategoryForData=function(){return""};
  wi.prototype.setLinkCategoryForData=function(){};wi.prototype.setFromNodeForLink=function(){};wi.prototype.setToNodeForLink=function(){};wi.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.G(a);null===b&&(b=this.B.linkTemplateMap.G(""),null===b&&(Iq||(Iq=!0,xa('No Link template found for category "'+a+'"'),xa("  Using default link template")),b=this.B.Fu));return b};wi.prototype.removeAllModeledParts=function(){this.fu(this.diagram.model.nodeDataArray)};
  wi.prototype.fu=function(a){var b=this;a.forEach(function(a){b.$q(a)})};wi.prototype.$q=function(a){a=this.zc(a);null!==a&&(Nj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};wi.prototype.unresolveReferencesForPart=function(){};wi.prototype.removeDataForLink=function(){};wi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Kb(a);return null!==a?this.Ue.G(a):null};
  wi.prototype.Cb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Kb(a);if(null===a)return null;a=this.Ue.G(a);return a instanceof W?a:null};wi.prototype.findLinkForKey=function(){return null};t=wi.prototype;t.zc=function(a){if(null===a)return null;var b=this.Ue.G(a);return null!==b?b:b=this.Te.G(a)};t.gj=function(a){if(null===a)return null;a=this.Ue.G(a);return a instanceof W?a:null};t.yc=function(a){return null===a?null:this.Te.G(a)};
  t.It=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.lp.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(za(g)&&Jq(this,e,g)){b.add(d);break}}}return b.iterator};t.Ht=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.No.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(za(g)&&Jq(this,e,g)){b.add(d);break}}}return b.iterator};
  function Jq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Aa(f)){if(!Aa(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Kq(a,e[g],h))return!1}}else if(!Kq(a,e,f))return!1}return!0}function Kq(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(za(b)&&za(c)){if(!Jq(a,b,c))return!1}else if(b!==c)return!1;return!0}
  wi.prototype.doModelChanged=function(a){if(this.B){var b=this.B;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d)if(c===xe){if("nodeCategory"===d){var e=this.zc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.fu(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===ze){var g=a.newValue;"nodeDataArray"===d&&za(g)&&Fq(this,g);b.isModified=!0}else if(c===Ae){var h=a.oldValue;
  "nodeDataArray"===d&&za(h)&&this.$q(h);b.isModified=!0}else c===ye&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.ir(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Md());else if(c===xe){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Md()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===ze||c===Ae){var m=a.change===ze,n=m?a.newParam:a.oldParam,
  p=m?a.newValue:a.oldValue,r=this.Qj.G(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)qn(q,p,n);else if(!(0>n)){var u=n+jn(q);q.Lc(u,!0);un(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};wi.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)};
  wi.prototype.ir=function(){for(var a=this.B.model,b=new G,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){Lq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.zc(f)&&Mq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
  for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};wi.prototype.refreshDataBoundLinks=function(){};wi.prototype.updateRelationshipsFromData=function(){};
  wi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.zc(a);if(null!==c)c.Ea(b);else{c=null;for(var d=this.Qj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].qy(a);null!==g&&(null===c&&(c=Ea()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ea(b);Ia(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
  function Jj(a,b){var c=b.Ci;if(Aa(c)){var d=a.Qj.G(c);if(null===d)d=[],d.push(b),a.Qj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Mj(a,b,c){Hj(b,function(a){a=a.W.j;for(var b=a.length,d=0;d<b;d++)ek(c,a[d])});var d=b.Ci;if(Aa(d)){var e=a.Qj.G(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Qj.remove(d);break}}}
  wi.prototype.tk=function(a,b,c){void 0===c&&(c=!1);var d=new H;if(Aa(a))for(var e=0;e<a.length;e++)Nq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Nq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.kl.dragsLink;e=new G;for(var f=new H,g=d.iterator;g.next();){var h=g.value;if(h instanceof S)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof W&&null!==h.data&&c.Em()){var k=h;h=g.key;var l=h.Fg();null!==l&&(l=
  d.G(l),null!==l?(c.fe(k.data,c.ja(l.data)),k=b.yc(k.data),h=h.jj(),null!==h&&null!==k&&f.add(h,k)):c.fe(k.data,void 0))}}0<e.count&&b.gu(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.B&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new H;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.B.model)}for(b=d.iterator;b.next();)b.value.Ea();return d};
  function Nq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.G(b);var f=a.copyPartData(b,c);if(!(f instanceof V))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof W){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.G(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.G(h),null!==h&&(h.toNode=f))}if(b instanceof U&&f instanceof U)for(b=b.memberParts;b.next();)g=Nq(a,b.value,c,d,e),g instanceof S||null===g||(g.containingGroup=
  f)}else if(b instanceof S&&f instanceof S)for(g=b.fromNode,null!==g&&(g=d.G(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.G(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Nq(a,b.value,c,d,e),null!==g&&g instanceof W&&(g.labeledLink=f);return f}
  wi.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof S||(d=e.copyNodeData(d),za(d)&&(e.uf(d),c=b.zc(d)))}else yg(a),c=a.copy(),null!==c&&(e=this.B,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof S||(e=b.copyNodeData(d)),za(e)&&(c.data=e)));return c};
  na.Object.defineProperties(wi.prototype,{nodes:{get:function(){return this.lp}},links:{get:function(){return this.No}},parts:{get:function(){return this.Fa}},diagram:{get:function(){return this.B}},addsToTemporaryLayer:{get:function(){return this.mr},set:function(a){this.mr=a}}});wi.prototype.updateAllRelationshipsFromData=wi.prototype.ir;
  wi.prototype.findLinksByExample=wi.prototype.Ht;wi.prototype.findNodesByExample=wi.prototype.It;wi.prototype.findLinkForData=wi.prototype.yc;wi.prototype.findNodeForData=wi.prototype.gj;wi.prototype.findPartForData=wi.prototype.zc;wi.prototype.findNodeForKey=wi.prototype.Cb;wi.prototype.removeModeledPart=wi.prototype.$q;wi.prototype.removeModeledParts=wi.prototype.fu;wi.prototype.rebuildParts=wi.prototype.Md;var Hq=!1,Gq=!1,Iq=!1;wi.className="PartManager";
  function Oq(a){wi.apply(this,arguments)}ma(Oq,wi);Oq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Pq(this,a.linkDataArray)};Oq.prototype.addModeledParts=function(a){wi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Qo(a.value);gk(this.diagram,!1)};function Pq(a,b){b.forEach(function(b){Qq(a,b)});gk(a.diagram,!1)}
  function Qq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Te.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){yg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Nf=c;e.ob=b;c=a.diagram.model;var f=Rq(c,b,!0);""!==f&&(e.fromPortId=f);f=Sq(c,b,!0);void 0!==f&&(f=a.Cb(f),f instanceof W&&(e.fromNode=f));f=Rq(c,b,!1);""!==f&&(e.toPortId=f);f=Sq(c,b,!1);void 0!==f&&(f=a.Cb(f),
  f instanceof W&&(e.toNode=f));c=c.Bf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Cb(b);null!==b&&(b.labeledLink=e)});a.mr&&(e.ih="Tool");a.diagram.add(e);e.ob=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Oq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Tq(this,a.linkDataArray);this.fu(a.nodeDataArray)};function Tq(a,b){b.forEach(function(b){a.$q(b)})}Oq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Lt(a)};
  Oq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.cr(a,b)};Oq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Bw(a.data,c.ja(null!==b?b.data:null))};Oq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Gw(a.data,c.ja(null!==b?b.data:null))};Oq.prototype.removeDataForLink=function(a){this.diagram.model.Mm(a.data)};
  Oq.prototype.findPartForKey=function(a){var b=wi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Dg(a),null!==a)?this.Te.G(a):b};Oq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Dg(a);return null!==a?this.Te.G(a):null};
  Oq.prototype.doModelChanged=function(a){var b=this;wi.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.Z){c.Z=!1;try{var e=a.modelChange;if(""!==e)if(d===xe){if("linkFromKey"===e){var f=this.yc(a.object);if(null!==f){var g=this.Cb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.yc(a.object);if(null!==h){var k=this.Cb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.yc(a.object);if(null!==l){var m=a.newValue;
  "string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.yc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.zc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Cb(q);u instanceof U?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var w=this.yc(a.object);if(null!==w){var v=a.oldValue,y=a.newValue;Array.isArray(v)&&v.forEach(function(a){0<=y.indexOf(a)||
  (a=b.Cb(a),null!==a&&(a.labeledLink=null))});Array.isArray(y)&&y.forEach(function(a){a=b.Cb(a);null!==a&&(a.labeledLink=w)})}}else if("linkCategory"===e){var z=this.yc(a.object),A=a.newValue;null!==z&&"string"===typeof A&&(z.category=A)}else"linkDataArray"===e&&(Tq(this,a.oldValue),Pq(this,a.newValue));c.isModified=!0}else if(d===ze){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)Qq(this,C);else if("linkLabelKeys"===e&&Uq(C)){var F=this.yc(a.object),Q=this.Cb(C);null!==F&&
  null!==Q&&(Q.labeledLink=F)}c.isModified=!0}else{if(d===Ae){var K=a.oldValue;if("linkDataArray"===e&&"object"===typeof K&&null!==K)this.$q(K);else if("linkLabelKeys"===e&&Uq(K)){var T=this.Cb(K);null!==T&&(T.labeledLink=null)}c.isModified=!0}}else if(d===xe){var P=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==P&&"linkToKeyProperty"!==P&&"linkFromPortIdProperty"!==P&&"linkToPortIdProperty"!==P&&"linkLabelKeysProperty"!==P&&"nodeIsGroupProperty"!==P&&"nodeGroupKeyProperty"!==P&&"linkCategoryProperty"!==
  P||c.undoManager.isUndoingRedoing||this.Md();c.isModified=!0}}finally{c.Z=!0}}}}};Oq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new G,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){Vq(b,a,!1)});d.forEach(function(c){null===a.yc(c)&&Wq(b,c,!1)})};
  Oq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof S){var e=Sq(d,b,!0);e=c.Cb(e);a.fromNode=e;e=Sq(d,b,!1);e=c.Cb(e);a.toNode=e;b=d.Bf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.ja(f.data)===e)return}e=(new G).addAll(b);var g=new G;a.labelNodes.each(function(a){null!==a.data&&(a=d.ja(a.data),void 0!==a&&g.add(a))});b=g.copy();b.Zq(e);e=
  e.copy();e.Zq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Cb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Cb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Je)&&(b=d.Lh(b),b=c.findPartForKey(b),null===b||b instanceof U)&&(a.containingGroup=b)}}};
  Oq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Xq(b,c),e=this.zc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.ab(g)?e instanceof U&&b.Lh(g)===c&&(g=this.zc(g),null!==g&&(g.containingGroup=e)):(f.link=this.yc(g),null!==f.link&&e instanceof W&&(Sq(b,g,!0)===c&&(f.link.fromNode=e),Sq(b,g,!1)===c&&(f.link.toNode=e),g=b.Bf(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=a.link,
  !0):!1}}(f))));f={link:f.link}}Yq(b,c)}a=b.Lh(a);void 0!==a&&(a=this.Cb(a),a instanceof U&&(e.containingGroup=a))}};Oq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.ja(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Zq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Zq(b,c,d.data));if(a instanceof U)for(a=a.memberParts;a.next();)d=a.value.data,b.ab(d)&&Zq(b,c,d)}}};
  Oq.prototype.copyPartData=function(a,b){var c=wi.prototype.copyPartData.call(this,a,b);if(a instanceof S)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Aq(a);"object"===typeof a&&null!==a&&(d.bj(a),c=b.yc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Aq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
  Oq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof S){if(yg(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof W&&(yg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Aq(d),"object"===
  typeof d&&null!==d))return null!==a&&$q(f,d,f.ja(a.data),!0),ar(f,d,h,!0),null!==c&&$q(f,d,f.ja(c.data),!1),ar(f,d,b,!1),f.bj(d),a=g.archetypeLabelNodeData,null===a||a instanceof W||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.uf(a),a=f.ja(a),void 0!==a&&f.Dv(d,a))),e.yc(d);return null};Oq.prototype.findLinkForKey=Oq.prototype.findLinkForKey;Oq.prototype.findPartForKey=Oq.prototype.findPartForKey;Oq.prototype.removeAllModeledParts=Oq.prototype.removeAllModeledParts;
  Oq.prototype.addModeledParts=Oq.prototype.addModeledParts;Oq.prototype.addAllModeledParts=Oq.prototype.addAllModeledParts;Oq.className="GraphLinksPartManager";function br(){wi.apply(this,arguments);this.rh=null}ma(br,wi);
  function cr(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!Of(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(yg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Nf=d;
  b.ob=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.ob=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}br.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Ot(a)};br.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.ku(a,b)};
  br.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.fe(a.data,d.ja(b));else{var e=this.rh;this.rh=a;null!==c&&d.fe(c.data,void 0);d.fe(b,d.ja(null!==a.toNode?a.toNode.data:null));this.rh=e}};
  br.prototype.setToNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren){var e=this.rh;this.rh=a;null!==c&&d.fe(c.data,void 0);d.fe(b,d.ja(null!==a.fromNode?a.fromNode.data:null));this.rh=e}else d.fe(a.data,d.ja(b))};br.prototype.removeDataForLink=function(a){this.diagram.model.fe(a.data,void 0)};
  br.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Kb(a);return null!==a?this.Te.G(a):null};
  br.prototype.doModelChanged=function(a){wi.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.Z){b.Z=!1;try{var d=a.modelChange;if(""!==d){if(c===xe){if("nodeParentKey"===d){var e=a.object,f=this.Cb(a.newValue),g=this.gj(e);if(null!==this.rh)null!==f&&(this.rh.data=e,this.rh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.jj();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:cr(this,f,g)}}else if("parentLinkCategory"===
  d){var k=this.gj(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.jj();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===xe){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Md());b.isModified=!0}}finally{b.Z=!0}}}}};
  br.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof W&&(b=d.Mh(b),b=c.Cb(b),d=a.Fg(),b!==d&&(d=a.jj(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:cr(this,b,a):null!==d&&Nj(c,d,!1)))}}};br.prototype.updateDataBindings=function(a,b){wi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.zc(a)&&(a=this.yc(a),null!==a&&a.Ea(b))};
  br.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.ja(a);if(void 0!==c){var d=Xq(b,c),e=this.zc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.ab(f)&&e instanceof W&&b.Mh(f)===c&&cr(this,e,this.gj(f))}Yq(b,c)}a=b.Mh(a);void 0!==a&&e instanceof W&&(a=this.Cb(a),cr(this,a,e))}};
  br.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.ja(a.data),d=this.yc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Lc(-1,d,!1);0<=f&&this.diagram.Va(Ae,"parts",e,d,null,f,null);f=d.layerChanged;null!==f&&f(d,e,null)}}d=this.diagram.isTreePathToChildren;for(a=a.linksConnected;a.next();)e=a.value,e=(d?e.toNode:e.fromNode).data,b.ab(e)&&Zq(b,c,e)}};
  br.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.fe(e.data,b.ja(d.data)),e.jj()):null};br.prototype.findLinkForKey=br.prototype.findLinkForKey;br.className="TreePartManager";
  function Z(a){this.Oi=new G;this.Li=new G;this.tu=',\n  "insertedNodeKeys": ';this.lx=',\n  "modifiedNodeData": ';this.vu=',\n  "removedNodeKeys": ';this.Yh=null;Xa(this);this.Ln=this.oa="";this.$f=!1;this.l={};this.Fc=[];this.Wa=new H;this.Ni="key";this.il=this.Pl=null;this.Cn=this.Dn=!1;this.Fn=!0;this.kn=null;this.Yj="category";this.Tf=new H;this.cv=new E;this.vg=!1;this.u=null;this.undoManager=new Ce;void 0!==a&&(this.nodeDataArray=a)}
  Z.prototype.cloneProtected=function(a){a.oa=this.oa;a.Ln=this.Ln;a.$f=this.$f;a.Ni=this.Ni;a.Pl=this.Pl;a.il=this.il;a.Dn=this.Dn;a.Cn=this.Cn;a.Fn=this.Fn;a.kn=this.kn;a.Yj=this.Yj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Fc=[];this.Wa.clear();this.Tf.clear();this.undoManager.clear()};
  Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.fr();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ka(e)}}return b};
  Z.prototype.gB=function(a){a.change!==ye&&B("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof Be))return null;dr(this,b);a=this.Yw(b,"FinishedUndo"===a.propertyName);this.Yh=null;return a};
  Z.prototype.Yw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Yh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ze?e.add(a.newValue):a.change===Ae&&g.add(a.oldValue):c.ab(a.object)?f.add(a.object):a.change!==xe||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.ab(a)&&f.add(a)}):a.object instanceof Z||c.qj()&&c.xc(a.object)||er(c,a.object).each(function(a){f.add(a)})):
  d=!0)});var k=this.Li;k.clear();e.each(function(a){k.add(c.ja(a));b||f.add(a)});var l=this.Oi;l.clear();g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a=c.cloneDeep(f.ma());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ma():m.insertedNodeKeys=k.ma());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ma():m.removedNodeKeys=l.ma());l.clear();k.clear();return m};
  Z.prototype.cloneDeep=function(a){return fr(this,a,!0)};
  function fr(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=ob++,d.set(a,c),e.set(a,b))}if(!za(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new H);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new H),k=e.iterator;k.next();){var l=k.key;if(k.value===b&&(l=d.get(l)))return l}if(Array.isArray(b)){k=[];g(b,k);for(var m=0;m<b.length;m++)k.push(fr(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof M||b instanceof N||b instanceof kc||b instanceof O)k=b.copy(),
  g(b,k);else{if(b instanceof zl||b instanceof rd||b instanceof D)return b;if(b instanceof E)k=(new E).addAll(fr(a,b.ma(),!1,d,e,f)),g(b,k);else if(b instanceof G)k=(new G).addAll(fr(a,b.ma(),!1,d,e,f)),g(b,k);else if(b instanceof H)k=(new H).addAll(fr(a,b.ma(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!==
  m&&(k[m]=fr(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;
  t.Vk=function(){var a="";""!==this.name&&(a+=',\n  "name": '+this.quote(this.name));""!==this.dataFormat&&(a+=',\n  "dataFormat": '+this.quote(this.dataFormat));this.isReadOnly&&(a+=',\n  "isReadOnly": '+this.isReadOnly);"key"!==this.nodeKeyProperty&&"string"===typeof this.nodeKeyProperty&&(a+=',\n  "nodeKeyProperty": '+this.quote(this.nodeKeyProperty));this.copiesArrays&&(a+=',\n  "copiesArrays": true');this.copiesArrayObjects&&(a+=',\n  "copiesArrayObjects": true');this.copiesKey||(a+=',\n  "copiesKey": false');
  "category"!==this.nodeCategoryProperty&&"string"===typeof this.nodeCategoryProperty&&(a+=',\n  "nodeCategoryProperty": '+this.quote(this.nodeCategoryProperty));return a};
  t.Xq=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.dataFormat=a.dataFormat);a.isReadOnly&&(this.isReadOnly=!0);a.nodeKeyProperty&&(this.nodeKeyProperty=a.nodeKeyProperty);a.copiesArrays&&(this.copiesArrays=!0);a.copiesArrayObjects&&(this.copiesArrayObjects=!0);!1===a.copiesKey&&(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function gr(a){return',\n  "modelData": '+hr(a,a.modelData)}
  function ir(a,b){b=b.modelData;za(b)&&(a.Om(b),a.modelData=b)}t.Zw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!jr(c,a[c])){b=!0;break}a="";b&&(a=gr(this));return a+',\n  "nodeDataArray": '+kr(this,this.nodeDataArray,!0)};t.rw=function(a){ir(this,a);a=a.nodeDataArray;Aa(a)&&(this.Om(a),this.nodeDataArray=a)};
  function lr(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.G(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!lr(a,b[e],c[e],d))return!1;return!0}if(za(b)&&za(c)){if(d.G(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!jr(f,g)){var h=c[f];if(void 0===h||!lr(a,g,h,d))return!1}}for(e in c)if(f=c[e],!jr(e,f)&&(g=b[e],void 0===g||!lr(a,g,f,d)))return!1;
  return!0}return!1}function mr(a,b,c){a[c]!==b[c]&&B("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
  t.kr=function(a){mr(this,a,"nodeKeyProperty");var b=this.Li;b.clear();var c=new G,d=this.Oi;d.clear();d.addAll(this.Wa.iteratorKeys);for(var e=new H,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.ja(k);if(void 0!==l){d.remove(l);var m=this.Kb(l);null===m?(b.add(l),c.add(k)):lr(this,m,k,e)||c.add(k)}else this.Zt(k),l=this.ja(k),b.add(l),c.add(k)}f="";lr(this,this.modelData,a.modelData,e)||(f+=gr(this));0<b.count&&(f+=this.tu+kr(this,b.ma(),!0));0<c.count&&(f+=this.lx+kr(this,c.ma(),!0));
  0<d.count&&(f+=this.vu+kr(this,d.ma(),!0));d.clear();b.clear();return f};t.Dz=function(a,b){void 0===b&&(b=nr(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.Vk()+this.kr(a)+"}"};
  function dr(a,b){function c(a,b){if(b=b.part)if(b=b.data,a!==b){var c=d.get(a);null===c?(c=new G,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Yh;null===d&&(d=new H,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===xe)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===ze||b===Ae)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Yh=d)}function er(a,b){for(var c=new G,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];or(a,b,e,e,c)}return c}
  function or(a,b,c,d,e){if(Array.isArray(c))for(var f=0;f<c.length;f++){var g=c[f];if(g===b)return e.add(d),!0;if(or(a,b,g,d,e))return!0}else if(za(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(or(a,b,g,d,e))return!0}return!1}
  t.Xw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Yh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ze?e.add(a.newValue):a.change===Ae&&g.add(a.oldValue):c.ab(a.object)?f.add(a.object):a.change!==xe||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.ab(a)&&f.add(a)}):a.object instanceof Z||c.qj()&&c.xc(a.object)||er(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
  this.Li;k.clear();e.each(function(a){k.add(c.ja(a));b||f.add(a)});var l=this.Oi;l.clear();g.each(function(a){l.add(c.ja(a));b&&f.add(a)});a="";d&&(a+=gr(this));0<k.count&&(a+=(b?this.vu:this.tu)+kr(this,k.ma(),!0));0<f.count&&(a+=this.lx+kr(this,f.ma(),!0));0<l.count&&(a+=(b?this.tu:this.vu)+kr(this,l.ma(),!0));l.clear();k.clear();return a};
  t.Wq=function(a){(void 0!==a.name&&a.name!==this.name||void 0!==a.dataFormat&&a.dataFormat!==this.dataFormat||void 0!==a.isReadOnly&&a.isReadOnly!==this.isReadOnly||void 0!==a.nodeKeyProperty&&a.nodeKeyProperty!==this.nodeKeyProperty||void 0!==a.copiesArrays&&a.copiesArrays!==this.copiesArrays||void 0!==a.copiesArrayObjects&&a.copiesArrayObjects!==this.copiesArrayObjects||void 0!==a.copiesKey&&a.copiesKey!==this.copiesKey||void 0!==a.nodeCategoryProperty&&a.nodeCategoryProperty!==this.nodeCategoryProperty)&&
  B("applyIncrementalJson cannot change Model properties");ir(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new H;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.ja(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Kb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Vm(h,g),this.uf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.ja(e),f=this.Kb(f),null!==f){for(var k in e)"__gohashid"===k||k===
  this.nodeKeyProperty||this.Ck()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.Wm(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Kb(a[k]),null!==b&&this.Nm(b)};
  t.Yy=function(a,b){a.change!==ye&&B("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof Be))return'{ "incremental": 0 }';void 0===b&&(b=nr(this,this));dr(this,c);a=this.Xw(c,"FinishedUndo"===a.propertyName);this.Yh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Vk()+a+"}"};t.hB=function(a,b){return this.Yy(a,b)};
  t.fr=function(a){void 0===a&&(a=nr(this,this));return'{ "class": '+this.quote(a)+this.Vk()+this.Zw()+"}"};t.toJSON=function(a){return this.fr(a)};t.Xx=function(a){var b=null;if("string"===typeof a)try{b=x.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:B("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&B("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.xa("applyIncrementalJson"),this.Wq(b),this.Xa("applyIncrementalJson"))};t.vz=function(a){return this.Xx(a)};
  Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
  t.Om=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(za(d)){var e=c;d=this.Om(d);Array.isArray(a)?a[e]=d:B("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(za(a)){for(b in a)if(c=a[b],za(c)&&(c=this.Om(c),a[b]=c,"points"===b&&Array.isArray(c))){e=0===c.length%2;for(d=0;d<c.length;d++)if("number"!==typeof c[d]){e=!1;break}if(e){e=new E;for(d=0;d<c.length/2;d++)e.add(new J(c[2*d],c[2*d+1]));e.freeze();a[b]=e}}return pr(a)}return a};
  t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?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.bn=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.bn(a.valueOf()):Aa(a)?kr(this,a):za(a)?hr(this,a):"function"===typeof a?"null":a.toString()};
  function kr(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new Za;e.add("[");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var g=b[f];void 0!==g&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.bn(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function jr(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function qr(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
  function hr(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:qr(c.x),y:qr(c.y)};else if(c instanceof M)b={"class":"go.Size",width:qr(c.width),height:qr(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:qr(c.x),y:qr(c.y),width:qr(c.width),height:qr(c.height)};else if(c instanceof kc)b={"class":"go.Margin",top:qr(c.top),right:qr(c.right),bottom:qr(c.bottom),left:qr(c.left)};else if(c instanceof O)c.kb()?b={"class":"go.Spot",x:qr(c.x),y:qr(c.y),offsetX:qr(c.offsetX),offsetY:qr(c.offsetY)}:
  b={"class":"go.Spot","enum":c.toString()};else if(c instanceof zl){b={"class":"go.Brush",type:c.type.name};if(c.type===Cl)b.color=c.color;else if(c.type===Fl||c.type===Al)b.start=c.start,b.end=c.end,c.type===Al&&(0!==c.startRadius&&(b.startRadius=qr(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=qr(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else c instanceof rd?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
  qr(c.startX)),0!==c.startY&&(b.startY=qr(c.startY)),0!==c.endX&&(b.endX=qr(c.endX)),0!==c.endY&&(b.endY=qr(c.endY)),c.spot1.w(tc)||(b.spot1=c.spot1),c.spot2.w(Dc)||(b.spot2=c.spot2),c.type===sd&&(b.path=xd(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:nr(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=vn(b,e);if(!jr(e,f))if(c?c=!1:d+=",",d+=JSON.stringify(e)+":","points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.bn(h.x);
  g+=",";g+=a.bn(h.y)}g+="]";d+=g}else d+=a.bn(f)}return d+"}"}function rr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
  function pr(a){if("object"!==typeof a)return a;var b=a["class"]||"";if("NaN"===b)return NaN;if("Date"===b)return new Date(a.value);if(0!==b.indexOf("go."))return a;b=b.substr(3);var c=a;if("Point"===b)c=new J(rr(a.x),rr(a.y));else if("Size"===b)c=new M(rr(a.width),rr(a.height));else if("Rect"===b)c=new N(rr(a.x),rr(a.y),rr(a.width),rr(a.height));else if("Margin"===b)c=new kc(rr(a.top),rr(a.right),rr(a.bottom),rr(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=id(a["enum"]):c=new O(rr(a.x),
  rr(a.y),rr(a.offsetX),rr(a.offsetY));else if("Brush"===b){if(c=new zl,c.type=Ya(zl,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof O&&(c.start=a.start),a.end instanceof O&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=rr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=rr(a.endRadius)),a=a.colorStops,za(a))for(var d in a)c.addColorStop(parseFloat(d),a[d])}else"Geometry"===b?(c=null,"string"===typeof a.path?c=Dd(a.path):c=new rd,c.type=Ya(rd,a.type),
  "number"===typeof a.startX&&(c.startX=rr(a.startX)),"number"===typeof a.startY&&(c.startY=rr(a.startY)),"number"===typeof a.endX&&(c.endX=rr(a.endX)),"number"===typeof a.endY&&(c.endY=rr(a.endY)),a.spot1 instanceof O&&(c.spot1=a.spot1),a.spot2 instanceof O&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=tr(d),"function"===typeof d&&(c=Ya(d,a.name)));return c}t.Hh=function(a){this.cv.add(a)};t.Tk=function(a){this.cv.remove(a)};
  t.zt=function(a){this.skipsUndoManager||this.undoManager.aw(a);for(var b=this.cv,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Va=function(a,b,c,d,e,f,g){ur(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){ur(this,"",xe,a,this,b,c,d,e)};t.du=function(a,b,c,d,e,f){ur(this,"",xe,b,a,c,d,e,f)};function ur(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new we;l.model=a;l.change=c;l.modelChange=b;l.propertyName=d;l.object=e;l.oldValue=f;l.oldParam=h;l.newValue=g;l.newParam=k;a.zt(l)}
  Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===xe){var c=a.object,d=a.propertyName,e=a.G(b);d===this.nodeKeyProperty&&this.ab(c)&&(b=a.G(!b),void 0!==b&&this.Wa.remove(b),void 0!==e&&this.Wa.add(e,c));Uj(c,d,e)}else a.change===ze?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,za(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Fc[c]===a&&Da(this.Fc,c),void 0!==d&&this.Wa.remove(d)):(this.Fc[c]!==a&&Ca(this.Fc,c,a),void 0!==d&&this.Wa.add(d,a)))):""===a.modelChange?
  ((d=a.object)&&!Aa(d)&&a.propertyName&&(d=vn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.newValue,b?Da(d,c):Ca(d,c,a))):B("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===Ae?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.ja(a),b?(this.Fc[c]!==a&&Ca(this.Fc,c,a),void 0!==d&&this.Wa.add(d,a)):(this.Fc[c]===a&&Da(this.Fc,c),void 0!==d&&this.Wa.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
  vn(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Ca(d,c,a):Da(d,c))):B("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==ye&&B("unknown ChangedEvent: "+a.toString())};Z.prototype.xa=function(a){return this.undoManager.xa(a)};Z.prototype.Xa=function(a){return this.undoManager.Xa(a)};Z.prototype.If=function(){return this.undoManager.If()};
  Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.xa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.If(),this.skipsUndoManager=c}};t=Z.prototype;t.Ea=function(a,b){void 0===b&&(b="");ur(this,"SourceChanged",ye,b,a,null,null)};
  t.ja=function(a){if(null!==a){var b=this.Ni;if(""!==b&&(b=vn(a,b),void 0!==b)){if(Uq(b))return b;B("Key value for node data "+a+" is not a number or a string: "+b)}}};t.Vm=function(a,b){if(null!==a){var c=this.Ni;if(""!==c)if(this.ab(a)){var d=vn(a,c);d!==b&&null===this.Kb(b)&&(Uj(a,c,b),void 0!==d&&this.Wa.remove(d),this.Wa.add(b,a),ur(this,"nodeKey",xe,c,a,d,b),"string"===typeof c&&this.Ea(a,c),this.ar(d,b))}else Uj(a,c,b)}};function Uq(a){return"number"===typeof a||"string"===typeof a}
  t.ab=function(a){var b=this.ja(a);return void 0===b?!1:this.Wa.G(b)===a};t.Kb=function(a){null===a&&B("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Uq(a)?this.Wa.G(a):null};
  t.Zt=function(a){if(null!==a){var b=this.Ni;if(""!==b){var c=this.ja(a);if(void 0===c||this.Wa.contains(c)){var d=this.Pl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.Wa.contains(c))){Uj(a,b,c);return}if("string"===typeof c){for(d=2;this.Wa.contains(c+d);)d++;Uj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.Wa.count-1;this.Wa.contains(c);)c--;Uj(a,b,c)}}}}};t.uf=function(a){null!==a&&(mb(a),this.ab(a)||Mq(this,a,!0))};
  function Mq(a,b,c){var d=a.ja(b);if(void 0===d||a.Wa.G(d)!==b)a.Zt(b),d=a.ja(b),void 0===d?B("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.Wa.add(d,b),d=null,c&&(d=a.Fc.length,Ca(a.Fc,d,b)),ur(a,"nodeDataArray",ze,"nodeDataArray",a,null,b,null,d),a.Qm(b),a.Pm(b))}t.qz=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.uf(a[c]);else for(a=a.iterator;a.next();)this.uf(a.value)};t.Nm=function(a){null!==a&&Lq(this,a,!0)};
  function Lq(a,b,c){var d=a.ja(b);void 0!==d&&a.Wa.remove(d);d=null;if(c){a:if(c=a.Fc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;Da(a.Fc,d)}ur(a,"nodeDataArray",Ae,"nodeDataArray",a,b,null,d,null);a.hr(b)}t.WA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.Nm(a[c]);else for(a=a.iterator;a.next();)this.Nm(a.value)};
  t.KA=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.Oi;b.clear();b.addAll(this.Wa.iteratorKeys);var c=this.Li;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.ja(f);if(void 0!==g){c.add(g);var h=this.Kb(g);h!==f&&(null!==h?(this.vq(h,f),this.Wm(f,h)):(f=this.cloneDeep(f),this.Vm(f,g),this.uf(f)))}else g=this.cloneDeep(f),this.uf(g),c.add(this.ja(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Kb(d))&&this.Nm(d);b.clear();c.clear()}};
  t.ar=function(a,b){void 0!==b&&(a=Xq(this,a),a instanceof G&&this.Tf.add(b,a))};t.Sw=function(){};t.Qm=function(){};t.Pm=function(){};t.hr=function(){};function Zq(a,b,c){if(void 0!==b){var d=a.Tf.G(b);null===d&&(d=new G,a.Tf.add(b,d));d.add(c)}}function Yq(a,b,c){if(void 0!==b){var d=a.Tf.G(b);d instanceof G&&(void 0===c||null===c?a.Tf.remove(b):(d.remove(c),0===d.count&&a.Tf.remove(b)))}}function Xq(a,b){if(void 0===b)return null;a=a.Tf.G(b);return a instanceof G?a:null}
  t.Cz=function(a){void 0===a?this.Tf.clear():this.Tf.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.il;a=null!==b?b(a,this):vr(this,a,!0);za(a)&&Xa(a);return a};
  function vr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=vr(a,b[c],a.copiesArrayObjects);d.push(e)}Xa(d);return d}if(c&&za(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=vn(b,d),g=nr(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
  g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g||f instanceof Z||f instanceof Ce||f instanceof Be||f instanceof we?Uj(c,d,f):(f=vr(a,f,!1),Uj(c,d,f))}Xa(c);return c}return b instanceof J?b.copy():b instanceof M?b.copy():b instanceof N?b.copy():b instanceof O?b.copy():b instanceof kc?b.copy():b}
  Z.prototype.setDataProperty=function(a,b,c){if(this.ab(a)){if(b===this.nodeKeyProperty){this.Vm(a,c);return}if(b===this.nodeCategoryProperty){this.Um(a,c);return}}else!wr&&a instanceof Y&&(wr=!0,xa('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),xa("  Is that really your intent?"));var d=vn(a,b);d!==c&&(Uj(a,b,c),this.du(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
  t.vq=function(a,b){if(b){var c=this.ab(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.mz=function(a,b){this.Pt(a,-1,b)};t.Pt=function(a,b,c){0>b&&(b=a.length);Ca(a,b,c);ur(this,"",ze,"",a,null,c,null,b)};t.tw=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];Da(a,b);ur(this,"",Ae,"",a,c,null,b,null)};
  t.Iq=function(a){if(null===a)return"";var b=this.Yj;if(""===b)return"";b=vn(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.Um=function(a,b){if(null!==a){var c=this.Yj;if(""!==c)if(this.ab(a)){var d=vn(a,c);void 0===d&&(d="");d!==b&&(Uj(a,c,b),ur(this,"nodeCategory",xe,c,a,d,b))}else Uj(a,c,b)}};t.Wm=function(a,b){this.Um(b,this.Iq(a))};t.Em=function(){return!1};t.Ck=function(){return!1};t.qj=function(){return!1};
  t.Ut=function(){return!1};t.Dk=function(){return!1};function zi(){return new Z}function nr(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 nr(a,b.constructor);return typeof b}function tr(a){return xr[a]?xr[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
  function vn(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 Uj(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){}}
  na.Object.defineProperties(Z.prototype,{name:{get:function(){return this.oa},set:function(a){var b=this.oa;b!==a&&(this.oa=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.Ln},set:function(a){var b=this.Ln;b!==a&&(this.Ln=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(this.$f=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.Py(this),this.u=a,null!==a&&a.Vx(this))}},skipsUndoManager:{get:function(){return this.vg},set:function(a){this.vg=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"),0<this.Wa.count&&B("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Ni=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.Pl},set:function(a){var b=this.Pl;b!==a&&(this.Pl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Fc},set:function(a){var b=this.Fc;if(b!==a){this.Wa.clear();
  this.Sw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!za(e)){B("Model.nodeDataArray must only contain Objects, not: "+e);return}mb(e)}this.Fc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.ja(f);void 0===g?d.add(f):null!==this.Wa.G(g)?d.add(f):this.Wa.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Zt(e),f=this.ja(e),void 0!==f&&this.Wa.add(f,e);ur(this,"nodeDataArray",xe,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Qm(d),this.Pm(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{
  get:function(){return this.il},set:function(a){var b=this.il;b!==a&&(this.il=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.Dn},set:function(a){var b=this.Dn;b!==a&&(this.Dn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.Cn},set:function(a){var b=this.Cn;b!==a&&(this.Cn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{get:function(){return this.Fn},
  set:function(a){var b=this.Fn;b!==a&&(this.Fn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.kn},set:function(a){var b=this.kn;b!==a&&(this.kn=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.Yj},set:function(a){var b=this.Yj;b!==a&&(this.Yj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
  Z.prototype.setCategoryForNodeData=Z.prototype.Um;Z.prototype.getCategoryForNodeData=Z.prototype.Iq;Z.prototype.removeArrayItem=Z.prototype.tw;Z.prototype.insertArrayItem=Z.prototype.Pt;Z.prototype.addArrayItem=Z.prototype.mz;Z.prototype.assignAllDataProperties=Z.prototype.vq;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.Cz;Z.prototype.mergeNodeDataArray=Z.prototype.KA;Z.prototype.removeNodeDataCollection=Z.prototype.WA;Z.prototype.removeNodeData=Z.prototype.Nm;
  Z.prototype.addNodeDataCollection=Z.prototype.qz;Z.prototype.addNodeData=Z.prototype.uf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.Zt;Z.prototype.findNodeDataForKey=Z.prototype.Kb;Z.prototype.containsNodeData=Z.prototype.ab;Z.prototype.setKeyForNodeData=Z.prototype.Vm;Z.prototype.getKeyForNodeData=Z.prototype.ja;Z.prototype.updateTargetBindings=Z.prototype.Ea;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.If;Z.prototype.commitTransaction=Z.prototype.Xa;
  Z.prototype.startTransaction=Z.prototype.xa;Z.prototype.raiseDataChanged=Z.prototype.du;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.Va;Z.prototype.removeChangedListener=Z.prototype.Tk;Z.prototype.addChangedListener=Z.prototype.Hh;Z.prototype.writeJsonValue=Z.prototype.bn;Z.prototype.replaceJsonObjects=Z.prototype.Om;Z.prototype.applyIncrementalJSON=Z.prototype.vz;Z.prototype.applyIncrementalJson=Z.prototype.Xx;Z.prototype.toJSON=Z.prototype.toJSON;
  Z.prototype.toJson=Z.prototype.fr;Z.prototype.toIncrementalJSON=Z.prototype.hB;Z.prototype.toIncrementalJson=Z.prototype.Yy;Z.prototype.computeJsonDifference=Z.prototype.Dz;Z.prototype.toIncrementalData=Z.prototype.gB;Z.prototype.clear=Z.prototype.clear;var wr=!1,xr={};Z.className="Model";
  Z.fromJSON=Z.fromJson=function(a,b){void 0===b&&(b=null);var c=null;if("string"===typeof a)try{c=x.JSON.parse(a)}catch(f){}else"object"===typeof a?c=a:B("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=tr(d)):(e=tr(d),null===e&&(e=x[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:B("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=Z.constructGraphLinksModel());
  b.Xq(c);b.rw(c);return b};Z.safePropertyValue=vn;Z.safePropertySet=Uj;xr.Brush=zl;xr.ChangedEvent=we;xr.Geometry=rd;xr.Margin=kc;xr.Panel=X;xr.Point=J;xr.Rect=N;xr.Size=M;xr.Spot=O;xr.Transaction=Be;xr.UndoManager=Ce;function Ii(a,b,c){Xa(this);this.v=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.l=-1;this.pd=null;this.pm=a;this.om=this.hq=0;this.ht=null;this.Ao=!1;this.hm=b;this.Bn=c;this.Zo=yr;this.un=null;this.Ou=new G}
  Ii.prototype.copy=function(){var a=new Ii;a.pm=this.pm;a.hq=this.hq;a.om=this.om;a.ht=this.ht;a.Ao=this.Ao;a.hm=this.hm;a.Bn=this.Bn;a.Zo=this.Zo;a.un=this.un;return a};t=Ii.prototype;t.jb=function(a){a.classType===Ii&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.wj?" "+this.wj:"")+" "+this.mode.name+")"};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};
  t.Iy=function(a){void 0===a&&(a=null);this.mode=on;this.backConverter=a;return this};t.Uq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.MA=function(){this.sourceName=null;this.isToModel=!0;return this};function ml(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.bb(a)}
  t.Tw=function(a,b,c){var d=this.hm;if(void 0===c||""===d||d===c){c=this.pm;var e=this.Bn;if(null===e&&""===c)xa("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=vn(b,d));if(void 0!==f)if(null===e)""!==c&&Uj(a,c,f);else try{if(""!==c){var g=e(f,a);Uj(a,c,g)}else e(f,a)}catch(h){}}}};
  t.jr=function(a,b,c,d){if(this.Zo===on){var e=this.pm;if(void 0===c||e===c){c=this.hm;var f=this.un,g=a;""!==e&&(g=vn(a,e));if(void 0!==g&&!this.Ou.contains(a))try{this.Ou.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?k.setDataProperty(b,c,g):Uj(b,c,g);else{if(null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var l=d.itemIndex,m=d.panel.itemArray;k.tw(m,l);k.Pt(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
  c,n):Uj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var r=d.itemIndex,q=d.panel.itemArray;k.tw(q,r);k.Pt(q,r,p)}}}catch(u){}}finally{this.Ou.remove(a)}}}};
  na.Object.defineProperties(Ii.prototype,{wj:{get:function(){return this.l},set:function(a){this.v&&va(this);this.l=a}},targetProperty:{get:function(){return this.pm},set:function(a){this.v&&va(this);this.pm=a}},sourceName:{get:function(){return this.ht},set:function(a){this.v&&va(this);this.ht=a;null!==a&&(this.Ao=!1)}},isToModel:{get:function(){return this.Ao},set:function(a){this.v&&
  va(this);this.Ao=a}},sourceProperty:{get:function(){return this.hm},set:function(a){this.v&&va(this);this.hm=a}},converter:{get:function(){return this.Bn},set:function(a){this.v&&va(this);this.Bn=a}},backConverter:{get:function(){return this.un},set:function(a){this.v&&va(this);this.un=a}},mode:{get:function(){return this.Zo},set:function(a){this.v&&va(this);this.Zo=a}}});
  Ii.prototype.updateSource=Ii.prototype.jr;Ii.prototype.updateTarget=Ii.prototype.Tw;Ii.prototype.ofModel=Ii.prototype.MA;Ii.prototype.ofObject=Ii.prototype.Uq;Ii.prototype.makeTwoWay=Ii.prototype.Iy;var Pk="Binding",yr=new D(Ii,"OneWay",1),on=new D(Ii,"TwoWay",2);Ii.className="Binding";Ii.parseEnum=function(a,b){return function(c){c=Ya(a,c);return null===c?b:c}};Ii.toString=Ka;Ii.OneWay=yr;Ii.TwoWay=on;
  function zr(a,b){Z.call(this);this.su=',\n  "insertedLinkKeys": ';this.kx=',\n  "modifiedLinkData": ';this.uu=',\n  "removedLinkKeys": ';this.$c=[];this.ag=new G;this.gb=new H;this.Hi="";this.Aj=this.hl=this.Ql=null;this.af="from";this.bf="to";this.Vj=this.Uj="";this.Tj="category";this.ae="";this.Ul="isGroup";this.ze="group";this.En=!1;void 0!==a&&(this.nodeDataArray=a);void 0!==b&&(this.linkDataArray=b)}ma(zr,Z);zr.constructGraphLinksModel=Z.constructGraphLinksModel;
  zr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Hi=this.Hi;a.Ql=this.Ql;a.hl=this.hl;a.af=this.af;a.bf=this.bf;a.Uj=this.Uj;a.Vj=this.Vj;a.Tj=this.Tj;a.ae=this.ae;a.Ul=this.Ul;a.ze=this.ze;a.En=this.En};t=zr.prototype;t.clear=function(){Z.prototype.clear.call(this);this.$c=[];this.gb.clear();this.ag.clear()};
  t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.fr();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ka(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Sq(this,e,!0)+"--\x3e"+Sq(this,e,!1)}return b};
  t.Yw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.Yw.call(this,a,b),d=this,e=new G,f=new G,g=new G,h=this.Yh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ze?e.add(a.newValue):a.change===Ae&&g.add(a.oldValue):d.xc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.xc(a)&&f.add(a)}):
  a.object instanceof Z||d.ab(a.object)||Ar(d,a.object).each(function(a){f.add(a)})))});var k=this.Li;k.clear();e.each(function(a){k.add(d.Wb(a));b||f.add(a)});var l=this.Oi;l.clear();g.each(function(a){l.add(d.Wb(a));b&&f.add(a)});a=d.cloneDeep(f.ma());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ma():c.insertedLinkKeys=k.ma());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ma():c.removedLinkKeys=l.ma());l.clear();k.clear();return c};
  t.Vk=function(){var a=Z.prototype.Vk.call(this),b="";"category"!==this.linkCategoryProperty&&"string"===typeof this.linkCategoryProperty&&(b+=',\n  "linkCategoryProperty": '+this.quote(this.linkCategoryProperty));""!==this.linkKeyProperty&&"string"===typeof this.linkKeyProperty&&(b+=',\n  "linkKeyProperty": '+this.quote(this.linkKeyProperty));"from"!==this.linkFromKeyProperty&&"string"===typeof this.linkFromKeyProperty&&(b+=',\n  "linkFromKeyProperty": '+this.quote(this.linkFromKeyProperty));"to"!==
  this.linkToKeyProperty&&"string"===typeof this.linkToKeyProperty&&(b+=',\n  "linkToKeyProperty": '+this.quote(this.linkToKeyProperty));""!==this.linkFromPortIdProperty&&"string"===typeof this.linkFromPortIdProperty&&(b+=',\n  "linkFromPortIdProperty": '+this.quote(this.linkFromPortIdProperty));""!==this.linkToPortIdProperty&&"string"===typeof this.linkToPortIdProperty&&(b+=',\n  "linkToPortIdProperty": '+this.quote(this.linkToPortIdProperty));""!==this.linkLabelKeysProperty&&"string"===typeof this.linkLabelKeysProperty&&
  (b+=',\n  "linkLabelKeysProperty": '+this.quote(this.linkLabelKeysProperty));"isGroup"!==this.nodeIsGroupProperty&&"string"===typeof this.nodeIsGroupProperty&&(b+=',\n  "nodeIsGroupProperty": '+this.quote(this.nodeIsGroupProperty));"group"!==this.nodeGroupKeyProperty&&"string"===typeof this.nodeGroupKeyProperty&&(b+=',\n  "nodeGroupKeyProperty": '+this.quote(this.nodeGroupKeyProperty));return a+b};
  t.Xq=function(a){Z.prototype.Xq.call(this,a);a.linkKeyProperty&&(this.linkKeyProperty=a.linkKeyProperty);a.linkFromKeyProperty&&(this.linkFromKeyProperty=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.linkToKeyProperty=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.linkFromPortIdProperty=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.linkToPortIdProperty=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.linkCategoryProperty=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.linkLabelKeysProperty=
  a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.nodeIsGroupProperty=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=a.nodeGroupKeyProperty)};t.Zw=function(){var a=Z.prototype.Zw.call(this),b=',\n  "linkDataArray": '+kr(this,this.linkDataArray,!0);return a+b};t.rw=function(a){Z.prototype.rw.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Om(a),this.linkDataArray=a)};
  t.kr=function(a){if(!(a instanceof zr))return B("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=Z.prototype.kr.call(this,a);mr(this,a,"linkKeyProperty");mr(this,a,"linkFromKeyProperty");mr(this,a,"linkToKeyProperty");mr(this,a,"linkLabelKeysProperty");mr(this,a,"nodeIsGroupProperty");mr(this,a,"nodeGroupKeyProperty");var c=this.Li;c.clear();
  var d=new G,e=this.Oi;e.clear();e.addAll(this.gb.iteratorKeys);for(var f=new H,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.Wb(l);if(void 0!==m){e.remove(m);var n=this.Dg(m);null===n?(c.add(m),d.add(l)):lr(this,n,l,f)||d.add(l)}else this.Rq(l),m=this.Wb(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.su+kr(this,c.ma(),!0));0<d.count&&(a+=this.kx+kr(this,d.ma(),!0));0<e.count&&(a+=this.uu+kr(this,e.ma(),!0));e.clear();c.clear();return a};
  function Ar(a,b){for(var c=new G,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];or(a,b,e,e,c)}return c}
  t.Xw=function(a,b){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.Xw.call(this,a,b),d=this,e=new G,f=new G,g=new G,h=this.Yh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ze?e.add(a.newValue):a.change===Ae&&g.add(a.oldValue):d.xc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.xc(a)&&f.add(a)}):
  a.object instanceof Z||d.ab(a.object)||Ar(d,a.object).each(function(a){f.add(a)})))});var k=this.Li;k.clear();e.each(function(a){k.add(d.Wb(a));b||f.add(a)});var l=this.Oi;l.clear();g.each(function(a){l.add(d.Wb(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.uu:this.su)+kr(this,k.ma(),!0));0<f.count&&(a+=this.kx+kr(this,f.ma(),!0));0<l.count&&(a+=(b?this.su:this.uu)+kr(this,l.ma(),!0));l.clear();k.clear();return a};
  t.Wq=function(a){(void 0!==a.linkCategoryProperty&&a.linkCategoryProperty!==this.linkCategoryProperty||void 0!==a.linkKeyProperty&&a.linkKeyProperty!==this.linkKeyProperty||void 0!==a.linkFromKeyProperty&&a.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==a.linkToKeyProperty&&a.linkToKeyProperty!==this.linkToKeyProperty||void 0!==a.linkFromPortIdProperty&&a.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==a.linkToPortIdProperty&&a.linkToPortIdProperty!==this.linkToPortIdProperty||
  void 0!==a.linkLabelKeysProperty&&a.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==a.nodeIsGroupProperty&&a.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==a.nodeGroupKeyProperty&&a.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Wq.call(this,a);var b=a.insertedLinkKeys;if(Array.isArray(b))for(var c=b.length,d=0;d<c;d++){var e=b[d],f=this.Dg(e);null===f&&(f=this.Aq({}),this.iu(f,e),this.bj(f))}b=a.modifiedLinkData;
  if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.Wb(e),f=this.Dg(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);Br(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Dg(a[b]),null!==c&&this.Mm(c)};
  zr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===xe){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.xc(c)){var e=a.G(b);b=a.G(!b);void 0!==b&&this.gb.remove(b);void 0!==e&&this.gb.add(e,c);Uj(c,d,e);return}}else if(a.change===ze){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;za(a)&&"number"===typeof c&&(d=this.Wb(a),b?(this.ag.remove(a),this.$c[c]===a&&this.$c.splice(c,1),void 0!==d&&this.gb.remove(d)):(this.ag.add(a),this.$c[c]!==
  a&&this.$c.splice(c,0,a),void 0!==d&&this.gb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue));return}}else if(a.change===Ae){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.Wb(a),b?(this.ag.add(a),this.$c[c]!==a&&this.$c.splice(c,0,a),void 0!==d&&this.gb.add(d,a)):(this.ag.remove(a),this.$c[c]===
  a&&this.$c.splice(c,1),void 0!==d&&this.gb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Bf(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.changeState.call(this,a,b)}};t=zr.prototype;t.Gm=function(a){if(void 0!==a){var b=this.Aj;if(null!==b){var c=this.Kb(a);null===c&&(c=this.copyNodeData(b),Uj(c,this.nodeKeyProperty,a),this.uf(c))}return a}};
  t.xy=function(a){return Sq(this,a,!0)};t.Bw=function(a,b){$q(this,a,b,!0)};t.Ay=function(a){return Sq(this,a,!1)};t.Gw=function(a,b){$q(this,a,b,!1)};function Sq(a,b,c){if(null!==b&&(a=c?a.af:a.bf,""!==a&&(a=vn(b,a),void 0!==a))){if(Uq(a))return a;B((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
  function $q(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.af:a.bf;if(""!==e)if(c=a.Gm(c),a.xc(b)){var f=vn(b,e);f!==c&&(Yq(a,f,b),Uj(b,e,c),null===a.Kb(c)&&Zq(a,c,b),ur(a,d?"linkFromKey":"linkToKey",xe,e,b,f,c),"string"===typeof e&&a.Ea(b,e))}else Uj(b,e,c)}}t.yy=function(a){return Rq(this,a,!0)};t.Cw=function(a,b){ar(this,a,b,!0)};t.By=function(a){return Rq(this,a,!1)};t.Hw=function(a,b){ar(this,a,b,!1)};
  function Rq(a,b,c){if(null===b)return"";a=c?a.Uj:a.Vj;if(""===a)return"";b=vn(b,a);return void 0===b?"":b}function ar(a,b,c,d){if(null!==b){var e=d?a.Uj:a.Vj;if(""!==e)if(a.xc(b)){var f=vn(b,e);void 0===f&&(f="");f!==c&&(Uj(b,e,c),ur(a,d?"linkFromPortId":"linkToPortId",xe,e,b,f,c),"string"===typeof e&&a.Ea(b,e))}else Uj(b,e,c)}}t.Bf=function(a){if(null===a)return Cr;var b=this.ae;if(""===b)return Cr;a=vn(a,b);return void 0===a?Cr:a};
  t.ju=function(a,b){if(null!==a){var c=this.ae;if(""!==c)if(this.xc(a)){var d=vn(a,c);void 0===d&&(d=Cr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Yq(this,d[f],a);Uj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Kb(g)&&Zq(this,g,a)}ur(this,"linkLabelKeys",xe,c,a,d,b);"string"===typeof c&&this.Ea(a,c)}}else Uj(a,c,b)}};
  t.Dv=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.ae;if(""!==c){var d=vn(a,c);if(void 0===d)c=[],c.push(b),this.ju(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.xc(a)&&(null===this.Kb(b)&&Zq(this,b,a),ur(this,"linkLabelKeys",ze,c,a,null,b,null,e)))}else B(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
  t.Oy=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.ae;if(""!==c){var d=vn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.xc(a)&&(Yq(this,b,a),ur(this,"linkLabelKeys",Ae,c,a,b,null,e,null)))}else void 0!==d&&B(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.Wb=function(a){if(null!==a){var b=this.Hi;if(""!==b&&(b=vn(a,b),void 0!==b)){if(Uq(b))return b;B("Key value for link data "+a+" is not a number or a string: "+b)}}};
  t.iu=function(a,b){if(null!==a){var c=this.Hi;if(""!==c)if(this.xc(a)){var d=vn(a,c);d!==b&&null===this.Dg(b)&&(Uj(a,c,b),void 0!==d&&this.gb.remove(d),this.gb.add(b,a),ur(this,"linkKey",xe,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Uj(a,c,b)}};t.Dg=function(a){null===a&&B("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Uq(a)?this.gb.G(a):null};
  t.Rq=function(a){if(null!==a){var b=this.Hi;if(""!==b){var c=this.Wb(a);if(void 0===c||this.gb.contains(c)){var d=this.Ql;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.gb.contains(c))){Uj(a,b,c);return}if("string"===typeof c){for(d=2;this.gb.contains(c+d);)d++;Uj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.gb.count-1;this.gb.contains(c);)c--;Uj(a,b,c)}}}}};t.xc=function(a){return null===a?!1:this.ag.contains(a)};t.bj=function(a){null!==a&&(mb(a),this.xc(a)||Wq(this,a,!0))};
  function Wq(a,b,c){if(""!==a.linkKeyProperty){var d=a.Wb(b);if(void 0!==d&&a.gb.G(d)===b)return;a.Rq(b);d=a.Wb(b);if(void 0===d){B("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.gb.add(d,b)}a.ag.add(b);d=null;c&&(d=a.$c.length,a.$c.splice(d,0,b));ur(a,"linkDataArray",ze,"linkDataArray",a,null,b,null,d);Dr(a,b)}t.pz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.bj(a[c]);else for(a=a.iterator;a.next();)this.bj(a.value)};
  t.Mm=function(a){null!==a&&Vq(this,a,!0)};function Vq(a,b,c){a.ag.remove(b);var d=a.Wb(b);void 0!==d&&a.gb.remove(d);d=null;if(c){d=a.$c.indexOf(b);if(0>d)return;a.$c.splice(d,1)}ur(a,"linkDataArray",Ae,"linkDataArray",a,b,null,d,null);c=Sq(a,b,!0);Yq(a,c,b);c=Sq(a,b,!1);Yq(a,c,b);d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Yq(a,c,b)}t.UA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Mm(a[c]);else for(a=a.iterator;a.next();)this.Mm(a.value)};
  t.JA=function(a){""===this.linkKeyProperty&&B("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Aa(a)){var b=this.Oi;b.clear();b.addAll(this.gb.iteratorKeys);var c=this.Li;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.Wb(f);if(void 0!==g){c.add(g);var h=this.Dg(g);h!==f&&(null!==h?(this.vq(h,f),Br(this,f,h)):(f=this.cloneDeep(f),this.iu(f,g),this.bj(f)))}else g=this.cloneDeep(f),this.bj(g),c.add(this.Wb(g))}for(a=
  b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Dg(d))&&this.Mm(d);b.clear();c.clear()}};function Dr(a,b){var c=Sq(a,b,!0);c=a.Gm(c);null===a.Kb(c)&&Zq(a,c,b);c=Sq(a,b,!1);c=a.Gm(c);null===a.Kb(c)&&Zq(a,c,b);var d=a.Bf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Kb(c)&&Zq(a,c,b)}
  t.Aq=function(a){if(null===a)return null;var b=this.hl;a=null!==b?b(a,this):vr(this,a,!0);za(a)&&(Xa(a),""!==this.af&&Uj(a,this.af,void 0),""!==this.bf&&Uj(a,this.bf,void 0),""!==this.ae&&Uj(a,this.ae,[]));return a};t.fw=function(a){if(null===a)return!1;var b=this.Ul;return""===b?!1:vn(a,b)?!0:!1};t.Lh=function(a){if(null!==a){var b=this.ze;if(""!==b&&(b=vn(a,b),void 0!==b)){if(Uq(b))return b;B("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
  t.dr=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.ze;if(""!==c)if(this.ab(a)){var d=vn(a,c);d!==b&&(Yq(this,d,a),Uj(a,c,b),null===this.Kb(b)&&Zq(this,b,a),ur(this,"nodeGroupKey",xe,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Uj(a,c,b)}};zr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.rk||""===this.ze||void 0===vn(a,this.ze)||Uj(a,this.ze,void 0);return a};
  zr.prototype.setDataProperty=function(a,b,c){if(this.ab(a)){if(b===this.nodeKeyProperty){this.Vm(a,c);return}if(b===this.nodeCategoryProperty){this.Um(a,c);return}if(b===this.nodeGroupKeyProperty){this.dr(a,c);return}}else if(this.xc(a)){if(b===this.linkFromKeyProperty){$q(this,a,c,!0);return}if(b===this.linkToKeyProperty){$q(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){ar(this,a,c,!0);return}if(b===this.linkToPortIdProperty){ar(this,a,c,!1);return}if(b===this.linkKeyProperty){this.iu(a,
  c);return}if(b===this.linkCategoryProperty){this.cr(a,c);return}if(b===this.linkLabelKeysProperty){this.ju(a,c);return}}var d=vn(a,b);d!==c&&(Uj(a,b,c),this.du(a,b,d,c))};t=zr.prototype;t.vq=function(a,b){if(b){var c=this.ab(a),d=this.xc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&vn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
  t.ar=function(a,b){Z.prototype.ar.call(this,a,b);for(var c=this.Wa.iterator;c.next();)this.vw(c.value,a,b);for(c=this.ag.iterator;c.next();){var d=c.value,e=a,f=b;if(Sq(this,d,!0)===e){var g=this.af;Uj(d,g,f);ur(this,"linkFromKey",xe,g,d,e,f);"string"===typeof g&&this.Ea(d,g)}Sq(this,d,!1)===e&&(g=this.bf,Uj(d,g,f),ur(this,"linkToKey",xe,g,d,e,f),"string"===typeof g&&this.Ea(d,g));g=this.Bf(d);if(Array.isArray(g))for(var h=g.length,k=this.ae,l=0;l<h;l++)g[l]===e&&(g[l]=f,ur(this,"linkLabelKeys",ze,
  k,d,e,f,l,l))}};t.vw=function(a,b,c){if(this.Lh(a)===b){var d=this.ze;Uj(a,d,c);ur(this,"nodeGroupKey",xe,d,a,b,c);"string"===typeof d&&this.Ea(a,d)}};t.Sw=function(){Z.prototype.Sw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Dr(this,a[c])};
  t.Qm=function(a){Z.prototype.Qm.call(this,a);a=this.ja(a);var b=Xq(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.ab(d)){if(this.Lh(d)===a){var e=this.ze;ur(this,"nodeGroupKey",xe,e,d,a,a);"string"===typeof e&&this.Ea(d,e);c.push(d)}}else if(Sq(this,d,!0)===a&&(e=this.af,ur(this,"linkFromKey",xe,e,d,a,a),"string"===typeof e&&this.Ea(d,e),c.push(d)),Sq(this,d,!1)===a&&(e=this.bf,ur(this,"linkToKey",xe,e,d,a,a),"string"===typeof e&&this.Ea(d,e),c.push(d)),e=this.Bf(d),
  Array.isArray(e))for(var f=e.length,g=this.ae,h=0;h<f;h++)e[h]===a&&(ur(this,"linkLabelKeys",ze,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Yq(this,a,c[b]);Ia(c)}};t.Pm=function(a){Z.prototype.Pm.call(this,a);var b=this.Lh(a);null===this.Kb(b)&&Zq(this,b,a)};t.hr=function(a){Z.prototype.hr.call(this,a);var b=this.Lh(a);Yq(this,b,a)};
  t.Lt=function(a){if(null===a)return"";var b=this.Tj;if(""===b)return"";b=vn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};zr.prototype.getLinkCategoryForData=function(a){return this.Lt(a)};zr.prototype.cr=function(a,b){if(null!==a){var c=this.Tj;if(""!==c)if(this.xc(a)){var d=vn(a,c);void 0===d&&(d="");d!==b&&(Uj(a,c,b),ur(this,"linkCategory",xe,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Uj(a,c,b)}};
  zr.prototype.setLinkCategoryForData=function(a,b){this.cr(a,b)};t=zr.prototype;t.Wm=function(a,b){Z.prototype.Wm.call(this,a,b);this.dr(b,this.Lh(a))};function Br(a,b,c){a.cr(c,a.Lt(b));a.Bw(c,a.xy(b));a.Gw(c,a.Ay(b));a.ju(c,a.Bf(b));a.Cw(c,a.yy(b));a.Hw(c,a.By(b))}t.Ck=function(){return!0};t.qj=function(){return!0};t.Ut=function(){return!0};t.Dk=function(){return!0};
  na.Object.defineProperties(zr.prototype,{archetypeNodeData:{get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(this.Aj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.af},set:function(a){var b=this.af;b!==a&&(this.af=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.bf},set:function(a){var b=this.bf;b!==a&&(this.bf=a,this.g("linkToKeyProperty",
  b,a))}},linkFromPortIdProperty:{get:function(){return this.Uj},set:function(a){var b=this.Uj;b!==a&&(this.Uj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.Vj},set:function(a){var b=this.Vj;b!==a&&(this.Vj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.ae},set:function(a){var b=this.ae;b!==a&&(this.ae=a,this.g("linkLabelKeysProperty",
  b,a))}},linkDataArray:{get:function(){return this.$c},set:function(a){var b=this.$c;if(b!==a){this.gb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!za(e)){B("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}mb(e)}this.$c=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.Wb(f);void 0===g?d.add(f):null!==this.gb.G(g)?d.add(f):this.gb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Rq(e),f=this.Wb(e),void 0!==
  f&&this.gb.add(f,e)}d=new G;for(e=0;e<c;e++)d.add(a[e]);this.ag=d;ur(this,"linkDataArray",xe,"linkDataArray",this,b,a);for(b=0;b<c;b++)Dr(this,a[b])}}},linkKeyProperty:{get:function(){return this.Hi},set:function(a){var b=this.Hi;if(b!==a){this.Hi=a;this.gb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.Wb(e);void 0===f&&(this.Rq(e),f=this.Wb(e));void 0!==f&&this.gb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
  get:function(){return this.Ql},set:function(a){var b=this.Ql;b!==a&&(this.Ql=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.hl},set:function(a){var b=this.hl;b!==a&&(this.hl=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.Ul},set:function(a){var b=this.Ul;b!==a&&(this.Ul=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
  get:function(){return this.ze},set:function(a){var b=this.ze;b!==a&&(this.ze=a,this.g("nodeGroupKeyProperty",b,a))}},rk:{get:function(){return this.En},set:function(a){this.En!==a&&(this.En=a)}},linkCategoryProperty:{get:function(){return this.Tj},set:function(a){var b=this.Tj;b!==a&&(this.Tj=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
  zr.prototype.setCategoryForLinkData=zr.prototype.cr;zr.prototype.getCategoryForLinkData=zr.prototype.Lt;zr.prototype.assignAllDataProperties=zr.prototype.vq;zr.prototype.setGroupKeyForNodeData=zr.prototype.dr;zr.prototype.getGroupKeyForNodeData=zr.prototype.Lh;zr.prototype.isGroupForNodeData=zr.prototype.fw;zr.prototype.copyLinkData=zr.prototype.Aq;zr.prototype.mergeLinkDataArray=zr.prototype.JA;zr.prototype.removeLinkDataCollection=zr.prototype.UA;zr.prototype.removeLinkData=zr.prototype.Mm;
  zr.prototype.addLinkDataCollection=zr.prototype.pz;zr.prototype.addLinkData=zr.prototype.bj;zr.prototype.containsLinkData=zr.prototype.xc;zr.prototype.makeLinkDataKeyUnique=zr.prototype.Rq;zr.prototype.findLinkDataForKey=zr.prototype.Dg;zr.prototype.setKeyForLinkData=zr.prototype.iu;zr.prototype.getKeyForLinkData=zr.prototype.Wb;zr.prototype.removeLabelKeyForLinkData=zr.prototype.Oy;zr.prototype.addLabelKeyForLinkData=zr.prototype.Dv;zr.prototype.setLabelKeysForLinkData=zr.prototype.ju;
  zr.prototype.getLabelKeysForLinkData=zr.prototype.Bf;zr.prototype.setToPortIdForLinkData=zr.prototype.Hw;zr.prototype.getToPortIdForLinkData=zr.prototype.By;zr.prototype.setFromPortIdForLinkData=zr.prototype.Cw;zr.prototype.getFromPortIdForLinkData=zr.prototype.yy;zr.prototype.setToKeyForLinkData=zr.prototype.Gw;zr.prototype.getToKeyForLinkData=zr.prototype.Ay;zr.prototype.setFromKeyForLinkData=zr.prototype.Bw;zr.prototype.getFromKeyForLinkData=zr.prototype.xy;zr.prototype.clear=zr.prototype.clear;
  var Cr=Object.freeze([]);zr.className="GraphLinksModel";xr.GraphLinksModel=zr;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new zr};Z.initDiagramModel=zi=function(){return new zr};function Er(a){Z.call(this);this.Ae="parent";this.Gn=!1;this.$j="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}ma(Er,Z);Er.constructGraphLinksModel=Z.constructGraphLinksModel;
  Er.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.Ae=this.Ae;a.Gn=this.Gn;a.$j=this.$j};t=Er.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.fr();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.ja(e)+":"+Ka(e)}}return b};
  t.Vk=function(){var a=Z.prototype.Vk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.Xq=function(a){Z.prototype.Xq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.kr=function(a){mr(this,a,"nodeParentKeyProperty");return Z.prototype.kr.call(this,a)};
  t.Wq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&B("applyIncrementalJson cannot change Model properties");Z.prototype.Wq.call(this,a)};t.Gm=function(a){return a};t.Mh=function(a){if(null!==a){var b=this.Ae;if(""!==b&&(b=vn(a,b),void 0!==b)){if(Uq(b))return b;B("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
  t.fe=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.Ae;if(""!==c)if(b=this.Gm(b),this.ab(a)){var d=vn(a,c);d!==b&&(Yq(this,d,a),Uj(a,c,b),null===this.Kb(b)&&Zq(this,b,a),ur(this,"nodeParentKey",xe,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Uj(a,c,b)}};t.Ot=function(a){if(null===a)return"";var b=this.$j;if(""===b)return"";b=vn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;B("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
  Er.prototype.getLinkCategoryForData=function(a){return this.Ot(a)};Er.prototype.ku=function(a,b){if(null!==a){var c=this.$j;if(""!==c)if(this.ab(a)){var d=vn(a,c);void 0===d&&(d="");d!==b&&(Uj(a,c,b),ur(this,"parentLinkCategory",xe,c,a,d,b),"string"===typeof c&&this.Ea(a,c))}else Uj(a,c,b)}};Er.prototype.setLinkCategoryForData=function(a,b){this.ku(a,b)};
  Er.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.sk||""===this.Ae||void 0===vn(a,this.Ae)||Uj(a,this.Ae,void 0);return a};Er.prototype.setDataProperty=function(a,b,c){if(this.ab(a)){if(b===this.nodeKeyProperty){this.Vm(a,c);return}if(b===this.nodeCategoryProperty){this.Um(a,c);return}if(b===this.nodeParentKeyProperty){this.fe(a,c);return}}var d=vn(a,b);d!==c&&(Uj(a,b,c),this.du(a,b,d,c))};t=Er.prototype;
  t.ar=function(a,b){Z.prototype.ar.call(this,a,b);for(var c=this.Wa.iterator;c.next();)this.vw(c.value,a,b)};t.vw=function(a,b,c){if(this.Mh(a)===b){var d=this.Ae;Uj(a,d,c);ur(this,"nodeParentKey",xe,d,a,b,c);"string"===typeof d&&this.Ea(a,d)}};
  t.Qm=function(a){Z.prototype.Qm.call(this,a);a=this.ja(a);var b=Xq(this,a);if(null!==b){var c=Ea();for(b=b.iterator;b.next();){var d=b.value;if(this.ab(d)&&this.Mh(d)===a){var e=this.Ae;ur(this,"nodeParentKey",xe,e,d,a,a);"string"===typeof e&&this.Ea(d,e);c.push(d)}}for(b=0;b<c.length;b++)Yq(this,a,c[b]);Ia(c)}};t.Pm=function(a){Z.prototype.Pm.call(this,a);var b=this.Mh(a);b=this.Gm(b);null===this.Kb(b)&&Zq(this,b,a)};t.hr=function(a){Z.prototype.hr.call(this,a);var b=this.Mh(a);Yq(this,b,a)};
  t.Wm=function(a,b){Z.prototype.Wm.call(this,a,b);this.ku(b,this.Ot(a));this.fe(b,this.Mh(a))};t.Em=function(){return!0};t.Ut=function(){return!0};
  na.Object.defineProperties(Er.prototype,{nodeParentKeyProperty:{get:function(){return this.Ae},set:function(a){var b=this.Ae;b!==a&&(this.Ae=a,this.g("nodeParentKeyProperty",b,a))}},sk:{get:function(){return this.Gn},set:function(a){this.Gn!==a&&(this.Gn=a)}},parentLinkCategoryProperty:{get:function(){return this.$j},set:function(a){var b=this.$j;b!==a&&(this.$j=a,this.g("parentLinkCategoryProperty",b,a))}},
  linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});Er.prototype.setParentLinkCategoryForNodeData=Er.prototype.ku;Er.prototype.getParentLinkCategoryForNodeData=Er.prototype.Ot;Er.prototype.setParentKeyForNodeData=Er.prototype.fe;Er.prototype.getParentKeyForNodeData=Er.prototype.Mh;Er.className="TreeModel";xr.TreeModel=Er;
  function Fr(){Bi.call(this);this.wx=this.Un=this.$b=0;this.Ur=360;this.vx=Gr;this.Ij=0;this.mx=new J;this.Gr=this.be=0;this.ut=new Hr;this.Bu=this.Zj=0;this.gz=600;this.Ap=NaN;this.pn=1;this.bq=0;this.mm=360;this.Eb=Gr;this.K=Ir;this.bd=Jr;this.Wc=vq;this.lf=6;this.jp=Kr}ma(Fr,Bi);Fr.prototype.cloneProtected=function(a){Bi.prototype.cloneProtected.call(this,a);a.Ap=this.Ap;a.pn=this.pn;a.bq=this.bq;a.mm=this.mm;a.Eb=this.Eb;a.K=this.K;a.bd=this.bd;a.Wc=this.Wc;a.lf=this.lf;a.jp=this.jp};
  Fr.prototype.jb=function(a){if(a.classType===Fr)if(a===Lr||a===Mr||a===Nr||a===Or||a===Jr)this.sorting=a;else if(a===Pr||a===Qr||a===Ir||a===Rr)this.direction=a;else if(a===Sr||a===Tr||a===Gr||a===Ur)this.arrangement=a;else{if(a===Vr||a===Kr)this.nodeDiameterFormula=a}else Bi.prototype.jb.call(this,a)};Fr.prototype.createNetwork=function(){return new Wr(this)};
  Fr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=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.Gr;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)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===Ur&&k===Vr?h=Gr:h===Ur&&k!==Vr&&(h=this.arrangement);if((this.direction===Pr||this.direction===Qr)&&this.sorting!==Jr){for(k=0;!(k>=d.length);k+=2){a.add(d.J(k));if(k+1>=d.length)break;c.add(d.J(k+1))}this.direction===Pr?(this.arrangement===Ur&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Ur&&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===Ir?1:-1)/k,u=d.J(r).diameter;isNaN(u)&&(u=Xr(d.J(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Ur){isNaN(b)&&(b=6);if(h!==Gr&&h!==Ur){f=-Infinity;for(g=0;g<k;g++)r=d.J(g),e=d.J(g===k-1?0:g+1),isNaN(r.diameter)&&Xr(r,0),isNaN(e.diameter)&&Xr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Sr?l=(f+b)/(2*Math.PI/k):l=Yr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Yr(this,e+(360<=p?k:k-1)*(h!==Ur?b:1.6*b),m,n*
  Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Zr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Gr||h===Ur)b=(r-e)/(360<=p?k:k-1)}else if(h===Gr||h===Ur)r=(r-e)/(360<=p?k:k-1),r<b?(l=Yr(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.J(e),u=d.J(e===k-1?0:e+1),isNaN(q.diameter)&&Xr(q,0),isNaN(u.diameter)&&Xr(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Yr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=
  r/(360<=p?k:k-1)}this.vx=h;this.$b=l;this.Un=m;this.wx=n;this.Ur=p;this.Ij=b;this.be=f;this.Gr=g;b=d;d=this.vx;h=this.$b;l=this.wx;m=this.Ur;n=this.Ij;p=this.be;k=this.Gr;if(this.direction!==Pr&&this.direction!==Qr||d!==Ur)if(this.direction===Pr||this.direction===Qr){g=0;switch(d){case Tr:g=180*$r(this,h,p,l,k)/Math.PI;break;case Gr:k=b=0;g=a.first();null!==g&&(b=Xr(g,Math.PI/2));g=c.first();null!==g&&(k=Xr(g,Math.PI/2));g=180*$r(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Sr:g=m/b.length}if(this.direction===
  Pr){switch(d){case Tr:as(this,a,l,Rr);break;case Gr:bs(this,a,l,Rr);break;case Sr:cs(this,a,m/2,l,Rr)}switch(d){case Tr:as(this,c,l+g,Ir);break;case Gr:bs(this,c,l+g,Ir);break;case Sr:cs(this,c,m/2,l+g,Ir)}}else{switch(d){case Tr:as(this,c,l,Rr);break;case Gr:bs(this,c,l,Rr);break;case Sr:cs(this,c,m/2,l,Rr)}switch(d){case Tr:as(this,a,l+g,Ir);break;case Gr:bs(this,a,l+g,Ir);break;case Sr:cs(this,a,m/2,l+g,Ir)}}}else switch(d){case Tr:as(this,b,l,this.direction);break;case Gr:bs(this,b,l,this.direction);
  break;case Sr:cs(this,b,m,l,this.direction);break;case Ur:ds(this,b,m,l,this.direction)}else ds(this,b,m,l-m/2,Ir)}this.updateParts();this.network=null;this.isValidLayout=!0};function cs(a,b,c,d,e){var f=a.Ur,g=a.$b;a=a.be;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Ir?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.J(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
  function bs(a,b,c,d){var e=a.$b,f=a.be,g=a.Ij;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.J(k),m=b.J(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&Xr(l,0);isNaN(m.diameter)&&Xr(m,0);l=$r(a,e,f,d===Ir?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Ir?l:-l}}
  function as(a,b,c,d){var e=a.$b,f=a.be,g=a.Gr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.J(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=$r(a,e,f,d===Ir?c:-c,g);c+=d===Ir?l:-l}}function ds(a,b,c,d,e){var f=a.Ur;a.Zj=0;a.ut=new Hr;if(360>c){for(f=d+(e===Ir?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Bu=f;es(a,b,c,d,e)}else fs(a,b,c,d,e);a.ut.commit(b)}
  function fs(a,b,c,d,e){var f=a.$b,g=a.Ij,h=a.Un,k=f*Math.cos(d*Math.PI/180),l=a.be*Math.sin(d*Math.PI/180),m=b.ma();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
  m[0].height+g,m[2].y+m[2].height+g);else{f=J.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;gs(a,k,l,m,n,e,f)||hs(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.Zj++;if(!(23<a.Zj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)?
  0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===Ir?k:!k)g=-Math.abs(g),g=Math.min(g,-m[m.length-1].width),g=Math.min(g,-m[m.length-1].height);a.ut.compare(g,m);1<Math.abs(g)&&(a.$b=8>a.Zj?a.$b-g/(2*Math.PI):5>m.length&&10<g?a.$b/2:a.$b-(0<g?1.7:-2.3),a.be=a.$b*h,fs(a,b,c,d,e))}}}
  function es(a,b,c,d,e){for(var f=a.$b,g=a.be,h=a.Un,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.ma(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;gs(a,k,l,n,p,e,m)||hs(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.Zj++;if(!(23<a.Zj)){k=Math.atan2(l,k);k=e===Ir?a.Bu-k:k-a.Bu;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.ut;if(Math.abs(f)<Math.abs(g.Am))for(g.Am=f,g.Wk=[],g.cn=[],k=0;k<n.length;k++)g.Wk[k]=n[k].bounds.x,g.cn[k]=n[k].bounds.y;
  1<Math.abs(f)&&(a.$b=8>a.Zj?a.$b-f/(2*Math.PI):a.$b-(0<f?1.7:-2.3),a.be=a.$b*h,es(a,b,c,d,e))}}function gs(a,b,c,d,e,f,g){var h=a.$b,k=a.be,l=0;a=(d[e].width+d[e+1].width)/2+a.Ij;var m=!1;if(0<=c!==(f===Ir)){if(f=b+a,f>h){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 hs(a,b,c,d,e,f,g){var h=a.$b,k=a.be,l=0;a=(d[e].height+d[e+1].height)/2+a.Ij;d=!1;if(0<=b!==(f===Ir)){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}Fr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
  Fr.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 J(0,0):(c.x=this.arrangementOrigin.x+this.$b,c.y=this.arrangementOrigin.y+this.be);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.Ta(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.ge(c.ge(a)),this.group.move(b),this.mx=b.ge(a))};
  Fr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Zr(a,b,c,d,e){var f=a.gz;if(.001>Math.abs(a.Un-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 Yr(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Zr(a,1,c,d,e):Zr(a,1,c))}function $r(a,b,c,d,e){if(.001>Math.abs(a.Un-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}}
  Fr.prototype.sort=function(a){switch(this.sorting){case Nr:break;case Or:a.reverse();break;case Lr:a.sort(this.comparer);break;case Mr:a.sort(this.comparer);a.reverse();break;case Jr:return this.nw(is(a));default:B("Invalid sorting type.")}return a};
  function is(a){for(var b=[],c=0;c<a.length;c++)b.push(0);c=new E;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.J(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.J(f));b[f]=-1;f=a.J(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]++}return c}
  Fr.prototype.nw=function(a){for(var b=[],c=0;c<a.length;c++){var d=a.J(c);b[c]=[];for(var e,f=d.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e);for(d=d.sourceEdges;d.next();)e=a.indexOf(d.value.fromVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e)}f=[];for(c=0;c<b.length;c++)f[c]=0;c=[];var g=[],h=[];d=[];e=new E;for(var k=0,l=0;l<b.length;l++){var m=b[l].length;if(1===m)d.push(l);else if(0===m)e.add(a.J(l));else{if(0===k)c.push(l);else{for(var n=m=Infinity,
  p=-1,r=[],q=0;q<c.length;q++)0>b[c[q]].indexOf(c[q===c.length-1?0:q+1])&&r.push(q===c.length-1?0:q+1);if(0===r.length)for(q=0;q<c.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],w=b[l],v=0,y=0;y<g.length;y++){var z=f[g[y]],A=f[h[y]];if(z<A){var C=z;z=A}else C=A;if(C<u&&u<=z)for(A=0;A<w.length;A++){var F=w[A];0>c.indexOf(F)||C<f[F]&&f[F]<z||C===f[F]||z===f[F]||v++}else for(A=0;A<w.length;A++)F=w[A],0>c.indexOf(F)||C<f[F]&&f[F]<z&&C!==f[F]&&z!==f[F]&&v++}w=v;for(y=v=0;y<b[l].length;y++)C=
  c.indexOf(b[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),v+=C<c.length+1-C?C:c.length+1-C);for(y=0;y<g.length;y++)C=f[g[y]],z=f[h[y]],C>=u&&C++,z>=u&&z++,C>z&&(A=z,z=C,C=A),z-C<(c.length+2)/2===(C<u&&u<=z)&&v++;if(w<m||w===m&&v<n)m=w,n=v,p=u}c.splice(p,0,l);for(m=0;m<c.length;m++)f[c[m]]=m;for(m=0;m<b[l].length;m++)n=b[l][m],0<=c.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=c.length;;){f=!0;for(h=0;h<d.length;h++)if(k=d[h],l=b[k][0],m=c.indexOf(l),0<=m){for(p=n=0;p<b[l].length;p++)r=c.indexOf(b[l][p]),
  0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);c.splice(0>n?m:m+1,0,k);d.splice(h,1);h--}else f=!1;if(f)break;else c.push(d[0]),d.splice(0,1)}for(b=0;b<c.length;b++)e.add(a.J(c[b]));return e};
  na.Object.defineProperties(Fr.prototype,{radius:{get:function(){return this.Ap},set:function(a){this.Ap!==a&&(0<a||isNaN(a))&&(this.Ap=a,this.C())}},aspectRatio:{get:function(){return this.pn},set:function(a){this.pn!==a&&0<a&&(this.pn=a,this.C())}},startAngle:{get:function(){return this.bq},set:function(a){this.bq!==a&&(this.bq=a,this.C())}},sweepAngle:{get:function(){return this.mm},
  set:function(a){this.mm!==a&&(0<a&&360>=a?this.mm=a:this.mm=360,this.C())}},arrangement:{get:function(){return this.Eb},set:function(a){this.Eb===a||a!==Ur&&a!==Gr&&a!==Tr&&a!==Sr||(this.Eb=a,this.C())}},direction:{get:function(){return this.K},set:function(a){this.K===a||a!==Ir&&a!==Rr&&a!==Pr&&a!==Qr||(this.K=a,this.C())}},sorting:{get:function(){return this.bd},set:function(a){this.bd===a||a!==Nr&&a!==Or&&
  a!==Lr&&!Mr&&a!==Jr||(this.bd=a,this.C())}},comparer:{get:function(){return this.Wc},set:function(a){this.Wc!==a&&(this.Wc=a,this.C())}},spacing:{get:function(){return this.lf},set:function(a){this.lf!==a&&(this.lf=a,this.C())}},nodeDiameterFormula:{get:function(){return this.jp},set:function(a){this.jp===a||a!==Kr&&a!==Vr||(this.jp=a,this.C())}},actualXRadius:{get:function(){return this.$b}},
  actualYRadius:{get:function(){return this.be}},actualSpacing:{get:function(){return this.Ij}},actualCenter:{get:function(){return this.mx}}});
  var Gr=new D(Fr,"ConstantSpacing",0),Tr=new D(Fr,"ConstantDistance",1),Sr=new D(Fr,"ConstantAngle",2),Ur=new D(Fr,"Packed",3),Ir=new D(Fr,"Clockwise",4),Rr=new D(Fr,"Counterclockwise",5),Pr=new D(Fr,"BidirectionalLeft",6),Qr=new D(Fr,"BidirectionalRight",7),Nr=new D(Fr,"Forwards",8),Or=new D(Fr,"Reverse",9),Lr=new D(Fr,"Ascending",10),Mr=new D(Fr,"Descending",11),Jr=new D(Fr,"Optimized",12),Kr=new D(Fr,"Pythagorean",13),Vr=new D(Fr,"Circular",14);Fr.className="CircularLayout";Fr.ConstantSpacing=Gr;
  Fr.ConstantDistance=Tr;Fr.ConstantAngle=Sr;Fr.Packed=Ur;Fr.Clockwise=Ir;Fr.Counterclockwise=Rr;Fr.BidirectionalLeft=Pr;Fr.BidirectionalRight=Qr;Fr.Forwards=Nr;Fr.Reverse=Or;Fr.Ascending=Lr;Fr.Descending=Mr;Fr.Optimized=Jr;Fr.Pythagorean=Kr;Fr.Circular=Vr;function Hr(){this.Am=-Infinity;this.cn=this.Wk=null}
  Hr.prototype.compare=function(a,b){if(0<a&&0>this.Am||Math.abs(a)<Math.abs(this.Am)&&!(0>a&&0<this.Am))for(this.Am=a,this.Wk=[],this.cn=[],a=0;a<b.length;a++)this.Wk[a]=b[a].bounds.x,this.cn[a]=b[a].bounds.y};Hr.prototype.commit=function(a){if(null!==this.Wk&&null!==this.cn)for(var b=0;b<this.Wk.length;b++){var c=a.J(b);c.x=this.Wk[b];c.y=this.cn[b]}};Hr.className="VertexArrangement";function Wr(a){aq.call(this,a)}ma(Wr,aq);Wr.prototype.createVertex=function(){return new js(this)};
  Wr.prototype.createEdge=function(){return new ks(this)};Wr.className="CircularNetwork";function js(a){oq.call(this,a);this.I=this.Gj=NaN}ma(js,oq);
  function Xr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Ur)if(c.nodeDiameterFormula===Vr)a.Gj=Math.max(a.width,a.height);else{c=Math.abs(Math.sin(b));b=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===b)return a.height;a.Gj=Math.min(a.height/c,a.width/b)}else a.Gj=c.nodeDiameterFormula===Vr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Gj}
  na.Object.defineProperties(js.prototype,{diameter:{get:function(){return this.Gj},set:function(a){this.Gj!==a&&(this.Gj=a)}},actualAngle:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}}});js.className="CircularVertex";function ks(a){pq.call(this,a)}ma(ks,pq);ks.className="CircularEdge";
  function ls(){Bi.call(this);this.Fh=null;this.Eo=0;this.Pd=(new M(100,100)).freeze();this.on=!1;this.kf=!0;this.jd=!1;this.Rl=100;this.Xn=1;this.Xf=1E3;this.bp=10;this.Bp=Math;this.ol=.05;this.nl=50;this.ll=150;this.ml=0;this.On=10;this.Nn=5}ma(ls,Bi);
  ls.prototype.cloneProtected=function(a){Bi.prototype.cloneProtected.call(this,a);a.Pd.assign(this.Pd);a.on=this.on;a.kf=this.kf;a.jd=this.jd;a.Rl=this.Rl;a.Xn=this.Xn;a.Xf=this.Xf;a.bp=this.bp;a.Bp=this.Bp;a.ol=this.ol;a.nl=this.nl;a.ll=this.ll;a.ml=this.ml;a.On=this.On;a.Nn=this.Nn};
  ls.prototype.serializeLayoutProperties=function(a,b){Bi.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength=
  this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge};
  ls.prototype.deserializeLayoutProperties=function(a,b,c,d,e){Bi.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.arrangementSpacing=new M(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness;
  this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};ls.prototype.createNetwork=function(){return new ms(this)};
  ls.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));if(!this.Uw()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Bq();for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.iterator;b.next();)c=b.value,c.stiffness=this.springStiffness(c),c.length=this.springLength(c);this.Fv();this.Eo=0;if(this.needsClusterLayout()){b=this.network;c=b.Xy();
  for(var d=c.iterator;d.next();){this.network=d.value;for(var e=this.network.vertexes.iterator;e.next();){var f=e.value;f.Ld=f.vertexes.count;f.Sh=1;f.qk=null;f.Ne=null}ns(this,0,a)}this.network=b;var g=d=c.iterator;d=this.arrangementSpacing;var h=g.count,k=!0;f=e=0;for(var l=Ea(),m=0;m<h+b.vertexes.count+2;m++)l[m]=null;h=0;g.reset();for(var n=N.alloc();g.next();)if(m=g.value,this.computeBounds(m,n),k)k=!1,e=n.x+n.width/2,f=n.y+n.height/2,l[0]=new J(n.x+n.width+d.width,n.y),l[1]=new J(n.x,n.y+n.height+
  d.height),h=2;else{var p=os(l,h,e,f,n.width,n.height,d),r=l[p],q=new J(r.x+n.width+d.width,r.y),u=new J(r.x,r.y+n.height+d.height);p+1<h&&l.splice(p+1,0,null);l[p]=q;l[p+1]=u;h++;p=r.x-n.x;r=r.y-n.y;for(m=m.vertexes.iterator;m.next();)q=m.value,q.centerX+=p,q.centerY+=r}N.free(n);for(m=b.vertexes.iterator;m.next();)g=m.value,p=g.bounds,2>h?(e=p.x+p.width/2,f=p.y+p.height/2,l[0]=new J(p.x+p.width+d.width,p.y),l[1]=new J(p.x,p.y+p.height+d.height),h=2):(k=os(l,h,e,f,p.width,p.height,d),n=l[k],r=new J(n.x+
  p.width+d.width,n.y),p=new J(n.x,n.y+p.height+d.height),k+1<h&&l.splice(k+1,0,null),l[k]=r,l[k+1]=p,h++,g.centerX=n.x+g.width/2,g.centerY=n.y+g.height/2);Ia(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.Bg(e.value);for(c=c.edges.iterator;c.next();)b.tm(c.value)}}ps(this,a);this.updateParts()}this.Rl=a;this.network=null;this.isValidLayout=!0}};
  ls.prototype.needsClusterLayout=function(){if(3>this.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.Mc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};ls.prototype.computeBounds=function(a,b){var c=!0;for(a=a.vertexes.iterator;a.next();){var d=a.value;c?(c=!1,b.set(d.bounds)):b.Rc(d.bounds)}return b};
  function ns(a,b,c){if(qs(a,b)){var d=a.Xf;a.Xf*=1+1/(b+1);var e=rs(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;ns(a,b+1,c);ps(a,f);ss(a,e);b=e.vertexes.ma();b.sort(function(a,b){return null===a||null===b||a===b?0:b.Ld-a.Ld});for(c=0;c<b.length;c++)ts(a,b[c]);a.Xf=d}}
  function qs(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.Fh=a.network.vertexes.ma();a=a.Fh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Ld-a.Ld});for(b=a.length-1;0<=b&&1>=a[b].Ld;)b--;return 1<a.length-b}
  function rs(a,b){for(var c=a.network,d=new ms(a),e=0;e<a.Fh.length;e++){var f=a.Fh[e];if(1<f.Ld){d.Bg(f);var g=new us;g.qu=f.Ld;g.ru=f.width;g.pu=f.height;g.$w=f.focus.x;g.ax=f.focus.y;null===f.Ne&&(f.Ne=new E);f.Ne.add(g);f.zw=f.Ne.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.tm(h):e.network===d?(h=e.qk,null===h&&(h=new E,e.qk=h),h.add(g),e.Ld--,e.Sh+=g.Sh):g.network===d&&(h=g.qk,null===h&&(h=new E,g.qk=h),h.add(e),
  g.Ld--,g.Sh+=e.Sh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,L.sqrt((f.fromVertex.Sh+f.toVertex.Sh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.qk;if(null!==k&&0<k.count&&(g=e.Ne.J(e.Ne.count-1).qu-e.Ld,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.J(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.zy(n)===e){p=r;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=e.height;p=e.focus;r=m*n;1>r&&
  (r=1);h=L.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 J(p.x+g,p.y+h)}}a.network=d;return c}function ss(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ne){var e=d.Ne.J(d.zw);d.Ld=e.qu;var f=e.$w,g=e.ax;d.bounds=new N(d.centerX-f,d.centerY-g,e.ru,e.pu);d.focus=new J(f,g);d.zw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
  function ts(a,b){var c=b.qk;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Ne&&0<b.Ne.count&&(g=b.Ne.J(0),f=g.ru,g=g.pu);f=L.sqrt(f*f+g*g)/2;for(var h=!1,k=g=0,l=0,m=b.vertexes.iterator;m.next();){var n=m.value;1>=n.Ld?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<c.count&&c.sort(function(a,b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),
  h=0===k%2?0:1,c=c.iterator;c.next();)if(k=c.value,!(1<k.Ld||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=L.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=d+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
  function os(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;l<b;l++){var m=a[l],n=m.x-c,p=m.y-d;n=n*n+p*p;if(n<h){for(p=l-1;0<=p;p--)if(a[p].y>m.y&&a[p].x-m.x<e+g.width)continue a;for(p=l+1;p<b;p++)if(a[p].x>m.x&&a[p].y-m.y<f+g.height)continue a;k=l;h=n}}return k}ls.prototype.Fv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
  ls.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Sv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.kj(c);null===d&&(d=this.network.mk(c));d.charge=this.defaultCommentElectricalCharge;c=null;for(var e=d.destinationEdges;e.next();){var f=e.value;if(f.toVertex===a){c=f;break}}if(null===c)for(e=d.sourceEdges;e.next();)if(f=e.value,f.fromVertex===a){c=f;break}null===c&&(c=this.network.Fk(a,d,null));c.length=this.defaultCommentSpringLength}}};
  function vs(a,b){var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,L.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,L.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,L.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,L.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function ps(a,b){a.Fh=null;for(b=a.Eo+b;a.Eo<b&&(a.Eo++,ws(a)););a.Fh=null}
  function ws(a){null===a.Fh&&(a.Fh=a.network.vertexes.ma());var b=a.Fh;if(0>=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;g<b.length;g++){var h=b[g];h.forceX=0;h.forceY=0;var k=h.centerX;h=h.centerY;d=Math.min(d,k);e=Math.max(e,k);c=Math.min(c,h);f=Math.max(f,h)}(e=e-d>f-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.Xf;var l=d=h=0;for(f=
  0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=vs(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new xs),q=d.random(),
  h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(q*q),d=(l-k)/q*h,l=(r-m)/q*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
  g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=vs(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new xs),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;for(e=d=0;e<b.length;e++)c=b[e],a.isFixed(c)?a.moveFixedVertex(c):d=Math.max(d,a.moveVertex(c)||
  0);return d>a.epsilonDistance*a.epsilonDistance}ls.prototype.moveVertex=function(a){var b=a.forceX,c=a.forceY,d=this.moveLimit;b<-d?b=-d:b>d&&(b=d);c<-d?c=-d:c>d&&(c=d);a.centerX+=b;a.centerY+=c;return b*b+c*c};ls.prototype.moveFixedVertex=function(){};ls.prototype.commitLayout=function(){this.Dw();this.commitNodes();this.isRouting&&this.commitLinks()};
  ls.prototype.Dw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Vc,b.toSpot=Vc)}};ls.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)};
  ls.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};ls.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.ol:a};ls.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.nl:a};ls.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.ll:a};ls.prototype.electricalFieldX=function(){return 0};ls.prototype.electricalFieldY=function(){return 0};
  ls.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.ml:a};ls.prototype.gravitationalFieldX=function(){return 0};ls.prototype.gravitationalFieldY=function(){return 0};ls.prototype.isFixed=function(a){return a.isFixed};
  na.Object.defineProperties(ls.prototype,{currentIteration:{get:function(){return this.Eo}},arrangementSpacing:{get:function(){return this.Pd},set:function(a){this.Pd.w(a)||(this.Pd.assign(a),this.C())}},arrangesToOrigin:{get:function(){return this.on},set:function(a){this.on!==a&&(this.on=a,this.C())}},setsPortSpots:{get:function(){return this.kf},set:function(a){this.kf!==a&&(this.kf=
  a,this.C())}},comments:{get:function(){return this.jd},set:function(a){this.jd!==a&&(this.jd=a,this.C())}},maxIterations:{get:function(){return this.Rl},set:function(a){this.Rl!==a&&0<=a&&(this.Rl=a,this.C())}},epsilonDistance:{get:function(){return this.Xn},set:function(a){this.Xn!==a&&0<a&&(this.Xn=a,this.C())}},infinityDistance:{get:function(){return this.Xf},set:function(a){this.Xf!==
  a&&1<a&&(this.Xf=a,this.C())}},moveLimit:{get:function(){return this.bp},set:function(a){this.bp!==a&&1<a&&(this.bp=a,this.C())}},randomNumberGenerator:{get:function(){return this.Bp},set:function(a){this.Bp!==a&&(null!==a&&"function"!==typeof a.random&&B('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Bp=a)}},defaultSpringStiffness:{get:function(){return this.ol},
  set:function(a){this.ol!==a&&(this.ol=a,this.C())}},defaultSpringLength:{get:function(){return this.nl},set:function(a){this.nl!==a&&(this.nl=a,this.C())}},defaultElectricalCharge:{get:function(){return this.ll},set:function(a){this.ll!==a&&(this.ll=a,this.C())}},defaultGravitationalMass:{get:function(){return this.ml},set:function(a){this.ml!==a&&(this.ml=a,this.C())}},defaultCommentSpringLength:{
  get:function(){return this.On},set:function(a){this.On!==a&&(this.On=a,this.C())}},defaultCommentElectricalCharge:{get:function(){return this.Nn},set:function(a){this.Nn!==a&&(this.Nn=a,this.C())}}});ls.className="ForceDirectedLayout";function us(){this.ax=this.$w=this.pu=this.ru=this.qu=0}us.className="ForceDirectedSubnet";function ms(a){aq.call(this,a)}ma(ms,aq);ms.prototype.createVertex=function(){return new ys(this)};ms.prototype.createEdge=function(){return new zs(this)};
  ms.className="ForceDirectedNetwork";function ys(a){oq.call(this,a);this.La=!1;this.eb=this.I=NaN;this.Sh=this.Ld=this.Ka=this.T=0;this.Ne=this.qk=null;this.zw=0}ma(ys,oq);ys.prototype.serializeVertexProperties=function(a,b){oq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};ys.prototype.Cq=function(a,b,c,d){oq.prototype.Cq.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
  na.Object.defineProperties(ys.prototype,{isFixed:{get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},charge:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},mass:{get:function(){return this.eb},set:function(a){this.eb!==a&&(this.eb=a)}},forceX:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}},forceY:{
  get:function(){return this.Ka},set:function(a){this.Ka!==a&&(this.Ka=a)}}});ys.className="ForceDirectedVertex";function zs(a){pq.call(this,a);this.l=this.u=NaN}ma(zs,pq);zs.prototype.serializeEdgeProperties=function(a,b){pq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};zs.prototype.deserializeEdgeProperties=function(a,b,c,d){pq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};
  na.Object.defineProperties(zs.prototype,{stiffness:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},length:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}}});zs.className="ForceDirectedEdge";function xs(){var a=0;void 0===a&&(a=42);this.seed=a;this.Zy=48271;this.az=2147483647;this.Q=44488.07041494893;this.bz=3399;this.$y=1/2147483647;this.random()}
  xs.prototype.random=function(){var a=this.seed%this.Q*this.Zy-this.seed/this.Q*this.bz;0<a?this.seed=a:this.seed=a+this.az;return this.seed*this.$y};xs.className="RandomNumberGenerator";
  function As(){Bi.call(this);this.Zb=this.ue=25;this.K=0;this.jl=Bs;this.Ml=Cs;this.Bl=Ds;this.Rj=4;this.Zk=Es;this.ng=15;this.kf=!0;this.Mo=4;this.Ca=this.Ji=this.sa=-1;this.pc=this.mh=0;this.Ia=this.yd=this.zd=this.$d=this.zb=null;this.oh=0;this.fp=this.Wj=null;this.Ec=0;this.gp=null;this.Vc=new J;this.xe=[];this.xe.length=100}ma(As,Bi);
  As.prototype.cloneProtected=function(a){Bi.prototype.cloneProtected.call(this,a);a.ue=this.ue;a.Zb=this.Zb;a.K=this.K;a.jl=this.jl;a.Ml=this.Ml;a.Bl=this.Bl;a.Rj=this.Rj;a.Zk=this.Zk;a.ng=this.ng;a.kf=this.kf;a.Mo=this.Mo};
  As.prototype.serializeLayoutProperties=function(a,b){Bi.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing;
  a.sa=this.sa;a.Ji=this.Ji;a.Ca=this.Ca;a.mh=this.mh;a.pc=this.pc;a.zb=this.zb;a.oh=this.oh;a.Ec=this.Ec;a.Vc={x:this.Vc.x,y:this.Vc.y}};
  As.prototype.deserializeLayoutProperties=function(a,b,c,d,e){Bi.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=Ya(As,a.cycleRemoveOption);this.layeringOption=Ya(As,a.layeringOption);this.initializeOption=Ya(As,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=Ya(As,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;
  this.linkSpacing=a.linkSpacing;this.sa=a.sa;this.Ji=a.Ji;this.Ca=a.Ca;this.mh=a.mh;this.pc=a.pc;this.zb=a.zb;this.oh=a.oh;this.Ec=a.Ec;this.Vc=new J(this.Vc.x,this.Vc.y);e&&!d&&e.edges.each(function(a){if(!a.link&&a.fromVertex&&a.toVertex&&(null===a.fromVertex.node||null===a.toVertex.node)){for(var b=a.fromVertex;null!==b&&null===b.node&&0<b.td.count;){var c=b.td.J(0);if(c.link){a.link=c.link;break}b=c.fromVertex}if(!a.link){for(c=a.toVertex;null!==c&&null===c.node&&0<c.Gd.count;){var d=c.Gd.J(0);
  if(d.link){a.link=d.link;break}c=d.toVertex}if(!a.link)for(c=c.td.iterator;c.next();)if(d=c.value,d.link&&d.fromVertex===b){a.link=d.link;break}}}})};As.prototype.jb=function(a){a.classType===As?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:B("Unknown enum value: "+a):Bi.prototype.jb.call(this,a)};As.prototype.createNetwork=function(){return new Fs(this)};
  As.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Ji=-1;this.pc=this.mh=0;this.gp=this.fp=this.Wj=null;for(a=0;a<this.xe.length;a++)this.xe[a]=null;if(0<this.network.vertexes.count){this.network.Bq();if(this.Uw())return;this.cycleRemoveOption!==Gs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.sa=-1;this.assignLayers();for(a.reset();a.next();)this.sa=
  Math.max(this.sa,a.value.layer);this.cycleRemoveOption===Gs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!(d.valid||(null===e.node&&null===e.data||null===f.node&&null===f.data)&&e.layer===f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=
  h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=J.alloc();m!==n?u.o()&&n.isVisible()?n.actualBounds.o()?(n.Df(p,zc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.Df(p,zc,r),r.o()||r.assign(q)):r.assign(q):u.o()?(n.Df(p,zc,r),r.o()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.o()&&k.isVisible()?k.actualBounds.o()?(k.Df(h,zc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(k.Df(h,zc,m),m.o()||m.assign(l)):
  m.assign(l):n.o()?(k.Df(h,zc,m),m.o()||m.assign(l)):m.assign(l);90===this.K||270===this.K?(g=Math.round((r.x-q.x)/this.Zb),k=r.x,h=Math.round((m.x-l.x)/this.Zb),l=m.x):(g=Math.round((r.y-q.y)/this.Zb),k=r.y,h=Math.round((m.y-l.y)/this.Zb),l=m.y);J.free(r);J.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var w=u.fromPort,v=u.toPort;if(null!==w&&
  null!==v){var y=u.fromNode;p=u.toNode;if(null!==y&&null!==p){var z=Hs(this,!0),A=Hs(this,!1),C=this.setsPortSpots?z:u.computeSpot(!0,w);q=this.setsPortSpots?A:u.computeSpot(!1,v);var F=u.isOrthogonal;C.Oc()&&C.Ef(A)&&q.Oc()&&q.Ef(z)?n=0:(z=u.getLinkPoint(y,w,C,!0,F,p,v,J.alloc()),A=u.getLinkDirection(y,w,z,C,!0,F,p,v),J.free(z),C.Vt()||A!==Is(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,v,q,!1,F,y,w,J.alloc()),u=u.getLinkDirection(p,v,C,q,!1,F,
  y,w),J.free(C),q.Vt()||u!==Is(this,d,!1)?this.setsPortSpots&&null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)q=a.createVertex(),q.node=null,q.wf=1,q.layer=r,q.near=e,a.Bg(q),e=a.Fk(e,q,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=q;u=1;n&&u--;if(r-m>u&&0<r){d.valid=!1;q=a.createVertex();q.node=null;q.wf=2;q.layer=r-1;a.Bg(q);e=a.Fk(e,q,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=
  p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=q;for(r--;r-m>u&&0<r;)q=a.createVertex(),q.node=null,q.wf=3,q.layer=r-1,a.Bg(q),e=a.Fk(e,q,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=q,r--;e=a.Fk(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.zb=[];for(b=0;b<=this.sa;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=
  -1;this.initializeIndices();this.Ji=-1;for(c=this.pc=this.mh=0;c<=this.sa;c++)a[c]>a[this.pc]&&(this.Ji=a[c]-1,this.pc=c),a[c]<a[this.mh]&&(this.mh=c);this.gp=[];for(c=0;c<a.length;c++)this.gp[c]=[];for(b.reset();b.next();)a=b.value,this.gp[a.layer][a.index]=a;this.Ca=-1;for(a=0;a<=this.sa;a++){b=Js(this,a);c=0;d=this.zb[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Ca=Math.max(this.Ca,c-1);Ks(this,a,b)}this.reduceCrossings();this.straightenAndPack();
  this.updateParts()}this.network=null;this.isValidLayout=!0};As.prototype.linkMinLength=function(){return 1};function Ls(a){var b=a.fromVertex.node||a.fromVertex.data;a=a.toVertex.node||a.toVertex.data;return null===b&&null===a?8:null===b||null===a?4:1}As.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.K||270===this.K?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
  As.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.Nk:a.Mk;if(null!==c)return c;c=this.K;return 90===c||270===c?b?a.Nk=a.focus.x/this.Zb+1|0:a.Mk=(a.bounds.width-a.focus.x)/this.Zb+1|0:b?a.Nk=a.focus.y/this.Zb+1|0:a.Mk=(a.bounds.height-a.focus.y)/this.Zb+1|0};function Ms(a){null===a.Wj&&(a.Wj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Wj[b]=d.layer;b++;a.Wj[b]=d.column;b++;a.Wj[b]=d.index;b++}return a.Wj}
  function Ns(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
  function Os(a,b,c){var d=Js(a,b),e=a.zb[b];if(null===a.fp||a.fp.length<e*e)a.fp=[];for(var f=a.fp,g=0;g<e;g++){var h=0,k=d[g],l=k.near;if(null!==l&&l.layer===k.layer)if(k=l.index,k>g)for(var m=g+1;m<k;m++){var n=d[m];n.near===l&&n.wf===l.wf||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.wf===l.wf||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=
  k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var w=q.portToPos;q=q.portFromPos;m<w&&(n>u||n===u&&r>q)&&h++;w<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>w)&&h++,q<r&&(u>n||u===n&&w>m)&&h++);f[g*e+g]=h;for(k=g+
  1;k<e;k++){var v=0,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&y++,(u<n||u===n&&q<r)&&v++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,
  m=r.portToPos,p=0;p<z.length;p++)q=z[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,(n<u||n===u&&m<w)&&y++,(u<n||u===n&&w<m)&&v++);f[g*e+k]=v;f[k*e+g]=y}}Ks(a,b,d);return f}As.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.sa;b++)for(var c=Os(this,b,1),d=this.zb[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
  function Ps(a){for(var b=0,c=0;c<=a.sa;c++){for(var d=a,e=c,f=Js(d,e),g=d.zb[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*Ls(n)}}}Ks(d,e,f);b+=h}return b}
  As.prototype.normalize=function(){var a=Infinity;this.Ca=-1;for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Ca=Math.max(this.Ca,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ca-=a};
  function Qs(a,b,c){for(var d=Js(a,b),e=a.zb[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=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<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}Ks(a,b,d);return f}
  function Rs(a,b,c){for(var d=Js(a,b),e=a.zb[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=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<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,
  m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}Ks(a,b,d);return f}function Ss(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&&Ss(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&&Ss(a,k,c,d,e,f)}}
  function Ts(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Ts(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Ts(a,b.value.fromVertex,c,d,e,f)}}
  As.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.jl){default:case Us: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!==Vs(a);){for(e=Ws(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Ws(a);for(e=Xs(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Xs(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||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.Rm(b),b.rev=!0);break;case Bs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Cg=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.oh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
  Ys(this,b);for(d.reset();d.next();)b=d.value,-1===b.Cg&&Ys(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.Cg<b.Cg&&c<f&&(this.network.Rm(d),d.rev=!0));break;case Gs:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){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;c<d.length;c++)if(e=d[c],!e||
  0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.Rm(b),b.rev=!0)}}};function Vs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Ws(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
  function Xs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function Ys(a,b){b.Cg=a.oh;a.oh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Cg&&(d.forest=!0,Ys(a,e))}b.finish=a.oh;a.oh++}
  As.prototype.assignLayers=function(){switch(this.Ml){case Zs:$s(this);break;case at:for(var a,b=this.network.vertexes.iterator;b.next();)a=bt(this,b.value),this.sa=Math.max(a,this.sa);for(b.reset();b.next();)a=b.value,a.layer=this.sa-a.layer;break;default:case Cs:$s(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&ct(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.sa=-1;for(b.reset();b.next();){var c=
  b.value;c.layer-=a;this.sa=Math.max(this.sa,c.layer)}}};function $s(a){for(var b=a.network.vertexes.iterator;b.next();){var c=dt(a,b.value);a.sa=Math.max(c,a.sa)}}function dt(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,dt(a,f)+e)}b.layer=c}else c=b.layer;return c}
  function bt(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,bt(a,f)+e)}b.layer=c}else c=b.layer;return c}
  function ct(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)ct(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&Ss(a,h,0,-1,!0,!1)}for(Ss(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;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(Ss(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
  f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(null===h||l>f)&&!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 Is(a,b,c){return 90===a.K?c&&!b.rev||!c&&b.rev?270:90:180===a.K?c&&!b.rev||!c&&b.rev?0:180:270===a.K?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
  As.prototype.initializeIndices=function(){switch(this.Bl){default:case et:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.zb[c];this.zb[c]++}break;case Ds:a=this.network.vertexes.iterator;for(b=this.sa;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&ft(this,c);break;case gt:for(a=this.network.vertexes.iterator,b=0;b<=this.sa;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&ht(this,c)}};
  function ft(a,b){var c=b.layer;b.index=a.zb[c];a.zb[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&ft(a,d))}
  function ht(a,b){var c=b.layer;b.index=a.zb[c];a.zb[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&ht(a,d))}
  As.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Ms(this),c,d;for(c=0;c<this.Rj;c++){for(d=0;d<=this.sa;d++)it(this,d,1),jt(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Ms(this));for(d=this.sa;0<=d;d--)it(this,d,-1),jt(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Ms(this))}Ns(this,b);for(c=0;c<this.Rj;c++){for(d=0;d<=this.sa;d++)it(this,d,0),jt(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Ms(this));for(d=this.sa;0<=d;d--)it(this,d,0),jt(this,d,0);e=this.countCrossings();
  e<a&&(a=e,b=Ms(this))}Ns(this,b);var f,g,h;switch(this.Zk){case kt:break;case lt:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.sa;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=jt(this,d,-1)||f;e=this.countCrossings();e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=jt(this,d,1)||f;e=this.countCrossings();e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=jt(this,d,1)||f;e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
  jt(this,d,-1)||f;e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=jt(this,d,0)||f;e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=jt(this,d,0)||f;e>=a?Ns(this,b):(a=e,b=Ms(this))}break;default:case Es:for(c=this.sa,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=jt(this,d,-1)||f;e=this.countCrossings();e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=jt(this,d,1)||f;e=this.countCrossings();e>=a?Ns(this,b):
  (a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=jt(this,d,1)||f;e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=jt(this,d,-1)||f;e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=jt(this,d,0)||f;e>=a?Ns(this,b):(a=e,b=Ms(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=jt(this,d,0)||f;e>=a?Ns(this,b):(a=e,b=Ms(this))}}Ns(this,b)};
  function it(a,b,c){var d=Js(a,b),e=a.zb[b],f=Rs(a,b,c),g=Qs(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=f,f+=1,f+=a.nodeMinColumnSpace(k,!1);Ks(a,b,d)}
  function jt(a,b,c){var d=Js(a,b),e=a.zb[b];c=Os(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,w=a.nodeMinColumnSpace(d[f],!0),v=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);w=q-w+y;v=u-v+z;var A=d[f].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,
  y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),r+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),r+=4*(y-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(y=A.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),r+=2*(f-y));y===f&&(r+=1);y>f+1&&(p+=4*(y-(f+1)),r+=4*(y-f))}A=d[f+1].destinationEdges.iterator;
  for(A.reset();A.next();)if(y=A.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;A=g[d[f].index];var C=h[d[f].index],F=g[d[f+1].index],Q=h[d[f+1].index];-1!==A&&(z+=Math.abs(A-q),y+=Math.abs(A-v));-1!==C&&(z+=Math.abs(C-q),y+=Math.abs(C-v));-1!==F&&(z+=Math.abs(F-u),y+=Math.abs(F-w));-1!==Q&&(z+=Math.abs(Q-u),y+=Math.abs(Q-w));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&y<z-.5)l=k=!0,d[f].column=v,d[f+1].column=w,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
  f;Ks(a,b,d);return k}
  As.prototype.straightenAndPack=function(){var a=0!==(this.ng&1);var b=0!==(this.ng&mt);1E3<this.network.edges.count&&b&&(a=!1);if(a){var c=[];for(b=0;b<=this.sa;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ca-c[b])>>1)+8*d;this.Ca*=8}if(0!==(this.ng&2))for(c=!0;c;){c=!1;for(b=this.pc+1;b<=this.sa;b++)c=nt(this,b,1)||
  c;for(b=this.pc-1;0<=b;b--)c=nt(this,b,-1)||c;c=nt(this,this.pc,0)||c}if(0!==(this.ng&4)){for(b=this.pc+1;b<=this.sa;b++)ot(this,b,1);for(b=this.pc-1;0<=b;b--)ot(this,b,-1);ot(this,this.pc,0)}a&&(pt(this,-1),pt(this,1));if(0!==(this.ng&2))for(c=!0;c;){c=!1;c=nt(this,this.pc,0)||c;for(b=this.pc+1;b<=this.sa;b++)c=nt(this,b,0)||c;for(b=this.pc-1;0<=b;b--)c=nt(this,b,0)||c}};function nt(a,b,c){for(var d=!1;qt(a,b,c);)d=!0;return d}
  function qt(a,b,c){var d,e=Js(a,b),f=a.zb[b],g=Qs(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Qs(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-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 w=e[d].sourceEdges.iterator;w.next();){var v=w.value;var y=v.fromVertex;
  if(v.valid&&y.layer!==b){var z=Ls(v);var A=v.portFromColOffset;v=v.portToColOffset;y=y.column;p+=(Math.abs(m+v-(y+A))+1)*z;q+=(Math.abs(r+v-(y+A))+1)*z;u+=(Math.abs(n+v-(y+A))+1)*z}}if(0<=c)for(w=e[d].destinationEdges.iterator;w.next();)v=w.value,y=v.toVertex,v.valid&&y.layer!==b&&(z=Ls(v),A=v.portFromColOffset,v=v.portToColOffset,y=y.column,p+=(Math.abs(m+A-(y+v))+1)*z,q+=(Math.abs(r+A-(y+v))+1)*z,u+=(Math.abs(n+A-(y+v))+1)*z);v=A=z=0;w=g[e[d].index];y=h[e[d].index];-1!==w&&(z+=Math.abs(w-m),A+=
  Math.abs(w-r),v+=Math.abs(w-n));-1!==y&&(z+=Math.abs(y-m),A+=Math.abs(y-r),v+=Math.abs(y-n));if(q<p||q===p&&A<z)l=k=!0,e[d].column=r;else if(u<p||u===p&&v<z)l=k=!0,e[d].column=n}Ks(a,b,e);a.normalize();return k}
  function ot(a,b,c){var d=Js(a,b),e=a.zb[b],f=Rs(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+
  1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}Ks(a,b,d);a.normalize()}
  function rt(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 st(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.sa;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.sa;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 pt(a,b){for(var c=0;c<=a.Ca;c++)for(;rt(a,c););a.normalize();for(c=0;c<a.Ca;c++)for(;st(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ca;c++){var e=Ms(a);var f=Ps(a);for(d=f+1;f<d;){d=f;tt(a,c,1);var g=Ps(a);g>f?Ns(a,e):g<f&&(f=g,e=Ms(a))}}if(0>b)for(c=a.Ca;0<=c;c--)for(e=Ms(a),f=Ps(a),d=f+1;f<d;)d=f,tt(a,c,-1),g=Ps(a),g>f?Ns(a,e):g<f&&(f=g,e=Ms(a));a.normalize()}
  function tt(a,b,c){a.Ec=0;for(var d=a.network.vertexes.iterator;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.Ec)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Ec);a.Ec++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Ts(a,b,a.Ec,-1,!0,!0),a.Ec++);var f;b=[];for(f=0;f<a.Ec*a.Ec;f++)b[f]=!1;e=[];for(f=0;f<(a.sa+1)*(a.Ca+1);f++)e[f]=-1;for(d.reset();d.next();){f=
  d.value;for(var g=f.layer,h=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),k=Math.min(a.Ca,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ca+1)+h]=f.component}for(f=0;f<=a.sa;f++){if(0<c)for(g=0;g<a.Ca;g++)-1!==e[f*(a.Ca+1)+g]&&-1!==e[f*(a.Ca+1)+g+1]&&e[f*(a.Ca+1)+g]!==e[f*(a.Ca+1)+g+1]&&(b[e[f*(a.Ca+1)+g]*a.Ec+e[f*(a.Ca+1)+g+1]]=!0);if(0>c)for(g=a.Ca;0<g;g--)-1!==e[f*(a.Ca+1)+g]&&-1!==e[f*(a.Ca+1)+g-1]&&e[f*(a.Ca+1)+g]!==e[f*(a.Ca+1)+g-1]&&(b[e[f*(a.Ca+1)+g]*a.Ec+e[f*(a.Ca+1)+g-1]]=!0)}e=
  [];for(f=0;f<a.Ec;f++)e[f]=!0;g=[];for(g.push(0);0!==g.length;)if(k=g[g.length-1],g.pop(),e[k])for(e[k]=!1,f=0;f<a.Ec;f++)b[k*a.Ec+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
  As.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Hs(this,!0),b=Hs(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.Iv();this.isRouting&&this.commitLinks()};function Hs(a,b){return 270===a.K?b?bd:ed:90===a.K?b?ed:bd:180===a.K?b?cd:dd:b?dd:cd}
  As.prototype.commitNodes=function(){this.$d=[];this.zd=[];this.yd=[];this.Ia=[];for(var a=0;a<=this.sa;a++)this.$d[a]=0,this.zd[a]=0,this.yd[a]=0,this.Ia[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.$d[c]=Math.max(this.$d[c],this.nodeMinLayerSpace(b,!0));this.zd[c]=Math.max(this.zd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ue;for(var d=0;d<=this.sa;d++){var e=c;0>=this.$d[d]+this.zd[d]&&(e=0);0<d&&(b+=e/2);90===this.K||0===this.K?(b+=this.zd[d],this.yd[d]=b,
  b+=this.$d[d]):(b+=this.$d[d],this.yd[d]=b,b+=this.zd[d]);d<this.sa&&(b+=e/2);this.Ia[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.sa;d++)270===this.K?this.yd[d]=b.y+this.yd[d]:90===this.K?(this.yd[d]=b.y+c-this.yd[d],this.Ia[d]=c-this.Ia[d]):180===this.K?this.yd[d]=b.x+this.yd[d]:(this.yd[d]=b.x+c-this.yd[d],this.Ia[d]=c-this.Ia[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.K||90===this.K){var h=b.x+this.Zb*g;f=this.yd[f]}else h=this.yd[f],f=b.y+
  this.Zb*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Vc=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
  As.prototype.Iv=function(){for(var a=0,b=this.ue,c=0;c<=this.sa;c++)a+=this.$d[c],a+=this.zd[c];a+=this.sa*b;b=[];c=this.Zb*this.Ca;for(var d=this.maxLayer;0<=d;d--)270===this.K?0===d?b.push(new N(0,0,c,Math.abs(this.Ia[0]))):b.push(new N(0,this.Ia[d-1],c,Math.abs(this.Ia[d-1]-this.Ia[d]))):90===this.K?0===d?b.push(new N(0,this.Ia[0],c,Math.abs(this.Ia[0]-a))):b.push(new N(0,this.Ia[d],c,Math.abs(this.Ia[d-1]-this.Ia[d]))):180===this.K?0===d?b.push(new N(0,0,Math.abs(this.Ia[0]),c)):b.push(new N(this.Ia[d-
  1],0,Math.abs(this.Ia[d-1]-this.Ia[d]),c)):0===d?b.push(new N(this.Ia[0],0,Math.abs(this.Ia[0]-a),c)):b.push(new N(this.Ia[d],0,Math.abs(this.Ia[d-1]-this.Ia[d]),c));this.commitLayers(b,this.Vc)};As.prototype.commitLayers=function(){};
  As.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Th(),b.pk(),b.xf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.xj();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Th();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}null!==f&&(k=f.findVisibleNode(),null!==k&&k!==f&&(f=k,h=k.port));var l=b.computeSpot(!0,g);k=b.computeSpot(!1,h);var m=
  c.fromVertex,n=c.toVertex;if(c.valid){if(b.curve===dg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.o()||c.set(e.actualBounds.center),g.o()||g.set(f.actualBounds.center),b.pk(),b.vf(c.x,c.y),b.vf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.vf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.vf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===sc&&(p=!0);null!==h&&k===sc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.K||270===this.K?(p=q,n=
  (c+d)/2):(p=(q+m)/2,n=c),b.L(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.L(0,l.x,l.y));r&&(90===this.K||270===this.K?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.L(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.L(3,e.x,e.y))}}b.xf()}else if(m.layer===n.layer)b.xf();else{p=r=!1;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var u=b.pointsCount;4<u&&b.points.removeRange(2,u-3)}else if(b.curve===dg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
  u-3),4===u&&(q=2);else{u=b.pointsCount;var w=l===sc,v=k===sc;2<u&&w&&v?b.points.removeRange(1,u-2):3<u&&w&&!v?b.points.removeRange(1,u-3):3<u&&!w&&v?b.points.removeRange(2,u-2):4<u&&!w&&!v&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var y=u=null;for(w=n.sourceEdges.iterator;w.next()&&(v=w.value,v.link!==c.link||(u=v.fromVertex,y=v.toVertex,null!==u.node)););if(null===u)break;if(u!==m){w=b.i(q-1).x;v=b.i(q-1).y;var z=u.centerX;var A=u.centerY;if(p)180===this.K||0===this.K?q===b.firstPickIndex+
  1?(b.m(q++,w,v),b.m(q++,w,A)):(null!==y?y.centerY:v)!==A&&(y=this.Ia[u.layer-1]+this.Vc.x,b.m(q++,y,v),b.m(q++,y,A)):q===b.firstPickIndex+1?(b.m(q++,w,v),b.m(q++,z,v)):(null!==y?y.centerX:w)!==z&&(y=this.Ia[u.layer-1]+this.Vc.y,b.m(q++,w,y),b.m(q++,z,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.$d[n.layer]);var C=Math.max(10,this.zd[n.layer]);if(r)180===this.K?z<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-y,A),b.m(q++,n,A),b.m(q++,n+C,A)):(b.m(q++,z-y,A),b.m(q++,z,A),b.m(q++,z+C,A)):90===this.K?
  A>=n.bounds.bottom?(n=n.bounds.y+n.bounds.height,b.m(q++,z,n+C),b.m(q++,z,n),b.m(q++,z,n-y)):(b.m(q++,z,A+C),b.m(q++,z,A),b.m(q++,z,A-y)):270===this.K?A<=n.bounds.y?(n=n.bounds.y,b.m(q++,z,n-y),b.m(q++,z,n),b.m(q++,z,n+C)):(b.m(q++,z,A-y),b.m(q++,z,A),b.m(q++,z,A+C)):0===this.K&&(z>=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-y,A)):(b.m(q++,z+C,A),b.m(q++,z,A),b.m(q++,z-y,A)));else{b.m(q++,w,v);var F=0;if(180===this.K||0===this.K){if(180===this.K?z>=n.bounds.right:
  z<=n.bounds.x)F=(0===this.K?-y:C)/2;b.m(q++,w+F,A)}else{if(270===this.K?A>=n.bounds.bottom:A<=n.bounds.y)F=(90===this.K?-y:C)/2;b.m(q++,z,v+F)}b.m(q++,z,A)}}else y=Math.max(10,this.$d[u.layer]),C=Math.max(10,this.zd[u.layer]),180===this.K?(r&&b.m(q++,z-y,A),b.m(q++,z,A),r&&b.m(q++,z+C,A)):90===this.K?(r&&b.m(q++,z,A+C),b.m(q++,z,A),r&&b.m(q++,z,A-y)):270===this.K?(r&&b.m(q++,z,A-y),b.m(q++,z,A),r&&b.m(q++,z,A+C)):(r&&b.m(q++,z+C,A),b.m(q++,z,A),r&&b.m(q++,z-y,A))}n=u}if(null===h||l!==sc||p)if(w=b.i(q-
  1).x,v=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,p)n=this.zd[m.layer],180===this.K||0===this.K?(p=v,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.K?z>=m.bounds.x:z<=m.bounds.right)&&(n=m.centerX+(180===this.K?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.Zb/2:p=m.bounds.bottom+this.Zb/2,b.m(q++,n,v),b.m(q++,n,p)),b.m(q++,z,p)):(p=w,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.K?A>=m.bounds.y:A<=m.bounds.bottom)&&(n=m.centerY+(270===this.K?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.Zb/
  2:p=m.bounds.right+this.Zb/2,b.m(q++,w,n),b.m(q++,p,n)),b.m(q++,p,A)),b.m(q++,z,A);else if(r)y=Math.max(10,this.$d[m.layer]),C=Math.max(10,this.zd[m.layer]),180===this.K&&z>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.L(q-2,n,v),b.L(q-1,n+C,v)):90===this.K&&A<=m.bounds.bottom?(n=m.bounds.y,b.L(q-2,w,n),b.L(q-1,w,n-y)):270===this.K&&A>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.L(q-2,w,n),b.L(q-1,w,n+C)):0===this.K&&z<=m.bounds.right&&(n=m.bounds.x,b.L(q-2,n,v),b.L(q-1,n-y,v));else{y=Math.max(10,this.$d[m.layer]);
  C=Math.max(10,this.zd[m.layer]);p=0;if(180===this.K||0===this.K){if(180===this.K?z<=m.bounds.x:z>=m.bounds.right)p=(0===this.K?C:-y)/2;b.m(q++,z+p,v)}else{if(270===this.K?A<=m.bounds.y:A>=m.bounds.bottom)p=(90===this.K?C:-y)/2;b.m(q++,w,A+p)}b.m(q++,z,A)}}else{for(;null!==m&&m!==n;){y=u=null;for(m=m.destinationEdges.iterator;m.next()&&(w=m.value,w.link!==c.link||(u=w.toVertex,y=w.fromVertex,null!==y.node&&(y=null),null!==u.node)););if(null===u)break;u!==n&&(w=b.i(q-1).x,v=b.i(q-1).y,z=u.centerX,A=
  u.centerY,p?180===this.K||0===this.K?(null!==y?y.centerY:v)!==A&&(y=this.Ia[u.layer]+this.Vc.x,q===b.firstPickIndex+1&&(y=0===this.K?Math.max(y,w):Math.min(y,w)),b.m(q++,y,v),b.m(q++,y,A)):(null!==y?y.centerX:w)!==z&&(y=this.Ia[u.layer]+this.Vc.y,q===b.firstPickIndex+1&&(y=90===this.K?Math.max(y,v):Math.min(y,v)),b.m(q++,w,y),b.m(q++,z,y)):(y=Math.max(10,this.$d[u.layer]),C=Math.max(10,this.zd[u.layer]),180===this.K?(b.m(q++,z+C,A),r&&b.m(q++,z,A),b.m(q++,z-y,A)):90===this.K?(b.m(q++,z,A-y),r&&b.m(q++,
  z,A),b.m(q++,z,A+C)):270===this.K?(b.m(q++,z,A+C),r&&b.m(q++,z,A),b.m(q++,z,A-y)):(b.m(q++,z-y,A),r&&b.m(q++,z,A),b.m(q++,z+C,A))));m=u}p&&(w=b.i(q-1).x,v=b.i(q-1).y,z=b.i(q).x,A=b.i(q).y,180===this.K||0===this.K?v!==A&&(y=0===this.K?Math.min(Math.max((z+w)/2,this.Ia[n.layer]+this.Vc.x),z):Math.max(Math.min((z+w)/2,this.Ia[n.layer]+this.Vc.x),z),b.m(q++,y,v),b.m(q++,y,A)):w!==z&&(y=90===this.K?Math.min(Math.max((A+v)/2,this.Ia[n.layer]+this.Vc.y),A):Math.max(Math.min((A+v)/2,this.Ia[n.layer]+this.Vc.y),
  A),b.m(q++,w,y),b.m(q++,z,y)))}null!==d&&r&&(null!==g&&(l===sc&&(l=b.i(0),d=b.i(2),l.w(d)||b.L(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,sc,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.L(0,l.x,l.y)),null!==h&&(k===sc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.w(l)||b.L(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,sc,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.L(b.pointsCount-1,e.x,e.y)));b.xf();c.commit()}}}this.avoidOrthogonalOverlaps()};
  As.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){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(0<a.count)if(90===this.K||270===this.K){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.A(f.y,g.y)&&!this.A(f.x,g.x)){var h=new ut;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first=
  k.x*k.x+k.y;h.Xb=l.x*l.x+l.y;h.fd=Math.min(f.x,g.x);h.vc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.l=m}c.push(h)}}}if(1<c.length)for(c.sort(this.Ry),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].vc;for(e=a+1;e<d&&c[e].fd<g;)g=Math.max(g,c[e].vc),e++;g=e-f;if(1<g){this.uj(c,this.hu,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==
  h&&(m++,h=l.Xb);this.uj(c,this.Qy,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].Xb,this.uj(c,this.hu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);b++;r.Th();r.L(p.index,f.x,f.y+q);r.L(p.index+1,g.x,g.y+q);r.xf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d=a.value,null!==d&&d.isOrthogonal)for(e=
  2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.A(f.x,g.x)&&!this.A(f.y,g.y)&&(h=new ut,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.Xb=l.x+l.y*l.y,h.fd=Math.min(f.y,g.y),h.vc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.l=m),c.push(h));if(1<c.length)for(c.sort(this.Ry),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=
  a;f<d;){g=c[f].vc;for(e=a+1;e<d&&c[e].fd<g;)g=Math.max(g,c[e].vc),e++;g=e-f;if(1<g){this.uj(c,this.hu,f,f+g);m=1;h=c[f].Xb;for(k=f;k<e;k++)l=c[k],l.Xb!==h&&(m++,h=l.Xb);this.uj(c,this.Qy,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].Xb,this.uj(c,this.hu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)p=c[n],(k?p.first:p.Xb)!==h&&(m++,h=k?p.first:p.Xb),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*(m-(l-1)/2),b++,r.Th(),r.L(p.index,
  f.x+q,f.y),r.L(p.index+1,g.x+q,g.y),r.xf()}f=e}a=d}}}};t=As.prototype;t.Ry=function(a,b){return a instanceof ut&&b instanceof ut&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.fd<b.fd?-1:a.fd>b.fd?1:a.vc<b.vc?-1:a.vc>b.vc?1:0:0};t.Qy=function(a,b){return a instanceof ut&&b instanceof ut&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.fd<b.fd?-1:a.fd>b.fd?1:a.vc<b.vc?-1:a.vc>b.vc?1:0:0};
  t.hu=function(a,b){return a instanceof ut&&b instanceof ut&&a!==b?a.Xb<b.Xb?-1:a.Xb>b.Xb||a.l<b.l?1:a.l>b.l||a.fd<b.fd?-1:a.fd>b.fd?1:a.vc<b.vc?-1:a.vc>b.vc?1:0:0};t.A=function(a,b){a-=b;return-1<a&&1>a};
  t.uj=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<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
  function Js(a,b){var c=a.zb[b];if(c>=a.xe.length){var d=[];for(var e=0;e<a.xe.length;e++)d[e]=a.xe[e];a.xe=d}void 0===a.xe[c]||null===a.xe[c]?d=[]:(d=a.xe[c],a.xe[c]=null);a=a.gp[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Ks(a,b,c){a.xe[a.zb[b]]=c}
  na.Object.defineProperties(As.prototype,{layerSpacing:{get:function(){return this.ue},set:function(a){this.ue!==a&&0<=a&&(this.ue=a,this.C())}},columnSpacing:{get:function(){return this.Zb},set:function(a){this.Zb!==a&&0<a&&(this.Zb=a,this.C())}},direction:{get:function(){return this.K},set:function(a){this.K!==a&&(0===a||90===a||180===a||270===a?(this.K=a,this.C()):B("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
  cycleRemoveOption:{get:function(){return this.jl},set:function(a){this.jl===a||a!==Us&&a!==Bs&&a!==Gs||(this.jl=a,this.C())}},layeringOption:{get:function(){return this.Ml},set:function(a){this.Ml===a||a!==Cs&&a!==Zs&&a!==at||(this.Ml=a,this.C())}},initializeOption:{get:function(){return this.Bl},set:function(a){this.Bl===a||a!==Ds&&a!==gt&&a!==et||(this.Bl=a,this.C())}},iterations:{
  get:function(){return this.Rj},set:function(a){this.Rj!==a&&0<=a&&(this.Rj=a,this.C())}},aggressiveOption:{get:function(){return this.Zk},set:function(a){this.Zk===a||a!==kt&&a!==Es&&a!==lt||(this.Zk=a,this.C())}},packOption:{get:function(){return this.ng},set:function(a){this.ng!==a&&0<=a&&8>a&&(this.ng=a,this.C())}},setsPortSpots:{get:function(){return this.kf},set:function(a){this.kf!==a&&(this.kf=a,this.C())}},
  linkSpacing:{get:function(){return this.Mo},set:function(a){this.Mo!==a&&0<=a&&(this.Mo=a,this.C())}},maxLayer:{get:function(){return this.sa}},maxIndex:{get:function(){return this.Ji}},maxColumn:{get:function(){return this.Ca}},minIndexLayer:{get:function(){return this.mh}},maxIndexLayer:{get:function(){return this.pc}}});
  var Bs=new D(As,"CycleDepthFirst",0),Us=new D(As,"CycleGreedy",1),Gs=new D(As,"CycleFromLayers",2),Cs=new D(As,"LayerOptimalLinkLength",0),Zs=new D(As,"LayerLongestPathSink",1),at=new D(As,"LayerLongestPathSource",2),Ds=new D(As,"InitDepthFirstOut",0),gt=new D(As,"InitDepthFirstIn",1),et=new D(As,"InitNaive",2),kt=new D(As,"AggressiveNone",0),Es=new D(As,"AggressiveLess",1),lt=new D(As,"AggressiveMore",2),mt=8;As.className="LayeredDigraphLayout";As.CycleDepthFirst=Bs;As.CycleGreedy=Us;
  As.CycleFromLayers=Gs;As.LayerOptimalLinkLength=Cs;As.LayerLongestPathSink=Zs;As.LayerLongestPathSource=at;As.InitDepthFirstOut=Ds;As.InitDepthFirstIn=gt;As.InitNaive=et;As.AggressiveNone=kt;As.AggressiveLess=Es;As.AggressiveMore=lt;As.PackNone=0;As.PackExpand=1;As.PackStraighten=2;As.PackMedian=4;As.PackAll=15;function ut(){this.index=this.vc=this.fd=this.Xb=this.first=this.layer=0;this.link=null;this.l=0}ut.className="SegInfo";function Fs(a){aq.call(this,a)}ma(Fs,aq);Fs.prototype.createVertex=function(){return new vt(this)};
  Fs.prototype.createEdge=function(){return new wt(this)};Fs.className="LayeredDigraphNetwork";function vt(a){oq.call(this,a);this.Ra=this.Rg=this.Fi=-1;this.I=NaN;this.T=null;this.valid=!1;this.finish=this.Cg=NaN;this.wf=0;this.Mk=this.Nk=null}ma(vt,oq);
  vt.prototype.serializeVertexProperties=function(a,b){oq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?kb(this.near):null;a.valid=this.valid;a.Cg=this.Cg;a.finish=this.finish;a.wf=this.wf;a.Nk=this.Nk;a.Mk=this.Mk};
  vt.prototype.Cq=function(a,b,c,d){oq.prototype.Cq.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.Cg=a.Cg;this.finish=a.finish;this.wf=a.wf;this.Nk=a.Nk;this.Mk=a.Mk};
  na.Object.defineProperties(vt.prototype,{layer:{get:function(){return this.Fi},set:function(a){this.Fi!==a&&(this.Fi=a)}},column:{get:function(){return this.Rg},set:function(a){this.Rg!==a&&(this.Rg=a)}},index:{get:function(){return this.Ra},set:function(a){this.Ra!==a&&(this.Ra=a)}},component:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},near:{
  get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}}});vt.className="LayeredDigraphVertex";function wt(a){pq.call(this,a);this.l=this.La=this.eb=!1;this.Ka=this.I=NaN;this.T=this.u=0}ma(wt,pq);
  wt.prototype.serializeEdgeProperties=function(a,b){pq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset};
  wt.prototype.deserializeEdgeProperties=function(a,b,c,d){pq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset};
  na.Object.defineProperties(wt.prototype,{fromVertex:{get:function(){return this.Yc},set:function(a){this.Yc!==a&&(this.Yc=a)}},toVertex:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a)}},valid:{get:function(){return this.eb},set:function(a){this.eb!==a&&(this.eb=a)}},rev:{get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},forest:{
  get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.I},set:function(a){this.I!==a&&(this.I=a)}},portToPos:{get:function(){return this.Ka},set:function(a){this.Ka!==a&&(this.Ka=a)}},portFromColOffset:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},portToColOffset:{get:function(){return this.T},
  set:function(a){this.T!==a&&(this.T=a)}}});wt.className="LayeredDigraphEdge";function xt(){Bi.call(this);this.Jb=new G;this.vp=yt;this.kd=zt;this.oq=At;this.ts=Bt;this.nx=[];this.jd=!0;this.Eb=Ct;this.Pd=(new M(10,10)).freeze();var a=new Dt(this);this.U=new Et(a);this.V=new Et(a);this.uv=[]}ma(xt,Bi);
  xt.prototype.cloneProtected=function(a){Bi.prototype.cloneProtected.call(this,a);a.vp=this.vp;a.oq=this.oq;a.ts=this.ts;a.jd=this.jd;a.Eb=this.Eb;a.Pd.assign(this.Pd);a.U.copyInheritedPropertiesFrom(this.U);a.V.copyInheritedPropertiesFrom(this.V)};
  xt.prototype.jb=function(a){a.classType===xt?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):Bi.prototype.jb.call(this,a)};xt.prototype.createNetwork=function(){return new Dt(this)};
  xt.prototype.makeNetwork=function(a){function b(a){if(a instanceof W)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof S){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 R?(c.Ag(a.nodes,!0,b),c.Ag(a.links,!0,b)):a instanceof U?c.Ag(a.memberParts,!1,b):c.Ag(a.iterator,!1,b);return c};
  xt.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Ft&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof R&&(b=a);this.path===yt&&null!==b?this.kd=b.isTreePathToChildren?zt:Gt:this.kd=this.path===yt?zt:this.path;if(0<this.network.vertexes.count){this.network.Bq();for(a=this.network.vertexes.iterator;a.next();)b=a.value,b.initialized=!1,b.level=0,b.parent=null,b.children=[];if(0<this.Jb.count){a=
  new G;for(b=this.Jb.iterator;b.next();){var c=b.value;c instanceof W?(c=this.network.kj(c),null!==c&&a.add(c)):c instanceof Et&&a.add(c)}this.Jb=a}0===this.Jb.count&&this.findRoots();for(a=this.Jb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Ht(this,b));b=this.network.vertexes;for(a=null;a=It(b),0<a.count;)b=Jt(this,a),null!==b&&this.Jb.add(b),b.initialized=!0,Ht(this,b),b=a;for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof Et&&Kt(this,b);for(a=this.Jb.iterator;a.next();)b=
  a.value,b instanceof Et&&Lt(this,b);for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof Et&&Mt(this,b);this.Fv();if(this.layerStyle===Nt){a=[];for(b=this.network.vertexes.iterator;b.next();){c=b.value;var d=c.parent;null===d&&(d=c);d=0===d.angle||180===d.angle;var e=a[c.level];void 0===e&&(e=0);a[c.level]=Math.max(e,d?c.width:c.height)}for(b=0;b<a.length;b++)void 0===a[b]&&(a[b]=0);this.nx=a;for(b=this.network.vertexes.iterator;b.next();)c=b.value,d=c.parent,null===d&&(d=c),0===d.angle||180===
  d.angle?(180===d.angle&&(c.focusX+=a[c.level]-c.width),c.width=a[c.level]):(270===d.angle&&(c.focusY+=a[c.level]-c.height),c.height=a[c.level])}else if(this.layerStyle===Ot)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=
  d)}for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof Et&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Jb=new G;this.isValidLayout=!0};function It(a){var b=new G;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
  xt.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.kd){case zt:0===c.sourceEdges.count&&this.Jb.add(c);break;case Gt:0===c.destinationEdges.count&&this.Jb.add(c);break;default:B("Unhandled path value "+this.kd.toString())}}0===this.Jb.count&&(a=Jt(this,a),null!==a&&this.Jb.add(a))};
  function Jt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.kd){case zt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Gt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:B("Unhandled path value "+a.kd.toString())}}return d}
  function Ht(a,b){if(null!==b){switch(a.kd){case zt:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;Pt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ma())}break;case Gt:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,Pt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ma())}break;default:B("Unhandled path value"+a.kd.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+1;f.parent=b;a.Jb.remove(f)}for(b=
  0;b<d;b++)Ht(a,c[b])}}function Pt(a,b,c){if(c.initialized){if(null===b)var d=!1;else{for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}xt.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
  function Kt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Qt&&a.sortTreeVertexChildren(b);for(var c=0,d=b.childrenCount,e=0,f=b.children,g=f.length,h=0;h<g;h++){var k=f[h];Kt(a,k);c+=k.descendantCount+1;d=Math.max(d,k.maxChildrenCount);e=Math.max(e,k.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
  function Rt(a,b){switch(a.oq){default:case At:return null!==b.parent?b.parent:a.U;case St:return null===b.parent?a.U:null===b.parent.parent?a.V:b.parent;case Tt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.V:a.U;case Ut:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.V:null!==b.parent?b.parent:a.U}}
  xt.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Rt(this,a));if(null!==a.parent&&a.parent.alignment===Qt){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};function Lt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Lt(a,b[d])}}xt.prototype.assignTreeVertexValues=function(){};
  function Mt(a,b){if(null!==b){b.alignment!==Qt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Mt(a,b[d])}}xt.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Vt:break;case Wt:a.children.reverse();break;case Xt:a.children.sort(a.comparer);break;case Yt:a.children.sort(a.comparer);a.children.reverse();break;default:B("Unhandled sorting value "+a.sorting.toString())}};xt.prototype.Fv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
  xt.prototype.addComments=function(a){var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Zt(e));b=90===b||270===b;d=90===d||270===d;c=0===a.childrenCount;var f=0,g=0,h=0,k=a.commentSpacing;if(null!==a.node)for(var l=a.node.Sv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ta(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
  m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=N.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,N.free(e))};function Zt(a){return a===$t||a===Qt||a===au||a===bu}function cu(a){return a===$t||a===Qt}
  function du(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Zt(c)){if(cu(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===au)return!0}}return!1}
  xt.prototype.layoutComments=function(a){if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=Zt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=du(a),k=0,l=a.comments,m=l.length,n=J.alloc(),p=0;p<m;p++){var r=l[p],q=r.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Hd();r.next();){var u=r.value;u.fromSpot=
  cd;u.toSpot=dd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=dd,u.toSpot=cd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=dd,u.toSpot=cd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=dd;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing-q.height)}else{if(135<
  e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=ed;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=bd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=bd;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
  r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=bd,u.toSpot=ed;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}J.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.kd===zt)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
  xt.prototype.layoutTree=function(a){if(null!==a){for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case ju:ku(this,a);break;case lu:if(a.alignment===Qt)ku(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Zt(c)),d=du(a),a.S.h(0,0),a.wa.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.fa.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.fa.h(a.width-2*a.focus.x,0):a.fa.h(0,a.height-2*a.focus.y),
  a.Pq=null,a.br=null;else{var e=mu(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.wa.width:d.wa.height);var k=a.alignment,l=k===nu,m=Zt(k),n=Math.max(0,a.breadthLimit);c=ou(a);var p=a.nodeSpacing,r=pu(a),q=a.rowSpacing,u=0;if(k===qu||l||a.Sm||a.Tm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var w=a.height,v=0,y=0,z=0,A=null,C=null,F=0,Q=0,K=0,T=0,P=0,I=0,ja=0,ba=0;m&&!cu(k)&&135<e&&g.reverse();if(cu(k))if(1<h)for(var qa=0;qa<h;qa++)0===
  qa%2&&qa!==h-1&&(ba=Math.max(ba,b?g[qa].wa.width:g[qa].wa.height));else 1===h&&(ba=b?g[0].wa.width:g[0].wa.height);if(m){switch(k){case $t:y=135>e?ru(a,g,ba,v,y):su(a,g,ba,v,y);ba=y.x;v=y.width;y=y.height;break;case au:for(A=0;A<h;A++)C=g[A],n=C.wa,z=0===I?0:q,b?(C.S.h(f-n.width,T+z),v=Math.max(v,n.width),y=Math.max(y,T+z+n.height),T+=z+n.height):(C.S.h(K+z,f-n.height),v=Math.max(v,K+z+n.width),y=Math.max(y,n.height),K+=z+n.width),I++;break;case bu:for(A=0;A<h;A++)C=g[A],f=C.wa,n=0===I?0:q,b?(C.S.h(p/
  2+a.focus.x,T+n),v=Math.max(v,f.width),y=Math.max(y,T+n+f.height),T+=n+f.height):(C.S.h(K+n,p/2+a.focus.y),v=Math.max(v,K+n+f.width),y=Math.max(y,f.height),K+=n+f.width),I++}A=tu(this,2);C=tu(this,2);b?(A[0].h(0,0),A[1].h(0,y),C[0].h(v,0)):(A[0].h(0,0),A[1].h(v,0),C[0].h(0,y));C[1].h(v,y)}else for(qa=0;qa<h;qa++){var Ma=g[qa],eb=Ma.wa;if(b){0<n&&0<I&&K+p+eb.width>n&&(K<f&&uu(a,k,f-K,0,ja,qa-1),P++,I=0,ja=qa,z=y,K=0,T=135<e?-y-q:y+q);vu(this,Ma,0,T);var Ga=0;if(0===I){if(A=Ma.Pq,C=Ma.br,F=eb.width,
  Q=eb.height,null===A||null===C||e!==mu(Ma))A=tu(this,2),C=tu(this,2),A[0].h(0,0),A[1].h(0,Q),C[0].h(F,0),C[1].h(F,Q)}else{var Ha=Ea();Q=wu(this,a,Ma,A,C,F,Q,Ha);Ga=Q.x;A=Ha[0];C=Ha[1];F=Q.width;Q=Q.height;Ia(Ha);K<eb.width&&0>Ga&&(xu(a,-Ga,0,ja,qa-1),yu(A,-Ga,0),yu(C,-Ga,0),Ga=0)}Ma.S.h(Ga,T);v=Math.max(v,F);y=Math.max(y,z+(0===P?0:q)+eb.height);K=F}else{0<n&&0<I&&T+p+eb.height>n&&(T<f&&uu(a,k,0,f-T,ja,qa-1),P++,I=0,ja=qa,z=v,T=0,K=135<e?-v-q:v+q);vu(this,Ma,K,0);Ga=0;if(0===I){if(A=Ma.Pq,C=Ma.br,
  F=eb.width,Q=eb.height,null===A||null===C||e!==mu(Ma))A=tu(this,2),C=tu(this,2),A[0].h(0,0),A[1].h(F,0),C[0].h(0,Q),C[1].h(F,Q)}else Ha=Ea(),Q=wu(this,a,Ma,A,C,F,Q,Ha),Ga=Q.x,A=Ha[0],C=Ha[1],F=Q.width,Q=Q.height,Ia(Ha),T<eb.height&&0>Ga&&(xu(a,0,-Ga,ja,qa-1),yu(A,0,-Ga),yu(C,0,-Ga),Ga=0);Ma.S.h(K,Ga);y=Math.max(y,Q);v=Math.max(v,z+(0===P?0:q)+eb.width);T=Q}I++}0<P&&(b?(y+=Math.max(0,c),K<v&&uu(a,k,v-K,0,ja,h-1),0<u&&(l||xu(a,u,0,0,h-1),v+=u)):(v+=Math.max(0,c),T<y&&uu(a,k,0,y-T,ja,h-1),0<u&&(l||xu(a,
  0,u,0,h-1),y+=u)));u=l=0;switch(k){case zu:b?l+=v/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2;break;case Au:0<P?b?l+=v/2-a.focus.x-r/2:u+=y/2-a.focus.y-r/2:b?(ba=g[0].S.x+g[0].fa.x,l+=ba+(g[h-1].S.x+g[h-1].fa.x+2*g[h-1].focus.x-ba)/2-a.focus.x-r/2):(ba=g[0].S.y+g[0].fa.y,u+=ba+(g[h-1].S.y+g[h-1].fa.y+2*g[h-1].focus.y-ba)/2-a.focus.y-r/2);break;case qu:b?(l-=r,v+=r):(u-=r,y+=r);break;case nu:b?(l+=v-a.width+r,v+=r):(u+=y-a.height+r,y+=r);break;case $t:b?1<h?l+=ba+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].fa.x:
  1<h?u+=ba+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].fa.y;break;case au:b?l+=v+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case bu:break;default:B("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)ba=g[r],b?ba.S.h(ba.S.x+ba.fa.x-l,ba.S.y+(135<e?(m?-y:-ba.wa.height)+ba.fa.y-c:w+c+ba.fa.y)):ba.S.h(ba.S.x+(135<e?(m?-v:-ba.wa.width)+ba.fa.x-c:d+c+ba.fa.x),ba.S.y+ba.fa.y-u);h=g=0;m?b?(v=Bu(a,v,l),0>l&&(l=0),135<e&&(u+=y+c),y+=w+c,k===bu&&(g+=p/2+a.focus.x),h+=w+c):(135<e&&(l+=v+c),v+=d+c,y=Cu(a,
  y,u),0>u&&(u=0),k===bu&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>v&&(v=Du(k,d-v,0),g=v.x,h=v.y,v=d,l=0):v=Bu(a,v,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,w),y+w+c),h+=w+c):(135<e&&(l+=v+c),v=Math.max(Math.max(v,d),v+d+c),null===a.comments?w>y&&(y=Du(k,0,w-y),g=y.x,h=y.y,y=w,u=0):y=Cu(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<P)e=tu(this,4),P=tu(this,4),b?(e[2].h(0,w+c),e[3].h(e[2].x,y),P[2].h(v,e[2].y),P[3].h(P[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(v,e[2].y),P[2].h(e[2].x,y),P[3].h(e[3].x,
  P[2].y));else{e=tu(this,A.length+2);P=tu(this,C.length+2);for(k=0;k<A.length;k++)m=A[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<C.length;k++)m=C[k],P[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,w),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),P[0].h(l+d,0),P[1].h(P[0].x,w),P[2].y<P[1].y&&(P[2].x<P[0].x?P[2].assign(P[1]):P[1].assign(P[2])),P[3].y<P[2].y&&(P[3].x<P[0].x?P[3].assign(P[2]):P[2].assign(P[3])),e[2].y-=
  c/2,P[2].y-=c/2):(e[0].h(0,u),e[1].h(d,e[0].y),e[2].x<e[1].x&&(e[2].y>e[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].x<e[2].x&&(e[3].y>e[0].y?e[3].assign(e[2]):e[2].assign(e[3])),P[0].h(0,u+w),P[1].h(d,P[0].y),P[2].x<P[1].x&&(P[2].y<P[0].y?P[2].assign(P[1]):P[1].assign(P[2])),P[3].x<P[2].x&&(P[3].y<P[0].y?P[3].assign(P[2]):P[2].assign(P[3])),e[2].x-=c/2,P[2].x-=c/2);Eu(this,A);Eu(this,C);a.Pq=e;a.br=P;a.fa.h(l,u);a.wa.h(v,y)}break;default:B("Unhandled compaction value "+a.compaction.toString())}}};
  function ku(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Zt(c));var e=du(b);b.S.h(0,0);b.wa.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.fa.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.fa.h(b.width-2*b.focus.x,0):b.fa.h(0,b.height-2*b.focus.y)}else{d=mu(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.wa.width:k.wa.height)}var l=b.alignment,m=l===qu,n=l===
  nu;h=Zt(l);var p=Math.max(0,b.breadthLimit);k=ou(b);var r=b.nodeSpacing,q=pu(b),u=m||n?0:q/2,w=b.rowSpacing,v=0;if(m||n||b.Sm||b.Tm&&1===b.maxGenerationCount)v=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,A=0,C=0,F=0,Q=0,K=0,T=0,P=0,I=0;h&&!cu(l)&&135<d&&e.reverse();if(cu(l))if(1<g)for(var ja=0;ja<g;ja++){var ba=e[ja],qa=ba.wa;0===ja%2&&ja!==g-1&&(I=Math.max(I,(c?qa.width:qa.height)+Fu(ba)-r))}else 1===g&&(I=c?e[0].wa.width:e[0].wa.height);if(h)switch(l){case $t:case Qt:A=135>d?ru(b,e,I,z,
  A):su(b,e,I,z,A);I=A.x;z=A.width;A=A.height;break;case au:for(a=0;a<g;a++)p=e[a],u=p.wa,C=0===T?0:w,c?(p.S.h(f-u.width,Q+C),z=Math.max(z,u.width),A=Math.max(A,Q+C+u.height),Q+=C+u.height):(p.S.h(F+C,f-u.height),z=Math.max(z,F+C+u.width),A=Math.max(A,u.height),F+=C+u.width),T++;break;case bu:for(f=0;f<g;f++)a=e[f],p=a.wa,u=0===T?0:w,c?(a.S.h(r/2+b.focus.x,Q+u),z=Math.max(z,p.width),A=Math.max(A,Q+u+p.height),Q+=u+p.height):(a.S.h(F+u,r/2+b.focus.y),z=Math.max(z,F+u+p.width),A=Math.max(A,p.height),
  F+=u+p.width),T++}else for(ja=0;ja<g;ja++){ba=e[ja];qa=ba.wa;if(c){0<p&&0<T&&F+r+qa.width>p&&(F<f&&uu(b,l,f-F,0,P,ja-1),K++,T=0,P=ja,C=A,F=0,Q=135<d?-A-w:A+w);var Ma=0===T?u:r;vu(a,ba,0,Q);ba.S.h(F+Ma,Q);z=Math.max(z,F+Ma+qa.width);A=Math.max(A,C+(0===K?0:w)+qa.height);F+=Ma+qa.width}else 0<p&&0<T&&Q+r+qa.height>p&&(Q<f&&uu(b,l,0,f-Q,P,ja-1),K++,T=0,P=ja,C=z,Q=0,F=135<d?-z-w:z+w),Ma=0===T?u:r,vu(a,ba,F,0),ba.S.h(F,Q+Ma),A=Math.max(A,Q+Ma+qa.height),z=Math.max(z,C+(0===K?0:w)+qa.width),Q+=Ma+qa.height;
  T++}0<K&&(c?(A+=Math.max(0,k),F<z&&uu(b,l,z-F,0,P,g-1),0<v&&(n||xu(b,v,0,0,g-1),z+=v)):(z+=Math.max(0,k),Q<A&&uu(b,l,0,A-Q,P,g-1),0<v&&(n||xu(b,0,v,0,g-1),A+=v)));v=n=0;switch(l){case zu:c?n+=z/2-b.focus.x-q/2:v+=A/2-b.focus.y-q/2;break;case Au:0<K?c?n+=z/2-b.focus.x-q/2:v+=A/2-b.focus.y-q/2:c?(l=e[0].S.x+e[0].fa.x,n+=l+(e[g-1].S.x+e[g-1].fa.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].S.y+e[0].fa.y,v+=l+(e[g-1].S.y+e[g-1].fa.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case qu:c?(n-=q,z+=q):(v-=
  q,A+=q);break;case nu:c?(n+=z-b.width+q,z+=q):(v+=A-b.height+q,A+=q);break;case $t:case Qt:c?1<g?n+=I+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].fa.x:1<g?v+=I+r/2-b.focus.y:v+=e[0].focus.y-b.focus.y+e[0].fa.y;break;case au:c?n+=z+r/2-b.focus.x:v+=A+r/2-b.focus.y;break;case bu:break;default:B("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.S.h(l.S.x+l.fa.x-n,l.S.y+(135<d?(h?-A:-l.wa.height)+l.fa.y-k:y+k+l.fa.y)):l.S.h(l.S.x+(135<d?(h?-z:-l.wa.width)+l.fa.x-k:m+k+l.fa.x),l.S.y+
  l.fa.y-v);c?(z=Bu(b,z,n),0>n&&(n=0),135<d&&(v+=A+k),A=Math.max(Math.max(A,y),A+y+k)):(135<d&&(n+=z+k),z=Math.max(Math.max(z,m),z+m+k),A=Cu(b,A,v),0>v&&(v=0));b.fa.h(n,v);b.wa.h(z,A)}}
  function ru(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.wa.width,e=a.wa.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===mu(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.wa,u=0===l?0:h;if(k){var w=Fu(r)-g;r.S.h(c-(q.width+w),n+u);d=Math.max(d,q.width+w);e=Math.max(e,n+u+q.height);n+=u+q.height}else w=Fu(r)-g,r.S.h(m+u,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,m+u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?
  (m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.wa;var v=0===l?0:h;if(k){var y=Fu(u)-g;u.S.h(m+y,n+v);d=Math.max(d,m+w.width+y);e=Math.max(e,n+v+w.height);n+=v+w.height}else y=Fu(u)-g,u.S.h(m+v,n+y),d=Math.max(d,m+v+w.width),e=Math.max(e,n+w.height+y),m+=v+w.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.wa,h=null===b.parent?0:b.parent.rowSpacing,k?(b.S.h(c+g/2-b.focus.x-b.fa.x,e+h),k=c+g/2-b.focus.x-b.fa.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.S.x&&
  (c=Gu(a,b.S.x,!1,c,g))):(b.S.h(d+h,c+g/2-b.focus.y-b.fa.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.fa.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.S.y&&(c=Gu(a,b.S.y,!0,c,g))));return new N(c,0,d,e)}
  function su(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.wa.width,e=b.wa.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===mu(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.wa,u=0===l?0:h;if(k){var w=Fu(r)-g;n-=u+q.height;r.S.h(c-(q.width+w),n);d=Math.max(d,q.width+w);e=Math.max(e,Math.abs(n))}else w=Fu(r)-g,m-=u+q.width,r.S.h(m,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,Math.abs(m));l++}l=0;r=m;p=n;k?(m=
  c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.wa;var v=0===l?0:h;if(k){var y=Fu(u)-g;n-=v+w.height;u.S.h(m+y,n);d=Math.max(d,m+w.width+y);e=Math.max(e,Math.abs(n))}else y=Fu(u)-g,m-=v+w.width,u.S.h(m,n+y),e=Math.max(e,n+w.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.wa,q=null===h.parent?0:h.parent.rowSpacing,k?(h.S.h(c+g/2-h.focus.x-h.fa.x,-e-l.height-q),m=c+g/2-h.focus.x-h.fa.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
  0>h.S.x&&(c=Gu(a,h.S.x,!1,c,g))):(h.S.h(-d-l.width-q,c+g/2-h.focus.y-h.fa.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.fa.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.S.y&&(c=Gu(a,h.S.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.S.h(g.S.x,g.S.y+e):g.S.h(g.S.x+d,g.S.y);return new N(c,0,d,e)}function Fu(a){return null===a.parent?0:a.parent.nodeSpacing}
  function Gu(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].S.h(a[g].S.x,a[g].S.y-b):a[g].S.h(a[g].S.x-b,a[g].S.y);b=a[f-1];return Math.max(d,c?b.fa.y+b.focus.y-e/2:b.fa.x+b.focus.x-e/2)}
  function Bu(a,b,c){switch(a.alignment){case Au:case zu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case qu:return a.width>b?a.width:b;case nu:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case $t:case Qt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case au:return a.width-a.focus.x+a.nodeSpacing/2+b;case bu:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
  function Cu(a,b,c){switch(a.alignment){case Au:case zu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case qu:return a.height>b?a.height:b;case nu:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case $t:case Qt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case au:return a.height-a.focus.y+a.nodeSpacing/2+b;case bu:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
  function Du(a,b,c){switch(a){case zu:b/=2;c/=2;break;case Au:b/=2;c/=2;break;case qu:c=b=0;break;case nu:break;default:B("Unhandled alignment value "+a.toString())}return new J(b,c)}function uu(a,b,c,d,e,f){b=Du(b,c,d);xu(a,b.x,b.y,e,f)}function xu(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].S;f.x+=b;f.y+=c}}
  function vu(a,b,c,d){var e=b.parent;switch(a.kd){case zt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Gt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:B("Unhandled path value "+a.kd.toString())}}function yu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
  function wu(a,b,c,d,e,f,g,h){var k=mu(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Pq,q=c.br;g=c.wa;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==mu(c))r=tu(a,2),q=tu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;){f=n[c];var w=r[e];k=w.x;l=w.y;k+=d;var v=
  f;c+1<n.length&&(v=n[c+1]);var y=w;w=y.x;y=y.y;e+1<r.length&&(y=r[e+1],w=y.x,y=y.y,w+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(w-k)-f.x:l>f.y&&l<v.y&&(z=k-(f.x+(l-f.y)/(v.y-f.y)*(v.x-f.x)));z<p&&(p=z);v.y<=f.y?c++:y<=l?e++:(v.y<=y&&c++,y<=v.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=tu(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].y<b[0].y;)l=c[f++],m[d++].h(l.x+e,l.y);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].y;f<
  c.length&&c[f].y<=k;)f++;for(;f<c.length&&c[f].y>k;)l=c[f++],m[d++].h(l.x+e,l.y);c=tu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Eu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=tu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)v=n[c++],m[e++].h(v.x,v.y);for(;l<f.length;)v=f[l++],m[e++].h(v.x+k,v.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=tu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Eu(a,m);e=f}f=
  Math.max(0,p)+g.width;g=u;Eu(a,b);Eu(a,r);Eu(a,n);Eu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],w=r[e],k=w.x,l=w.y,l+=p,v=f,c+1<n.length&&(v=n[c+1]),y=w,w=y.x,y=y.y,e+1<r.length&&(y=r[e+1],w=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<w?z=l+(f.x-k)/(w-k)*(y-l)-f.y:k>f.x&&k<v.x&&(z=l-(f.y+(k-f.x)/(v.x-f.x)*(v.y-f.y))),z<d&&(d=z),v.x<=f.x?c++:w<=k?e++:(v.x<=w&&c++,w<=v.x&&e++);p-=d;p+=m;c=r;e=p;if(null===
  b||2>b.length||null===c||2>c.length)d=null;else{m=tu(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].x<b[0].x;)l=c[f++],m[d++].h(l.x,l.y+e);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].x;f<c.length&&c[f].x<=k;)f++;for(;f<c.length&&c[f].x>k;)l=c[f++],m[d++].h(l.x,l.y+e);c=tu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Eu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=tu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)v=n[c++],m[e++].h(v.x,v.y);
  for(;l<f.length;)v=f[l++],m[e++].h(v.x,v.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=tu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Eu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;Eu(a,b);Eu(a,r);Eu(a,n);Eu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function tu(a,b){a=a.uv[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new J;return a}
  function Eu(a,b){var c=b.length,d=a.uv[c];void 0===d&&(d=[],a.uv[c]=d);d.push(b)}
  xt.prototype.arrangeTrees=function(){if(this.Eb===Ft)for(var a=this.Jb.iterator;a.next();){var b=a.value;if(b instanceof Et){var c=b.node;if(null!==c){var d=c.position;c=d.x;d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);Hu(this,b,c,d)}}}else{a=[];for(b=this.Jb.iterator;b.next();)c=b.value,c instanceof Et&&a.push(c);switch(this.sorting){case Vt:break;case Wt:a.reverse();break;case Xt:a.sort(this.comparer);break;case Yt:a.sort(this.comparer);a.reverse();break;default:B("Unhandled sorting value "+this.sorting.toString())}c=
  this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];Hu(this,e,b+e.fa.x,c+e.fa.y);switch(this.Eb){case Ct:c+=e.wa.height+this.Pd.height;break;case Iu:b+=e.wa.width+this.Pd.width;break;default:B("Unhandled arrangement value "+this.Eb.toString())}}}};function Hu(a,b,c,d){if(null!==b){b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];Hu(a,g,c+g.S.x,d+g.S.y)}}}xt.prototype.commitLayout=function(){this.Dw();this.commitNodes();this.Iv();this.isRouting&&this.commitLinks()};
  xt.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
  xt.prototype.Iv=function(){if(this.layerStyle===Nt){for(var a=this.nx,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Rc(e.bounds);var f=b[e.level];void 0===f?f=ou(e):f=Math.max(f,ou(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Jc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Jc(this.layerSpacing,this.nodeSpacing/2),d=new J(-this.layerSpacing/2,-this.nodeSpacing/
  2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new N(0,f,c,h))):90===this.angle?(e.push(new N(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new N(f,0,h,c))):(e.push(new N(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};xt.prototype.commitLayers=function(){};xt.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
  xt.prototype.Dw=function(){for(var a=this.Jb.iterator;a.next();){var b=a.value;b instanceof Et&&Ju(this,b)}};function Ju(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Ju(a,b[d])}}
  xt.prototype.setPortSpots=function(a){var b=a.alignment;if(Zt(b)){var c=this.kd===zt,d=mu(a);switch(d){case 0:var e=dd;break;case 90:e=ed;break;case 180:e=cd;break;default:e=bd}var f=a.children,g=f.length;switch(b){case $t:case Qt:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?cd:bd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=cd;break;case 90:k=bd;break;case 180:k=dd;break;default:k=ed}else 0===b%2&&(k=90===d||270===
  d?dd:ed);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case au:d=90===d||270===d?dd:ed;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case bu:for(d=90===d||270===d?cd:bd,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,
  null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=mu(a),this.kd===zt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.fromSpot=dd;break;case 90:d.fromSpot=ed;break;case 180:d.fromSpot=cd;break;default:d.fromSpot=bd}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.toSpot=cd;break;
  case 90:d.toSpot=bd;break;case 180:d.toSpot=dd;break;default:d.toSpot=ed}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Mb())switch(c){case 0:d.toSpot=dd;break;case 90:d.toSpot=ed;break;case 180:d.toSpot=cd;break;default:d.toSpot=bd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Mb())switch(c){case 0:d.fromSpot=cd;break;case 90:d.fromSpot=bd;break;case 180:d.fromSpot=dd;break;default:d.fromSpot=ed}else d.fromSpot=
  a.childPortSpot}};function mu(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function ou(a){var b=mu(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function pu(a){var b=mu(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
  na.Object.defineProperties(xt.prototype,{roots:{get:function(){return this.Jb},set:function(a){this.Jb!==a&&(this.Jb=a,this.C())}},path:{get:function(){return this.vp},set:function(a){this.vp!==a&&(this.vp=a,this.C())}},treeStyle:{get:function(){return this.oq},set:function(a){this.Eb===a||a!==At&&a!==Tt&&a!==Ut&&a!==St||(this.oq=a,this.C())}},layerStyle:{get:function(){return this.ts},
  set:function(a){this.Eb===a||a!==Bt&&a!==Ot&&a!==Nt||(this.ts=a,this.C())}},comments:{get:function(){return this.jd},set:function(a){this.jd!==a&&(this.jd=a,this.C())}},arrangement:{get:function(){return this.Eb},set:function(a){this.Eb===a||a!==Ct&&a!==Iu&&a!==Ft||(this.Eb=a,this.C())}},arrangementSpacing:{get:function(){return this.Pd},set:function(a){this.Pd.w(a)||(this.Pd.assign(a),this.C())}},rootDefaults:{
  get:function(){return this.U},set:function(a){this.U!==a&&(this.U=a,this.C())}},alternateDefaults:{get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a,this.C())}},sorting:{get:function(){return this.U.sorting},set:function(a){this.U.sorting===a||a!==Vt&&a!==Wt&&a!==Xt&&!Yt||(this.U.sorting=a,this.C())}},comparer:{get:function(){return this.U.comparer},set:function(a){this.U.comparer!==
  a&&(this.U.comparer=a,this.C())}},angle:{get:function(){return this.U.angle},set:function(a){this.U.angle!==a&&(0===a||90===a||180===a||270===a?(this.U.angle=a,this.C()):B("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.U.alignment},set:function(a){this.U.alignment!==a&&(this.U.alignment=a,this.C())}},nodeIndent:{get:function(){return this.U.nodeIndent},set:function(a){this.U.nodeIndent!==
  a&&0<=a&&(this.U.nodeIndent=a,this.C())}},nodeIndentPastParent:{get:function(){return this.U.nodeIndentPastParent},set:function(a){this.U.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.U.nodeIndentPastParent=a,this.C())}},nodeSpacing:{get:function(){return this.U.nodeSpacing},set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.C())}},layerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!==
  a&&(this.U.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.C())}},compaction:{get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==ju&&a!==lu||(this.U.compaction=a,this.C())}},breadthLimit:{get:function(){return this.U.breadthLimit},
  set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.C())}},rowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.C())}},rowIndent:{get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.C())}},commentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!==
  a&&(this.U.commentSpacing=a,this.C())}},commentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.C())}},setsPortSpot:{get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.C())}},portSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.w(a)||(this.U.portSpot=
  a,this.C())}},setsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.C())}},childPortSpot:{get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.w(a)||(this.U.childPortSpot=a,this.C())}},alternateSorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==Vt&&a!==Wt&&
  a!==Xt&&!Yt||(this.V.sorting=a,this.C())}},alternateComparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==a&&(this.V.comparer=a,this.C())}},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.C())}},alternateAlignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!==
  a&&(this.V.alignment=a,this.C())}},alternateNodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==a&&0<=a&&(this.V.nodeIndent=a,this.C())}},alternateNodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.C())}},alternateNodeSpacing:{get:function(){return this.V.nodeSpacing},
  set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.C())}},alternateLayerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==a&&(this.V.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.C())}},alternateCompaction:{
  get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==ju&&a!==lu||(this.V.compaction=a,this.C())}},alternateBreadthLimit:{get:function(){return this.V.breadthLimit},set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.C())}},alternateRowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.C())}},alternateRowIndent:{
  get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.C())}},alternateCommentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==a&&(this.V.commentSpacing=a,this.C())}},alternateCommentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.C())}},alternateSetsPortSpot:{
  get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.C())}},alternatePortSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.w(a)||(this.V.portSpot=a,this.C())}},alternateSetsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{
  get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.w(a)||(this.V.childPortSpot=a,this.C())}}});
  var yt=new D(xt,"PathDefault",-1),zt=new D(xt,"PathDestination",0),Gt=new D(xt,"PathSource",1),Vt=new D(xt,"SortingForwards",10),Wt=new D(xt,"SortingReverse",11),Xt=new D(xt,"SortingAscending",12),Yt=new D(xt,"SortingDescending",13),zu=new D(xt,"AlignmentCenterSubtrees",20),Au=new D(xt,"AlignmentCenterChildren",21),qu=new D(xt,"AlignmentStart",22),nu=new D(xt,"AlignmentEnd",23),$t=new D(xt,"AlignmentBus",24),Qt=new D(xt,"AlignmentBusBranching",25),au=new D(xt,"AlignmentTopLeftBus",26),bu=new D(xt,
  "AlignmentBottomRightBus",27),ju=new D(xt,"CompactionNone",30),lu=new D(xt,"CompactionBlock",31),At=new D(xt,"StyleLayered",40),Ut=new D(xt,"StyleLastParents",41),Tt=new D(xt,"StyleAlternating",42),St=new D(xt,"StyleRootOnly",43),Ct=new D(xt,"ArrangementVertical",50),Iu=new D(xt,"ArrangementHorizontal",51),Ft=new D(xt,"ArrangementFixedRoots",52),Bt=new D(xt,"LayerIndividual",60),Ot=new D(xt,"LayerSiblings",61),Nt=new D(xt,"LayerUniform",62);xt.className="TreeLayout";xt.PathDefault=yt;
  xt.PathDestination=zt;xt.PathSource=Gt;xt.SortingForwards=Vt;xt.SortingReverse=Wt;xt.SortingAscending=Xt;xt.SortingDescending=Yt;xt.AlignmentCenterSubtrees=zu;xt.AlignmentCenterChildren=Au;xt.AlignmentStart=qu;xt.AlignmentEnd=nu;xt.AlignmentBus=$t;xt.AlignmentBusBranching=Qt;xt.AlignmentTopLeftBus=au;xt.AlignmentBottomRightBus=bu;xt.CompactionNone=ju;xt.CompactionBlock=lu;xt.StyleLayered=At;xt.StyleLastParents=Ut;xt.StyleAlternating=Tt;xt.StyleRootOnly=St;xt.ArrangementVertical=Ct;
  xt.ArrangementHorizontal=Iu;xt.ArrangementFixedRoots=Ft;xt.LayerIndividual=Bt;xt.LayerSiblings=Ot;xt.LayerUniform=Nt;function Dt(a){aq.call(this,a)}ma(Dt,aq);Dt.prototype.createVertex=function(){return new Et(this)};Dt.prototype.createEdge=function(){return new Ku(this)};Dt.className="TreeNetwork";
  function Et(a){oq.call(this,a);this.Ka=!1;this.Cc=null;this.I=[];this.Sc=this.eb=this.T=this.La=0;this.jd=null;this.S=new J(0,0);this.wa=new M(0,0);this.fa=new J(0,0);this.Tm=this.Sm=this.ZA=!1;this.br=this.Pq=null;this.bd=Vt;this.Wc=vq;this.Yb=0;this.yb=Au;this.Ds=this.Cs=0;this.Es=20;this.ue=50;this.ss=0;this.Er=lu;this.wr=0;this.Rs=25;this.Dr=this.Qs=10;this.Cr=20;this.dt=!0;this.Ms=Vc;this.ct=!0;this.zr=Vc}ma(Et,oq);
  Et.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.bd=a.sorting,this.Wc=a.comparer,this.Yb=a.angle,this.yb=a.alignment,this.Cs=a.nodeIndent,this.Ds=a.nodeIndentPastParent,this.Es=a.nodeSpacing,this.ue=a.layerSpacing,this.ss=a.layerSpacingParentOverlap,this.Er=a.compaction,this.wr=a.breadthLimit,this.Rs=a.rowSpacing,this.Qs=a.rowIndent,this.Dr=a.commentSpacing,this.Cr=a.commentMargin,this.dt=a.setsPortSpot,this.Ms=a.portSpot,this.ct=a.setsChildPortSpot,this.zr=a.childPortSpot)};
  na.Object.defineProperties(Et.prototype,{initialized:{get:function(){return this.Ka},set:function(a){this.Ka!==a&&(this.Ka=a)}},parent:{get:function(){return this.Cc},set:function(a){this.Cc!==a&&(this.Cc=a)}},children:{get:function(){return this.I},set:function(a){if(this.I!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.I=a}}},level:{get:function(){return this.La},set:function(a){this.La!==
  a&&(this.La=a)}},descendantCount:{get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a)}},maxChildrenCount:{get:function(){return this.eb},set:function(a){this.eb!==a&&(this.eb=a)}},maxGenerationCount:{get:function(){return this.Sc},set:function(a){this.Sc!==a&&(this.Sc=a)}},comments:{get:function(){return this.jd},set:function(a){if(this.jd!==a){if(null!==a)for(var b=
  a.length,c=0;c<b;c++);this.jd=a}}},sorting:{get:function(){return this.bd},set:function(a){this.bd!==a&&(this.bd=a)}},comparer:{get:function(){return this.Wc},set:function(a){this.Wc!==a&&(this.Wc=a)}},angle:{get:function(){return this.Yb},set:function(a){this.Yb!==a&&(this.Yb=a)}},alignment:{get:function(){return this.yb},set:function(a){this.yb!==a&&(this.yb=a)}},nodeIndent:{
  get:function(){return this.Cs},set:function(a){this.Cs!==a&&(this.Cs=a)}},nodeIndentPastParent:{get:function(){return this.Ds},set:function(a){this.Ds!==a&&(this.Ds=a)}},nodeSpacing:{get:function(){return this.Es},set:function(a){this.Es!==a&&(this.Es=a)}},layerSpacing:{get:function(){return this.ue},set:function(a){this.ue!==a&&(this.ue=a)}},layerSpacingParentOverlap:{
  get:function(){return this.ss},set:function(a){this.ss!==a&&(this.ss=a)}},compaction:{get:function(){return this.Er},set:function(a){this.Er!==a&&(this.Er=a)}},breadthLimit:{get:function(){return this.wr},set:function(a){this.wr!==a&&(this.wr=a)}},rowSpacing:{get:function(){return this.Rs},set:function(a){this.Rs!==a&&(this.Rs=a)}},rowIndent:{get:function(){return this.Qs},set:function(a){this.Qs!==
  a&&(this.Qs=a)}},commentSpacing:{get:function(){return this.Dr},set:function(a){this.Dr!==a&&(this.Dr=a)}},commentMargin:{get:function(){return this.Cr},set:function(a){this.Cr!==a&&(this.Cr=a)}},setsPortSpot:{get:function(){return this.dt},set:function(a){this.dt!==a&&(this.dt=a)}},portSpot:{get:function(){return this.Ms},set:function(a){this.Ms.w(a)||(this.Ms=a)}},setsChildPortSpot:{
  get:function(){return this.ct},set:function(a){this.ct!==a&&(this.ct=a)}},childPortSpot:{get:function(){return this.zr},set:function(a){this.zr.w(a)||(this.zr=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(a){this.S.set(a)}},subtreeSize:{get:function(){return this.wa},set:function(a){this.wa.set(a)}},
  subtreeOffset:{get:function(){return this.fa},set:function(a){this.fa.set(a)}}});Et.className="TreeVertex";function Ku(a){pq.call(this,a);this.lv=new J(0,0)}ma(Ku,pq);
  Ku.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.kd){case zt:c=this.fromVertex;d=this.toVertex;break;case Gt:c=this.toVertex;d=this.fromVertex;break;default:B("Unhandled path value "+b.kd.toString())}if(null!==c&&null!==d)if(b=this.lv,0!==b.x||0!==b.y||c.ZA){d=c.bounds;var e=mu(c),f=ou(c),g=c.rowSpacing;a.xj();var h=a.curve===dg,k=a.isOrthogonal,l;a.Th();if(k||h){for(l=2;4<a.pointsCount;)a.uw(2);var m=a.i(1);var n=a.i(2)}else{for(l=
  1;3<a.pointsCount;)a.uw(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===nu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-pu(c))))):c.alignment===qu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+pu(c))))):e=c.Sm||c.Tm&&1===c.maxGenerationCount?d.top-c.fa.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
  g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===nu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-pu(c))))):c.alignment===qu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+pu(c))))):e=c.Sm||c.Tm&&1===c.maxGenerationCount?d.left-c.fa.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
  3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===nu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-pu(c))))):c.alignment===qu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+pu(c))))):e=c.Sm||c.Tm&&1===c.maxGenerationCount?d.top-c.fa.y+b.y:d.y+d.height/2+b.y,h?
  (a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===nu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-pu(c))))):c.alignment===qu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+pu(c))))):e=c.Sm||c.Tm&&1===c.maxGenerationCount?
  d.left-c.fa.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.top-f),l++,a.m(l,e,d.top-f+(b.y+g)/3),l++,a.m(l,e,d.top-f+2*(b.y+g)/3),l++,a.m(l,e,d.top-f+(b.y+g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.top-f/2),l++),a.m(l,e,d.top-f/2),l++,a.m(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):B("Invalid angle "+e);a.xf()}else a=this.link,f=mu(c),f!==mu(d)&&(g=ou(c),h=c.bounds,c=d.bounds,0===f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<
  g+1||(a.xj(),c=a.curve===dg,b=a.isOrthogonal,d=Zt(this.fromVertex.alignment),a.Th(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.L(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.L(5,a.i(5).x,c)):b?d?a.L(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.L(2,f,a.i(2).y),a.L(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.L(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.L(1,a.i(1).x,f-20),a.m(2,c,f-20),
  a.m(3,c,f),a.m(4,c,f+20),a.L(5,c,a.i(5).y)):b?d?a.L(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.L(2,a.i(2).x,f),a.L(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.L(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.L(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.L(5,a.i(5).x,c)):b?d?a.L(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.L(2,f,a.i(2).y),a.L(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
  a.L(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.L(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.L(5,c,a.i(5).y)):b?d?a.L(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.L(2,a.i(2).x,f),a.L(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.L(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.xf()))}};
  na.Object.defineProperties(Ku.prototype,{fromVertex:{get:function(){return this.Yc},set:function(a){this.Yc!==a&&(this.Yc=a)}},toVertex:{get:function(){return this.ed},set:function(a){this.ed!==a&&(this.ed=a)}},relativePoint:{get:function(){return this.lv},set:function(a){this.lv.set(a)}}});Ku.className="TreeEdge";
  Pa.prototype.initializeStandardTools=function(){this.Ya("Action",new Eg,this.mouseDownTools);this.Ya("Relinking",new bf,this.mouseDownTools);this.Ya("LinkReshaping",new bg,this.mouseDownTools);this.Ya("Rotating",new Cg,this.mouseDownTools);this.Ya("Resizing",new vg,this.mouseDownTools);this.Ya("Linking",new Vf,this.mouseMoveTools);this.Ya("Dragging",new Ve,this.mouseMoveTools);this.Ya("DragSelecting",new Hg,this.mouseMoveTools);this.Ya("Panning",new Ig,this.mouseMoveTools);this.Ya("ContextMenu",new Kg,
  this.mouseUpTools);this.Ya("TextEditing",new Vg,this.mouseUpTools);this.Ya("ClickCreating",new Fg,this.mouseUpTools);this.Ya("ClickSelecting",new Dg,this.mouseUpTools)};wn("Horizontal",new Cm);wn("Spot",new Em);wn("Table",new Im);wn("Viewbox",new Nm);wn("TableRow",new Lm);wn("TableColumn",new Mm);wn("Graduated",new Xm);wn("Grid",new Om);vi.add("GraphLinksModel",Oq);vi.add("TreeModel",br);gq(ls,null);gq(As,null);
  var Lu=x.go,Mu={get licenseKey(){return R.licenseKey},set licenseKey(a){R.licenseKey=a},get version(){return R.version},Group:U,EnumValue:D,List:E,Set:G,Map:H,Point:J,Size:M,Rect:N,Margin:kc,Spot:O,Geometry:rd,PathFigure:je,PathSegment:ke,InputEvent:me,DiagramEvent:ve,ChangedEvent:we,Model:Z,GraphLinksModel:zr,TreeModel:Er,Binding:Ii,Transaction:Be,UndoManager:Ce,CommandHandler:Xk,Tool:Ee,DraggingTool:Ve,DraggingInfo:cf,DraggingOptions:We,LinkingBaseTool:Jf,LinkingTool:Vf,RelinkingTool:bf,LinkReshapingTool:bg,
  ResizingTool:vg,RotatingTool:Cg,ClickSelectingTool:Dg,ActionTool:Eg,ClickCreatingTool:Fg,HTMLInfo:Te,ContextMenuTool:Kg,DragSelectingTool:Hg,PanningTool:Ig,TextEditingTool:Vg,ToolManager:Pa,Animation:qh,AnimationManager:mh,AnimationTrigger:gi,Layer:li,Diagram:R,Palette:Qk,Overview:Tk,Brush:zl,GraphObject:Y,Panel:X,RowColumnDefinition:Vj,Shape:Kf,TextBlock:Wg,TextBlockMetrics:po,Picture:dk,Part:V,Adornment:Je,Node:W,Link:S,Placeholder:xg,Layout:Bi,LayoutNetwork:aq,LayoutVertex:oq,LayoutEdge:pq,GridLayout:Sk,
  PanelLayout:Tl,CircularLayout:Fr,CircularNetwork:Wr,CircularVertex:js,CircularEdge:ks,ForceDirectedLayout:ls,ForceDirectedNetwork:ms,ForceDirectedVertex:ys,ForceDirectedEdge:zs,LayeredDigraphLayout:As,LayeredDigraphNetwork:Fs,LayeredDigraphVertex:vt,LayeredDigraphEdge:wt,TreeLayout:xt,TreeNetwork:Dt,TreeVertex:Et,TreeEdge:Ku};
  "object"===typeof Lu&&Lu.version&&B("WARNING: a `go` object on the root object is already defined.  "+("Debug"in Lu?"debug ":"")+"version: "+Lu.version+", replaced with version: "+Mu.version);R.prototype.go=Mu;x.go=Mu;("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(Mu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
  