/*
 * GoJS v2.2.9 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-2022 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.2.9/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 ea(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var fa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},ha;
if("function"==typeof Object.setPrototypeOf)ha=Object.setPrototypeOf;else{var ia;a:{var ja={a:!0},ka={};try{ka.__proto__=ja;ia=ka.a;break a}catch(a){}ia=!1}ha=ia?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var la=ha;
function ma(a,b){a.prototype=fa(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.vB=b.prototype}
var na="undefined"!=typeof global&&null!=global?global:self,oa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a},pa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function qa(a,b){if(b){var c=na;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&pa(c,a,{writable:!0,value:b})}}qa("Object.assign",function(a){return a||oa});qa("Array.prototype.fill",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 globalThis&&globalThis||"object"===typeof global&&global.global===global&&global||"object"===typeof self&&self.self===self&&self||{};void 0===x.requestAnimationFrame&&(void 0===x.setImmediate?x.requestAnimationFrame=function(a){x.setTimeout(a,0)}:x.requestAnimationFrame=x.setImmediate);function sa(){}function ta(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&x.clearTimeout(c);c=ua(function(){c=-1;a.apply(d,e)},b)}}function ua(a,b){return x.setTimeout(a,b)}
function va(a){return x.document.createElement(a)}function C(a){throw Error(a);}function wa(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);C(a)}function xa(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);C(c+" is not in the range "+b+": "+a)}function ya(a){x.console&&x.console.log(a)}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 Da(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):C("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Ea(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):C("Cannot remove an object from an HTMLCollection or NodeList at "+b)}
function Fa(){var a=Ga.pop();return void 0===a?[]:a}function Ia(a){a.length=0;Ga.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.hB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Ma(a,b,c){Object.defineProperty(Oa.prototype,a,{get:b,set:c})}
function Pa(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]);if(f.indexOf('GoJS 2.2 evaluation') > -1||f.indexOf('(c) 1998-2022 Northwoods Software') > -1||f.indexOf('Not for distribution or production use') > -1||f.indexOf('gojs.net') > -1){return '';}else{return f};return f}
var Qa=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Trident/7"),Ra=void 0!==x.navigator&&0<x.navigator.userAgent.indexOf("Edge/"),Sa=void 0!==x.navigator&&void 0!==x.navigator.platform&&null!==x.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i),Ga=[];Object.freeze([]);sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f21462913b5";sa.adym="gojs.net";sa.vfo="28e644fdba";sa.className="Util";function D(a,b,c){Ta(this);this.j=a;this.na=b;this.o=c}
D.prototype.toString=function(){return"EnumValue."+this.na};function Ua(a,b){return void 0===b||null===b||""===b?null:a[b]}na.Object.defineProperties(D.prototype,{classType:{get:function(){return this.j}},name:{get:function(){return this.na}},value:{get:function(){return this.o}}});D.className="EnumValue";function Va(){this.Fw=[]}Va.prototype.toString=function(){return this.Fw.join("")};
Va.prototype.add=function(a){""!==a&&this.Fw.push(a)};Va.className="StringBuilder";function Wa(){}Wa.className="PropertyCollection";
var Xa={jB:!1,oB:!1,lB:!1,nB:!1,tB:!1,rB:!1,Qx:!1,kB:null,trace:function(a){x.console&&x.console.log(a)},mB: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)},iB: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.sm=Object.getOwnPropertyNames(d.prototype);for(var e={lk:0};e.lk<b.sm.length;e={lk:e.lk},e.lk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.sm[e.lk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.sm[e.lk],{set:function(a,b){return function(){throw Error("Property "+a.sm[b.lk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={sm:b.sm,x:b.x}}}};function Ya(){}Ya.prototype.reset=function(){};Ya.prototype.next=function(){return!1};Ya.prototype.od=function(){return!1};Ya.prototype.first=function(){return null};Ya.prototype.any=function(){return!1};Ya.prototype.all=function(){return!0};Ya.prototype.each=function(){return this};Ya.prototype.map=function(){return this};Ya.prototype.filter=function(){return this};
Ya.prototype.Qd=function(){};Ya.prototype.toString=function(){return"EmptyIterator"};na.Object.defineProperties(Ya.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});Ya.prototype.first=Ya.prototype.first;Ya.prototype.hasNext=Ya.prototype.od;Ya.prototype.next=Ya.prototype.next;Ya.prototype.reset=Ya.prototype.reset;var Za=null;Ya.className="EmptyIterator";Za=new Ya;function $a(a){this.key=-1;this.value=a}
$a.prototype.reset=function(){this.key=-1};$a.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};$a.prototype.od=function(){return this.next()};$a.prototype.first=function(){this.key=0;return this.value};$a.prototype.any=function(a){this.key=-1;return a(this.value)};$a.prototype.all=function(a){this.key=-1;return a(this.value)};$a.prototype.each=function(a){this.key=-1;a(this.value);return this};$a.prototype.map=function(a){return new $a(a(this.value))};
$a.prototype.filter=function(a){return a(this.value)?new $a(this.value):Za};$a.prototype.Qd=function(){this.value=null};$a.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties($a.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});$a.prototype.first=$a.prototype.first;$a.prototype.hasNext=$a.prototype.od;$a.prototype.next=$a.prototype.next;
$a.prototype.reset=$a.prototype.reset;$a.className="SingletonIterator";function ab(a){this.pb=a;this.af=null;a.Ja=null;this.ja=a.Ba;this.Qa=-1}ab.prototype.reset=function(){var a=this.pb;a.Ja=null;this.ja=a.Ba;this.Qa=-1};ab.prototype.next=function(){var a=this.pb;if(a.Ba!==this.ja&&0>this.key)return!1;a=a.m;var b=a.length,c=++this.Qa,d=this.af;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Qa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Qd()}return!1};
ab.prototype.od=function(){return this.next()};ab.prototype.first=function(){var a=this.pb;this.ja=a.Ba;this.Qa=0;a=a.m;var b=a.length,c=this.af;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Qa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};ab.prototype.any=function(a){var b=this.pb;b.Ja=null;this.Qa=-1;b=b.m;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
ab.prototype.all=function(a){var b=this.pb;b.Ja=null;this.Qa=-1;b=b.m;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};ab.prototype.each=function(a){var b=this.pb;b.Ja=null;this.Qa=-1;b=b.m;for(var c=b.length,d=this.af,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
ab.prototype.map=function(a){var b=this.pb;b.Ja=null;this.Qa=-1;var c=[];b=b.m;for(var d=b.length,e=this.af,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.m=c;a.kb();return a.iterator};ab.prototype.filter=function(a){var b=this.pb;b.Ja=null;this.Qa=-1;var c=[];b=b.m;for(var d=b.length,e=this.af,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.m=c;a.kb();return a.iterator};
ab.prototype.Qd=function(){this.key=-1;this.value=null;this.ja=-1;this.af=null;this.pb.Ja=this};ab.prototype.toString=function(){return"ListIterator@"+this.Qa+"/"+this.pb.count};
na.Object.defineProperties(ab.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.af},set:function(a){this.af=a}},count:{get:function(){var a=this.af;if(null!==a){for(var b=0,c=this.pb.m,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.pb.m.length}}});ab.prototype.first=ab.prototype.first;ab.prototype.hasNext=ab.prototype.od;ab.prototype.next=ab.prototype.next;
ab.prototype.reset=ab.prototype.reset;ab.className="ListIterator";function fb(a){this.pb=a;a.Ng=null;this.ja=a.Ba;this.Qa=a.m.length}fb.prototype.reset=function(){var a=this.pb;a.Ng=null;this.ja=a.Ba;this.Qa=a.m.length};fb.prototype.next=function(){var a=this.pb;if(a.Ba!==this.ja&&0>this.key)return!1;var b=--this.Qa;if(0<=b)return this.key=b,this.value=a.m[b],!0;this.Qd();return!1};fb.prototype.od=function(){return this.next()};
fb.prototype.first=function(){var a=this.pb;this.ja=a.Ba;var b=a.m;this.Qa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};fb.prototype.any=function(a){var b=this.pb;b.Ng=null;b=b.m;var c=b.length;this.Qa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};fb.prototype.all=function(a){var b=this.pb;b.Ng=null;b=b.m;var c=b.length;this.Qa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
fb.prototype.each=function(a){var b=this.pb;b.Ng=null;b=b.m;var c=b.length;this.Qa=c;for(--c;0<=c;c--)a(b[c]);return this};fb.prototype.map=function(a){var b=this.pb;b.Ng=null;var c=[];b=b.m;var d=b.length;this.Qa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.m=c;a.kb();return a.iterator};fb.prototype.filter=function(a){var b=this.pb;b.Ng=null;var c=[];b=b.m;var d=b.length;this.Qa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.m=c;a.kb();return a.iterator};
fb.prototype.Qd=function(){this.key=-1;this.value=null;this.ja=-1;this.pb.Ng=this};fb.prototype.toString=function(){return"ListIteratorBackwards("+this.Qa+"/"+this.pb.count+")"};na.Object.defineProperties(fb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.pb.m.length}}});fb.prototype.first=fb.prototype.first;fb.prototype.hasNext=fb.prototype.od;fb.prototype.next=fb.prototype.next;fb.prototype.reset=fb.prototype.reset;
fb.className="ListIteratorBackwards";function E(a){Ta(this);this.v=!1;this.m=[];this.Ba=0;this.Ng=this.Ja=null;"string"===typeof a&&C("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=E.prototype;t.kb=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()#"+gb(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);this.m.push(a);this.kb();return this};t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);var b=this.m;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.kb();return this};t.clear=function(){this.v&&wa(this);this.m.length=0;this.kb()};t.contains=function(a){return null===a?!1:-1!==this.m.indexOf(a)};t.has=function(a){return this.contains(a)};
t.indexOf=function(a){return null===a?-1:this.m.indexOf(a)};t.J=function(a){var b=this.m;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.J(a)};t.Lc=function(a,b){var c=this.m;(0>a||a>=c.length)&&xa(a,"0 <= i < length",E,"setElt:i");this.v&&wa(this,a);c[a]=b};t.set=function(a,b){this.Lc(a,b)};t.first=function(){var a=this.m;return 0===a.length?null:a[0]};t.Xb=function(){var a=this.m,b=a.length;return 0<b?a[b-1]:null};
t.pop=function(){this.v&&wa(this);var a=this.m;return 0<a.length?a.pop():null};E.prototype.any=function(a){for(var b=this.m,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.m,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.m,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.m,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.m=c;b.kb();return b};
E.prototype.filter=function(a){for(var b=new E,c=[],d=this.m,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.m=c;b.kb();return b};t=E.prototype;t.ub=function(a,b){0>a&&xa(a,">= 0",E,"insertAt:i");this.v&&wa(this,a);var c=this.m;a>=c.length?c.push(b):c.splice(a,0,b);this.kb()};t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=this.m;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.kb();return!0};t.delete=function(a){return this.remove(a)};
t.eb=function(a){var b=this.m;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"removeAt:i");this.v&&wa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.kb()};t.removeRange=function(a,b){var c=this.m,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&&wa(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.kb();return this};E.prototype.copy=function(){var a=new E,b=this.m;0<b.length&&(a.m=Array.prototype.slice.call(b));return a};
t=E.prototype;t.xa=function(){for(var a=this.m,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.ew=function(){for(var a=new G,b=this.m,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.v&&wa(this);this.m.sort(a);this.kb();return this};
t.Wi=function(a,b,c){var d=this.m,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.v&&wa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&xa(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.kb()),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.kb();return this};
t.reverse=function(){this.v&&wa(this);this.m.reverse();this.kb();return this};
na.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.m}},count:{get:function(){return this.m.length}},size:{get:function(){return this.m.length}},length:{get:function(){return this.m.length}},iterator:{get:function(){if(0>=this.m.length)return Za;var a=this.Ja;return null!==a?(a.reset(),a):new ab(this)}},iteratorBackwards:{
get:function(){if(0>=this.m.length)return Za;var a=this.Ng;return null!==a?(a.reset(),a):new fb(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.Wi;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.ew;E.prototype.toArray=E.prototype.xa;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.eb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.ub;
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.Lc;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 hb(a){this.ag=a;a.Ja=null;this.ja=a.Ba;this.la=null}hb.prototype.reset=function(){var a=this.ag;a.Ja=null;this.ja=a.Ba;this.la=null};hb.prototype.next=function(){var a=this.ag;if(a.Ba!==this.ja&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Qd();return!1};hb.prototype.od=function(){return this.next()};
hb.prototype.first=function(){var a=this.ag;this.ja=a.Ba;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};hb.prototype.any=function(a){var b=this.ag;this.la=b.Ja=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};hb.prototype.all=function(a){var b=this.ag;this.la=b.Ja=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};hb.prototype.each=function(a){var b=this.ag;this.la=b.Ja=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
hb.prototype.map=function(a){var b=this.ag;b.Ja=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};hb.prototype.filter=function(a){var b=this.ag;b.Ja=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};hb.prototype.Qd=function(){this.value=this.key=null;this.ja=-1;this.ag.Ja=this};hb.prototype.toString=function(){return null!==this.la?"SetIterator@"+this.la.value:"SetIterator"};
na.Object.defineProperties(hb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ag.Hb}}});hb.prototype.first=hb.prototype.first;hb.prototype.hasNext=hb.prototype.od;hb.prototype.next=hb.prototype.next;hb.prototype.reset=hb.prototype.reset;hb.className="SetIterator";
function G(a){Ta(this);this.v=!1;this.Ib={};this.Hb=0;this.Ja=null;this.Ba=0;this.We=this.ba=null;"string"===typeof a&&C("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=G.prototype;t.kb=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()#"+gb(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);var b=a;za(a)&&(b=ib(a));void 0===this.Ib[b]&&(this.Hb++,a=new jb(a,a),this.Ib[b]=a,b=this.We,null===b?this.ba=a:(a.Fl=b,b.oa=a),this.We=a,this.kb());return this};t.addAll=function(a){if(null===a)return this;this.v&&wa(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=gb(a),void 0===b)?!1:void 0!==this.Ib[b]};t.has=function(a){return this.contains(a)};t.wz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.xz=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.oa}return!1};G.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};G.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b.value),b=b.oa;return this};G.prototype.map=function(a){for(var b=new G,c=this.ba;null!==c;)b.add(a(c.value)),c=c.oa;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.oa}return b};t=G.prototype;
t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(za(a)&&(b=gb(a),void 0===b))return!1;a=this.Ib[b];if(void 0===a)return!1;var c=a.oa,d=a.Fl;null!==c&&(c.Fl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.We===a&&(this.We=d);delete this.Ib[b];this.Hb--;this.kb();return!0};t.delete=function(a){return this.remove(a)};
t.Bq=function(a){if(null===a)return this;this.v&&wa(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.SA=function(a){if(null===a||0===this.count)return this;this.v&&wa(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.Bq(a);return this};t.clear=function(){this.v&&wa(this);this.Ib={};this.Hb=0;null!==this.Ja&&this.Ja.reset();this.We=this.ba=null;this.kb()};
G.prototype.copy=function(){var a=new G,b=this.Ib,c;for(c in b)a.add(b[c].value);return a};G.prototype.xa=function(){var a=Array(this.Hb),b=this.Ib,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};G.prototype.dw=function(){var a=new E,b=this.Ib,c;for(c in b)a.add(b[c].value);return a};function Ta(a){a.__gohashid=kb++}function ib(a){var b=a.__gohashid;void 0===b&&(b=kb++,a.__gohashid=b);return b}function gb(a){return a.__gohashid}
na.Object.defineProperties(G.prototype,{count:{get:function(){return this.Hb}},size:{get:function(){return this.Hb}},iterator:{get:function(){if(0>=this.Hb)return Za;var a=this.Ja;return null!==a?(a.reset(),a):new hb(this)}}});G.prototype.toList=G.prototype.dw;G.prototype.toArray=G.prototype.xa;G.prototype.clear=G.prototype.clear;G.prototype.retainAll=G.prototype.SA;G.prototype.removeAll=G.prototype.Bq;
G.prototype["delete"]=G.prototype.delete;G.prototype.remove=G.prototype.remove;G.prototype.first=G.prototype.first;G.prototype.containsAny=G.prototype.xz;G.prototype.containsAll=G.prototype.wz;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 kb=1;G.className="Set";G.uniqueHash=Ta;G.hashIdUnique=ib;G.hashId=gb;
function lb(a){this.ha=a;this.ja=a.Ba;this.la=null}lb.prototype.reset=function(){this.ja=this.ha.Ba;this.la=null};lb.prototype.next=function(){var a=this.ha;if(a.Ba!==this.ja&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=this.key=a=b.key,!0;this.Qd();return!1};lb.prototype.od=function(){return this.next()};lb.prototype.first=function(){var a=this.ha;this.ja=a.Ba;a=a.ba;return null!==a?(this.la=a,this.value=this.key=a=a.key):null};
lb.prototype.any=function(a){var b=this.ha;this.la=null;for(b=b.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};lb.prototype.all=function(a){var b=this.ha;this.la=null;for(b=b.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};lb.prototype.each=function(a){var b=this.ha;this.la=null;for(b=b.ba;null!==b;)a(b.key),b=b.oa;return this};lb.prototype.map=function(a){var b=this.ha;this.la=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
lb.prototype.filter=function(a){var b=this.ha;this.la=null;var c=new E;for(b=b.ba;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};lb.prototype.Qd=function(){this.value=this.key=null;this.ja=-1};lb.prototype.toString=function(){return null!==this.la?"MapKeySetIterator@"+this.la.value:"MapKeySetIterator"};na.Object.defineProperties(lb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ha.Hb}}});
lb.prototype.first=lb.prototype.first;lb.prototype.hasNext=lb.prototype.od;lb.prototype.next=lb.prototype.next;lb.prototype.reset=lb.prototype.reset;lb.className="MapKeySetIterator";function mb(a){G.call(this);Ta(this);this.v=!0;this.ha=a}ma(mb,G);t=mb.prototype;t.freeze=function(){return this};t.ea=function(){return this};t.toString=function(){return"MapKeySet("+this.ha.toString()+")"};t.add=function(){C("This Set is read-only: "+this.toString())};t.contains=function(a){return this.ha.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){C("This Set is read-only: "+this.toString())};t.delete=function(a){return this.remove(a)};t.clear=function(){C("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ha.ba;return null!==a?a.key:null};mb.prototype.any=function(a){for(var b=this.ha.ba;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};mb.prototype.all=function(a){for(var b=this.ha.ba;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
mb.prototype.each=function(a){for(var b=this.ha.ba;null!==b;)a(b.key),b=b.oa;return this};mb.prototype.map=function(a){for(var b=new G,c=this.ha.ba;null!==c;)b.add(a(c.key)),c=c.oa;return b};mb.prototype.filter=function(a){for(var b=new G,c=this.ha.ba;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};mb.prototype.copy=function(){return new mb(this.ha)};mb.prototype.ew=function(){var a=new G,b=this.ha.Ib,c;for(c in b)a.add(b[c].key);return a};
mb.prototype.xa=function(){var a=this.ha.Ib,b=Array(this.ha.Hb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};mb.prototype.dw=function(){var a=new E,b=this.ha.Ib,c;for(c in b)a.add(b[c].key);return a};na.Object.defineProperties(mb.prototype,{count:{get:function(){return this.ha.Hb}},size:{get:function(){return this.ha.Hb}},iterator:{get:function(){return 0>=this.ha.Hb?Za:new lb(this.ha)}}});
mb.prototype.toList=mb.prototype.dw;mb.prototype.toArray=mb.prototype.xa;mb.prototype.toSet=mb.prototype.ew;mb.prototype.first=mb.prototype.first;mb.prototype.clear=mb.prototype.clear;mb.prototype["delete"]=mb.prototype.delete;mb.prototype.remove=mb.prototype.remove;mb.prototype.has=mb.prototype.has;mb.prototype.contains=mb.prototype.contains;mb.prototype.add=mb.prototype.add;mb.prototype.thaw=mb.prototype.ea;mb.prototype.freeze=mb.prototype.freeze;mb.className="MapKeySet";
function nb(a){this.ha=a;a.Ve=null;this.ja=a.Ba;this.la=null}nb.prototype.reset=function(){var a=this.ha;a.Ve=null;this.ja=a.Ba;this.la=null};nb.prototype.next=function(){var a=this.ha;if(a.Ba!==this.ja&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.value=b.value,this.key=b.key,!0;this.Qd();return!1};nb.prototype.od=function(){return this.next()};
nb.prototype.first=function(){var a=this.ha;this.ja=a.Ba;a=a.ba;if(null!==a){this.la=a;var b=a.value;this.key=a.key;return this.value=b}return null};nb.prototype.any=function(a){var b=this.ha;this.la=b.Ve=null;for(b=b.ba;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};nb.prototype.all=function(a){var b=this.ha;this.la=b.Ve=null;for(b=b.ba;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};nb.prototype.each=function(a){var b=this.ha;this.la=b.Ve=null;for(b=b.ba;null!==b;)a(b.value),b=b.oa;return this};
nb.prototype.map=function(a){var b=this.ha;this.la=b.Ve=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};nb.prototype.filter=function(a){var b=this.ha;this.la=b.Ve=null;var c=new E;for(b=b.ba;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};nb.prototype.Qd=function(){this.value=this.key=null;this.ja=-1;this.ha.Ve=this};nb.prototype.toString=function(){return null!==this.la?"MapValueSetIterator@"+this.la.value:"MapValueSetIterator"};
na.Object.defineProperties(nb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ha.Hb}}});nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.od;nb.prototype.next=nb.prototype.next;nb.prototype.reset=nb.prototype.reset;nb.className="MapValueSetIterator";function jb(a,b){this.key=a;this.value=b;this.Fl=this.oa=null}jb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
jb.className="KeyValuePair";function ob(a){this.ha=a;a.Ja=null;this.ja=a.Ba;this.la=null}ob.prototype.reset=function(){var a=this.ha;a.Ja=null;this.ja=a.Ba;this.la=null};ob.prototype.next=function(){var a=this.ha;if(a.Ba!==this.ja&&null===this.key)return!1;var b=this.la;b=null===b?a.ba:b.oa;if(null!==b)return this.la=b,this.key=b.key,this.value=b.value,!0;this.Qd();return!1};ob.prototype.od=function(){return this.next()};
ob.prototype.first=function(){var a=this.ha;this.ja=a.Ba;a=a.ba;return null!==a?(this.la=a,this.key=a.key,this.value=a.value,a):null};ob.prototype.any=function(a){var b=this.ha;this.la=b.Ja=null;for(b=b.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};ob.prototype.all=function(a){var b=this.ha;this.la=b.Ja=null;for(b=b.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};ob.prototype.each=function(a){var b=this.ha;this.la=b.Ja=null;for(b=b.ba;null!==b;)a(b),b=b.oa;return this};
ob.prototype.map=function(a){var b=this.ha;this.la=b.Ja=null;var c=new E;for(b=b.ba;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};ob.prototype.filter=function(a){var b=this.ha;this.la=b.Ja=null;var c=new E;for(b=b.ba;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};ob.prototype.Qd=function(){this.value=this.key=null;this.ja=-1;this.ha.Ja=this};ob.prototype.toString=function(){return null!==this.la?"MapIterator@"+this.la:"MapIterator"};
na.Object.defineProperties(ob.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ha.Hb}}});ob.prototype.first=ob.prototype.first;ob.prototype.hasNext=ob.prototype.od;ob.prototype.next=ob.prototype.next;ob.prototype.reset=ob.prototype.reset;ob.className="MapIterator";
function I(a){Ta(this);this.v=!1;this.Ib={};this.Hb=0;this.Ve=this.Ja=null;this.Ba=0;this.We=this.ba=null;"string"===typeof a&&C("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=I.prototype;t.kb=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()#"+gb(this)};
t.add=function(a,b){this.v&&wa(this,a);var c=a;za(a)&&(c=ib(a));var d=this.Ib[c];void 0===d?(this.Hb++,a=new jb(a,b),this.Ib[c]=a,c=this.We,null===c?this.ba=a:(a.Fl=c,c.oa=a),this.We=a,this.kb()):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 I)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};I.prototype.any=function(a){for(var b=this.ba;null!==b;){if(a(b))return!0;b=b.oa}return!1};I.prototype.all=function(a){for(var b=this.ba;null!==b;){if(!a(b))return!1;b=b.oa}return!0};
I.prototype.each=function(a){for(var b=this.ba;null!==b;)a(b),b=b.oa;return this};I.prototype.map=function(a){for(var b=new I,c=this.ba;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};I.prototype.filter=function(a){for(var b=new I,c=this.ba;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=I.prototype;t.contains=function(a){var b=a;return za(a)&&(b=gb(a),void 0===b)?!1:void 0!==this.Ib[b]};t.has=function(a){return this.contains(a)};
t.H=function(a){var b=a;if(za(a)&&(b=gb(a),void 0===b))return null;a=this.Ib[b];return void 0===a?null:a.value};t.get=function(a){return this.H(a)};t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(za(a)&&(b=gb(a),void 0===b))return!1;a=this.Ib[b];if(void 0===a)return!1;var c=a.oa,d=a.Fl;null!==c&&(c.Fl=d);null!==d&&(d.oa=c);this.ba===a&&(this.ba=c);this.We===a&&(this.We=d);delete this.Ib[b];this.Hb--;this.kb();return!0};t.delete=function(a){return this.remove(a)};
t.clear=function(){this.v&&wa(this);this.Ib={};this.Hb=0;null!==this.Ja&&this.Ja.reset();null!==this.Ve&&this.Ve.reset();this.We=this.ba=null;this.kb()};I.prototype.copy=function(){var a=new I,b=this.Ib,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};I.prototype.xa=function(){var a=this.Ib,b=Array(this.Hb),c=0,d;for(d in a){var e=a[d];b[c]=new jb(e.key,e.value);c++}return b};I.prototype.Ef=function(){return new mb(this)};
na.Object.defineProperties(I.prototype,{count:{get:function(){return this.Hb}},size:{get:function(){return this.Hb}},iterator:{get:function(){if(0>=this.count)return Za;var a=this.Ja;return null!==a?(a.reset(),a):new ob(this)}},iteratorKeys:{get:function(){return 0>=this.count?Za:new lb(this)}},iteratorValues:{get:function(){if(0>=this.count)return Za;
var a=this.Ve;return null!==a?(a.reset(),a):new nb(this)}}});I.prototype.toKeySet=I.prototype.Ef;I.prototype.toArray=I.prototype.xa;I.prototype.clear=I.prototype.clear;I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.get=I.prototype.get;I.prototype.getValue=I.prototype.H;I.prototype.has=I.prototype.has;I.prototype.contains=I.prototype.contains;I.prototype.first=I.prototype.first;I.prototype.addAll=I.prototype.addAll;I.prototype.set=I.prototype.set;
I.prototype.add=I.prototype.add;I.prototype.thaw=I.prototype.ea;I.prototype.freeze=I.prototype.freeze;I.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):C("Invalid arguments to Point constructor: "+a+", "+b);this.v=!1}var pb,rb,tb,ub,vb;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.ng=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.I=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)&&C("cannot thaw constant: "+this);this.v=!1;return this};
function wb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new J(c,e)}return new J}function xb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof J?this.x===a.x&&this.y===a.y:!1};t.Gi=function(a,b){return this.x===a&&this.y===b};t.Ta=function(a){return L.w(this.x,a.x)&&L.w(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.tf=function(a){var b=a.x-this.x;a=a.y-this.y;return b*b+a*a};t.nd=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.Oa=function(a){return yb(a.x-this.x,a.y-this.y)};t.direction=function(a,b){return yb(a-this.x,b-this.y)};
function yb(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.vz=function(a,b){return L.em(a.x,a.y,b.x,b.y,this.x,this.y)};t.IA=function(a,b,c,d){L.Eh(a,b,c,d,this.x,this.y,this);return this};t.JA=function(a,b){L.Eh(a.x,a.y,b.x,b.y,this.x,this.y,this);return this};t.XA=function(a,b,c,d){L.jq(this.x,this.y,a,b,c,d,this);return this};
t.YA=function(a,b){L.jq(this.x,this.y,a.x,a.y,b.width,b.height,this);return this};t.Ui=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.Vi=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.ya(this);return this};function Ab(a,b){b.Ed(a);return a}
function Bb(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 Cb(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}function Gb(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.u=function(){return isFinite(this.x)&&isFinite(this.y)};
J.alloc=function(){var a=Hb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Hb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Hb.push(a)};J.prototype.isReal=J.prototype.u;J.prototype.setSpot=J.prototype.Vi;J.prototype.setRectSpot=J.prototype.Ui;J.prototype.snapToGridPoint=J.prototype.YA;J.prototype.snapToGrid=J.prototype.XA;J.prototype.projectOntoLineSegmentPoint=J.prototype.JA;J.prototype.projectOntoLineSegment=J.prototype.IA;
J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){return L.lm(a,b,c,d,e,f,g,h)};J.prototype.compareWithLineSegmentPoint=J.prototype.vz;J.compareWithLineSegment=function(a,b,c,d,e,f){return L.em(a,b,c,d,e,f)};J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Oa;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.nd;J.prototype.distanceSquaredPoint=J.prototype.tf;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.Ta;J.prototype.equalTo=J.prototype.Gi;J.prototype.equals=J.prototype.A;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.ng;var Hb=[];J.className="Point";J.parse=wb;J.stringify=xb;J.distanceLineSegmentSquared=Bb;J.distanceSquared=Cb;J.direction=Gb;J.Origin=pb=(new J(0,0)).ca();J.InfiniteTopLeft=rb=(new J(-Infinity,-Infinity)).ca();
J.InfiniteBottomRight=tb=(new J(Infinity,Infinity)).ca();J.SixPoint=ub=(new J(6,6)).ca();J.NoPoint=vb=(new J(NaN,NaN)).ca();J.parse=wb;J.stringify=xb;J.distanceLineSegmentSquared=Bb;J.distanceSquared=Cb;J.direction=Gb;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):C("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.ng=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.I=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)&&C("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.A=function(a){return a instanceof M?this.width===a.width&&this.height===a.height:!1};t.Gi=function(a,b){return this.width===a&&this.height===b};t.Ta=function(a){return L.w(this.width,a.width)&&L.w(this.height,a.height)};t.u=function(){return isFinite(this.width)&&isFinite(this.height)};M.alloc=function(){var a=Sb.pop();return void 0===a?new M:a};M.free=function(a){Sb.push(a)};M.prototype.isReal=M.prototype.u;
M.prototype.equalsApprox=M.prototype.Ta;M.prototype.equalTo=M.prototype.Gi;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.ng;var Sb=[];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:"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):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):C("Incorrect second argument supplied to Rect constructor "+
b)):C("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 Tb(a,b,c){a.width=b;a.height=c}t.ng=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.Mc=function(a){this.x=a.x;this.y=a.y;return this};t.WA=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.I=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)&&C("cannot thaw constant: "+this);this.v=!1;return this};function Ub(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 Vb(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof N?this.x===a.x&&this.y===a.y&&this.width===a.width&&this.height===a.height:!1};t.Gi=function(a,b,c,d){return this.x===a&&this.y===b&&this.width===c&&this.height===d};t.Ta=function(a){return L.w(this.x,a.x)&&L.w(this.y,a.y)&&L.w(this.width,a.width)&&L.w(this.height,a.height)};
function Wb(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.De=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.Gc=function(a,b){return Xb(this,b,a,b,a)};t.Xp=function(a){return Xb(this,a.top,a.right,a.bottom,a.left)};t.cw=function(a){return Xb(this,-a.top,-a.right,-a.bottom,-a.left)};t.lA=function(a,b,c,d){return Xb(this,a,b,c,d)};function Xb(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.hy=function(a){return Yb(this,a.x,a.y,a.width,a.height)};
t.zv=function(a,b,c,d){return Yb(this,a,b,c,d)};function Yb(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.Ic=function(a){return this.Av(a.x,a.y,a.width,a.height)};
t.Av=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 Zb(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.Le=function(a){return $b(this,a.x,a.y,0,0)};t.Nc=function(a){return $b(this,a.x,a.y,a.width,a.height)};
t.gw=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return $b(this,a,b,c,d)};function $b(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.Vi=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 ac(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 bc(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.u=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.rA=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=cc.pop();return void 0===a?new N:a};N.allocAt=function(a,b,c,d){var e=cc.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){cc.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.rA;N.prototype.isReal=N.prototype.u;N.intersectsLineSegment=function(a,b,c,d,e,f,g,h){return L.iy(a,b,c,d,e,f,g,h)};N.prototype.setSpot=N.prototype.Vi;N.prototype.union=N.prototype.gw;N.prototype.unionRect=N.prototype.Nc;N.prototype.unionPoint=N.prototype.Le;N.prototype.intersects=N.prototype.Av;
N.prototype.intersectsRect=N.prototype.Ic;N.prototype.intersect=N.prototype.zv;N.prototype.intersectRect=N.prototype.hy;N.prototype.grow=N.prototype.lA;N.prototype.subtractMargin=N.prototype.cw;N.prototype.addMargin=N.prototype.Xp;N.prototype.inflate=N.prototype.Gc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.De;N.prototype.containsPoint=N.prototype.$;N.prototype.equalsApprox=N.prototype.Ta;N.prototype.equalTo=N.prototype.Gi;
N.prototype.equals=N.prototype.A;N.prototype.setSize=N.prototype.WA;N.prototype.setPoint=N.prototype.Mc;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.ng;var gc=null,hc=null,cc=[];N.className="Rect";N.parse=Ub;N.stringify=Vb;N.contains=ac;N.intersects=bc;N.ZeroRect=gc=(new N(0,0,0,0)).ca();N.NoRect=hc=(new N(NaN,NaN,NaN,NaN)).ca();N.parse=Ub;N.stringify=Vb;N.contains=ac;N.intersects=bc;
function ic(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):C("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}ic.prototype.assign=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};
ic.prototype.ng=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d;return this};ic.prototype.set=function(a){this.top=a.top;this.right=a.right;this.bottom=a.bottom;this.left=a.left;return this};ic.prototype.copy=function(){var a=new ic;a.top=this.top;a.right=this.right;a.bottom=this.bottom;a.left=this.left;return a};t=ic.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=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)&&C("cannot thaw constant: "+this);this.v=!1;return this};
function mc(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 ic;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new ic(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new ic(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new ic(c,e):new ic(c,e,f,g)}return new ic}
function nc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof ic?this.top===a.top&&this.right===a.right&&this.bottom===a.bottom&&this.left===a.left:!1};t.Gi=function(a,b,c,d){return this.top===a&&this.right===b&&this.bottom===c&&this.left===d};
t.Ta=function(a){return L.w(this.top,a.top)&&L.w(this.right,a.right)&&L.w(this.bottom,a.bottom)&&L.w(this.left,a.left)};t.u=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};ic.alloc=function(){var a=oc.pop();return void 0===a?new ic:a};ic.free=function(a){oc.push(a)};ic.prototype.isReal=ic.prototype.u;ic.prototype.equalsApprox=ic.prototype.Ta;ic.prototype.equalTo=ic.prototype.Gi;ic.prototype.equals=ic.prototype.A;ic.prototype.set=ic.prototype.set;
ic.prototype.setTo=ic.prototype.ng;var pc=null,qc=null,oc=[];ic.className="Margin";ic.parse=mc;ic.stringify=nc;ic.ZeroMargin=pc=(new ic(0,0,0,0)).ca();ic.TwoMargin=qc=(new ic(2,2,2,2)).ca();ic.parse=mc;ic.stringify=nc;function P(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 rc,sc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Dc,Fc,Gc,Hc,Ic,Jc,Kc,Lc,Mc,Nc,Oc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,ad,bd,cd,dd,ed,fd,gd,hd;P.prototype.assign=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};P.prototype.ng=function(a,b,c,d){this.x=a;this.y=b;this.offsetX=c;this.offsetY=d;return this};P.prototype.set=function(a){this.x=a.x;this.y=a.y;this.offsetX=a.offsetX;this.offsetY=a.offsetY;return this};
P.prototype.copy=function(){var a=new P;a.x=this.x;a.y=this.y;a.offsetX=this.offsetX;a.offsetY=this.offsetY;return a};t=P.prototype;t.ca=function(){this.v=!0;Object.freeze(this);return this};t.I=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)&&C("cannot thaw constant: "+this);this.v=!1;return this};function id(a,b){a.x=NaN;a.y=NaN;a.offsetX=b;return a}
function jd(a){if("string"===typeof a){a=a.trim();if("None"===a)return rc;if("TopLeft"===a)return sc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return vc;if("TopRight"===a)return wc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return xc;if("Center"===a)return yc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return zc;if("BottomLeft"===a)return Ac;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Bc;if("BottomRight"===a)return Cc;if("TopSide"===a)return Dc;if("LeftSide"===
a)return Fc;if("RightSide"===a)return Gc;if("BottomSide"===a)return Hc;if("TopBottomSides"===a)return Ic;if("LeftRightSides"===a)return Jc;if("TopLeftSides"===a)return Kc;if("TopRightSides"===a)return Lc;if("BottomLeftSides"===a)return Mc;if("BottomRightSides"===a)return Nc;if("NotTopSide"===a)return Oc;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 P(c,e,f,g)}return new P}function kd(a){return a.hb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.hb()?0===this.offsetX&&0===this.offsetY?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(rc)?"None":this.A(sc)?"TopLeft":this.A(vc)?"Top":this.A(wc)?"TopRight":this.A(xc)?"Left":this.A(yc)?"Center":this.A(zc)?"Right":this.A(Ac)?"BottomLeft":this.A(Bc)?"Bottom":this.A(Cc)?"BottomRight":this.A(Dc)?"TopSide":this.A(Fc)?"LeftSide":this.A(Gc)?"RightSide":this.A(Hc)?"BottomSide":this.A(Ic)?"TopBottomSides":this.A(Jc)?
"LeftRightSides":this.A(Kc)?"TopLeftSides":this.A(Lc)?"TopRightSides":this.A(Mc)?"BottomLeftSides":this.A(Nc)?"BottomRightSides":this.A(Oc)?"NotTopSide":this.A(Rc)?"NotLeftSide":this.A(Sc)?"NotRightSide":this.A(Tc)?"NotBottomSide":this.A(Uc)?"AllSides":this.A(Vc)?"Default":"None"};t.A=function(a){return a instanceof P?(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.Jv=function(){return new P(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)};t.zf=function(a){if(!this.Kc())return!1;if(!a.Kc())if(a.A(Wc))a=Fc;else if(a.A(Xc))a=Gc;else if(a.A(ad))a=Dc;else if(a.A(bd))a=Hc;else return!1;a=a.offsetY;return(this.offsetY&a)===a};t.hb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.wc=function(){return isNaN(this.x)||isNaN(this.y)};t.Kc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.Qs=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Lb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};P.alloc=function(){var a=pd.pop();return void 0===a?new P:a};P.free=function(a){pd.push(a)};P.prototype.isDefault=P.prototype.Lb;P.prototype.isNone=P.prototype.Qs;P.prototype.isSide=P.prototype.Kc;P.prototype.isNoSpot=P.prototype.wc;P.prototype.isSpot=P.prototype.hb;P.prototype.includesSide=P.prototype.zf;
P.prototype.opposite=P.prototype.Jv;P.prototype.equals=P.prototype.A;P.prototype.set=P.prototype.set;P.prototype.setTo=P.prototype.ng;var pd=[];P.className="Spot";P.parse=jd;P.stringify=kd;P.None=rc=id(new P(0,0,0,0),0).ca();P.Default=Vc=id(new P(0,0,-1,0),-1).ca();P.TopLeft=sc=(new P(0,0,0,0)).ca();P.TopCenter=vc=(new P(.5,0,0,0)).ca();P.TopRight=wc=(new P(1,0,0,0)).ca();P.LeftCenter=xc=(new P(0,.5,0,0)).ca();P.Center=yc=(new P(.5,.5,0,0)).ca();P.RightCenter=zc=(new P(1,.5,0,0)).ca();
P.BottomLeft=Ac=(new P(0,1,0,0)).ca();P.BottomCenter=Bc=(new P(.5,1,0,0)).ca();P.BottomRight=Cc=(new P(1,1,0,0)).ca();P.MiddleTop=cd=vc;P.MiddleLeft=dd=xc;P.MiddleRight=ed=zc;P.MiddleBottom=fd=Bc;P.Top=ad=vc;P.Left=Wc=xc;P.Right=Xc=zc;P.Bottom=bd=Bc;P.TopSide=Dc=id(new P(0,0,1,1),1).ca();P.LeftSide=Fc=id(new P(0,0,1,2),1).ca();P.RightSide=Gc=id(new P(0,0,1,4),1).ca();P.BottomSide=Hc=id(new P(0,0,1,8),1).ca();P.TopBottomSides=Ic=id(new P(0,0,1,9),1).ca();P.LeftRightSides=Jc=id(new P(0,0,1,6),1).ca();
P.TopLeftSides=Kc=id(new P(0,0,1,3),1).ca();P.TopRightSides=Lc=id(new P(0,0,1,5),1).ca();P.BottomLeftSides=Mc=id(new P(0,0,1,10),1).ca();P.BottomRightSides=Nc=id(new P(0,0,1,12),1).ca();P.NotTopSide=Oc=id(new P(0,0,1,14),1).ca();P.NotLeftSide=Rc=id(new P(0,0,1,13),1).ca();P.NotRightSide=Sc=id(new P(0,0,1,11),1).ca();P.NotBottomSide=Tc=id(new P(0,0,1,7),1).ca();P.AllSides=Uc=id(new P(0,0,1,15),1).ca();gd=(new P(.156,.156)).ca();hd=(new P(.844,.844)).ca();P.parse=jd;P.stringify=kd;
function qd(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}qd.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};qd.prototype.setTransform=function(a,b,c,d,e,f){this.m11=a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};qd.prototype.copy=function(){var a=new qd;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};
qd.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};qd.prototype.A=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};qd.prototype.Os=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};qd.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
qd.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};
qd.prototype.Hv=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};
qd.prototype.Ns=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};
qd.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=qd.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.ya=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.Ed=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.Fx=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.Jq=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};qd.alloc=function(){var a=rd.pop();return void 0===a?new qd:a};
qd.free=function(a){rd.push(a)};qd.prototype.transformRect=qd.prototype.Jq;qd.prototype.transformPoint=qd.prototype.ya;qd.prototype.scale=qd.prototype.scale;qd.prototype.translate=qd.prototype.translate;qd.prototype.rotate=qd.prototype.rotate;qd.prototype.invert=qd.prototype.Ns;qd.prototype.multiplyInverted=qd.prototype.Hv;qd.prototype.multiply=qd.prototype.multiply;qd.prototype.reset=qd.prototype.reset;qd.prototype.isIdentity=qd.prototype.Os;qd.prototype.equals=qd.prototype.A;
qd.prototype.setTransform=qd.prototype.setTransform;qd.prototype.set=qd.prototype.set;var rd=[];qd.className="Transform";qd.xF="54a702f3e53909c447824c6706603faf4c";
var L={fB:"7da71ca0ad381e90",qg:(Math.sqrt(2)-1)/3*4,uw:null,sqrt:function(a){if(0>=a)return 0;var b=L.uw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);L.uw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},w:function(a,b){a-=b;return.5>a&&-.5<a},aa:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Mb: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},vs:function(a,b,c,d,e,f,g,h,k,l,m,n){if(L.Mb(a,b,g,h,n,c,d)&&L.Mb(a,b,g,h,n,e,f))return L.Mb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var v=(d+q)/2,w=(c+u)/2;return L.vs(a,
b,p,r,d,c,v,w,k,l,m,n)||L.vs(v,w,q,u,e,f,g,h,k,l,m,n)},pz: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},oz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Gb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},cm:function(a,b,c,d,e,f,g,h,k,l){if(L.Mb(a,b,g,h,k,c,d)&&L.Mb(a,b,g,h,k,e,f))$b(l,a,b,0,0),$b(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.cm(a,b,m,n,d,c,q,u,k,l);L.cm(q,u,p,r,e,f,g,h,k,l)}return l},Ce:function(a,b,c,d,e,f,g,h,k,l){if(L.Mb(a,b,g,h,k,c,d)&&L.Mb(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.Ce(a,b,m,n,d,c,q,u,k,l);L.Ce(q,u,p,r,e,f,g,h,k,l)}return l},Mv:function(a,b,c,d,e,f,g,h,k,l){if(L.Mb(a,b,e,f,l,c,d))return L.Mb(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.Mv(a,b,m,n,p,r,g,h,k,l)||L.Mv(p,r,c,d,e,f,g,h,k,l)},uB: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},Lv:function(a,b,c,d,e,f,g,h){if(L.Mb(a,b,e,f,g,c,d))$b(h,a,b,0,0),$b(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.Lv(a,b,k,l,m,n,g,h);L.Lv(m,n,c,d,e,f,g,h)}return h},xq:function(a,b,c,d,e,f,g,h){if(L.Mb(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.xq(a,b,k,l,m,n,g,h);L.xq(m,n,c,d,e,f,g,h)}return h},Zp:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(L.Mb(a,b,g,h,p,c,d)&&L.Mb(a,b,g,h,p,e,f)){if(!L.lm(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,v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/
2;w=(w+f)/2;var z=(d+v)/2,y=(c+w)/2,A=Infinity,B=!1,F=0,K=0;L.Zp(a,b,q,u,d,c,z,y,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<A&&(A=a,B=!0,F=r.x,K=r.y));L.Zp(z,y,v,w,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<A&&(B=!0,F=r.x,K=r.y);B&&(r.x=F,r.y=K);return B},$p:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(L.Mb(a,b,g,h,p,c,d)&&L.Mb(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?(k=b,a=h):(k=h,a=b),u<k||u>a)return r}else if(a<g?(k=a,a=g):k=g,q<k||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,w=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+v)/2;c=(u+w)/2;v=(v+e)/2;w=(w+f)/2;var z=(d+v)/2,y=(c+w)/2;r+=L.$p(a,b,q,u,d,c,z,y,k,l,m,n,p);r+=L.$p(z,y,v,w,e,f,g,h,k,l,m,n,p)}return r},Eh: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},Ie:function(a,b,c,d,e,f,g,h,k){if(L.w(a,c)&&L.w(b,d))return k.h(a,b),!1;if(L.aa(e,g))return L.aa(a,c)?(L.Eh(a,b,c,d,e,f,k),!1):L.Eh(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.Eh(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.Eh(a,b,c,d,e,g*(e-a)+b,k)},sB:function(a,b,c,d,e){return L.Ie(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},qB: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},yf:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(L.Ie(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.Ie(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.Ie(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.Ie(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},pB: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},Ls:function(a,b,c){return L.iy(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},iy: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):ac(a,b,c,d,e,f)||ac(a,b,c,d,g,h)||L.lm(a,b,k,b,e,f,g,h)||L.lm(k,b,k,l,e,f,g,h)||L.lm(k,l,a,l,e,f,g,h)||L.lm(a,l,a,b,e,f,g,h)?!0:!1},lm:function(a,b,c,d,e,f,g,h){return 0>=L.em(a,b,c,d,e,f)*L.em(a,b,c,d,g,h)&&0>=L.em(e,f,g,h,a,b)*L.em(e,
f,g,h,c,d)},em: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 f},vq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Lx: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.zz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},zz: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)]},jq: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},
Wx: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},Ez: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.Fz(k,0===g?a:b,l,c,0,0)},Fz: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},Ne:new Wa,Qm:new Wa,Ff:new Wa,Gf:0,Rm:100};L.za=L.fB;
function Q(a){Ta(this);this.v=!1;void 0===a&&(a=Q.o);this.ia=a;this.oc=this.fc=this.$c=this.Zc=0;this.rj=new E;this.nr=this.rj.Ba;this.Zq=(new N).freeze();this.qa=!0;this.Zm=this.Hk=null;this.$m=NaN;this.hf=sc;this.jf=Cc;this.jl=this.kl=NaN;this.Kf=sd}
Q.prototype.copy=function(){var a=new Q;a.ia=this.ia;a.Zc=this.Zc;a.$c=this.$c;a.fc=this.fc;a.oc=this.oc;for(var b=this.rj.m,c=b.length,d=a.rj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.nr=this.nr;a.Zq.assign(this.Zq);a.qa=this.qa;a.Hk=this.Hk;a.Zm=this.Zm;a.$m=this.$m;a.hf=this.hf.I();a.jf=this.jf.I();a.kl=this.kl;a.jl=this.jl;a.Kf=this.Kf;return a};Q.prototype.ca=function(){this.freeze();Object.freeze(this);return this};
Q.prototype.freeze=function(){this.v=!0;var a=this.figures;a.freeze();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};Q.prototype.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;var a=this.figures;a.ea();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};
Q.prototype.Ta=function(a){if(!(a instanceof Q))return!1;if(this.type!==a.type)return this.type===Q.j&&a.type===Q.o?td(this,a):a.type===Q.j&&this.type===Q.o?td(a,this):!1;if(this.type===Q.o){var b=this.figures.m;a=a.figures.m;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ta(a[d]))return!1;return!0}return L.w(this.startX,a.startX)&&L.w(this.startY,a.startY)&&L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)};
function td(a,b){return a.type!==Q.j||b.type!==Q.o?!1:1===b.figures.count&&(b=b.figures.J(0),1===b.segments.count&&L.w(a.startX,b.startX)&&L.w(a.startY,b.startY)&&(b=b.segments.J(0),b.type===ud&&L.w(a.endX,b.endX)&&L.w(a.endY,b.endY)))?!0:!1}Q.Ga=function(a){return a.toString()};Q.prototype.gb=function(a){a.classType===Q&&(this.type=a)};
Q.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Q.j: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 Q.C:var b=new N(this.startX,this.startY,0,0);b.gw(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 Q.M:b=new N(this.startX,this.startY,0,0);b.gw(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 Q.o:b="";c=this.figures.m;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()}};
Q.Wa=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};
Q.parse=function(a,b){function c(){return u>=A-1?!0:null!==l[u+1].match(B)}function d(){u++;return l[u]}function e(a){var b=parseFloat(d()),c=parseFloat(d());v===v.toLowerCase()&&(b=y.x+b,c=y.y+c);a.h(b,c)}function f(){e(y);return y}function g(){e(z);return z}function h(){var a=w.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?y:new J(2*y.x-z.x,2*y.y-z.y)}void 0===b&&(b=!1);var k=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm;a=a.replace(/,/gm," ");a=a.replace(k,"$1 $2");
a=a.replace(k,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^s])/gm,"$1 $2");a=a.replace(/([^s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var l=a.split(" ");for(a=0;a<l.length;a++){var m=l[a];if(null!==m.match(/(\.[0-9]*)(\.)/gm)){k=Fa();for(var n="",p=!1,r=0;r<m.length;r++){var q=m[r];"."!==q||p?"."===q?(k.push(n),n="."):n+=q:(p=!0,n+=q)}k.push(n);l.splice(a,1);for(m=0;m<k.length;m++)l.splice(a+
m,0,k[m]);a+=k.length-1;Ia(k)}}var u=-1,v="",w="";k=new J(0,0);var z=new J(0,0),y=new J(0,0),A=l.length;a=vd(null);n=m=!1;p=!0;r=null;for(var B=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(u>=A-1);)if(w=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=m=!1;break;case "M":r=f();null===a.gc||!0===p?(wd(a,r.x,r.y,m,!n),p=!1):a.moveTo(r.x,r.y);for(k.assign(y);!c();)r=f(),a.lineTo(r.x,r.y);break;case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)y=new J((v===v.toLowerCase()?y.x:0)+parseFloat(d()),
y.y),a.lineTo(y.x,y.y);break;case "V":for(;!c();)y=new J(y.x,(v===v.toLowerCase()?y.y:0)+parseFloat(d())),a.lineTo(y.x,y.y);break;case "C":for(;!c();){r=new J;e(r);q=g();var F=f();xd(a,r.x,r.y,q.x,q.y,F.x,F.y)}break;case "S":for(;!c();)r=h(),q=g(),F=f(),xd(a,r.x,r.y,q.x,q.y,F.x,F.y);break;case "Q":for(;!c();)r=g(),q=f(),Ad(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Ad(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());F=parseFloat(d());var K=parseFloat(d()),
S=parseFloat(d()),R=S,O=!1;c()||(R=parseFloat(d()),c()||(O=0!==parseFloat(d())));v===v.toLowerCase()&&(F+=y.x,K+=y.y);a.arcTo(r,q,F,K,S,R,O)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),F=parseFloat(d()),S=K=!1,O=R=0,R=d(),1===R.length?(K=!!parseFloat(R),S=!!parseFloat(d()),R=parseFloat(d())):2===R.length?(K=!!parseFloat(R[0]),S=!!parseFloat(R[1]),R=parseFloat(d())):(K=!!parseFloat(R[0]),S=!!parseFloat(R[1]),R=parseFloat(R.slice(2))),O=parseFloat(d()),v===v.toLowerCase()&&
(R=y.x+R,O=y.y+O),y.h(R,O),Bd(a,r,q,F,K,S,R,O);break;case "Z":Cd(a);y.assign(k);break;case "F":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Uu]/))q++;else if(null===l[u+q].match(B))q++;else{r=l[u+q];break}r.match(/[Mm]/)?m=!0:0<a.gc.segments.length&&(a.gc.isFilled=!0);break;case "U":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Ff]/))q++;else if(null===l[u+q].match(B))q++;else{r=l[u+q];break}r.match(/[Mm]/)?n=!0:a.Jm(!1)}k=a.Fs;Dd=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=!0;return k};
Q.Ha=function(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.ya(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ya(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ya(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ya(d);f[6]=d.x;f[7]=d.y}J.free(d)};Q.prototype.Ev=function(){if(this.qa||this.nr!==this.figures.Ba)return!0;for(var a=this.figures.m,b=a.length,c=0;c<b;c++)if(a[c].Ev())return!0;return!1};
Q.prototype.computeBounds=function(){this.qa=!1;this.Zm=this.Hk=null;this.$m=NaN;this.nr=this.figures.Ba;for(var a=this.figures.m,b=a.length,c=0;c<b;c++){var d=a[c];d.qa=!1;var e=d.segments;d.bs=e.Ba;d=e.m;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.qa=!1;g.Od=null}}a=this.Zq;a.ea();isNaN(this.kl)||isNaN(this.jl)?a.h(0,0,0,0):a.h(0,0,this.kl,this.jl);Ed(this,a,!1);$b(a,0,0,0,0);a.freeze()};Q.prototype.Kx=function(){var a=new N;Ed(this,a,!0);return a};
function Ed(a,b,c){switch(a.type){case Q.j:case Q.C:case Q.M:c?b.h(a.Zc,a.$c,0,0):$b(b,a.Zc,a.$c,0,0);$b(b,a.fc,a.oc,0,0);break;case Q.o:var d=a.figures;a=d.m;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):$b(b,f.startX,f.startY,0,0);for(var g=f.segments.m,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case ud:case Fd:k=n.endX;l=n.endY;$b(b,k,l,0,0);break;case Md:L.cm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;
l=n.endY;break;case Nd:L.Lv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Od:case Pd:var p=n.type===Od?Qd(n,f):Rd(n,f,k,l),r=p.length;if(0===r){k=n.type===Od?n.centerX:n.endX;l=n.type===Od?n.centerY:n.endY;$b(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],L.cm(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:C("Unknown Segment type: "+n.type)}}}break;default:C("Unknown Geometry type: "+a.type)}}
Q.prototype.normalize=function(){this.v&&wa(this);var a=this.Kx();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};Q.prototype.offset=function(a,b){this.v&&wa(this);this.transform(1,0,0,1,a,b);return this};Q.prototype.scale=function(a,b){this.v&&wa(this);this.transform(a,0,0,b,0,0);return this};Q.prototype.rotate=function(a,b,c){this.v&&wa(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=qd.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);qd.free(d);return this};
t=Q.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case Q.j:case Q.C:case Q.M:var g=this.Zc;var h=this.$c;this.Zc=g*a+h*c+e;this.$c=g*b+h*d+f;g=this.fc;h=this.oc;this.fc=g*a+h*c+e;this.oc=g*b+h*d+f;break;case Q.o:for(var k=this.figures.m,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.m;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case ud:case Fd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Md: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 Nd: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 Od: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 Pd: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:C("Unknown Segment type: "+q.type)}}}}this.qa=!0;return this};
t.$=function(a,b){void 0===b&&(b=0);var c=this.Zc,d=this.$c,e=this.fc,f=this.oc;switch(this.type){case Q.j:return L.Mb(c,d,e,f,b,a.x,a.y);case Q.C: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 Q.M: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 Q.o:return Sd(this,a,b,!0,!1);default:return!1}};
function Sd(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.m,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.$(f,b,c))return!0;var v=u.segments;k=u.startX;l=u.startY;for(var w=k,z=l,y=v.m,A=0;A<=v.length;A++){var B=void 0;if(A!==v.length){B=y[A];var F=B.type;a=B.endX;n=B.endY}else F=ud,a=w,n=z;switch(F){case Fd:w=Td(f,b,g,b,k,l,w,z);if(isNaN(w))return!0;h+=w;w=a;z=n;break;case ud:k=Td(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Md:m=L.$p(k,l,B.point1X,
B.point1Y,B.point2X,B.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Nd:m=L.$p(k,l,(k+2*B.point1X)/3,(l+2*B.point1Y)/3,(2*B.point1X+a)/3,(2*B.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Od:case Pd:F=B.type===Od?Qd(B,u):Rd(B,u,k,l);var K=F.length;if(0===K){k=Td(f,b,g,b,k,l,B.type===Od?B.centerX:B.endX,B.type===Od?B.centerY:B.endY);if(isNaN(k))return!0;h+=k;break}B=null;for(var S=0;S<K;S++){B=F[S];if(0===S){m=Td(f,b,g,b,k,l,B[0],B[1]);if(isNaN(m))return!0;h+=m}m=L.$p(B[0],B[1],B[2],B[3],B[4],B[5],B[6],B[7],
g,b,f,b,.5);h+=m}null!==B&&(a=B[6],n=B[7]);break;default:C("Unknown Segment type: "+B.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 Td(a,b,c,d,e,f,g,h){if(L.Mb(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 Ud(a,b,c,d){a=a.figures.m;for(var e=a.length,f=0;f<e;f++)if(a[f].$(b,c,d))return!0;return!1}
t.uv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===Q.j)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.Xx=function(a){0>a?a=0:1<a&&(a=1);if(this.type===Q.j)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.vv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===Q.j)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.Yx=function(a){if(this.type===Q.j){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.Eh(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===Q.C){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 v=
p[u],w=p[u+1];if(0!==u){L.Eh(l,m,v,w,a.x,a.y,d);var z=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);z<e&&(e=z,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=v;m=w}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function Vd(a){if(null===a.Hk){var b=a.Hk=[],c=a.Zm=[],d=[],e=[];if(a.type===Q.j)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===Q.C)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===Q.M){var f=new Wd;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new Xd(Od);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=Qd(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.Ce(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(Yd(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.m,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Fd:4<=d.length&&(b.push(d),c.push(Yd(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case ud:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Md:L.Ce(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Nd:L.xq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Od:var r=Qd(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 v=r[u];L.Ce(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d);g=v[6];f=v[7]}break;case Pd:r=Rd(p,e,g,f);q=r.length;u=p.endX;v=p.endY;if(0===q){d.push(u);d.push(v);g=u;f=v;break}for(u=0;u<q;u++)v=r[u],L.Ce(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],f=v[7];break;default:C("Segment not of valid type: "+
p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(Yd(d)))}}}function Yd(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(Cb(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.rj.add(a);return this};t.Km=function(a,b,c,d,e,f,g,h){this.v&&wa(this);this.hf=(new P(a,b,e,f)).freeze();this.jf=(new P(c,d,g,h)).freeze();return this};
na.Object.defineProperties(Q.prototype,{flattenedSegments:{get:function(){Vd(this);return this.Hk}},flattenedLengths:{get:function(){Vd(this);return this.Zm}},flattenedTotalLength:{get:function(){var a=this.$m;if(isNaN(a)){if(this.type===Q.j){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===Q.C)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.$m=a}return a}},type:{get:function(){return this.ia},set:function(a){this.ia!==a&&(this.v&&wa(this,a),this.ia=a,this.qa=!0)}},startX:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.v&&wa(this,a),this.Zc=a,this.qa=!0)}},startY:{get:function(){return this.$c},set:function(a){this.$c!==
a&&(this.v&&wa(this,a),this.$c=a,this.qa=!0)}},endX:{get:function(){return this.fc},set:function(a){this.fc!==a&&(this.v&&wa(this,a),this.fc=a,this.qa=!0)}},endY:{get:function(){return this.oc},set:function(a){this.oc!==a&&(this.v&&wa(this,a),this.oc=a,this.qa=!0)}},figures:{get:function(){return this.rj},set:function(a){this.rj!==a&&(this.v&&wa(this,a),this.rj=a,this.qa=!0)}},spot1:{
get:function(){return this.hf},set:function(a){this.v&&wa(this,a);this.hf=a.I()}},spot2:{get:function(){return this.jf},set:function(a){this.v&&wa(this,a);this.jf=a.I()}},defaultStretch:{get:function(){return this.Kf},set:function(a){this.v&&wa(this,a);this.Kf=a}},bounds:{get:function(){this.Ev()&&this.computeBounds();return this.Zq}}});Q.prototype.setSpots=Q.prototype.Km;Q.prototype.add=Q.prototype.add;
Q.prototype.getFractionForPoint=Q.prototype.Yx;Q.prototype.getPointAndAngleAlongPath=Q.prototype.vv;Q.prototype.getAngleAlongPath=Q.prototype.Xx;Q.prototype.getPointAlongPath=Q.prototype.uv;Q.prototype.containsPoint=Q.prototype.$;Q.prototype.transform=Q.prototype.transform;Q.prototype.rotate=Q.prototype.rotate;Q.prototype.scale=Q.prototype.scale;Q.prototype.offset=Q.prototype.offset;Q.prototype.normalize=Q.prototype.normalize;Q.prototype.computeBoundsWithoutOrigin=Q.prototype.Kx;
Q.prototype.equalsApprox=Q.prototype.Ta;Q.className="Geometry";Q.j=new D(Q,"Line",0);Q.C=new D(Q,"Rectangle",1);Q.M=new D(Q,"Ellipse",2);Q.o=new D(Q,"Path",3);Q.Oc="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";Q.className="Geometry";Q.stringify=Q.Ga;Q.fillPath=Q.Wa;Q.parse=Q.parse;Q.Line=Q.j;Q.Rectangle=Q.C;Q.Ellipse=Q.M;Q.Path=Q.o;
function Wd(a,b,c,d){Ta(this);this.Gw=null;this.v=!1;void 0===c&&(c=!0);this.xr=c;void 0===d&&(d=!0);this.Cr=d;void 0!==a?this.Zc=a:this.Zc=0;void 0!==b?this.$c=b:this.$c=0;this.Ml=new E;this.bs=this.Ml.Ba;this.qa=!0}Wd.prototype.copy=function(){var a=new Wd;a.xr=this.xr;a.Cr=this.Cr;a.Zc=this.Zc;a.$c=this.$c;for(var b=this.Ml.m,c=b.length,d=a.Ml,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.bs=this.bs;a.qa=this.qa;a.Gw=this.Gw;return a};t=Wd.prototype;
t.Ta=function(a){if(!(a instanceof Wd&&L.w(this.startX,a.startX)&&L.w(this.startY,a.startY)))return!1;var b=this.segments.m;a=a.segments.m;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ta(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.m,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.m;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.m;for(var b=a.length,c=0;c<b;c++)a[c].ea();return this};t.Ev=function(){if(this.qa)return!0;var a=this.segments;if(this.bs!==a.Ba)return!0;a=a.m;for(var b=a.length,c=0;c<b;c++)if(a[c].qa)return!0;return!1};t.add=function(a){this.Ml.add(a);return this};
t.$=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.m,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Fd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case ud:if(L.Mb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Md:if(L.vs(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 Nd:if(L.Mv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Od:case Pd:var n=m.type===
Od?Qd(m,this):Rd(m,this,d,e),p=n.length,r=m.type===Od?m.centerX:m.endX,q=m.type===Od?m.centerY:m.endY;if(0===p){if(L.Mb(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.Mb(d,e,r[0],r[1],c,a,b)||L.vs(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:C("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&L.Mb(d,e,f,g,c,a,b))return!0}return!1};
na.Object.defineProperties(Wd.prototype,{isFilled:{get:function(){return this.xr},set:function(a){this.v&&wa(this,a);this.xr=a}},isShadowed:{get:function(){return this.Cr},set:function(a){this.v&&wa(this,a);this.Cr=a}},startX:{get:function(){return this.Zc},set:function(a){this.v&&wa(this,a);this.Zc=a;this.qa=!0}},startY:{get:function(){return this.$c},set:function(a){this.v&&wa(this,
a);this.$c=a;this.qa=!0}},segments:{get:function(){return this.Ml},set:function(a){this.v&&wa(this,a);this.Ml=a;this.qa=!0}}});Wd.prototype.add=Wd.prototype.add;Wd.prototype.equalsApprox=Wd.prototype.Ta;Wd.className="PathFigure";
function Xd(a,b,c,d,e,f,g,h){Ta(this);this.v=!1;void 0===a&&(a=ud);this.ia=a;void 0!==b?this.fc=b:this.fc=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===Pd?(a=f%360,0>a&&(a+=360),this.Ae=a,this.pi=0,this.ri=Math.max(d,0),this.ah=Math.max(e,0),this.rl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Nk=!!h):(this.Ae=d,this.pi=e,a===Od&&(f=Math.max(f,0)),this.ri=f,"number"===typeof g?(a===Od&&(g=Math.max(g,0)),this.ah=g):this.ah=0,
this.Nk=this.rl=!1);this.yj=!1;this.qa=!0;this.Od=null}Xd.prototype.copy=function(){var a=new Xd;a.ia=this.ia;a.fc=this.fc;a.oc=this.oc;a.Ae=this.Ae;a.pi=this.pi;a.ri=this.ri;a.ah=this.ah;a.rl=this.rl;a.Nk=this.Nk;a.yj=this.yj;a.qa=this.qa;return a};t=Xd.prototype;
t.Ta=function(a){if(!(a instanceof Xd)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Fd:case ud:return L.w(this.endX,a.endX)&&L.w(this.endY,a.endY);case Md:return L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)&&L.w(this.point1X,a.point1X)&&L.w(this.point1Y,a.point1Y)&&L.w(this.point2X,a.point2X)&&L.w(this.point2Y,a.point2Y);case Nd:return L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)&&L.w(this.point1X,a.point1X)&&L.w(this.point1Y,a.point1Y);case Od:return L.w(this.startAngle,
a.startAngle)&&L.w(this.sweepAngle,a.sweepAngle)&&L.w(this.centerX,a.centerX)&&L.w(this.centerY,a.centerY)&&L.w(this.radiusX,a.radiusX)&&L.w(this.radiusY,a.radiusY);case Pd:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&L.w(this.xAxisRotation,a.xAxisRotation)&&L.w(this.endX,a.endX)&&L.w(this.endY,a.endY)&&L.w(this.radiusX,a.radiusX)&&L.w(this.radiusY,a.radiusY);default:return!1}};t.gb=function(a){a.classType===Xd&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Fd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case ud:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Md: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 Nd: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 Od: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 Pd: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.yj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};t.close=function(){this.yj=!0;return this};
function Qd(a,b){if(null!==a.Od&&!1===b.qa)return a.Od;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Od=[],a.Od;b=a.Ae;var e=a.pi,f=L.Lx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=qd.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Q.Ha(f,g);qd.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.Od=f;return a.Od}
function Rd(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.Od&&!1===b.qa)return a.Od;if(0===a.radiusX||0===a.radiusY)return a.Od=[],a.Od;b=a.ri;var f=a.ah;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Ae,h=a.rl,k=a.Nk,l=a.fc,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.Lx(0,0,b>f?b:f,m,m+g,!0);f=qd.alloc();f.reset();f.translate(c,d);f.rotate(a.Ae,0,0);f.scale(k,r);Q.Ha(b,f);qd.free(f);a.Od=b;return a.Od}
na.Object.defineProperties(Xd.prototype,{isClosed:{get:function(){return this.yj},set:function(a){this.yj!==a&&(this.yj=a,this.qa=!0)}},type:{get:function(){return this.ia},set:function(a){this.v&&wa(this,a);this.ia=a;this.qa=!0}},endX:{get:function(){return this.fc},set:function(a){this.v&&wa(this,a);this.fc=a;this.qa=!0}},endY:{get:function(){return this.oc},set:function(a){this.v&&
wa(this,a);this.oc=a;this.qa=!0}},point1X:{get:function(){return this.Ae},set:function(a){this.v&&wa(this,a);this.Ae=a;this.qa=!0}},point1Y:{get:function(){return this.pi},set:function(a){this.v&&wa(this,a);this.pi=a;this.qa=!0}},point2X:{get:function(){return this.ri},set:function(a){this.v&&wa(this,a);this.ri=a;this.qa=!0}},point2Y:{get:function(){return this.ah},set:function(a){this.v&&
wa(this,a);this.ah=a;this.qa=!0}},centerX:{get:function(){return this.Ae},set:function(a){this.v&&wa(this,a);this.Ae=a;this.qa=!0}},centerY:{get:function(){return this.pi},set:function(a){this.v&&wa(this,a);this.pi=a;this.qa=!0}},radiusX:{get:function(){return this.ri},set:function(a){0>a&&xa(a,">= zero",Xd,"radiusX");this.v&&wa(this,a);this.ri=a;this.qa=!0}},radiusY:{get:function(){return this.ah},
set:function(a){0>a&&xa(a,">= zero",Xd,"radiusY");this.v&&wa(this,a);this.ah=a;this.qa=!0}},startAngle:{get:function(){return this.fc},set:function(a){this.fc!==a&&(this.v&&wa(this,a),a%=360,0>a&&(a+=360),this.fc=a,this.qa=!0)}},sweepAngle:{get:function(){return this.oc},set:function(a){this.v&&wa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.oc=a;this.qa=!0}},isClockwiseArc:{get:function(){return this.Nk},set:function(a){this.v&&
wa(this,a);this.Nk=a;this.qa=!0}},isLargeArc:{get:function(){return this.rl},set:function(a){this.v&&wa(this,a);this.rl=a;this.qa=!0}},xAxisRotation:{get:function(){return this.Ae},set:function(a){a%=360;0>a&&(a+=360);this.v&&wa(this,a);this.Ae=a;this.qa=!0}}});Xd.prototype.equalsApprox=Xd.prototype.Ta;
var Fd=new D(Xd,"Move",0),ud=new D(Xd,"Line",1),Md=new D(Xd,"Bezier",2),Nd=new D(Xd,"QuadraticBezier",3),Od=new D(Xd,"Arc",4),Pd=new D(Xd,"SvgArc",4);Xd.className="PathSegment";Xd.Move=Fd;Xd.Line=ud;Xd.Bezier=Md;Xd.QuadraticBezier=Nd;Xd.Arc=Od;Xd.SvgArc=Pd;function Zd(){this.F=null;this.Wu=(new J(0,0)).freeze();this.Ht=(new J(0,0)).freeze();this.Sq=this.Lr=0;this.Tq=1;this.ci="";this.rs=this.hr=!1;this.fr=this.Vq=0;this.sg=this.ur=this.Ar=!1;this.lr=null;this.ps=0;this.md=this.os=null}
Zd.prototype.copy=function(){var a=new Zd;return this.clone(a)};Zd.prototype.clone=function(a){a.F=this.F;a.Wu.assign(this.viewPoint);a.Ht.assign(this.documentPoint);a.Lr=this.Lr;a.Sq=this.Sq;a.Tq=this.Tq;a.ci=this.ci;a.hr=this.hr;a.rs=this.rs;a.Vq=this.Vq;a.fr=this.fr;a.Ar=this.Ar;a.ur=this.ur;a.sg=this.sg;a.lr=this.lr;a.ps=this.ps;a.os=this.os;a.md=this.md;return a};
Zd.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};Zd.prototype.mq=function(a,b){var c=this.diagram;if(null===c)return b;$d(c,this.event,a,b);return b};
Zd.prototype.fA=function(a,b){var c=this.diagram;if(null===c)return b;$d(c,this.event,a,b);b.assign(c.kt(b));return b};
na.Object.defineProperties(Zd.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},viewPoint:{get:function(){return this.Wu},set:function(a){this.Wu.assign(a)}},documentPoint:{get:function(){return this.Ht},set:function(a){this.Ht.assign(a)}},modifiers:{get:function(){return this.Lr},set:function(a){this.Lr=a}},button:{get:function(){return this.Sq},
set:function(a){this.Sq=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.Tq},set:function(a){this.Tq=a}},key:{get:function(){return this.ci},set:function(a){this.ci=a}},down:{get:function(){return this.hr},set:function(a){this.hr=a}},up:{get:function(){return this.rs},set:function(a){this.rs=
a}},clickCount:{get:function(){return this.Vq},set:function(a){this.Vq=a}},delta:{get:function(){return this.fr},set:function(a){this.fr=a}},isMultiTouch:{get:function(){return this.Ar},set:function(a){this.Ar=a}},handled:{get:function(){return this.ur},set:function(a){this.ur=a}},bubbles:{get:function(){return this.sg},set:function(a){this.sg=a}},event:{
get:function(){return this.lr},set:function(a){this.lr=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.ps},set:function(a){this.ps=a}},targetDiagram:{get:function(){return this.os},set:function(a){this.os=a}},targetObject:{
get:function(){return this.md},set:function(a){this.md=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}}});
Zd.prototype.getMultiTouchDocumentPoint=Zd.prototype.fA;Zd.prototype.getMultiTouchViewPoint=Zd.prototype.mq;Zd.className="InputEvent";function ae(){this.F=null;this.na="";this.Tr=this.ks=null}ae.prototype.copy=function(){var a=new ae;a.F=this.F;a.na=this.na;a.ks=this.ks;a.Tr=this.Tr;return a};ae.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(ae.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},name:{get:function(){return this.na},set:function(a){this.na=a}},subject:{get:function(){return this.ks},set:function(a){this.ks=a}},parameter:{get:function(){return this.Tr},set:function(a){this.Tr=a}}});ae.className="DiagramEvent";
function be(){this.fn=ce;this.bf=this.Kr="";this.Mo=this.No=this.So=this.To=this.Ro=this.F=this.Tb=null}be.prototype.clear=function(){this.Mo=this.No=this.So=this.To=this.Ro=this.F=this.Tb=null};
be.prototype.copy=function(){var a=new be;a.fn=this.fn;a.Kr=this.Kr;a.bf=this.bf;a.Tb=this.Tb;a.F=this.F;a.Ro=this.Ro;var b=this.To;a.To=za(b)&&"function"===typeof b.I?b.I():b;b=this.So;a.So=za(b)&&"function"===typeof b.I?b.I():b;b=this.No;a.No=za(b)&&"function"===typeof b.I?b.I():b;b=this.Mo;a.Mo=za(b)&&"function"===typeof b.I?b.I():b;return a};be.prototype.gb=function(a){a.classType===be&&(this.change=a)};
be.prototype.toString=function(){var a="";a=this.change===de?a+"* ":this.change===ce?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===de?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};be.prototype.H=function(a){return a?this.oldValue:this.newValue};be.prototype.hA=function(a){return a?this.oldParam:this.newParam};be.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
be.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};be.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};be.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
na.Object.defineProperties(be.prototype,{model:{get:function(){return this.Tb},set:function(a){this.Tb=a}},diagram:{get:function(){return this.F},set:function(a){this.F=a}},change:{get:function(){return this.fn},set:function(a){this.fn=a}},modelChange:{get:function(){return this.Kr},set:function(a){this.Kr=a}},propertyName:{get:function(){return this.bf},
set:function(a){this.bf=a}},isTransactionFinished:{get:function(){return this.fn===de&&("CommittedTransaction"===this.bf||"FinishedUndo"===this.bf||"FinishedRedo"===this.bf)}},object:{get:function(){return this.Ro},set:function(a){this.Ro=a}},oldValue:{get:function(){return this.To},set:function(a){this.To=a}},oldParam:{get:function(){return this.So},set:function(a){this.So=a}},
newValue:{get:function(){return this.No},set:function(a){this.No=a}},newParam:{get:function(){return this.Mo},set:function(a){this.Mo=a}}});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.getParam=be.prototype.hA;be.prototype.getValue=be.prototype.H;be.prototype.clear=be.prototype.clear;
var de=new D(be,"Transaction",-1),ce=new D(be,"Property",0),ee=new D(be,"Insert",1),fe=new D(be,"Remove",2);be.className="ChangedEvent";be.Transaction=de;be.Property=ce;be.Insert=ee;be.Remove=fe;function oe(){this.o=(new E).freeze();this.na="";this.j=!1}oe.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};
oe.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()};oe.prototype.canUndo=function(){return this.isComplete};oe.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()}};oe.prototype.canRedo=function(){return this.isComplete};
oe.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()}};
oe.prototype.Zs=function(){if(this.isComplete){var a=this.changes;a.ea();for(var b=new I,c=0;c<a.count;c++){var d=a.J(c);if(null!==d&&d.change===ce&&d.object){var e=b.get(d.object);e||(e=new I,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Lc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.J(c),null!==d&&(c>b&&a.Lc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}};
na.Object.defineProperties(oe.prototype,{changes:{get:function(){return this.o}},name:{get:function(){return this.na},set:function(a){this.na=a}},isComplete:{get:function(){return this.j},set:function(a){this.j=a}}});oe.prototype.optimize=oe.prototype.Zs;oe.prototype.redo=oe.prototype.redo;oe.prototype.canRedo=oe.prototype.canRedo;oe.prototype.undo=oe.prototype.undo;oe.prototype.canUndo=oe.prototype.canUndo;
oe.prototype.clear=oe.prototype.clear;oe.className="Transaction";function pe(){this.nu=new G;this.td=!1;this.C=(new E).freeze();this.pe=-1;this.o=999;this.re=!1;this.cr=null;this.yi=0;this.j=!1;this.we=(new E).freeze();this.Al=new E;this.Pt=!0;this.Zt=this.yr=this.bu=this.au=!1}
pe.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};
pe.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.pe=-1;a.freeze();this.re=!1;this.cr=null;this.yi=0;this.we.ea();this.we.clear();this.we.freeze();this.Al.clear();this.Zt=this.yr=this.bu=this.au=!1};pe.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=pe.prototype;t.Ax=function(a){this.nu.add(a)};t.xy=function(a){this.nu.remove(a)};
t.wa=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Pt&&(this.Pt=!1,this.yi++,this.isInternalTransaction||this.Cb("StartingFirstTransaction",a,this.currentTransaction),0<this.yi&&this.yi--);this.isEnabled&&(this.we.ea(),this.we.add(a),this.we.freeze(),null===this.currentTransaction?this.Al.add(0):this.Al.add(this.currentTransaction.changes.count));this.yi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Cb("StartedTransaction",a,this.currentTransaction));
return b};t.Xa=function(a){void 0===a&&(a="");return qe(this,!0,a)};t.Df=function(){return qe(this,!1,"")};
function qe(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&ya("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Cb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.yi--,a.isEnabled)){var g=a.we.count;0<g&&(""===c&&(c=a.we.J(0)),a.we.ea(),a.we.eb(g-1),a.we.freeze());g=a.Al.count;0<g&&(f=a.Al.J(g-1),a.Al.eb(g-1))}if(d){if(b){a.yr=!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.eb(d),a.yr=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.J(0),null!==f&&f.clear(),b.eb(0),a.pe--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.pe++);b.freeze()}a.isInternalTransaction||a.Cb("CommittedTransaction",c,e)}else{a.re=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Cb("RolledBackTransaction",c,e),a.re=!1}null!==e&&e.clear()}a.cr=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.eb(e);c.freeze()}return!1}pe.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
pe.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.re=!0,this.Cb("StartingUndo","Undo",a),this.pe--,a.undo()}catch(b){ya("undo error: "+b.toString())}finally{this.Cb("FinishedUndo","Undo",a),this.re=!1}}};pe.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
pe.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.re=!0,this.Cb("StartingRedo","Redo",a),this.pe++,a.redo()}catch(b){ya("redo error: "+b.toString())}finally{this.Cb("FinishedRedo","Redo",a),this.re=!1}}};pe.prototype.Cb=function(a,b,c){void 0===c&&(c=null);var d=new be;d.change=de;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.ws(d)};
pe.prototype.yv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.cr=b=new oe);var c=a.copy();b=b.changes;b.ea();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Pt&&(a=a.diagram,null!==a&&!1===a.Pi||ya("Change not within a transaction: "+c.toString()))}};
pe.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(pe.prototype,{models:{get:function(){return this.nu.iterator}},isEnabled:{get:function(){return this.td},set:function(a){this.td=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.re}},history:{get:function(){return this.C}},maxHistoryLength:{get:function(){return this.o},set:function(a){this.o=a}},historyIndex:{get:function(){return this.pe}},currentTransaction:{get:function(){return this.cr}},transactionLevel:{
get:function(){return this.yi}},isInTransaction:{get:function(){return 0<this.yi}},checksTransactionLevel:{get:function(){return this.j},set:function(a){this.j=a}},nestedTransactionNames:{get:function(){return this.we}},isPendingClear:{get:function(){return this.au},set:function(a){this.au=a}},isPendingUnmodified:{get:function(){return this.bu},set:function(a){this.bu=
a}},isInternalTransaction:{get:function(){return this.Zt},set:function(a){this.Zt=a}},isJustDiscarded:{get:function(){return this.yr}}});pe.prototype.handleChanged=pe.prototype.yv;pe.prototype.redo=pe.prototype.redo;pe.prototype.undo=pe.prototype.undo;pe.prototype.canUndo=pe.prototype.canUndo;pe.prototype.rollbackTransaction=pe.prototype.Df;pe.prototype.commitTransaction=pe.prototype.Xa;pe.prototype.startTransaction=pe.prototype.wa;
pe.prototype.removeModel=pe.prototype.xy;pe.prototype.addModel=pe.prototype.Ax;pe.prototype.clear=pe.prototype.clear;pe.className="UndoManager";function re(){Ta(this);this.F=se;this.na="";this.td=!0;this.Oc=!1;this.tw=null;this.cz=new Zd;this.ts=-1}re.prototype.toString=function(){return""!==this.name?this.name+" Tool":Ja(this.constructor)};re.prototype.updateAdornments=function(){};re.prototype.canStart=function(){return this.isEnabled};re.prototype.doStart=function(){};
re.prototype.doActivate=function(){this.isActive=!0};re.prototype.doDeactivate=function(){this.isActive=!1};re.prototype.doStop=function(){};re.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};re.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};re.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};re.prototype.doMouseMove=function(){};re.prototype.doMouseUp=function(){this.stopTool()};
re.prototype.doMouseWheel=function(){};re.prototype.canStartMultiTouch=function(){return!0};re.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.mq(0,J.allocAt(NaN,NaN)),d=b.mq(1,J.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.km("hasGestureZoom"))){a.bx=a.scale;var e=d.x-c.x,f=d.y-c.y;a.mx=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
re.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.mq(0,J.allocAt(NaN,NaN)),d=b.mq(1,J.allocAt(NaN,NaN));if(c.u()&&d.u()&&(this.doCancel(),a.km("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.mx;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.bx;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)};
re.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};re.prototype.doKeyUp=function(){};re.prototype.wa=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.wa(a)};re.prototype.stopTransaction=function(){var a=this.diagram;return null===this.transactionResult?a.Df():a.Xa(this.transactionResult)};
re.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.im(b.documentPoint,!1);if(null!==c)if(Sa?b.meta:b.control){a.S("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.S("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.S("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.S("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||(Sa?b.meta:b.control)||b.shift||a.clearSelection()}};re.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.Wb(d.documentPoint,a,b);d.targetObject=a;te(a,d,c);return d.handled};
function te(a,b,c){b.handled=!1;if(null===a||a.Af()){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.S(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.S(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)}}}
re.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.rb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.$(b.documentPoint)?a.Wb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Tk){var f=a.Tk,g=f;a.Tk=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.mg(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.mg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Tk}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.Fb();a.skipsUndoManager=c}};re.prototype.doCurrentObjectChanged=function(){};
re.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.u()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===ue&&!b.shift||e===ve&&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===ue&&b.shift||e===ve&&!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(Qa||Ra)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.A(d)||(b.bubbles=!1)}}};re.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.cz);this.ts=ua(function(){c.doWaitAfter(d)},a)};re.prototype.cancelWaitAfter=function(){-1!==this.ts&&x.clearTimeout(this.ts);this.ts=-1};
re.prototype.doWaitAfter=function(){};re.prototype.findToolHandleAt=function(a,b){a=this.diagram.Wb(a,function(a){for(;null!==a&&!(a.panel instanceof we);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};re.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(re.prototype,{diagram:{get:function(){return this.F},set:function(a){a instanceof T&&(this.F=a)}},name:{get:function(){return this.na},set:function(a){this.na=a}},isEnabled:{get:function(){return this.td},set:function(a){this.td=a}},isActive:{get:function(){return this.Oc},set:function(a){this.Oc=a}},transactionResult:{get:function(){return this.tw},
set:function(a){this.tw=a}}});re.prototype.startTransaction=re.prototype.wa;re.className="Tool";function Oa(){re.call(this);this.name="ToolManager";this.yc=new E;this.Pc=new E;this.Kd=new E;this.M=this.Ga=850;this.o=(new M(2,2)).ca();this.Wa=5E3;this.Ha=ve;this.C=xe;this.br=this.j=null;this.Vj=-1}ma(Oa,re);Oa.prototype.initializeStandardTools=function(){};
Oa.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof we&&this.br===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Oa.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===ye&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===ze){b.bubbles=!0;return}if(this.gestureBehavior===ye)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===ve?this.mouseWheelBehavior=ue:this.mouseWheelBehavior===ue&&(this.mouseWheelBehavior=ve));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Oa.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===ze){b.bubbles=!0;return}if(this.gestureBehavior===ye)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}}Ae(this,
a);a=b.event;null===a||"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Ae(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Oa.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof we&&(b===a||b.mg(a))||this.hideToolTip()};
Oa.prototype.doWaitAfter=function(a){var b=this.diagram;b.Aa&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Pu=!0,b.doMouseUp()))};
Oa.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Wb(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)};
Oa.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Wb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof we)||b!==a&&!b.mg(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()};
Oa.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof we){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.Sa();this.positionToolTip(a,b)}else a instanceof Be&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Vj&&(x.clearTimeout(this.Vj),
this.Vj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Vj=ua(function(){e.hideToolTip()},a)}};Oa.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}};
Oa.prototype.hideToolTip=function(){-1!==this.Vj&&(x.clearTimeout(this.Vj),this.Vj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof we?(a.remove(b),null!==this.br&&this.br.Cf(b.category),b.data=null,b.adornedObject=null):b instanceof Be&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Oa.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()};Oa.prototype.doMouseWheel=function(){this.standardMouseWheel()};Oa.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Oa.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Oa.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};
Oa.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.Lc(d,b):this.mouseDownTools.eb(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.Lc(d,b):this.mouseMoveTools.eb(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.Lc(d,
b):this.mouseUpTools.eb(d),e;return null};Oa.prototype.Za=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(Oa.prototype,{mouseWheelBehavior:{get:function(){return this.Ha},set:function(a){this.Ha=a}},gestureBehavior:{get:function(){return this.C},set:function(a){this.C=a}},currentToolTip:{get:function(){return this.j},set:function(a){this.j=a;this.br=null!==a&&a instanceof we?a.adornedPart:null}},mouseDownTools:{get:function(){return this.yc}},mouseMoveTools:{
get:function(){return this.Pc}},mouseUpTools:{get:function(){return this.Kd}},hoverDelay:{get:function(){return this.Ga},set:function(a){this.Ga=a}},holdDelay:{get:function(){return this.M},set:function(a){this.M=a}},dragSize:{get:function(){return this.o},set:function(a){this.o=a.I()}},toolTipDuration:{get:function(){return this.Wa},set:function(a){this.Wa=
a}}});Oa.prototype.replaceStandardTool=Oa.prototype.Za;var ve=new D(Oa,"WheelScroll",0),ue=new D(Oa,"WheelZoom",1),Ce=new D(Oa,"WheelNone",2),xe=new D(Oa,"GestureZoom",3),ye=new D(Oa,"GestureCancel",4),ze=new D(Oa,"GestureNone",5);Oa.className="ToolManager";Oa.WheelScroll=ve;Oa.WheelZoom=ue;Oa.WheelNone=Ce;Oa.GestureZoom=xe;Oa.GestureCancel=ye;Oa.GestureNone=ze;
function De(){re.call(this);this.name="Dragging";this.C=this.Pc=!0;this.o=this.Wa=this.Ga=this.Yf=null;this.Cn=this.Kd=!1;this.Sl=new J(NaN,NaN);this.hs=new J;this.yc=!0;this.Zk=100;this.Eg=[];this.Zi=(new G).freeze();this.Ha=new Ee;this.qo=null;this.M="copy";this.Ih="";this.Jh="no-drop"}var He;ma(De,re);
De.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.Zk)?!1:null!==this.findDraggablePart()};
De.prototype.findDraggablePart=function(){var a=this.diagram;a=a.im(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};
De.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.im(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.S("ChangingSelection",a.selection),b=a.lastInput,(Sa?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.S("ChangedSelection",a.selection))}}};
De.prototype.doActivate=function(){var a=this.diagram;this.qo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(a.ev(!0),Ie=null,this.isActive=!0,this.Sl.set(a.position),Je(this,a.selection),this.Eg.length=0,a.animationManager.nc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.ht=!0,!0===a.Fe("temporaryPixelRatio")&&30<a.Ex&&Ke(a),Le(a,this.draggedParts),this.wa("Drag"),this.startPoint=a.firstInput.documentPoint,
a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Cn=!1,Ie=this,Me=this.diagram,this.doSimulatedDragOut()))};function Je(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.nk()&&1===b.count&&b.first()instanceof U?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.$j(),a.Yf=c.toolManager.findTool("Relinking"),null===a.Yf&&(a.Yf=new Ne,a.Yf.diagram=c)):(a.draggedLink=null,a.Yf=null))}}
De.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};De.prototype.yd=function(a){return void 0===a?new Oe(pb):this.isGridSnapEnabled?new Oe(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new Oe(a.copy())};
De.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.ev(!1);a.og();Pe(this);Qe(a,this.draggedParts);this.draggedParts=this.currentPart=this.qo=null;this.Cn=this.isDragOutStarted=!1;if(0<He.count){for(var b=He,c=b.length,d=0;d<c;d++){var e=b.J(d);Re(e);Se(e);Pe(e);e.diagram.og()}b.clear()}Re(this);this.Sl.h(NaN,NaN);null!==Me&&(Me.currentCursor="");Ie=Me=null;Se(this);a.isMouseCaptured=!1;a.currentCursor="";a.ht=!1;this.stopTransaction();Te(a,!0)};
De.prototype.stopTransaction=function(){var a=this.diagram,b=re.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.Zs();return b};function Pe(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;Ue(a,b.lastInput,null);b.skipsUndoManager=c;a.Eg.length=0}function $e(){var a=Ie;Se(a);af(a);var b=a.diagram;a.Sl.u()&&(b.position=a.Sl);b.og()}
De.prototype.doCancel=function(){Se(this);af(this);var a=this.diagram;this.Sl.u()&&(a.position=this.Sl);this.stopTool()};De.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};De.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};
function bf(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.Df(),c.wa("Drag")):af(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Ef():c.selection;b=c.ek(b,c,!0);c=new I;for(d=a.draggedParts.iterator;d.next();){var e=
d.key;if(e.Jc()&&e.canCopy()){var f=b.H(e);null!==f&&(f.location=e.location,f.Sa(),c.add(f,a.yd(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof U&&d.canCopy()&&c.add(d,a.yd());a.copiedParts=c;Je(a,c.Ef());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,cf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)));a.doUpdateCursor(null,!0)}}}
function Se(a){var b=a.diagram;if(null!==a.copiedParts){b.bt(a.copiedParts.Ef(),!1);a.copiedParts=null;if(null!==a.draggedParts)for(var c=a.draggedParts.iterator;c.next();)c.key instanceof U&&(c.value.point=new J(0,0));a.doUpdateCursor(null,!0)}b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function Re(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.Yf){var b=a.Yf;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.Yf=null}}function df(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.Fe("temporaryPixelRatio")&&null===d.ti&&30<d.Ex&&(Ke(d),d.Aq())}
De.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&ef(d,a,b,this.dragOptions,c)};function af(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Jc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof U&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.yd());cf(d,-e.x,-e.y)}b.ed()}}
function ff(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),gf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d,!1);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=Ue(a,e,d);if(!a.isActive&&null===Ie)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof hf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Ie)return;
a.doDragOver(b,d);if(!a.isActive&&null===Ie)return}finally{c.skipsUndoManager=f,g&&c.ed()}a.qo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.zs(e.viewPoint)}De.prototype.findDragOverObject=function(a){var b=this;return jf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof we||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
De.prototype.doUpdateCursor=function(a,b){var c=this.diagram;if(b||this.qo!==a)!this.diagram.currentTool.isActive||this.mayCopy()?c.currentCursor=this.copyCursor:this.mayMove()?c.currentCursor=this.moveCursor:this.mayDragOut()&&(c.currentCursor=this.nodropCursor)};
function Ue(a,b,c){var d=!1,e=a.Eg.length,f=0<e?a.Eg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Eg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Eg.length=0;if(!a.isActive&&null===Ie||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Eg.push(e),e=kf(e);e=a.Eg.length;for(c=0;c<e&&(g=a.Eg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function kf(a){var b=a.panel;return null!==b?b:a instanceof V&&!(a instanceof hf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function lf(a,b,c){var d=a.Yf;if(null===d)return null;var e=a.diagram.kg(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(yc,a);k=b.tf(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function gf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.Yf;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=lf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=lf(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.sy&&d.S("LinkRelinked",c,d.sy),c.toPort!==d.ty&&d.S("LinkRelinked",c,d.ty)):mf(e,g,f,k,h):mf(e,null,null,null,null)}}}}De.prototype.doDragOver=function(){};
function nf(a,b){var c=a.diagram;a.dragsLink&&gf(a,!0);Pe(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;of(a,e,f);f=kf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Ie){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!==Ie){a=N.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof W&&pf(c,d,a);N.free(a)}}}function of(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof hf||(c=a.mouseDrop,null!==c&&c(b))}function pf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.De(c)&&(d=!0);a=a.sv(c,function(a){return a.part},function(a){return a instanceof U},!0,function(a){return a instanceof U},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Fd(b)&&c.isAvoiding&&c.Ua()}
De.prototype.doDropOnto=function(){};De.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()?(bf(this,!1),Le(a,this.copiedParts),df(this,this.copiedParts,!1),Qe(a,this.copiedParts)):this.mayMove()?(Se(this),df(this,this.draggedParts,!0)):this.mayDragOut()?(bf(this,!1),df(this,this.copiedParts,!1)):Se(this),ff(this,a.lastInput.documentPoint))}};
De.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?(Se(this),bf(this,!0),Le(a,this.copiedParts),df(this,this.copiedParts,!1),Qe(a,this.copiedParts),null!==this.copiedParts&&(a.S("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,Se(this),this.mayMove()&&(df(this,this.draggedParts,
!0),ff(this,a.lastInput.documentPoint)));this.Cn=!0;nf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Ef():this.draggedParts.Ef();this.copiedParts=null;b&&qf(this);a.Pa();Qe(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.S(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.S("ChangedSelection",a.selection)}}};
De.prototype.simulatedMouseMove=function(a,b,c){if(null===Ie)return!1;var d=Ie.diagram;c instanceof T||(c=null);var e=Me;c!==e&&(null!==e&&e!==d&&(e.og(),Ie.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Me=c,null!==c&&c!==d&&($e(),e=c.toolManager.findTool("Dragging"),null!==e&&(He.contains(e)||He.add(e),e.doSimulatedDragEnter())),this.doUpdateCursor(null,!0));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.Iq(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
De.prototype.simulatedMouseUp=function(a,b,c){if(null===Ie)return!1;var d=Me,e=Ie.diagram;if(null===c)return Ie.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.og(),Ie.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Me=c;d=c.toolManager.findTool("Dragging");null!==d&&($e(),He.contains(d)||He.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.Iq(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Ie,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function qf(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())}}
De.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(Sa?!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};
De.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};
De.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};De.prototype.computeBorder=function(a,b,c){return this.Cn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};De.prototype.eA=function(){return Ie};
De.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Ie;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};De.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.nc();rf(a);a.animationManager.nc();a=Ie;null!==a&&(a.diagram.ht=!1);this.doUpdateCursor(null,!0)}};De.prototype.doSimulatedDragLeave=function(){var a=Ie;null!==a&&a.doSimulatedDragOut();this.doCancel()};
De.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.dn=!0;var b=Ie;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;sf(this,b.draggedParts.Ef(),!1,a.firstInput);df(this,this.copiedParts,!1);ff(this,a.lastInput.documentPoint)}a.animationManager.dn=!1};
De.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Ie;if(null!==b){var c=b.diagram;b.Cn=!0;Se(this);if(!this.mayDragIn())return;a.animationManager.dn=!0;a.S("ChangingSelection",a.selection);this.wa("Drop");sf(this,b.draggedParts.Ef(),!0,a.lastInput);df(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));nf(this,a.lastInput.documentPoint);a.Pa();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new G;this.copiedParts=null;a.doFocus();a.S("ExternalObjectsDropped",b,c);this.stopTransaction();a.S("ChangedSelection",a.selection)}a.animationManager.dn=!1};
function sf(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.ek(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.hs;g=new I;h=J.alloc();for(k=b.iterator;k.next();)l=k.value,l instanceof U&&l.canCopy()&&(m=c.H(l),null!==m&&(m.points=l.points,cf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.yd())));for(b=b.iterator;b.next();)l=b.value,l.Jc()&&l.canCopy()&&(k=c.H(l),null!==k&&(l=l.location,h.h(f.x-(d-l.x),f.y-(e-l.y)),k.location=h,k.Sa(),g.add(k,a.yd(h))));J.free(h);a.copiedParts=g;Je(a,g.Ef());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,cf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/
2)));a.doUpdateCursor(null,!0)}}}De.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.ht=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.qo=null};De.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(De.prototype,{isCopyEnabled:{get:function(){return this.Pc},set:function(a){this.Pc=a}},copiesEffectiveCollection:{get:function(){return this.C},set:function(a){this.C=a}},dragOptions:{get:function(){return this.Ha},set:function(a){this.Ha=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.yc},set:function(a){this.yc=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.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{
get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.A(a)||(a=a.I(),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.M},set:function(a){this.M=a}},moveCursor:{get:function(){return this.Ih},set:function(a){this.Ih=a}},nodropCursor:{get:function(){return this.Jh},set:function(a){this.Jh=a}},currentPart:{get:function(){return this.Ga},
set:function(a){this.Ga=a}},copiedParts:{get:function(){return this.o},set:function(a){this.o=a}},draggedParts:{get:function(){return this.Wa},set:function(a){this.Wa=a}},draggingParts:{get:function(){return null!==this.copiedParts?this.copiedParts.Ef():null!==this.draggedParts?this.draggedParts.Ef():this.Zi}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=
a}},isDragOutStarted:{get:function(){return this.Kd},set:function(a){this.Kd=a}},startPoint:{get:function(){return this.hs},set:function(a){this.hs.A(a)||this.hs.assign(a)}},delay:{get:function(){return this.Zk},set:function(a){this.Zk=a}}});De.prototype.getDraggingSource=De.prototype.eA;var Ie=null,Me=null;De.className="DraggingTool";He=new E;
Ma("draggingTool",function(){return this.findTool("Dragging")},function(a){this.Za("Dragging",a,this.mouseMoveTools)});Oa.prototype.doCancel=function(){null!==Ie&&Ie.doCancel();re.prototype.doCancel.call(this)};
function tf(){re.call(this);this.Jh=100;this.Ha=!1;this.Sh="pointer";var a=new U,b=new uf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new uf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.rw=a;a=new W;b=new uf;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.Tm=a;this.j=b;a=new W;b=new uf;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.sw=a;this.o=b;this.Ih=this.Kd=this.yc=this.Wa=this.Pc=null;this.Ga=!0;this.My=new I;this.Zi=this.ii=this.Sm=null}ma(tf,re);tf.prototype.doStop=function(){this.diagram.og();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
tf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.wf(),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=yc;f=J.alloc();c.location=b.da(yc,f);J.free(f);d.angle=b.Li();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
tf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Jb,b.fromSpot=rc,b.toSpot=rc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};tf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
tf.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.zs(a.lastInput.viewPoint)}};tf.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};
tf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.kg(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(yc,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.H(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};
tf.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.iq(b).count>=c)return!1}return!0};
tf.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.Dd(b).count>=c)return!1}return!0};
tf.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};tf.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.Dd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
tf.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};tf.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 vf(this,c,b,d)};
function vf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),vf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),vf(a,b.labeledLink,c,d))?!0:!1}
tf.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!==wf){if(d===Hf){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!If(this,a,b,c,!0)}if(d===Jf){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!If(this,a,b,c,!0)}if(d===Kf)return a===b?a=!0:(d=new G,d.add(b),a=Lf(this,d,a,b,c)),!a;if(d===Mf)return!If(this,a,b,c,!1);if(d===Nf)return a===b?a=!0:(d=new G,d.add(b),a=Of(this,d,a,b,c)),!a}return!0};function If(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&&If(a,g,c,d,e)))return!0}return!1}
function Lf(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&&Lf(a,b,g,d,e)))return!0}return!1}function Of(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&&Of(a,b,h,d,e))return!0}}return!1}
na.Object.defineProperties(tf.prototype,{portGravity:{get:function(){return this.Jh},set:function(a){0<=a&&(this.Jh=a)}},isUnconnectedLinkValid:{get:function(){return this.Ha},set:function(a){this.Ha=a}},linkingCursor:{get:function(){return this.Sh},set:function(a){this.Sh=a}},temporaryLink:{get:function(){return this.rw},set:function(a){this.rw=a}},temporaryFromNode:{
get:function(){return this.Tm},set:function(a){if(this.Tm=a)this.j=a.port}},temporaryFromPort:{get:function(){return this.j},set:function(a){if(null!==this.j){var b=this.j.panel;if(null!==b){var c=b.T.indexOf(this.j);b.eb(c);b.ub(c,a)}}this.j=a}},temporaryToNode:{get:function(){return this.sw},set:function(a){if(this.sw=a)this.o=a.port}},temporaryToPort:{get:function(){return this.o},set:function(a){if(null!==
this.o){var b=this.o.panel;if(null!==b){var c=b.T.indexOf(this.o);b.eb(c);b.ub(c,a)}}this.o=a}},originalLink:{get:function(){return this.Pc},set:function(a){this.Pc=a}},originalFromNode:{get:function(){return this.Wa},set:function(a){this.Wa=a}},originalFromPort:{get:function(){return this.yc},set:function(a){this.yc=a}},originalToNode:{get:function(){return this.Kd},set:function(a){this.Kd=
a}},originalToPort:{get:function(){return this.Ih},set:function(a){this.Ih=a}},isForwards:{get:function(){return this.Ga},set:function(a){this.Ga=a}},validPortsCache:{get:function(){return this.My}},targetPort:{get:function(){return this.Sm},set:function(a){this.Sm=a}},linkValidation:{get:function(){return this.ii},set:function(a){this.ii=a}},portTargeted:{
get:function(){return this.Zi},set:function(a){this.Zi=a}}});tf.className="LinkingBaseTool";function Pf(){tf.call(this);this.name="Linking";this.M={};this.C=null;this.K=Qf;this.Kh=null}ma(Pf,tf);Pf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Ps()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Pf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Wb(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===Qf||c===Rf){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===Qf||c===Sf)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};
Pf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.wa(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.u()||(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.u()||(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)};Pf.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.stopTransaction()};
Pf.prototype.doStop=function(){tf.prototype.doStop.call(this);this.startObject=null};
Pf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,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:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.S("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.S("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.S("ChangedSelection",a.selection)}}};Pf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof U)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};
Pf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Pf.prototype.doNoLink=function(){};
na.Object.defineProperties(Pf.prototype,{archetypeLinkData:{get:function(){return this.M},set:function(a){this.M=a}},archetypeLabelNodeData:{get:function(){return this.C},set:function(a){this.C=a}},direction:{get:function(){return this.K},set:function(a){this.K=a}},startObject:{get:function(){return this.Kh},set:function(a){this.Kh=a}}});
var Qf=new D(Pf,"Either",0),Rf=new D(Pf,"ForwardsOnly",0),Sf=new D(Pf,"BackwardsOnly",0);Pf.className="LinkingTool";Pf.Either=Qf;Pf.ForwardsOnly=Rf;Pf.BackwardsOnly=Sf;
function Ne(){tf.call(this);this.name="Relinking";var a=new uf;a.figure="Diamond";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.M=a;a=new uf;a.figure="Diamond";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Kh=a;this.C=null;this.hx=new N}ma(Ne,tf);
Ne.prototype.updateAdornments=function(a){if(null!==a&&a instanceof U){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Bf()&&(c=a.hk(b),null===c&&(c=this.makeAdornment(d,!1),a.th(b,c)))}null===c&&a.Cf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.u()&&a.isVisible()&&d.actualBounds.u()&&d.Bf()&&
(c=a.hk(b),null===c?(c=this.makeAdornment(d,!0),a.th(b,c)):c.s()));null===c&&a.Cf(b)}};Ne.prototype.makeAdornment=function(a,b){var c=new we;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Ne.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Ps()||!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};
Ne.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 we&&c.adornedPart instanceof U))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.wa(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};
Ne.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Tf||c===Uf)c=Vf;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}};
Ne.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.stopTransaction()};Ne.prototype.doStop=function(){tf.prototype.doStop.call(this);this.handle=null};
Ne.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;try{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:f.defaultFromPoint=a.lastInput.documentPoint,f.Ua()),this.transactionResult=this.name,a.S("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.rq(this.hx)}finally{this.stopTool()}}};
Ne.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};Ne.prototype.doNoRelink=function(){};
function mf(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(Ne.prototype,{fromHandleArchetype:{get:function(){return this.M},set:function(a){this.M=a}},toHandleArchetype:{get:function(){return this.Kh},set:function(a){this.Kh=a}},handle:{get:function(){return this.C},set:function(a){if(null!==a&&!(a.part instanceof we))throw Error("new handle is not in an Adornment: "+a);this.C=a}}});Ne.className="RelinkingTool";
Ma("linkingTool",function(){return this.findTool("Linking")},function(a){this.Za("Linking",a,this.mouseMoveTools)});Ma("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.Za("Relinking",a,this.mouseDownTools)});
function Wf(){re.call(this);this.name="LinkReshaping";var a=new uf;a.figure="Rectangle";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";this.o=a;a=new uf;a.figure="Diamond";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.C=a;this.M=3;this.ot=this.j=null;this.ix=new J;this.Sr=new E}ma(Wf,re);Wf.prototype.wv=function(a){return a&&a.Wr&&0!==a.Wr.value?a.Wr:Xf};Wf.prototype.Im=function(a,b){a.Wr=b};
Wf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof U){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.u()&&a.isVisible()&&c.actualBounds.u()&&c.Bf()&&(b=a.hk(this.name),null===b||b.ax!==a.pointsCount||b.xx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.ax=a.pointsCount,b.xx=a.resegmentable,a.th(this.name,b)))}null===b&&a.Cf(this.name)}};
Wf.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new we;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==Yf)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.w(k.x,l.x)&&
L.w(k.y,l.y)&&(l=b.i(c-1));L.w(k.x,l.x)?(this.Im(h,Zf),h.cursor="n-resize"):L.w(k.y,l.y)&&(this.Im(h,$f),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),L.w(k.x,l.x)&&L.w(k.y,l.y)&&(k=b.i(f+1)),L.w(k.x,l.x)?(this.Im(h,Zf),h.cursor="n-resize"):L.w(k.y,l.y)&&(this.Im(h,$f),h.cursor="w-resize")):g!==f&&(this.Im(h,ag),h.cursor="move");e.add(h)}e.adornedObject=a}return e};Wf.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
Wf.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};Wf.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};
Wf.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 U){this.ot=b;a.isMouseCaptured=!0;this.wa(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.ub(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.ub(this.handle.segmentIndex+1,d);b.points=c;b.Kb();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.Sr=b.points.copy();this.isActive=!0}}};Wf.prototype.doDeactivate=function(){this.stopTransaction();this.ot=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};Wf.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Sr);this.stopTool()};Wf.prototype.getResegmentingPoint=function(){return this.handle.da(yc)};
Wf.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
Wf.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&&(bg(this,g,d,e,f,!0)||bg(this,g,d,e,f,!1))){var h=b.points.copy();bg(this,g,d,
e,f,!0)?(h.Lc(c-2,new J(g.x,(f.y+g.y)/2)),h.Lc(c+1,new J(f.x,(f.y+g.y)/2))):(h.Lc(c-2,new J((f.x+g.x)/2,g.y)),h.Lc(c+1,new J((f.x+g.x)/2,f.y)));h.eb(c);h.eb(c-1);b.points=h;b.Kb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(bg(this,d,e,f,g,!0)||bg(this,d,e,f,g,!1))&&(h=b.points.copy(),bg(this,d,e,f,g,!0)?(h.Lc(c-1,new J(d.x,(d.y+g.y)/2)),h.Lc(c+2,new J(g.x,(d.y+g.y)/2))):(h.Lc(c-1,new J((d.x+g.x)/2,d.y)),h.Lc(c+2,new J((d.x+g.x)/2,g.y))),
h.eb(c+1),h.eb(c),b.points=h,b.Kb())}}else g=J.alloc(),L.Eh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.tf(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.eb(c),b.points=d,b.Kb()),J.free(g)}a.Pa();this.transactionResult=this.name;a.S("LinkReshaped",this.adornedLink,this.Sr)}this.stopTool()};
function bg(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}
Wf.prototype.reshape=function(a){var b=this.adornedLink;b.Hh();var c=this.handle.segmentIndex,d=this.wv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===Zf?(b.L(c,b.i(c-1).x,a.y),b.L(c+1,b.i(c+2).x,a.y)):d===$f&&(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===Zf?(b.L(c-1,b.i(c-2).x,a.y),b.L(c,b.i(c+1).x,a.y)):d===$f&&(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.w(f.x,
e.x)&&L.w(e.y,g.y)?(L.w(f.x,b.i(d-2).x)&&!L.w(f.y,b.i(d-2).y)?(b.l(d,a.x,f.y),c++,d++):b.L(d-1,a.x,f.y),L.w(g.y,b.i(d+2).y)&&!L.w(g.x,b.i(d+2).x)?b.l(d+1,g.x,a.y):b.L(d+1,g.x,a.y)):L.w(f.y,e.y)&&L.w(e.x,g.x)?(L.w(f.y,b.i(d-2).y)&&!L.w(f.x,b.i(d-2).x)?(b.l(d,f.x,a.y),c++,d++):b.L(d-1,f.x,a.y),L.w(g.x,b.i(d+2).x)&&!L.w(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.L(d+1,a.x,g.y)):L.w(f.x,e.x)&&L.w(e.x,g.x)?(L.w(f.x,b.i(d-2).x)&&!L.w(f.y,b.i(d-2).y)?(b.l(d,a.x,f.y),c++,d++):b.L(d-1,a.x,f.y),L.w(g.x,b.i(d+2).x)&&
!L.w(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.L(d+1,a.x,g.y)):L.w(f.y,e.y)&&L.w(e.y,g.y)&&(L.w(f.y,b.i(d-2).y)&&!L.w(f.x,b.i(d-2).x)?(b.l(d,f.x,a.y),c++,d++):b.L(d-1,f.x,a.y),L.w(g.y,b.i(d+2).y)&&!L.w(g.x,b.i(d+2).x)?b.l(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).wc()&&(f=e.da(yc,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).wc()&&(c=e.da(yc,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.rf()};Wf.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.wv(this.handle)){case ag:return a;case Zf:return new J(b.i(c).x,a.y);case $f:return new J(a.x,b.i(c).y);default:case Xf:return b.i(c)}};
na.Object.defineProperties(Wf.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},midHandleArchetype:{get:function(){return this.C},set:function(a){this.C=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof we))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedLink:{get:function(){return this.ot}},
resegmentingDistance:{get:function(){return this.M},set:function(a){this.M=a}},originalPoint:{get:function(){return this.ix}},originalPoints:{get:function(){return this.Sr}}});Wf.prototype.setReshapingBehavior=Wf.prototype.Im;Wf.prototype.getReshapingBehavior=Wf.prototype.wv;var Xf=new D(Wf,"None",0),$f=new D(Wf,"Horizontal",1),Zf=new D(Wf,"Vertical",2),ag=new D(Wf,"All",3);Wf.className="LinkReshapingTool";
Wf.None=Xf;Wf.Horizontal=$f;Wf.Vertical=Zf;Wf.All=ag;Ma("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.Za("LinkReshaping",a,this.mouseDownTools)});
function cg(){re.call(this);this.name="Resizing";this.Uf=(new M(1,1)).freeze();this.Tf=(new M(9999,9999)).freeze();this.tg=(new M(NaN,NaN)).freeze();this.C=!1;this.M=!0;this.ie=null;var a=new uf;a.alignmentFocus=yc;a.figure="Rectangle";a.desiredSize=Kb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Rr=new J;this.gx=new M;this.Uo=new J;this.Nt=new M(0,0);this.Mt=new M(Infinity,Infinity);this.Lt=new M(1,1)}ma(cg,re);
cg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof U)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.hk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.u()&&a.isVisible()&&b.actualBounds.u()&&b.Bf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Li();lg(a)&&this.updateResizeHandles(c,b);a.th(this.name,c);return}}}a.Cf(this.name)}};
cg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new we;b.type=X.Spot;b.locationSpot=yc;var c=new mg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,sc));b.add(this.makeHandle(a,wc));b.add(this.makeHandle(a,Cc));b.add(this.makeHandle(a,Ac));b.add(this.makeHandle(a,cd));b.add(this.makeHandle(a,ed));b.add(this.makeHandle(a,fd));b.add(this.makeHandle(a,dd))}else if(ng(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
cg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
cg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Lb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.wc()&&(c=yc);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)};cg.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};
cg.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.nc(),this.wa(this.name),this.Rr.set(this.adornedObject.da(this.handle.alignment.Jv())),this.Uo.set(this.adornedObject.part.location),this.gx.set(this.adornedObject.desiredSize),this.Lt=this.computeCellSize(),this.Nt=
this.computeMinSize(),this.Mt=this.computeMaxSize(),this.isActive=!0))};cg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.ie=this.handle=null;this.isActive=a.isMouseCaptured=!1};cg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
cg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Nt,c=this.Mt,d=this.Lt,e=this.adornedObject.Hs(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.ed();J.free(e)}};
cg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Nt,c=this.Mt,d=this.Lt,e=this.adornedObject.Hs(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.Pa();this.transactionResult=this.name;a.S("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
cg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Sa();c=c.da(this.handle.alignment.Jv());if(a instanceof hf){var d=new E;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Ee;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.ed()}};
cg.prototype.computeResize=function(a,b,c,d,e,f){b.wc()&&(b=yc);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.jq(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};cg.prototype.computeReshape=function(){var a=og;this.adornedObject instanceof uf&&(a=pg(this.adornedObject));return!(a===qg||this.diagram.lastInput.shift)};
cg.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};cg.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};
cg.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(cg.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof we))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.ie},set:function(a){if(null!==a&&a.part instanceof we)throw Error("new handle must not be in an Adornment: "+
a);this.ie=a}},minSize:{get:function(){return this.Uf},set:function(a){if(!this.Uf.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Uf.h(b,a)}}},maxSize:{get:function(){return this.Tf},set:function(a){if(!this.Tf.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.Tf.h(b,a)}}},cellSize:{get:function(){return this.tg},set:function(a){this.tg.A(a)||this.tg.assign(a)}},
isGridSnapEnabled:{get:function(){return this.C},set:function(a){this.C=a}},dragsMembers:{get:function(){return this.M},set:function(a){this.M=a}},oppositePoint:{get:function(){return this.Rr},set:function(a){this.Rr.A(a)||this.Rr.assign(a)}},originalDesiredSize:{get:function(){return this.gx}},originalLocation:{get:function(){return this.Uo}}});
cg.className="ResizingTool";Ma("resizingTool",function(){return this.findTool("Resizing")},function(a){this.Za("Resizing",a,this.mouseDownTools)});function rg(){re.call(this);this.name="Rotating";this.Ha=45;this.Ga=2;this.Uo=new J;this.ie=null;var a=new uf;a.figure="Ellipse";a.desiredSize=Lb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.ex=0;this.Xr=new J(NaN,NaN);this.C=0;this.M=50}ma(rg,re);
rg.prototype.updateAdornments=function(a){if(null!==a){if(a.Dh()){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.u()&&a.isVisible()&&b.actualBounds.u()&&b.Bf())){var c=a.hk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Li();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.th(this.name,c);return}}a.Cf(this.name)}};
rg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new we;b.type=X.Position;b.locationSpot=yc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(ng(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};rg.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};
rg.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.wa(this.name),this.ex=this.adornedObject.angle,this.Xr=this.computeRotationPoint(this.adornedObject),this.Uo=this.adornedObject.part.location.copy(),this.isActive=!0)};
rg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.hb()?a.da(b.rotationSpot):a===b||a===c?c.da(b.locationSpot):a.da(yc)};
rg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.u()||(b=this.computeRotationPoint(a));b=a.Hs(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)};rg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.ie=this.handle=null;this.Xr=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};rg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};rg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
rg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Pa();this.transactionResult=this.name;a.S("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
rg.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Sa();var c=b.locationObject,d=b.rotateObject;if(c===d||c.mg(d))c=this.Uo.copy(),b.location=c.ge(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.ed()}};
rg.prototype.computeRotate=function(a){a=this.rotationPoint.Oa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Li());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(rg.prototype,{handleArchetype:{get:function(){return this.o},set:function(a){this.o=a}},handle:{get:function(){return this.j},set:function(a){if(null!==a&&!(a.part instanceof we))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{get:function(){return this.ie},set:function(a){if(null!==a&&a.part instanceof we)throw Error("new handle must not be in an Adornment: "+
a);this.ie=a}},snapAngleMultiple:{get:function(){return this.Ha},set:function(a){this.Ha=a}},snapAngleEpsilon:{get:function(){return this.Ga},set:function(a){this.Ga=a}},originalAngle:{get:function(){return this.ex}},rotationPoint:{get:function(){return this.Xr},set:function(a){this.Xr=a.copy()}},handleAngle:{get:function(){return this.C},set:function(a){this.C=
a}},handleDistance:{get:function(){return this.M},set:function(a){this.M=a}}});rg.className="RotatingTool";Ma("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.Za("Rotating",a,this.mouseDownTools)});function sg(){re.call(this);this.name="ClickSelecting"}ma(sg,re);sg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};
sg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};sg.className="ClickSelectingTool";function tg(){re.call(this);this.name="Action";this.Dk=null}ma(tg,re);
tg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Wb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Dk=c;a.Tk=a.Wb(b.documentPoint,null,null);return!0}return!1};tg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Dk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
tg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Dk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};tg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Dk;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()};
tg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Dk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};tg.prototype.doStop=function(){this.Dk=null};tg.className="ActionTool";function ug(){re.call(this);this.name="ClickCreating";this.mj=null;this.o=!0;this.j=!1;this.Nw=new J(0,0)}ma(ug,re);
ug.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.Nw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Nw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.im(a.lastInput.documentPoint,!0)?!1:!0};
ug.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
ug.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.S("ChangingSelection",b.selection);this.wa(this.name);if(c instanceof V)c.Jc()&&(ng(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);za(e)&&(b.model.nf(e),d=b.vc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&vg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Pa();this.transactionResult=
this.name;b.S("PartCreated",d)}finally{this.stopTransaction(),b.S("ChangedSelection",b.selection)}return d};na.Object.defineProperties(ug.prototype,{archetypeNodeData:{get:function(){return this.mj},set:function(a){this.mj=a}},isDoubleClick:{get:function(){return this.o},set:function(a){this.o=a}},isGridSnapEnabled:{get:function(){return this.j},set:function(a){this.j=a}}});ug.className="ClickCreatingTool";
function wg(){re.call(this);this.name="DragSelecting";this.Zk=175;this.o=!1;var a=new V;a.layerName="Tool";a.selectable=!1;var b=new uf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.j=a}ma(wg,re);
wg.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.im(b.documentPoint,!0))?!1:!0};wg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
wg.prototype.doDeactivate=function(){var a=this.diagram;a.og();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};wg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.Ya("SHAPE");null===c&&(c=this.box.nb());var d=M.alloc().h(b.width,b.height);c.desiredSize=d;this.box.Gm(b.x,b.y,!1);M.free(d);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.zs(a.lastInput.viewPoint)}};
wg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.S("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.S("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};wg.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
wg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Vx(a,this.isPartialInclusion);if(Sa?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(wg.prototype,{delay:{get:function(){return this.Zk},set:function(a){this.Zk=a}},isPartialInclusion:{get:function(){return this.o},set:function(a){this.o=a}},box:{get:function(){return this.j},set:function(a){this.j=a}}});wg.className="DragSelectingTool";
function xg(){re.call(this);this.name="Panning";this.vu=new J;this.bz=new J;this.sg=!1;var a=this;this.nx=function(){var b=a.diagram;null!==b&&b.removeEventListener(x.document,"scroll",a.nx,!1);a.stopTool()}}ma(xg,re);xg.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};
xg.prototype.doActivate=function(){var a=this.diagram;this.sg?(a.lastInput.bubbles=!0,a.addEventListener(x.document,"scroll",this.nx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.vu.assign(a.position));this.isActive=!0};xg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};xg.prototype.doCancel=function(){var a=this.diagram;a.position=this.vu;a.isMouseCaptured=!1;this.stopTool()};xg.prototype.doMouseMove=function(){this.move()};
xg.prototype.doMouseUp=function(){this.move();this.stopTool()};xg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.sg)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.bz.h(e,c)}};
na.Object.defineProperties(xg.prototype,{bubbles:{get:function(){return this.sg},set:function(a){this.sg=a}},originalPosition:{get:function(){return this.vu}}});xg.className="PanningTool";Ma("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.Za("ClickCreating",a,this.mouseUpTools)});Ma("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.Za("ClickSelecting",a,this.mouseUpTools)});
Ma("panningTool",function(){return this.findTool("Panning")},function(a){this.Za("Panning",a,this.mouseMoveTools)});Ma("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.Za("DragSelecting",a,this.mouseMoveTools)});Ma("actionTool",function(){return this.findTool("Action")},function(a){this.Za("Action",a,this.mouseDownTools)});function Be(){this.M=this.C=this.j=this.o=null}
na.Object.defineProperties(Be.prototype,{mainElement:{get:function(){return this.C},set:function(a){this.C=a}},show:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},hide:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}},valueFunction:{get:function(){return this.M},set:function(a){this.M=a}}});Be.className="HTMLInfo";
function yg(a,b,c){this.text=a;this.Jx=b;this.visible=c}yg.className="ContextMenuButtonInfo";function zg(){re.call(this);this.name="ContextMenu";this.o=this.Ct=this.j=null;this.Zw=new J;this.Et=null;this.$t=!1;var a=this;this.Su=function(){a.stopTool()}}ma(zg,re);
function Ag(a){var b=new Be;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Bg=b;a.Su=function(){a.stopTool()};b=va("div");var c=va("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=va("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",Cg,!1),d.addEventListener(b,"selectstart",
Cg,!1),d.addEventListener(c,"contextmenu",Cg,!1));b.className="goCXforeground";c.className="goCXbackground";x.document.body&&(x.document.body.appendChild(b),x.document.body.appendChild(c));Dg=b;Eg=c;Fg=!0}function Cg(a){a.preventDefault();return!1}
zg.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};zg.prototype.doStart=function(){this.Zw.set(this.diagram.firstInput.documentPoint)};zg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
zg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof T||(a instanceof Y?d=a:d=b.Wb(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};zg.prototype.doActivate=function(){};
zg.prototype.doMouseDown=function(){re.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof we){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Gg(this)};
zg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof we){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Gg(this)};
function Gg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Be)){var d=b.Wb(b.lastInput.documentPoint,null,null);null!==d&&d.mg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Hg(a,!0),a.isActive||a.stopTool())}
function Hg(a,b,c){void 0===c&&(c=null);if(!a.$t&&(a.$t=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.$t=!1,!b)){a.isActive=!0;b=Bg;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 we&&!a.currentContextMenu.visible&&a.stopTool()}}
zg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
zg.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof we){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.Sa();this.positionContextMenu(a,b)}else a instanceof Be&&a.show(b,c,this);this.currentContextMenu=a};
zg.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}};
zg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof we?(a.remove(b),null!==this.Ct&&this.Ct.Cf(b.category),b.data=null,b.adornedObject=null):b instanceof Be&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Ig(a){var b=new E;b.add(new yg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new yg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new yg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new yg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new yg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new yg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new yg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new yg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new yg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new yg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new yg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new yg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new yg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
zg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Et&&(this.Et=Ig(this));Dg.innerHTML="";Eg.addEventListener("pointerdown",this.Su,!1);var b=this,c=va("ul");c.className="goCXul";Dg.appendChild(c);c.innerHTML="";for(var d=this.Et.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Jx&&("function"!==typeof f||f(a))){f=va("li");f.className="goCXli";var g=va("a");g.className="goCXa";g.href="#";g.Py=e.Jx;g.addEventListener("pointerdown",function(c){this.Py(a);
b.stopTool();c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Dg.style.display="block";Eg.style.display="block"};zg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Bg){Dg.style.display="none";Eg.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Eg,"pointerdown",this.Su,!1);this.currentContextMenu=null}};
na.Object.defineProperties(zg.prototype,{currentContextMenu:{get:function(){return this.j},set:function(a){this.j=a;this.Ct=a instanceof we?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){!1===Fg&&null===Bg&&Jg&&Ag(this);return Bg},set:function(a){null===a&&(Fg=!0);Bg=a}},currentObject:{get:function(){return this.o},set:function(a){this.o=a}},mouseDownPoint:{get:function(){return this.Zw}}});
var Bg=null,Fg=!1,Eg=null,Dg=null;zg.className="ContextMenuTool";Ma("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.Za("ContextMenu",a,this.mouseUpTools)});function Kg(){re.call(this);this.name="TextEditing";this.mh=new Lg;this.Ha=null;this.Ga=Mg;this.vi=null;this.ja=Ng;this.C=1;this.M=!0;this.o=null;this.j=new Be;this.Ft=null;Og(this,this.j)}ma(Kg,re);
function Og(a,b){if(Jg){var c=va("textarea");a.Ft=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.py(this.value);this.style.width=20+b.measuredBounds.width*this.ZA+"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(Pg)):"Tab"===c?(a.acceptText(Qg),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==Ng){var b=a.Ft;a.ja===Rg&&(a.ja=Sg);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==Ng){var b=a.Ft;"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 Lg&&f instanceof Kg)if(f.state===Tg)c.style.border="3px solid red",c.focus();else{var d=a.da(yc),e=b.position,k=b.scale,l=a.wf()*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;e=a.verticalAlignment;k=(a.lineHeight+a.spacingAbove+a.spacingBelow)*a.lineCount*l;n=e.y*n-e.y*k+e.offsetY-(.5*n-.5*k)-k/2;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|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.ZA=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)}}}
Kg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||Ug&&Ug!==this&&(Ug.acceptText(Vg),Ug&&Ug!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Wb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Lg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Mg&&!b.isSelected||this.starting===Wg&&2>a.lastInput.clickCount?!1:!0};Kg.prototype.doStart=function(){Ug=this;null!==this.textBlock&&this.doActivate()};
Kg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Wb(a.lastInput.documentPoint));if(null!==b&&b instanceof Lg&&(this.textBlock=b,null!==b.part)){a.animationManager.nc();this.isActive=!0;this.ja=Rg;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.mh=this.textBlock.copy();var d=new N(this.textBlock.da(sc),this.textBlock.da(Cc));a.Vv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Kg.prototype.doCancel=function(){this.stopTool()};
Kg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Kg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Vg)};Kg.prototype.acceptText=function(a){switch(a){case Vg:if(this.ja===Xg)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.ja===Rg||this.ja===Tg||this.ja===Sg)this.ja=Yg,Zg(this);break;case $g:case Pg:case Qg:if(Pg!==a||!0!==this.textBlock.isMultiline)if(this.ja===Rg||this.ja===Tg||this.ja===Sg)this.ja=Yg,Zg(this)}};
function Zg(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.wa(a.name),a.ja=Xg,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.S("TextEdited",b,e),a.stopTransaction(),a.stopTool(),null!==c&&c.doFocus()):(a.ja=Tg,a.doError(e,f))}}
Kg.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)};Kg.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Kg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.ja=Ng,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.textBlock=null,this.isActive=!1)};Kg.prototype.doStop=function(){Ug=null};
Kg.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};Kg.prototype.py=function(a){var b=this.mh;b.text=a;b.measure(this.textBlock.di,Infinity);return b};
na.Object.defineProperties(Kg.prototype,{textBlock:{get:function(){return this.Ha},set:function(a){this.Ha=a}},currentTextEditor:{get:function(){return this.o},set:function(a){this.o=a}},defaultTextEditor:{get:function(){return this.j},set:function(a){this.j=a}},starting:{get:function(){return this.Ga},set:function(a){this.Ga=a}},textValidation:{get:function(){return this.vi},
set:function(a){this.vi=a}},minimumEditorScale:{get:function(){return this.C},set:function(a){this.C=a}},selectsTextOnActivate:{get:function(){return this.M},set:function(a){this.M=a}},state:{get:function(){return this.ja},set:function(a){this.ja!==a&&(this.ja=a)}}});Kg.prototype.measureTemporaryTextBlock=Kg.prototype.py;
var $g=new D(Kg,"LostFocus",0),Vg=new D(Kg,"MouseDown",1),Qg=new D(Kg,"Tab",2),Pg=new D(Kg,"Enter",3),ah=new D(Kg,"SingleClick",0),Mg=new D(Kg,"SingleClickSelected",1),Wg=new D(Kg,"DoubleClick",2),Ng=new D(Kg,"StateNone",0),Rg=new D(Kg,"StateActive",1),Sg=new D(Kg,"StateEditing",2),Yg=new D(Kg,"StateValidating",3),Tg=new D(Kg,"StateInvalid",4),Xg=new D(Kg,"StateValidated",5),Ug=null;Kg.className="TextEditingTool";Kg.LostFocus=$g;Kg.MouseDown=Vg;Kg.Tab=Qg;Kg.Enter=Pg;Kg.SingleClick=ah;
Kg.SingleClickSelected=Mg;Kg.DoubleClick=Wg;Kg.StateNone=Ng;Kg.StateActive=Rg;Kg.StateEditing=Sg;Kg.StateValidating=Yg;Kg.StateInvalid=Tg;Kg.StateValidated=Xg;Ma("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.Za("TextEditing",a,this.mouseUpTools)});
function bh(a){ch||(dh(),ch=!0);this.F=se;this.gl=this.rb=this.Dr=this.hc=!1;this.ux=!0;this.hl=eh;this.dn=!1;this.Zh=this.td=!0;this.Fg=600;this.Dw=this.sx=!1;this.Md=new G;this.Pd=new fh;this.Pd.Ld=this;this.$i=new G;this.Ou=new G;this.qs=new G;this.Il=new G;a&&Object.assign(this,a)}bh.prototype.Ke=function(a){this.F=a};bh.prototype.canStart=function(){return!0};function gh(a,b){a.td&&a.canStart(b)&&(a.Md.add(b),a.defaultAnimation.isAnimating&&a.nc(),hh(a.F),a.rb=!0)}
function ih(a){if(a.td&&a.rb){var b=a.Pd,c=a.F,d=a.Md.contains("Model");d&&(a.gl=!0,a.hl===eh?(b.isViewportUnconstrained=!0,b.jc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.hl===jh&&b.jc.clear(),a.ux=a.hl===kh&&c.Cu.A(c.ka)?!0:!1,c.S("InitialAnimationStarting",a));d&&!a.Zh||0===b.jc.count?(a.Md.clear(),a.rb=!1,b.jc.clear(),lh(b,c),a.gl=!1,c.N()):(a.Md.clear(),c.eg=!1,d=b.jc.get(c),c.autoScale!==mh&&null!==d&&(delete d.start.scale,delete d.end.scale),
x.requestAnimationFrame(function(){!1===a.rb||b.hc||(c.Fe("temporaryPixelRatio")&&Ke(c),nh(c),a.rb=!1,b.start(),oh(a),c.Pa(),zh(b,0),rf(c,!0),Ah(a),c.S("AnimationStarting",a))}))}}function Bh(a){return a.Md.contains("Trigger")&&1===a.Md.count}function Ch(a,b,c,d){a.isTicking||Bh(a)||b instanceof U&&(null!==b.fromNode||null!==b.toNode)||a.Pd.add(b,"position",c,d,!1)}t=bh.prototype;t.Ys=function(a){return this.Pd.Ys(a)};t.Cv=function(a){return this.Pd.Cv(a)};
function Dh(a,b){function c(){0<e.qs.count&&(d.addAll(e.qs),e.qs.clear(),e.hc=!0);if(!1!==e.hc&&0!==d.count){e.Ou.addAll(d);for(var a=e.Ou.iterator;a.next();){var b=a.value;if(!1!==b.hc){a:if(0<b.Zl.count)var h=!0;else{for(h=b.jc.iterator;h.next();){var k=h.key;if(k instanceof Y&&null!==k.diagram||k instanceof T){h=!0;break a}}h=!1}h?Eh(b,!1):b.ol=!0}}e.Ou.clear();oh(e);rf(e.F);Ah(e);x.requestAnimationFrame(c)}}var d=a.$i,e=a;a.hc?a.qs.add(b):(a.hc=!0,d.add(b),x.requestAnimationFrame(function(){c()}))}
function Fh(a){for(a=a.$i.iterator;a.next();)a.value.ol=!1}function oh(a){if(!a.Dr){var b=a.F;a.sx=b.skipsUndoManager;a.Dw=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.Dr=!0}}function Ah(a){var b=a.F;b.skipsUndoManager=a.sx;b.skipsModelSourceBindings=a.Dw;a.Dr=!1}
t.nc=function(a){var b=this.Pd;!0===this.rb&&(this.gl=this.rb=!1,this.Md.clear(),0<b.jc.count&&this.F.Fb());if(this.hc){if(b.gm(!0),b.jc.clear(),lh(b,null),!0===a)for(a=this.$i.xa(),b=0;b<a.length;b++)a[b].gm(!0)}else b.jc.clear(),lh(b,this.F)};t.gm=function(a){a===this.defaultAnimation&&this.defaultAnimation.jc.clear();this.$i.remove(a);0===this.$i.count&&(this.hc=!1,this.F.Fb());a===this.defaultAnimation&&(this.defaultAnimation.jc.clear(),this.F.S("AnimationFinished",this))};
t.Yj=function(a,b){this.rb&&(this.Md.contains("Expand Tree")||this.Md.contains("Expand SubGraph"))&&(this.Pd.Yj(a,b),Gh(this,a))};t.Wj=function(a,b){this.rb&&(this.Md.contains("Collapse Tree")||this.Md.contains("Collapse SubGraph"))&&(this.Pd.Wj(a,b),Hh(this.Pd,b,"position",b.position,b.position),Gh(this,a))};function Ih(a,b,c){!a.rb||b.A(c)||Bh(a)||(a.F.Pi||(b=c.copy()),Hh(a.Pd,a.F,"position",b,c))}
function Gh(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.cf=c.points.copy();a.Il.add(c)}}function Jh(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 dh(){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 I;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.Gm(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.Gm(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.Gm(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.Gm(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=Jh(b,e,g,h,f)});b.add("stroke",function(a,b,e,f,g,h){a.stroke=Jh(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=Jh(b,e,g,h,f)});b.add("areaBackground",function(a,b,e,f,g,h){a.areaBackground=
Jh(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)});Kh=b}
na.Object.defineProperties(bh.prototype,{animationReasons:{get:function(){return this.Md}},isEnabled:{get:function(){return this.td},set:function(a){(this.td=a)&&this.$i.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{get:function(){return this.Fg},set:function(a){1>a&&xa(a,">= 1",bh,"duration");this.Fg=a}},isAnimating:{get:function(){return this.hc}},
isTicking:{get:function(){return this.Dr}},isInitial:{get:function(){return this.Zh},set:function(a){this.Zh=a}},defaultAnimation:{get:function(){return this.Pd}},activeAnimations:{get:function(){return this.$i}},initialAnimationStyle:{get:function(){return this.hl},set:function(a){this.hl=a}}});bh.prototype.stopAnimation=bh.prototype.nc;
var Kh=null,ch=!1,eh=new D(bh,"Default",1),kh=new D(bh,"AnimateLocations",2),jh=new D(bh,"None",3);bh.className="AnimationManager";bh.defineAnimationEffect=function(a,b){ch||(dh(),ch=!0);Kh.add(a,b)};bh.Default=eh;bh.AnimateLocations=kh;bh.None=jh;
function fh(a){this.Uu=this.qx=this.Ld=this.F=null;this.ol=this.hc=this.j=!1;this.In=this.zd=0;this.ar=this.Kt=Lh;this.nl=this.jp=!1;this.Bu=1;this.zu=0;this.sd=this.Fg=NaN;this.Hw=0;this.Jn=null;this.o=pb;this.jc=new I;this.ru=new I;this.Zl=new G;this.su=new G;this.Ew=Mh;a&&Object.assign(this,a)}fh.prototype.suspend=function(){this.ol=!0};fh.prototype.advanceTo=function(a,b){b&&(this.ol=!1);this.jp&&a>=this.sd&&(this.nl=!0,a-=this.sd);this.Hw=a;Eh(this,!0);oh(this.Ld);rf(this.F);Ah(this.Ld);this.F.redraw()};
function lh(a,b){a.ru.clear();a.nl=!1;a.zu=0;a.sd=NaN;0<a.Zl.count&&a.Zl.clear();0<a.su.count&&a.su.clear();if(null!==b)for(a=b.links;a.next();)a.value.cf=null}t=fh.prototype;
t.start=function(){if(0===this.jc.count||this.hc)return this;for(var a=this.F,b=this.jc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof hf&&null!==e.placeholder){var f=e.placeholder;e=f.da(sc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof T?a=d:d instanceof Y&&(a=d.diagram))}if(null!==a)this.F=a,this.Ld=a.animationManager;else return this;b=this.Ld;if(!1===b.isEnabled)return this;this.sd=
isNaN(this.Fg)?b.duration:this.Fg;this.ar=this.Kt;b.gl&&b.hl===eh&&this===b.defaultAnimation&&(this.ar=Nh,this.sd=isNaN(this.Fg)?600===b.duration?900:b.duration:this.Fg);this.Ew=a.scrollMode;this.isViewportUnconstrained&&(a.Sj=Oh);oh(b);this.Zl.each(function(b){b.data=null;a.add(b)});Ah(b);this.hc=!0;this.zd=+new Date;this.In=this.zd+this.sd;Dh(b,this);return this};t.kz=function(a,b){if(!a.Jc())return this;this.Zl.add(a);this.F=b;return this};
t.add=function(a,b,c,d,e){if("position"===b&&c.A(d))return this;null===this.F&&(a instanceof T?this.F=a:a instanceof Y&&null!==a.diagram&&(this.F=a.diagram));if(a instanceof V){if(!a.isAnimated)return this;"position"===b&&(b="position:part")}Hh(this,a,b,c,d,e);return this};
function Hh(a,b,c,d,e,f){var g=a.jc;b instanceof T&&"position"===c&&(c="position:diagram");if("fill"===c||"stroke"===c||"background"===c||"areaBackground"===c)Ph(d),Qh(),d=[Rh.j,Rh.C,Rh.o,Rh.M],Ph(e),Qh(),e=[Rh.j,Rh.C,Rh.o,Rh.M];if(g.contains(b)){var h=g.H(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=Sh(d));l[c]=Sh(e)}else k={},l={},k[c]=Sh(d),l[c]=Sh(e),h=k.position,b instanceof Y&&h instanceof J&&!h.u()&&b.diagram.animationManager.Md.contains("Expand SubGraph")&&h.assign(l.position),h=new Th(k,
l,f),g.add(b,h);g=k[c];g instanceof J&&!g.u()&&g.assign(a.o);f&&0===c.indexOf("position:")&&b instanceof V?h.nv.location=Sh(b.location):f&&(h.nv[c]=Sh(d))}function Sh(a){return a instanceof J?a.copy():a instanceof M?a.copy():a}t.Ys=function(a){if(!this.hc)return!1;a=this.jc.H(a);return null!==a&&a.Pv};t.Cv=function(a){if(!this.hc)return!1;a=this.jc.H(a);return null!==a&&(a.start.position||a.start.location)};
function Eh(a,b){if(!a.ol||b){var c=a.Ld;if(!1!==a.hc){var d=+new Date,e=d>a.In?a.sd:d-a.zd;b&&(e=a.Hw,e<a.sd?(a.zd=+new Date-e,a.In=a.zd+a.sd):e=a.sd);oh(c);zh(a,e);rf(a.F,!0);Ah(c);d>a.In&&(a.jp&&!a.nl?(a.zd=+new Date,a.In=a.zd+a.sd,a.nl=!0):a.gm(!1))}}}
function zh(a,b){for(var c=a.sd,d=a.jc.iterator,e=a.nl;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=Kh,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.ar,b,c,a)}}}t.stop=function(){if(!this.hc)return this;this.gm(!0);return this};
t.gm=function(a){null!==this.Uu&&this.Uu.qp.remove(this.qx);if(this.hc){var b=this.F,c=this.Ld;this.ol=this.hc=c.gl=!1;oh(c);for(var d=this.jc,e=this.Zl.iterator;e.next();)b.remove(e.value);for(e=this.su.iterator;e.next();)e.value.s();e=this.jp;d=d.iterator;for(var f=Kh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.nv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.hv||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:
h.hv?k[n]:l[n],this.ar,this.sd,this.sd,this)}h.hv&&void 0!==m.location&&g instanceof V&&(g.location=m.location);h.Pv&&g instanceof V&&g.Nb(!1)}b.Ts.clear();Te(b,!1);b.Pa();b.N();rf(b,!0);if(c.defaultAnimation===this){for(n=c.Il.iterator;n.next();)e=n.value,null!==e.cf&&(e.points=e.cf,e.cf=null);c.Il.clear()}this.isViewportUnconstrained&&(b.scrollMode=this.Ew);Ah(c);this.zu++;!a&&this.Bu>this.zu?(this.nl=!1,this.start()):(this.Jn&&this.Jn(this),lh(this,null),c.gm(this),b.Fb())}};
t.Yj=function(a,b){var c=b.actualBounds,d=null;b instanceof hf&&(d=b.placeholder);null!==d?(c=d.da(sc),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 hf)for(a=a.memberParts;a.next();)d=a.value,d instanceof W&&this.Yj(d,b)};
t.Wj=function(a,b){if(a.isVisible()){var c=null;b instanceof hf&&(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.jc;c.contains(a)&&(c.H(a).Pv=!0);if(a instanceof hf)for(a=a.memberParts;a.next();)c=a.value,c instanceof W&&this.Wj(c,b)}};t.iA=function(a){var b=this.ru.get(a);null===b&&(b={},this.ru.add(a,b));return b};
na.Object.defineProperties(fh.prototype,{duration:{get:function(){return this.Fg},set:function(a){1>a&&xa(a,">= 1",fh,"duration");this.Fg=a}},reversible:{get:function(){return this.jp},set:function(a){this.jp=a}},runCount:{get:function(){return this.Bu},set:function(a){0<a?this.Bu=a:C("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.Jn},
set:function(a){this.Jn!==a&&(this.Jn=a)}},easing:{get:function(){return this.Kt},set:function(a){this.Kt=a}},isViewportUnconstrained:{get:function(){return this.j},set:function(a){this.j=a}},isAnimating:{get:function(){return this.hc}}});fh.prototype.getTemporaryState=fh.prototype.iA;fh.prototype.stop=fh.prototype.stop;fh.prototype.add=fh.prototype.add;fh.prototype.addTemporaryPart=fh.prototype.kz;
function Lh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function Nh(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}fh.className="Animation";fh.EaseLinear=function(a,b,c,d){return c*a/d+b};fh.EaseInOutQuad=Lh;fh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};fh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};fh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};fh.EaseOutExpo=Nh;
function Th(a,b,c){this.start=a;this.end=b;this.nv={};this.hv=c;this.Pv=!1}Th.className="AnimationState";function Uh(a,b,c){this.md=null;this.bf=a;this.Hp=c||Vh;this.Ik=null;void 0!==b&&(this.Ik=b,void 0===c&&(this.Hp=Wh))}Uh.prototype.copy=function(){var a=new Uh(this.bf);a.Hp=this.Hp;var b=this.Ik;if(null!==b){var c={};void 0!==b.duration&&(c.duration=b.duration);void 0!==b.finished&&(c.finished=b.finished);void 0!==b.easing&&(c.easing=b.easing);a.Ik=c}return a};
function Xh(a,b){a=a.Ik;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}na.Object.defineProperties(Uh.prototype,{propertyName:{get:function(){return this.bf},set:function(a){this.bf=a}},animationSettings:{get:function(){return this.Ik},set:function(a){this.Ik=a}},startCondition:{get:function(){return this.Hp},set:function(a){this.Hp=a}}});
var Vh=new D(Uh,"Default",1),Wh=new D(Uh,"Immediate",2),Yh=new D(Uh,"Bundled",3);Uh.className="AnimationTrigger";Uh.Default=Vh;Uh.Immediate=Wh;Uh.Bundled=Yh;function Zh(a){Ta(this);this.F=null;this.Fa=new E;this.na="";this.lb=1;this.o=!1;this.j=this.oi=this.C=this.jj=this.ij=this.hj=this.gj=this.ej=this.fj=this.dj=this.lj=this.cj=this.kj=this.bj=this.aj=!0;this.Vo=[];a&&Object.assign(this,a)}t=Zh.prototype;t.clear=function(){this.Fa.clear();this.Vo.length=0};t.Ke=function(a){this.F=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 hf?e++:k instanceof W?d++:k instanceof U?f++:k instanceof we?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&&gb(d)&&(h+=" #"+gb(d)),c instanceof W?h+=" "+
Ka(d):c instanceof U&&(h+=" "+Ka(c.fromNode)+" "+Ka(c.toNode));return b+" "+this.Fa.count+": "+h};t.Wb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.oi)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(d=!0);for(var e=J.alloc(),f=this.Fa.m,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==lg(h))&&h.isVisible()&&(e.assign(a),Ab(e,h.de),h=h.Wb(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.Ii=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.oi)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.$(a)&&(e=!0);for(var f=J.alloc(),g=this.Fa.m,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==lg(k))&&k.isVisible()){f.assign(a);Ab(f,k.de);var l=k;k.Ii(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
t.vf=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.oi)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.De(a)&&(f=!0);for(var g=this.Fa.m,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==lg(k))&&k.isVisible()){var l=k;k.vf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.sv=function(a,b,c,d,e,f,g){if(!1===this.oi)return e;for(var h=this.Fa.m,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==lg(l))&&f(l)&&l.isVisible()){var m=l;l.vf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.kg=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.oi)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.m,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==lg(n))&&n.isVisible()){h.assign(a);Ab(h,n.de);k.h(a.x+b,a.y);Ab(k,n.de);var p=n;n.kg(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.Jd=function(a,b){if(this.visible){var c=this.Fa.m,d=c.length;if(0!==d){a=Fa();for(var e=Fa(),f=0;f<d;f++){var g=c[f];g.Xw=f;if(g instanceof U){if(!1===g.rd)continue}else if(g instanceof we&&null!==g.adornedPart)continue;var h=g.actualBounds;g.isVisible()&&Zb(h,b)?(g.Jd(!0),a.push(g)):(g.Jd(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],$h(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Jd(!0);for(b=0;b<e.length;b++)$h(e[b]);
Ia(a);Ia(e)}}};function ai(a,b){var c=1;1!==a.lb&&(c=b.globalAlpha,b.globalAlpha=c*a.lb);return c}t.lc=function(a,b,c){if(this.visible&&0!==this.lb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Fa.m;var d=c.length;if(0!==d){var e=ai(this,a),f=this.Vo;f.length=0;for(var g=b.scale,h=N.alloc(),k=0;k<d;k++)this.Ei(a,c[k],b,f,g,h,!0);N.free(h);a.globalAlpha=e}}};
t.Ei=function(a,b,c,d,e,f,g){if(!g||lg(b)){if(null!==d&&b instanceof U&&(b.isOrthogonal&&d.push(b),!1===b.rd))return;g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.$a&&f.hy(d.$a):null!==d.$a&&(g=!0,f.assign(d.$a)),d=d.containingGroup;var h=b.actualBounds;d=!1;if(g&&b.isVisible()){if(!f.Ic(h))return;d=!f.De(h)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());h.width*e>c.Jr||h.height*e>c.Jr?b.lc(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&&(bi(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(bi(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),bi(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Os()||(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.Ec(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.Va(ce,a,this,b,c,d,e)};t.Oi=function(a,b,c){var d=this.Fa;b.ei=this;if(a>=d.count)a=d.count;else if(d.J(a)===b)return-1;d.ub(a,b);b.pq(c);d=this.diagram;null!==d&&(c?d.N():d.Oi(b));ci(this,a,b);return a};
t.bc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.bc(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.qq(c);d.eb(a);d=this.diagram;null!==d&&(c?d.N():d.bc(b));b.ei=null;return a};
function ci(a,b,c){b=di(a,b,c);if(c instanceof hf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Fa.m,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.eb(b),e.ub(d,c))}c=c.containingGroup;null!==c&&ci(a,-1,c)}}
function di(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.eb(b);a.ub(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.eb(b);a.ub(h,c);return h}for(k=NaN;++h<
e&&(k=a.J(h).zOrder,isNaN(k)););}return b}
na.Object.defineProperties(Zh.prototype,{parts:{get:function(){return this.Fa.iterator}},partsBackwards:{get:function(){return this.Fa.iteratorBackwards}},diagram:{get:function(){return this.F}},name:{get:function(){return this.na},set:function(a){var b=this.na;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&C("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&C("Layer.name is already present in this diagram: "+a);this.na=a;this.g("name",b,a);for(a=this.Fa.iterator;a.next();)a.value.layerName=this.na}}},opacity:{get:function(){return this.lb},set:function(a){var b=this.lb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Zh,"opacity"),this.lb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.N())}},isTemporary:{get:function(){return this.o},set:function(a){var b=this.o;if(b!==a){if(this.o=a)this.isInDocumentBounds=
!1;this.g("isTemporary",b,a)}}},visible:{get:function(){return this.C},set:function(a){var b=this.C;if(b!==a){this.C=a;this.g("visible",b,a);for(b=this.Fa.iterator;b.next();)b.value.Nb(a);a=this.diagram;null!==a&&a.N()}}},pickable:{get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(this.oi=a,this.g("pickable",b,a))}},isInDocumentBounds:{get:function(){return this.j},set:function(a){this.j!==
a&&(this.j=a,null!==this.diagram&&this.diagram.Pa())}},allowCopy:{get:function(){return this.aj},set:function(a){var b=this.aj;b!==a&&(this.aj=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.bj},set:function(a){var b=this.bj;b!==a&&(this.bj=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.kj},set:function(a){var b=this.kj;b!==a&&(this.kj=a,this.g("allowTextEdit",b,
a))}},allowGroup:{get:function(){return this.cj},set:function(a){var b=this.cj;b!==a&&(this.cj=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.lj},set:function(a){var b=this.lj;b!==a&&(this.lj=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.dj},set:function(a){var b=this.dj;b!==a&&(this.dj=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.fj},
set:function(a){var b=this.fj;b!==a&&(this.fj=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.ej},set:function(a){var b=this.ej;b!==a&&(this.ej=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.gj},set:function(a){var b=this.gj;b!==a&&(this.gj=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.hj},set:function(a){var b=this.hj;b!==a&&(this.hj=a,this.g("allowResize",
b,a))}},allowRotate:{get:function(){return this.ij},set:function(a){var b=this.ij;b!==a&&(this.ij=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.jj},set:function(a){var b=this.jj;b!==a&&(this.jj=a,this.g("allowSelect",b,a))}}});Zh.prototype.findObjectsNear=Zh.prototype.kg;Zh.prototype.findObjectsIn=Zh.prototype.vf;Zh.prototype.findObjectsAt=Zh.prototype.Ii;Zh.prototype.findObjectAt=Zh.prototype.Wb;Zh.className="Layer";
function T(a,b){ei||(fi(),ei=!0);Ta(this);se=this;this.ob=!0;this.Ea=null;this.ta=this.ua=0;this.Aa=null;if(Jg){var c=this,d=function(){c.removeEventListener(x.document,"DOMContentLoaded",d,!1);c.setRTL()};null!==x.document.body?this.setRTL():c.addEventListener(x.document,"DOMContentLoaded",d,!1)}this.Hl=null;gi.add("Model",hi);var e=this;this.Kd=function(a){var b=e.partManager;if(a.model===b.diagram.model&&b.diagram.Z){b.diagram.Z=!1;try{var c=a.change;""===a.modelChange&&c===ce&&b.updateDataBindings(a.object,
a.propertyName)}finally{b.diagram.Z=!0}}};this.Ih=function(a){e.partManager.doModelChanged(a)};this.Gu=this.Ju=null;ii(this);this.model=ji();this.gh=!0;ki(this);this.layout=new li;this.gh=!1;this.yk=this.zk=this.xk=this.wk=this.EA=this.tk=this.lw=null;this.Aq=function(){};this.preventDefault=null;this.fo=!1;this.Yh=new mi;void 0!==a&&("string"===typeof a||x.Element&&a instanceof Element?ni(this,a):b=a);this.ob=!1;b&&this.Hm(b);return this}var oi,se;
function ii(a){a.Ld=new bh;a.Ld.Ke(a);a.sb=17;a.jx=!1;a.io=!1;a.Au="default";a.Na=new E;a.Xy=new I;a.zy();a.yy();a.lb=1;a.ka=(new J(NaN,NaN)).freeze();a.Cu=new J(NaN,NaN);a.sa=1;a.er=1;a.Vt=(new J(NaN,NaN)).freeze();a.Wt=NaN;a.mu=1E-4;a.iu=100;a.tb=new qd;a.Yu=(new J(NaN,NaN)).freeze();a.Qt=(new N(NaN,NaN,NaN,NaN)).freeze();a.Rj=(new ic(0,0,0,0)).freeze();a.Sj=Mh;a.Mu=!1;a.xu=null;a.Eu=null;a.Oh=mh;a.Qk=Vc;a.Lg=mh;a.vr=Vc;a.Ut=sc;a.Xt=sc;a.Uc=!0;a.bo=!1;a.qe=new G;a.Wh=new I;a.Bn=!0;a.Oq=250;a.Jk=
-1;a.Qq=(new ic(16,16,16,16)).freeze();a.eg=!1;a.$k=!1;a.Ln=!0;a.pr=new Zd;a.pr.diagram=a;a.bh=new Zd;a.bh.diagram=a;a.Dj=new Zd;a.Dj.diagram=a;a.ug=null;a.$e=null;a.Pu=!1;pi(a);a.xi=new G;a.du=!0;a.Tu=qi;a.Rw=!1;a.Vu=wf;a.Dt="auto";a.dr="auto";a.vg=null;a.Dg=null;a.xg=null;a.Wg=null;a.Ug=null;a.Tg=null;a.ou=null;a.Rg=null;a.Tt=!1;a.Sg=null;a.Vg=null;a.qh=null;a.yg=null;a.pu=!1;a.wu={};a.El=[null,null];a.gh=!1;a.lx=!1;a.Nu=!1;a.Gt=!1;a.Tw=!0;a.Vc=!1;a.zj=!1;a.wx=!0;a.pe=-2;a.$g=new I;a.$o=new E;a.Mg=
!1;a.td=!0;a.pt=!0;a.aj=!0;a.bj=!0;a.qt=!1;a.rt=!0;a.kj=!0;a.cj=!0;a.lj=!0;a.tt=!0;a.dj=!0;a.fj=!0;a.ej=!0;a.gj=!0;a.hj=!0;a.ij=!0;a.jj=!0;a.ut=!0;a.wt=!0;a.Sw=!1;a.ml=!1;a.Yn=!0;a.Zn=!0;a.st=!0;a.vt=!0;a.Hu=16;a.Lu=16;a.$r=!1;a.Fu=!1;a.Ku=0;a.Iu=0;a.mb=(new ic(5)).freeze();a.kx=(new G).freeze();a.ju=999999999;a.Pw=(new G).freeze();a.vj=!0;a.wj=!0;a.xj=!0;a.Ue=!1;a.Of=!1;a.Nh=!0;a.Qf=!1;a.Wy=new G;a.Qw=new G;a.si=null;a.Bw=new M(8,8);a.Cw=999;a.bx=1;a.mx=0;a.bd={scale:1,position:new J,bounds:new N,
Gx:new M,qy:new M,ky:!1};a.vx=(new N(NaN,NaN,NaN,NaN)).freeze();a.Rp=(new M(NaN,NaN)).freeze();a.gr=(new N(NaN,NaN,NaN,NaN)).freeze();a.eu=!1;a.Yg=new I;var b=new W,c=new Lg;c.bind(new ri("text","",Ka));b.add(c);a.Sy=b;a.Yg.add("",b);b=new W;c=new Lg;c.stroke="brown";c.bind(new ri("text","",Ka));b.add(c);a.Yg.add("Comment",b);b=new W;b.selectable=!1;b.avoidable=!1;c=new uf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new M(3,3)).ca();b.add(c);a.Yg.add("LinkLabel",b);a.uj=new I;b=
new hf;b.selectionObjectName="GROUPPANEL";b.type=X.Vertical;c=new Lg;c.font="bold 12pt sans-serif";c.bind(new ri("text","",Ka));b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new uf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new mg;d.padding=(new ic(5,5,5,5)).ca();c.add(d);b.add(c);a.Qy=b;a.uj.add("",b);a.hi=new I;b=new U;c=new uf;c.isPanelMain=!0;b.add(c);c=new uf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Ry=b;a.hi.add("",
b);b=new U;c=new uf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.hi.add("Comment",b);b=new we;b.type=X.Auto;c=new uf;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new mg;c.margin=(new ic(1.5,1.5,1.5,1.5)).ca();b.add(c);a.qu=b;a.St=b;b=new we;b.type=X.Link;c=new uf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.gu=b;a.Vd=null;a.tr=!1;a.Tk=null;a.partManager=new hi;a.toolManager=new Oa;a.toolManager.initializeStandardTools();a.defaultTool=a.toolManager;
a.currentTool=a.defaultTool;a.It=null;a.zn=new Ee;a.tu=null;a.uu=null;a.ms=!1;a.commandHandler=si();a.ns=!1;a.rr=null;a.sr=vb;a.tx=!1;a.ac=1;a.ti=null;a.Jr=1;a.Mr=0;a.$w=[0,0,0,0,0];a.Nr=0;a.Er=1;a.Vw=0;a.Ww=new J;a.dz=500;a.Pq=new J;a.cu=!1}T.prototype.clear=function(){this.animationManager.nc();this.model.clear();Ei=null;Gi="";Hi(this,!1);this.$o.clear();Ii();this.$g.clear();this.si=null;this.Pa();this.Sa();this.N()};
function Hi(a,b){a.animationManager.nc(!0);a.kx=(new G).freeze();a.Pw=(new G).freeze();var c=a.skipsUndoManager,d=null!==a.Tb&&void 0!==a.Tb;d&&(a.skipsUndoManager=!0);var e=null;null!==a.Vd&&(e=a.Vd.part,null!==e&&a.remove(e));var f=[],g=a.Na.length;if(b){for(b=0;b<g;b++)for(var h=a.Na.m[b].parts;h.next();){var k=h.value;k!==e&&null===k.data&&f.push(k)}for(b=0;b<f.length;b++)a.remove(f[b])}for(b=0;b<g;b++)a.Na.m[b].clear();a.partManager.clear();a.qe.clear();a.Wh.clear();a.xi.clear();a.Tk=null;a.$o.clear();
Ii();a.$g.clear();Ga=[];null!==e&&(a.add(e),a.partManager.parts.remove(e));d&&(a.skipsUndoManager=c);return f}function si(){return null}T.prototype.reset=function(){this.clear();this.ob=!0;ii(this);Ji(this);this.gh=!0;ki(this);this.layout=new li;this.gh=!1;this.model=ji();this.model.undoManager=new pe;this.ob=this.fo=!1;this.N()};
T.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=va("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.Au=c};
T.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=x.document.body);var b=0;if(Jg){var c=Ki;b=oi;null===c&&(c=Ki=va("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=oi=va("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||Sa||(b=11)}this.sb=b;this.jx=!0};T.prototype.gb=function(a){a.classType===T&&(this.autoScale=a)};T.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.Na.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};T.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
T.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function Li(a){var b=a.Aa.La;b instanceof HTMLCanvasElement&&(a.addEventListener(b,"pointerdown",a.wk,!1),a.addEventListener(b,"pointermove",a.xk,!1),a.addEventListener(b,"pointerup",a.zk,!1),a.addEventListener(b,"pointerout",a.yk,!1),a.addEventListener(b,"pointerenter",a.Gz,!1),a.addEventListener(b,"pointerleave",a.Hz,!1),a.addEventListener(b,"wheel",a.tk,!1),a.addEventListener(b,"keydown",a.uA,!1),a.addEventListener(b,"keyup",a.vA,!1),a.addEventListener(b,"blur",a.rz,!1),a.addEventListener(b,"focus",
a.sz,!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(x,"resize",a.lw,!1),Sa&&a.addEventListener(b,"touchstart",function(a){a.preventDefault()},!1))}function Ke(a){30<a.Mr&&(a.ti=1)}function Te(a,b){null!==a.ti&&(a.ti=null,b&&a.Aq(),Xa&&Xa.Qx||(a.Mr=0,a.$w=[0,0,0,0,0],a.Nr=0))}
T.prototype.computePixelRatio=function(){return null!==this.ti?this.ti:x.devicePixelRatio||1};T.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};T.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};T.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};T.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};T.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};T.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};
T.prototype.doFocus=function(){this.focus()};T.prototype.focus=function(){if(this.Aa)if(this.scrollsPageOnFocus)this.Aa.focus();else{var a=x.scrollX||x.pageXOffset,b=x.scrollY||x.pageYOffset;this.Aa.focus();x.scrollTo(a,b)}};T.prototype.sz=function(){this.F.S("GainedFocus")};T.prototype.rz=function(){this.F.S("LostFocus")};
function nh(a){if(null!==a.Aa){var b=a.Ea;if(null!==b&&0!==b.clientWidth&&0!==b.clientHeight){a.jx||a.setScrollWidth();var c=a.Of?a.sb:0,d=a.Ue?a.sb:0,e=a.ac;a.ac=a.computePixelRatio();a.ac!==e&&(a.bo=!0,a.Fb());if(b.clientWidth!==a.ua+c||b.clientHeight!==a.ta+d)a.wj=!0,a.Uc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===mh&&(a.$k=!0,b.B()),a.Vc||a.Fb()}}}
function ki(a){var b=new Zh;b.name="Background";a.bm(b);b=new Zh;b.name="";a.bm(b);b=new Zh;b.name="Foreground";a.bm(b);b=new Zh;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.bm(b);b=new Zh;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.bm(b);b=new Zh;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.zx(b,a.ik("Background"))}
function Mi(a){var b=new X(X.Grid);b.name="GRID";var c=new uf;c.figure="LineH";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new uf;c.figure="LineH";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new uf;c.figure="LineH";c.stroke="gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new uf;c.figure="LineV";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new uf;c.figure="LineV";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new uf;c.figure="LineV";c.stroke=
"gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new V;c.add(b);c.layerName="Grid";c.zOrder=0;c.isInDocumentBounds=!1;c.isAnimated=!1;c.pickable=!1;c.locationObjectName="GRID";a.add(c);a.partManager.parts.remove(c);b.visible=!1;return b}function Ni(){this.F.Fu?this.F.Fu=!1:this.F.isEnabled?this.F.Mx(this):Oi(this.F)}function Pi(a){this.F.isEnabled?(this.F.Ku=a.target.scrollTop,this.F.Iu=a.target.scrollLeft):Oi(this.F)}
T.prototype.Mx=function(a){if(null!==this.Aa){var b=this.Ju,c=this.Gu;this.$r=!0;var d=this.documentBounds,e=this.viewportBounds,f=this.Rj,g=d.x-f.left,h=d.y-f.top,k=d.width+f.left+f.right,l=d.height+f.top+f.bottom,m=d.right+f.right;f=d.bottom+f.bottom;var n=e.x;d=e.y;var p=e.width,r=e.height,q=e.right,u=e.bottom;e=this.scale;var v=a.scrollLeft;if(this.io)switch(this.Au){case "negative":v=v+a.scrollWidth-a.clientWidth;break;case "reverse":v=a.scrollWidth-v-a.clientWidth}var w=v;p<k||r<l?(v=J.allocAt(this.position.x,
this.position.y),this.allowHorizontalScroll&&this.Iu!==w&&(v.x=w/e+g,this.Iu=w),this.allowVerticalScroll&&this.Ku!==a.scrollTop&&(v.y=a.scrollTop/e+h,this.Ku=a.scrollTop),this.position=v,J.free(v),this.wj=this.$r=!1):(v=J.alloc(),a.Zy&&this.allowHorizontalScroll&&(g<n&&(this.position=v.h(w+g,this.position.y)),m>q&&(this.position=v.h(-(b.scrollWidth-this.ua)+w-this.ua/e+m,this.position.y))),a.$y&&this.allowVerticalScroll&&(h<d&&(this.position=v.h(this.position.x,a.scrollTop+h)),f>u&&(this.position=
v.h(this.position.x,-(b.scrollHeight-this.ta)+a.scrollTop-this.ta/e+f))),J.free(v),Qi(this),this.wj=this.$r=!1,d=this.documentBounds,e=this.viewportBounds,m=d.right,q=e.right,f=d.bottom,u=e.bottom,g=d.x,n=e.x,h=d.y,d=e.y,p>=k&&g>=n&&m<=q&&(c.style.width="1px"),r>=l&&h>=d&&f<=u&&(c.style.height="1px"))}};T.prototype.computeBounds=function(a){void 0===a&&(a=new N);hh(this);return Ri(this,a)};
function Ri(a,b){if(a.fixedBounds.u())return b.assign(a.fixedBounds),b.Xp(a.mb),b;for(var c=!0,d=a.Na.m,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Fa.m;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.u()&&(c?(c=!1,b.assign(l)):b.Nc(l)))}}}c&&b.h(0,0,0,0);b.Xp(a.mb);return b}
T.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 U||(e.Sa(),null===c?c=e.actualBounds.copy():c.Nc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof U||(d.Sa(),null===c?c=d.actualBounds.copy():c.Nc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function Si(a,b){if((b||a.Qf)&&!a.ob&&null!==a.Aa&&a.documentBounds.u()){if(b){var c=a.initialPosition;if(c.u()){a.position=c;return}c=J.alloc();c.Ui(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=N.allocAt(0,0,d.width,d.height);var e=J.alloc();e.Ui(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.ob=!0;c=a.Oh;b&&a.Lg!==mh&&(c=a.Lg);var f=c!==mh?Ti(a,c):a.scale;c=a.ka.x;d=a.ka.y;e=a.ua/f;var g=a.ta/f,h=a.Qk,k=a.vr;b&&!h.hb()&&(k.hb()||k.Lb())&&
(h=k.Lb()?yc:k);Ui(a,a.documentBounds,e,g,h,b);b=a.scale;a.scale=f;a.ob=!1;Vi(a);Wi(a,!0,!1);f=a.viewportBounds;if(!(L.w(f.x,c)&&L.w(f.y,d)&&L.w(f.width,e)&&L.w(f.height,g)))a.onViewportBoundsChanged(new N(c,d,e,g),f,b,!1)}}
function Ti(a,b){var c=a.er;if(null===a.Aa)return c;a.Sa();var d=a.documentBounds;if(!d.u())return c;var e=d.width;d=d.height;var f=a.ua+(a.Of?a.sb:0),g=a.ta+(a.Ue?a.sb:0),h=f/e,k=g/d;return b===Xi?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===Yi?(b=k>h?(g-a.sb)/d:(f-a.sb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
T.prototype.zoomToFit=function(){var a=this.Sj;this.Sj=Mh;this.scale=Ti(this,Xi);a!==Mh&&(Si(this,!1),Ui(this,this.documentBounds,this.ua/this.sa,this.ta/this.sa,this.Qk,!1));this.Sj=a};t=T.prototype;
t.gB=function(a,b){void 0===b&&(b=Xi);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Xi||b===Yi)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.ua;var f=this.ta;e=b===Yi?f/d>e/c?(f-(this.Ue?this.sb:0))/d:(e-(this.Of?this.sb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.lz=function(a,b){this.Sa();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.dA=function(a){if(a instanceof Y){this.rr=a;var b=J.alloc();this.sr=this.Iq(a.da(sc,b));J.free(b)}else this.rr=null,this.sr=vb};
function Ui(a,b,c,d,e,f){var g=J.allocAt(a.ka.x,a.ka.y),h=g.x,k=g.y;if(null!==a.rr){var l=J.alloc();l=a.rr.da(sc,l);h=l.x-a.sr.x/a.scale;k=l.y-a.sr.y/a.scale;e=rc;J.free(l)}if(f||a.scrollMode===Mh)e.hb()&&(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.Rj,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.mb.left;g.y=isFinite(k)?k:-a.mb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);Ih(a.Ld,a.ka,g);a.ka.h(g.x,g.y);Ji(a);J.free(g)}
t.im=function(a,b){void 0===b&&(b=!0);if(b){if(a=jf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof V)return a}else if(a=jf(this,a,function(a){return a.part}),a instanceof V)return a;return null};t.Wb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);hh(this);for(var d=this.Na.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Wb(a,b,c),null!==e))return e}return null};
function jf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);hh(a);for(a=a.Na.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Wb(b,c,d),null!==e))return e}return null}t.Rz=function(a,b,c){void 0===b&&(b=!0);return Zi(this,a,function(a){return a.part},b?function(a){return a instanceof V&&a.canSelect()}:null,c)};
function Zi(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof E||e instanceof G||(e=new G);hh(a);for(a=a.Na.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Ii(b,c,d,e)}return e}t.Ii=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof G||(d=new G);hh(this);for(var e=this.Na.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Ii(a,b,c,d)}return d};
t.Vx=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return $i(this,a,function(a){return a instanceof V&&(!c||a.canSelect())},b,d)};t.vf=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);hh(this);for(var f=this.Na.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.vf(a,b,c,d,e)}return e};
t.sv=function(a,b,c,d,e,f){var g=new G;hh(this);for(var h=this.Na.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.sv(a,b,c,d,g,e,f)}return g};function $i(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);hh(a);for(a=a.Na.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.vf(b,f,c,d,e)}return e}
t.Sz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return aj(this,a,b,function(a){return a instanceof V&&(!d||a.canSelect())},c,e)};t.kg=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);hh(this);for(var g=this.Na.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.kg(a,b,c,d,e,f)}return f};
function aj(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);hh(a);for(a=a.Na.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.kg(b,c,g,d,e,f)}return f}T.prototype.acceptEvent=function(a){return bj(this,a,a instanceof MouseEvent)};
function bj(a,b,c){var d=a.bh;a.bh=a.Dj;a.Dj=d;d.diagram=a;d.event=b;c?cj(a,b,d):(d.viewPoint=a.bh.viewPoint,d.documentPoint=a.bh.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&&(d.buttons=b.buttons);Sa&&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=dj(b,b.target);d.targetObject=null;return d}
function dj(a,b){if(null===b)return null;if(b=b.F)return b;(b=a.path)||"function"!==typeof a.composedPath||(b=a.composedPath());return b&&b[0]&&b[0].F?b[0].F:null}
function ej(a,b,c,d,e,f){var g=a.bh;a.bh=a.Dj;a.Dj=g;g.diagram=a;g.clickCount=1;a=g.delta=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);g.modifiers=a;g.event=b;g.timestamp=b.timeStamp;g.button=b.button;g.buttons=b.buttons;Sa&&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 fj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();!1!==b.cancelable&&b.preventDefault();b.cancelBubble=!0;return!1}
T.prototype.uA=function(a){var b=this.F;if(!this.F.isEnabled)return!1;var c=bj(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 fj(c,a)};
T.prototype.vA=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=bj(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 fj(c,a)};
T.prototype.Gz=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=bj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return fj(c,a)};T.prototype.Hz=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=bj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return fj(c,a)};
T.prototype.getMouse=function(a){var b=this.Aa;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.ua/c.width*c.left;a=a.clientY-this.ta/c.height*c.top;return null!==this.tb?Ab(new J(b,a),this.tb):new J(b,a)};
function cj(a,b,c){var d=a.Aa,e=a.ua,f=a.ta,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.tb?(b=J.allocAt(g,h),a.tb.Ed(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
function $d(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.El[0])b=a.El[c];else return;c=a.Aa;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.ua/c.width*c.left,b.clientY-a.ta/c.height*c.top))}T.prototype.Pa=function(){this.vj||(this.vj=!0,this.Fb(!0))};function gj(a){a.Vc||hh(a);a.Sa()}T.prototype.redraw=function(){this.ob||this.Vc||(this.N(),Vi(this),this.ed())};t=T.prototype;t.tA=function(){return this.eg};
t.Bz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.nc();b.isEnabled=!1;rf(this);this.Qf=!1;this.Cu=new J(NaN,NaN);b.isEnabled=c;this.Vc=!0;var d=this;null!==a&&ua(function(){d.Vc=!1;gh(b,"Model");a(d)},1)};t.Fb=function(a){void 0===a&&(a=!1);if(!0!==this.eg&&!(this.ob||!1===a&&this.Vc)){this.eg=!0;var b=this;x.requestAnimationFrame(function(){b.eg&&b.ed()})}};t.ed=function(){if(!this.Ln||this.eg)this.Ln&&(this.Ln=!1),rf(this)};
function Wi(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.ob||!a.wj||Oi(a)||(b&&hh(a),c&&Si(a,!1))}
function rf(a,b){if(!a.Vc&&(a.eg=!1,null!==a.Ea||a.Rp.u())){a.Vc=!0;var c=a.animationManager,d=a.$o;if(!c.isAnimating&&0!==d.length){for(var e=d.m,f=e.length,g=0;g<f;g++){var h=e[g];hj(h,!1);h.s()}d.clear()}d=a.Qw;0<d.count&&(d.each(function(a){a.kw()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.rb||nh(a);Wi(a,!1,!0);null!==a.Vd&&(a.Vd.visible&&!a.tr&&(ij(a),a.tr=!0),!a.Vd.visible&&a.tr&&(a.tr=!1));hh(a);f=!1;if(!a.Qf||a.Nh)a.Qf?jj(a,!a.$k):
(a.wa("Initial Layout"),!1===c.isEnabled&&c.nc(),jj(a,!1)),f=!0;a.$k=!1;hh(a);a.Nu||gj(a);Wi(a,!0,!1);g=!1;f?(c=N.alloc(),c.assign(a.viewportBounds),a.Qf||(g=a.Qf=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,kj(a)),a.S("LayoutCompleted"),c.A(a.viewportBounds)||Wi(a,!0,!1),N.free(c)):c.gl&&c.ux&&(a.Lg!==mh?a.scale=Ti(a,a.Lg):a.Oh!==mh?a.scale=Ti(a,a.Oh):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),Si(a,!0));hh(a);f&&g&&a.Xa("Initial Layout");a.fv();
b||a.lc(a.Sb);e&&(a.skipsUndoManager=d);a.Vc=!1}}function kj(a){var b=a.sa;if(a.Lg!==mh)a.scale=Ti(a,a.Lg);else if(a.Oh!==mh)a.scale=Ti(a,a.Oh);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.sa!==b&&(Vi(a),Wi(a,!0,!1));Si(a,!0);b=a.Na.m;a.Jd(b,b.length,a,a.viewportBounds);a.S("InitialLayoutCompleted");a.Cu.assign(a.ka);ij(a)}
function hh(a){if(0!==a.qe.count&&(a.Vc||!a.animationManager.isTicking)){for(var b=0;23>b;b++){var c=a.qe.iterator;if(null===c||0===a.qe.count)break;a.qe=new G;a.kw(c,a.qe)}a.nodes.each(function(a){a instanceof hf&&0!==(a.R&65536)!==!1&&(a.R=a.R^65536)})}}
t.kw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Jc()||c instanceof hf||(c.Si()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof hf&&c.isVisible()&&lj(this,c);for(a.reset();a.next();)c=a.value,c instanceof U&&c.isVisible()&&(c.Si()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof we&&c.isVisible()&&(c.Si()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function lj(a,b){for(var c=Fa(),d=Fa(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof hf?(mj(f)||nj(f)||oj(f))&&lj(a,f):f instanceof U?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.Jd=function(a,b,c,d){if(this.xj||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Jd(c,d)};
t.lc=function(a,b){if(null!==this.Ea){null===this.Aa&&C("No canvas specified");var c=this.animationManager;if(!c.rb&&(!c.isAnimating||c.isTicking)){var d=new Date;pj(this);if("0"!==this.Ea.style.opacity){var e=a!==this.Sb,f=this.Na.m,g=f.length,h=this;this.Jd(f,g,h,h.viewportBounds);if(e)a.Ec(!0),Qi(this);else if(!this.Uc&&void 0===b&&!c.isAnimating)return;g=this.ka;var k=this.sa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.tb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.ac;a.setTransform(k,0,0,k,0,0);a.clearRect(0,0,this.ua,this.ta);1!==this.lb&&(a.globalAlpha=this.lb);qj(this,a);l=void 0!==b?function(c){if(c.visible&&0!==c.lb){var d=c.Fa.m,e=d.length;if(0!==e){var f=ai(c,a),g=c.Vo;g.length=0;for(var k=h.scale,l=N.alloc(),m=0;m<e;m++){var n=d[m];b.contains(n)||c.Ei(a,n,h,g,k,l,!0)}N.free(l);a.globalAlpha=f}}}:function(b){b.lc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(k,0,0,k,0,0),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);f=!1;this.Yh?rj(this.Yh,
this)&&(f=this.Jt()):f=!0;f&&(qd.prototype.Ed=qd.prototype.Fx);e?(this.Sb.Ec(!0),Qi(this)):this.Uc=this.xj=!1;f=+new Date-+d;e=Xa&&Xa.Qx;d=this.$w;if(e||null===this.ti){d[this.Nr]=f;this.Nr=(this.Nr+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.Mr=f/d.length}1!==this.lb&&(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 sj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ea){null===a.Aa&&C("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);pj(a);a.Sb.Ec(!0);Qi(a);a.zj=!0;var m=a.sa;a.sa=e;var n=a.Na.m,p=n.length;try{var r=new N(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Xp(c);ij(a,q);hh(a);a.Jd(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.ac;b.scale(u,u);var v=qd.alloc();
v.reset();v.translate(c.left,c.top);v.scale(e);0===f.x&&0===f.y||v.translate(-f.x,-f.y);b.setTransform(v.m11,v.m12,v.m21,v.m22,v.dx,v.dy);qd.free(v);qj(a,b);b.globalAlpha=a.lb;var w=a.ik("Grid");if(g){var z=new G,y=g.iterator;for(y.reset();y.next();){var A=y.value;A instanceof V&&(l||A.layer!==w)&&z.add(A)}for(l=0;l<p;l++){var B=n[l];w=b;var F=a;if(B.visible&&0!==B.lb&&(k||!B.isTemporary)){var K=B.Fa.m,S=K.length;if(0!==S){var R=ai(B,w),O=B.Vo;O.length=0;var H=F.scale,da=N.alloc();for(c=0;c<S;c++){var ba=
K[c];z.contains(ba)&&B.Ei(w,ba,F,O,H,da,!1)}N.free(da);w.globalAlpha=R}}}}else for(z=0;z<p;z++)F=n[z],F===w?l&&F.lc(b,a,!0):F.lc(b,a,k);a.zj=!1;a.Yh&&rj(a.Yh,a)&&a.Jt()}finally{a.sa=m,a.Sb.Ec(!0),Qi(a),a.Jd(n,p,a,a.viewportBounds),ij(a)}}}t.Fe=function(a){return this.dh[a]};t.Dy=function(a,b){"minDrawingLength"===a&&(this.Jr=b);this.dh[a]=b;this.redraw()};
t.zy=function(){this.dh=new Wa;this.dh.drawShadows=!0;this.dh.textGreeking=!0;this.dh.viewportOptimizations=Sa||Qa?!1:!0;this.dh.temporaryPixelRatio=!0;this.dh.pictureRatioOptimization=!0;this.Jr=this.dh.minDrawingLength=1};function qj(a,b){a=a.dh;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Cy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.km=function(a){return this.ao[a]};t.VA=function(a,b){this.ao[a]=b};
t.yy=function(){this.ao=new Wa;this.ao.extraTouchArea=10;this.ao.extraTouchThreshold=10;this.ao.hasGestureZoom=!0};t.set=function(a){Object.assign(this,a);return this};t.dv=function(a){return this.Hm(a)};t.Hm=function(a){tj(this,a);return this};
function tj(a,b){var c=a instanceof X,d=a instanceof T,e;for(e in b){""===e&&C("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.Ya(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];za(f)?g=e.substr(h+1):C("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.Bx(b[g]);continue}else if(d&&"Changed"===g){a.uh(b[g]);continue}else if(d&&
La(a.toolManager,g))f=a.toolManager;else if(d&&uj(a,g)){a.Xj(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.uh(b[g]);continue}else C('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.yx(g)}}t.fv=function(){if(0===this.undoManager.transactionLevel&&0!==this.Wh.count){for(;0<this.Wh.count;){var a=this.Wh;this.Wh=new I;for(a=a.iterator;a.next();){var b=a.key;b.rq(a.value);b.cc(!1)}}this.N()}};
t.N=function(a){if(void 0===a)this.Uc=!0,this.Fb();else{var b=this.viewportBounds;a.u()&&b.Ic(a)&&(this.Uc=!0,this.Fb())}this.S("InvalidateDraw")};
T.prototype.invalidateViewport=function(a,b){if(!0!==this.Uc){this.Uc=!0;var c=!0===this.Fe("temporaryPixelRatio");if(!0===this.Fe("viewportOptimizations")&&this.scrollMode!==Oh&&this.Rj.Gi(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.ns&&0<d.width&&0<d.height){if(!(this.Vc||(this.eg=!1,null===this.Ea||(this.Vc=
!0,this.fv(),this.documentBounds.u()||(e=N.alloc(),vj(this,this.computeBounds(e)),N.free(e)),e=this.Aa,null===e||e instanceof wj)))){var g=this.ac;f=this.ua*g;var h=this.ta*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.Kw;a=this.Ty;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.La,n,p,r,q,0,0,r,
q);rj(this.Yh,this)&&a.clearRect(0,0,k,m);e=Fa();a=Fa();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 v=this.tb;v.reset();v.scale(g,g);1!==this.sa&&v.scale(this.sa);g=this.ka;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&v.translate(-g.x,-g.y);Ab(n,v);Ab(q,v);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)));Ab(n,v);Ab(q,v);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)));rj(this.Yh,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))),Ab(n,v),Ab(q,v),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);Wi(this,!1,!0);null===this.Ea&&
C("No div specified");null===this.Aa&&C("No canvas specified");if(!this.animationManager.rb&&(f=this.Sb,this.Uc)){pj(this);h=this.ac;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.ua*h,this.ta*h);f.drawImage(this.Kw.La,0<l?0:Math.round(-l),0<b?0:Math.round(-b));l=this.ka;g=this.sa;k=Math.round(l.x*g)/g;m=Math.round(l.y*g)/g;b=this.tb;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.Na.m;l=b.length;this.Jd(b,l,this,this.viewportBounds);qj(this,f);f.globalAlpha=this.lb;for(h=0;h<l;h++)if(g=b[h],k=e,g.visible&&0!==g.lb){m=ai(g,f);p=g.Vo;p.length=0;n=this.scale;r=N.alloc();q=g.Fa.m;v=q.length;u=k.length;for(var w=0;w<v;w++){var z=q[w],y=xj(z,z.actualBounds);a:{for(var A=2/n,B=4/n,F=0;F<u;F++){var K=k[F];if(0!==K.width&&0!==
K.height&&y.Av(K.x-A,K.y-A,K.width+B,K.height+B)){y=!0;break a}}y=!1}y&&g.Ei(f,z,this,p,n,r,!0)}N.free(r);f.globalAlpha=m}f.restore();f.Ec(!0);this.Yh&&rj(this.Yh,this)&&this.Jt();this.Uc=this.xj=!1;this.Aq()}Ia(e);Ia(a);this.Vc=!1}}else this.ed();N.free(d);c&&(Ke(this),this.ed(),Te(this,!0))}else c?(Ke(this),this.ed(),Te(this,!0)):this.ed()}};function Vi(a){!1===a.wj&&(a.wj=!0)}function Qi(a){!1===a.xj&&(a.xj=!0)}function pj(a){!1!==a.bo&&(a.bo=!1,yj(a,a.ua,a.ta))}
function yj(a,b,c){Ji(a);var d=a.ac;a.Aa.resize(b*d,c*d,b,c)&&(a.Uc=!0,a.Sb.Ec(!0))}
function Oi(a){var b=a.Aa;if(null===b||a.Rp.u())return!0;var c=a.ua,d=a.ta,e=a.viewportBounds;if(!a.viewportBounds.u())return!0;var f=e.x,g=e.y,h=e.width,k=e.height,l=a.Ju,m=a.Gu,n=a.Ea,p=!1,r=a.Of?a.sb:0,q=a.Ue?a.sb:0,u=n.clientWidth||c+r,v=n.clientHeight||d+q;if(u!==c+r||v!==d+q)a.Of=!1,a.Ue=!1,q=r=0,a.ua=u,a.ta=v,p=a.bo=!0,Ji(a);if(!(p||a.Of||a.Ue||a.Yn||a.Zn))return!0;a.wj=!1;var w=a.documentBounds,z=0,y=0,A=0,B=0;n=e.width;var F=e.height,K=a.Rj;a.contentAlignment.hb()?(w.width>n&&(z=K.left,y=
K.right),w.height>F&&(A=K.top,B=K.bottom)):(z=K.left,y=K.right,A=K.top,B=K.bottom);K=w.width+z+y;var S=w.height+A+B;z=w.x-z;var R=e.x;y=w.right+y;var O=e.right+r;A=w.y-A;var H=e.y;w=w.bottom+B;B=e.bottom+q;var da="1px",ba="1px";e=a.scale;u=K>u/e;v=S>v/e;a.scrollMode===Mh&&(u||v)&&(u&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(u=1,z+1<R&&(u=Math.max((R-z)*e+a.ua,u)),y>O+1&&(u=Math.max((y-O)*e+a.ua,u)),n+r+1<K&&(u=Math.max((K-n)*e+a.ua,u)),da=u.toString()+"px"),v&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&
(u=1,A+1<H&&(u=Math.max((H-A)*e+a.ta,u)),w>B+1&&(u=Math.max((w-B)*e+a.ta,u)),F+q+1<S&&(u=Math.max((S-F)*e+a.ta,u)),ba=u.toString()+"px"));u="1px"!==da;v="1px"!==ba;u&&v||!u&&!v||(v&&(O-=a.sb),u&&(B-=a.sb),K<n+r||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(r=1,z+1<R&&(r=Math.max((R-z)*e+a.ua,r)),y>O+1&&(r=Math.max((y-O)*e+a.ua,r)),n+1<K&&(r=Math.max((K-n)*e+a.ua,r)),da=r.toString()+"px"),u="1px"!==da,r=a.ta,u!==a.Ue&&(r=u?a.ta-a.sb:a.ta+a.sb),S<F+q||!a.hasVerticalScrollbar||!a.allowVerticalScroll||
(q=1,A+1<H&&(q=Math.max((H-A)*e+r,q)),w>B+1&&(q=Math.max((w-B)*e+r,q)),F+1<S&&(q=Math.max((S-F)*e+r,q)),ba=q.toString()+"px"),v="1px"!==ba);if(a.$r&&u===a.Ue&&v===a.Of)return c===a.ua&&d===a.ta||a.ed(),!1;u!==a.Ue&&("1px"===da?a.ta=a.ta+a.sb:a.ta=Math.max(a.ta-a.sb,1),p=!0);a.Ue=u;m.style.width=da;v!==a.Of&&("1px"===ba?a.ua=a.ua+a.sb:a.ua=Math.max(a.ua-a.sb,1),p=!0,a.io&&(q=J.alloc(),v?(b.style.left=a.sb+"px",a.position=q.h(a.ka.x+a.sb/a.scale,a.ka.y)):(b.style.left="0px",a.position=q.h(a.ka.x-a.sb/
a.scale,a.ka.y)),J.free(q)));p&&Ji(a);a.Of=v;m.style.height=ba;a.Fu=!0;p&&(a.bo=!0);b=l.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(n+1<K?b=(a.position.x-z)*e:z+1<R?b=l.scrollWidth-l.clientWidth:y>O+1&&(b=a.position.x*e));if(a.io)switch(a.Au){case "negative":b=-(l.scrollWidth-b-l.clientWidth);break;case "reverse":b=l.scrollWidth-b-l.clientWidth}l.scrollLeft=b;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(F+1<S?l.scrollTop=(a.position.y-A)*e:A+1<H?l.scrollTop=l.scrollHeight-l.clientHeight:
w>B+1&&(l.scrollTop=a.position.y*e));u=a.ua;v=a.ta;l.style.width=u+(a.Of?a.sb:0)+"px";l.style.height=v+(a.Ue?a.sb:0)+"px";return c!==u||d!==v||a.animationManager.rb?(c=N.allocAt(f,g,h,k),a.onViewportBoundsChanged(c,a.viewportBounds,e,p),N.free(c),!1):!0}t=T.prototype;
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&C("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.ik(a.layerName),null===b&&(b=this.ik("")),null===b&&C('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.Oi(99999999,a,a.diagram===this);0<=c&&this.Va(ee,"parts",b,null,a,null,c);b.isTemporary||this.Pa();a.B(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.Oi=function(a){this.partManager.Oi(a);var b=this;zj(a,function(a){Aj(b,a)});(a instanceof we||a instanceof hf&&null!==a.placeholder)&&a.s();null!==a.data&&zj(a,function(a){Bj(b.partManager,a)});!0!==nj(a)&&!0!==oj(a)||this.qe.add(a);Cj(a,!0,this);Dj(a)?(a.actualBounds.u()&&this.N(xj(a,a.actualBounds)),this.Pa()):a.isVisible()&&a.actualBounds.u()&&this.N(xj(a,a.actualBounds));this.Fb()};
t.bc=function(a){a.$j();this.partManager.bc(a);var b=this;null!==a.data&&zj(a,function(a){Ej(b.partManager,a,b)});this.qe.remove(a);Dj(a)?(a.actualBounds.u()&&this.N(xj(a,a.actualBounds)),this.Pa()):a.isVisible()&&a.actualBounds.u()&&this.N(xj(a,a.actualBounds));this.Fb()};t.remove=function(a){Fj(this,a,!0)};
function Fj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.B(2),c&&b.fk(),c=d.bc(-1,b,!1),0<=c&&a.Va(fe,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.bt=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.ek=function(a,b,c){void 0===c&&(c=!1);return this.partManager.ek(a,b,c)};
T.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Gj(this));if(null!==this.toolManager){var e=new I;if(null!==a)if(Aa(a))for(var f=0;f<a.length;f++)Hj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Hj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Hj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Hj(this,e,a.value,c,d);for(a=this.links;a.next();)Hj(this,e,a.value,c,d)}ef(this,e,b,d,c)}};
function Hj(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=Gj(a)),c instanceof W){b.add(c,a.yd(e,c,c.location));if(c instanceof hf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Hj(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)&&Hj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.tv();c.next();)Hj(a,b,
c.value,d,e)}else if(c instanceof U)for(b.add(c,a.yd(e,c)),c=c.labelNodes;c.next();)Hj(a,b,c.value,d,e);else c instanceof we||b.add(c,a.yd(e,c,c.location))}
function ef(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.ms)||Le(a,b);for(var h=Fa(),k=Fa(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.Jc()){var r=Ij(a,n,b);if(null!==r)h.push(new Jj(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 U&&k.push(l.la)}J.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.xv.shifted&&(n.xv.shifted=new J),n.node.location=f.add(n.xv.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 U)if(r.suspendsRouting){r.cf=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.yd(d,r,g)),cf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.u()&&q.assign(m);var v=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(v=J.alloc(),vg(a,r,m,v,d));m.assign(r.dragComputation(r,m,v)).ge(q);b.add(r,a.yd(d,r,m));cf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);v!==m&&J.free(v)}else null!==m&&(e.assign(m.location),v=b.H(m),null!==v&&e.ge(v.point)),null!==u&&(l.assign(u.location),v=b.H(u),null!==v&&l.ge(v.point)),null!==m&&null!==u?e.Ta(l)?(m=q.value.point,u=f,u.assign(e),u.ge(m),b.add(r,a.yd(d,r,e)),cf(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.yd(d,r,m)),cf(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.yd(d,r,g)),cf(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||(hh(a),Qe(a,b))}}
T.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(),vg(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 Gj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.zn}
function vg(a,b,c,d,e){void 0===e&&(e=Gj(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.Vi(0,0,a,b,e);L.jq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function Le(a,b){if(null!==b)for(a.ms=!0,a=b.iterator;a.next();)b=a.key,b instanceof U&&(b.suspendsRouting=!0)}
function Qe(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof U&&(c.suspendsRouting=!1,Kj(c)&&c.Ua())}a.ms=!1}}function Ij(a,b,c){b=b.containingGroup;if(null!==b){a=Ij(a,b,c);if(null!==a)return a;a=c.H(b);if(null!==a)return a}return null}t=T.prototype;t.yd=function(a,b,c){if(void 0===c)return new Oe(pb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new Oe(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new Oe(c.copy())};
function Lj(a,b,c){null!==b.diagram&&b.diagram!==a&&C("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&C("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&C("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&C("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Na;c=a.count;for(var d=0;d<c;d++)a.J(d).name===b&&C("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.bm=function(a){Lj(this,a,null);a.Ke(this);var b=this.Na,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.J(c).isTemporary;)c--;b.ub(c+1,a);null!==this.Tb&&this.Va(ee,"layers",this,null,a,null,c+1);this.N();this.Pa();return this};
t.zx=function(a,b){Lj(this,a,b);a.Ke(this);var c=this.Na,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Tb&&this.Va(fe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.ub(f,a);break}null!==this.Tb&&this.Va(ee,"layers",this,null,a,null,f);this.N();0>d&&this.Pa();return this};
t.fz=function(a,b){Lj(this,a,b);a.Ke(this);var c=this.Na,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Tb&&this.Va(fe,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.J(f)===b){c.ub(f+1,a);break}null!==this.Tb&&this.Va(ee,"layers",this,null,a,null,f+1);this.N();0>d&&this.Pa();return this};
t.NA=function(a){a.diagram!==this&&C("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Na,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.Tb&&this.Va(fe,"layers",this,a,null,c,null);this.N();this.Pa()}}};t.ik=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Bx=function(a){null===this.$e&&(this.$e=new E);this.$e.add(a);this.model.uh(a);return this};t.PA=function(a){null!==this.$e&&(this.$e.remove(a),0===this.$e.count&&(this.$e=null));this.model.Bk(a)};t.uh=function(a){null===this.ug&&(this.ug=new E);this.ug.add(a);return this};t.Bk=function(a){null!==this.ug&&(this.ug.remove(a),0===this.ug.count&&(this.ug=null))};
t.ws=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.yv(a);a.change!==de&&(this.isModified=!0);if(null!==this.ug)for(var b=this.ug,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 be;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.ws(h)};t.g=function(a,b,c,d,e){this.Va(ce,a,this,b,c,d,e)};
T.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===ce){var e=a.object;Mj(e,a.propertyName,a.H(b));if(e instanceof Y){var f=e.part;null!==f&&f.Kb()}this.isModified=!0}else if(d===ee){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof Y){b?g.bc(h):g.ub(h,k);var l=g.part;null!==l&&l.Kb()}else"number"===typeof h&&k instanceof Nj&&(k.isRow?Oj(g,h,
b?void 0:k):Pj(g,h,b?void 0:k));else if(g instanceof Zh){var m=!0===a.oldParam;"number"===typeof h&&k instanceof V&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Kb(),g.bc(m?h:-1,k,m)):g.Oi(h,k,m))}else g instanceof T?"number"===typeof h&&k instanceof Zh&&(b?this.Na.eb(h):(k.Ke(this),this.Na.ub(h,k))):C("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===fe){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof X)"number"===typeof p&&r instanceof Y?b?n.ub(p,r):n.bc(p):
"number"===typeof p&&r instanceof Nj&&(r.isRow?Oj(n,p,b?r:void 0):Pj(n,p,b?r:void 0));else if(n instanceof Zh){var q=!0===a.newParam;"number"===typeof p&&r instanceof V&&(b?0>n.Fa.indexOf(r)&&n.Oi(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Kb(),n.bc(q?p:-1,r,q)))}else n instanceof T?"number"===typeof p&&r instanceof Zh&&(b?(r.Ke(this),this.Na.ub(p,r)):this.Na.eb(p)):C("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==de&&C("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=
c}}};T.prototype.wa=function(a){return this.undoManager.wa(a)};T.prototype.Xa=function(a){return this.undoManager.Xa(a)};T.prototype.Df=function(){return this.undoManager.Df()};T.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.wa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.Df(),this.skipsUndoManager=c}};T.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};
T.prototype.Lq=function(){this.partManager.Lq()};
function Qj(a,b,c){var d=a.animationManager;if(a.ob||a.Vc)a.sa=c,Ji(a),d.rb&&(Bh(d)||d.Pd.add(d.F,"scale",b,a.sa));else if(null===a.Aa)a.sa=c,Ji(a);else{a.ob=!0;var e=a.viewportBounds.copy(),f=a.ua,g=a.ta;e.width=a.ua/b;e.height=a.ta/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Kc()?l.zf(Fc)?h=0:l.zf(Gc)&&(h=f-1):h=l.hb()?l.x*(f-1):f/2);isNaN(k)&&(l.Kc()?l.zf(Dc)?k=0:l.zf(Hc)&&(k=g-1):k=l.hb()?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.ka.x+h/b-h/c,a.ka.y+k/b-k/c);a.position=f;J.free(f);a.sa=c;Ji(a);a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);a.ob=!1;Si(a,!1);d.rb&&(Bh(d)||d.Pd.add(d.F,"scale",b,a.sa));a.N();Vi(a)}}
T.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||Vi(this);Qi(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==mh||d||a.width===b.width&&a.height===b.height||e.B();e=this.currentTool;!0===this.ml&&e instanceof Oa&&(this.lastInput.documentPoint=this.kt(this.lastInput.viewPoint),Ae(e,this));this.ob||this.invalidateViewport(a,b);ij(this);this.bd.scale=c;this.bd.position.x=a.x;this.bd.position.y=a.y;this.bd.bounds.assign(a);this.bd.Gx.width=
Math.round(a.width*c);this.bd.Gx.height=Math.round(a.height*c);this.bd.qy.width=this.ua;this.bd.qy.height=this.ta;this.bd.ky=d;this.S("ViewportBoundsChanged",this.bd,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Ic(b)&&a.Ua()})}};
function ij(a,b){var c=a.Vd;if(null!==c&&c.visible){for(var d=M.alloc(),e=1,f=1,g=c.T.m,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(Rj(l.figure)?f=f*m/L.Wx(f,m):e=e*m/L.Wx(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(void 0!==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.u()){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.jq(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)}}T.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.S("ChangingSelection",b);for(var c=b.xa(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ea();b.clear();b.freeze();a||this.S("ChangedSelection",b)}};
T.prototype.select=function(a){null!==a&&a.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.S("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.S("ChangedSelection",this.selection))};
T.prototype.UA=function(a){this.S("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||C("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||C("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.S("ChangedSelection",this.selection)};
T.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.xa(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ea();a.clear();a.freeze()}};t=T.prototype;t.nA=function(a){null!==a&&a.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.oA=function(a){a=(new G).addAll(a);for(var b=this.highlighteds.copy().Bq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof V||C("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}C("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:C("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.Vv=function(a){var b=this.viewportBounds;b.De(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.xs=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.Iq=function(a){var b=this.tb;b.reset();1!==this.sa&&b.scale(this.sa);var c=this.ka;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.tb)};
t.cB=function(a){var b=this.tb,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.kt=function(a){var b=this.tb;b.reset();1!==this.sa&&b.scale(this.sa);var c=this.ka;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Ab(a.copy(),this.tb)};function Sj(a){var b=a.isModified;a.wx!==b&&(a.wx=b,a.S("Modified"))}function Tj(a){a=gi.get(a);return null!==a?new a:new hi}
T.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===de&&"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.Vc||this.Qf||(this.$k=!0,this.Ln&&(this.eg=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.nc(),this.S("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.nc());else if(this.Z){this.Z=!1;try{if(""===a.modelChange&&c===de){if("FinishedUndo"===d||"FinishedRedo"===d)this.S("ChangedSelection",this.selection),hh(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.nc();this.$k=!0;this.ed();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||ih(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.pe=Math.min(this.pe,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(Sj(this),this.Ts.clear(),Fh(this.animationManager));if(!this.pu&&g&&this.lastInput.targetDiagram){this.pu=!0;var h=this;ua(function(){h.currentTool.standardMouseOver();h.pu=!1},10)}}}finally{this.Z=!0}}}};
function Aj(a,b){b=b.T.m;for(var c=b.length,d=0;d<c;d++)Uj(a,b[d])}function Uj(a,b){if(b instanceof Vj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.Cg instanceof G&&c.Cg.add(a);var d=b.Gg;null!==d&&!0===d.zr&&null!==b.diagram&&b.diagram.$o.add(b);if(c.Qn)if(c=c.getAttribute("src")||"",d=a.$g.H(c),null===d)d=[],d.push(b),a.$g.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function Wj(a,b){if(b instanceof Vj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&(c.Cg instanceof G&&c.Cg.remove(a),Xj(c),c.Qn)){c=c.getAttribute("src")||"";var d=a.$g.H(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.$g.remove(c),Ii(c));break}}}}T.prototype.Hd=function(){this.partManager.Hd()};T.prototype.Wj=function(a,b){this.Ld.Wj(a,b)};T.prototype.Yj=function(a,b){this.Ld.Yj(a,b)};T.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};
T.prototype.Eb=function(a){return this.partManager.Eb(a)};T.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=T.prototype;t.vc=function(a){return this.partManager.vc(a)};t.Hi=function(a){return this.partManager.Hi(a)};t.uc=function(a){return this.partManager.uc(a)};t.Ds=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Ds.apply(this.partManager,b instanceof Array?b:ea(ca(b)))};
t.Cs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Cs.apply(this.partManager,b instanceof Array?b:ea(ca(b)))};function Ji(a){var b=a.ka,c=a.sa;a.vx.h(b.x,b.y,Math.max(a.ua,0)/c,Math.max(a.ta,0)/c)}function vj(a,b){a.vj=!1;var c=a.gr;c.A(b)||(c=c.copy(),a.gr.assign(b),Si(a,!1),a.S("DocumentBoundsChanged",void 0,c),Vi(a))}t.Sa=function(){if(this.vj){var a=N.alloc();vj(this,this.computeBounds(a));N.free(a)}};
t.Xz=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.Wz=function(){return this.xi.iterator};t.xA=function(a){hh(this);a&&Yj(this,!0);this.Vc?jj(this,!1):(this.$k=!0,rf(this))};function Yj(a,b){for(var c=a.xi.iterator;c.next();)Zj(a,c.value,b);a.layout&&(b?a.layout.isValidLayout=!1:a.layout.B())}
function Zj(a,b,c){if(null!==b){for(var d=b.zl.iterator;d.next();)Zj(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.B())}}
function jj(a,b){if(a.Nh&&!a.Gt){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.wa("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.rb&&(b||gh(f,"Layout"));a.Nh=!1;for(var g=a.xi.iterator;g.next();)ak(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),hh(a),e.isValidLayout=!0):a.Nh=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.Xa("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||ih(f),a.Z=c}}}function ak(a,b,c,d){if(null!==b){for(var e=b.zl.iterator;e.next();)ak(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Fh=!b.location.u(),e.doLayout(b),b.B(32),lj(a,b),e.isValidLayout=!0):a.Nh=!0)}}t.cA=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Ji()&&a.add(c)}return a.iterator};
function pi(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 I,d=new I;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.Jw=c;a.Iw=d}
function uj(a,b){var c=a.Iw.H(b);return null!==c?c:a.Iw.H(b.toLowerCase())}function jk(a,b){var c=a.Jw.H(b);if(null!==c)return c;c=a.Jw.H(b.toLowerCase());if(null!==c)return c;C("Unknown DiagramEvent name: "+b)}t.Xj=function(a,b){a=jk(this,a);null!==a&&a.add(b);return this};t.um=function(a,b){a=jk(this,a);null!==a&&a.remove(b)};
t.S=function(a,b,c){var d=jk(this,a),e=new ae;e.diagram=this;a=uj(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.xa(),c=0;c<b;c++)(0,d[c])(e)};function nk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.ms||b.isComplexRoutingRealtime:!0}t.qk=function(a,b){return ok(this,!1,null,b||null).qk(a.x,a.y,a.width,a.height)};
T.prototype.computeOccupiedArea=function(a){return this.isVirtualized?this.viewportBounds.copy():this.vj?Ri(this,a):a.assign(this.documentBounds)};
function ok(a,b,c,d){var e=a.si;null===e&&(a.si=e=new pk(a.avoidanceCellSize));if(e.Ms||e.group!==c||e.Fy!==d){e.ly=Math.max(e.it+1,Math.floor(a.avoidanceLimit/a.avoidanceCellSize.width));e.my=Math.max(e.it+1,Math.floor(a.avoidanceLimit/a.avoidanceCellSize.height));null!==c&&(c=qk(a,c));if(null===c){b=N.alloc();a.computeOccupiedArea(b);b.Gc(100,100);e.initialize(b);for(var f=a.nodes;f.next();){var g=f.value,h=g.layer;null!==h&&h.visible&&!h.isTemporary&&rk(a,g,d,b)}N.free(b)}else{0<c.memberParts.count&&
(b=a.computePartsBounds(c.memberParts,!1),b.Gc(20,20),e.initialize(b));b=N.alloc();for(f=c.memberParts;f.next();)g=f.value,g instanceof W&&rk(a,g,d,b);N.free(b)}e.group=c;e.Fy=d;e.Ms=!1}else b&&sk(e);return e}function qk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?qk(a,b.containingGroup):null}
function rk(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.si;var e=b.x,f=b.y;if(tk(a,e,f))for(c=(f-a.xd)/a.ec|0,d=Math.min((e+b.width-a.wd)/a.dc|0,a.zi),b=Math.min((f+b.height-a.xd)/a.ec|0,a.Ai),e=(e-a.wd)/a.dc|0;e<=d;e++)if(f=a.Qb[e],f.fill)f.fill(uk,c,b+1);else for(var g=c;g<=b;g++)f[g]=uk}else if(b instanceof hf)for(b=b.memberParts;b.next();)e=b.value,e instanceof W&&rk(a,e,c,d)}
function vk(a,b){null===a.si||a.si.Ms||void 0!==b&&(!b.avoidable||b.isLinkLabel)||(a.si.Ms=!0)}T.prototype.zs=function(a){this.Pq.assign(a);this.computeAutoScrollPosition(this.Pq).Ta(this.position)?this.og():wk(this)};
function wk(a){-1===a.Jk&&(a.Jk=ua(function(){if(-1!==a.Jk&&(a.og(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.Pq);b.Ta(a.position)||(a.position=b,a.lastInput.documentPoint=a.kt(a.Pq),a.doMouseMove(),a.vj=!0,b=N.alloc(),a.computeBounds(b),b.Nc(a.documentBounds),vj(a,b),N.free(b),a.Uc=!0,a.ed(),wk(a))}},a.Oq))}T.prototype.og=function(){-1!==this.Jk&&(x.clearTimeout(this.Jk),this.Jk=-1)};
T.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.Qq;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.Ta(pb)||(b=new J(b.x+f.x/e,b.y+f.y/e));
N.free(d);J.free(f);return b};t=T.prototype;t.Vs=function(){return null};t.Gv=function(){return null};t.jz=function(a,b){this.Xy.add(a,b)};t.ev=function(a){(this.tx=a)||this.nodes.each(function(a){a instanceof hf&&(a.mr=null)})};
function xk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].ul){f=!1;break}f||a-l>k?b(c,e,h):x.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.$g.iterator;g.next();)if(!g.value[0].ul){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.zA=function(a){if(!Jg)return null;void 0===a&&(a={});a.returnType="Image";return this.ny(a)};
t.ny=function(a){void 0===a&&(a={});return xk(this,this.AA,a)};
t.AA=function(a,b,c){var d=yk(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 zk+"data":e=d.getImageData(0,0,c.width,c.height);break;case zk:d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&C('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 yk(a,b,c,d){a.animationManager.nc();a.ed();if(null===a.Aa)return null;"object"!==typeof b&&C("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 ic(l):l instanceof ic||C("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.Sb.Ec(!0);n=new Ak(null,p);var u=n.context;if(!(e||f||k||h)){n.width=a.ua+Math.ceil(l.left+l.right);n.height=a.ta+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.gq=r;sj(a,d.context,l,new M(n.width,n.height),a.sa,a.ka,k,m,q,b);return d.context}a.Bn=!1;sj(a,u,l,new M(n.width,n.height),a.sa,a.ka,k,m,q,b);a.Bn=!0;return n.context}var v=a.er,w=a.documentBounds.copy();w.cw(a.mb);if(q)for(var z=a.Na.m,y=z.length,A=0;A<y;A++){var B=z[A];if(B.visible&&B.isTemporary){B=B.Fa.m;for(var F=B.length,K=0;K<F;K++){var S=B[K];S.isInDocumentBounds&&S.isVisible()&&(S=S.actualBounds,S.u()&&w.Nc(S))}}}z=new J(w.x,w.y);if(null!==k){y=
new N(0,0,0,0);A=!0;B=k.iterator;for(B.reset();B.next();)F=B.value,F instanceof V&&(K=F.layer,null!==K&&!K.visible||null!==K&&!q&&K.isTemporary||!F.isVisible()||(F=F.actualBounds,F.u()&&(A?(A=!1,y.assign(F)):y.Nc(F))));w.width=y.width;w.height=y.height;z.x=y.x;z.y=y.y}null!==h&&h.u()&&(z=h,f||(f=v));y=h=0;null!==l&&(h=l.left+l.right,y=l.top+l.bottom);A=B=0;null!==e&&(B=e.width,A=e.height,isFinite(B)&&(B=Math.max(0,B-h)),isFinite(A)&&(A=Math.max(0,A-y)));null!==e&&null!==f?("NaN"===f&&(f=v),e.u()?
(e=B,w=A):isNaN(A)?(e=B,w=w.height*f):(e=w.width*f,w=A)):null!==e?e.u()?(f=Math.min(B/w.width,A/w.height),e=B,w=A):isNaN(A)?(f=B/w.width,e=B,w=w.height*f):(f=A/w.height,e=w.width*f,w=A):null!==f?"NaN"===f&&g.u()?(f=Math.min((g.width-h)/w.width,(g.height-y)/w.height),f>v?(f=v,e=w.width,w=w.height):(e=g.width,w=g.height)):(e=w.width*f,w=w.height*f):(f=v,e=w.width,w=w.height);null!==l?(e+=h,w+=y):l=new ic(0);null!==g&&(v=g.width,g=g.height,isNaN(v)&&(v=2E3),isNaN(g)&&(g=2E3),isFinite(v)&&(e=Math.min(e,
v)),isFinite(g)&&(w=Math.min(w,g)));n.width=Math.ceil(e);n.height=Math.ceil(w);if("SVG"===c){if(null===d)return null;d.resize(n.width,n.height,n.width,n.height);d.ownerDocument=p;d.gq=r;sj(a,d.context,l,new M(Math.ceil(e),Math.ceil(w)),f,z,k,m,q,b);return d.context}a.Bn=!1;sj(a,u,l,new M(Math.ceil(e),Math.ceil(w)),f,z,k,m,q,b);a.Bn=!0;return n.context}
na.Object.defineProperties(T.prototype,{div:{get:function(){return this.Ea},set:function(a){if(this.Ea!==a){var b=this.Ea;null!==b?(b.F=void 0,b.goDiagram=void 0,b.go=void 0,b.innerHTML="",null!==this.Aa&&(b=this.Aa.La,this.removeEventListener(b,"pointermove",this.xk,!1),this.removeEventListener(b,"pointerdown",this.wk,!1),this.removeEventListener(b,"pointerup",this.zk,!1),this.removeEventListener(b,"pointerout",this.yk,!1),this.Aa.Ox()),this.Hl&&(this.Hl.disconnect(),
this.Hl=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.Aa=null,this.removeEventListener(x,"resize",this.lw,!1),this.removeEventListener(x,"wheel",this.tk,!0),se===this&&(se=null)):this.Qf=!1;this.Ea=null;if(null!==a){if(b=a.F)b.div=null;ni(this,a);this.redraw()}}}},Ex:{
get:function(){return this.Mr}},Pi:{get:function(){return this.Qf}},draggedLink:{get:function(){return this.It},set:function(a){this.It!==a&&(this.It=a,null!==a&&(this.tu=a.fromPort,this.uu=a.toPort))}},sy:{get:function(){return this.tu},set:function(a){this.tu=a}},ty:{get:function(){return this.uu},set:function(a){this.uu=a}},animationManager:{get:function(){return this.Ld}},
undoManager:{get:function(){return this.Tb.undoManager}},skipsUndoManager:{get:function(){return this.gh},set:function(a){this.gh=a;this.Tb.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Gt},set:function(a){this.Gt=a}},opacity:{get:function(){return this.lb},set:function(a){var b=this.lb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",T,"opacity"),this.lb=a,this.g("opacity",
b,a),this.N())}},validCycle:{get:function(){return this.Vu},set:function(a){var b=this.Vu;b!==a&&(this.Vu=a,this.g("validCycle",b,a))}},layers:{get:function(){return this.Na.iterator}},isModelReadOnly:{get:function(){var a=this.Tb;return null===a?!1:a.isReadOnly},set:function(a){var b=this.Tb;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.Mg},set:function(a){var b=
this.Mg;b!==a&&(this.Mg=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.td},set:function(a){var b=this.td;b!==a&&(this.td=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.pt},set:function(a){var b=this.pt;b!==a&&(this.pt=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.aj},set:function(a){var b=this.aj;b!==a&&(this.aj=a,this.g("allowCopy",b,a))}},
allowDelete:{get:function(){return this.bj},set:function(a){var b=this.bj;b!==a&&(this.bj=a,this.g("allowDelete",b,a))}},allowDragOut:{get:function(){return this.qt},set:function(a){var b=this.qt;b!==a&&(this.qt=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.rt},set:function(a){var b=this.rt;b!==a&&(this.rt=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.kj},
set:function(a){var b=this.kj;b!==a&&(this.kj=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.cj},set:function(a){var b=this.cj;b!==a&&(this.cj=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.lj},set:function(a){var b=this.lj;b!==a&&(this.lj=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.tt},set:function(a){var b=this.tt;b!==a&&(this.tt=
a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.dj},set:function(a){var b=this.dj;b!==a&&(this.dj=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.fj},set:function(a){var b=this.fj;b!==a&&(this.fj=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.ej},set:function(a){var b=this.ej;b!==a&&(this.ej=a,this.g("allowMove",b,a))}},allowReshape:{
get:function(){return this.gj},set:function(a){var b=this.gj;b!==a&&(this.gj=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.hj},set:function(a){var b=this.hj;b!==a&&(this.hj=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.ij},set:function(a){var b=this.ij;b!==a&&(this.ij=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.jj},set:function(a){var b=
this.jj;b!==a&&(this.jj=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.ut},set:function(a){var b=this.ut;b!==a&&(this.ut=a,this.g("allowUndo",b,a))}},allowZoom:{get:function(){return this.wt},set:function(a){var b=this.wt;b!==a&&(this.wt=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.Zn},set:function(a){var b=this.Zn;b!==a&&(this.Zn=a,Vi(this),this.N(),this.g("hasVerticalScrollbar",
b,a),Si(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.Yn},set:function(a){var b=this.Yn;b!==a&&(this.Yn=a,Vi(this),this.N(),this.g("hasHorizontalScrollbar",b,a),Si(this,!1))}},allowHorizontalScroll:{get:function(){return this.st},set:function(a){var b=this.st;b!==a&&(this.st=a,this.g("allowHorizontalScroll",b,a),Si(this,!1))}},allowVerticalScroll:{get:function(){return this.vt},set:function(a){var b=
this.vt;b!==a&&(this.vt=a,this.g("allowVerticalScroll",b,a),Si(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.Hu},set:function(a){var b=this.Hu;b!==a&&(0>a&&xa(a,">= 0",T,"scrollHorizontalLineChange"),this.Hu=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.Lu},set:function(a){var b=this.Lu;b!==a&&(0>a&&xa(a,">= 0",T,"scrollVerticalLineChange"),this.Lu=a,this.g("scrollVerticalLineChange",
b,a))}},lastInput:{get:function(){return this.Dj},set:function(a){this.Dj=a}},previousInput:{get:function(){return this.bh},set:function(a){this.bh=a}},firstInput:{get:function(){return this.pr},set:function(a){this.pr=a}},currentCursor:{get:function(){return this.Dt},set:function(a){""===a&&(a=this.dr);if(this.Dt!==a){var b=this.Aa,c=this.Ea;if(null!==b&&null!==c){this.Dt=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.dr},set:function(a){""===a&&(a="auto");var b=this.dr;b!==a&&(this.dr=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.vg},
set:function(a){var b=this.vg;b!==a&&(this.vg=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Dg},set:function(a){var b=this.Dg;b!==a&&(this.Dg=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.xg},set:function(a){var b=this.xg;b!==a&&(this.xg=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.Wg},set:function(a){var b=this.Wg;b!==a&&(this.Wg=a,this.g("mouseOver",
b,a))}},mouseHover:{get:function(){return this.Ug},set:function(a){var b=this.Ug;b!==a&&(this.Ug=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Tg},set:function(a){var b=this.Tg;b!==a&&(this.Tg=a,this.g("mouseHold",b,a))}},mouseDragOver:{get:function(){return this.ou},set:function(a){var b=this.ou;b!==a&&(this.ou=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Rg},
set:function(a){var b=this.Rg;b!==a&&(this.Rg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.Tt},set:function(a){var b=this.Tt;b!==a&&(this.Tt=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{get:function(){return this.Sg},set:function(a){var b=this.Sg;b!==a&&(this.Sg=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.Vg},set:function(a){var b=
this.Vg;b!==a&&(this.Vg=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.qh},set:function(a){var b=this.qh;b!==a&&(this.qh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.yg},set:function(a){var b=this.yg;b!==a&&(this.yg=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.Oc},set:function(a){this.Oc!==a&&(this.Oc=a,a.Ke(this))}},toolManager:{
get:function(){return this.Zi},set:function(a){this.Zi!==a&&(this.Zi=a,a.diagram=this)}},defaultTool:{get:function(){return this.Pc},set:function(a){var b=this.Pc;b!==a&&(this.Pc=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{get:function(){return this.yc},set:function(a){var b=this.yc;b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.yc=
a,a.diagram=this,a.doStart())}},selection:{get:function(){return this.kx}},maxSelectionCount:{get:function(){return this.ju},set:function(a){var b=this.ju;if(b!==a)if(0<=a&&!isNaN(a)){if(this.ju=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.S("ChangingSelection",this.selection);b=this.selection.xa();for(var c=0;c<a;c++)b[c].isSelected=!1;this.S("ChangedSelection",this.selection)}}else xa(a,
">= 0",T,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.qu},set:function(a){var b=this.qu;b!==a&&(this.qu=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{get:function(){return this.St},set:function(a){var b=this.St;b!==a&&(this.St=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.gu},
set:function(a){var b=this.gu;b!==a&&(this.gu=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.Pw}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.fo&&this.pe!==a.historyIndex:this.fo},set:function(a){if(this.fo!==a){this.fo=a;var b=this.undoManager;!a&&b.isEnabled&&(this.pe=b.historyIndex);a||Sj(this)}}},model:{
get:function(){return this.Tb},set:function(a){var b=this.Tb;if(b!==a){this.currentTool.doCancel();b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&C("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.nc(!0);var c=Hi(this,!0);this.Qf=!1;this.Ln=!0;this.pe=-2;this.eg=!1;var d=this.ob;this.ob=!0;gh(this.animationManager,"Model");b&&(null!==this.$e&&this.$e.each(function(a){b.Bk(a)}),b.Bk(this.Ih));this.Tb=a;this.partManager=Tj(this.Tb.type);for(var e=
0;e<c.length;e++)this.add(c[e]);a.uh(this.Kd);this.partManager.addAllModeledParts();a.Bk(this.Kd);a.uh(this.Ih);null!==this.$e&&this.$e.each(function(b){a.uh(b)});this.ob=d;this.Pa();this.ob||this.N();b&&a.undoManager.copyProperties(b.undoManager)}}},Z:{get:function(){return this.Tw},set:function(a){this.Tw=a}},Ts:{get:function(){return this.Wy}},skipsModelSourceBindings:{get:function(){return this.lx},set:function(a){this.lx=
a}},ht:{get:function(){return this.Nu},set:function(a){this.Nu=a}},nodeTemplate:{get:function(){return this.Yg.H("")},set:function(a){var b=this.Yg.H("");b!==a&&(this.Yg.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Hd())}},nodeTemplateMap:{get:function(){return this.Yg},set:function(a){var b=this.Yg;b!==a&&(this.Yg=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||
this.Hd())}},groupTemplate:{get:function(){return this.uj.H("")},set:function(a){var b=this.uj.H("");b!==a&&(this.uj.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Hd())}},groupTemplateMap:{get:function(){return this.uj},set:function(a){var b=this.uj;b!==a&&(this.uj=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Hd())}},linkTemplate:{get:function(){return this.hi.H("")},
set:function(a){var b=this.hi.H("");b!==a&&(this.hi.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Hd())}},linkTemplateMap:{get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(this.hi=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Hd())}},isMouseCaptured:{get:function(){return this.Sw},set:function(a){var b=this.Aa;null!==b&&(b=b.La,b instanceof SVGElement||(a?(this.lastInput.bubbles=
!1,this.removeEventListener(b,"pointermove",this.xk,!1),this.removeEventListener(b,"pointerdown",this.wk,!1),this.removeEventListener(b,"pointerup",this.zk,!1),this.removeEventListener(b,"pointerout",this.yk,!1),this.addEventListener(x,"pointermove",this.xk,!0),this.addEventListener(x,"pointerdown",this.wk,!0),this.addEventListener(x,"pointerup",this.zk,!0),this.addEventListener(x,"pointerout",this.yk,!0),this.removeEventListener(b,"wheel",this.tk,!1),this.addEventListener(x,"wheel",this.tk,!0),this.addEventListener(x,
"selectstart",this.preventDefault,!1)):(this.removeEventListener(x,"pointermove",this.xk,!0),this.removeEventListener(x,"pointerdown",this.wk,!0),this.removeEventListener(x,"pointerup",this.zk,!0),this.removeEventListener(x,"pointerout",this.yk,!0),this.addEventListener(b,"pointermove",this.xk,!1),this.addEventListener(b,"pointerdown",this.wk,!1),this.addEventListener(b,"pointerup",this.zk,!1),this.addEventListener(b,"pointerout",this.yk,!1),this.removeEventListener(x,"wheel",this.tk,!0),this.removeEventListener(x,
"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.tk,!1)),this.Sw=a))}},position:{get:function(){return this.ka},set:function(a){var b=J.alloc().assign(this.ka);if(!b.A(a)){var c=this.viewportBounds.copy();this.ka.assign(a);Ih(this.animationManager,b,this.ka);this.ob||null===this.Aa&&!this.Rp.u()?Ji(this):(this.ob=!0,a=this.scale,Ui(this,this.gr,this.ua/a,this.ta/a,this.Qk,!1),this.ob=!1);if(!this.ob)this.onViewportBoundsChanged(c,this.viewportBounds,
this.sa,!1)}J.free(b)}},initialPosition:{get:function(){return this.Vt},set:function(a){this.Vt.A(a)||(this.Vt=a.I())}},initialScale:{get:function(){return this.Wt},set:function(a){this.Wt!==a&&(this.Wt=a)}},grid:{get:function(){null===this.Vd&&(this.Vd=Mi(this));return this.Vd},set:function(a){var b=this.Vd;if(b!==a){null===b&&(b=this.Vd=Mi(this));a.type!==X.Grid&&C("Diagram.grid must be a Panel of type Panel.Grid");
var c=b.panel;null!==c&&c.remove(b);this.Vd=a;a.name="GRID";null!==c&&c.add(a);ij(this);this.N();this.g("grid",b,a)}}},viewportBounds:{get:function(){return this.vx}},viewSize:{get:function(){return this.Rp},set:function(a){var b=this.viewSize;b.A(a)||(this.Rp=a=a.I(),this.ta=this.ua=0,a.u()?(this.ua=a.width,this.ta=a.height):null!==this.Ea&&(this.ua=this.Ea.clientWidth||1,this.ta=this.Ea.clientHeight||1),Ji(this),this.Pa(),this.g("viewSize",
b,a),this.redraw())}},fixedBounds:{get:function(){return this.Qt},set:function(a){var b=this.Qt;b.A(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||C("fixedBounds width/height must not be Infinity"),this.Qt=a=a.I(),this.Pa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.Rj},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.Rj;b.A(a)||(this.Rj=a=a.I(),this.g("scrollMargin",b,a),this.Aq())}},
scrollMode:{get:function(){return this.Sj},set:function(a){var b=this.Sj;b!==a&&(this.Sj=a,a===Mh&&Si(this,!1),this.g("scrollMode",b,a),this.N())}},scrollsPageOnFocus:{get:function(){return this.Mu},set:function(a){var b=this.Mu;b!==a&&(this.Mu=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.xu},set:function(a){var b=this.xu;b!==a&&(this.xu=a,Si(this,!1),this.g("positionComputation",
b,a))}},scaleComputation:{get:function(){return this.Eu},set:function(a){var b=this.Eu;b!==a&&(this.Eu=a,Qj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.gr}},isVirtualized:{get:function(){return this.eu},set:function(a){var b=this.eu;b!==a&&(this.eu=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.sa},
set:function(a){var b=this.sa;b!==a&&Qj(this,b,a)}},defaultScale:{get:function(){return this.er},set:function(a){this.er=a}},autoScale:{get:function(){return this.Oh},set:function(a){var b=this.Oh;b!==a&&(this.Oh=a,this.g("autoScale",b,a),a!==mh&&Si(this,!1))}},initialAutoScale:{get:function(){return this.Lg},set:function(a){var b=this.Lg;b!==a&&(this.Lg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{
get:function(){return this.Xt},set:function(a){var b=this.Xt;b!==a&&(a.hb()||C("initialViewportSpot must be a specific Spot: "+a),this.Xt=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.Ut},set:function(a){var b=this.Ut;b!==a&&(a.hb()||C("initialViewportSpot must be a specific Spot: "+a),this.Ut=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.mu},set:function(a){var b=
this.mu;b!==a&&(0<a?(this.mu=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):xa(a,"> 0",T,"minScale"))}},maxScale:{get:function(){return this.iu},set:function(a){var b=this.iu;b!==a&&(0<a?(this.iu=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):xa(a,"> 0",T,"maxScale"))}},zoomPoint:{get:function(){return this.Yu},set:function(a){this.Yu.A(a)||(this.Yu=a=a.I())}},contentAlignment:{get:function(){return this.Qk},
set:function(a){var b=this.Qk;b.A(a)||(this.Qk=a=a.I(),this.g("contentAlignment",b,a),Si(this,!1))}},initialContentAlignment:{get:function(){return this.vr},set:function(a){var b=this.vr;b.A(a)||(this.vr=a=a.I(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.mb},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.mb;b.A(a)||(this.mb=a=a.I(),this.Pa(),this.g("padding",b,a))}},partManager:{
get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(null!==a.diagram&&C("Cannot share PartManagers between Diagrams: "+a.toString()),b&&b.Ke(null),this.Jh=a,a.Ke(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.Ac},set:function(a){var b=this.Ac;b!==a&&(this.Ac=a,a.diagram=this,a.group=null,this.Nh=!0,this.g("layout",b,a),this.Fb())}},isTreePathToChildren:{get:function(){return this.du},set:function(a){var b=this.du;if(b!==a&&(this.du=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Bk(a.value)}},treeCollapsePolicy:{get:function(){return this.Tu},set:function(a){var b=
this.Tu;b!==a&&(a!==qi&&a!==Ck&&a!==Dk&&C("Unknown Diagram.treeCollapsePolicy: "+a),this.Tu=a,this.g("treeCollapsePolicy",b,a))}},He:{get:function(){return this.Rw},set:function(a){this.Rw=a}},avoidanceCellSize:{get:function(){return this.Bw},set:function(a){this.si=null;this.Bw=new M(Math.max(1,a.width),Math.max(1,a.height))}},avoidanceLimit:{get:function(){return this.Cw},set:function(a){this.Cw=Math.max(1,
a)}},autoScrollInterval:{get:function(){return this.Oq},set:function(a){var b=this.Oq;b!==a&&(this.Oq=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.Qq},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.Qq;b.A(a)||(this.Qq=a=a.I(),this.Pa(),this.g("autoScrollRegion",b,a))}}});
na.Object.defineProperties(T,{licenseKey:{get:function(){return Ek.Xb()},set:function(a){Ek.add(a.replace(/\s/g,""))}},version:{get:function(){return Fk}}});T.prototype.makeImageData=T.prototype.ny;T.prototype.makeImage=T.prototype.zA;T.prototype.cacheGroupExternalLinks=T.prototype.ev;T.prototype.addRenderer=T.prototype.jz;T.prototype.makeSVG=T.prototype.Gv;T.prototype.makeSvg=T.prototype.Vs;T.prototype.stopAutoScroll=T.prototype.og;
T.prototype.doAutoScroll=T.prototype.zs;T.prototype.isUnoccupied=T.prototype.qk;T.prototype.raiseDiagramEvent=T.prototype.S;T.prototype.removeDiagramListener=T.prototype.um;T.prototype.addDiagramListener=T.prototype.Xj;T.prototype.findTreeRoots=T.prototype.cA;T.prototype.layoutDiagram=T.prototype.xA;T.prototype.findTopLevelGroups=T.prototype.Wz;T.prototype.findTopLevelNodesAndLinks=T.prototype.Xz;T.prototype.ensureBounds=T.prototype.Sa;T.prototype.findLinksByExample=T.prototype.Cs;
T.prototype.findNodesByExample=T.prototype.Ds;T.prototype.findLinkForData=T.prototype.uc;T.prototype.findNodeForData=T.prototype.Hi;T.prototype.findPartForData=T.prototype.vc;T.prototype.findLinkForKey=T.prototype.findLinkForKey;T.prototype.findNodeForKey=T.prototype.Eb;T.prototype.findPartForKey=T.prototype.findPartForKey;T.prototype.rebuildParts=T.prototype.Hd;T.prototype.transformViewToDoc=T.prototype.kt;T.prototype.transformRectDocToView=T.prototype.cB;T.prototype.transformDocToView=T.prototype.Iq;
T.prototype.centerRect=T.prototype.xs;T.prototype.scrollToRect=T.prototype.Vv;T.prototype.scroll=T.prototype.scroll;T.prototype.highlightCollection=T.prototype.oA;T.prototype.highlight=T.prototype.nA;T.prototype.selectCollection=T.prototype.UA;T.prototype.select=T.prototype.select;T.prototype.updateAllRelationshipsFromData=T.prototype.Lq;T.prototype.updateAllTargetBindings=T.prototype.updateAllTargetBindings;T.prototype.commit=T.prototype.commit;T.prototype.rollbackTransaction=T.prototype.Df;
T.prototype.commitTransaction=T.prototype.Xa;T.prototype.startTransaction=T.prototype.wa;T.prototype.raiseChanged=T.prototype.g;T.prototype.raiseChangedEvent=T.prototype.Va;T.prototype.removeChangedListener=T.prototype.Bk;T.prototype.addChangedListener=T.prototype.uh;T.prototype.removeModelChangedListener=T.prototype.PA;T.prototype.addModelChangedListener=T.prototype.Bx;T.prototype.findLayer=T.prototype.ik;T.prototype.removeLayer=T.prototype.NA;T.prototype.addLayerAfter=T.prototype.fz;
T.prototype.addLayerBefore=T.prototype.zx;T.prototype.addLayer=T.prototype.bm;T.prototype.moveParts=T.prototype.moveParts;T.prototype.copyParts=T.prototype.ek;T.prototype.removeParts=T.prototype.bt;T.prototype.remove=T.prototype.remove;T.prototype.add=T.prototype.add;T.prototype.clearDelayedGeometries=T.prototype.fv;T.prototype.setProperties=T.prototype.Hm;T.prototype.attach=T.prototype.dv;T.prototype.set=T.prototype.set;T.prototype.resetInputOptions=T.prototype.yy;T.prototype.setInputOption=T.prototype.VA;
T.prototype.getInputOption=T.prototype.km;T.prototype.resetRenderingHints=T.prototype.zy;T.prototype.setRenderingHint=T.prototype.Dy;T.prototype.getRenderingHint=T.prototype.Fe;T.prototype.maybeUpdate=T.prototype.ed;T.prototype.requestUpdate=T.prototype.Fb;T.prototype.delayInitialization=T.prototype.Bz;T.prototype.isUpdateRequested=T.prototype.tA;T.prototype.invalidateDocumentBounds=T.prototype.Pa;T.prototype.findObjectsNear=T.prototype.kg;T.prototype.findPartsNear=T.prototype.Sz;
T.prototype.findObjectsIn=T.prototype.vf;T.prototype.findPartsIn=T.prototype.Vx;T.prototype.findObjectsAt=T.prototype.Ii;T.prototype.findPartsAt=T.prototype.Rz;T.prototype.findObjectAt=T.prototype.Wb;T.prototype.findPartAt=T.prototype.im;T.prototype.focusObject=T.prototype.dA;T.prototype.alignDocument=T.prototype.lz;T.prototype.zoomToRect=T.prototype.gB;T.prototype.zoomToFit=T.prototype.zoomToFit;T.prototype.diagramScroll=T.prototype.Mx;T.prototype.focus=T.prototype.focus;
var gi=new I,Ki=null,Jg=void 0!==x.document,Ei=null,Gi="",mh=new D(T,"None",0),Xi=new D(T,"Uniform",1),Yi=new D(T,"UniformToFill",2),wf=new D(T,"CycleAll",10),Kf=new D(T,"CycleNotDirected",11),Mf=new D(T,"CycleNotDirectedFast",12),Nf=new D(T,"CycleNotUndirected",13),Hf=new D(T,"CycleDestinationTree",14),Jf=new D(T,"CycleSourceTree",15),Mh=new D(T,"DocumentScroll",1),Oh=new D(T,"InfiniteScroll",2),qi=new D(T,"TreeParentCollapsed",21),Ck=new D(T,"AllParentsCollapsed",22),Dk=new D(T,"AnyParentsCollapsed",
23),Ek=new E,Fk="2.2.9",zk="image",Gk=null,ei=!1;
function fi(){if(Jg){var a=x.document.createElement("canvas"),b=a.getContext("2d"),c=Pa("7ca11abfd022028846");b[c]=Pa("398c3597c01238");for(var d=["5da73c80a36455d6038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",qd.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],e=1;5>e;e++)b[Pa("7ca11abfd7330390")](Pa(d[e-1]),10,15*e);b[c]=Pa("39f046ebb36e4b");for(c=1;5>c;c++)b[Pa("7ca11abfd7330390")](Pa(d[c-1]),10,15*c);if(4!==d.length||"5"!==d[0][0]||"7"!==d[3][0])qd.prototype.Ed=qd.prototype.Fx;
Gk=a}}T.className="Diagram";T.fromDiv=function(a){var b=a;"string"===typeof a&&(b=x.document.getElementById(a));return b instanceof HTMLDivElement&&b.F instanceof T?b.F:null};T.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};T.useDOM=function(a){Jg=a?void 0!==x.document:!1};T.isUsingDOM=function(){return Jg};T.None=mh;T.Uniform=Xi;
T.UniformToFill=Yi;T.CycleAll=wf;T.CycleNotDirected=Kf;T.CycleNotDirectedFast=Mf;T.CycleNotUndirected=Nf;T.CycleDestinationTree=Hf;T.CycleSourceTree=Jf;T.DocumentScroll=Mh;T.InfiniteScroll=Oh;T.TreeParentCollapsed=qi;T.AllParentsCollapsed=Ck;T.AnyParentsCollapsed=Dk;function mi(){this.az=null;this.j="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.hd=this.j=!0:this.hd=null}
function rj(a,b){b.Sb.setTransform(b.ac,0,0,b.ac,0,0);b.Sb.Bd();if(null===a.hd)a:{b="f";var c=x[Pa("76a715b2f73f148a")][Pa("72ba13b5")];a.hd=!0;if(Jg){var d=T[Pa("76a115b6ed251eaf4692")];if(d)for(var e=Ek.iterator;e.next();){d=e.value;d=Pa(d).split(Pa("39e9"));if(6>d.length)break;var f=Pa(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Pa(sa[Pa("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){var h=x[Pa("74a900bae4370f8b51")][Pa("6fbb13a1c2311e8a57")].toLowerCase();g=h[Pa("73a612b6fb191d")](Pa("3aad1ab6e022098b4dc4"));
f=Pa(d[2]);if(-1<g&&(h=h[Pa("73a612b6fb191d")](f.toLowerCase()+"/"),a.hd=!(-1<h&&h<g),!a.hd))break;g=c[Pa("76ad18b4f73e")];for(h=c[Pa("73a612b6fb191d")](Pa("35e7"))+2;h<g;h++)b+=c[h];g=b[Pa("73a612b6fb191d")](f);0>g&&f!==Pa("7da71ca0ad381e90")&&(g=b[Pa("73a612b6fb191d")](Pa("76a715b2ef3e149757")));0>g&&(g=b[Pa("73a612b6fb191d")](Pa("76a715b2ef3e149757")));0>g&&(g=c[Pa("73a612b6fb191d")](Pa("7baa19a6f76c1988428554")));a.hd=!(0<=g&&g<b[Pa("73a612b6fb191d")](Pa("35"))||-1===b[Pa("73a612b6fb191d")](Pa("35")));
if(!a.hd)break;if(c[Pa("73a612b6fb191d")](Pa("7fb002b6ed25128b4da25b2e"))&&c[Pa("73a612b6fb191d")](Pa("75ba1beee63a1e875799507d"))&&(a.hd=!(-1<c[Pa("73a612b6fb191d")](f)),!a.hd))break;if("#"===f[0]){g=x.document.createElement("div");for(var k=d[0].replace(/[A-Za-z]/g,"");4>k.length;)k+="9";h=k;k=k.substr(k.length-4);d="";d+=["gsh","gsf"][parseInt(k.substr(0,1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(k.substr(0,1),10)%4];g[Pa("79a417a0f0181a8946")]=d;if(x.document[Pa("78a712aa")]){x.document[Pa("78a712aa")][Pa("7bb806b6ed32388c4a875b")](g);
k=x.getComputedStyle(g).getPropertyValue(Pa("78a704b7e62456904c9b12701b6532a8"));var l=x.getComputedStyle(g).getPropertyValue(Pa("75b817b0ea2202"));x.document[Pa("78a712aa")][Pa("68ad1bbcf533388c4a875b")](g);if(k)if(g=x[Pa("77a902b0eb1b1e804a8a")],l==="0."+parseInt(h,10)%100||-1!==k.indexOf(parseInt(f[1]+f[2],16))&&-1!==k.indexOf(parseInt(f[3]+f[4],16))){a.hd=!1;break}else if(g&&g(Pa("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=document.styleSheets[f].rules||
document.styleSheets[f].cssRules;for(var m in g)if(d===g[m].selectorText){a.hd=!1;break a}}}else a.hd=null,a.hd=!1}}}else{m=c[Pa("76ad18b4f73e")];for(e=c[Pa("73a612b6fb191d")](Pa("35e7"))+2;e<m;e++)b+=c[e];c=b[Pa("73a612b6fb191d")](Pa("7da71ca0ad381e90"));a.hd=!(0<=c&&c<b[Pa("73a612b6fb191d")](Pa("35")))}}}return 0<a.hd&&a!==a.az?!0:!1}
function ni(a,b){if(Jg){void 0!==b&&null!==b||C("Diagram setup requires an argument DIV.");null!==a.Ea&&C("Diagram has already completed setup.");"string"===typeof b?a.Ea=x.document.getElementById(b):b instanceof HTMLDivElement?a.Ea=b:C("No DIV or DIV id supplied: "+b);null===a.Ea&&C("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ea.F&&C("Invalid div id; div already has a Diagram associated with it.");if(!a.Hl&&x.ResizeObserver){var c=ta(function(){a.Fb()},250);a.Hl=new x.ResizeObserver(function(){c()});
a.Hl.observe(a.Ea)}"static"===x.getComputedStyle(a.Ea,null).position&&(a.Ea.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.Ea.style["-webkit-tap-highlight-color"]=d;a.Ea.innerHTML="";a.Ea.F=a;a.Ea.goDiagram=a;a.Ea.go=x.go;var e=a.ns?new wj(a):new Ak(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===x.getComputedStyle(a.Ea,null).getPropertyValue("direction")&&(a.io=!0),e.style.zIndex="2",e.style.userSelect="none",e.style.MozUserSelect=
"none",e.style.touchAction="none");a.Aa=e;a.Sb=e.context;d=a.Sb;a.ac=a.computePixelRatio();a.viewSize.u()||(a.ua=a.Ea.clientWidth||1,a.ta=a.Ea.clientHeight||1);yj(a,a.ua,a.ta);a.Ea.insertBefore(e.La,a.Ea.firstChild);e=new Ak(null);e.width=1;e.height=1;a.Kw=e;a.Ty=e.context;if(Jg){e=va("div");var f=va("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.ua+"px";e.style.height=a.ta+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.Ea.appendChild(e);
e.appendChild(f);e.onscroll=Ni;e.addEventListener("pointerdown",Pi);e.F=a;e.Zy=!0;e.$y=!0;a.Ju=e;a.Gu=f}a.Aq=ta(function(){a.ti=null;a.N()},300);a.lw=ta(function(){nh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.tk=function(b){if(a.isEnabled){var c=bj(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();fj(c,b)}};a.EA=function(b){a.isEnabled&&(a.ml=!1,bj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.wk=function(b){if(a.isEnabled){a.ml=!0;var c=a.wu;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.El;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(c="touch"===b.pointerType||"pen"===b.pointerType)a.Pu=!1,a.cu=!0;var e=d;d=ej(a,b,!0,!1,!0,e);cj(a,b,d);d.targetDiagram=dj(b,b.target);d.targetObject=null;e||d.clone(a.pr);e=a.Ww;c=c?25:10;b.timeStamp-a.Vw<a.dz&&!(Math.abs(e.x-b.screenX)>c||Math.abs(e.y-b.screenY)>c)?a.Er++:a.Er=1;d.clickCount=a.Er;a.Vw=b.timeStamp;a.Ww.ng(b.screenX,b.screenY);
a.doMouseDown();1===b.button?b.preventDefault():fj(d,b)}};a.xk=function(b){if(a.isEnabled){a.ml=!0;var c=a.El;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}if(c[0].pointerId===b.pointerId){c=ej(a,b,!1,!1,!1,null!==c[1]);var d=x.document.elementFromPoint(b.clientX,b.clientY);null!==d&&void 0!==d.shadowRoot&&null!==d.shadowRoot&&(d=d.shadowRoot.elementFromPoint(b.clientX,b.clientY));var e=a,f=b;
d&&d.F&&(f=b,e=d.F);c.targetDiagram=e;cj(a,f,c);c.targetObject=null;a.doMouseMove();fj(c,b)}}};a.zk=function(b){if(a.isEnabled){a.ml=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.wu;if(c&&a.Pu)delete d[b.pointerId],b.preventDefault();else if(d=a.El,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=ej(a,b,!1,!0,!0,!1);var e=x.document.elementFromPoint(b.clientX,b.clientY);null!==e&&void 0!==e.shadowRoot&&null!==e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(b.clientX,b.clientY));
null!==e&&e.F instanceof T&&e.F!==a&&cj(e.F,b,d);null===e&&(e=b.target);cj(a,b,d);d.clickCount=a.Er;d.targetDiagram=dj(b,e);d.targetObject=null;a.doMouseUp();fj(d,b);c&&(a.cu=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.yk=function(b){if(a.isEnabled){a.ml=!1;var c=a.wu;c[b.pointerId]&&delete c[b.pointerId];c=a.El;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.Jt=d.Y["d"+Hk[1]+Hk[2]+"wI"+zk.slice(1,5)]["b"+Ik.slice(1,b)](d.Y,Gk,b,b);d.Ec(!0);Li(a)}}mi.className="DiagramHelper";function Oe(a){this.j=void 0===a?new J:a;this.o=new J}na.Object.defineProperties(Oe.prototype,{point:{get:function(){return this.j},set:function(a){this.j=a}},shifted:{get:function(){return this.o},set:function(a){this.o=a}}});var Hk="DraggingInfo";Oe.className="DraggingInfo";
function Jj(a,b,c){this.node=a;this.info=b;this.xv=c}Jj.className="DraggingNodeInfoPair";function Ee(){this.reset()}Ee.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new M(NaN,NaN)).freeze();this.gridSnapCellSpot=sc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Ee.className="DraggingOptions";
function Jk(a,b){if("string"===typeof a||x.Element&&a instanceof Element)var c=T.call(this,a)||this;else c=T.call(this)||this,b=a;Kk(c);b&&c.Hm(b);return c}ma(Jk,T);function Kk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=vc;a.layout=new Lk}Jk.prototype.reset=function(){T.prototype.reset.call(this);Kk(this)};Jk.className="Palette";
function Mk(a,b){if("string"===typeof a||x.Element&&a instanceof Element)var c=T.call(this,a)||this;else c=T.call(this)||this,b=a;var d=c;c.animationManager.isEnabled=!1;c.ob=!0;c.Ga=null;c.Yn=!1;c.Zn=!1;c.M=!0;c.C=!0;c.Ha=0;c.o=!1;c.Ol=null;c.Dy("drawShadows",!1);a=new V;var e=new uf;e.stroke="magenta";e.strokeWidth=2;e.fill="transparent";e.name="BOXSHAPE";a.selectable=!0;a.selectionAdorned=!1;a.selectionObjectName="BOXSHAPE";a.locationObjectName="BOXSHAPE";a.resizeObjectName="BOXSHAPE";a.cursor=
"move";a.add(e);c.j=a;c.allowCopy=!1;c.allowDelete=!1;c.allowSelect=!0;c.autoScrollRegion=new ic(0,0,0,0);c.ka.h(0,0);c.toolManager.Za("Dragging",new Nk,c.toolManager.mouseMoveTools);c.click=function(){var a=d.observed;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new J(c.x-b.width/2,c.y-b.height/2)}};c.Tm=function(){d.Pa();Ok(d)};c.Sm=function(){null!==d.observed&&(d.Pa(),d.N())};c.Wa=function(){1>d.updateDelay?d.N():d.o||(d.o=!0,setTimeout(function(){return d.redraw()},
d.updateDelay))};c.Kh=function(){null!==d.observed&&Ok(d)};c.autoScale=Xi;c.ob=!1;b&&Object.assign(c,b);return c}ma(Mk,T);Mk.prototype.computePixelRatio=function(){return 1};
Mk.prototype.redraw=function(){if(this.o&&1<=this.updateDelay){this.o=!1;var a=this.Aa,b=this.Sb;if(null!==a&&null!==b){pj(this);if(null===this.Ol){var c=new Ak(null);c.width=a.width;c.height=a.height;this.Ol=c}try{this.Aa=this.Ol,this.Sb=this.Aa.context,this.Sb.Ec(!0),this.Sb.setTransform(1,0,0,1,0,0),this.Sb.clearRect(0,0,this.Aa.width,this.Aa.height),Pk(this)}finally{this.Aa=a,this.Sb=b}}}T.prototype.redraw.call(this)};
Mk.prototype.lc=function(){null===this.Ea&&C("No div specified");null===this.Aa&&C("No canvas specified");if(!(this.Aa instanceof wj)&&($h(this.box),this.Uc)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.Pi){pj(this);var b=this.Aa;a=this.Sb;a.Ec(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Pk(this):null!==this.Ol&&(a.drawImage(this.Ol.La,0,0),b=this.tb,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.ac,this.ac),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Na.m;for(var c=b.length,d=0;d<c;d++)b[d].lc(a,this);this.Uc=this.xj=!1}}};
function Pk(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).Nc(b.viewportBounds),ij(b,e),N.free(e),hh(b));var f=a.tb;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.Sb;e.scale(a.ac,a.ac);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Na.m;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=ai(h,e),l.lc(e,k),e.globalAlpha=h);else{for(var m=ai(h,e),n=k.scale,p=N.alloc(),r=h.Fa.m,q=r.length,u=0;u<q;u++){var v=r[u];(d||v!==l)&&h.Ei(e,v,k,null,n,p,!1)}N.free(p);e.globalAlpha=m}}}}}
function Ok(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Uc=!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 uf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Mk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return gc;var b=a.documentBounds.copy();b.Nc(a.viewportBounds);return b};Mk.prototype.invalidateViewport=function(){!0!==this.Uc&&(this.Uc=!0,this.Fb())};
Mk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.ob||(Qi(this),this.N(),Vi(this),this.Pa(),Ok(this),this.bd.scale=c,this.bd.position.x=a.x,this.bd.position.y=a.y,this.bd.bounds.assign(a),this.bd.ky=d,this.S("ViewportBoundsChanged",this.bd,a))};
na.Object.defineProperties(Mk.prototype,{observed:{get:function(){return this.Ga},set:function(a){var b=this.Ga;a instanceof Mk&&C("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.um("ViewportBoundsChanged",this.Tm),b.um("DocumentBoundsChanged",this.Sm),b.um("InvalidateDraw",this.Wa),b.um("AnimationFinished",this.Kh));this.Ga=a;null!==a&&(a.Xj("ViewportBoundsChanged",this.Tm),a.Xj("DocumentBoundsChanged",this.Sm),
a.Xj("InvalidateDraw",this.Wa),a.Xj("AnimationFinished",this.Kh),this.add(this.box));this.Pa();if(null===a){this.Ol=null;var c=this.Aa,d=this.Sb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.Wa(null),Ok(this),this.N();this.g("observed",b,a)}}},box:{get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.remove(b),this.add(this.j),Ok(this),this.g("box",b,a))}},drawsTemporaryLayers:{
get:function(){return this.M},set:function(a){this.M!==a&&(this.M=a,this.redraw())}},drawsGrid:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a,this.redraw())}},updateDelay:{get:function(){return this.Ha},set:function(a){0>a&&(a=0);this.Ha!==a&&(this.Ha=a)}}});Mk.className="Overview";function Nk(){De.call(this);this.j=null}ma(Nk,De);
Nk.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.j=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.j.x,a.y-this.j.y));return!0};
Nk.prototype.doActivate=function(){this.j=null;De.prototype.doActivate.call(this)};Nk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Nk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.j){var d=a.firstInput.documentPoint;c=c.location;this.j=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.j.x,a.y-this.j.y)}}};Nk.className="OverviewDraggingTool";
function Qk(){Ta(this);this.F=se;this.Wa=this.C=this.o=!0;this.M=this.Ga=this.Oc=this.Ha=!1;this.ki=this.j=null;this.Kd=1.05;this.fu=NaN;this.Uw=null;this.Zu=NaN;this.Xu=gc;this.yc=!0;this.Zf=null;this.Pc=200}Qk.prototype.toString=function(){return"CommandHandler"};Qk.prototype.Ke=function(a){this.F=a};
Qk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=Sa?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()};
Qk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Qk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Oa&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Qk.prototype.canStopCommand=function(){return!0};
Qk.prototype.selectAll=function(){var a=this.diagram;a.N();try{a.currentCursor="wait";a.S("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.S("ChangedSelection",a.selection),a.currentCursor=""}};Qk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Qk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);a.wa("Delete");a.S("SelectionDeleting",a.selection);for(var b=new G,c=a.selection.iterator;c.next();)Rk(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.bt(b,!0);a.S("SelectionDeleted",b)}finally{a.Xa("Delete"),a.S("ChangedSelection",a.selection),a.currentCursor=""}};
Qk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Qk.prototype.copySelection=function(){var a=this.diagram,b=new G;for(a=a.selection.iterator;a.next();)Rk(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Qk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Qk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Qk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Qk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Ei=null,Gi="";else{c=b.model;var d=!1,e=!1,f=null;try{c.nm()&&(d=c.dk,c.dk=this.copiesParentKey),c.nk()&&(e=c.ck,c.ck=this.copiesGroupKey),f=b.ek(a,null,!0)}finally{c.nm()&&(c.dk=d),c.nk()&&(c.ck=e),c=new E,c.addAll(f),Ei=c,Gi=b.model.dataFormat}}b.S("ClipboardChanged",c)};
Qk.prototype.pasteFromClipboard=function(){var a=new G,b=Ei;if(null===b)return a;var c=this.diagram;if(Gi!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.nm()&&(e=d.dk,d.dk=this.copiesParentKey),d.nk()&&(f=d.ck,d.ck=this.copiesGroupKey),g=c.ek(b,c,!1)}finally{for(d.nm()&&(d.dk=e),d.nk()&&(d.ck=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.u()||(d.location.u()?c.location=d.location:!c.position.u()&&d.position.u()&&(c.position=d.position)),a.add(c)}return a};
Qk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.S("ChangingSelection",b.selection);b.wa("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.u()){var f=this.computeEffectiveCollection(b.selection,b.zn);ef(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.zn,!1)}}b.S("ClipboardPasted",c)}finally{b.Xa("Paste"),b.S("ChangedSelection",
b.selection),b.currentCursor=""}};Qk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Ei||0===Ei.count||Gi!==a.model.dataFormat?!1:!0};Qk.prototype.undo=function(){this.diagram.undoManager.undo()};Qk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Qk.prototype.redo=function(){this.diagram.undoManager.redo()};
Qk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Qk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===mh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Qk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==mh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Qk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===mh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};Qk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==mh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Qk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Qk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Qk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.nc();a.redraw();var c=a.position,d=a.scale;gh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.Zu&&!isNaN(this.fu)&&a.documentBounds.A(this.Xu)?(a.scale=this.fu,a.position=this.Uw,this.Zu=NaN,this.Xu=gc):(this.fu=d,this.Uw=c.copy(),a.zoomToFit(),this.Zu=a.scale,this.Xu=a.documentBounds.copy());ih(b)};Qk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Qk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;b.Sa();if(null===a){try{null!==this.Zf&&(this.Zf.next()?a=this.Zf.value:this.Zf=null)}catch(k){this.Zf=null}null===a&&(0<b.highlighteds.count?this.Zf=b.highlighteds.iterator:0<b.selection.count&&(this.Zf=b.selection.iterator),null!==this.Zf&&this.Zf.next()&&(a=this.Zf.value))}if(null!==a){var c=b.animationManager;gh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Sk(this,a,[a]);if(1===e.length)b.wa(),b.xs(a.actualBounds),
b.Xa("Scroll To Part");else{var f=function(){b.wa();for(var a=e.pop();0<e.length&&a instanceof W&&a.isTreeExpanded&&(!(a instanceof hf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof V&&b.Vv(a.actualBounds),a instanceof W&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof hf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof V&&b.xs(a.actualBounds),b.um("LayoutCompleted",g));b.Xa("Scroll To Part")},g=function(){ua(f,(c.isEnabled?c.duration:0)+d)};b.Xj("LayoutCompleted",
g);f()}}else{var h=b.position.copy();b.xs(a.actualBounds);h.Ta(b.position)&&c.nc()}}};
function Sk(a,b,c){if(b.isVisible())return c;if(b instanceof we)Sk(a,b.adornedPart,c);else if(b instanceof U){var d=b.fromNode;null!==d&&Sk(a,d,c);b=b.toNode;null!==b&&Sk(a,b,c)}else b instanceof W&&(d=b.labeledLink,null!==d&&Sk(a,d,c),d=b.lg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Sk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Sk(a,b,c));return c}
Qk.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};
Qk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.wa("Collapse Tree");gh(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.S("TreeCollapsed",c)}finally{b.Xa("Collapse Tree")}};
Qk.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.kq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&b.isTreeExpanded&&0<b.kq().count)return!0;return!1};
Qk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.wa("Expand Tree");gh(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.S("TreeExpanded",c)}finally{b.Xa("Expand Tree")}};
Qk.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.kq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof W&&!b.isTreeExpanded&&0<b.kq().count)return!0;return!1};
Qk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.pk()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.S("ChangingSelection",a.selection);a.wa("Group");for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.Jc()&&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.Fd(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.Fd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof hf)ng(c),d=c.copy(),null!==d&&a.add(d);else if(b.Dv(c)){var r=b.copyNodeData(c);za(r)&&(b.nf(r),d=a.Hi(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.S("SelectionGrouped",d)}finally{a.Xa("Group"),a.S("ChangedSelection",
a.selection),a.currentCursor=""}}}};Qk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.pk()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Jc()&&b.canGroup())return!0}return!1};
function Tk(a){var b=Fa();for(a=a.iterator;a.next();){var c=a.value;c instanceof U||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.Fd(b[g])){f=!1;break}f&&a.add(e)}Ia(b);return a}
Qk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof U)return!1;if(null!==a){if(a===b||a.Fd(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};
Qk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.pk())try{b.currentCursor="wait";b.S("ChangingSelection",b.selection);b.wa("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 hf&&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.pa(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 U)){var r=p.data;null!==r?c.Gq(r,m):p.containingGroup=l}}b.remove(k)}}b.S("SelectionUngrouped",d,g)}finally{b.Xa("Ungroup"),b.S("ChangedSelection",b.selection),b.currentCursor=""}};
Qk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.pk())return!1;if(null!==a){if(!(a instanceof hf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof hf&&b.canUngroup())return!0;return!1};
Qk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Tk(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Qk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.wa("Collapse SubGraph");gh(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 hf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.S("SubGraphCollapsed",c)}finally{b.Xa("Collapse SubGraph")}};
Qk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof hf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof hf&&b.isSubGraphExpanded)return!0;return!1};
Qk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.wa("Expand SubGraph");gh(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 hf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.S("SubGraphExpanded",c)}finally{b.Xa("Expand SubGraph")}};
Qk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof hf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof hf&&!b.isSubGraphExpanded)return!0;return!1};
Qk.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.hm(function(a){return a instanceof Lg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Qk.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 Lg))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.hm(function(a){return a instanceof Lg&&a.editable}),null!==a))return!0;return!1};
Qk.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(yc):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.Iq(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Hg(c,!1,a)}};
Qk.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};
Qk.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.zn);d=new I;if(null===a)return d;for(var f=a.iterator;f.next();)Hj(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 U&&(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(Qk.prototype,{diagram:{get:function(){return this.F}},copiesClipboardData:{get:function(){return this.o},set:function(a){this.o=a}},copiesConnectedLinks:{get:function(){return this.C},set:function(a){this.C=a}},deletesConnectedLinks:{get:function(){return this.Wa},set:function(a){this.Wa=a}},copiesTree:{get:function(){return this.Ha},
set:function(a){this.Ha=a}},deletesTree:{get:function(){return this.Oc},set:function(a){this.Oc=a}},copiesParentKey:{get:function(){return this.Ga},set:function(a){this.Ga=a}},copiesGroupKey:{get:function(){return this.M},set:function(a){this.M=a}},archetypeGroupData:{get:function(){return this.j},set:function(a){this.j=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.Kd},set:function(a){1<a||C("zoomFactor must be larger than 1.0, not: "+a);this.Kd=a}},isZoomToFitRestoreEnabled:{get:function(){return this.yc},set:function(a){this.yc=a}},scrollToPartPause:{get:function(){return this.Pc},
set:function(a){this.Pc=a}}});Qk.className="CommandHandler";si=function(){return new Qk};
function Y(){Ta(this);this.G=4225027;this.lb=1;this.Xf=null;this.na="";this.fd=this.Rb=null;this.ka=(new J(NaN,NaN)).freeze();this.Sc=Ob;this.Uf=Ib;this.Tf=Nb;this.tb=new qd;this.Mh=new qd;this.Ab=null;this.sa=this.al=1;this.xb=0;this.Be=Uk;this.Pg=pc;this.ic=(new N(NaN,NaN,NaN,NaN)).freeze();this.vb=(new N(NaN,NaN,NaN,NaN)).freeze();this.qc=(new N(0,0,NaN,NaN)).freeze();this.P=this.ap=this.bp=null;this.Gk=this.wb=Vc;this.np=0;this.op=1;this.wg=0;this.jn=1;this.Fp=null;this.sp=-Infinity;this.Jl=0;
this.Kl=pb;this.Ll=Vf;this.Sh="";this.fb=this.O=null;this.Mk=-1;this.Nl=this.$a=this.Rh=this.Rl=null;this.Wr=og;this.qp=this.rg=this.Nj=null}var sd,og,qg,Uk,Vk,Wk,Xk,Yk,Zk,$k;
Y.prototype.cloneProtected=function(a){a.G=this.G|6144;a.lb=this.lb;a.na=this.na;a.Rb=this.Rb;a.fd=this.fd;a.rg=this.rg;a.ka.assign(this.ka);a.Sc=this.Sc.I();a.Uf=this.Uf.I();a.Tf=this.Tf.I();null!==this.Ab?a.Ab=this.Ab.copy():a.Ab=null;a.sa=this.sa;a.xb=this.xb;a.Be=this.Be;a.Pg=this.Pg.I();a.ic.assign(this.ic);a.vb.assign(this.vb);a.qc.assign(this.qc);a.ap=this.ap;null!==this.P&&(a.P=this.P.copy());a.wb=this.wb.I();a.Gk=this.Gk.I();a.np=this.np;a.op=this.op;a.wg=this.wg;a.jn=this.jn;a.Fp=this.Fp;
a.sp=this.sp;a.Jl=this.Jl;a.Kl=this.Kl.I();a.Ll=this.Ll;a.Sh=this.Sh;null!==this.O&&(a.O=this.O.copy());a.fb=this.fb;a.Mk=this.Mk;null!==this.Rh&&(a.Rh=Ba(this.Rh));null!==this.$a&&(a.$a=this.$a.copy());a.Nl=this.Nl};Y.prototype.yx=function(a){var b=this.Rh;if(Aa(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Rh=b=[];b.push(a)};Y.prototype.sf=function(a){a.bp=null;a.Nj=null;a.s()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Rh)for(var b=0;b<this.Rh.length;b++){var c=this.Rh[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.gb=function(a){a.classType===U?0===a.name.indexOf("Orient")?this.segmentOrientation=a:C("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Ja(this.constructor)+"#"+gb(this)};
function al(a){null===a.O&&(a.O=new bl)}t.Hc=function(){if(null===this.P){var a=new cl;a.Jg=rc;a.ph=rc;a.Hg=10;a.nh=10;a.Ig=0;a.oh=0;this.P=a}};
t.Va=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.Ak(a,b,c,d,e,f,g),c===this&&a===ce&&dl(this)&&el(this,h,b),f=this.diagram,null===this.rg||null===f||!f.Pi||f.undoManager.isUndoingRedoing||f.animationManager.dn||(a=this.rg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.qp&&(this.qp=new I),g=0===f.undoManager.transactionLevel,a.startCondition===Wh?g=!0:a.startCondition===Yh&&(g=!1),g?(f=new fh,Xh(a,f),g=this.qp.get(a),null!==g&&g.stop(),this.qp.add(a,
f),f.Uu=this,f.qx=a,f.add(this,b,d,e),f.start()):(gh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.G&16777216)&&null!==h.data))for(c=this.T.m,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&zj(h,function(a){null!==a.data&&0!==(a.G&16777216)&&a.Da(b)})};
function el(a,b,c){var d=a.yh();if(null!==d)for(var e=a.fb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=fl(f,d,a);if(null===g)continue;f.Mq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Mq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Mq(a,h,c,d)}g===a&&(h=d.Bs(f.Yi),null!==h&&f.iw(h,g,c))}}t.Bs=function(a){return this.Mk===a?this:null};
t.g=function(a,b,c){this.Va(ce,a,this,b,c)};t.ue=function(a,b,c,d){var e=this.ic;e.h(a,b,c,d);if(1!==this.sa||0!==this.xb){null===this.Ab&&(this.Ab=new qd);var f=this.Ab;f.reset();this.zp(f,a,b,c,d);f.Jq(e)}};function gl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Ic(b,d):a.wh(b,d)}
t.Ux=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.tf(b);return c?Bb(a.x,a.y,0,0,0,d.height)<=b||Bb(a.x,a.y,0,d.height,d.width,d.height)<=b||Bb(a.x,a.y,d.width,d.height,d.width,0)<=b||Bb(a.x,a.y,d.width,0,0,0)<=b:a.nd(0,0)<=b&&a.nd(0,d.height)<=b&&a.nd(d.width,0)<=b&&a.nd(d.width,d.height)<=b};t.he=function(){return!0};
t.$=function(a){var b=J.alloc();b.assign(a);this.transform.ya(b);var c=this.actualBounds;if(!c.u())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.cu){var e=d.km("extraTouchThreshold"),f=d.km("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.wf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=ac(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 we||this instanceof uf?ac(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.$(b))this.$a&&!this.$a.$(b)?e=
!1:null!==this.fd&&c.$(b)?e=!0:null!==this.Rb&&this.qc.$(a)?e=!0:e=this.xh(a);J.free(b);return e};t.xh=function(a){var b=this.naturalBounds;return ac(0,0,b.width,b.height,a.x,a.y)};t.De=function(a){if(0===this.angle)return this.actualBounds.De(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.Ed(e))&&(e.h(a.x,a.bottom),b.$(c.Ed(e))&&(e.h(a.right,a.bottom),b.$(c.Ed(e))&&(e.h(a.right,a.y),b.$(c.Ed(e))&&(d=!0))));J.free(e);N.free(b);return d};
t.wh=function(a,b){if(void 0===b)return a.De(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.$(b.ya(e))&&(e.h(0,c.height),a.$(b.ya(e))&&(e.h(c.width,c.height),a.$(b.ya(e))&&(e.h(c.width,0),a.$(b.ya(e))&&(d=!0))));J.free(e);return d};
t.Ic=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Ic(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.ya(d))||a.$(b.ya(e))||a.$(b.ya(f))||a.$(b.ya(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.$(b.Ed(k))?h=!0:(k.h(a.x,a.bottom),c.$(b.Ed(k))?h=!0:(k.h(a.right,a.bottom),c.$(b.Ed(k))?h=!0:(k.h(a.right,a.y),c.$(b.Ed(k))&&(h=!0))));J.free(k);N.free(c);
!h&&(L.Ls(a,d,e)||L.Ls(a,e,f)||L.Ls(a,f,g)||L.Ls(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 P){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.de.ya(b);return b};
t.Mi=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.de,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);$b(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);$b(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);$b(a,d.x,d.y,0,0);J.free(d);return a};t.Li=function(){var a=this.de;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.wf=function(){if(0!==(this.G&4096)===!1)return this.al;var a=this.sa;return null!==this.panel?a*this.panel.wf():a};t.Hs=function(a,b){void 0===b&&(b=new J);b.assign(a);this.de.Ed(b);return b};t.Is=function(a,b,c){return this.kk(a.x,a.y,b.x,b.y,c)};
t.kk=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.yf(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.yf(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!==mj(this)){var e=this.Pg,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 uf&&(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(hl(this,!0)){case og:g=e=0;h&&(b=a=Infinity);
break;case sd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Vk:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Wk: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.ic.ea();this.qm(a,b,c,d);this.ic.freeze();this.ic.u()||C("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.ic.toString());hj(this,!1)}};Y.prototype.qm=function(){};Y.prototype.Ri=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.ll();var f=N.alloc();f.assign(this.vb);this.vb.ea();!1===nj(this)?this.vb.h(a,b,c,d):this.vh(a,b,c,d);this.vb.freeze();void 0===e?this.$a=null:this.$a=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.qc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.vb),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 Lg&&(a=this.naturalBounds,
this.Ir>a.height||this.qb>a.width)))c=!0;this.G=c?this.G|256:this.G&-257;this.vb.u()||C("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.vb.toString());this.rm(f,this.vb);il(this,!1);N.free(f)};t=Y.prototype;t.vh=function(){};
function jl(a,b,c,d,e){a.vb.h(b,c,d,e);if(!a.desiredSize.u()){var f=a.ic;c=a.Pg;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=hl(a,!0);c===d&&f===e&&(b=og);switch(b){case og:if(c>d||f>e)hj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case sd:hj(a,!0);a.measure(d,e,0,0);break;case Vk:hj(a,!0);a.measure(d,f,0,0);break;case Wk:hj(a,!0),a.measure(c,e,0,0)}}}
t.rm=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||kl(c,!0),this.N(),Wb(a,b)||(c.Ch(),this.Qo(c)))};t.Qo=function(a){null!==this.portId&&(kl(a,!0),a instanceof W&&ll(a,this))};
t.lc=function(a,b){if(this.visible){var c=this.opacity;if(0!==c){var d=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),e=this.vb;if(d||0!==e.width&&0!==e.height&&!isNaN(e.x)&&!isNaN(e.y)){var f=1;1!==c&&(f=a.globalAlpha,a.globalAlpha=f*c);if(d){e=this.vb;d=this.qc;var g=this.fd,h=this.Rb;null===g&&null===h||a.Bd();null!==g&&(bi(this,a,g,!0,!0,d,e),g instanceof ml&&g.type===nl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.uf(g)):a.fillRect(e.x,e.y,e.width,e.height));null!==
h&&(bi(this,a,h,!0,!1,d,e),h instanceof ml&&h.type===nl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.uf(h)):a.fillRect(e.x,e.y,e.width,e.height));this.Fi(a,b)}else if(!this.Px(a,b)){this instanceof U&&this.sk(!1);d=this.transform;g=this.panel;0!==(this.G&4096)===!0&&ol(this);var k=this.part;h=!1;var l=0;if(k&&b.Fe("drawShadows")&&(h=k.isShadowed)){var m=k.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.ac}m=this.Ri();var n;if(!(n=b.zj||!m)){var p=this.naturalBounds;n=this.Mh;var r=n.m11,q=n.m21,u=
n.dx,v=n.m12,w=n.m22,z=n.dy,y,A=y=0;n=y*r+A*q+u;var B=y*v+A*w+z;y=p.width+l;A=0;var F=y*r+A*q+u;y=y*v+A*w+z;A=Math.min(n,F);var K=Math.min(B,y);var S=Math.max(n+0,F)-A;var R=Math.max(B+0,y)-K;n=A;B=K;y=p.width+l;A=p.height+l;F=y*r+A*q+u;y=y*v+A*w+z;A=Math.min(n,F);K=Math.min(B,y);S=Math.max(n+S,F)-A;R=Math.max(B+R,y)-K;n=A;B=K;y=0;A=p.height+l;F=y*r+A*q+u;y=y*v+A*w+z;A=Math.min(n,F);K=Math.min(B,y);S=Math.max(n+S,F)-A;R=Math.max(B+R,y)-K;n=A;B=K;l=b.viewportBounds;p=l.x;r=l.y;n=!(n>l.width+p||p>S+
n||B>l.height+r||r>R+B)}if(n){n=0!==(this.G&256);a.clipInsteadOfFill&&(n=!1);this instanceof Lg&&(a.font=this.font);if(n){B=g.he()?g.naturalBounds:g.actualBounds;null!==this.$a?(p=this.$a,S=p.x,R=p.y,l=p.width,p=p.height):(S=Math.max(e.x,B.x),R=Math.max(e.y,B.y),l=Math.min(e.right,B.right)-S,p=Math.min(e.bottom,B.bottom)-R);if(S>e.width+e.x||e.x>B.width+B.x){1!==c&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(S,R,l,p);a.clip()}if(m){if(!k.isVisible()){1!==c&&(a.globalAlpha=f);return}h&&
(B=k.shadowOffset,a.bw(B.x*b.scale*b.ac,B.y*b.scale*b.ac,k.shadowBlur),pl(a),a.shadowColor=k.shadowColor)}h&&!0===this.shadowVisible?pl(a):h&&!1===this.shadowVisible&&ql(a);k=this.naturalBounds;null!==this.fd&&(a.Bd(),bi(this,a,this.fd,!0,!0,k,e),this.fd instanceof ml&&this.fd.type===nl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.uf(this.fd)):a.fillRect(e.x,e.y,e.width,e.height));a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);h&&(null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===
X.Spot)&&g.nb()!==this)&&null===this.shadowVisible&&ql(a);null!==this.Rb&&(a.Bd(),rl(this,a,k,e));h&&(null!==this.Rb||null!==this.fd||null!==g&&0!==(g.G&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.nb()!==this)?(sl(this,!0),null===this.shadowVisible&&ql(a)):sl(this,!1);this.Fi(a,b);h&&0!==(this.G&512)===!0&&pl(a);m&&h&&ql(a);n&&(a.restore(),a.Ec(this instanceof X));d.Os()||(b=1/(d.m11*d.m22-d.m12*d.m21),a.transform(d.m22*b,-d.m12*b,-d.m21*b,d.m11*b,b*(d.m21*d.dy-d.m22*d.dx),b*(d.m12*d.dx-
d.m11*d.dy)))}}1!==c&&(a.globalAlpha=f)}}}};function rl(a,b,c,d){var e=a.naturalBounds,f=0,g=0,h=e.width;e=e.height;var k=a.Ow();a instanceof uf&&(e=a.ma.bounds,f=e.x,g=e.y,h=e.width,e=e.height);bi(a,b,a.Rb,!0,!1,c,d);a.Rb instanceof ml&&a.Rb.type===nl?(b.beginPath(),b.rect(f-k/2,g-k/2,h+k,e+k),b.uf(a.Rb)):b.fillRect(f-k/2,g-k/2,h+k,e+k)}t.Px=function(){return!1};t.Fi=function(){};
function bi(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===tl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof uf&&(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 ul)&&c.ke&&(c.type===vl||c.Pk===h&&c.At===k))var m=c.ke;else{var n=0,p=0,r=0,q=0,u=0,v=0;v=u=0;e?(u=g.x,v=g.y):d||(u-=l/2,v-=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+=v;q+=v;if(c.type===wl)m=b.createLinearGradient(n,p,r,q);else if(c.type===nl)v=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,v=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,v);else if(c.type===vl)try{m=b.createPattern(c.pattern,"repeat")}catch(z){m=null}if(c.type!==vl&&(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.Pk=h,c.At=k),null===
m&&c.type===vl&&-1!==c.Pk)){c.Pk=-1;var w=a.diagram;null!==w&&-1===c.Pk&&ua(function(){w.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.mg=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.Bf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Bf():!0};t.Af=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function ol(a){if(0!==(a.G&2048)===!0){var b=a.tb;b.reset();if(!a.vb.u()||!a.ic.u()){xl(a,!1);return}b.translate(a.vb.x-a.ic.x,a.vb.y-a.ic.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;a.zp(b,c.x,c.y,c.width,c.height)}xl(a,!1);yl(a,!0)}0!==(a.G&4096)===!0&&(b=a.panel,null===b?(a.Mh.set(a.tb),a.al=a.scale,yl(a,!1)):null!==b.de&&(c=a.Mh,c.reset(),b.he()?c.multiply(b.Mh):null!==b.panel&&c.multiply(b.panel.Mh),c.multiply(a.tb),a.al=a.scale*b.al,yl(a,!1)))}
t.zp=function(a,b,c,d,e){1!==this.sa&&a.scale(this.sa);if(0!==this.xb){var f=J.alloc();f.Vi(b,c,d,e,yc);a.rotate(this.xb,f.x,f.y);J.free(f)}};t.s=function(a){if(!mj(this)){void 0===a&&(a=!1);hj(this,!0);il(this,!0);var b=this.panel;null===b||a||b.s()}};t.mk=function(){mj(this)||(hj(this,!0),il(this,!0))};function zl(a){if(!nj(a)){var b=a.panel;null!==b?b.s():a.Ri()&&(b=a.diagram,null!==b&&(b.qe.add(a),a instanceof W&&a.pd(),b.Fb()));il(a,!0)}}
t.ll=function(){0!==(this.G&2048)===!1&&(xl(this,!0),yl(this,!0))};t.Bv=function(){yl(this,!0)};t.N=function(){var a=this.part;null!==a&&a.N()};
function hl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return Al(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.nb()===a)return Bl(a,sd,b);if(c===Uk){if(null!==d){if(d.type===X.Spot&&d.nb()===a)return Bl(a,sd,b);c=d.defaultStretch;return c===Uk?Bl(a,og,b):Bl(a,c,b)}return Bl(a,og,b)}return Bl(a,c,b)}
function Al(a,b,c,d){var e=a.stretch;if(e!==Uk)return Bl(a,e,d);var f=e=null;switch(b.stretch){case Wk:f=!0;break;case sd:f=!0}switch(c.stretch){case Vk:e=!0;break;case sd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Vk||b===sd);null===f&&(f=b===Wk||b===sd);return!0===e&&!0===f?Bl(a,sd,d):!0===e?Bl(a,Vk,d):!0===f?Bl(a,Wk,d):Bl(a,og,d)}
function Bl(a,b,c){if(c)return b;if(b===og)return og;c=a.desiredSize;if(c.u())return og;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Vk)return og;if(b===sd)return Wk}else{if(b===Wk)return og;if(b===sd)return Vk}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Wk)return og;if(b===sd)return Vk}else{if(b===Vk)return og;if(b===sd)return Wk}return b}function sl(a,b){a.G=b?a.G|512:a.G&-513}function dl(a){return 0!==(a.G&1024)}function Cl(a,b){a.G=b?a.G|1024:a.G&-1025}
function xl(a,b){a.G=b?a.G|2048:a.G&-2049}function yl(a,b){a.G=b?a.G|4096:a.G&-4097}function mj(a){return 0!==(a.G&8192)}function hj(a,b){a.G=b?a.G|8192:a.G&-8193}function nj(a){return 0!==(a.G&16384)}function il(a,b){a.G=b?a.G|16384:a.G&-16385}t.Ti=function(a){this.Xf=a};t.gt=function(){};t.Zv=function(a){this.ka=a;zl(this);return!0};t.Gm=function(a,b){if(this.ka.x!==a||this.ka.y!==b)this.ka.h(a,b),this.ll()};t.Ow=function(){return 0};
function Dl(a){var b=a.part;if(b instanceof W&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ll(b,a)}}function El(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof W?a.pd():a.Mm(a,function(a){Dl(a)}):Dl(a))}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new ri(a,b,c,d):e=a;e.md=this;a=this.yh();null!==a&&Fl(a)&&C("Cannot add a Binding to a template that has already been copied: "+e);null===this.fb&&(this.fb=new E);this.fb.add(e);return this};t.set=function(a){Object.assign(this,a);return this};t.dv=function(a){Gl(this,a);return this};t.apply=function(a){a(this);return this};t.Hm=function(a){tj(this,a);return this};t.Vz=function(){return this.yh()};
t.yh=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.Ph)return a;a=a.panel}return null};t.fw=function(a){a.md=this;null===this.rg&&(this.rg=new I);this.rg.add(a.propertyName,a);return this};
function Hl(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=Il.H(a);"function"===typeof f?(c=Ba(arguments),d=f(c),za(d)||C('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||C("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 T&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)ni(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?C("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Gl(d,f);return d}
function Gl(a,b){if("string"===typeof b)if(a instanceof Lg)a.text=b;else if(a instanceof uf)a.figure=b;else if(a instanceof Vj)a.source=b;else if(a instanceof X)b=Jl.H(b),null!==b&&(a.type=b);else if(a instanceof ml){var c=Ua(ml,b);null!==c?a.type=c:C("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof Q?(b=Ua(Q,b),null!==b&&(a.type=b)):a instanceof Xd&&(b=Ua(Xd,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof X||C("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Nj){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 Nj?(a=d,b.isRow?a.height=b.height:a.width=b.width,a.minimum=b.minimum,a.maximum=b.maximum,a.alignment=b.alignment,a.stretch=b.stretch,a.sizing=b.sizing,a.$f=null===b.separatorPadding?null:b.separatorPadding.I(),a.separatorStroke=b.separatorStroke,a.separatorStrokeWidth=b.separatorStrokeWidth,
a.Tj=null,b.separatorDashArray&&(a.Tj=Ba(b.separatorDashArray)),a.background=b.background,a.coversSeparators=b.coversSeparators,a.fb=b.fb):C("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.gb&&a.gb(b);else if(b instanceof Kl)a.type=b;else if(b instanceof ri)a instanceof Y?a.bind(b):a instanceof Nj?a.bind(b):C("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+
a);else if(b instanceof Uh)a instanceof Y?a.fw(b):C("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof Wd)a instanceof Q?a.figures.add(b):C("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof Xd)a instanceof Wd?a.segments.add(b):C("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof li)a instanceof T?a.layout=b:a instanceof hf?a.layout=b:C("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++)Gl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof ml){c=new Wa;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);tj(a,c)}else if(a instanceof Nj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&C("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)&&C("Must specify non-negative integer column for RowColumnDefinition "+
b+", not: "+e),a.isRow=!1,a.index=e);e=new Wa;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);tj(a,e)}else tj(a,b);else C('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function Ll(a,b){Il.add(a,b)}function Ml(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.Nl},set:function(a){var b=this.Nl;b!==a&&(this.Nl=a,this.N(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.O?this.O.Fn:null},set:function(a){al(this);var b=this.O.Fn;b!==a&&(this.O.Fn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.Ll},set:function(a){var b=this.Ll;
b!==a&&(this.Ll=a,this.s(),this.g("segmentOrientation",b,a),a===Vf&&(this.angle=0))}},segmentIndex:{get:function(){return this.sp},set:function(a){a=Math.round(a);var b=this.sp;b!==a&&(this.sp=a,this.s(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.Jl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Jl;b!==a&&(this.Jl=a,this.s(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.Kl},set:function(a){var b=this.Kl;b.A(a)||(this.Kl=a=a.I(),this.s(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.Be},set:function(a){var b=this.Be;b!==a&&(this.Be=a,this.s(),this.g("stretch",b,a))}},name:{get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,null!==this.part&&(this.part.li=null),this.g("name",b,a))}},opacity:{get:function(){return this.lb},
set:function(a){var b=this.lb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Y,"opacity"),this.lb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.N(xj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(this.G^=1,this.g("visible",b,a),b=this.panel,null!==b?b.s():this.Ri()&&this.Nb(a),this.N(),El(this))}},pickable:{get:function(){return 0!==(this.G&2)},set:function(a){var b=
0!==(this.G&2);b!==a&&(this.G^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(this.G^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(this.G^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.G&16)},set:function(a){var b=0!==(this.G&16);b!==a&&(this.G^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(this.G^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);b!==a&&(this.G^=64,this.s(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(this.G^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.fd},set:function(a){var b=this.fd;b!==a&&(null!==a&&Nl(a,"GraphObject.areaBackground"),a instanceof ml&&a.freeze(),this.fd=a,this.N(),this.g("areaBackground",b,a))}},background:{get:function(){return this.Rb},set:function(a){var b=this.Rb;b!==a&&(null!==a&&Nl(a,"GraphObject.background"),
a instanceof ml&&a.freeze(),this.Rb=a,this.N(),this.g("background",b,a))}},part:{get:function(){if(this.Ri())return this;if(null!==this.Nj)return this.Nj;var a;for(a=this.panel;a;){if(a instanceof V)return this.Nj=a;a=a.panel}return null}},svg:{get:function(){return this.ns},set:function(a){this.ns=a}},panel:{get:function(){return this.Xf}},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.ka},set:function(a){var b=a.x,c=a.y,d=this.ka,e=d.x;d=d.y;(e===b||isNaN(e)&&isNaN(b))&&(d===c||isNaN(d)&&isNaN(c))?this.gt():(a=a.copy(),this.Zv(a,e,d)&&this.g("position",new J(e,d),a))}},actualBounds:{get:function(){return this.vb}},scale:{
get:function(){return this.sa},set:function(a){var b=this.sa;b!==a&&(0>=a&&C("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.sa=a,this.s(),this.g("scale",b,a))}},angle:{get:function(){return this.xb},set:function(a){var b=this.xb;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.xb=a,El(this),this.s(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Sc},set:function(a){var b=a.width,c=a.height,d=this.Sc,e=
d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Sc=a=a.I(),this.s(),this instanceof uf&&this.cc(),this.g("desiredSize",d,a),dl(this)&&(a=this.part,null!==a&&(el(this,a,"width"),el(this,a,"height"))))}},width:{get:function(){return this.Sc.width},set:function(a){var b=this.Sc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Sc,this.Sc=a=(new M(a,this.Sc.height)).freeze(),this.s(),this instanceof uf&&this.cc(),this.g("desiredSize",b,a),dl(this)&&
(a=this.part,null!==a&&el(this,a,"width")))}},height:{get:function(){return this.Sc.height},set:function(a){var b=this.Sc.height;b===a||isNaN(b)&&isNaN(a)||(b=this.Sc,this.Sc=a=(new M(this.Sc.width,a)).freeze(),this.s(),this instanceof uf&&this.cc(),this.g("desiredSize",b,a),dl(this)&&(a=this.part,null!==a&&el(this,a,"height")))}},minSize:{get:function(){return this.Uf},set:function(a){var b=this.Uf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=
0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Uf=a,this.s(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.Tf},set:function(a){var b=this.Tf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Tf=a,this.s(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.ic}},naturalBounds:{get:function(){return this.qc}},margin:{
get:function(){return this.Pg},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.Pg;b.A(a)||(this.Pg=a=a.I(),this.s(),this.g("margin",b,a))}},transform:{get:function(){0!==(this.G&2048)===!0&&ol(this);return this.tb}},de:{get:function(){0!==(this.G&4096)===!0&&ol(this);return this.Mh}},alignment:{get:function(){return this.wb},set:function(a){var b=this.wb;b.A(a)||(a.wc()&&!a.Lb()&&
C("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.wb=a=a.I(),zl(this),this.g("alignment",b,a))}},column:{get:function(){return this.wg},set:function(a){a=Math.round(a);var b=this.wg;b!==a&&(0>a&&xa(a,">= 0",Y,"column"),this.wg=a,this.s(),this.g("column",b,a))}},columnSpan:{get:function(){return this.jn},set:function(a){a=Math.round(a);var b=this.jn;b!==a&&(1>a&&xa(a,">= 1",Y,"columnSpan"),this.jn=a,
this.s(),this.g("columnSpan",b,a))}},row:{get:function(){return this.np},set:function(a){a=Math.round(a);var b=this.np;b!==a&&(0>a&&xa(a,">= 0",Y,"row"),this.np=a,this.s(),this.g("row",b,a))}},rowSpan:{get:function(){return this.op},set:function(a){a=Math.round(a);var b=this.op;b!==a&&(1>a&&xa(a,">= 1",Y,"rowSpan"),this.op=a,this.s(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.Fp},set:function(a){var b=
this.Fp;b!==a&&(this.Fp=a,this.s(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.Gk},set:function(a){var b=this.Gk;b.A(a)||(this.Gk=a=a.I(),this.s(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.ap},set:function(a){var b=this.ap;if(b!==a){var c=this.part;null===c||c instanceof W||C("Cannot set portID on a Link: "+a);null!==b&&null!==c&&Ol(c,this);this.ap=a;null!==a&&null!==c&&(c.Ge=!0,Pl(c,
this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.P?this.P.ph:rc},set:function(a){this.Hc();var b=this.P.ph;b.A(a)||(a=a.I(),this.P.ph=a,this.g("toSpot",b,a),Dl(this))}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.nh:10},set:function(a){this.Hc();var b=this.P.nh;b!==a&&(0>a&&xa(a,">= 0",Y,"toEndSegmentLength"),this.P.nh=a,this.g("toEndSegmentLength",b,a),Dl(this))}},toShortLength:{
get:function(){return null!==this.P?this.P.oh:0},set:function(a){this.Hc();var b=this.P.oh;b!==a&&(this.P.oh=a,this.g("toShortLength",b,a),Dl(this))}},toLinkable:{get:function(){return null!==this.P?this.P.Mp:null},set:function(a){this.Hc();var b=this.P.Mp;b!==a&&(this.P.Mp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.P?this.P.Np:Infinity},set:function(a){this.Hc();var b=this.P.Np;b!==a&&(0>a&&
xa(a,">= 0",Y,"toMaxLinks"),this.P.Np=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Jg:rc},set:function(a){this.Hc();var b=this.P.Jg;b.A(a)||(a=a.I(),this.P.Jg=a,this.g("fromSpot",b,a),Dl(this))}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Hg:10},set:function(a){this.Hc();var b=this.P.Hg;b!==a&&(0>a&&xa(a,">= 0",Y,"fromEndSegmentLength"),this.P.Hg=a,this.g("fromEndSegmentLength",
b,a),Dl(this))}},fromShortLength:{get:function(){return null!==this.P?this.P.Ig:0},set:function(a){this.Hc();var b=this.P.Ig;b!==a&&(this.P.Ig=a,this.g("fromShortLength",b,a),Dl(this))}},fromLinkable:{get:function(){return null!==this.P?this.P.Mn:null},set:function(a){this.Hc();var b=this.P.Mn;b!==a&&(this.P.Mn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.P?this.P.Nn:Infinity},
set:function(a){this.Hc();var b=this.P.Nn;b!==a&&(0>a&&xa(a,">= 0",Y,"fromMaxLinks"),this.P.Nn=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.Sh},set:function(a){var b=this.Sh;b!==a&&(this.Sh=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.O?this.O.vg:null},set:function(a){al(this);var b=this.O.vg;b!==a&&(this.O.vg=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==
this.O?this.O.Dg:null},set:function(a){al(this);var b=this.O.Dg;b!==a&&(this.O.Dg=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==this.O?this.O.xg:null},set:function(a){al(this);var b=this.O.xg;b!==a&&(this.O.xg=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.O?this.O.Sg:null},set:function(a){al(this);var b=this.O.Sg;b!==a&&(this.O.Sg=a,this.g("mouseEnter",b,a))}},mouseLeave:{
get:function(){return null!==this.O?this.O.Vg:null},set:function(a){al(this);var b=this.O.Vg;b!==a&&(this.O.Vg=a,this.g("mouseLeave",b,a))}},mouseOver:{get:function(){return null!==this.O?this.O.Wg:null},set:function(a){al(this);var b=this.O.Wg;b!==a&&(this.O.Wg=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.O?this.O.Ug:null},set:function(a){al(this);var b=this.O.Ug;b!==a&&(this.O.Ug=a,this.g("mouseHover",
b,a))}},mouseHold:{get:function(){return null!==this.O?this.O.Tg:null},set:function(a){al(this);var b=this.O.Tg;b!==a&&(this.O.Tg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{get:function(){return null!==this.O?this.O.Ho:null},set:function(a){al(this);var b=this.O.Ho;b!==a&&(this.O.Ho=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.O?this.O.Io:null},set:function(a){al(this);
var b=this.O.Io;b!==a&&(this.O.Io=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.O?this.O.Rg:null},set:function(a){al(this);var b=this.O.Rg;b!==a&&(this.O.Rg=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.O?this.O.Vm:null},set:function(a){al(this);var b=this.O.Vm;b!==a&&(this.O.Vm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==
this.O?this.O.Wm:null},set:function(a){al(this);var b=this.O.Wm;b!==a&&(this.O.Wm=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.O?this.O.Xm:null},set:function(a){al(this);var b=this.O.Xm;b!==a&&(this.O.Xm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.O?this.O.Um:null},set:function(a){al(this);var b=this.O.Um;b!==a&&(this.O.Um=a,this.g("actionCancel",b,a))}},toolTip:{
get:function(){return null!==this.O?this.O.qh:null},set:function(a){al(this);var b=this.O.qh;b!==a&&(this.O.qh=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return null!==this.O?this.O.yg:null},set:function(a){al(this);var b=this.O.yg;b!==a&&(this.O.yg=a,this.g("contextMenu",b,a))}}});Y.prototype.trigger=Y.prototype.fw;Y.prototype.findBindingPanel=Y.prototype.yh;Y.prototype.findTemplateBinder=Y.prototype.Vz;Y.prototype.setProperties=Y.prototype.Hm;
Y.prototype.apply=Y.prototype.apply;Y.prototype.attach=Y.prototype.dv;Y.prototype.set=Y.prototype.set;Y.prototype.isEnabledObject=Y.prototype.Af;Y.prototype.isVisibleObject=Y.prototype.Bf;Y.prototype.isContainedBy=Y.prototype.mg;Y.prototype.getNearestIntersectionPoint=Y.prototype.Is;Y.prototype.getLocalPoint=Y.prototype.Hs;Y.prototype.getDocumentScale=Y.prototype.wf;Y.prototype.getDocumentAngle=Y.prototype.Li;Y.prototype.getDocumentBounds=Y.prototype.Mi;Y.prototype.getDocumentPoint=Y.prototype.da;
Y.prototype.intersectsRect=Y.prototype.Ic;Y.prototype.containedInRect=Y.prototype.wh;Y.prototype.containsRect=Y.prototype.De;Y.prototype.containsPoint=Y.prototype.$;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.Va;Y.prototype.addCopyProperty=Y.prototype.yx;var Il=null;Y.className="GraphObject";Il=new I;
Ll("Button",function(){function a(a,b){return null!==a.diagram.Wb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Hl(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.Ya("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"},Hl(uf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new P(0,0,2.76142374915397,2.761423749153969),spot2:new P(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Af()&&b instanceof X&&(a=b.Ya("ButtonBorder"),a instanceof uf)){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.Af()&&b instanceof X&&(a=b.Ya("ButtonBorder"),a instanceof uf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Af()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.Ya("ButtonBorder");if(c instanceof uf){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.Af()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.Ya("ButtonBorder");if(c instanceof uf){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.Af()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.Ya("ButtonBorder");if(c instanceof uf){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.Af()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.Ya("ButtonBorder"),b instanceof uf))){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});
Ll("TreeExpanderButton",function(){var a=Hl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Hl(uf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Lb},(new ri("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).wq()),{visible:!1},(new ri("visible","isTreeLeaf",function(a){return!a})).wq());a.click=function(a,c){c=c.part;c instanceof we&&(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});
Ll("SubGraphExpanderButton",function(){var a=Hl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Hl(uf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Lb},(new ri("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).wq()));a.click=function(a,c){c=c.part;c instanceof we&&(c=c.adornedPart);if(c instanceof hf){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});Ll("ToolTip",function(){return Hl(we,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Hl(uf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new P(0,0,4,6),spot2:new P(1,1,-4,-4)}))});
Ll("ContextMenu",function(){return Hl(we,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new ri("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Ll("ContextMenuButton",function(){var a=Hl("Button");a.stretch=Vk;var b=a.Ya("ButtonBorder");b instanceof uf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new P(0,0,2,3),b.spot2=new P(1,1,-2,-2));return a});
Ll("PanelExpanderButton",function(a){var b=Ml(a,"COLLAPSIBLE"),c=Hl("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},Hl(uf,{name:"ButtonIcon",strokeWidth:2},(new ri("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).wq(b)));
a=c.Ya("ButtonBorder");a instanceof uf&&(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.yh();null===e&&(e=c.part);null!==e&&(c=e.Ya(b),null!==c&&(a.handled=!0,d.wa("Collapse/Expand Panel"),c.visible=!c.visible,d.Xa("Collapse/Expand Panel")))}};return c});
Ll("CheckBoxButton",function(a){var b=Ml(a);a=Hl("Button",{desiredSize:new M(14,14)},Hl(uf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:sd,geometryStretch:qg,visible:!1},""!==b?(new ri("visible",b)).oy():[]));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.Ya("ButtonIcon");c.wa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.Xa("checkbox")}}};return a});
Ll("CheckBox",function(a){a=Ml(a);a=Hl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new ic(0,1,0,0)});var b=Hl(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=og=new D(Y,"None",0);Y.Default=Uk=new D(Y,"Default",0);Y.Vertical=Wk=new D(Y,"Vertical",4);Y.Horizontal=Vk=new D(Y,"Horizontal",5);Y.Fill=sd=new D(Y,"Fill",3);Y.Uniform=qg=new D(Y,"Uniform",1);
Y.UniformToFill=Xk=new D(Y,"UniformToFill",2);Y.FlipVertical=Yk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=Zk=new D(Y,"FlipHorizontal",2);Y.FlipBoth=$k=new D(Y,"FlipBoth",3);Y.make=Hl;Y.getBuilders=function(){var a=new I,b;for(b in Il)if(b!==b.toLowerCase()){var c=Il.H(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=Ll;
Y.build=function(a,b){var c=Il.H(a);if("function"===typeof c&&(c=c(null),c instanceof Y))return b&&c.set(b),c;C('GraphObject.build invoked object builder "'+a+'", but it did not return an Object')};Y.takeBuilderArgument=Ml;function bl(){this.Fn=this.yg=this.qh=this.Um=this.Xm=this.Wm=this.Vm=this.Rg=this.Io=this.Ho=this.Tg=this.Ug=this.Wg=this.Vg=this.Sg=this.xg=this.Dg=this.vg=null}
bl.prototype.copy=function(){var a=new bl;a.vg=this.vg;a.Dg=this.Dg;a.xg=this.xg;a.Sg=this.Sg;a.Vg=this.Vg;a.Wg=this.Wg;a.Ug=this.Ug;a.Tg=this.Tg;a.Ho=this.Ho;a.Io=this.Io;a.Rg=this.Rg;a.Vm=this.Vm;a.Wm=this.Wm;a.Xm=this.Xm;a.Um=this.Um;a.qh=this.qh;a.yg=this.yg;a.Fn=this.Fn;return a};bl.className="GraphObjectEventHandlers";function Ql(){this.Ma=[1,0,0,1,0,0]}
Ql.prototype.copy=function(){var a=new Ql;a.Ma[0]=this.Ma[0];a.Ma[1]=this.Ma[1];a.Ma[2]=this.Ma[2];a.Ma[3]=this.Ma[3];a.Ma[4]=this.Ma[4];a.Ma[5]=this.Ma[5];return a};Ql.prototype.translate=function(a,b){this.Ma[4]+=this.Ma[0]*a+this.Ma[2]*b;this.Ma[5]+=this.Ma[1]*a+this.Ma[3]*b};Ql.prototype.scale=function(a,b){this.Ma[0]*=a;this.Ma[1]*=a;this.Ma[2]*=b;this.Ma[3]*=b};Ql.className="STransform";
function Rl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Ix=[];this.pattern=null}Rl.prototype.addColorStop=function(a,b){this.Ix.push({offset:a,color:b})};Rl.className="SGradient";
function wj(a,b){this.ownerDocument=a=void 0===b?x.document:b;this.FA="http://www.w3.org/2000/svg";void 0!==a&&(this.La=this.Ob("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.gq=null;this.context=new Sl(this)}
wj.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.La.setAttributeNS(null,"width",c+"px"),this.La.setAttributeNS(null,"height",d+"px"),this.La.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Yw.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Yw.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
wj.prototype.Ob=function(a,b,c){a=this.ownerDocument.createElementNS(this.FA,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};wj.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};wj.prototype.focus=function(){this.La.focus()};wj.prototype.Ox=function(){this.ownerDocument=null};
na.Object.defineProperties(wj.prototype,{width:{get:function(){return this.La.width.baseVal.value},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height.baseVal.value},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});wj.className="SVGSurface";
function Sl(a){this.jt=a;this.svg=a.La;this.stack=[];this.dd=[];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.bg=this.fs=this.es=0;this.Rs=null;this.path=[];this.Yt=!1;this.ih=null;this.jh=0;this.Ee=new Ql;
Tl(this,1,0,0,1,0,0);var b=kb++,c=this.Ob("clipPath",{id:"mainClip"+b});c.appendChild(this.Ob("rect",{x:0,y:0,width:a.width,height:a.height}));this.Yw=c;this.jt.La.appendChild(c);this.dd[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.HA={}}t=Sl.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.Ee)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Rl("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.HA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+kb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Ob("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Ob(zk,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new Rl("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"+kb++,g=this.Ob("clipPath",{id:f}),g.appendChild(this.Ob("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";Ul(this,zk,a,this.Ee,l);this.addElement(zk,a)};t.fill=function(){this.addPath("fill",this.path,this.Ee)};
t.uf=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]};Ul(this,"fill",a,this.Ee);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};Ul(this,"fill",b,this.Ee);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.Ee=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.Ee.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||Tl(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Ee.scale(a,b)};t.translate=function(a,b){this.Ee.translate(a,b)};t.transform=function(){};t.Bd=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Ee)};t.Xi=function(){this.clipInsteadOfFill||this.stroke()};t.Ob=function(a,b,c){return this.jt.Ob(a,b,c)};
t.addElement=function(a,b,c){a=this.Ob(a,b,c);0<this.dd.length?this.dd[this.dd.length-1].appendChild(a):this.svg.appendChild(a);return this.Rs=a};
function Ul(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Rl?c.fill=Vl(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 Rl?c.stroke=Vl(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.Ma;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function Vl(a,b){var c="GRAD"+kb++;if("linear"===b.type)var d=a.Ob("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Ob("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.Ix;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.Ob("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.Yt&&(b["stroke-dasharray"]=this.ih.toString(),b["stroke-dashoffset"]=this.jh);Ul(this,a,b,c);"clipPath"===a?(a="CLIP"+kb++,c=this.Ob("clipPath",{id:a}),c.appendChild(this.Ob("path",b)),this.svg.appendChild(c),
0<this.dd.length&&this.dd[this.dd.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function Tl(a,b,c,d,e,f,g){var h=new Ql;h.Ma=[b,c,d,e,f,g];b={};Ul(a,"g",b,h);h=a.addElement("g",b);a.dd.push(h)}
t.Jm=function(a){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var b="SHADOW"+kb++,c=this.addElement("filter",{id:b,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),d=a.computePixelRatio();a=this.Ob("feGaussianBlur",{"in":"SourceAlpha",result:"blur",stdDeviation:this.shadowBlur/2/d});var e=this.Ob("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor}),f=this.Ob("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});d=this.Ob("feOffset",
{"in":"comp",result:"offsetBlur",dx:this.shadowOffsetX/d,dy:this.shadowOffsetY/d});var g=this.Ob("feMerge",{});g.appendChild(this.Ob("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Ob("feMergeNode",{"in":"SourceGraphic"}));c.appendChild(a);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(g);0<this.dd.length&&this.dd[this.dd.length-1].setAttributeNS(null,"filter","url(#"+b+")")}};t.bw=function(a,b,c){this.es=a;this.fs=b;this.bg=c};
function ql(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}function pl(a){a.shadowOffsetX=a.es;a.shadowOffsetY=a.fs;a.shadowBlur=a.bg}t.As=function(a,b){this.Yt=!0;this.ih=a;this.jh=b};t.ys=function(){this.Yt=!1};t.Ec=function(){};t.Cy=function(){};Sl.prototype.rotate=function(){};Sl.prototype.getImageData=function(){return null};Sl.prototype.measureText=function(){return null};Sl.className="SVGContext";
T.prototype.Vs=function(a){var b=new wj(this,x.document);void 0===a&&(a=new Wa);var c=this;return xk(this,function(a,e){a=yk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};T.prototype.makeSvg=T.prototype.Vs;T.prototype.Gv=function(a){return this.Vs(a)};T.prototype.makeSVG=T.prototype.Gv;
Y.prototype.Px=function(a,b){if(!(a instanceof Sl))return!1;var c=null,d=a.Rs,e=this.transform,f=this.panel;0!==(this.G&4096)===!0&&ol(this);var g=this.vb,h=0!==(this.G&256);a.clipInsteadOfFill&&(h=!1);var k=!1;this instanceof Lg&&(a.font=this.font);if(h){k=f.he()?f.naturalBounds:f.actualBounds;if(null!==this.$a){var l=this.$a;var m=l.x;var n=l.y;var p=l.width;l=l.height}else m=Math.max(g.x,k.x),n=Math.max(g.y,k.y),p=Math.min(g.right,k.right)-m,l=Math.min(g.bottom,k.bottom)-n;if(m>g.width+g.x||g.x>
k.width+k.x||n>g.height+g.y||g.y>k.height+k.y)return!0;k=!0;Tl(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Ri()&&!this.isVisible())return!0;a.Ee.Ma=[1,0,0,1,0,0];(this instanceof Lg&&1<this.lineCount||this instanceof uf&&1<this.geometry.figures.length)&&Tl(a,1,0,0,1,0,0);m=!1;this.Ri()&&this.isShadowed&&b.Fe("drawShadows")&&(n=this.shadowOffset,a.bw(n.x*b.scale*b.ac,n.y*b.scale*b.ac,this.shadowBlur),pl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Fe("drawShadows")&&
(n=this.part.isShadowed);a.clipInsteadOfFill&&(n=!1);!0===this.shadowVisible?(pl(a),!1===m&&n&&(Tl(a,1,0,0,1,0,0),a.Jm(b),m=!0)):!1===this.shadowVisible&&ql(a);p=this.naturalBounds;null!==this.areaBackground&&(bi(this,a,this.areaBackground,!0,!0,p,g),!1===m&&n&&(Tl(a,1,0,0,1,0,0),a.Jm(b),m=!0),this.areaBackground instanceof ml&&this.areaBackground.type===nl?(a.beginPath(),a.rect(g.x,g.y,g.width,g.height),a.uf(this.areaBackground)):a.fillRect(g.x,g.y,g.width,g.height));l=!1;this instanceof X?Tl(a,
e.m11,e.m12,e.m21,e.m22,e.dx,e.dy):(a.Ee.Ma=[e.m11,e.m12,e.m21,e.m22,e.dx,e.dy],!1===m&&n&&(l=!0));null!==this.background&&(!1===m&&n&&(Tl(a,1,0,0,1,0,0),a.Jm(b),m=!0),rl(this,a,p,g));n&&(null!==this.background||null!==this.areaBackground||null!==f&&0!==(f.G&512)||null!==f&&(f.type===X.Auto||f.type===X.Spot)&&f.nb()!==this)?(sl(this,!0),null===this.shadowVisible&&ql(a),l=!1):sl(this,!1);l&&!1===m&&(Tl(a,1,0,0,1,0,0),a.Jm(b),m=!0);this.Fi(a,b);n&&0!==(this.G&512)===!0&&pl(a);this.Ri()&&n&&ql(a);h&&
(a.restore(),k&&a.dd.pop());this instanceof X&&(c=a.dd.pop());!0===m&&a.dd.pop();if(this instanceof Lg&&1<this.lineCount||this instanceof uf&&1<this.geometry.figures.length)c=a.dd.pop();null!==a.jt.gq&&(null===c&&(d===a.Rs?(Tl(a,1,0,0,1,0,0),c=a.dd.pop()):c=a.Rs),a.jt.gq(this,c));this.svg=c;return!0};
function Ak(a,b){this.ownerDocument=b=void 0===b?x.document:b;this.gq=null;b=b.createElement("canvas");b.tabIndex=0;this.La=b;this.La.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new ul(b);b.F=a}Ak.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};Ak.prototype.toDataURL=function(a,b){return this.La.toDataURL(a,b)};
Ak.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};Ak.prototype.focus=function(){this.La.focus()};Ak.prototype.Ox=function(){this.ownerDocument=this.La.F=null};na.Object.defineProperties(Ak.prototype,{width:{get:function(){return this.La.width},set:function(a){this.La.width=a}},height:{get:function(){return this.La.height},set:function(a){this.La.height=a}},style:{get:function(){return this.La.style}}});
Ak.className="CanvasSurface";function ul(a){a.getContext&&a.getContext("2d")||C("Browser does not support HTML Canvas Element");this.Y=a.getContext("2d");this.xt=this.zt=this.yt="";this.hn=!1;this.bg=this.fs=this.es=0;this.dm=new qd}t=ul.prototype;t.Cy=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.Bd();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()};
t.save=function(){this.Bd();this.Y.save()};ul.prototype.rotate=function(a){this.dm.rotate(57.2958*a,0,0)};t=ul.prototype;t.setTransform=function(a,b,c,d,e,f){this.dm.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.dm.scale(a,b)};t.translate=function(a,b){this.dm.translate(a,b)};t.stroke=function(){this.Y.stroke()};
t.transform=function(a,b,c,d,e,f){if(1!==a||0!==b||0!==c||1!==d||0!==e||0!==f){var g=this.dm,h=g.m11*a+g.m21*b;a=g.m12*a+g.m22*b;b=g.m11*c+g.m21*d;c=g.m12*c+g.m22*d;g.dx=g.m11*e+g.m21*f+g.dx;g.dy=g.m12*e+g.m22*f+g.dy;g.m11=h;g.m12=a;g.m21=b;g.m22=c}};t.Bd=function(){var a=this.dm;this.Y.setTransform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy)};
t.uf=function(a){if(a instanceof ml&&a.type===nl){var b=a.Pk;a=a.At;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.hn?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.hn?this.clip():this.fill()};t.Xi=function(){this.hn||this.stroke()};t.bw=function(a,b,c){this.es=a;this.fs=b;this.bg=c};
t.As=function(a,b){var c=this.Y;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.ys=function(){var a=this.Y;void 0!==a.setLineDash&&(a.setLineDash(Wl),a.lineDashOffset=0)};t.Ec=function(a){a&&(this.yt="");this.xt=this.zt=""};
na.Object.defineProperties(ul.prototype,{fillStyle:{get:function(){return this.Y.fillStyle},set:function(a){this.xt!==a&&(this.xt=this.Y.fillStyle=a)}},font:{get:function(){return this.Y.font},set:function(a){this.yt!==a&&(this.yt=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.zt!==a&&(this.zt=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.hn},
set:function(a){this.hn=a}}});var Wl=Object.freeze([]);ul.className="CanvasSurfaceContext";function Xl(){this.M=this.o=this.C=this.j=0}Xl.className="ColorNumbers";function ml(a,b){Yl||(Zl(),Yl=!0);Ta(this);this.v=!1;void 0===a?(this.ia=tl,this.Ok="black"):"string"===typeof a?(this.ia=tl,this.Ok=a):(this.ia=a,this.Ok="black");a=this.ia;a===wl?(this.zd=vc,this.bl=Bc):this.bl=a===nl?this.zd=yc:this.zd=rc;this.js=0;this.jr=NaN;this.ke=this.Ur=this.je=null;this.At=this.Pk=0;b&&Object.assign(this,b)}
ml.prototype.copy=function(){var a=new ml;a.ia=this.ia;a.Ok=this.Ok;a.zd=this.zd.I();a.bl=this.bl.I();a.js=this.js;a.jr=this.jr;null!==this.je&&(a.je=this.je.copy());a.Ur=this.Ur;return a};t=ml.prototype;t.freeze=function(){this.v=!0;null!==this.je&&this.je.freeze();return this};t.ea=function(){Object.isFrozen(this)&&C("cannot thaw constant: "+this);this.v=!1;null!==this.je&&this.je.ea();return this};t.gb=function(a){a.classType===ml&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===tl)a+=this.color;else if(a=this.type===wl?a+"Linear ":this.type===nl?a+"Radial ":this.type===vl?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&&wa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&xa(a,"0 <= loc <= 1",ml,"addColorStop:loc");null===this.je&&(this.je=new I);this.je.add(a,b);this.ia===tl&&(this.type=wl);this.ke=null;return this};
t.yA=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?$l:b;if(this.type===tl)Ph(this.color),this.color=am(a,b);else if((this.type===wl||this.type===nl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Ph(c.value),this.addColorStop(c.key,am(a,b));return this};function bm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?$l:c;Ph(a);return am(b,c)}
t.Az=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?$l:b;if(this.type===tl)Ph(this.color),this.color=am(-a,b);else if((this.type===wl||this.type===nl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Ph(c.value),this.addColorStop(c.key,am(-a,b));return this};function cm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?$l:c;Ph(a);return am(-b,c)}
function dm(a,b,c){Ph(a);a=em.j;var d=em.C,e=em.o,f=em.M;Ph(b);void 0===c&&(c=.5);return"rgba("+Math.round((em.j-a)*c+a)+", "+Math.round((em.C-d)*c+d)+", "+Math.round((em.o-e)*c+e)+", "+Math.round((em.M-f)*c+f)+")"}
t.jy=function(){if(this.type===tl)return fm(this.color);if((this.type===wl||this.type===nl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===nl)return fm(a.first().value);if(null!==a.get(.5))return fm(a.get(.5));if(2===a.count)return a=a.xa(),fm(dm(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 fm(dm(a.get(c),a.get(d),1-f/e))}return!1};
function fm(a){if(!a)return!1;if(a instanceof ml)return a.jy();Ph(a);return 128>(299*em.j+587*em.C+114*em.o)/1E3}
function am(a,b){switch(b){case $l:b=100*gm(em.j);var c=100*gm(em.C),d=100*gm(em.o);hm.j=.4124564*b+.3575761*c+.1804375*d;hm.C=.2126729*b+.7151522*c+.072175*d;hm.o=.0193339*b+.119192*c+.9503041*d;hm.M=em.M;b=im(hm.j/jm[0]);c=im(hm.C/jm[1]);d=im(hm.o/jm[2]);km.j=116*c-16;km.C=500*(b-c);km.o=200*(c-d);km.M=hm.M;km.j=Math.min(100,Math.max(0,km.j+100*a));a=(km.j+16)/116;b=a-km.o/200;hm.j=jm[0]*lm(km.C/500+a);hm.C=jm[1]*(km.j>mm*nm?Math.pow(a,3):km.j/mm);hm.o=jm[2]*lm(b);hm.M=km.M;a=-.969266*hm.j+1.8760108*
hm.C+.041556*hm.o;b=.0556434*hm.j+-.2040259*hm.C+1.0572252*hm.o;em.j=255*om((3.2404542*hm.j+-1.5371385*hm.C+-.4985314*hm.o)/100);em.C=255*om(a/100);em.o=255*om(b/100);em.M=hm.M;em.j=Math.round(em.j);255<em.j?em.j=255:0>em.j&&(em.j=0);em.C=Math.round(em.C);255<em.C?em.C=255:0>em.C&&(em.C=0);em.o=Math.round(em.o);255<em.o?em.o=255:0>em.o&&(em.o=0);return"rgba("+em.j+", "+em.C+", "+em.o+", "+em.M+")";case pm:return Qh(),Rh.o=Math.min(100,Math.max(0,Rh.o+100*a)),"hsla("+Rh.j+", "+Rh.C+"%, "+Rh.o+"%, "+
Rh.M+")";default:C("Unknown color space: "+b)}}function Ph(a){Yl||(Zl(),Yl=!0);var b=qm;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,em.j=a[0],em.C=a[1],em.o=a[2],em.M=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,em.j=0,em.C=0,em.o=0,em.M=1)}}
function Qh(){var a=em.j/255,b=em.C/255,c=em.o/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))}Rh.j=Math.round(g);Rh.C=Math.round(100*a);Rh.o=Math.round(100*e);Rh.M=em.M}function gm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function om(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function im(a){return a>nm?Math.pow(a,1/3):(mm*a+16)/116}function lm(a){var b=a*a*a;return b>nm?b:(116*a-16)/mm}function Nl(a,b){"string"!==typeof a&&(a instanceof ml||C("Value for "+b+" must be a color string or a Brush, not "+a))}function Zl(){qm=Jg?(new Ak(null)).context:null}
na.Object.defineProperties(ml.prototype,{type:{get:function(){return this.ia},set:function(a){this.v&&wa(this,a);this.ia=a;this.start.wc()&&(a===wl?this.start=vc:a===nl&&(this.start=yc));this.end.wc()&&(a===wl?this.end=Bc:a===nl&&(this.end=yc));this.ke=null}},color:{get:function(){return this.Ok},set:function(a){this.v&&wa(this,a);this.Ok=a;this.ke=null}},start:{get:function(){return this.zd},set:function(a){this.v&&
wa(this,a);this.zd=a.I();this.ke=null}},end:{get:function(){return this.bl},set:function(a){this.v&&wa(this,a);this.bl=a.I();this.ke=null}},startRadius:{get:function(){return this.js},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",ml,"startRadius");this.js=a;this.ke=null}},endRadius:{get:function(){return this.jr},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",ml,"endRadius");this.jr=a;this.ke=
null}},colorStops:{get:function(){return this.je},set:function(a){this.v&&wa(this,a);this.je=a;this.ke=null}},pattern:{get:function(){return this.Ur},set:function(a){this.v&&wa(this,a);this.Ur=a;this.ke=null}}});ml.prototype.isDark=ml.prototype.jy;ml.prototype.darkenBy=ml.prototype.Az;ml.prototype.lightenBy=ml.prototype.yA;ml.prototype.addColorStop=ml.prototype.addColorStop;
var nm=216/24389,mm=24389/27,jm=[95.047,100,108.883],qm=null,em=new Xl,Rh=new Xl,hm=new Xl,km=new Xl,Yl=!1;ml.className="Brush";var tl;ml.Solid=tl=new D(ml,"Solid",0);var wl;ml.Linear=wl=new D(ml,"Linear",1);var nl;ml.Radial=nl=new D(ml,"Radial",2);var vl;ml.Pattern=vl=new D(ml,"Pattern",4);var $l;ml.Lab=$l=new D(ml,"Lab",5);var pm;ml.HSL=pm=new D(ml,"HSL",6);
ml.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};
ml.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;Yl||(Zl(),Yl=!0);var b=qm;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};ml.lighten=function(a){return bm(a)};ml.lightenBy=bm;ml.darken=function(a){return cm(a)};ml.darkenBy=cm;ml.mix=dm;ml.isDark=fm;function Kl(){this.na="Base"}Kl.prototype.measure=function(){};
Kl.prototype.BA=function(a,b,c,d,e){a.measure(b,c,d,e)};Kl.prototype.arrange=function(){};Kl.prototype.nz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Kl.prototype.LA=function(a){a.mk()};Kl.prototype.lc=function(){};na.Object.defineProperties(Kl.prototype,{name:{get:function(){return this.na},set:function(a){this.na=a}},classType:{get:function(){return X}}});Kl.prototype.remeasureObject=Kl.prototype.LA;Kl.prototype.arrangeElement=Kl.prototype.nz;
Kl.prototype.measureElement=Kl.prototype.BA;Kl.className="PanelLayout";function rm(){this.na="Base"}ma(rm,Kl);
rm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=sm(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 uf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);$b(e,p,r,n,m)}}};
rm.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 uf&&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 tm(){this.na="Base"}ma(tm,Kl);
tm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Fa();f=sm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=hl(l,!1);if(m!==og&&m!==Vk)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)};
tm.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,v=hl(m,!1);if(isNaN(m.desiredSize.height)&&v===sd||v===Wk)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Lb()&&(q=a.defaultAlignment);q.hb()||(q=yc);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 um(){this.na="Base"}ma(um,Kl);
um.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Fa();for(var h=sm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=hl(l,!1);if(m!==og&&m!==Wk)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;Tb(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)}};
um.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,v=hl(m,!1);if(isNaN(m.desiredSize.width)&&v===sd||v===Vk)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Lb()&&(q=a.defaultAlignment);q.hb()||(q=yc);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 vm(){this.na="Base"}ma(vm,Kl);
vm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.nb(),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);var u=a.isClipping,v=N.allocAt(-l.left,-l.top,r,q),w=N.allocAt(0,0,f,g);wm(k,w,!0);f=w.width;g=w.height;for(var z=!0,y=sm(a),A=0;A<h;A++){var B=d[A],F=b,K=c;if(B!==k&&(B.visible||B===y)){l=B.margin;r=l.right+l.left;q=l.top+l.bottom;p=hl(B,!1);switch(p){case sd:F=f;K=g;break;case Vk:F=
f;break;case Wk:K=g}B.measure(F,K,0,0);p=B.measuredBounds;r=Math.max(p.width+r,0);q=Math.max(p.height+q,0);F=B.alignment;F.Lb()&&(F=a.defaultAlignment);F.hb()||(F=yc);var S=B.alignmentFocus;S.Lb()&&(S=yc);K=null;B instanceof X&&""!==B.Oe&&(K=B.Ya(B.Oe),K===B&&(K=null));var R=w.x,O=w.y;if(null!==K){B.arrange(0,0,p.width,p.height);l=K.actualBounds;l=J.allocAt(l.x+(S.x*l.width-S.offsetX),l.y+(S.y*l.height-S.offsetY));for(K=K.panel;K!==B;)K.transform.ya(l),K=K.panel;R+=F.x*f+F.offsetX-l.x;O+=F.y*g+F.offsetY-
l.y;J.free(l)}else R+=F.x*f+F.offsetX-(S.x*p.width+S.offsetX)-l.left,O+=F.y*g+F.offsetY-(S.y*p.height+S.offsetY)-l.top;z?(z=!1,e.h(R,O,r,q)):$b(e,R,O,r,q)}}z?e.assign(v):u?e.zv(w.x,w.y,w.width,w.height):$b(e,v.x,v.y,v.width,v.height);N.free(v);N.free(w);p=k.stretch;p===Uk&&(p=hl(k,!1));switch(p){case og:return;case sd:if(!isFinite(b)&&!isFinite(c))return;break;case Vk:if(!isFinite(b))return;break;case Wk: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);wm(k,w,!0);f=w.width;g=w.height;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.Lb()&&(m=a.defaultAlignment),m.hb()||(m=yc),c=c.alignmentFocus,c.Lb()&&(c=yc),z?(z=!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)):$b(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));z?e.assign(v):u?e.zv(w.x,w.y,w.width,w.height):$b(e,v.x,v.y,v.width,v.height);N.free(w)};
vm.prototype.arrange=function(a,b,c){var d=b.length,e=a.nb(),f=e.measuredBounds,g=f.width,h=f.height,k=a.padding;f=k.left;k=k.top;var l=f-c.x,m=k-c.y;e.arrange(l,m,g,h);g=N.allocAt(0,0,g,h);wm(e,g,!1);for(h=0;h<d;h++){var n=b[h];if(n!==e){l=n.measuredBounds;var p=l.width,r=l.height;m=n.alignment;m.Lb()&&(m=a.defaultAlignment);m.hb()||(m=yc);var q=n.alignmentFocus;q.Lb()&&(q=yc);l=null;n instanceof X&&""!==n.Oe&&(l=n.Ya(n.Oe),l===n&&(l=null));if(null!==l){var u=l.actualBounds;q=J.allocAt(u.x+(q.x*
u.width-q.offsetX),u.y+(q.y*u.height-q.offsetY));for(l=l.panel;l!==n;)l.transform.ya(q),l=l.panel;l=m.x*g.width+m.offsetX-q.x;m=m.y*g.height+m.offsetY-q.y;J.free(q)}else l=m.x*g.width+m.offsetX-(q.x*p+q.offsetX),m=m.y*g.height+m.offsetY-(q.y*r+q.offsetY);l+=g.x-c.x;m+=g.y-c.y;n.visible&&n.arrange(f+l,k+m,p,r)}}N.free(g)};
function wm(a,b,c){var d=null;a instanceof X&&""!==a.Oe&&(d=a.Ya(a.Oe),d===a&&(d=null));if(null!==d)for(c&&a.arrange(0,0,b.width,b.height),b.assign(d.actualBounds),d=d.panel;d!==a;)d.transform.Jq(b),d=d.panel}function xm(){this.na="Base"}ma(xm,Kl);
xm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.nb(),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 uf&&(u=k,q=u.strokeWidth*u.scale);var v=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var w=ym(k),z=w.x*v+w.offsetX;w=w.y*l+w.offsetY;var y=zm(k),A=y.x*v+y.offsetX;y=y.y*l+y.offsetY;isFinite(b)&&(m=Math.max(Math.abs(z-A)-q,0));isFinite(c)&&(n=Math.max(Math.abs(w-y)-q,0));q=M.alloc();q.h(0,0);a=sm(a);for(y=0;y<h;y++)w=
d[y],w===k||!w.visible&&w!==a||(l=w.margin,v=l.right+l.left,z=l.top+l.bottom,w.measure(m,n,0,0),l=w.measuredBounds,v=Math.max(l.width+v,0),l=Math.max(l.height+z,0),q.h(Math.max(v,q.width),Math.max(l,q.height)));if(1===h)e.width=v,e.height=l,M.free(q);else{w=ym(k);y=zm(k);h=d=0;y.x!==w.x&&y.y!==w.y&&(d=q.width/Math.abs(y.x-w.x),h=q.height/Math.abs(y.y-w.y));M.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,pg(u)===qg&&(d=h=Math.max(d,h)));d+=Math.abs(w.offsetX)+Math.abs(y.offsetX)+q;h+=Math.abs(w.offsetY)+
Math.abs(y.offsetY)+q;u=k.stretch;u===Uk&&(u=hl(k,!1));switch(u){case og:g=f=0;break;case sd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Vk:isFinite(b)&&(d=b);g=0;break;case Wk:f=0,isFinite(c)&&(h=c)}k.mk();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
xm.prototype.arrange=function(a,b){var c=b.length,d=a.nb(),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=ym(d),n=zm(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;$b(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.Lb()&&(p=a.defaultAlignment),p.hb()||(p=yc),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&&(ac(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 Am(){this.na="Base";this.name="Table"}ma(Am,Kl);
Am.prototype.measure=function(a,b,c,d,e){for(var f=d.length,g=Fa(),h=Fa(),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.T.m,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=[],v=0;v<f;v++){var w=g[v];hj(w,!0);il(w,!0);u[w.row]||(u[w.row]=[]);
u[w.row][w.column]||(u[w.row][w.column]=[]);u[w.row][w.column].push(w)}Ia(g);var z=Fa(),y=Fa(),A=Fa(),B={count:0},F={count:0},K=b,S=c,R=a.Db;f=R.length;for(var O=0;O<f;O++){var H=R[O];void 0!==H&&(H.actual=0)}R=a.yb;f=R.length;for(var da=0;da<f;da++)H=R[da],void 0!==H&&(H.actual=0);for(var ba=u.length,ra=0,Ca=0;Ca<ba;Ca++)u[Ca]&&(ra=Math.max(ra,u[Ca].length));var cb=Math.min(a.topIndex,ba-1),db=Math.min(a.leftIndex,ra-1),Ha=0;ba=u.length;for(var zb=sm(a),Db=0;Db<ba;Db++)if(u[Db]){ra=u[Db].length;
var Yc=a.getRowDefinition(Db);Yc.actual=0;for(var Rb=Yc.$b=0;Rb<ra;Rb++)if(u[Db][Rb]){var jc=a.getColumnDefinition(Rb);void 0===z[Rb]&&(jc.actual=0,jc.$b=0,z[Rb]=!0);for(var Ec=u[Db][Rb],ge=Ec.length,xf=0;xf<ge;xf++){var sb=Ec[xf];if(sb.visible||sb===zb){var he=1<sb.rowSpan||1<sb.columnSpan;he&&(Db<cb||Rb<db||y.push(sb));var dg=sb.margin,ph=dg.right+dg.left,qh=dg.top+dg.bottom;var eb=Al(sb,Yc,jc,!1);var ti=sb.desiredSize,bk=!isNaN(ti.height),eg=!isNaN(ti.width)&&bk;he||eb===og||eg||Db<cb||Rb<db||
(void 0!==B[Rb]||eb!==sd&&eb!==Vk||(B[Rb]=-1,B.count++),void 0!==F[Db]||eb!==sd&&eb!==Wk||(F[Db]=-1,F.count++),A.push(sb));sb.measure(Infinity,Infinity,0,0);if(!(Db<cb||Rb<db)){var ld=sb.measuredBounds,kc=Math.max(ld.width+ph,0),yf=Math.max(ld.height+qh,0);if(1===sb.rowSpan&&(eb===og||eb===Vk)){H=a.getRowDefinition(Db);var tc=H.Fc();Ha=Math.max(yf-H.actual,0);Ha+tc>S&&(Ha=Math.max(S-tc,0));var fg=0===H.ga;H.$b=H.$b+Ha;H.actual=H.ga+Ha;S=Math.max(S-(Ha+(fg?tc:0)),0)}if(1===sb.columnSpan&&(eb===og||
eb===Wk)){H=a.getColumnDefinition(Rb);var rh=H.Fc();Ha=Math.max(kc-H.actual,0);Ha+rh>K&&(Ha=Math.max(K-rh,0));var wn=0===H.ga;H.$b=H.$b+Ha;H.actual=H.ga+Ha;K=Math.max(K-(Ha+(wn?rh:0)),0)}he&&sb.mk()}}}}}Ia(z);var Gd=0,ie=0;f=a.columnCount;for(var gg=0;gg<f;gg++){var Ve=a.yb[gg];void 0!==Ve&&(Gd+=isNaN(Ve.rc)?Ve.$b:Ve.rc,0!==Ve.$b&&(Gd+=Ve.Fc()))}f=a.rowCount;for(var Hd=0;Hd<f;Hd++){var yd=a.Db[Hd];void 0!==yd&&(ie+=isNaN(yd.rc)?yd.$b:yd.rc,0!==yd.$b&&(ie+=yd.Fc()))}K=Math.max(b-Gd,0);var dc=S=Math.max(c-
ie,0),sh=K;f=A.length;for(var th=0;th<f;th++){var ec=A[th],ui=a.getRowDefinition(ec.row),je=a.getColumnDefinition(ec.column),We=ec.measuredBounds,Pc=ec.margin,vi=Pc.right+Pc.left,ck=Pc.top+Pc.bottom;B[ec.column]=0===je.$b&&void 0!==B[ec.column]?Math.max(We.width+vi,B[ec.column]):null;F[ec.row]=0===ui.$b&&void 0!==F[ec.row]?Math.max(We.height+ck,F[ec.row]):null}var Id=0,uh=0,zf;for(zf in F)"count"!==zf&&(Id+=F[zf]);for(zf in B)"count"!==zf&&(uh+=B[zf]);for(var bb=M.alloc(),Eb=0;Eb<f;Eb++){var Fb=A[Eb];
if(Fb.visible||Fb===zb){var lc=a.getRowDefinition(Fb.row),uc=a.getColumnDefinition(Fb.column),Jd=0;isFinite(uc.width)?Jd=uc.width:(isFinite(K)&&null!==B[Fb.column]?0===uh?Jd=uc.actual+K:Jd=B[Fb.column]/uh*sh:null!==B[Fb.column]?Jd=K:Jd=uc.actual||K,Jd=Math.max(0,Jd-uc.Fc()));var Fe=0;isFinite(lc.height)?Fe=lc.height:(isFinite(S)&&null!==F[Fb.row]?0===Id?Fe=lc.actual+S:Fe=F[Fb.row]/Id*dc:null!==F[Fb.row]?Fe=S:Fe=lc.actual||S,Fe=Math.max(0,Fe-lc.Fc()));bb.h(Math.max(uc.minimum,Math.min(Jd,uc.maximum)),
Math.max(lc.minimum,Math.min(Fe,lc.maximum)));eb=Al(Fb,lc,uc,!1);switch(eb){case Vk:bb.height=Math.max(bb.height,lc.actual+S);break;case Wk:bb.width=Math.max(bb.width,uc.actual+K)}var hg=Fb.margin,wi=hg.right+hg.left,xi=hg.top+hg.bottom;Fb.mk();Fb.measure(bb.width,bb.height,uc.minimum,lc.minimum);var yi=Fb.measuredBounds,fc=Math.max(yi.width+wi,0),Xe=Math.max(yi.height+xi,0);isFinite(K)&&(fc=Math.min(fc,bb.width));isFinite(S)&&(Xe=Math.min(Xe,bb.height));var Ye=0;Ye=lc.actual;lc.actual=Math.max(lc.actual,
Xe);lc.$b=Math.max(lc.$b,Xe);Ha=lc.actual-Ye;S=Math.max(S-Ha,0);null===F[Fb.row]&&(dc=Math.max(dc-Ha,0));Ye=uc.actual;uc.actual=Math.max(uc.actual,fc);uc.$b=Math.max(uc.$b,fc);Ha=uc.actual-Ye;K=Math.max(K-Ha,0);null===B[Fb.column]&&(sh=Math.max(sh-Ha,0))}}Ia(A);var Qc=M.alloc(),ke=Fa(),md=Fa();f=y.length;if(0!==f)for(var le=0;le<ba;le++)if(u[le]){ra=u[le].length;var dk=a.getRowDefinition(le);ke[le]=dk.actual;for(var Af=0;Af<ra;Af++)if(u[le][Af]){var ek=a.getColumnDefinition(Af);md[Af]=ek.actual}}for(var Bf=
0;Bf<f;Bf++){var Na=y[Bf];if(Na.visible||Na===zb){var Kd=a.getRowDefinition(Na.row),qb=a.getColumnDefinition(Na.column);bb.h(Math.max(qb.minimum,Math.min(b,qb.maximum)),Math.max(Kd.minimum,Math.min(c,Kd.maximum)));eb=Al(Na,Kd,qb,!1);switch(eb){case sd:0!==md[qb.index]&&(bb.width=Math.min(bb.width,md[qb.index]));0!==ke[Kd.index]&&(bb.height=Math.min(bb.height,ke[Kd.index]));break;case Vk:0!==md[qb.index]&&(bb.width=Math.min(bb.width,md[qb.index]));break;case Wk:0!==ke[Kd.index]&&(bb.height=Math.min(bb.height,
ke[Kd.index]))}isFinite(qb.width)&&(bb.width=qb.width);isFinite(Kd.height)&&(bb.height=Kd.height);Qc.h(0,0);for(var vh=qb.minimum,Ld=Kd.minimum,Cf=1;Cf<Na.rowSpan&&!(Na.row+Cf>=a.rowCount);Cf++)H=a.getRowDefinition(Na.row+Cf),Ha=0,Ha=eb===sd||eb===Wk?Math.max(H.minimum,0===ke[Na.row+Cf]?H.maximum:Math.min(ke[Na.row+Cf],H.maximum)):Math.max(H.minimum,isNaN(H.rc)?H.maximum:Math.min(H.rc,H.maximum)),Qc.height+=Ha,Ld+=H.minimum;for(var nd=1;nd<Na.columnSpan&&!(Na.column+nd>=a.columnCount);nd++)H=a.getColumnDefinition(Na.column+
nd),Ha=0,Ha=eb===sd||eb===Vk?Math.max(H.minimum,0===md[Na.column+nd]?H.maximum:Math.min(md[Na.column+nd],H.maximum)):Math.max(H.minimum,isNaN(H.rc)?H.maximum:Math.min(H.rc,H.maximum)),Qc.width+=Ha,vh+=H.minimum;bb.width+=Qc.width;bb.height+=Qc.height;var Df=Na.margin,zi=Df.right+Df.left,me=Df.top+Df.bottom;Na.measure(bb.width,bb.height,vh,Ld);for(var ig=Na.measuredBounds,Ef=Math.max(ig.width+zi,0),Ai=Math.max(ig.height+me,0),Ze=0,Zc=0;Zc<Na.rowSpan&&!(Na.row+Zc>=a.rowCount);Zc++)H=a.getRowDefinition(Na.row+
Zc),Ze+=H.total||0;if(Ze<Ai){var od=Ai-Ze,Ff=Ai-Ze;if(null!==Na.spanAllocation)for(var Gf=Na.spanAllocation,ne=0;ne<Na.rowSpan&&!(0>=od)&&!(Na.row+ne>=a.rowCount);ne++){H=a.getRowDefinition(Na.row+ne);var zd=H.ga||0,fk=Gf(Na,H,Ff);H.actual=Math.min(H.maximum,zd+fk);H.ga!==zd&&(od-=H.ga-zd)}for(;0<od;){var Ge=H.ga||0;isNaN(H.height)&&H.maximum>Ge&&(H.actual=Math.min(H.maximum,Ge+od),H.ga!==Ge&&(od-=H.ga-Ge));if(0===H.index)break;H=a.getRowDefinition(H.index-1)}}for(var wh=0,xh=0;xh<Na.columnSpan&&
!(Na.column+xh>=a.columnCount);xh++)H=a.getColumnDefinition(Na.column+xh),wh+=H.total||0;if(wh<Ef){var $c=Ef-wh,Bi=Ef-wh;if(null!==Na.spanAllocation)for(var xn=Na.spanAllocation,yh=0;yh<Na.columnSpan&&!(0>=$c)&&!(Na.column+yh>=a.columnCount);yh++){H=a.getColumnDefinition(Na.column+yh);var yn=H.ga||0,Wt=xn(Na,H,Bi);H.actual=Math.min(H.maximum,yn+Wt);H.ga!==yn&&($c-=H.ga-yn)}for(;0<$c;){var gk=H.ga||0;isNaN(H.width)&&H.maximum>gk&&(H.actual=Math.min(H.maximum,gk+$c),H.ga!==gk&&($c-=H.ga-gk));if(0===
H.index)break;H=a.getColumnDefinition(H.index-1)}}}}Ia(y);M.free(Qc);M.free(bb);void 0!==ke&&Ia(ke);void 0!==md&&Ia(md);var jg=0,kg=0,hk=a.desiredSize,fr=a.maxSize;eb=hl(a,!0);var Ci=ie=Gd=0,Di=0;f=a.columnCount;for(var ik=0;ik<f;ik++)void 0!==a.yb[ik]&&(H=a.getColumnDefinition(ik),isFinite(H.width)?(Ci+=H.width,Ci+=H.Fc()):Bm(H)===Cm?(Ci+=H.ga,Ci+=H.Fc()):0!==H.ga&&(Gd+=H.ga,Gd+=H.Fc()));isFinite(hk.width)?jg=Math.min(hk.width,fr.width):jg=eb!==og&&isFinite(b)?b:Gd;jg=Math.max(jg,a.minSize.width);
jg=Math.max(jg-Ci,0);for(var Xt=0===Gd?1:Math.max(jg/Gd,1),kk=0;kk<f;kk++)void 0!==a.yb[kk]&&(H=a.getColumnDefinition(kk),isFinite(H.width)||Bm(H)===Cm||(H.actual=H.ga*Xt),H.position=e.width,0!==H.ga&&(e.width+=H.ga,e.width+=H.Fc()));f=a.rowCount;for(var lk=0;lk<f;lk++)void 0!==a.Db[lk]&&(H=a.getRowDefinition(lk),isFinite(H.height)?(Di+=H.height,Di+=H.Fc()):Bm(H)===Cm?(Di+=H.ga,Di+=H.Fc()):0!==H.ga&&(ie+=H.ga,0!==H.ga&&(ie+=H.Fc())));isFinite(hk.height)?kg=Math.min(hk.height,fr.height):kg=eb!==og&&
isFinite(c)?c:ie;kg=Math.max(kg,a.minSize.height);kg=Math.max(kg-Di,0);for(var Yt=0===ie?1:Math.max(kg/ie,1),mk=0;mk<f;mk++)void 0!==a.Db[mk]&&(H=a.getRowDefinition(mk),isFinite(H.height)||Bm(H)===Cm||(H.actual=H.ga*Yt),H.position=e.height,0!==H.ga&&(e.height+=H.ga,0!==H.ga&&(e.height+=H.Fc())));f=h.length;for(var zn=0;zn<f;zn++){var Fi=h[zn],An=0,Bn=0;Fi.type===X.TableRow?(An=e.width,H=a.getRowDefinition(Fi.row),Bn=H.actual):(H=a.getColumnDefinition(Fi.column),An=H.actual,Bn=e.height);Fi.measuredBounds.h(0,
0,An,Bn);hj(Fi,!1)}Ia(h);a.pp=u};
Am.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.pp,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));k=a.Db;h=a.yb;for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===k[n]||0===k[n].ga);)n++;n=Math.max(Math.min(n,l-1),0);n=-k[n].position;for(var p=Math.min(a.leftIndex,m-1);p!==m&&(void 0===h[p]||0===h[p].ga);)p++;p=Math.max(Math.min(p,m-1),0);p=-h[p].position;for(var r=0,q=0;r!==l&&void 0===k[r];)r++;for(;q!==l&&void 0===h[q];)q++;m=a.part;a.getRowDefinition(r);
a.getColumnDefinition(q);for(var u=0;u<b.length;u++){var v=b[u];if(v instanceof X&&v.visible&&(v.type===X.TableRow||v.type===X.TableColumn)){if(v.type===X.TableRow){h=a.getRowDefinition(v.row);var w=a.getColumnDefinition(q)}else h=a.getRowDefinition(r),w=a.getColumnDefinition(v.column);k=h.position+n+e;0!==h.ga&&(k+=h.cq(r));h=w.position+p+f;0!==w.ga&&(h+=w.cq(q));w=v.measuredBounds;v.ll();v.actualBounds.ea();var z=v.actualBounds,y=N.allocAt(z.x,z.y,z.width,z.height);z.x=v.type===X.TableRow?f:h;z.y=
v.type===X.TableColumn?e:k;z.width=w.width;z.height=w.height;v.actualBounds.freeze();il(v,!1);Wb(y,z)||null===m||(m.Ch(),v.Qo(m));N.free(y)}}u=M.alloc();for(v=0;v<l;v++)if(g[v])for(m=g[v].length,w=a.getRowDefinition(v),k=w.position+n+e,0!==w.ga&&(k+=w.cq(r)),z=0;z<m;z++)if(g[v][z]){y=a.getColumnDefinition(z);h=y.position+p+f;0!==y.ga&&(h+=y.cq(q));for(var A=g[v][z],B=A.length,F=0;F<B;F++){var K=A[F],S=K.measuredBounds;u.h(0,0);for(var R=1;R<K.rowSpan&&!(v+R>=a.rowCount);R++){var O=a.getRowDefinition(v+
R);0!==O.ga&&(u.height+=O.total)}for(R=1;R<K.columnSpan&&!(z+R>=a.columnCount);R++)O=a.getColumnDefinition(z+R),0!==O.ga&&(u.width+=O.total);var H=y.ga+u.width,da=w.ga+u.height;R=h;O=k;var ba=H,ra=da,Ca=h,cb=k,db=H,Ha=da;h+H>c.width&&(db=Math.max(c.width-h,0));k+da>c.height&&(Ha=Math.max(c.height-k,0));var zb=K.alignment;if(zb.Lb()){zb=a.defaultAlignment;zb.hb()||(zb=yc);var Db=zb.x;var Yc=zb.y;var Rb=zb.offsetX;zb=zb.offsetY;var jc=y.alignment,Ec=w.alignment;jc.hb()&&(Db=jc.x,Rb=jc.offsetX);Ec.hb()&&
(Yc=Ec.y,zb=Ec.offsetY)}else Db=zb.x,Yc=zb.y,Rb=zb.offsetX,zb=zb.offsetY;if(isNaN(Db)||isNaN(Yc))Yc=Db=.5,zb=Rb=0;jc=S.width;Ec=S.height;var ge=K.margin,xf=ge.left+ge.right,sb=ge.top+ge.bottom,he=Al(K,w,y,!1);!isNaN(K.desiredSize.width)||he!==sd&&he!==Vk||(jc=Math.max(H-xf,0));!isNaN(K.desiredSize.height)||he!==sd&&he!==Wk||(Ec=Math.max(da-sb,0));H=K.maxSize;da=K.minSize;jc=Math.min(H.width,jc);Ec=Math.min(H.height,Ec);jc=Math.max(da.width,jc);Ec=Math.max(da.height,Ec);H=Ec+sb;R+=ba*Db-(jc+xf)*Db+
Rb+ge.left;O+=ra*Yc-H*Yc+zb+ge.top;K.visible&&(ac(Ca,cb,db,Ha,R,O,S.width,S.height)?K.arrange(R,O,jc,Ec):K.arrange(R,O,jc,Ec,new N(Ca,cb,db,Ha)))}}M.free(u);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 Dm(){this.na="Base"}ma(Dm,Kl);Dm.prototype.measure=function(){};Dm.prototype.arrange=function(){};
function Em(){this.na="Base"}ma(Em,Kl);Em.prototype.measure=function(){};Em.prototype.arrange=function(){};function Fm(){this.na="Base"}ma(Fm,Kl);
Fm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&C("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.sa=1;d.mk();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===qg?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.sa*=q;m!==d.scale&&(hj(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)};Fm.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.Lb()&&(g=a.defaultAlignment);g.hb()||(g=yc);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 Gm(){this.na="Base"}ma(Gm,Kl);Gm.prototype.measure=function(){};
Gm.prototype.arrange=function(){};
Gm.prototype.lc=function(a,b,c){c=a.wf()*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.T.m,u=q.length,v=0;v<u;v++){var w=q[v],z=[];r.push(z);if(w.visible){var y=w.interval;if(!(0>y)){w=Rj(w.figure);for(var A=0;A<u;A++)if(A!==v){var B=q[A];B.visible&&Rj(B.figure)===w&&(B=B.interval,B>y&&z.push(B))}}}}q=
a.T.m;u=q.length;for(v=0;v<u;v++){var F=q[v];if(F.visible&&(z=F.interval||1,w=Math.abs(z),!(2>e*w*c))){y=F.segmentIndex;if(!isFinite(y)||isNaN(y))y=0;0>y&&(y=w-Math.min(-y,w));y=Math.round(y%w);w=F.opacity;A=1;if(1!==w){if(0===w)continue;A=b.globalAlpha;b.globalAlpha=A*w}B=r[v];var K=!1,S=F.strokeDashArray;null!==S&&(K=!0,b.As(S,F.strokeDashOffset));if("LineV"===F.figure&&null!==F.stroke&&0<F.strokeWidth){b.lineWidth=F.strokeWidth;bi(a,b,F.stroke,!1,!1,f,g);b.beginPath();for(S=F=Math.floor((p-e)/
e);S<=F+l;S++){var R=S*e+p;0<=R&&R<=h&&Hm(S,z,y,B)&&(b.moveTo(R,0),b.lineTo(R,k))}b.stroke()}else if("LineH"===F.figure&&null!==F.stroke&&0<F.strokeWidth){b.lineWidth=F.strokeWidth;bi(a,b,F.stroke,!1,!1,f,g);b.beginPath();for(S=F=Math.floor((n-d)/d);S<=F+m;S++)R=S*d+n,0<=R&&R<=k&&Hm(S,z,y,B)&&(b.moveTo(0,R),b.lineTo(h,R));b.stroke()}else if("BarV"===F.figure&&null!==F.fill)for(bi(a,b,F.fill,!0,!1,f,g),F=F.width,isNaN(F)&&(F=e),R=S=Math.floor((p-e)/e);R<=S+l;R++){var O=R*e+p;0<=O+F&&O<=h&&Hm(R,z,y,
B)&&b.fillRect(O,0,F,k)}else if("BarH"===F.figure&&null!==F.fill)for(bi(a,b,F.fill,!0,!1,f,g),F=F.height,isNaN(F)&&(F=d),R=S=Math.floor((n-d)/d);R<=S+m;R++)O=R*d+n,0<=O+F&&O<=k&&Hm(R,z,y,B)&&b.fillRect(0,O,h,F);K&&b.ys();1!==w&&(b.globalAlpha=A)}}b.restore();b.Ec(!1)};function Hm(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 Im(){this.na="Base"}ma(Im,Kl);
Im.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof we||a instanceof U){var f=null,g=null;a instanceof U&&(f=a);a instanceof we&&(g=a,f=g.adornedPart,null===a.j&&(a.j=[]));if(f instanceof U){var h=f;if(0===c)Tb(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var k=a instanceof we?null:f.path,l=f.routeBounds;b=a.dg;b.h(0,0,l.width,l.height);var m=h.points,n=f.pointsCount;null!==g?g.sk(!1):null!==f&&f.sk(!1);var p=l.width,r=l.height;a.location.h(l.x,l.y);var q=a.j;q.length=0;null!==
k&&(Jm(a,p,r,k),g=k.measuredBounds,b.Nc(g),q.push(g));g=qd.alloc();for(var u=J.alloc(),v=J.alloc(),w=0;w<c;w++){var z=d[w];if(z!==k)if(z.isPanelMain&&z instanceof uf){Jm(a,p,r,z);var y=z.measuredBounds;b.Nc(y);q.push(y)}else if(2>n)z.measure(Infinity,Infinity,0,0),y=z.measuredBounds,b.Nc(y),q.push(y);else{var A=z.segmentIndex,B=z.segmentFraction,F=z.alignmentFocus;F.wc()&&(F=yc);var K=z.segmentOrientation,S=z.segmentOffset;if(isNaN(A)){var R=h.ma;y=Fa();R.vv(B,y);var O=J.allocAt(y[0],y[1]);O.add(h.i(0));
R.type===Q.j?O.offset(-R.startX,-R.startY):(R=R.figures.first(),null!==R&&O.offset(-R.startX,-R.startY));R=y[2];if(K!==Vf){var H=h.computeAngle(z,K,R);z.xb=H}H=O.x-l.x;var da=O.y-l.y;J.free(O);Ia(y)}else if(A<-n||A>=n)y=J.alloc(),h.pg(),h.computeMidPoint(y),R=h.midAngle,K!==Vf&&(H=h.computeAngle(z,K,R),z.xb=H),H=y.x-l.x,da=y.y-l.y,J.free(y);else{H=0;0<=A?(da=m.J(A),y=A<n-1?m.J(A+1):da):(H=n+A,da=m.J(H),y=0<H?m.J(H-1):da);if(da.Ta(y)){0<=A?(R=0<A?m.J(A-1):da,H=A<n-2?m.J(A+2):y):(R=H<n-1?m.J(H+1):da,
H=1<H?m.J(H-2):y);O=R.tf(da);var ba=y.tf(H);R=O>ba+10?0<=A?R.Oa(da):da.Oa(R):ba>O+10?0<=A?y.Oa(H):H.Oa(y):0<=A?R.Oa(H):H.Oa(R)}else R=0<=A?da.Oa(y):y.Oa(da);K!==Vf&&(H=h.computeAngle(z,K,R),z.xb=H);H=da.x+(y.x-da.x)*B-l.x;da=da.y+(y.y-da.y)*B-l.y}z.measure(Infinity,Infinity,0,0);y=z.measuredBounds;O=z.naturalBounds;var ra=0;z instanceof uf&&(ra=z.strokeWidth);ba=O.width+ra;var Ca=O.height+ra;g.reset();g.translate(-y.x,-y.y);g.scale(z.scale,z.scale);g.rotate(K===Vf?z.angle:R,ba/2,Ca/2);K!==Km&&K!==
Lm||g.rotate(90,ba/2,Ca/2);K!==Mm&&K!==Nm||g.rotate(-90,ba/2,Ca/2);K===Om&&(45<R&&135>R||225<R&&315>R)&&g.rotate(-R,ba/2,Ca/2);O=new N(0,0,ba,Ca);u.Ui(O,F);g.ya(u);F=-u.x+ra/2*z.scale;z=-u.y+ra/2*z.scale;v.assign(S);ra=isNaN(S.x);var cb=isNaN(S.y);if(ra||cb){ba=ba/2+3;Ca=Ca/2+3;var db=45<=R&&135>=R,Ha=225<=R&&315>=R;K===Vf&&(db||Ha)?(v.x=cb?ba:S.y,v.y=ra?Ca:S.x,db?0<=A||isNaN(A)&&.5>B||!ra||(v.y=-Ca):Ha&&((0<=A||isNaN(A)&&.5>B)&&ra&&(v.y=-Ca),cb&&(v.x=-ba))):(ra&&(v.x=0<=A||isNaN(A)&&.5>B?ba:-ba),
cb&&(v.y=-Ca),v.rotate(R))}else v.rotate(R);H+=v.x;da+=v.y;O.set(y);O.h(H+F,da+z,y.width,y.height);q.push(O);b.Nc(O)}}if(null!==f)for(d=f.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.dg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);Tb(e,b.width||0,b.height||0);qd.free(g);J.free(u);J.free(v)}}}};
Im.prototype.arrange=function(a,b){var c=b.length;if(a instanceof we||a instanceof U){var d=a,e=null;a instanceof we&&(e=a,d=e.adornedPart);var f=a instanceof we?null:d.path,g=a.j;if(0!==g.length){var h=0;if(null!==f&&h<g.length){var k=g[h];h++;f.arrange(k.x-a.dg.x,k.y-a.dg.y,k.width,k.height)}for(k=0;k<c;k++){var l=b[k];if(l!==f&&h<g.length){var m=g[h];h++;l.arrange(m.x-a.dg.x,m.y-a.dg.y,m.width,m.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof U)for(f=a.labelNodes;f.next();){var n=a;g=f.value;
h=g.segmentIndex;k=g.segmentFraction;var p=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){var r=n.ma;var q=Fa();r.vv(k,q);var u=J.allocAt(q[0],q[1]);u.add(n.i(0));r.type===Q.j?u.offset(-r.startX,-r.startY):(r=r.figures.first(),u.offset(-r.startX,-r.startY));r=q[2];l!==Vf&&(n=n.computeAngle(g,l,r),g.angle=n);n=u.x;var v=u.y;J.free(u);Ia(q)}else if(h<-c||h>=c)q=J.alloc(),r=n,v=q,r.pg(),r.computeMidPoint(v),r=n.midAngle,l!==Vf&&(n=n.computeAngle(g,l,r),g.angle=n),n=q.x,v=q.y,
J.free(q);else{u=0;0<=h?(q=b.m[h],v=h<c-1?b.m[h+1]:q):(u=c+h,q=b.m[u],v=0<u?b.m[u-1]:q);if(q.Ta(v)){0<=h?(r=0<h?b.m[h-1]:q,u=h<c-2?b.m[h+2]:v):(r=u<c-1?b.m[u+1]:q,u=1<u?b.m[u-2]:v);var w=r.tf(q),z=v.tf(u);r=w>z+10?0<=h?r.Oa(q):q.Oa(r):z>w+10?0<=h?v.Oa(u):u.Oa(v):0<=h?r.Oa(u):u.Oa(r)}else r=0<=h?q.Oa(v):v.Oa(q);l!==Vf&&(n=n.computeAngle(g,l,r),g.angle=n);n=q.x+(v.x-q.x)*k;v=q.y+(v.y-q.y)*k}if(p.Qs())g.location=new J(n,v);else{p.wc()&&(p=yc);q=qd.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,
0,0);var y=g.naturalBounds;u=N.allocAt(0,0,y.width,y.height);w=J.alloc();w.Ui(u,p);q.ya(w);p=-w.x;z=-w.y;var A=y.width,B=y.height;y=J.alloc();y.assign(m);var F=isNaN(m.x),K=isNaN(m.y);if(F||K){A=A/2+3;B=B/2+3;var S=45<=r&&135>=r,R=225<=r&&315>=r;l===Vf&&(S||R)?(y.x=K?A:m.y,y.y=F?B:m.x,S?0<=h||isNaN(h)&&.5>k||!F||(y.y=-B):R&&((0<=h||isNaN(h)&&.5>k)&&F&&(y.y=-B),K&&(y.x=-A))):(F&&(y.x=0<=h||isNaN(h)&&.5>k?A:-A),K&&(y.y=-B),y.rotate(r))}else y.rotate(r);n+=y.x;v+=y.y;q.Jq(u);p+=u.x;z+=u.y;h=J.allocAt(n+
p,v+z);g.move(h);J.free(h);J.free(y);J.free(w);N.free(u);qd.free(q)}}null!==e?e.sk(!1):d.sk(!1)}};
function Jm(a,b,c,d){if(!1!==mj(d)){var e=d.strokeWidth;0===e&&a instanceof we&&a.type===X.Link&&a.adornedObject instanceof uf&&(e=a.adornedObject.strokeWidth);e*=d.sa;a instanceof U&&null!==a.ma?(a=a.ma.bounds,d.ue(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof we&&null!==a.adornedPart.ma?(a=a.adornedPart.ma.bounds,d.ue(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):d.ue(-(e/2),-(e/2),b+e,c+e);hj(d,!1)}}function Pm(){this.na="Base"}ma(Pm,Kl);
Pm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.nb();a.Kg=[];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.Kg.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,v=r.flattenedLengths,w=r.flattenedTotalLength,z=u.length,y=0,A=0,B=Fa(),F=0;F<z;F++){var K=u[F],S=[];A=y=0;for(var R=K.length,O=0;O<R;O+=2){var H=K[O],da=K[O+1];if(0!==O){var ba=180*Math.atan2(da-
A,H-y)/Math.PI;0>ba&&(ba+=360);S.push(ba)}y=H;A=da}B.push(S)}if(null===a.Nf){for(var ra=[],Ca=a.T.m,cb=Ca.length,db=0;db<cb;db++){var Ha=Ca[db],zb=[];ra.push(zb);if(Ha.visible){var Db=Ha.interval;if(!(0>Db))for(var Yc=0;Yc<cb;Yc++)if(Yc!==db){var Rb=Ca[Yc];if(Rb.visible&&Ha.constructor===Rb.constructor){var jc=Rb.interval;jc>Db&&zb.push(jc)}}}}a.Nf=ra}var Ec=a.Nf;var ge=a.T.m,xf=ge.length,sb=0,he=0,dg=w;a.tj=[];for(var ph,qh=0;qh<xf;qh++){var eb=ge[qh];ph=[];if(eb.visible&&eb!==h){var ti=Math.abs(eb.interval),
bk=a.graduatedTickUnit;if(!(2>bk*ti*w/a.graduatedRange)){var eg=v[0][0],ld=0,kc=0;he=w*eb.graduatedStart-1E-4;dg=w*eb.graduatedEnd+1E-4;var yf=bk*ti,tc=a.graduatedTickBase;if(tc<a.graduatedMin){var fg=(a.graduatedMin-tc)/yf;fg=0===fg%1?fg:Math.floor(fg+1);tc+=fg*yf}else tc>a.graduatedMin+yf&&(tc-=Math.floor((tc-a.graduatedMin)/yf)*yf);for(var rh=Ec[qh],wn=tc,Gd=1;tc<a.graduatedMax+5E-8;Gd++){a:{for(var ie=rh.length,gg=0;gg<ie;gg++)if(L.aa((tc-a.graduatedTickBase)%(rh[gg]*a.graduatedTickUnit),0)){var Ve=
!1;break a}Ve=!0}if(Ve&&(null===eb.graduatedSkip||!eb.graduatedSkip(tc))&&(sb=(tc-a.graduatedMin)*w/a.graduatedRange,sb>w&&(sb=w),he<=sb&&sb<=dg)){for(var Hd=B[ld][kc],yd=v[ld][kc];ld<v.length;){for(;sb>eg&&kc<v[ld].length-1;)kc++,Hd=B[ld][kc],yd=v[ld][kc],eg+=yd;if(sb<=eg)break;ld++;kc=0;Hd=B[ld][kc];yd=v[ld][kc];eg+=yd}var dc=u[ld],sh=dc[2*kc],th=dc[2*kc+1],ec=(sb-(eg-yd))/yd,ui=new J(sh+(dc[2*kc+2]-sh)*ec+q/2-r.bounds.x,th+(dc[2*kc+3]-th)*ec+q/2-r.bounds.y);ui.scale(h.scale,h.scale);a:{var je=
Hd,We=B[ld];if(!(.5005>ec&&.4995<ec)){var Pc=je;.5>ec?0<kc?Pc=We[kc-1]:L.aa(dc[0],dc[dc.length-2])&&L.aa(dc[1],dc[dc.length-1])&&(Pc=We[We.length-1]):.5<ec&&(kc+1<We.length?Pc=We[kc+1]:L.aa(dc[0],dc[dc.length-2])&&L.aa(dc[1],dc[dc.length-1])&&(Pc=We[0]));if(je!==Pc){var vi=Math.abs(je-Pc);180<vi&&(je<Pc?je+=360:Pc+=360,vi=Math.abs(je-Pc));if(5E-4>ec||.9995<ec){Hd=(je+Pc)/2%360;break a}if(10>vi){var ck=1-Math.abs(.5-ec);Hd=(je*ck+Pc*(1-ck))%360;break a}}}Hd=je}if(eb instanceof Lg){var Id="";null!==
eb.graduatedFunction?(Id=eb.graduatedFunction(tc),Id=null!==Id&&void 0!==Id?Id.toString():""):Id=(+tc.toFixed(2)).toString();""!==Id&&ph.push({tm:ui,angle:Hd,text:Id})}else ph.push({tm:ui,angle:Hd})}tc=wn+Gd*yf}}}a.tj.push(ph)}Ia(B);var uh=a.tj;if(null!==uh)for(var zf=d.length,bb=0;bb<zf;bb++){var Eb=d[bb],Fb=uh[bb];if(Eb.visible&&Eb!==h&&0!==Fb.length){if(Eb instanceof uf){var lc=a,uc=e,Jd=Eb.alignmentFocus;Jd.wc()&&(Jd=vc);var Fe=Eb.angle;Eb.xb=0;Eb.measure(Infinity,Infinity,0,0);Eb.xb=Fe;var hg=
Eb.measuredBounds,wi=hg.width,xi=hg.height,yi=N.allocAt(0,0,wi,xi),fc=J.alloc();fc.Ui(yi,Jd);N.free(yi);for(var Xe=-fc.x,Ye=-fc.y,Qc=new N,ke=Fb.length,md=0;md<ke;md++)for(var le=Fb[md],dk=le.tm.x,Af=le.tm.y,ek=le.angle,Bf=0;4>Bf;Bf++){switch(Bf){case 0:fc.h(Xe,Ye);break;case 1:fc.h(Xe+wi,Ye);break;case 2:fc.h(Xe,Ye+xi);break;case 3:fc.h(Xe+wi,Ye+xi)}fc.rotate(ek+Eb.angle);fc.offset(dk,Af);0===md&&0===Bf?Qc.h(fc.x,fc.y,0,0):Qc.Le(fc);fc.offset(-dk,-Af);fc.rotate(-ek-Eb.angle)}J.free(fc);null!==lc.Kg&&
lc.Kg.push(Qc);$b(uc,Qc.x,Qc.y,Qc.width,Qc.height)}else if(Eb instanceof Lg){var Na=a,Kd=e;null===Na.mh&&(Na.mh=new Lg);var qb=Na.mh;Qm(qb,Eb);var vh=Eb.alignmentFocus;vh.wc()&&(vh=vc);for(var Ld=Eb.segmentOrientation,Cf=Eb.segmentOffset,nd=new N,Df=0,zi=0,me=0,ig=0,Ef=0,Ai=Fb.length,Ze=0;Ze<Ai;Ze++){var Zc=Fb[Ze];Df=Zc.tm.x;zi=Zc.tm.y;me=Zc.angle;Ef=ig=Eb.angle;Ld!==Vf&&(Ef=Ld===Rm||Ld===Sm?me+Eb.angle:me,ig=U.computeAngle(Ld,Ef));qb.xb=ig;qb.text=Zc.text||"";qb.measure(Infinity,Infinity,0,0);var od=
qb.measuredBounds,Ff=qb.naturalBounds,Gf=Ff.width,ne=Ff.height,zd=qd.alloc();zd.reset();zd.translate(-od.x,-od.y);zd.scale(qb.scale,qb.scale);zd.rotate(Ef,Gf/2,ne/2);Ld!==Km&&Ld!==Lm||zd.rotate(90,Gf/2,ne/2);Ld!==Mm&&Ld!==Nm||zd.rotate(-90,Gf/2,ne/2);Ld===Om&&(45<me&&135>me||225<me&&315>me)&&zd.rotate(-me,Gf/2,ne/2);var fk=N.allocAt(0,0,Gf,ne),Ge=J.alloc();Ge.Ui(fk,vh);zd.ya(Ge);var wh=-Ge.x,xh=-Ge.y,$c=J.alloc();$c.assign(Cf);isNaN($c.x)&&($c.x=Gf/2+3);isNaN($c.y)&&($c.y=-(ne/2+3));$c.rotate(me);
Df+=$c.x+wh;zi+=$c.y+xh;var Bi=new N(Df,zi,od.width,od.height),xn=new N(od.x,od.y,od.width,od.height),yh=new N(Ff.x,Ff.y,Ff.width,Ff.height);Zc.wA=ig;Zc.lineCount=qb.lineCount;Zc.lines=[qb.qb,qb.di,qb.oe,qb.ze,qb.zc,qb.Pb,qb.me];Zc.actualBounds=Bi;Zc.measuredBounds=xn;Zc.naturalBounds=yh;0===Ze?nd.assign(Bi):nd.Nc(Bi);J.free($c);J.free(Ge);N.free(fk);qd.free(zd)}null!==Na.Kg&&Na.Kg.push(nd);$b(Kd,nd.x,nd.y,nd.width,nd.height)}hj(Eb,!1)}}};
Pm.prototype.arrange=function(a,b,c){if(null!==a.Kg){var d=a.nb(),e=a.tj;if(null!==e){var f=a.Kg,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.Kg=null}}};
Pm.prototype.lc=function(a,b,c){var d=c.zj;c.zj=!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.nb();f.lc(b,c);e=a.wf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.T.m,k=a.tj,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 uf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,v=n.alignmentFocus;v.wc()&&
(v=vc);for(var w=0;w<r;w++){var z=p[w].tm,y=p[w].angle,A=v,B=n.tb;B.reset();B.translate(z.x+g.x,z.y+g.y);B.rotate(y+n.angle,0,0);B.translate(-q.width*A.x+A.offsetX+u/2,-q.height*A.y+A.offsetY+u/2);B.scale(n.scale,n.scale);xl(n,!1);n.Mh.set(n.tb);n.al=n.scale;yl(n,!1);n.lc(b,c);n.tb.reset()}}}else if(n instanceof Lg)for(null===a.mh&&(a.mh=new Lg),q=a.mh,Qm(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Ub=u.text||"",q.xb=u.wA||0,q.Wc=u.lineCount||0,v=u.lines,void 0!==
v&&(q.qb=v[0],q.di=v[1],q.oe=v[2],q.ze=v[3],q.zc=v[4],q.Pb=v[5],q.me=v[6]),u.naturalBounds&&(q.qc=u.naturalBounds),u.actualBounds&&(v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height)),v=u.actualBounds,q.arrange(v.x,v.y,v.width,v.height),w=u.measuredBounds,u=u.naturalBounds,z=q.tb,z.reset(),z.translate(v.x+g.x,v.y+g.y),z.translate(-w.x,-w.y),q.zp(z,u.x,u.y,u.width,u.height),xl(q,!1),q.Mh.set(q.tb),q.al=q.scale,yl(q,!1),q.lc(b,c))}c.zj=d;b.restore();b.Ec(!0)};
function X(a,b){Y.call(this);this.ia=null;if(void 0===a)this.ia=X.Position;else if("string"===typeof a){var c=Jl.H(a);null!==c&&(this.ia=c)}else a instanceof Kl?this.ia=a:a&&(this.ia=X.Position,b=a);null===this.ia&&C("Panel type not specified or PanelLayout not loaded: "+a);this.T=new E;this.mb=pc;this.ia===X.Grid&&(this.G|=1048576);this.wn=Vc;this.Kf=Uk;this.ia===X.Table&&Tm(this);this.Sp=qg;this.Vn=Mb;this.Wn=pb;this.Sn=0;this.Rn=100;this.Un=10;this.Tn=0;this.Ph=this.ib=this.Nf=this.Kg=this.tj=
null;this.oo=NaN;this.se=this.bi=null;this.pl="category";this.Xd=null;this.dg=new N(NaN,NaN,NaN,NaN);this.mh=this.pp=this.lh=null;this.Oe="";b&&Object.assign(this,b)}ma(X,Y);function Tm(a){a.oj=pc;a.Bg=1;a.Vh=null;a.Uh=null;a.Ag=1;a.zg=null;a.Th=null;a.Db=[];a.yb=[];a.Pj=Um;a.nj=Um;a.wi=0;a.fi=0}
X.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ia=this.ia;a.mb=this.mb.I();a.wn=this.wn.I();a.Kf=this.Kf;if(a.ia===X.Table){a.oj=this.oj.I();a.Bg=this.Bg;a.Vh=this.Vh;a.Uh=this.Uh;a.Ag=this.Ag;a.zg=this.zg;a.Th=this.Th;var b=[];if(0<this.Db.length)for(var c=this.Db,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Ti(a);b[e]=f}a.Db=b;b=[];if(0<this.yb.length)for(c=this.yb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Ti(a),b[e]=f);a.yb=b;a.Pj=
this.Pj;a.nj=this.nj;a.wi=this.wi;a.fi=this.fi}a.Sp=this.Sp;a.Vn=this.Vn.I();a.Wn=this.Wn.I();a.Sn=this.Sn;a.Rn=this.Rn;a.Un=this.Un;a.Tn=this.Tn;a.tj=this.tj;a.Nf=this.Nf;a.ib=this.ib;a.Ph=this.Ph;a.oo=this.oo;a.bi=this.bi;a.se=this.se;a.pl=this.pl;a.dg.assign(this.dg);a.Oe=this.Oe;null!==this.pp&&(a.pp=this.pp)};X.prototype.sf=function(a){Y.prototype.sf.call(this,a);a.T=this.T;for(var b=a.T.m,c=b.length,d=0;d<c;d++)b[d].Xf=a;a.lh=null};
X.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.Ti(a);e.Nj=null;var f=a.T,g=f.count;f.ub(g,e);f=a.part;if(null!==f){f.li=null;null!==e.portId&&f instanceof W&&(f.Ge=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.Va(ee,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+gb(this)};
t.Qo=function(a){Y.prototype.Qo.call(this,a);for(var b=this.T.m,c=b.length,d=0;d<c;d++)b[d].Qo(a)};
t.Fi=function(a,b){if(this.ia===X.Grid)a.Bd(),this.ia.lc(this,a,b);else if(this.ia===X.Graduated)a.Bd(),this.ia.lc(this,a,b);else{this.ia===X.Table&&(a.Bd(),a.lineCap="butt",Vm(this,a,!0,this.Db,!0),Vm(this,a,!1,this.yb,!0),Wm(this,a,!0,this.Db),Wm(this,a,!1,this.yb),Vm(this,a,!0,this.Db,!1),Vm(this,a,!1,this.yb,!1));var c=this.isClipping&&this.ia===X.Spot;c&&a.save();for(var d=this.nb(),e=this.T.m,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.lc(a,b);c&&h===d&&(a.clipInsteadOfFill=
!1)}c&&(a.restore(),a.Ec(!0))}};
function Wm(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.Bg:a.Ag);var n=l.separatorStroke;null===n&&(n=c?a.Vh:a.zg);if(0!==m&&null!==n){bi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Uh:a.Th);null!==p&&(n=!0,b.As(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.mb;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.ys()}}}}
function Vm(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=Xm(a,!0),l=Xm(a,!1),m=0;m<f;m++){var n=d[m];if(void 0!==n&&null!==n.background&&n.coversSeparators!==e&&0!==n.actual){var p=c?g.height:g.width;if(!(n.position>p)){var r=n.Fc(),q=n.separatorStrokeWidth;isNaN(q)&&(q=c?a.Bg:a.Ag);var u=n.separatorStroke;null===u&&(u=c?a.Vh:a.zg);if(null===u||n.index===(c?k:l))q=0;r-=q;q=n.position+q;r+=n.actual;q+r>p&&(r=p-q);0>=r||(p=a.mb,bi(a,b,n.background,!0,!1,h,g),c?b.fillRect(p.left,
q+p.top,g.width-(p.left+p.right),r):b.fillRect(q+p.left,p.top,r,g.height-(p.top+p.bottom)))}}}}function Xm(a,b){for(var c=b?a.Db.length:a.yb.length,d=0;d<c;d++){var e=b?a.Db[d]:a.yb[d];if(void 0!==e)return e.index}return 0}function Rj(a){return"LineV"===a||"BarV"===a}
t.kk=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.yf(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.yf(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.T.m;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.ia===X.Spot;u&&(q=J.alloc(),p=this.nb(),(l=p.kk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var v=0;v<r;v++){var w=n[v];w.visible&&w!==p&&w.kk(h,a,k,c,m)&&(l=!0,w=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),w<d&&(d=w,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(!mj(this)){Y.prototype.s.call(this,a);a=null;if(this.ia===X.Auto||this.ia===X.Link)a=this.nb();for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.s(!0);if(!e.desiredSize.u()){var f=hl(e,!1);(e instanceof mg||e instanceof X||e instanceof Lg||f!==og)&&e.s(!0)}}}};t.mk=function(){if(!mj(this)){hj(this,!0);il(this,!0);for(var a=this.T.m,b=a.length,c=0;c<b;c++)a[c].mk()}};
t.ll=function(){if(0!==(this.G&2048)===!1){xl(this,!0);yl(this,!0);for(var a=this.T.m,b=a.length,c=0;c<b;c++)a[c].Bv()}};t.Bv=function(){yl(this,!0);for(var a=this.T.m,b=a.length,c=0;c<b;c++)a[c].Bv()};
t.qm=function(a,b,c,d){var e=this.dg;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.mb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.T.m;0!==l.length&&this.ia.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);Tb(e,a,k);Tb(this.naturalBounds,a,k);this.ue(0,0,a,k)};t.nb=function(){if(null===this.lh){var a=this.T.m,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.lh=d}this.lh=a[0]}return this.lh};function sm(a){return null!==a.part?a.part.locationObject:null}
t.vh=function(a,b,c,d){var e=this.T.m;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.u()){a=hl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Pg,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=og);switch(a){case og:if(b>c||f>d)this.s(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case sd:this.s(!0);this.measure(c+h,d+g,0,0);break;case Vk:this.s(!0);this.measure(c+h,f+g,0,0);break;case Wk:this.s(!0),this.measure(b+h,d+g,0,0)}}this.ia.arrange(this,e,this.dg)}};
t.xh=function(a){var b=this.naturalBounds,c=sm(this);if(ac(0,0,b.width,b.height,a.x,a.y)){b=this.T.m;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Ab(e.set(a),f.transform),f.$(e))return J.free(e),!0}J.free(e);return null===this.Rb&&null===this.fd?!1:!0}return!1};t.Bs=function(a){if(this.Mk===a)return this;for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d].Bs(a);if(null!==e)return e}return null};
t.Mm=function(a,b){b(this,a);if(a instanceof X){a=a.T.m;for(var c=a.length,d=0;d<c;d++)this.Mm(a[d],b)}};function zj(a,b){Ym(a,a,b)}function Ym(a,b,c){c(b);b=b.T.m;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&Ym(a,f,c)}}function Zm(a,b){$m(a,a,b)}function $m(a,b,c){c(b);if(b instanceof X){b=b.T.m;for(var d=b.length,e=0;e<d;e++)$m(a,b[e],c)}}t.hm=function(a){return an(this,this,a)};
function an(a,b,c){if(c(b))return b;if(b instanceof X){b=b.T.m;for(var d=b.length,e=0;e<d;e++){var f=an(a,b[e],c);if(null!==f)return f}}return null}t.Ya=function(a){if(this.name===a)return this;var b=this.T.m,c=b.length;null===this.bi&&null===this.se||(c=bn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.Ya(a);if(null!==f)return f}if(e.name===a)return e}return null};
function cn(a){a=a.T.m;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,cn(e)):e instanceof uf&&(c=Math.max(c,e.cg/2*e.Uj*e.wf()))}return c}t.he=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.Wb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(nj(this))return null;var d=this.naturalBounds,e=1/this.wf(),f=this.he(),g=f?a:Ab(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.km("extraTouchArea"),l=k/2);if(ac(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.T.m;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.ia===X.Spot)?this.nb():null;if(k&&(l.he()?Ab(h.set(a),l.transform):h.set(a),!l.$(h)))return J.free(h),
f||J.free(g),null;for(var n=sm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.he()?Ab(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.Wb(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=ac(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.Ii=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:Ab(J.allocAt(a.x,a.y),this.transform);e=ac(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.T.m,k=h.length,l=J.alloc(),m=sm(this);k--;){var n=h[k];if(n.visible||n===m){n.he()?Ab(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.Ii(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.vf=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=qd.alloc(),g.reset());g.multiply(this.transform);if(this.wh(a,g))return dn(this,b,c,e),void 0===f&&qd.free(g),!0;if(this.Ic(a,g)){if(!this.isAtomic)for(var h=sm(this),k=this.T.m,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=qd.alloc();p.set(g);
if(null!==m?m.vf(a,b,c,d,e,p):gl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);qd.free(p)}}}void 0===f&&qd.free(g);return d}void 0===f&&qd.free(g);return!1};function dn(a,b,c,d){for(var e=a.T.m,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&&dn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.kg=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:Ab(J.allocAt(a.x,a.y),this.transform),l=h?b:Ab(J.allocAt(b.x,b.y),this.transform),m=k.tf(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Bb(k.x,k.y,0,0,0,g.height)<=m||Bb(k.x,k.y,0,g.height,g.width,g.height)<=m||Bb(k.x,k.y,g.width,g.height,g.width,0)<=m||Bb(k.x,k.y,g.width,0,0,0)<=m;g=k.nd(0,0)<=m&&k.nd(0,g.height)<=m&&k.nd(g.width,0)<=m&&k.nd(g.width,g.height)<=
m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=sm(this);for(var p=this.T.m,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,v=this.naturalBounds;if(!h||!(u.x>v.width||u.y>v.height||0>u.x+u.width||0>u.y+u.height))if(q.he()?(u=q.transform,Ab(k.set(a),u),Ab(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.kg(k,l,c,d,e,f):u.Ux(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 ym(a){var b=null;a instanceof uf&&(b=a.spot1,b===Vc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=sc);return b}function zm(a){var b=null;a instanceof uf&&(b=a.spot2,b===Vc&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Cc);return b}t.add=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];for(c=0;c<b.length;c++)this.ub(this.T.count,b[c]);return this};t.J=function(a){return this.T.J(a)};
t.ub=function(a,b){b instanceof V&&C("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.mg(b))this===b&&C("Cannot make a Panel contain itself: "+this.toString()),C("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&C("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.ia!==X.Grid||b instanceof uf||C("Can only add Shapes to a Grid Panel, not: "+b);this.ia!==X.Graduated||b instanceof uf||b instanceof Lg||C("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Ti(this);b.Nj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Xd&&(this.Xd=new I),this.Xd.add(d,b))}var e=this.T;d=-1;if(c===this){for(var f=-1,g=this.T.m,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.eb(f);d=f}else C("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.ub(a,b);if(0===a||b.isPanelMain)this.lh=null;mj(this)||this.s();b.s(!1);null!==b.portId?this.Ge=!0:b instanceof X&&!0===b.Ge&&(this.Ge=!0);this.Nf=null;this.Af()||en(this,b,!1);c=this.part;null!==c&&(c.li=null,c.Sf=NaN,this.Ge&&c instanceof W&&(c.Ge=!0),c.Ge&&c instanceof W&&(c.kc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.Va(fe,"elements",
this,b,null,d,null),c.Va(ee,"elements",this,null,b,null,a)))};function fn(a,b){a.G=b?a.G|16777216:a.G&-16777217}t.remove=function(a){for(var b=this.T.m,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.bc(d,!0)};t.eb=function(a){0<=a&&this.bc(a,!0)};
t.bc=function(a,b){var c=this.T,d=c.J(a);d.Nj=null;d.Ti(null);if(null!==this.Xd){var e=d.data;"object"===typeof e&&this.Xd.remove(e)}c.eb(a);hj(this,!1);this.s();this.lh===d&&(this.lh=null);this.Nf=null;var f=this.part;null!==f&&(f.li=null,f.Sf=NaN,f.Kb(),f instanceof W&&(d instanceof X?d.Mm(d,function(a,c){Ol(f,c,b)}):Ol(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.Va(fe,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){0>a&&xa(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.Db;if(void 0===b)return null;if(void 0===b[a]){var c=new Nj;c.Ti(this);c.isRow=!0;c.index=a;b[a]=c;this.Va(ee,"rowdefs",this,null,c,null,a)}return b[a]};
X.prototype.RA=function(a){0>a&&xa(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.Db;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(fe,"rowdefs",this,c,null,a,null);this.s()}}};function Oj(a,b,c){var d=a.Db;if(d&&!(0>b)){d[b]=c instanceof Nj?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&&xa(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.yb;if(void 0===b)return null;if(void 0===b[a]){var c=new Nj;c.Ti(this);c.isRow=!1;c.index=a;b[a]=c;this.Va(ee,"coldefs",this,null,c,null,a)}return b[a]};t=X.prototype;
t.MA=function(a){0>a&&xa(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.yb;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(fe,"coldefs",this,c,null,a,null);this.s()}}};function Pj(a,b,c){var d=a.yb;if(d&&!(0>b)){d[b]=c instanceof Nj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.s()}}
t.Tz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.Db,d=c.length,e=this.wi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Lz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.yb,d=c.length,e=this.fi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.jA=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.nb();c.geometry.uv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ya(b)};t.kA=function(a){if(this.type!==X.Graduated)return NaN;var b=this.nb();b.transform.Ed(a);return b.geometry.Yx(a)*this.graduatedRange+this.graduatedMin};function Fl(a){a=a.Ph;return null!==a&&a.v}
function ng(a){var b=a.Ph;if(null===b)null!==a.data&&C("Template cannot have .data be non-null: "+a),a.Ph=b=new E;else if(b.v)return;var c=new E;fn(a,!1);a.Mm(a,function(a,d){var e=d.fb;if(null!==e)for(Cl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===gn&&Cl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&fn(a,!0),g=fl(f,a,d),null!==g&&(c.add(g),null===g.Rl&&(g.Rl=new E),g.Rl.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.Db.length)for(a=d.Db,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.md=g;k.Jp=2;k.Xl=g.index;b.add(k)}if(0<d.yb.length)for(d=d.yb,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.md=f,h.Jp=1,h.Xl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Rl){Cl(e,!0);for(var f=e.Rl.iterator;f.next();){var g=f.value;null===e.fb&&(e.fb=new E);e.fb.add(g)}}e.Rl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.md,null!==f){e.md=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.Ya(g),null!==k?(f=k,e.targetProperty=h):ya('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Nj?(g=gb(f.panel),e.Yi=void 0===g?-1:g,f.panel.Mk=e.Yi):f instanceof Y?(g=gb(f),e.Yi=void 0===g?-1:g,f.Mk=e.Yi):C("Unknown type of binding target: "+f)}b.freeze();a instanceof V&&a.Jc()&&a.Sa()}
t.yz=function(a){void 0===a&&(a=!1);var b=this.copy();Zm(b,function(a){a instanceof X&&(a.Ph=null,a.ib=null);var b=a.fb;null!==b&&(a.fb=null,b.each(function(b){a.bind(b.copy())}));b=a.rg;null!==b&&(a.rg=null,b.each(function(b){a.fw(b.value.copy())}))});a&&ng(b);return b};
t.Da=function(a){var b=this.Ph;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.Ya(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.Yi;if(-1!==g){if(f=this.Bs(g),null===f)continue}else null!==
c.md&&(f=c.md);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.Jp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.Xl):2===e&&(f=f.getRowDefinition(c.Xl))}void 0!==f&&c.iw(f,d)}}};t.Tx=function(a){return void 0===a||null===a||null===this.Xd?null:this.Xd.H(a)};
function hn(a,b){a=a.T.m;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 bn(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.T.length,1);if(a.type===X.Link){a=a.T;for(var b=a.length,c=0;c<b;c++){var d=a.J(c);if(!(d instanceof uf&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.T.length&&(a=a.T.J(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.Ov=function(){for(var a=bn(this);this.T.length>a;)this.bc(this.T.length-1,!1);jn(this,this.itemArray)};
function jn(a,b){var c=bn(a);if(null===b||0===b.length)for(;a.T.length>c;)a.bc(a.T.length-1,!1);else if(a.T.length<=c){c=b.length;for(var d=0;d<c;d++)kn(a,b[d],d,!0)}else{d=c;for(var e=0;e<b.length;e++,d++){var f=b[e],g=d<a.T.length?a.T.J(d):null;if(g instanceof X){if(g.data!==f){var h=ln(a,g.data),k=ln(a,f),l=k!==h;l||(h=mn(a,h),l=mn(a,k)!==h);l?(a.bc(d,!1),kn(a,f,e,!1)):g.data=f}}else kn(a,f,e,!1)}for(;d<a.T.length;)a.bc(d,!1);a.lh=null;nn(a,c,0);mj(a)||a.s();a.Nf=null;a.Af()||en(a,a,!1);b=a.part;
null!==b&&(b.li=null,b.Sf=NaN,a.Ge&&b instanceof W&&(b.Ge=!0),b.Ge&&b instanceof W&&(b.kc=null))}}function kn(a,b,c,d){if(!(void 0===b||null===b||0>c)){var e=ln(a,b);e=mn(a,e);if(null!==e){ng(e);e=e.copy();if(0!==(e.G&16777216)){var f=a.yh();null!==f&&fn(f,!0)}"object"===typeof b&&(null===a.Xd&&(a.Xd=new I),a.Xd.add(b,e));f=c+bn(a);a.ub(f,e);d&&(e.ib=b,nn(a,f,c),e.ib=null);e.data=b}}}
function nn(a,b,c){for(a=a.T;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 ln(a,b){if(null===b)return"";a=a.pl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=on(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;C("Panel.getCategoryForItemData found a non-string category for "+b+": "+a)}
function mn(a,b){var c=a.itemTemplateMap,d=null;null!==c&&(d=c.H(b));null===d&&(null!==c&&(d=c.H("")),null===d&&(pn||(pn=!0,ya('No item template Panel found for category "'+b+'" on '+a),ya("  Using default item template."),a=new X,b=new Lg,b.bind(new ri("text","",Ka)),a.add(b),qn=a),d=qn));return d}function en(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.T.m;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||en(a,f,c)}}}
function rn(a,b){b.name=a;Jl.add(a,b)}
na.Object.defineProperties(X.prototype,{type:{get:function(){return this.ia},set:function(a){var b=this.ia;b!==a&&(this.ia=a,this.ia===X.Grid?this.isAtomic=!0:this.ia===X.Table&&Tm(this),this.s(),this.g("type",b,a))}},elements:{get:function(){return this.T.iterator}},naturalBounds:{get:function(){return this.qc}},padding:{get:function(){return this.mb},set:function(a){"number"===
typeof a?(0>a&&xa(a,">= 0",X,"padding"),a=new ic(a)):(0>a.left&&xa(a.left,">= 0",X,"padding:value.left"),0>a.right&&xa(a.right,">= 0",X,"padding:value.right"),0>a.top&&xa(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&xa(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.mb;b.A(a)||(this.mb=a=a.I(),this.s(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.wn},set:function(a){var b=this.wn;b.A(a)||(this.wn=a=a.I(),this.s(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Kf},set:function(a){var b=this.Kf;b!==a&&(this.Kf=a,this.s(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.oj?pc:this.oj},set:function(a){if(void 0!==this.oj){"number"===typeof a&&(a=new ic(a));var b=this.oj;b.A(a)||(this.oj=a=a.I(),this.s(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.Vh?null:this.Vh},set:function(a){var b=this.Vh;b!==a&&(null===a||"string"===typeof a||a instanceof ml)&&(a instanceof ml&&a.freeze(),this.Vh=a,this.N(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Bg?1:this.Bg},set:function(a){if(void 0!==this.Bg){var b=this.Bg;b!==a&&isFinite(a)&&0<=a&&(this.Bg=a,this.s(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.Uh?null:this.Uh},set:function(a){if(void 0!==this.Uh){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];"number"===typeof f&&0<=f&&isFinite(f)||C("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.Uh=a;this.N();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.zg?null:this.zg},set:function(a){if(void 0!==this.zg){var b=this.zg;b!==a&&(null===a||"string"===typeof a||a instanceof ml)&&(a instanceof ml&&a.freeze(),this.zg=a,this.N(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Ag?1:this.Ag},set:function(a){if(void 0!==this.Ag){var b=this.Ag;b!==a&&isFinite(a)&&0<=a&&(this.Ag=a,this.s(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.Th?null:this.Th},set:function(a){if(void 0!==this.Th){var b=this.Th;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)||C("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.Th=a;this.N();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.Sp},
set:function(a){var b=this.Sp;b!==a&&(this.Sp=a,this.s(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.Vn},set:function(a){var b=this.Vn;if(!b.A(a)){a.u()&&0!==a.width&&0!==a.height||C("Invalid Panel.gridCellSize: "+a);this.Vn=a.I();var c=this.diagram;null!==c&&this===c.grid&&ij(c);this.N();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Wn},set:function(a){var b=this.Wn;if(!b.A(a)){a.u()||
C("Invalid Panel.gridOrigin: "+a);this.Wn=a.I();var c=this.diagram;null!==c&&this===c.grid&&ij(c);this.N();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(this.Sn=a,this.s(),this.g("graduatedMin",b,a),dl(this)&&(a=this.part,null!==a&&el(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&(this.Rn=a,this.s(),this.g("graduatedMax",
b,a),dl(this)&&(a=this.part,null!==a&&el(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.Un},set:function(a){var b=this.Un;b!==a&&0<a&&(this.Un=a,this.s(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.Tn},set:function(a){var b=this.Tn;b!==a&&(this.Tn=a,this.s(),this.g("graduatedTickBase",
b,a))}},Ge:{get:function(){return 0!==(this.G&8388608)},set:function(a){0!==(this.G&8388608)!==a&&(this.G^=8388608)}},rowCount:{get:function(){return void 0===this.Db?0:this.Db.length}},columnCount:{get:function(){return void 0===this.yb?0:this.yb.length}},rowSizing:{get:function(){return void 0===this.Pj?Um:this.Pj},set:function(a){if(void 0!==this.Pj){var b=this.Pj;b!==a&&(this.Pj=
a,this.s(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.nj?Um:this.nj},set:function(a){if(void 0!==this.nj){var b=this.nj;b!==a&&(this.nj=a,this.s(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.wi?0:this.wi},set:function(a){if(void 0!==this.wi){var b=this.wi;b!==a&&((!isFinite(a)||0>a)&&C("Panel.topIndex must be greater than zero and a real number, not: "+a),this.wi=a,this.s(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.fi?0:this.fi},set:function(a){if(void 0!==this.fi){var b=this.fi;b!==a&&((!isFinite(a)||0>a)&&C("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.fi=a,this.s(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.ib},set:function(a){var b=this.ib;if(b!==a){var c=this instanceof V&&!(this instanceof we);ng(this);this.ib=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof U?(null!==b&&c.Qe.remove(b),null!==a&&c.Qe.add(a,this)):this instanceof V&&(null!==b&&c.Re.remove(b),null!==a&&c.Re.add(a,this))):(c=this.panel,null!==c&&null!==c.Xd&&(null!==b&&c.Xd.remove(b),null!==a&&c.Xd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Da()}}},itemIndex:{get:function(){return this.oo},set:function(a){var b=this.oo;b!==a&&(this.oo=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.bi},set:function(a){var b=this.bi;if(b!==a||null!==a&&hn(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Ej(c.partManager,this,c),this.bi=a,null!==c&&null!==a&&Bj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||jn(this,a)}}},itemTemplate:{get:function(){return null===this.se?null:this.se.H("")},set:function(a){if(null===this.se){if(null===a)return;this.se=new I}var b=this.se.H("");
b!==a&&((a instanceof V||a.isPanelMain)&&C("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.se.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.Ov())}},itemTemplateMap:{get:function(){return this.se},set:function(a){var b=this.se;if(b!==a){for(var c=a.iterator;c.next(););this.se=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.Ov()}}},itemCategoryProperty:{
get:function(){return this.pl},set:function(a){var b=this.pl;b!==a&&(this.pl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.G&1048576)},set:function(a){var b=0!==(this.G&1048576);b!==a&&(this.G^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.G&2097152)},set:function(a){var b=0!==(this.G&2097152);b!==a&&(this.G^=2097152,this instanceof hf&&(this.$a=null),this.s(),
this.g("isClipping",b,a))}},isOpposite:{get:function(){return 0!==(this.G&33554432)},set:function(a){var b=0!==(this.G&33554432);b!==a&&(this.G^=33554432,this.s(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.G&4194304)},set:function(a){var b=0!==(this.G&4194304);if(b!==a){var c=null===this.panel||this.panel.Af();this.G^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&en(this,
this,a)}}},alignmentFocusName:{get:function(){return this.Oe},set:function(a){var b=this.Oe;b!==a&&(this.Oe=a,this.s(),this.g("alignmentFocusName",b,a))}}});
na.Object.defineProperties(X,{Position:{get:function(){return Jl.H("Position")}},Horizontal:{get:function(){return Jl.H("Horizontal")}},Vertical:{get:function(){return Jl.H("Vertical")}},Spot:{get:function(){return Jl.H("Spot")}},Auto:{get:function(){return Jl.H("Auto")}},Table:{get:function(){return Jl.H("Table")}},Viewbox:{
get:function(){return Jl.H("Viewbox")}},TableRow:{get:function(){return Jl.H("TableRow")}},TableColumn:{get:function(){return Jl.H("TableColumn")}},Link:{get:function(){return Jl.H("Link")}},Grid:{get:function(){return Jl.H("Grid")}},Graduated:{get:function(){return Jl.H("Graduated")}}});X.prototype.rebuildItemElements=X.prototype.Ov;
X.prototype.findItemPanelForData=X.prototype.Tx;X.prototype.updateTargetBindings=X.prototype.Da;X.prototype.copyTemplate=X.prototype.yz;X.prototype.graduatedValueForPoint=X.prototype.kA;X.prototype.graduatedPointForValue=X.prototype.jA;X.prototype.findColumnForLocalX=X.prototype.Lz;X.prototype.findRowForLocalY=X.prototype.Tz;X.prototype.removeColumnDefinition=X.prototype.MA;X.prototype.removeRowDefinition=X.prototype.RA;X.prototype.removeAt=X.prototype.eb;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.ub;X.prototype.elt=X.prototype.J;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.Ya;X.prototype.findInVisualTree=X.prototype.hm;X.prototype.walkVisualTreeFrom=X.prototype.Mm;X.prototype.findMainElement=X.prototype.nb;var pn=!1,qn=null,Jl=new I;X.className="Panel";X.definePanelLayout=rn;rn("Position",new rm);rn("Vertical",new um);rn("Auto",new xm);rn("Link",new Im);
function Nj(){Ta(this);this.Xf=null;this.Br=!0;this.Qa=0;this.rc=NaN;this.Ij=0;this.Hj=Infinity;this.wb=Vc;this.ka=this.$b=this.ga=0;this.fb=null;this.Cp=sn;this.Be=Uk;this.xp=this.$f=null;this.yp=NaN;this.Rb=this.Tj=null;this.sn=!1}
Nj.prototype.copy=function(){var a=new Nj;a.Br=this.Br;a.Qa=this.Qa;a.rc=this.rc;a.Ij=this.Ij;a.Hj=this.Hj;a.wb=this.wb;a.ga=this.ga;a.$b=this.$b;a.ka=this.ka;a.Be=this.Be;a.Cp=this.Cp;null===this.$f?a.$f=null:a.$f=this.$f.I();a.xp=this.xp;a.yp=this.yp;a.Tj=null;null!==this.Tj&&(a.separatorDashArray=Ba(this.separatorDashArray));a.Rb=this.Rb;a.sn=this.sn;a.fb=this.fb;return a};t=Nj.prototype;t.gb=function(a){a.classType===Nj&&(this.sizing=a)};
t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+gb(this)};t.Ti=function(a){this.Xf=a};
t.cq=function(a){var b=0,c=this.Xf;this.index!==a&&(a=this.separatorStroke,null===a&&null!==c&&(a=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==a&&(b=this.separatorStrokeWidth,isNaN(b)&&(null!==c?b=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:b=0)));a=this.$f;if(null===a)if(null!==c)a=c.defaultSeparatorPadding;else return b;return b+(this.isRow?a.top:a.left)};
t.Fc=function(){var a=0,b=this.Xf,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.Db.length:b.yb.length,f=0;f<e;f++){var g=d?b.Db[f]:b.yb[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.$f;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.Cb=function(a,b,c){var d=this.Xf;if(null!==d&&(d.Va(ce,a,this,b,c,void 0,void 0),null!==this.fb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.yh(),null!==d&&(b=d.data,null!==b)))))for(c=this.fb.iterator;c.next();)c.value.Mq(this,b,a,d)};function Bm(a){if(a.sizing===sn){var b=a.Xf;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new ri(a,b,c,d):e=a;e.md=this;a=this.panel;null!==a&&(b=a.yh(),null!==b&&Fl(b)&&C("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+e+" on "+a));null===this.fb&&(this.fb=new E);this.fb.add(e);return this};
na.Object.defineProperties(Nj.prototype,{panel:{get:function(){return this.Xf}},isRow:{get:function(){return this.Br},set:function(a){this.Br=a}},index:{get:function(){return this.Qa},set:function(a){this.Qa=a}},height:{get:function(){return this.rc},set:function(a){var b=this.rc;b!==a&&(0>a&&xa(a,">= 0",Nj,"height"),this.rc=a,this.actual=this.ga,null!==this.panel&&this.panel.s(),
this.Cb("height",b,a))}},width:{get:function(){return this.rc},set:function(a){var b=this.rc;b!==a&&(0>a&&xa(a,">= 0",Nj,"width"),this.rc=a,this.actual=this.ga,null!==this.panel&&this.panel.s(),this.Cb("width",b,a))}},minimum:{get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&((0>a||!isFinite(a))&&xa(a,">= 0",Nj,"minimum"),this.Ij=a,this.actual=this.ga,null!==this.panel&&this.panel.s(),this.Cb("minimum",b,a))}},maximum:{
get:function(){return this.Hj},set:function(a){var b=this.Hj;b!==a&&(0>a&&xa(a,">= 0",Nj,"maximum"),this.Hj=a,this.actual=this.ga,null!==this.panel&&this.panel.s(),this.Cb("maximum",b,a))}},alignment:{get:function(){return this.wb},set:function(a){var b=this.wb;b.A(a)||(this.wb=a.I(),null!==this.panel&&this.panel.s(),this.Cb("alignment",b,a))}},stretch:{get:function(){return this.Be},set:function(a){var b=this.Be;b!==a&&(this.Be=
a,null!==this.panel&&this.panel.s(),this.Cb("stretch",b,a))}},separatorPadding:{get:function(){return this.$f},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.$f;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.I()),this.$f=a,null!==this.panel&&this.panel.s(),this.Cb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.xp},set:function(a){var b=this.xp;b!==a&&(null!==a&&Nl(a,"RowColumnDefinition.separatorStroke"),
a instanceof ml&&a.freeze(),this.xp=a,null!==this.panel&&this.panel.s(),this.Cb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.yp},set:function(a){var b=this.yp;b!==a&&(this.yp=a,null!==this.panel&&this.panel.s(),this.Cb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.Tj},set:function(a){var b=this.Tj;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)||C("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.Tj=a;null!==this.panel&&this.panel.N();this.Cb("separatorDashArray",b,a)}}},background:{get:function(){return this.Rb},set:function(a){var b=this.Rb;b!==a&&(null!==a&&Nl(a,"RowColumnDefinition.background"),a instanceof ml&&a.freeze(),this.Rb=a,null!==this.panel&&this.panel.N(),this.Cb("background",b,a))}},coversSeparators:{
get:function(){return this.sn},set:function(a){var b=this.sn;b!==a&&(this.sn=a,null!==this.panel&&this.panel.N(),this.Cb("coversSeparators",b,a))}},sizing:{get:function(){return this.Cp},set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,null!==this.panel&&this.panel.s(),this.Cb("sizing",b,a))}},actual:{get:function(){return this.ga},set:function(a){this.ga=isNaN(this.rc)?Math.max(Math.min(this.Hj,a),this.Ij):Math.max(Math.min(this.Hj,
this.rc),this.Ij)}},measured:{get:function(){return this.$b},set:function(a){this.$b=a}},total:{get:function(){return this.ga+this.Fc()}},position:{get:function(){return this.ka},set:function(a){this.ka=a}}});Nj.prototype.computeEffectiveSpacing=Nj.prototype.Fc;Nj.prototype.computeEffectiveSpacingTop=Nj.prototype.cq;var sn=new D(Nj,"Default",0),Cm=new D(Nj,"None",1),Um=new D(Nj,"ProportionalExtra",2);
Nj.className="RowColumnDefinition";Nj.Default=sn;Nj.None=Cm;Nj.ProportionalExtra=Um;function uf(a,b){Y.call(this);this.Ad=this.ma=null;this.Hn="None";this.Pn=Uk;this.Dc=this.cl="black";this.cg=1;this.Tl="butt";this.Ul="miter";this.Uj=10;this.ih=null;this.jh=0;this.jf=this.hf=Vc;this.Xo=this.Wo=NaN;this.eo=!1;this.Zo=null;this.dl=this.$l="None";this.Wd=1;this.Ud=0;this.Sd=1;this.Td=null;"string"===typeof a?this.figure=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(uf,Y);
uf.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ma=this.ma;a.Hn=this.Hn;a.Pn=this.Pn;a.Ad=this.Ad;a.cl=this.cl;a.Dc=this.Dc;a.cg=this.cg;a.Tl=this.Tl;a.Ul=this.Ul;a.Uj=this.Uj;null!==this.ih&&(a.ih=Ba(this.ih));a.jh=this.jh;a.hf=this.hf.I();a.jf=this.jf.I();a.Wo=this.Wo;a.Xo=this.Xo;a.eo=this.eo;a.Zo=this.Zo;a.$l=this.$l;a.dl=this.dl;a.Wd=this.Wd;a.Ud=this.Ud;a.Sd=this.Sd;a.Td=this.Td};t=uf.prototype;
t.gb=function(a){a===og||a===qg||a===Xk||a===Uk?this.geometryStretch=a:Y.prototype.gb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+gb(this)};
function tn(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,v=Fa(),w=2;w<e;w+=2)l=c[w],m=c[w+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),v.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof uf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;w=0;q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];for(var z=0;.1<=u;){0===z&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Ia(v);return}e>q?(z=e-q,e=q):z=0;var y=Math.sqrt(e*e/(1+p*p));0>n&&(y=-y);h+=y;k+=p*y;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===z&&d.Fi(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){w++;if(w===v.length){Ia(v);return}q=v[w];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Ia(v)}}
t.Fi=function(a,b){var c=this.Dc,d=this.cl;if(null!==c||null!==d){var e=this.ma;if(null!==e){a.Bd();var f=this.actualBounds,g=this.naturalBounds;null!==d&&bi(this,a,d,!0,!1,g,f);var h=this.part,k=this.cg;null===c||0!==k||null===h||!this.isPanelMain&&h.nb()!==this||(k=h.type===X.Link&&h instanceof we&&"Selection"===h.category&&h.adornedObject instanceof uf&&h.adornedPart.nb()===h.adornedObject?h.adornedObject.strokeWidth:0);0===k&&(c=null);null!==c&&0!==k&&(bi(this,a,c,!1,!1,g,f),a.lineWidth=k,a.lineJoin=
this.Ul,a.lineCap=this.Tl,a.miterLimit=this.Uj);f=!1;h&&b.Fe("drawShadows")&&(f=h.isShadowed);h=!0;null===c||null!==d&&"transparent"!==d||(h=!1);g=!1;k=this.strokeDashArray;null!==k&&(g=!0,a.As(k,this.jh));if(e.type===Q.j)a.beginPath(),a.moveTo(e.startX,e.startY),a.lineTo(e.endX,e.endY),null!==c&&a.Xi();else if(e.type===Q.C){var l=e.startX;k=e.startY;var m=e.endX,n=e.endY;e=Math.min(l,m);var p=Math.min(k,n);l=Math.abs(m-l);k=Math.abs(n-k);a.beginPath();a.rect(e,p,l,k);null!==d&&a.uf(d);if(null!==
c){h&&f&&ql(a);if(0===l||0===k)a.beginPath(),a.rect(e,p,Math.max(l,.1),Math.max(k,.1));a.Xi();h&&f&&pl(a)}}else if(e.type===Q.M)l=e.startX,k=e.startY,m=e.endX,n=e.endY,e=Math.abs(m-l)/2,p=Math.abs(n-k)/2,l=Math.min(l,m)+e,k=Math.min(k,n)+p,a.beginPath(),a.moveTo(l,k-p),a.bezierCurveTo(l+L.qg*e,k-p,l+e,k-L.qg*p,l+e,k),a.bezierCurveTo(l+e,k+L.qg*p,l+L.qg*e,k+p,l,k+p),a.bezierCurveTo(l-L.qg*e,k+p,l-e,k+L.qg*p,l-e,k),a.bezierCurveTo(l-e,k-L.qg*p,l-L.qg*e,k-p,l,k-p),a.closePath(),null!==d&&a.uf(d),null!==
c&&(h&&f?(ql(a),a.Xi(),pl(a)):a.Xi());else if(e.type===Q.o)for(e=e.figures,k=e.length,p=0;p<k;p++){l=e.m[p];a.beginPath();a.moveTo(l.startX,l.startY);m=l.segments.m;n=m.length;for(var r=null,q=0;q<n;q++){var u=m[q];switch(u.type){case Fd:a.moveTo(u.endX,u.endY);break;case ud:a.lineTo(u.endX,u.endY);break;case Md:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case Nd:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case Od:if(u.radiusX===u.radiusY){var v=Math.PI/
180;a.arc(u.point1X,u.point1Y,u.radiusX,u.startAngle*v,(u.startAngle+u.sweepAngle)*v,0>u.sweepAngle,null!==r?r.endX:l.startX,null!==r?r.endY:l.startY)}else if(r=Qd(u,l),v=r.length,0===v)a.lineTo(u.centerX,u.centerY);else for(var w=0;w<v;w++){var z=r[w];0===w&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7])}break;case Pd:w=v=0;if(null!==r&&r.type===Od){r=Qd(r,l);z=r.length;if(0===z){a.lineTo(u.endX,u.endY);break}r=r[z-1]||null;null!==r&&(v=r[6],w=r[7])}else v=null!==r?r.endX:l.startX,
w=null!==r?r.endY:l.startY;r=Rd(u,l,v,w);v=r.length;if(0===v){a.lineTo(u.endX,u.endY);break}for(w=0;w<v;w++)z=r[w],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:C("Segment not of valid type: "+u.type)}u.isClosed&&a.closePath();r=u}m=l.isFilled;f?l.isShadowed?(!0===m&&"transparent"!==d&&null!==d&&a.uf(d),null!==c&&(m&&h&&ql(a),a.Xi(),m&&h&&pl(a))):(ql(a),m&&"transparent"!==d&&null!==d&&a.uf(d),null!==c&&a.Xi(),pl(a)):(m&&null!==d&&a.uf(d),null!==c&&a.Xi())}g&&a.ys();if(null!==this.pathPattern){c=
this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);f=this.geometry;a.save();a.beginPath();d=Fa();if(f.type===Q.j)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.endY),tn(a,b,d,c);else if(f.type===Q.o)for(f=f.figures.iterator;f.next();){h=f.value;d.length=0;d.push(h.startX);d.push(h.startY);g=h.startX;e=h.startY;k=g;p=e;l=h.segments.m;m=l.length;for(n=0;n<m;n++){q=l[n];switch(q.type){case Fd:tn(a,b,d,c);d.length=0;d.push(q.endX);d.push(q.endY);
g=q.endX;e=q.endY;k=g;p=e;break;case ud:d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break;case Md:L.Ce(g,e,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Nd:L.xq(g,e,q.point1X,q.point1Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Od:u=Qd(q,h);r=u.length;if(0===r){d.push(q.centerX);d.push(q.centerY);g=q.centerX;e=q.centerY;break}for(v=0;v<r;v++)w=u[v],L.Ce(g,e,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],e=w[7];break;case Pd:u=Rd(q,h,g,e);r=u.length;
if(0===r){d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break}for(v=0;v<r;v++)w=u[v],L.Ce(g,e,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],e=w[7];break;default:C("Segment not of valid type: "+q.type)}q.isClosed&&(d.push(k),d.push(p),tn(a,b,d,c))}tn(a,b,d,c)}else if(f.type===Q.C)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.startY),d.push(f.endX),d.push(f.endY),d.push(f.startX),d.push(f.endY),d.push(f.startX),d.push(f.startY),tn(a,b,d,c);else if(f.type===Q.M){e=new Wd;e.startX=f.endX;e.startY=
(f.startY+f.endY)/2;g=new Xd(Od);g.startAngle=0;g.sweepAngle=360;g.centerX=(f.startX+f.endX)/2;g.centerY=(f.startY+f.endY)/2;g.radiusX=Math.abs(f.startX-f.endX)/2;g.radiusY=Math.abs(f.startY-f.endY)/2;e.add(g);f=Qd(g,e);h=f.length;if(0===h)d.push(g.centerX),d.push(g.centerY);else for(g=e.startX,e=e.startY,k=0;k<h;k++)p=f[k],L.Ce(g,e,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),g=p[6],e=p[7];tn(a,b,d,c)}Ia(d);a.restore();a.Ec(!1)}}}};
t.da=function(a,b){void 0===b&&(b=new J);if(a instanceof P){a.wc()&&C("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.de.ya(b);return b};
t.Mi=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.de;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Gc(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);$b(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);$b(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);$b(a,d.x,d.y,0,0);N.free(b);J.free(d);return a};
t.xh=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!==Q.j||b||(e+=2);var f=N.alloc();f.assign(d);f.Gc(e+2,e+2);if(!f.$(a))return N.free(f),!1;d=e+1E-4;if(c.type===Q.j){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.Mb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
Q.C){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.Gc(-d,-d);if(f.$(a))return N.free(f),!1;f.Gc(d,d)}null!==this.stroke&&f.Gc(e,e);a=f.$(a);N.free(f);return a}if(c.type===Q.M){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===Q.o)return N.free(f),null===this.fill?Ud(c,a.x,a.y,e):Sd(c,a,e,1<this.strokeWidth,b);C("Unknown Geometry type: "+c.type)};
t.qm=function(a,b,c,d){var e=this.desiredSize,f=this.cg;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Ad)var g=this.geometry.bounds;else{var h=this.figure,k=un[h];if(void 0===k){var l=L.Ne[h];"string"===typeof l&&(l=L.Ne[l]);"function"===typeof l?(k=l(null,100,100),un[h]=k):C("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(hl(this,!0)){case og:d=c=0;break;case sd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Vk:l=Math.max(a-f,0);d=0;break;case Wk: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=pg(this);switch(c){case og:break;case sd:h=l;k=m;break;case qg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:C(c+" is not a valid geometryStretch.")}null!==this.Ad?(0===h&&(h=.001),0===k&&(k=.001),
c=null!==this.Ad?this.Ad:this.ma,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),this.ma=1===d&&1===e?c:c.copy().scale(d,e)):null!==this.ma&&L.aa(this.ma.kl,a-f)&&L.aa(this.ma.jl,b-f)||(this.ma=uf.makeGeometry(this,h,k));g=this.ma.bounds;Infinity===a||Infinity===b?this.ue(g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):this.ue(-(f/2),-(f/2),l+f,m+f)};
function pg(a){var b=a.geometryStretch;return null!==a.Ad?b===Uk?sd:b:b===Uk?un[a.figure].defaultStretch:b}t.vh=function(a,b,c,d){jl(this,a,b,c,d)};t.Is=function(a,b,c){return this.kk(a.x,a.y,b.x,b.y,c)};
t.kk=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.cg/2;l=this.ma;null===l&&(this.measure(Infinity,Infinity),l=this.ma);var r=l.bounds;m=!1;if(l.type===Q.j)if(1.5>=this.strokeWidth)m=L.Ie(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=Fa();a=new J;L.Ie(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;L.Ie(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;L.Ie(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;L.Ie(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===Q.C)m=L.yf(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===Q.M){b=N.allocAt(r.x,r.y,r.width,r.height).Gc(n,n);a:if(0===b.width)m=L.Ie(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=L.Ie(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===Q.o){p=J.alloc();var q=h-f;var u=k-g,v=q*q+u*u,w=f,z=g;if(0<v&&r.contains(w,z)&&(p.x=w,p.y=z,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),w-=q,z-=
u;r.contains(w,z);)w-=q,z-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var y=l.figures.m[u],A=y.isFilled?w:f,B=y.isFilled?z:g,F=y.segments;r=y.startX;q=y.startY;for(var K=r,S=q,R=0;R<F.count;R++){var O=F.m[R],H=O.type;var da=O.endX;var ba=O.endY;var ra=!1;switch(H){case Fd:K=da;S=ba;break;case ud:ra=vn(r,q,da,ba,A,B,h,k,p);break;case Md:ra=L.Zp(r,q,O.point1X,O.point1Y,O.point2X,O.point2Y,da,ba,A,B,h,k,.6,p);break;case Nd:ra=L.Zp(r,q,r+2/3*(O.point1X-r),q+2/3*(O.point1Y-q),da+2/3*(O.point1X-da),ba+
2/3*(O.point1Y-ba),da,ba,A,B,h,k,.6,p);break;case Od:case Pd:H=O.type===Od?Qd(O,y):Rd(O,y,r,q);var Ca=H.length;if(0===Ca){ra=vn(r,q,O.type===Od?O.centerX:O.endX,O.type===Od?O.centerY:O.endY,A,B,h,k,p);break}ba=null;for(da=0;da<Ca;da++){ba=H[da];if(0===da&&vn(r,q,ba[0],ba[1],A,B,h,k,p)){var cb=Cn(A,B,p,v,e);cb<v&&(v=cb,m=!0)}L.Zp(ba[0],ba[1],ba[2],ba[3],ba[4],ba[5],ba[6],ba[7],A,B,h,k,.6,p)&&(cb=Cn(A,B,p,v,e),cb<v&&(v=cb,m=!0))}da=ba[6];ba=ba[7];break;default:C("Unknown Segment type: "+H)}r=da;q=ba;
ra&&(ra=Cn(A,B,p,v,e),ra<v&&(v=ra,m=!0));O.isClosed&&(da=K,ba=S,vn(r,q,da,ba,A,B,h,k,p)&&(O=Cn(A,B,p,v,e),O<v&&(v=O,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 C("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ya(e);return!0};function Cn(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 vn(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.wh=function(a,b){if(void 0===b)return a.De(this.actualBounds);var c=this.ma;null===c&&(this.measure(Infinity,Infinity),c=this.ma);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.$(b.ya(f))&&(f.h(c.x-d,c.bottom+d),a.$(b.ya(f))&&(f.h(c.right+d,c.bottom+d),a.$(b.ya(f))&&(f.h(c.right+d,c.y-d),a.$(b.ya(f))&&(e=!0))));J.free(f);return e};
t.Ic=function(a,b){if(this.wh(a,b)||void 0===b&&(b=this.transform,a.De(this.actualBounds)))return!0;var c=qd.alloc();c.set(b);c.Ns();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.ya(g);if(this.xh(g,!0))return J.free(g),!0;g.h(e,f);c.ya(g);if(this.xh(g,!0))return J.free(g),!0;g.h(d,a);c.ya(g);if(this.xh(g,!0))return J.free(g),!0;g.h(e,a);c.ya(g);if(this.xh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.Hv(this.transform);c.Ns();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Dn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Dn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Dn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Dn(this,g,h,k)&&(b=!0))));J.free(g);qd.free(c);J.free(h);J.free(k);return b};function Dn(a,b,c,d){if(!a.Is(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.Ux=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.nd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.xh(a,!0))return!0;var e=a.tf(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ma;if(null===b&&(this.measure(Infinity,Infinity),b=this.ma,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(Cb(a.x,a.y,h,k)<=e&&Cb(a.x,a.y,l,k)<=e&&Cb(a.x,a.y,h,g)<=e&&Cb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===Q.j){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),Bb(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===Q.C)return b=!1,c&&(b=Bb(a.x,a.y,h,k,h,g)<=e||Bb(a.x,a.y,h,k,l,k)<=e||Bb(a.x,a.y,l,k,l,g)<=e||Bb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Q.M){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 Bb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=L.Ez(m,n,b,f),a*a<=e)return!0}else return Cb(b,f,-m,0)>=e||Cb(b,f,0,-n)>=e||Cb(b,
f,0,n)>=e||Cb(b,f,m,0)>=e?!1:!0}else if(b.type===Q.o){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&&Bb(a.x,a.y,f,h,f,l)>e&&Bb(a.x,a.y,f,h,k,h)>e&&Bb(a.x,a.y,k,l,f,l)>e&&Bb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Ud(b,a.x,a.y,f):Sd(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.m[b];g=f.startX;m=f.startY;if(a.nd(g,m)>e)return!1;h=f.segments.m;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Fd:case ud:g=n.endX;
m=n.endY;if(a.nd(g,m)>e)return!1;break;case Md:var p=Fa();L.Ce(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.nd(g,m)>e)return!1;break;case Nd:p=Fa();L.xq(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.nd(g,m)>e)return!1;break;case Od:case Pd:p=n.type===Od?Qd(n,f):Rd(n,f,g,m);var r=p.length;if(0===r){g=n.type===Od?n.centerX:n.endX;m=n.type===Od?n.centerY:n.endY;if(a.nd(g,m)>e)return!1;
break}n=null;for(var q=Fa(),u=0;u<r;u++)if(n=p[u],q.length=0,L.Ce(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:C("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.cc=function(){this.ma=null};t.Ow=function(){return this.cg};
function En(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=Rm,"None"!==a.$l?(a.segmentIndex=-1,a.alignmentFocus=ed):"None"!==a.dl&&(a.segmentIndex=0,a.alignmentFocus=new P(1-ed.x,ed.y)))}
uf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Fn[a.toArrow];else"None"!==a.fromArrow?d=Fn[a.fromArrow]:(d=L.Ne[a.figure],"string"===typeof d&&(d=L.Ne[d]),void 0===d&&C("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.kl=b,d.jl=c);if(null===d){var e=L.Ne.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function Gn(a){var b=Fn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Fn[c];if(void 0===b){var d=null,e;for(e in L.Qm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Q.parse(L.Qm[d],!1),Fn[d]=a,c!==d&&(Fn[c]=d),d}}return"string"===typeof b?b:b instanceof Q?a:null}
na.Object.defineProperties(uf.prototype,{geometry:{get:function(){return null!==this.ma?this.ma:this.Ad},set:function(a){var b=this.ma,c=this.Ad;if(b!==a){null!==a?this.Ad=this.ma=a.freeze():this.Ad=this.ma=null;var d=this.part;null!==d&&(d.Sf=NaN);this.s();this.g("geometry",b||c,a);dl(this)&&(a=this.part,null!==a&&el(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
Q.parse(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.eo},set:function(a){var b=this.eo;b!==a&&(this.eo=a,this.s(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.cl},set:function(a){var b=this.cl;b!==a&&(null!==a&&Nl(a,"Shape.fill"),a instanceof ml&&a.freeze(),this.cl=a,this.N(),this.g("fill",b,a))}},stroke:{
get:function(){return this.Dc},set:function(a){var b=this.Dc;b!==a&&(null!==a&&Nl(a,"Shape.stroke"),a instanceof ml&&a.freeze(),this.Dc=a,this.N(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.cg},set:function(a){var b=this.cg;if(b!==a)if(0<=a){this.cg=a;this.s();var c=this.part;null!==c&&(c.Sf=NaN);this.g("strokeWidth",b,a)}else xa(a,"value >= 0",uf,"strokeWidth:value")}},strokeCap:{get:function(){return this.Tl},
set:function(a){var b=this.Tl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?xa(a,'"butt", "round", or "square"',uf,"strokeCap"):(this.Tl=a,this.N(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Ul},set:function(a){var b=this.Ul;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?xa(a,'"miter", "bevel", or "round"',uf,"strokeJoin"):(this.Ul=a,this.N(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{
get:function(){return this.Uj},set:function(a){var b=this.Uj;if(b!==a&&1<=a){this.Uj=a;this.N();var c=this.part;null!==c&&(c.Sf=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.ih},set:function(a){var b=this.ih;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)||C("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.ih=
a;this.N();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{get:function(){return this.jh},set:function(a){var b=this.jh;b!==a&&0<=a&&(this.jh=a,this.N(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Hn},set:function(a){var b=this.Hn;if(b!==a){var c=L.Ne[a];"function"===typeof c?c=a:(c=L.Ne[a.toLowerCase()])||C("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.Sf=NaN),this.Hn=c,this.Ad=null,this.cc(),this.s(),
this.g("figure",b,c))}}},toArrow:{get:function(){return this.$l},set:function(a){var b=this.$l;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Gn(a);null===c?C("Unknown Shape.toArrow: "+a):b!==c&&(this.$l=c,this.Ad=null,this.cc(),this.s(),En(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.dl},set:function(a){var b=this.dl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=Gn(a);null===c?C("Unknown Shape.fromArrow: "+
a):b!==c&&(this.dl=c,this.Ad=null,this.cc(),this.s(),En(this),this.g("fromArrow",b,c))}}},spot1:{get:function(){return this.hf},set:function(a){var b=this.hf;b.A(a)||(this.hf=a=a.I(),this.s(),this.g("spot1",b,a))}},spot2:{get:function(){return this.jf},set:function(a){var b=this.jf;b.A(a)||(this.jf=a=a.I(),this.s(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Wo},set:function(a){var b=this.Wo;
b!==a&&(this.Wo=a,this.cc(),this.s(),this.g("parameter1",b,a))}},parameter2:{get:function(){return this.Xo},set:function(a){var b=this.Xo;b!==a&&(this.Xo=a,this.cc(),this.s(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){var a=this.desiredSize;return a.u()||null===this.ma?new N(0,0,a.width,a.height):(this.qc.assign(this.ma.bounds),this.qc)}},pathPattern:{get:function(){return this.Zo},set:function(a){var b=
this.Zo;b!==a&&(this.Zo=a,this.N(),this.g("pathPattern",b,a))}},geometryStretch:{get:function(){return this.Pn},set:function(a){var b=this.Pn;b!==a&&(this.Pn=a,this.s(),this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Wd},set:function(a){var b=this.Wd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Wd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&ij(c);this.s();c=this.panel;null!==c&&(c.Nf=null);this.g("interval",
b,a)}}},graduatedStart:{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("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Sd},set:function(a){var b=this.Sd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Sd=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(this.Td=a,this.s(),
this.g("graduatedSkip",b,a))}}});uf.prototype.intersectsRect=uf.prototype.Ic;uf.prototype.containedInRect=uf.prototype.wh;uf.prototype.getNearestIntersectionPoint=uf.prototype.Is;uf.prototype.getDocumentBounds=uf.prototype.Mi;uf.prototype.getDocumentPoint=uf.prototype.da;var Fn=new Wa,un=new Wa;uf.className="Shape";uf.getFigureGenerators=function(){var a=new I,b;for(b in L.Ne)b!==b.toLowerCase()&&a.add(b,L.Ne[b]);a.freeze();return a};
uf.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=L.Ne;d[a]=b;d[c]=a};uf.getArrowheadGeometries=function(){var a=new I;for(d in L.Qm)if(void 0===Fn[d]){var b=Q.parse(L.Qm[d],!1);Fn[d]=b;b=d.toLowerCase();b!==d&&(Fn[b]=d)}for(var c in Fn)if(c!==c.toLowerCase()){var d=Fn[c];d instanceof Q&&a.add(c,d)}a.freeze();return a};
uf.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=Q.parse(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||C("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Fn;d[a]=c;d[b]=a};
function Lg(a,b){Y.call(this);Hn||(In=Jg?(new Ak(null)).context:null,Hn=!0);this.Ub="";this.Dc="black";this.ne="13px sans-serif";this.ui="start";this.Rd=og;this.Bi=ad;this.Aj=!0;this.$h=this.ai=!1;this.Vf=Jn;this.gg=Kn;this.Ir=this.qb=this.Wc=0;this.ku=this.lu=null;this.En=!1;this.kd=this.gn=this.Kp=this.vi=this.Lp=null;this.gf=this.ff=0;this.Xh=Ln;this.te=Infinity;this.di=0;this.oe=null;this.ze=0;this.me=this.Pb=this.zc=null;this.Wd=1;this.Ud=0;this.Sd=1;this.Td=this.sj=null;"string"===typeof a?
this.text=a:a&&Object.assign(this,a);b&&Object.assign(this,b);return this}ma(Lg,Y);
Lg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Ub=this.Ub;a.Dc=this.Dc;a.ne=this.ne;a.ui=this.ui;a.Rd=this.Rd;a.Bi=this.Bi;a.Aj=this.Aj;a.ai=this.ai;a.$h=this.$h;a.Vf=this.Vf;a.gg=this.gg;a.Wc=this.Wc;a.Ir=this.Ir;a.qb=this.qb;a.lu=this.lu;a.ku=this.ku;a.En=this.En;a.Lp=this.Lp;a.vi=this.vi;a.Kp=this.Kp;a.gn=this.gn;a.kd=this.kd;a.ff=this.ff;a.gf=this.gf;a.Xh=this.Xh;a.te=this.te;a.oe=this.oe;a.ze=this.ze;a.zc=this.zc;a.Pb=this.Pb;a.me=this.me;a.di=this.di;a.Wd=
this.Wd;a.Ud=this.Ud;a.Sd=this.Sd;a.sj=this.sj;a.Td=this.Td};
function Qm(a,b){a.G=b.G|6144;a.lb=b.opacity;a.Rb=b.background;a.fd=b.areaBackground;a.Sc=b.desiredSize.I();a.Uf=b.minSize.I();a.Tf=b.maxSize.I();null!==b.Ab?a.Ab=b.Ab.copy():a.Ab=null;a.sa=b.scale;a.xb=b.angle;a.Be=b.stretch;a.Pg=b.margin.I();a.wb=b.alignment.I();a.Gk=b.alignmentFocus.I();a.Jl=b.segmentFraction;a.Kl=b.segmentOffset.I();a.Ll=b.segmentOrientation;null!==b.$a&&(a.$a=b.$a.copy());a.Nl=b.shadowVisible;b instanceof Lg&&(a.Ub=b.Ub,a.Dc=b.Dc,a.ne=b.ne,a.ui=b.ui,a.Rd=b.Rd,a.Bi=b.Bi,a.Aj=
b.Aj,a.ai=b.ai,a.$h=b.$h,a.Vf=b.Vf,a.gg=b.gg,a.oe=null,a.ff=b.ff,a.gf=b.gf,a.te=b.te,a.di=b.di,a.Wd=b.Wd,a.Ud=b.Ud,a.Sd=b.Sd,a.sj=b.sj,a.Td=b.Td)}t=Lg.prototype;t.gb=function(a){a.classType===Lg?this.wrap=a:Y.prototype.gb.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.ku=this.lu=null};
t.Fi=function(a,b){if(null!==this.Dc&&0!==this.Ub.length&&null!==this.ne){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=Mn(this),h=a.textAlign=this.ui,k=b.io;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.ai;var l=this.$h;bi(this,a,this.Dc,!0,!1,c,d);(k||l)&&bi(this,a,this.Dc,!1,!1,c,d);d=0;c=!1;var m=this.de,n=m.dx-(g*m.m21+m.dx);m=m.dy-(g*m.m22+m.dy);var p=b.scale;8>(n*n+m*m)*p*p&&(c=!0);b.Sb!==a&&(c=!1);!1===b.Fe("textGreeking")&&(c=!1);b=this.ff;n=
this.gf;switch(this.flip){case Zk:a.translate(e,0);a.scale(-1,1);break;case Yk:a.translate(0,f);a.scale(1,-1);break;case $k:a.translate(e,f),a.scale(-1,-1)}a.Bd();m=this.Wc;p=(b+g+n)*m;f>p&&(d=this.Bi,d=d.y*f-d.y*p+d.offsetY);if(1===m&&null!==this.me)n=this.qb,n>e&&(n=e),this.Ei(this.me,a,0,d+b,e,g,n,c,h,k,l);else if(null!==this.zc&&null!==this.Pb)for(p=0;p<m;p++){var r=this.zc[p];r>e&&(r=e);d+=b;this.Ei(this.Pb[p],a,0,d,e,g,r,c,h,k,l);d+=g+n}switch(this.flip){case Zk:a.scale(-1,1);a.translate(-e,
0);break;case Yk:a.scale(1,-1);a.translate(0,-f);break;case $k:a.scale(-1,-1),a.translate(-e,-f)}}};
t.Ei=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!==Nn?Nn(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!==On?On(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.qm=function(a,b,c,d){this.di=a;var e=this.ne;null!==In&&Pn!==e&&(Pn=In.font=e);this.qb=this.ze=0;this.me=this.Pb=this.zc=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.Xh===Ln&&(g=g.trim());f=Math.max(f,Qn(g));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=Qn(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=Rn(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==this.qb&&null!==this.zc&&null!==this.Pb&&this.Vf===Sn&&(b=this.ne,b=this.Vf===Sn?Tn(b):0,k=this.ff+this.gf,k=Math.max(0,Mn(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=this.Pb.length))){k=this.Pb[h];for(b=Math.max(1,a-b);Qn(k)>b&&1<k.length;)k=k.substr(0,
k.length-1);k+=Un;b=Qn(k);this.Pb[h]=k;this.Pb=this.Pb.slice(0,h+1);this.zc[h]=b;this.zc=this.zc.slice(0,h+1);this.ze=this.Pb.length;this.qb=Math.max(this.qb,b);this.Wc=this.ze;1===this.Wc&&(this.me=this.Pb[0])}if(this.wrap===Vn||isNaN(this.desiredSize.width))e=isNaN(a)?this.qb:Math.min(a,this.qb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);Tb(this.qc,e,f);this.ue(0,0,e,f)};t.vh=function(a,b,c,d){jl(this,a,b,c,d)};
function Wn(a,b,c){if(null===a.me)a.me=b,a.qb=c;else{if(null===a.Pb||null===a.zc)a.Pb=[],a.zc=[],a.Pb.push(a.me),a.zc.push(a.qb);a.Pb.push(b);a.zc.push(c)}}
function Xn(a,b,c,d){var e=a.Xh===Ln;e&&(b=b.trim());var f=0,g=a.ne,h=a.ff+a.gf;h=Math.max(0,Mn(a)+h);var k=a.Vf===Sn?Tn(g):0;if(a.Wc>=a.te)null!==d&&d.h(0,h);else if(g=b,a.gg===Yn){a.ze=1;var l=Qn(b);if(0===k||l<=c)a.qb=Math.max(a.qb,l),Wn(a,b,a.qb),null!==d&&d.h(l,h);else{f=Zn(a,g);g=g.substr(f.length);b=Zn(a,g);for(l=Qn(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=Zn(a,g),l=f+b,e&&(l=l.trim()),l=Qn(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);Qn(f)>c&&1<f.length;)f=f.substr(0,f.length-1);
f+=Un;var m=Qn(f);a.qb=m;Wn(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,Wn(a,g,0));for(;0<g.length;){b=Zn(a,g);for(g=g.substr(b.length);Qn(b)>c;){var n=1;l=Qn(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=Qn(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);Wn(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.Wc+k>a.te)break}m=Zn(a,g);for(l=Qn(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=Zn(a,g),l=b+m,e&&(l=l.trim()),l=Qn(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=Qn(b),f=Math.max(f,m)),Wn(a,b,n),k++,a.Wc+k>a.te))break}a.ze=Math.min(a.te,k);a.qb=Math.max(a.qb,f);null!==d&&d.h(a.qb,h*a.ze)}}function Zn(a,b){if(a.gg===$n)return b.substr(0,1);for(var c=b.length,d=0,e=ao;d<c&&!e.test(b.charAt(d));)d++;for(a.Xh===bo&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function Qn(a){return null===In?8*a.length:In.measureText(a).width}
function Mn(a){if(null!==a.oe)return a.oe;var b=a.ne;if(null===In){var c=16;return a.oe=c}void 0!==co[b]&&5E3>eo?c=co[b]:(c=1.3*In.measureText("M").width,co[b]=c,eo++);return a.oe=c}function Tn(a){if(null===In)return 6;if(void 0!==fo[a]&&5E3>go)var b=fo[a];else b=In.measureText(Un).width,fo[a]=b,go++;return b}
function Rn(a,b){var c=a.Ub.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.ff+a.gf;d=Math.max(0,Mn(a)+d);if(0===c.length)return a.qb=0,a.Wc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Wc=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.gg!==Yn){a.ze=0;var k=M.alloc();Xn(a,f,b,k);e+=k.height;M.free(k);a.Wc+=a.ze}else Xn(a,f,b,null),e+=d,a.Wc++;a.Wc===a.te&&(h=!0)}f=g+1}return a.Ir=e}
na.Object.defineProperties(Lg.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.ui},set:function(a){var b=this.ui;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.ui=a,this.N(),this.g("textAlign",b,a))}},flip:{get:function(){return this.Rd},set:function(a){var b=this.Rd;b!==a&&(this.Rd=a,this.N(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.Bi},set:function(a){var b=this.Bi;b.A(a)||(this.Bi=a=a.I(),zl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.qc.u()){var a=
M.alloc();Xn(this,this.Ub,999999,a);var b=a.width;M.free(a);a=Rn(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);Tb(this.qc,b,a)}return this.qc}},isMultiline:{get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(this.Aj=a,this.s(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.ai},set:function(a){var b=this.ai;b!==a&&(this.ai=a,this.N(),this.g("isUnderline",b,
a))}},isStrikethrough:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.N(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.gg},set:function(a){var b=this.gg;b!==a&&(this.gg=a,this.s(),this.g("wrap",b,a))}},overflow:{get:function(){return this.Vf},set:function(a){var b=this.Vf;b!==a&&(this.Vf=a,this.s(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Dc},set:function(a){var b=this.Dc;b!==a&&(null!==a&&Nl(a,"TextBlock.stroke"),a instanceof ml&&a.freeze(),this.Dc=a,this.N(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.Wc}},lineHeight:{get:function(){return Mn(this)}},editable:{get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(this.En=a,this.g("editable",b,a))}},textEditor:{
get:function(){return this.Lp},set:function(a){var b=this.Lp;b!==a&&(this.Lp=a,this.g("textEditor",b,a))}},errorFunction:{get:function(){return this.kd},set:function(a){var b=this.kd;b!==a&&(this.kd=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Wd},set:function(a){var b=this.Wd;a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Wd=a;this.s();var c=this.panel;null!==c&&(c.Nf=null);this.g("interval",b,a)}}},graduatedStart:{
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("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Sd},set:function(a){var b=this.Sd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Sd=a,this.s(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.sj},set:function(a){var b=this.sj;b!==a&&(this.sj=a,this.s(),this.g("graduatedFunction",b,a))}},
graduatedSkip:{get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(this.Td=a,this.s(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.vi},set:function(a){var b=this.vi;b!==a&&(this.vi=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.Kp},set:function(a){var b=this.Kp;b!==a&&(this.Kp=a,this.g("textEdited",b,a))}},spacingAbove:{
get:function(){return this.ff},set:function(a){var b=this.ff;b!==a&&(this.ff=a,this.s(),this.g("spacingAbove",b,a))}},spacingBelow:{get:function(){return this.gf},set:function(a){var b=this.gf;b!==a&&(this.gf=a,this.s(),this.g("spacingBelow",b,a))}},formatting:{get:function(){return this.Xh},set:function(a){var b=this.Xh;b!==a&&(this.Xh=a,this.s(),this.g("formatting",b,a))}},maxLines:{get:function(){return this.te},
set:function(a){var b=this.te;b!==a&&(a=Math.floor(a),0>=a&&xa(a,"> 0",Lg,"maxLines"),this.te=a,this.s(),this.g("maxLines",b,a))}},metrics:{get:function(){return{arrSize:null!==this.zc?this.zc:[this.qb],arrText:null!==this.Pb?this.Pb:[this.me],maxLineWidth:this.qb,fontHeight:this.oe}}},choices:{get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(this.gn=a,this.g("choices",b,a))}}});
var Nn=null,On=null,Yn=new D(Lg,"None",0),Vn=new D(Lg,"WrapFit",1),Kn=new D(Lg,"WrapDesiredSize",2),$n=new D(Lg,"WrapBreakAll",3),Jn=new D(Lg,"OverflowClip",0),Sn=new D(Lg,"OverflowEllipsis",1),Ln=new D(Lg,"FormatTrim",0),bo=new D(Lg,"FormatNone",0),ao=/[ \u200b\u00ad]/,co=new Wa,eo=0,fo=new Wa,go=0,Un="...",Pn="",In=null,Hn=!1;Lg.className="TextBlock";Lg.getEllipsis=function(){return Un};Lg.setEllipsis=function(a){Un=a;fo=new Wa;go=0};Lg.getBaseline=function(){return Nn};
Lg.setBaseline=function(a){Nn=a};Lg.getUnderline=function(){return On};Lg.setUnderline=function(a){On=a};Lg.isValidFont=function(a){Hn||(In=Jg?(new Ak(null)).context:null,Hn=!0);if(null===In)return!0;var b=In.font;if(a===b||"10px sans-serif"===a)return!0;In.font="10px sans-serif";In.font=a;var c=In.font;if("10px sans-serif"!==c)return In.font=b,!0;In.font="19px serif";var d=In.font;In.font=a;c=In.font;In.font=b;return c!==d};Lg.FormatNone=bo;Lg.FormatTrim=Ln;Lg.None=Yn;Lg.OverflowClip=Jn;
Lg.OverflowEllipsis=Sn;Lg.WrapBreakAll=$n;Lg.WrapDesiredSize=Kn;Lg.WrapFit=Vn;function Vj(a,b){Y.call(this);this.Gg=null;this.Ep="";this.hh=hc;this.fl=sd;this.kh=this.kd=null;this.el=yc;this.Rd=og;this.Wl=null;this.co=!1;this.Kn=!0;this.ul=!1;this.Pl=null;"string"===typeof a?this.source=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}var ho;ma(Vj,Y);
Vj.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Gg;a.Ep=this.Ep;a.hh=this.hh.I();a.fl=this.fl;a.Rd=this.Rd;a.kd=this.kd;a.kh=this.kh;a.el=this.el.I();a.Kn=this.Kn;a.Pl=this.Pl};Vj.prototype.gb=function(a){a===og||a===qg||a===Xk?this.imageStretch=a:Y.prototype.gb.call(this,a)};Vj.prototype.toString=function(){return"Picture("+this.source+")#"+gb(this)};function Ii(a){void 0===a&&(a="");""!==a?ho[a]&&(delete ho[a],io--):(ho=new Wa,io=0)}
function jo(a,b){b.Vy||(b.Hr=function(c){b.zr=!0;b.Xn=!1;var d=b.Cg.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.$g.H(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.$o.add(f),e.Fb(),b.Qn&&(void 0===b.Du&&(b.Du=c),null!==f.kh&&f.kh(f,c))}b.Cg.clear()}a.desiredSize.u()||(hj(a,!1),a.s())},b.kr=function(a){b.Xn=a;var c=b.Cg.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src")||"";
var g=e.$g.H(f);if(null!==g){e=g.length;f=Fa();for(var h=0;h<e;h++)f.push(g[h]);if(b.Qn)for(h=0;h<e;h++)g=f[h],null!==g.kd&&g.kd(g,a);Ia(f)}}b.Cg.clear()}},b.addEventListener("load",b.Hr),b.addEventListener("error",b.kr),b.Vy=!0)}function Xj(a){a.Hr&&a.removeEventListener("load",a.Hr);a.kr&&a.removeEventListener("error",a.kr);delete a.Hr;delete a.kr}Vj.prototype.KA=function(){if(""!==this.source){Ii(this.source);var a=this.source;this.source="";this.source=a}};Vj.prototype.redraw=function(){this.N()};
Vj.prototype.Fi=function(a,b){var c=this.Gg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.Xn instanceof Event&&a instanceof ul)){d=this.naturalBounds;var e=0,f=0,g=this.co,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.u()&&(e=this.hh.x,f=this.hh.y,h=this.hh.width,g=this.hh.height);
var m=h,n=g,p=this.fl,r=this.el;switch(p){case og:if(this.sourceRect.u())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 sd:m=d.width;n=d.height;break;case qg:case Xk:p===qg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Xk&&(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.wf()*b.scale;var q=m*p*n*p,u=h*g/q,v=c.__goCache;p=null;var w=ko;if(c.zr&&void 0!==v&&4<q&&u>w*w)for(null===v.Di&&(lo(v,4,k,l,c),lo(v,16,k,l,c)),k=v.Di,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.Bn){if(null===this.Wl)if(null===this.Gg)this.Wl=!1;else{k=(new Ak(null)).context;try{k.drawImage(this.Gg,0,0)}catch(z){this.Kn=!1}try{k.getImageData(0,0,1,1).data[3]&&(this.Wl=!1),this.Wl=!1}catch(z){this.Wl=!0}}if(this.Wl)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 Zk:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case Yk:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case $k:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}a.Bd();if(b.Fe("pictureRatioOptimization")&&!b.zj&&void 0!==v&&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(z){this.Kn=!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(z){this.Kn=!1}switch(this.flip){case Zk:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case Yk:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case $k:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
Vj.prototype.qm=function(a,b,c,d){var e=this.desiredSize,f=hl(this,!0),g=this.Gg,h=this.co;if(h||!this.ul&&g&&g.complete)this.ul=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===sd||f===Vk?(isFinite(a)||(this.sourceRect.u()?a=this.sourceRect.width:null!==g&&(a=h?+g.width:g.naturalWidth)),c=0):null!==g&&!1!==this.ul&&(a=this.sourceRect.u()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===sd||f===Wk?(isFinite(b)||(this.sourceRect.u()?b=
this.sourceRect.height:null!==g&&(b=h?+g.height:g.naturalHeight)),d=0):null!==g&&!1!==this.ul&&(b=this.sourceRect.u()?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||0,f.width);d=Math.max(d||0,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));Tb(this.qc,a,b);this.ue(0,0,a,b)};
Vj.prototype.vh=function(a,b,c,d){jl(this,a,b,c,d)};
na.Object.defineProperties(Vj.prototype,{element:{get:function(){return this.Gg},set:function(a){var b=this.Gg;if(b!==a){this.co=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;b instanceof HTMLImageElement&&Xj(b);null===a||c||a instanceof HTMLVideoElement||this.co||C("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&Wj(d,this);this.Gg=a;null!==a&&c&&void 0===a.Cg&&(a.Cg=new G);null!==d&&c&&Uj(d,
this);null!==a&&(this.co||!0===a.complete?(a.Qn&&(a.Xn instanceof Event&&null!==this.kd?this.kd(this,a.Xn):!0===a.zr&&!a.Xn&&null!==this.kh&&a.Du&&this.kh(this,a.Du)),a.zr=!0,this.desiredSize.u()||(hj(this,!1),this.s())):c&&jo(this,a));this.g("element",b,a);this.N()}}},source:{get:function(){return this.Ep},set:function(a){var b=this.Ep;if(b!==a){this.Ep=a;var c=ho;if(Jg){if(void 0!==c[a])var d=c[a];else if(""!==a){30<io&&(Ii(),c=ho);d=va("img");d.Qn=!0;jo(this,d);var e=
this.Pl;null!==e&&(d.crossOrigin=e(this));d.src=a;c[a]=d;io++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new mo);this.s();this.N()}this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.Pl},set:function(a){if(this.Pl!==a&&(this.Pl=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.hh},set:function(a){var b=this.hh;b.A(a)||(this.hh=a=a.I(),this.N(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.fl},set:function(a){var b=this.fl;b!==a&&(this.fl=a,this.N(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.Rd},set:function(a){var b=this.Rd;b!==a&&(this.Rd=a,this.N(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.el},
set:function(a){var b=this.el;b.A(a)||(this.el=a=a.I(),this.N(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.kd},set:function(a){var b=this.kd;b!==a&&(this.kd=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.kh},set:function(a){var b=this.kh;b!==a&&(this.kh=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.qc}}});
Vj.prototype.redraw=Vj.prototype.redraw;Vj.prototype.reloadSource=Vj.prototype.KA;var io=0,ko=4;Vj.className="Picture";ho=new Wa;Vj.clearCache=Ii;function mo(){this.Di=null}function lo(a,b,c,d,e){null===a.Di&&(a.Di=[]);var f=new Ak(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new no(f.La,b),c=1,0<a.Di.length&&(c=a.Di[a.Di.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.Bd(),g.drawImage(e,0,0),a.Di.push(b))}mo.className="PictureCacheArray";
function no(a,b){this.source=a;this.ratio=b}no.className="PictureCacheInstance";function oo(){this.Fs=new Q;this.gc=null}oo.prototype.reset=function(a){null!==a?(a.ea(),this.Fs=a,a.figures.clear()):this.Fs=new Q;this.gc=null};function wd(a,b,c,d,e){a.gc=new Wd;a.gc.startX=b;a.gc.startY=c;a.gc.isFilled=d;a.Fs.figures.add(a.gc);void 0!==e&&(a.gc.isShadowed=e)}function Cd(a){var b=a.gc.segments.length;0<b&&a.gc.segments.J(b-1).close()}oo.prototype.Jm=function(a){this.gc.isShadowed=a};
oo.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new Xd(Fd);d.endX=a;d.endY=b;c&&d.close();this.gc.segments.add(d)};oo.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new Xd(ud);d.endX=a;d.endY=b;c&&d.close();this.gc.segments.add(d)};function xd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new Xd(Md);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.gc.segments.add(k)}
function Ad(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new Xd(Nd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.gc.segments.add(g)}oo.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new Xd(Od);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.gc.segments.add(h)};function Bd(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new Xd(Pd,g,h,b,c,d,e,f);k&&b.close();a.gc.segments.add(b)}
function vd(a){var b=Dd;if(null!==b)return Dd=null,b.reset(a),b;b=new oo;b.reset(a);return b}var Dd=null;oo.className="StreamGeometryContext";function po(a,b){var c=a.toLowerCase(),d=L.Ne;d[a]=b;d[c]=a}po("Rectangle",function(a,b,c){a="r"+b+","+c;var d=L.Ff[a];if(void 0!==d)return d;d=new Q(Q.C);d.endX=b;d.endY=c;L.Gf<L.Rm&&(L.Ff[a]=d,L.Gf++);return d});
po("Square",function(a,b,c){a="s"+b+","+c;var d=L.Ff[a];if(void 0!==d)return d;d=new Q(Q.C);d.endX=b;d.endY=c;d.defaultStretch=qg;L.Gf<L.Rm&&(L.Ff[a]=d,L.Gf++);return d});
po("RoundedRectangle",function(a,b,c){a=a?a.parameter1:NaN;if(isNaN(a)||0>a)a=5;a=Math.min(a,b/3);a=Math.min(a,c/3);var d="rr"+b+","+c+","+a,e=L.Ff[d];if(void 0!==e)return e;var f=a*L.qg;e=(new Q).add((new Wd(a,0,!0)).add(new Xd(ud,b-a,0)).add(new Xd(Md,b,a,b-f,0,b,f)).add(new Xd(ud,b,c-a)).add(new Xd(Md,b-a,c,b,c-f,b-f,c)).add(new Xd(ud,a,c)).add(new Xd(Md,0,c-a,f,c,0,c-f)).add(new Xd(ud,0,a)).add((new Xd(Md,a,0,0,f,f,0)).close()));1<f&&(e.spot1=new P(0,0,f,f),e.spot2=new P(1,1,-f,-f));L.Gf<L.Rm&&
(L.Ff[d]=e,L.Gf++);return e});po("Border","RoundedRectangle");po("Ellipse",function(a,b,c){a="e"+b+","+c;var d=L.Ff[a];if(void 0!==d)return d;d=new Q(Q.M);d.endX=b;d.endY=c;d.spot1=gd;d.spot2=hd;L.Gf<L.Rm&&(L.Ff[a]=d,L.Gf++);return d});po("Circle",function(a,b,c){a="c"+b+","+c;var d=L.Ff[a];if(void 0!==d)return d;d=new Q(Q.M);d.endX=b;d.endY=c;d.spot1=gd;d.spot2=hd;d.defaultStretch=qg;L.Gf<L.Rm&&(L.Ff[a]=d,L.Gf++);return d});
po("TriangleRight",function(a,b,c){return(new Q).add((new Wd(0,0)).add(new Xd(ud,b,.5*c)).add((new Xd(ud,0,c)).close())).Km(0,.25,.5,.75)});po("TriangleDown",function(a,b,c){return(new Q).add((new Wd(0,0)).add(new Xd(ud,b,0)).add((new Xd(ud,.5*b,c)).close())).Km(.25,0,.75,.5)});po("TriangleLeft",function(a,b,c){return(new Q).add((new Wd(b,c)).add(new Xd(ud,0,.5*c)).add((new Xd(ud,b,0)).close())).Km(.5,.25,1,.75)});
po("TriangleUp",function(a,b,c){return(new Q).add((new Wd(b,c)).add(new Xd(ud,0,c)).add((new Xd(ud,.5*b,0)).close())).Km(.25,.5,.75,1)});po("Triangle","TriangleUp");po("Diamond",function(a,b,c){return(new Q).add((new Wd(.5*b,0)).add(new Xd(ud,0,.5*c)).add(new Xd(ud,.5*b,c)).add((new Xd(ud,b,.5*c)).close())).Km(.25,.25,.75,.75)});po("LineH",function(a,b,c){a=new Q(Q.j);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});
po("LineV",function(a,b,c){a=new Q(Q.j);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});po("None","Rectangle");po("BarH","Rectangle");po("BarV","Rectangle");po("MinusLine","LineH");po("PlusLine",function(a,b,c){return(new Q).add((new Wd(0,c/2,!1)).add(new Xd(ud,b,c/2)).add(new Xd(Fd,b/2,0)).add(new Xd(ud,b/2,c)))});po("XLine",function(a,b,c){return(new Q).add((new Wd(0,c,!1)).add(new Xd(ud,b,0)).add(new Xd(Fd,0,0)).add(new Xd(ud,b,c)))});
L.Qm={"":"",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,b){void 0===a||a instanceof Kl||"string"===typeof a?X.call(this,a):(X.call(this),a&&(b=a));this.D=2408959;this.Og=this.Jf="";this.kp=this.gp=this.tp=this.ro=null;this.wp="";this.Hf=this.$n=this.vp=this.fh=null;this.ip="";this.hp=Ob;this.Ub=this.lp="";this.ei=this.kn=this.Qh=null;this.ae=(new J(NaN,NaN)).freeze();this.xo="";this.Ze=null;this.yo=sc;this.mp=Vc;this.Go=rb;this.zo=tb;this.An=null;this.so=127;this.Bp=ub;this.Ap="gray";this.bg=4;this.Xw=-1;this.Wp=NaN;this.Uy=new N;this.li=
null;this.Sf=NaN;b&&Object.assign(this,b)}ma(V,X);
V.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.D=this.D&-4097|49152;a.Jf=this.Jf;a.Og=this.Og;a.ro=this.ro;a.tp=this.tp;a.gp=this.gp;a.kp=this.kp;a.wp=this.wp;a.vp=this.vp;a.$n=this.$n;a.Hf=null;a.ip=this.ip;a.hp=this.hp.I();a.lp=this.lp;a.mp=this.mp.I();a.Ub=this.Ub;a.kn=this.kn;a.ae.assign(this.ae);a.xo=this.xo;a.yo=this.yo.I();a.Go=this.Go.I();a.zo=this.zo.I();a.An=this.An;a.so=this.so;a.Bp=this.Bp.I();a.Ap=this.Ap;a.bg=this.bg;a.Wp=this.Wp};
V.prototype.sf=function(a){X.prototype.sf.call(this,a);a.Ch();a.fh=null;a.Ze=null;a.li=null};V.prototype.toString=function(){var a=Ja(this.constructor)+"#"+gb(this);null!==this.data&&(a+="("+Ka(this.data)+")");return a};V.prototype.Ak=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===ee&&"elements"===b?e instanceof X?zj(e,function(a){Bj(h.partManager,a);Aj(h,a)}):Uj(h,e):a===fe&&"elements"===b&&(e instanceof X?zj(e,function(a){Ej(h.partManager,a,h)}):Wj(h,e)),h.Va(a,b,c,d,e,f,g))};
V.prototype.Da=function(a){X.prototype.Da.call(this,a);if(null!==this.data){for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&zj(e,function(a){null!==a.data&&a.Da()})}for(b=this.adornments;b.next();)b.value.Da(a)}};V.prototype.updateRelationshipsFromData=function(){var a;null!==this.data&&(null===(a=this.diagram)||void 0===a?void 0:a.partManager.updateRelationshipsFromData(this))};V.prototype.hk=function(a){var b=this.Hf;return null===b?null:b.H(a)};
V.prototype.th=function(a,b){if(null!==b){var c=null,d=this.Hf;null!==d&&(c=d.H(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Hf=d=new I);b.Jf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.yh(),null!==a&&(b.data=a.data)))}}};V.prototype.Cf=function(a){var b=this.Hf;if(null!==b){var c=b.H(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Hf=null)}};
V.prototype.$j=function(){var a=this.Hf;if(null!==a){var b=Fa();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Cf(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.u()&&this.isVisible()&&b.Bf()&&b.actualBounds.u())){c=this.hk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Dh()?a.linkSelectionAdornmentTemplate:this instanceof hf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof we))break a;ng(c);c=c.copy();null!==c&&(this.Dh()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.s();this.th("Selection",c);break a}}this.Cf("Selection")}qo(this,a);for(b=this.adornments;b.next();)b.value.Da()}};V.prototype.Kb=function(){var a=this.diagram;null!==a&&(Qi(a),0!==(this.D&16384)!==!0&&(this.D|=16384,a.Fb()))};function $h(a){0!==(a.D&16384)!==!1&&(a.updateAdornments(),a.D&=-16385)}
function qo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function ro(a){if(!1===oj(a)){so(a,!0);a.ll();var b=a.diagram;null!==b&&(b.qe.add(a),b.Fb())}}function to(a){a.D|=2097152;if(!1!==oj(a)){var b=a.position,c=a.location;c.u()&&b.u()||uo(a,b,c);c=a.vb;var d=N.alloc().assign(c);c.ea();c.x=b.x;c.y=b.y;c.freeze();a.rm(d,c);N.free(d);so(a,!1)}}
V.prototype.ue=function(a,b,c,d){var e=this.ic;e.h(a,b,c,d);null===this.Ab&&(this.Ab=new qd);var f=this.Ab;f.reset();this.zp(f,a,b,c,d);this.Ab=f;f.Os()||f.Jq(e)};
V.prototype.zp=function(a,b,c,d,e){1!==this.sa&&a.scale(this.sa);if(0!==this.xb){var f=yc;this.locationSpot.hb()&&(f=this.locationSpot);var g=J.alloc();if(this.locationObject!==this)for(b=this.locationObject,c=b.naturalBounds,g.Vi(c.x,c.y,c.width,c.height,f),null!==b.Ab&&b.Ab.ya(g),g.offset(-b.measuredBounds.x,-b.measuredBounds.y),f=b.panel;null!==f&&f!==this;)null!==f.Ab&&f.Ab.ya(g),g.offset(-f.measuredBounds.x,-f.measuredBounds.y),f=f.panel;else g.Vi(b,c,d,e,f);a.rotate(this.xb,g.x,g.y);J.free(g)}};
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.Ys(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};
V.prototype.Nb=function(a){var b=this.diagram;a?(this.B(4),this.Kb(),null!==b&&b.qe.add(this)):(this.B(8),this.$j());this.Ch();null!==b&&(b.Pa(),b.N())};V.prototype.Ya=function(a){if(this.name===a)return this;var b=this.li;null===b&&(this.li=b=new I);if(null!==b.H(a))return b.H(a);var c=X.prototype.Ya.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};
function vo(a,b,c,d){void 0===d&&(d=new J);c=c.wc()?yc:c;var e=b.naturalBounds;d.h(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.ya(d);for(b=b.panel;null!==b&&b!==a;)b.transform.ya(d),b=b.panel;null!==a.Ab&&a.Ab.ya(d);d.offset(-a.ic.x,-a.ic.y);return d}V.prototype.Mi=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};V.prototype.Sa=function(){!0===mj(this)&&this.measure(Infinity,Infinity);this.arrange()};
function xj(a,b){var c=a.Uy;isNaN(a.Sf)&&(a.Sf=cn(a));var d=a.Sf;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===nj(this))to(this);else{il(this,!1);var a=this.vb,b=N.alloc();b.assign(a);var c=lg(this);this.vh(0,0,this.ic.width,this.ic.height);var d=this.position;uo(this,d,this.location);a.ea();a.x=d.x;a.y=d.y;a.freeze();this.rm(b,a);b.A(a)?this.Jd(c):!this.Jc()||L.w(b.width,a.width)&&L.w(b.height,a.height)||0<=this.Xw&&this.B(16);N.free(b);so(this,!1)}};t=V.prototype;
t.rm=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.vj&&a.u()){var e=N.alloc();e.assign(c.documentBounds);e.cw(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.A(b)||Cj(this,d,c);c.N();!a.u()&&!b.u()||Wb(a,b)||(this instanceof W&&!c.undoManager.isUndoingRedoing&&this.pd(),this.Ch())}};
t.Zv=function(a,b,c){if(this.Dh()||!a.u())return!1;var d=this.diagram;null!==d&&wo(this,d,a,b,c);this.ka=a;this.D&=-2097153;!this.ae.u()||null!==d&&!d.animationManager.isTicking&&d.undoManager.isUndoingRedoing||(d=this.ae,this.ae=new J(d.x+(a.x-b),d.y+(a.y-c)),this.g("location",d,this.ae.copy()));!1===oj(this)&&!1===nj(this)&&(ro(this),to(this));return!0};function wo(a,b,c,d,e){null===b||a instanceof we||(b=b.animationManager,b.rb&&Ch(b,a,new J(d,e),c))}
t.Gm=function(a,b,c){var d=this.ae,e=this.ka;if(c){if(d.x===a&&d.y===b)return;oj(this)||nj(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;oj(this)||nj(this)?this.gt():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}ro(this)};t.gt=function(){this.D&=-2097153;ro(this)};
function uo(a,b,c){var d=J.alloc(),e=a.locationObject,f=e.naturalBounds,g=e instanceof uf?e.strokeWidth:0;d.Vi(0,0,f.width+g,f.height+g,a.locationSpot);if(e!==a)for(d.offset(-g/2,-g/2),e.transform.ya(d),e=e.panel;null!==e&&e!==a;)e.transform.ya(d),e=e.panel;null!==a.Ab&&a.Ab.ya(d);d.offset(-a.ic.x,-a.ic.y);e=a.diagram;f=c.u();g=b.u();f&&g?0!==(a.D&2097152)?xo(a,b,c,e,d):yo(a,b,c,e,d):f?xo(a,b,c,e,d):g&&yo(a,b,c,e,d);a.D|=2097152;J.free(d);a.ll()}
function xo(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.rb||a instanceof we||Ch(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function yo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||a.g("location",f,c.copy())}
function Cj(a,b,c){kl(a,!1);a instanceof W&&vk(c,a);a.layer.isTemporary||b||c.Pa();b=a.vb;var d=c.viewportBounds;d.u()?lg(a)?(Zb(b,d)||a.Jd(!1),a.updateAdornments()):b.Ic(d)?(a.Jd(!0),a.updateAdornments()):a.Kb():c.xj=!0}t.Si=function(){return!0};t.Jc=function(){return!0};t.Dh=function(){return!1};t.Ri=function(){return!0};
function zo(a,b,c,d){b.constructor===a.constructor||Ao||(Ao=!0,ya('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),ya("  Old class: "+Ja(a.constructor)+", new class: "+Ja(b.constructor)+", part: "+a.toString()));a.$j();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.sf(a);b.cloneProtected(a);a.Jf=d;a.s();a.N();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.ib=e;a.D=f?a.D|4096:a.D&-4097;a.D=g?a.D|524288:a.D&-524289;a instanceof W&&(a.R=h?a.R|4:a.R&-5,a.R=k?a.R|1:a.R&-2,a.R=l?a.R|2:a.R&-3);null!==e&&a.Da();e=a.layerName;e!==c&&(a.Og=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Jc()&&a.B(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 oj(a){return 0!==(a.D&32768)}function so(a,b){a.D=b?a.D|32768:a.D&-32769}function kl(a,b){a.D=b?a.D|65536:a.D&-65537}
function lg(a){return 0!==(a.D&131072)}t=V.prototype;t.Jd=function(a){this.D=a?this.D|131072:this.D&-131073};function Bo(a,b){a.D=b?a.D|1048576:a.D&-1048577}t.Ch=function(){var a=this.containingGroup;null!==a&&(a.s(),null!==a.placeholder&&a.placeholder.s(),a.pd())};t.N=function(){var a=this.diagram;null!==a&&!nj(this)&&!oj(this)&&this.isVisible()&&this.vb.u()&&a.N(xj(this,this.vb))};
t.s=function(){X.prototype.s.call(this);var a=this.diagram;null!==a&&(a.qe.add(this),this instanceof W&&null!==this.labeledLink&&zl(this.labeledLink),a.Fb(!0))};t.pq=function(a){a||(a=this.Qh,null!==a&&Co(a,this))};t.qq=function(a){a||(a=this.Qh,null!==a&&Do(a,this))};t.fk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.wm(a))}};t.Uz=function(){return Eo(this,this)};
function Eo(a,b){var c=b.containingGroup;return null!==c?1+Eo(a,c):b instanceof W&&(b=b.labeledLink,null!==b)?Eo(a,b):0}t.Yz=function(){return Fo(this,this)};function Fo(a,b){var c=b.containingGroup;return null!==c||b instanceof W&&(c=b.labeledLink,null!==c)?Fo(a,c):b}t.Fd=function(a){return a instanceof hf?Go(this,this,a):!1};function Go(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Go(a,d,c)?b instanceof W&&(b=b.labeledLink,null!==b)?Go(a,b,c):!1:!0}
t.Rx=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof hf&&Bo(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 hf&&Bo(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.B=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.Qh,null!==b){var c=b.layout;null!==c?c.B():b.B(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.B())};function Dj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Rk(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof we))if(a.add(b),b instanceof W){if(c&&b instanceof hf)for(var g=b.memberParts;g.next();)Rk(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)&&Rk(a,h,c,d,e,f)}}if(1<d)for(b=b.tv();b.next();)Rk(a,b.value,c,d-1,e,f)}else if(b instanceof U)for(b=b.labelNodes;b.next();)Rk(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.pa(this.data)}},adornments:{get:function(){return null===this.Hf?Za:this.Hf.iteratorValues}},layer:{get:function(){return this.ei}},diagram:{get:function(){var a=this.ei;return null===a||void 0===a?null:a.diagram}},layerName:{get:function(){return this.Og},set:function(a){var b=
this.Og;if(b!==a){var c=this.diagram;if(null===c||null!==c.ik(a)&&!c.partManager.addsToTemporaryLayer)if(this.Og=a,null!==c&&c.Pa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.ik(a),null!==a&&a!==b))){var d=b.bc(-1,this,!0);0<=d&&c.Va(fe,"parts",b,this,null,d,!0);d=a.Oi(99999999,this,!0);b.visible!==a.visible&&this.Nb(a.visible);0<=d&&c.Va(ee,"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.ro},set:function(a){var b=this.ro;b!==a&&(this.ro=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.Wp},set:function(a){var b=this.Wp;if(b!==a){this.Wp=a;var c=this.layer;null!==c&&ci(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.N()}}},locationObject:{get:function(){if(null===this.Ze){var a=this.locationObjectName;""!==a?(a=this.Ya(a),null!==a?this.Ze=a:this.Ze=this):
this instanceof we?this.type!==X.Link&&null!==this.placeholder?this.Ze=this.placeholder:this.Ze=this:this.Ze=this}return this.Ze.visible?this.Ze:this}},minLocation:{get:function(){return this.Go},set:function(a){var b=this.Go;b.A(a)||(this.Go=a=a.I(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.zo},set:function(a){var b=this.zo;b.A(a)||(this.zo=a=a.I(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.xo},set:function(a){var b=this.xo;b!==a&&(this.xo=a,this.Ze=null,this.s(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.yo},set:function(a){var b=this.yo;b.A(a)||(this.yo=a=a.I(),this.s(),this.g("locationSpot",b,a))}},location:{get:function(){return this.ae},set:function(a){var b=a.x,c=a.y,d=this.ae;if(!(d.x===b||isNaN(d.x)&&isNaN(b))||!(d.y===c||isNaN(d.y)&&isNaN(c))){a=
a.copy();b=a;if(this.Dh())b=!1;else{this.ae=b;this.D|=2097152;if(!1===nj(this)&&(ro(this),c=this.ka,c.u())){var e=this.diagram;if(null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing){var f=c.copy();c.h(c.x+(b.x-d.x),c.y+(b.y-d.y));wo(this,e,c,f.x,f.y);this.g("position",f,c.copy())}}b=!0}b&&this.g("location",d,a.copy())}}},category:{get:function(){return this.Jf},set:function(a){var b=this.Jf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==
c&&null!==d&&!(this instanceof we)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.T.addAll(this.T))}this.Jf=a;this.g("category",b,a);null===c||null===d||this instanceof we?this instanceof we&&(e=this.adornedPart,null!==e&&(a=e.Hf,null!==a&&a.remove(b),e.th(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Dh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(ng(c),c=c.copy(),null!==c&&zo(this,
c,b,a))):(null!==f&&f.Dm(d,a),c=Ho(c.partManager,d,a),null!==c&&(ng(c),c=c.copy(),null===c||c instanceof U||(d=this.location.copy(),zo(this,c,b,a),this.location.u()||(this.location=d)))),null!==e&&(b=this.clone(),b.T.addAll(this.T),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){zo(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.Kb())}},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.Kb())}},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.Pa();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.B(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.Kb())}},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.Kb())}},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.Kb())}},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.Kb())}},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.Kb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Fb(),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.N();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.N())}},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.$n},set:function(a){var b=this.$n;b!==a&&(this.$n=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.wp},set:function(a){var b=this.wp;b!==a&&(this.wp=a,this.fh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{
get:function(){return this.tp},set:function(a){var b=this.tp;b!==a&&(this.tp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{get:function(){if(null===this.fh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.Ya(a),null!==a?this.fh=a:this.fh=this):this instanceof U?(a=this.path,null!==a?this.fh=a:this.fh=this):this.fh=this}return this.fh}},selectionChanged:{get:function(){return this.vp},set:function(a){var b=this.vp;
b!==a&&(this.vp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.gp},set:function(a){var b=this.gp;b!==a&&(this.gp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.ip},set:function(a){var b=this.ip;b!==a&&(this.ip=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.Ya(a),
null!==a)?a:this}},resizeCellSize:{get:function(){return this.hp},set:function(a){var b=this.hp;b.A(a)||(this.hp=a=a.I(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(this.lp=a,this.g("rotateObjectName",
b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.Ya(a),null!==a)?a:this}},rotationSpot:{get:function(){return this.mp},set:function(a){var b=this.mp;b.A(a)||(this.mp=a=a.I(),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.Qh},
set:function(a){if(this.Jc()){var b=this.Qh;if(b!==a){null===a||this!==a&&!a.Fd(this)||(this===a&&C("Cannot make a Group a member of itself: "+this.toString()),C("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.B(2);var c=this.diagram;null!==b?Do(b,this):this instanceof hf&&null!==c&&c.xi.remove(this);this.Qh=a;null!==a?Co(a,this):this instanceof hf&&null!==c&&c.xi.add(this);this.B(1);if(null!==c&&c.Z){var d=this.data,e=c.model;if(null!==d&&
e.pk()){var f=e.pa(null!==a?a.data:null);e.Gq(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 hf)for(c=new G,Rk(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof W)for(d=d.linksConnected;d.next();)Io(d.value);if(this instanceof W){for(c=this.linksConnected;c.next();)Io(c.value);c=this.labeledLink;null!==c&&Io(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&ci(b,-1,a))}}else C("cannot set the Part.containingGroup of a Link or Adornment")}},
containingGroupChanged:{get:function(){return this.kn},set:function(a){var b=this.kn;b!==a&&(this.kn=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.so},set:function(a){var b=this.so;b!==a&&(this.so=a,this.g("layoutConditions",b,a))}},dragComputation:{
get:function(){return this.An},set:function(a){var b=this.An;b!==a&&(this.An=a,this.g("dragComputation",b,a))}},shadowOffset:{get:function(){return this.Bp},set:function(a){var b=this.Bp;b.A(a)||(this.Bp=a=a.I(),this.N(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.Ap},set:function(a){var b=this.Ap;b!==a&&(this.Ap=a,this.N(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.bg},
set:function(a){var b=this.bg;b!==a&&(this.bg=a,this.N(),this.g("shadowBlur",b,a))}}});V.prototype.invalidateLayout=V.prototype.B;V.prototype.findCommonContainingGroup=V.prototype.Rx;V.prototype.isMemberOf=V.prototype.Fd;V.prototype.findTopLevelPart=V.prototype.Yz;V.prototype.findSubGraphLevel=V.prototype.Uz;V.prototype.ensureBounds=V.prototype.Sa;V.prototype.getDocumentBounds=V.prototype.Mi;V.prototype.findObject=V.prototype.Ya;V.prototype.moveTo=V.prototype.moveTo;
V.prototype.invalidateAdornments=V.prototype.Kb;V.prototype.clearAdornments=V.prototype.$j;V.prototype.removeAdornment=V.prototype.Cf;V.prototype.addAdornment=V.prototype.th;V.prototype.findAdornment=V.prototype.hk;V.prototype.updateTargetBindings=V.prototype.Da;var Ao=!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 we(a,b){void 0===a||a instanceof Kl||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.D&=-257;this.Og="Adornment";this.ie=null;this.ax=0;this.xx=!1;this.j=this.Ra=null;b&&Object.assign(this,b)}ma(we,V);we.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};we.prototype.updateRelationshipsFromData=function(){};
we.prototype.sk=function(a){var b=this.adornedObject,c=null===b||void 0===b?void 0:b.part;if(c instanceof U&&b instanceof uf){b=c.path;c.sk(a);a=b.geometry;c=this.T.m;b=c.length;for(var d=0;d<b;d++){var e=c[d];e.isPanelMain&&e instanceof uf&&(e.ma=a)}}};we.prototype.Si=function(){var a=this.ie;if(null===a)return!0;a=a.part;return null===a||!nj(a)};we.prototype.Jc=function(){return!1};
we.prototype.Ak=function(a,b,c,d,e,f,g){if(a===ee&&"elements"===b)if(e instanceof mg)null===this.Ra&&(this.Ra=e);else{if(e instanceof X){var h=e.hm(function(a){return a instanceof mg});h instanceof mg&&null===this.Ra&&(this.Ra=h)}}else a===fe&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.mg(d)&&(this.Ra=null));V.prototype.Ak.call(this,a,b,c,d,e,f,g)};we.prototype.updateAdornments=function(){};we.prototype.fk=function(){};
na.Object.defineProperties(we.prototype,{placeholder:{get:function(){return this.Ra}},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.Cf(this.category);this.ie=a;null!==c&&c.th(this.category,this)}},adornedPart:{get:function(){var a=this.ie;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});we.className="Adornment";function W(a,b){void 0===a||a instanceof Kl||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.R=13;this.ab=new E;this.Pp=this.ql=this.ii=this.uo=this.to=null;this.Kk=qc;this.kc=this.Pe=null;this.cp=Jo;this.rh=!1;b&&Object.assign(this,b)}ma(W,V);W.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.R=this.R;a.R=this.R&-17;a.to=this.to;a.uo=this.uo;a.ii=this.ii;a.Pp=this.Pp;a.Kk=this.Kk.I();a.cp=this.cp};
t=W.prototype;t.sf=function(a){V.prototype.sf.call(this,a);a.pd();a.Pe=this.Pe;a.kc=null};function Ko(a,b){null!==b&&(null===a.Pe&&(a.Pe=new G),a.Pe.add(b))}function Lo(a,b,c,d){if(null===b||null===a.Pe)return null;for(var e=a.Pe.iterator;e.next();){var f=e.value;if(f.Ws===a&&f.Iv===b&&f.uy===c&&f.vy===d||f.Ws===b&&f.Iv===a&&f.uy===d&&f.vy===c)return f}return null}t.qA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Lo(this,a,b,c);null!==a&&a.mm()};
t.Ak=function(a,b,c,d,e,f,g){a===ee&&"elements"===b?this.kc=null:a===fe&&"elements"===b&&(this.kc=null);V.prototype.Ak.call(this,a,b,c,d,e,f,g)};t.pd=function(a){for(var b=this.linksConnected;b.next();){var c=b.value;void 0!==a&&a.contains(c)||(Mo(c.fromPort),Mo(c.toPort),c.Ua())}};function ll(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)Mo(c.fromPort),Mo(c.toPort),c.Ua()}}
function Mo(a){if(null!==a){var b=a.bp;null!==b&&b.mm();a=a.part;b=a.containingGroup;null===b||a.isVisible()||Mo(b.port)}}t.Si=function(){return!0};W.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Xp(this.Kk);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=qi,c=this.diagram;if(null!==c){if(c.animationManager.Ys(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===qi){if(a=this.lg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Ck){if(a=a?this.qv():this.rv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Dk&&(a=a?this.qv():this.rv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};W.prototype.Nb=function(a){V.prototype.Nb.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.nq(this);null===d||d.Fd(this.containingGroup)||c.Ua()}c.Nb(a)}};W.prototype.Sx=function(){var a=new G,b=new G;No(this,this,a,b);return b.iterator};
function No(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)&&No(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.ab.iterator;var b=new ab(this.ab),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.iq=function(a){void 0===a&&(a=null);var b=new ab(this.ab),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.Dd=function(a){void 0===a&&(a=null);var b=new ab(this.ab),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.pv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.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 $a(c):Za};
t.rv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.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 $a(c):Za};
t.qv=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.ab.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 $a(c):Za};
t.Pz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ab(this.ab),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.Qz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new ab(this.ab),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 Oo(a,b,c){Mo(c);var d=a.ab.contains(b);d||a.ab.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.rh||(e.rh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function Po(a,b,c){Mo(c);var d=a.ab.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.rh=!1),null===b||b.isTreeLeaf||(0===b.ab.count?(b.rh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Bk(b)))}
function Bk(a){a.rh=!1;if(0!==a.ab.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.ab.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.pq=function(a){V.prototype.pq.call(this,a);a||(Bk(this),a=this.ql,null!==a&&Qo(a,this))};t.qq=function(a){V.prototype.qq.call(this,a);a||(a=this.ql,null!==a&&null!==a.ld&&(a.ld.remove(this),a.s()))};
t.fk=function(){if(0<this.ab.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.ab.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.fk.call(this)};t.Es=function(a){if(null===this.kc){if(""===a&&!1===this.Ge)return this;Ro(this)}var b=this.kc.H(a);return null!==b||""!==a&&(b=this.kc.H(""),null!==b)?b:this};
function Ro(a){null===a.kc?a.kc=new I:a.kc.clear();a.Mm(a,function(a,c){Pl(a,c)});0===a.kc.count&&a.kc.add("",a)}function Pl(a,b){var c=b.portId;null!==c&&null!==a.kc&&a.kc.add(c,b)}function Ol(a,b,c){var d=b.portId;if(null!==d&&(null!==a.kc&&a.kc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Fa()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Ia(c)}}}
t.sA=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.ab.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.ab.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.bA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.ab.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.ab.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.Mz=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)Bo(b,!0),b=b.lg();var c=null;for(b=a;null!==b;){if(0!==(b.D&1048576)){c=b;break}b=b.lg()}for(b=this;null!==b;)Bo(b,!1),b=b.lg();return c};t.Ji=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.ab.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.lg=function(){var a=this.rh;if(null===a)return null;if(a instanceof W)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.ab.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.rh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.rh=b;return this.rh=null};t.$z=function(){function a(b,d){d.add(b);var c=b.Ji();null!==c&&(d.add(c),b=b.lg(),null!==b&&a(b,d))}var b=new G;a(this,b);return b};
t.Zz=function(){return So(this,this)};function So(a,b){b=b.lg();return null===b?0:1+So(a,b)}t.kq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new ab(this.ab);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.tv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.ab.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 $a(c):Za};
t.aA=function(a){void 0===a&&(a=Infinity);var b=new G;Rk(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.He){b.He=!0;var c=new G;c.add(this);To(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===qi);b.He=!1}};function To(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.iq():a.Dd();h.next();){var k=h.value;k.isTreeLink&&(k=k.nq(a),null===k||k===a||b.contains(k)||(b.add(k),To(k,b,c,d-1,e,f,g)))}else Uo(a,b,c,e,f,g)}
function Uo(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.iq():a.Dd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.nq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Wj(k,e),k.Ch(),k.Nb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Uo(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.He){b.He=!0;var c=new G;c.add(this);Vo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===qi);b.He=!1}};
function Vo(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.iq():a.Dd();k.next();){var l=k.value;l.isTreeLink&&(h||l.rd||l.Ua(),l=l.nq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Nb(!0),l.Ch(),g&&e.Yj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Vo(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
na.Object.defineProperties(W.prototype,{portSpreading:{get:function(){return this.cp},set:function(a){var b=this.cp;b!==a&&(this.cp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.pd())}},avoidable:{get:function(){return 0!==(this.R&8)},set:function(a){var b=0!==(this.R&8);if(b!==a){this.R^=8;var c=this.diagram;null!==c&&vk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.Kk},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.Kk;if(!b.A(a)){this.Kk=a=a.I();var c=this.diagram;null!==c&&vk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.ab.iterator}},linkConnected:{get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(this.to=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.uo},
set:function(a){var b=this.uo;b!==a&&(this.uo=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.ql}},labeledLink:{get:function(){return this.ql},set:function(a){var b=this.ql;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.ld&&(b.ld.remove(this),
b.s());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.Qi()){var g=f.pa(d);void 0!==g&&f.wy(e,g)}}this.containingGroup=null}this.ql=a;null!==a&&(Qo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.Qi()&&(d=c.pa(d),void 0!==d&&c.av(e,d))),this.containingGroup=a.containingGroup);zl(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.Es("")}},ports:{
get:function(){null===this.kc&&Ro(this);return this.kc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.R&1)},set:function(a){var b=0!==(this.R&1);if(b!==a){this.R^=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.Nb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.R&2)},set:function(a){var b=0!==(this.R&2);b!==a&&(this.R^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.Pp},set:function(a){var b=this.Pp;b!==a&&(this.Pp=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.R&4)},set:function(a){var b=0!==(this.R&4);b!==a&&(this.R^=4,this.g("isTreeLeaf",b,a))}}});W.prototype.expandTree=W.prototype.expandTree;
W.prototype.collapseTree=W.prototype.collapseTree;W.prototype.findTreeParts=W.prototype.aA;W.prototype.findTreeChildrenNodes=W.prototype.tv;W.prototype.findTreeChildrenLinks=W.prototype.kq;W.prototype.findTreeLevel=W.prototype.Zz;W.prototype.findTreeParentChain=W.prototype.$z;W.prototype.findTreeParentNode=W.prototype.lg;W.prototype.findTreeParentLink=W.prototype.Ji;W.prototype.findCommonTreeParent=W.prototype.Mz;W.prototype.findTreeRoot=W.prototype.bA;W.prototype.isInTreeOf=W.prototype.sA;
W.prototype.findPort=W.prototype.Es;W.prototype.findLinksTo=W.prototype.Qz;W.prototype.findLinksBetween=W.prototype.Pz;W.prototype.findNodesInto=W.prototype.qv;W.prototype.findNodesOutOf=W.prototype.rv;W.prototype.findNodesConnected=W.prototype.pv;W.prototype.findLinksInto=W.prototype.Dd;W.prototype.findLinksOutOf=W.prototype.iq;W.prototype.findExternalTreeLinksConnected=W.prototype.Sx;W.prototype.invalidateConnectedLinks=W.prototype.pd;W.prototype.invalidateLinkBundle=W.prototype.qA;
var Wo=new D(W,"SpreadingNone",10),Jo=new D(W,"SpreadingEvenly",11),Xo=new D(W,"SpreadingPacked",12);W.className="Node";W.SpreadingNone=Wo;W.SpreadingEvenly=Jo;W.SpreadingPacked=Xo;function hf(a,b){void 0===a||a instanceof Kl||"string"===typeof a?W.call(this,a):(W.call(this),a&&(b=a));this.R|=4608;this.Eo=new G;this.zl=new G;this.Ra=this.Ip=this.ki=this.Fo=this.Do=this.$a=null;this.Ac=new li;this.Ac.group=this;this.mr=null;b&&Object.assign(this,b)}ma(hf,W);
hf.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);this.R=this.R&-32769;null!==this.$a&&(a.$a=this.$a.copy());a.Do=this.Do;a.Fo=this.Fo;a.ki=this.ki;a.Ip=this.Ip;var b=a.hm(function(a){return a instanceof mg});b instanceof mg?a.Ra=b:a.Ra=null;null!==this.Ac?(a.Ac=this.Ac.copy(),a.Ac.group=a):(null!==a.Ac&&(a.Ac.group=null),a.Ac=null)};t=hf.prototype;
t.sf=function(a){W.prototype.sf.call(this,a);var b=a.jk();for(a=a.memberParts;a.next();){var c=a.value;c.s();c.B(8);c.$j();if(c instanceof W)c.pd(b);else if(c instanceof U)for(c=c.labelNodes;c.next();)c.value.pd(b)}};
t.Ak=function(a,b,c,d,e,f,g){if(a===ee&&"elements"===b)if(e instanceof mg)null===this.Ra?this.Ra=e:this.Ra!==e&&C("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.hm(function(a){return a instanceof mg});h instanceof mg&&(null===this.Ra?this.Ra=h:this.Ra!==h&&C("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===fe&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof X&&this.Ra.mg(d)&&(this.Ra=null));
W.prototype.Ak.call(this,a,b,c,d,e,f,g)};t.rm=function(a,b){W.prototype.rm.call(this,a,b);this.isClipping&&this.type!==X.Spot&&this.isSubGraphExpanded&&(a=this.resizeObject,a instanceof X&&(a=a.nb()),null===this.$a&&(this.$a=new N),a.Mi(this.$a),a instanceof uf&&this.$a.Gc(-a.strokeWidth,-a.strokeWidth))};t.vh=function(a,b,c,d){this.Ze=this.Ra;W.prototype.vh.call(this,a,b,c,d)};
t.Sa=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof U||b.Sa()});W.prototype.Sa.call(this)};t.Si=function(){if(!W.prototype.Si.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof W){if(b.isVisible()&&nj(b))return!1}else if(b instanceof U&&b.isVisible()&&nj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Co(a,b){if(a.Eo.add(b)){b instanceof hf&&a.zl.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.Nb(!1)}b instanceof U&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.s())}
function Do(a,b){if(a.Eo.remove(b)){b instanceof hf&&a.zl.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.Nb(!0)}b instanceof U&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.s())}t.fk=function(){if(0<this.Eo.count){var a=this.diagram;if(null!==a)for(var b=this.Eo.copy().iterator;b.next();)a.remove(b.value)}W.prototype.fk.call(this)};
hf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Tk(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};hf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Tk(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
hf.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=hf.prototype;
t.pd=function(a){var b=0!==(this.R&65536);W.prototype.pd.call(this,a);if(!b)for(0!==(this.R&65536)!==!0&&(this.R=this.R^65536),b=this.ov();b.next();){var c=b.value;if(void 0===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Fd(this)&&!d.isVisible()?(Mo(c.fromPort),Mo(c.toPort),c.Ua()):(d=c.toNode,null!==d&&d!==this&&d.Fd(this)&&!d.isVisible()&&(Mo(c.fromPort),Mo(c.toPort),c.Ua()))}}};
t.ov=function(){var a=null!==this.diagram&&this.diagram.tx;if(a&&null!==this.mr)return this.mr.iterator;var b=this.jk();b.add(this);for(var c=new G,d=b.iterator;d.next();){var e=d.value;if(e instanceof W)for(e=e.linksConnected;e.next();){var f=e.value;b.contains(f)||c.add(f)}}a&&(this.mr=c);return c.iterator};
t.Oz=function(){var a=this.jk();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.Nz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new G;a(this,b);return b};t.jk=function(){var a=new G;Rk(a,this,!0,0,!0);a.remove(this);return a};
t.Nb=function(a){W.prototype.Nb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Nb(a)};hf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.He){a.He=!0;var b=this.jk();Yo(this,b,a,this);a.He=!1}};
function Yo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Nb(!1);f instanceof hf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,Yo(f,b,c,d));if(f instanceof W)f.pd(b),c.Wj(f,d);else if(f instanceof U)for(f=f.labelNodes;f.next();)f.value.pd(b)}a.isSubGraphExpanded=!1}hf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.He){a.He=!0;var b=this.jk();Zo(this,b,a,this);a.He=!1}};
function Zo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Nb(!0);f instanceof hf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,Zo(f,b,c,d));if(f instanceof W)f.pd(b),c.Yj(f,d);else if(f instanceof U)for(f=f.labelNodes;f.next();)f.value.pd(b)}a.isSubGraphExpanded=!0}
hf.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.jk().iterator;b.next();)if(e=b.value,e instanceof U&&(e.suspendsRouting&&a.add(e),e.rd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Dh()||e instanceof W&&e.isLinkLabel)){var g=
e.position,h=e.location;g.u()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.u()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof U&&(e.suspendsRouting=a.contains(e),e.rd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.u()?e.move(f):e.Ua(),Kj(e)&&e.Ua();J.free(f)}};
na.Object.defineProperties(hf.prototype,{placeholder:{get:function(){return this.Ra}},computesBoundsAfterDrag:{get:function(){return 0!==(this.R&2048)},set:function(a){var b=0!==(this.R&2048);b!==a&&(this.R^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.R&4096)},set:function(a){var b=0!==(this.R&4096);b!==a&&(this.R^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.R&8192)},set:function(a){var b=0!==(this.R&8192);b!==a&&(this.R^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.R&16384)},set:function(a){var b=0!==(this.R&16384);b!==a&&(this.R^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.Eo.iterator}},
layout:{get:function(){return this.Ac},set:function(a){var b=this.Ac;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.Ac=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Nh=!0);this.g("layout",b,a);null!==c&&c.Fb()}}},memberAdded:{get:function(){return this.Do},set:function(a){var b=this.Do;b!==a&&(this.Do=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.Fo},
set:function(a){var b=this.Fo;b!==a&&(this.Fo=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.R&256)},set:function(a){var b=0!==(this.R&256);b!==a&&(this.R^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.R&512)},
set:function(a){var b=0!==(this.R&512);if(b!==a){this.R^=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.Ra&&this.Ra.s(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.R&1024)},set:function(a){var b=
0!==(this.R&1024);b!==a&&(this.R^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.Ip},set:function(a){var b=this.Ip;b!==a&&(this.Ip=a,this.g("subGraphExpandedChanged",b,a))}},Fh:{get:function(){return 0!==(this.R&32768)},set:function(a){0!==(this.R&32768)!==a&&(this.R^=32768)}}});hf.prototype.expandSubGraph=hf.prototype.expandSubGraph;hf.prototype.collapseSubGraph=hf.prototype.collapseSubGraph;
hf.prototype.findSubGraphParts=hf.prototype.jk;hf.prototype.findContainingGroupChain=hf.prototype.Nz;hf.prototype.findExternalNodesConnected=hf.prototype.Oz;hf.prototype.findExternalLinksConnected=hf.prototype.ov;hf.prototype.ensureBounds=hf.prototype.Sa;hf.className="Group";function mg(a){Y.call(this);this.mb=pc;this.rp=new N(NaN,NaN,NaN,NaN);a&&Object.assign(this,a)}ma(mg,Y);mg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.mb=this.mb.I();a.rp=this.rp.copy()};
mg.prototype.xh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return ac(0,0,b.width,b.height,a.x,a.y)};
mg.prototype.qm=function(){var a=this.part;null!==a&&(a instanceof hf||a instanceof we)||C("Placeholder is not inside a Group or Adornment.");if(a instanceof hf){var b=this.computeBorder(this.rp),c=this.minSize,d=this.qc;Tb(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);this.ue(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.Cv(a)||isNaN(b.x)||
isNaN(b.y)||(c=J.alloc(),c.Ui(b,a.locationSpot),c.A(a.location)||(a.location=c),J.free(c))}else{b=this.qc;c=this.mb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Li();var g=0;f instanceof uf&&(g=f.strokeWidth);var h=f.wf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(h=f.da("Selection"===a.category?sc:a.locationSpot,J.alloc()),a.location=h,J.free(h));isNaN(l)||isNaN(g)?(a=f.da(sc,J.alloc()),l=N.allocAt(a.x,a.y,0,0),l.Le(f.da(Cc,a)),l.Le(f.da(wc,a)),l.Le(f.da(Ac,
a)),Tb(b,l.width+d||0,l.height+e||0),this.ue(-c.left,-c.top,b.width,b.height),J.free(a),N.free(l)):(Tb(b,l+d||0,g+e||0),this.ue(-c.left,-c.top,b.width,b.height))}};mg.prototype.vh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
mg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof hf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.rp.u()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.rp,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.mb;b instanceof hf&&!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 hf&&b.computesBoundsIncludingLocation&&b.location.u()&&a.Le(b.location);return a};
mg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof hf))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 U){if(!b.computesBoundsIncludingLinks)continue;if(mj(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(mg.prototype,{padding:{get:function(){return this.mb},set:function(a){"number"===typeof a&&(a=new ic(a));var b=this.mb;b.A(a)||(this.mb=a=a.I(),this.g("padding",b,a),this.s())}}});mg.className="Placeholder";
function U(a){V.call(this,X.Link);this.Ia=8;this.Se=null;this.Te="";this.kf=this.On=null;this.lf="";this.Op=null;this.Ek=Vf;this.rn=0;this.tn=Vf;this.un=NaN;this.Oj=$o;this.Dp=.5;this.ld=null;this.Bb=(new E).freeze();this.cf=this.Zg=null;this.Gl=new N;this.ma=new Q;this.C=this.o=this.If=this.Mf=null;this.Ru=new J;this.qr=this.px=this.ox=null;this.Rt=NaN;this.P=null;this.j=[];a&&Object.assign(this,a)}ma(U,V);
U.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.Ia=this.Ia&-113;a.Te=this.Te;a.On=this.On;a.lf=this.lf;a.Op=this.Op;a.Ek=this.Ek;a.rn=this.rn;a.tn=this.tn;a.un=this.un;a.Oj=this.Oj;a.Dp=this.Dp;null!==this.P&&(a.P=this.P.copy())};t=U.prototype;t.sf=function(a){V.prototype.sf.call(this,a);this.Te=a.Te;this.lf=a.lf;a.Zg=null;a.Ua();a.If=this.If;var b=a.fromPort;null!==b&&Mo(b);a=a.toPort;null!==a&&Mo(a)};
t.gb=function(a){a.classType===U?2===(a.value&2)?this.routing=a:a===Yf||a===Uf||a===Tf?this.curve=a:a===ap||a===bp||a===cp?this.adjusting=a:a!==$o&&a!==Vf&&C("Unknown Link enum value for a Link property: "+a):V.prototype.gb.call(this,a)};t.Hc=function(){null===this.P&&(this.P=new cl)};t.Si=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(nj(a)||oj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),nj(a)||oj(a))?!1:!0};t.Zv=function(){return!1};
t.gt=function(){};t.Jc=function(){return!1};U.prototype.computeAngle=function(a,b,c){return U.computeAngle(b,c)};U.computeAngle=function(a,b){switch(a){default:case Vf:a=0;break;case Rm:a=b;break;case Km:a=b+90;break;case Mm:a=b-90;break;case dp:a=b+180;break;case Sm:a=L.vq(b);90<a&&270>a&&(a-=180);break;case Lm:a=L.vq(b+90);90<a&&270>a&&(a-=180);break;case Nm:a=L.vq(b-90);90<a&&270>a&&(a-=180);break;case Om:a=L.vq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return L.vq(a)};
function Io(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.Rx(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Qh;if(c!==b){null!==c&&Do(c,a);a.Qh=b;null!==b&&Co(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.rd||a.ox!==c&&a.px!==c||a.Ua()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=U.prototype;
t.Ch=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&V.prototype.Ch.call(this)};t.nq=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.gA=function(a){var b=this.fromPort;return a===b?this.toPort:b};function Qo(a,b){null===a.ld&&(a.ld=new G);a.ld.add(b);a.s()}
t.pq=function(a){V.prototype.pq.call(this,a);ep(this)&&this.rq(this.actualBounds);if(!a){a=this.Se;var b=null;null!==a&&(b=this.fromPort,Oo(a,this,b));var c=this.kf;if(null!==c){var d=this.toPort;c===a&&d===b||Oo(c,this,d)}fp(this)}};t.qq=function(a){V.prototype.qq.call(this,a);ep(this)&&this.rq(this.actualBounds);if(!a){a=this.Se;var b=null;null!==a&&(b=this.fromPort,Po(a,this,b));var c=this.kf;if(null!==c){var d=this.toPort;c===a&&d===b||Po(c,this,d)}gp(this)}};
t.fk=function(){this.rd=!0;if(null!==this.ld){var a=this.diagram;if(null!==a)for(var b=this.ld.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};U.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
U.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));cf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
U.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};U.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};
U.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(vb),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()===Yf))return this.ma.uv(.5,a),a.add(this.i(0)),c=this.ma.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===Yf){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.pz(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};
U.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Oa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Yf))return this.ma.Xx(.5);if(this.computeCurve()===Yf&&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.oz(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).Oa(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).Oa(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.Oa(d)};t=U.prototype;t.i=function(a){return this.Bb.m[a]};t.Mc=function(a,b){this.Bb.Lc(a,b)};t.L=function(a,b,c){this.Bb.Lc(a,new J(b,c))};t.pA=function(a,b){this.Bb.ub(a,b)};
t.l=function(a,b,c){this.Bb.ub(a,new J(b,c))};t.ce=function(a){this.Bb.add(a)};t.pf=function(a,b){this.Bb.add(new J(a,b))};t.Rv=function(a){this.Bb.eb(a)};t.ak=function(){this.Bb.clear()};
function cf(a,b,c){if(0!==b||0!==c)if(0===a.pointsCount)a.defaultFromPoint&&a.defaultFromPoint.offset(b,c),a.defaultToPoint&&a.defaultToPoint.offset(b,c);else{for(var d=a.rd,e=new E,f=a.Bb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Bb;a.Bb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.rb?a.s():(a.ae.h(a.ae.x+b,a.ae.y+c),a.ka.h(a.ka.x+b,a.ka.y+c),zl(a));d?hp(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&(a.defaultToPoint=
a.i(a.pointsCount-1)));null!==g&&g.animationManager.rb&&(b=g.animationManager,a.cf=e,b.Il.add(a));a.g("points",f,e)}}t.Hh=function(){null===this.Zg&&(this.Zg=this.Bb,this.Bb=this.Bb.copy())};
t.rf=function(){if(null!==this.Zg){for(var a=this.Zg,b=this.Bb,c=Infinity,d=Infinity,e=a.m,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.m,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.cc(!0);break}}else this.cc(!0);this.Zg=null;c=this.diagram;null!==c&&c.animationManager.rb&&(c=c.animationManager,this.cf=b,c.Il.add(this));hp(this);
this.g("points",a,b)}};t.Tv=function(){null!==this.Zg&&(this.Bb=this.Zg,this.Zg=null)};function hp(a){0===a.Bb.count?a.rd=!1:(a.rd=!0,a.qr=null,a.Rt=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),ip(a,!1))}
t.Ua=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Ts.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.cf&&!a.isTicking&&a.isAnimating&&(this.cf=null)}a=this.path;null!==a&&(this.rd=!1,this.s(),a.s())}};
t.pg=function(){if(!this.rd&&!this.computingPoints){var a=!0;try{this.computingPoints=!0,this.Hh(),a=this.computePoints()}catch(b){this.computingPoints=!1,this.Tv()}finally{this.computingPoints=!1,a?this.rf():this.Tv()}}};
U.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(jp||(jp=new W,jp.desiredSize=Ib,jp.Sa()),this.defaultFromPoint&&(jp.location=this.defaultFromPoint,jp.Sa(),b=a=jp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.ox=a;if(null===a||!a.location.u())return!1;for(;!(null===b||b.actualBounds.u()&&b.Bf());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(kp||(kp=new W,
kp.desiredSize=Ib,kp.Sa()),this.defaultToPoint&&(kp.location=this.defaultToPoint,kp.Sa(),e=d=kp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.px=d;if(null===d||!d.location.u())return!1;for(;!(null===e||e.actualBounds.u()&&e.Bf());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=lp(g),k=lp(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===Yf;this.Mf=l&&!m?n=!0:!1;var p=this.computeAdjusting()===
Vf||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.ak(),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,v=q;L.w(k,0)?v=0<h?v-l:v+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=
(0>k?-1:1)*n+r,v=m*(u-r)+q);r=f.x+2*h/3;q=f.y+2*k/3;var w=r,z=q;L.w(k,0)?z=0<h?z-l:z+l:(w=(0>k?-1:1)*n+r,z=m*(w-r)+q);this.ak();this.ce(f);this.pf(u,v);this.pf(w,z);this.ce(p);this.Mc(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.Mc(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.w(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.pf(f,h),this.ce(e);else{this.ce(d);this.ce(e);h=N.alloc();b.Mi(h);k=h.$(e);p.Mi(h);l=h.$(d);if(k||l)g=b.da(mp(g),new J),this.Mc(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.da(mp(c),new J),this.Mc(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));N.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.ak();var y=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);r=u=q=0;if(m||!h||l)v=this.computeEndSegmentLength(a,b,g,!0),r=this.getLinkDirection(a,
b,n,g,!0,m,d,e),l&&(h||g.A(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(r-=m?90:30,0>y&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(v+=Math.abs(y)*(m?1:2)),0===r?q=v:90===r?u=v:180===r?q=-v:270===r?u=-v:(q=v*Math.cos(r*Math.PI/180),u=v*Math.sin(r*Math.PI/180)),g.wc()&&l&&(v=b.da(yc,J.alloc()),w=J.allocAt(v.x+1E3*q,v.y+1E3*u),this.getLinkPointFromPoint(a,b,v,w,!0,n),J.free(v),J.free(w));v=this.getLinkPoint(d,e,c,!1,m,a,b);var A=z=w=0;if(m||!k||l){var B=this.computeEndSegmentLength(d,e,c,!1);A=this.getLinkDirection(d,
e,v,c,!1,m,a,b);l&&(k||g.A(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(A+=m?0:30,0>y&&(A+=180));0>A?A+=360:360<=A&&(A-=360);l&&(B+=Math.abs(y)*(m?1:2));0===A?w=B:90===A?z=B:180===A?w=-B:270===A?z=-B:(w=B*Math.cos(A*Math.PI/180),z=B*Math.sin(A*Math.PI/180));c.wc()&&l&&(c=e.da(yc,J.alloc()),g=J.allocAt(c.x+1E3*w,c.y+1E3*z),this.getLinkPointFromPoint(d,e,c,g,!1,v),J.free(c),J.free(g))}c=n;if(m||!h||l)c=new J(n.x+q,n.y+u);g=v;if(m||!k||l)g=new J(v.x+w,v.y+z);!p&&!m&&h&&3<f&&this.adjustPoints(0,n,f-2,g)?this.Mc(f-
1,v):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,v)?this.Mc(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.Mc(0,n),this.Mc(f-1,v)):(this.ak(),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(v))}return!0};function np(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}
U.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.de;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.kk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function op(a,b){var c=b.bp;null===c&&(c=new pp,c.port=b,c.node=b.part,b.bp=c);return qp(c,a)}
U.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.hb()&&!lp(c))return b.da(c,h),h;if(c.Kc()){var k=op(this,b);if(null!==k){h.assign(k.tq);if(e&&this.routing===rp){var l=op(this,g);if(null!==l&&k.fm<l.fm){k=J.alloc();l=J.alloc();var m=new N(b.da(sc,k),b.da(Cc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.zf(Fc)||c.zf(Gc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.zf(Dc)||c.zf(Hc))&&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(mp(c),J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=np(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.da(mp(k),f),e&&(g=np(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
U.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.hb())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.Kc()&&(k=op(this,b),null!==k))switch(k.xc){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(yc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?np(k,h.copy()):c):(c=J.alloc(),h=h.da(yc,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.wc()&&g.Fd(a)&&(k+=180,360<=k&&(k-=360));if(lp(d))return k;a=b.Li();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};U.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Kc()&&(a=op(this,b),null!==a))return a.mv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
U.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=yc:(b=this.fromSpot,b.Lb()&&(b=a.fromSpot),a=b===Vc?rc:b)):(a=b?b:this.toPort,null===a?a=yc:(b=this.toSpot,b.Lb()&&(b=a.toSpot),a=b===Vc?rc:b));return a};function lp(a){return a===rc||.5===a.x&&.5===a.y}function mp(a){return.5===a.x&&.5===a.y?a:yc}
U.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==Vf&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.bp;a=null!==a?qp(a,this):null;return null!==a?a.tq:b.da(yc)};U.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};
U.prototype.vf=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=qd.alloc(),g.reset());g.multiply(this.transform);if(this.wh(a,g))return dn(this,b,c,e),void 0===f&&qd.free(g),!0;if(this.Ic(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.T.m,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=qd.alloc();n.set(g);
if(m instanceof X)h=m.vf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof uf)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.wh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.De(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var v=J.alloc(),w=J.alloc(),z=J.alloc(),y=qd.alloc();y.set(q);y.Hv(m.transform);y.Ns();w.x=p;w.y=u;w.transform(y);v.x=h;v.y=u;v.transform(y);q=!1;Dn(m,v,w,z)?q=!0:(v.x=p,v.y=r,v.transform(y),Dn(m,v,w,z)?q=!0:(w.x=
h,w.y=r,w.transform(y),Dn(m,v,w,z)?q=!0:(v.x=h,v.y=u,v.transform(y),Dn(m,v,w,z)&&(q=!0))));qd.free(y);J.free(v);J.free(w);J.free(z);h=q}}else h=m.wh(h,n)}else h=gl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));qd.free(n)}}}void 0===f&&qd.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&qd.free(g);return!1};
U.prototype.computeCurve=function(){if(null===this.Mf){var a=this.fromPort,b=this.isOrthogonal;this.Mf=null!==a&&a===this.toPort&&!b}return this.Mf?Yf:this.curve};U.prototype.computeCorner=function(){if(this.curve===Yf)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
U.prototype.findMidLabel=function(){for(var a=this.path,b=this.T.m,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};
U.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=sp;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===Rm||d===Sm||d===dp?a=Math.max(a,e):d===Mm||d===Nm||d===Km||d===Lm?a=Math.max(a,g):(b=b.da(yc).Oa(c.da(yc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===Yf&&(a*=1.333)}}return a};U.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===Vf&&c.Ua()}};
U.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=tp;var b=this.If;if(null!==b){for(var c=Fa(),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.Ws===this.fromNode&&(a=-a);Ia(c)}}return a};U.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
U.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.If};
U.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===bp)return!1;e===cp&&(e=ap)}switch(e){case bp:var f=this.i(a),g=this.i(c);if(!f.Ta(b)||!g.Ta(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.Mc(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.Mc(c,d)}}return!0;case cp:f=this.i(a);n=this.i(c);if(!f.Ta(b)||!n.Ta(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.Mc(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,v=b.y,w=.5;0!==l&&(w=((e-u)*(e-g)+(f-v)*(f-n))/l);var z=e+w*(g-e),y=f+w*(n-f);b=Math.sqrt((u-z)*(u-z)+(v-y)*(v-y));v<q*(u-z)+y&&(b=-b);0<q&&(b=-b);u=h+w*(k-h);w=m+w*(p-m);0!==q?(b=u+b/r,this.L(a,b,w-(b-u)/q)):this.L(a,u,w+b)}this.Mc(c,d)}return!0;case ap: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.w(e.y,f.y)?L.w(f.x,g.x)?m=b.y:L.w(f.y,g.y)&&(h=b.x):L.w(e.x,f.x)&&(L.w(f.y,g.y)?h=b.x:L.w(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.w(e.y,f.y)?L.w(f.x,g.x)?m=d.y:L.w(f.y,g.y)&&(h=d.x):L.w(e.x,f.x)&&(L.w(f.y,g.y)?h=d.x:L.w(f.x,g.x)&&(m=d.y)),this.L(c-1,h,m),Kj(this))){this.L(a+1,n,l);this.L(c-1,k,p);c=!1;break a}this.Mc(a,b);this.Mc(c,d);c=!0}return c;default:return!1}};
U.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.u()&&k.u()){h.Gc(up,up);k.Gc(up,up);h.Le(a);k.Le(c);var l=J.alloc(),m=J.alloc();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)l.h(c.x,a.y),m.h(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.h(a.x,c.y);m.h((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.h(Math.max((a.x+c.x)/2,a.x),a.y),m.h(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.h(c.x,a.y),m.h(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.h(a.x,c.y);m.h((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.h(Math.min((a.x+c.x)/2,a.x),a.y),m.h(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.h(a.x,c.y),m.h((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.h(c.x,a.y);m.h(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.h(a.x,Math.max((a.y+c.y)/2,a.y)),m.h(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.h(a.x,c.y),m.h((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.h(c.x,a.y);m.h(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.h(a.x,Math.min((a.y+c.y)/2,a.y)),m.h(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=c;if(this.isAvoiding){var p=this.diagram;if(null===p||e===f||this.layer.isTemporary||!nk(p)||h.$(n)&&!f.Fd(e)||k.$(a)&&!e.Fd(f))b=!1;else{var r=ok(p,!0,this.containingGroup,null);if(17!==this.segmentIndex&&r.qk(Math.min(a.x,l.x),
Math.min(a.y,l.y),Math.abs(a.x-l.x),Math.abs(a.y-l.y))&&r.qk(Math.min(l.x,m.x),Math.min(l.y,m.y),Math.abs(l.x-m.x),Math.abs(l.y-m.y))&&r.qk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y)))b=!1;else{e=a;f=n;var q=c=null;if(p.isVirtualized){p=r.bounds.copy();p.Gc(-r.bq,-r.aq);var u=J.alloc();tk(r,a.x,a.y)||(L.yf(p.x,p.y,p.x+p.width,p.y+p.height,a.x,a.y,l.x,l.y,u)?(c=a=u.copy(),b=u.Oa(l)):L.yf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,m.x,m.y,u)?(c=a=u.copy(),b=u.Oa(m)):L.yf(p.x,
p.y,p.x+p.width,p.y+p.height,m.x,m.y,n.x,n.y,u)&&(c=a=u.copy(),b=u.Oa(n)));tk(r,n.x,n.y)||(L.yf(p.x,p.y,p.x+p.width,p.y+p.height,n.x,n.y,m.x,m.y,u)?(q=n=u.copy(),d=m.Oa(u)):L.yf(p.x,p.y,p.x+p.width,p.y+p.height,m.x,m.y,l.x,l.y,u)?(q=n=u.copy(),d=l.Oa(u)):L.yf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,a.x,a.y,u)&&(q=n=u.copy(),d=a.Oa(u)));J.free(u)}h=h.copy().Nc(k);h.Gc(r.bq*r.it,r.aq*r.it);vp(r,a,b,n,d,h,!0);k=wp(r,n.x,n.y);!r.abort&&k>=xp&&(sk(r),h.Gc(r.bq*r.ly,r.aq*r.my),vp(r,a,b,n,d,h,!1),k=wp(r,
n.x,n.y));if(!r.abort&&k<xp&&wp(r,n.x,n.y)!==uk){yp(this,r,n.x,n.y,d,!0,g);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=n.y):(h.x=n.x,h.y=a.y),this.L(2,h.x,h.y),this.l(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)L.w(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.w(h.y,g.y)?(Math.abs(a.y-h.y)<=r.aq/2&&(this.L(2,h.x,a.y),this.L(3,g.x,a.y)),this.l(2,h.x,a.y)):this.L(2,a.x,h.y);else if(90===b||270===b)L.w(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.w(h.x,g.x)?(Math.abs(a.x-h.x)<=r.bq/2&&(this.L(2,a.x,h.y),this.L(3,a.x,g.y)),this.l(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.l(2,a.x,g.y):this.l(2,g.x,a.y):0===b||180===b?this.l(2,e.x,c.y):this.l(2,c.x,e.y));null!==q&&(0===d||180===d?this.pf(f.x,q.y):this.pf(q.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.ce(l.copy()),this.ce(m.copy()));J.free(l);J.free(m)}};
U.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Kc()||this.computeSpot(!1,this.toPort).Kc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function Kj(a){if(null===a.diagram||!a.isAvoiding||!nk(a.diagram))return!1;var b=a.points.m,c=b.length;if(4>c)return!1;a=ok(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.qk(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 yp(a,b,c,d,e,f,g){var h=b.bq,k=b.aq,l=wp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>zp&&wp(b,m,n)!==l-1&&(wp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):wp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):wp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):wp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>zp&&wp(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>zp)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>zp&&(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),wp(b,g,m)===l-1?yp(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),wp(b,g,m)===l-1&&yp(a,b,g,m,f,!1,f)));a.pf(c,d)}U.prototype.Kz=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Bb(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=Bb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};
U.prototype.cc=function(a){this.Lm=!1;a&&this.s()};U.prototype.sk=function(a){if(!a){if(!1===this.rd)return;a=this.nb();if(this.Lm&&(null===a||null!==a.geometry))return}this.ma=this.makeGeometry();a=this.path;if(null!==a){a.ma=this.ma;for(var b=this.T.m,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof uf&&(e.ma=this.ma)}}};
U.prototype.makeGeometry=function(){var a=this.ma,b=this.pointsCount;if(2>b)return a.type=Q.j,this.Lm=!0,a;var c=!1,d=this.diagram;null!==d&&ep(this)&&d.Wh.contains(this)&&(0!==this.Gl.width||0!==this.Gl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Bb.m;var g=this.computeCurve();if(g===Yf&&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.Ru.x;k-=this.Ru.y;e.x-=d;e.y-=k;if(2!==b||ep(this)){a.type=Q.o;h=vd(a);0!==this.computeShortLength(!0)&&(e=Ap(this,e,!0,f));wd(h,e.x,e.y,!1);if(g===Yf&&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=Ap(this,e,!1,f)),xd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){b=J.allocAt(d,k);c=J.alloc();c.assign(this.i(1));f=J.allocAt(d,k);e=J.allocAt(d,k);g=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=g,r=l,q=this.i(Bp(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 v=p.x;p=p.y;var w=r.x;r=r.y;var z=q.x;q=q.y;var y=u*Cp(v,p,w,r);u*=Cp(w,r,z,q);L.aa(p,r)&&L.aa(w,z)&&(w>v?q>r?(f.x=
w-y,f.y=r-y,e.x=w+u,e.y=r+u):(f.x=w-y,f.y=r+y,e.x=w+u,e.y=r-u):q>r?(f.x=w+y,f.y=r-y,e.x=w-u,e.y=r+u):(f.x=w+y,f.y=r+y,e.x=w-u,e.y=r-u));L.aa(v,w)&&L.aa(r,q)&&(r>p?(z>w?(f.x=w-y,f.y=r-y,e.x=w+u):(f.x=w+y,f.y=r-y,e.x=w-u),e.y=r+u):(z>w?(f.x=w-y,f.y=r+y,e.x=w+u):(f.x=w+y,f.y=r+y,e.x=w-u),e.y=r-u));if(L.aa(v,w)&&L.aa(w,z)||L.aa(p,r)&&L.aa(r,q))v=.5*(v+z),p=.5*(p+q),f.x=v,f.y=p,e.x=v,e.y=p;1===n?(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y)):2===n&&L.aa(g.x,this.i(0).x)&&L.aa(g.y,this.i(0).y)&&(c.x=.5*(g.x+l.x),
c.y=.5*(g.y+l.y));xd(h,c.x-d,c.y-k,f.x-d,f.y-k,l.x-d,l.y-k);b.set(f);c.set(e);g=l}}l=g.x;g=g.y;m=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(m=Ap(this,m.copy(),!1,pb));l=.5*(l+m.x);g=.5*(g+m.y);xd(h,e.x-d,e.y-k,l-d,g-k,m.x-d,m.y-k);J.free(b);J.free(c);J.free(f);J.free(e)}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=Ap(this,g.copy(),!1,pb)),xd(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=Bp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=Ap(this,m.copy(),!1,pb)),Dp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Dp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Bp(this,m,n+1,n<b-3);n=-d;v=-k;p=m;w=this.i(l);u=c;if(L.w(f.y,p.y)&&L.w(p.x,w.x))if(q=Math.min(g,Math.abs(p.x-e.x)/2),q=y=Math.min(q,Math.abs(w.y-p.y)/2),L.w(q,0))Dp(this,h,n,v,f,p,u),f.assign(p);else{var A=
p.x,B=p.y;r=A;z=B;p.x>f.x?A=p.x-q:A=p.x+q;w.y>p.y?z=p.y+y:z=p.y-y;w=J.allocAt(A,B);Dp(this,h,n,v,f,w,u);J.free(w);Ad(h,p.x+n,p.y+v,r+n,z+v);f.h(r,z)}else L.w(f.x,p.x)&&L.w(p.y,w.y)?(q=Math.min(g,Math.abs(p.y-e.y)/2),q=y=Math.min(q,Math.abs(w.x-p.x)/2),L.w(y,0)?(Dp(this,h,n,v,f,p,u),f.assign(p)):(A=p.x,B=p.y,r=A,z=B,p.y>f.y?B=p.y-q:B=p.y+q,w.x>p.x?r=p.x+y:r=p.x-y,w=J.allocAt(A,B),Dp(this,h,n,v,f,w,u),J.free(w),Ad(h,p.x+n,p.y+v,r+n,z+v),f.h(r,z))):(Dp(this,h,n,v,f,p,u),f.assign(p));e.assign(m);n=l}J.free(f)}Dd=
h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Ap(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=Ap(this,h,!1,f)),a.type=Q.j,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Lm=!0;return a};function Cp(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 Ap(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=Cp(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=Cp(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 Bp(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}U.prototype.computeJumpLength=function(){return 10};
function Dp(a,b,c,d,e,f,g){if(!g&&ep(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=Ep(a,e,f,k));if(0<l)if(L.w(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===Uf?wd(b,r,q,!1):xd(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===Uf?wd(b,n,r,!1):xd(b,p,m,n,m,n,r)}else if(L.w(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===Uf?wd(b,q,n,!1):xd(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===Uf?wd(b,r,m,!1):xd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)}
function Ep(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Fa.m;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof U){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&ep(k)){var l=k.routeBounds;l.u()&&a.routeBounds.Ic(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Bf()&&Fp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Fp(a,b,c,d){for(var e=L.w(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,v=l.y;if(!L.w(m,p)){if(L.w(n,r)&&L.w(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,v)<n&&Math.max(g,v)>n&&!L.w(g,v)){h.x=q;h.y=n;m=!0;break a}}else if(!L.w(n,r)&&
L.w(g,v)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!L.w(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}J.free(h)}function ep(a){a=a.curve;return a===Tf||a===Uf}function ip(a,b){if(b||ep(a))b=a.diagram,null===b||b.animationManager.isTicking||b.Wh.contains(a)||0===a.Gl.width&&0===a.Gl.height||b.Wh.add(a,a.Gl.copy())}
U.prototype.rq=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.m;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof U&&(k===this?f=!0:f&&Gp(this,k,a))}}else if(d)for(f=e.Fa.m,e=f.length,g=0;g<e;g++)h=f[g],h instanceof U&&Gp(this,h,a)}}}};
function Gp(a,b,c){if(null!==b&&b.Lm&&b.rd&&ep(b)){var d=b.routeBounds;d.u()&&(a.routeBounds.Ic(d)||c.Ic(d))&&(a.usesSamePort(b)||b.cc(!1))}}U.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.Ta(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ta(a)||d.Ta(a)||b.Ta(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};
U.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};U.prototype.Nb=function(a){V.prototype.Nb.call(this,a);null!==this.If&&this.If.mm();if(null!==this.ld)for(var b=this.ld.iterator;b.next();)b.value.Nb(a)};U.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?ap:this.Ek};
function fp(a){var b=a.Se;if(null!==b){var c=a.kf;if(null!==c&&isNaN(a.curviness)){for(var d=a.Te,e=a.lf,f=a=null,g=b.ab.m,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Se===b&&l.Te===d&&l.kf===c&&l.lf===e||l.Se===c&&l.Te===e&&l.kf===b&&l.lf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Lo(b,c,d,e);null===f&&(f=new Hp(b,d,c,e),Ko(b,f),Ko(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].If=f;f.mm()}}}}
function gp(a){var b=a.If;null!==b&&isNaN(a.curviness)&&(a.If=null,a=b.links.indexOf(a),0<=a&&(Ea(b.links,a),b.mm()))}U.prototype.Dh=function(){return!0};
na.Object.defineProperties(U.prototype,{fromNode:{get:function(){return this.Se},set:function(a){var b=this.Se;if(b!==a){var c=this.fromPort;null!==b&&(this.kf!==b&&Po(b,this,c),gp(this),this.B(2));this.Se=a;null!==a&&this.Nb(a.isVisible());this.Mf=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.kf!==a&&Oo(a,this,e),fp(this),this.B(1));this.g("fromNode",b,a);Io(this)}}},fromPortId:{get:function(){return this.Te},set:function(a){var b=this.Te;if(b!==a){var c=this.fromPort;null!==c&&Mo(c);gp(this);this.Te=a;var d=this.fromPort;null!==d&&Mo(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Qi()&&g.Xv(f,a)}c!==d&&(this.Mf=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)));fp(this);
this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.Se;return null===a?null:a.Es(this.Te)}},fromPortChanged:{get:function(){return this.On},set:function(a){var b=this.On;b!==a&&(this.On=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.kf},set:function(a){var b=this.kf;if(b!==a){var c=this.toPort;null!==b&&(this.Se!==b&&Po(b,this,c),gp(this),this.B(2));this.kf=a;null!==a&&this.Nb(a.isVisible());
this.Mf=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.Se!==a&&Oo(a,this,e),fp(this),this.B(1));this.g("toNode",b,a);Io(this)}}},toPortId:{get:function(){return this.lf},set:function(a){var b=this.lf;if(b!==a){var c=this.toPort;null!==c&&Mo(c);gp(this);this.lf=a;var d=this.toPort;null!==d&&Mo(d);
var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Qi()&&g.aw(f,a)}c!==d&&(this.Mf=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)));fp(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.kf;return null===a?null:a.Es(this.lf)}},toPortChanged:{get:function(){return this.Op},set:function(a){var b=this.Op;b!==a&&(this.Op=a,this.g("toPortChanged",b,a))}},
fromSpot:{get:function(){return null!==this.P?this.P.Jg:Vc},set:function(a){this.Hc();var b=this.P.Jg;b.A(a)||(a=a.I(),this.P.Jg=a,this.g("fromSpot",b,a),(b.Kc()||a.Kc())&&null!==this.fromNode&&Mo(this.fromPort),this.Ua())}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Hg:NaN},set:function(a){this.Hc();var b=this.P.Hg;b!==a&&(0>a&&xa(a,">= 0",U,"fromEndSegmentLength"),this.P.Hg=a,this.g("fromEndSegmentLength",b,a),this.Ua())}},
fromShortLength:{get:function(){return null!==this.P?this.P.Ig:NaN},set:function(a){this.Hc();var b=this.P.Ig;b!==a&&(this.P.Ig=a,this.cc(!0),this.g("fromShortLength",b,a))}},toSpot:{get:function(){return null!==this.P?this.P.ph:Vc},set:function(a){this.Hc();var b=this.P.ph;b.A(a)||(a=a.I(),this.P.ph=a,this.g("toSpot",b,a),(b.Kc()||a.Kc())&&null!==this.toNode&&Mo(this.toPort),this.Ua())}},toEndSegmentLength:{
get:function(){return null!==this.P?this.P.nh:NaN},set:function(a){this.Hc();var b=this.P.nh;b!==a&&(0>a&&xa(a,">= 0",U,"toEndSegmentLength"),this.P.nh=a,this.g("toEndSegmentLength",b,a),this.Ua())}},toShortLength:{get:function(){return null!==this.P?this.P.oh:NaN},set:function(a){this.Hc();var b=this.P.oh;b!==a&&(this.P.oh=a,this.cc(!0),this.g("toShortLength",b,a))}},isLabeledLink:{get:function(){return null===this.ld?!1:0<this.ld.count}},
labelNodes:{get:function(){return null===this.ld?Za:this.ld.iterator}},relinkableFrom:{get:function(){return 0!==(this.Ia&1)},set:function(a){var b=0!==(this.Ia&1);b!==a&&(this.Ia^=1,this.g("relinkableFrom",b,a),this.Kb())}},relinkableTo:{get:function(){return 0!==(this.Ia&2)},set:function(a){var b=0!==(this.Ia&2);b!==a&&(this.Ia^=2,this.g("relinkableTo",b,a),this.Kb())}},resegmentable:{
get:function(){return 0!==(this.Ia&4)},set:function(a){var b=0!==(this.Ia&4);b!==a&&(this.Ia^=4,this.g("resegmentable",b,a),this.Kb())}},isTreeLink:{get:function(){return 0!==(this.Ia&8)},set:function(a){var b=0!==(this.Ia&8);b!==a&&(this.Ia^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Bk(this.fromNode),null!==this.toNode&&Bk(this.toNode))}},path:{get:function(){var a=this.nb();return a instanceof uf?a:null}},routeBounds:{
get:function(){this.pg();var a=this.Gl,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.Le(e)}else if(this.computeCurve()===Yf&&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.cm(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.cm(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.Le(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Le(f);this.Ru.h(b-a.x,c-a.y)}return a}},midPoint:{get:function(){this.pg();return this.computeMidPoint(new J)}},
midAngle:{get:function(){this.pg();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.qr){this.rd||hp(this);for(var a=this.qr=[],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.tf(e));a.push(d)}}return this.qr}},flattenedTotalLength:{get:function(){var a=this.Rt;if(isNaN(a)){for(var b=
this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Rt=a}return a}},points:{get:function(){return this.Bb},set:function(a){var b=this.Bb;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 C("Link.points value is not an instance of List or Array: "+a);c.freeze();this.Bb=c;this.cc(!0);hp(this);a=this.diagram;null!==a&&(a.Pi||a.undoManager.isUndoingRedoing||a.Ts.add(this),a.animationManager.rb&&(a=a.animationManager,this.cf=c,a.Il.add(this)));this.g("points",b,c)}}},pointsCount:{
get:function(){return this.Bb.count}},rd:{get:function(){return 0!==(this.Ia&16)},set:function(a){0!==(this.Ia&16)!==a&&(this.Ia^=16)}},suspendsRouting:{get:function(){return 0!==(this.Ia&32)},set:function(a){0!==(this.Ia&32)!==a&&(this.Ia^=32)}},computingPoints:{get:function(){return 0!==(this.Ia&64)},set:function(a){0!==(this.Ia&64)!==a&&(this.Ia^=64)}},defaultFromPoint:{
get:function(){return this.o},set:function(a){this.o=a.copy()}},defaultToPoint:{get:function(){return this.C},set:function(a){this.C=a.copy()}},isOrthogonal:{get:function(){return 2===(this.Oj.value&2)}},isAvoiding:{get:function(){return 4===(this.Oj.value&4)}},Lm:{get:function(){return 0!==(this.Ia&128)},set:function(a){0!==(this.Ia&128)!==a&&(this.Ia^=128)}},geometry:{
get:function(){this.Lm||(this.pg(),this.ma=this.makeGeometry());return this.ma}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!lp(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!lp(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Ek},set:function(a){var b=this.Ek;b!==
a&&(this.Ek=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.rn},set:function(a){var b=this.rn;b!==a&&(this.rn=a,this.cc(!0),this.g("corner",b,a))}},curve:{get:function(){return this.tn},set:function(a){var b=this.tn;b!==a&&(this.tn=a,this.Ua(),this.cc(!0),ip(this,b===Uf||b===Tf||a===Uf||a===Tf),this.g("curve",b,a))}},curviness:{get:function(){return this.un},set:function(a){var b=this.un;b!==
a&&(this.un=a,this.Ua(),this.cc(!1),this.g("curviness",b,a))}},routing:{get:function(){return this.Oj},set:function(a){var b=this.Oj;b!==a&&(this.Oj=a,this.Mf=null,this.Ua(),ip(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.cc(!0),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;
if(null!==a&&a.model.Qi())return a.model.mc(this.data)}}});U.prototype.invalidateOtherJumpOvers=U.prototype.rq;U.prototype.findClosestSegment=U.prototype.Kz;U.prototype.updateRoute=U.prototype.pg;U.prototype.invalidateRoute=U.prototype.Ua;U.prototype.rollbackRoute=U.prototype.Tv;U.prototype.commitRoute=U.prototype.rf;U.prototype.startRoute=U.prototype.Hh;U.prototype.clearPoints=U.prototype.ak;U.prototype.removePoint=U.prototype.Rv;U.prototype.addPointAt=U.prototype.pf;U.prototype.addPoint=U.prototype.ce;
U.prototype.insertPointAt=U.prototype.l;U.prototype.insertPoint=U.prototype.pA;U.prototype.setPointAt=U.prototype.L;U.prototype.setPoint=U.prototype.Mc;U.prototype.getPoint=U.prototype.i;U.prototype.getOtherPort=U.prototype.gA;U.prototype.getOtherNode=U.prototype.nq;
var jp=null,kp=null,$o=new D(U,"Normal",1),Ip=new D(U,"Orthogonal",2),Jp=new D(U,"AvoidsNodes",6),rp=new D(U,"AvoidsNodesStraight",7),Vf=new D(U,"None",0),Yf=new D(U,"Bezier",9),Uf=new D(U,"JumpGap",10),Tf=new D(U,"JumpOver",11),ap=new D(U,"End",17),bp=new D(U,"Scale",18),cp=new D(U,"Stretch",19),Rm=new D(U,"OrientAlong",21),Km=new D(U,"OrientPlus90",22),Mm=new D(U,"OrientMinus90",23),dp=new D(U,"OrientOpposite",24),Sm=new D(U,"OrientUpright",25),Lm=new D(U,"OrientPlus90Upright",26),Nm=new D(U,"OrientMinus90Upright",
27),Om=new D(U,"OrientUpright45",28),tp=16,sp=14,up=8;U.className="Link";U.Normal=$o;U.Orthogonal=Ip;U.AvoidsNodes=Jp;U.AvoidsNodesStraight=rp;U.None=Vf;U.Bezier=Yf;U.JumpGap=Uf;U.JumpOver=Tf;U.End=ap;U.Scale=bp;U.Stretch=cp;U.OrientAlong=Rm;U.OrientPlus90=Km;U.OrientMinus90=Mm;U.OrientOpposite=dp;U.OrientUpright=Sm;U.OrientPlus90Upright=Lm;U.OrientMinus90Upright=Nm;U.OrientUpright45=Om;U.EndSegmentStep=8;U.CurvinessStart=tp;U.SpacingMin=sp;U.OrthoShortCut=up;
function Hp(a,b,c,d){Ta(this);this.re=this.wr=!1;this.Ws=a;this.uy=b;this.Iv=c;this.vy=d;this.links=[]}Hp.prototype.mm=function(){if(!this.wr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Qw.add(this),this.re=a.undoManager.isUndoingRedoing))}this.wr=!0};
Hp.prototype.kw=function(){if(this.wr){this.wr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Pi&&!this.re;this.re=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.If=null,a.length=0)}0===a.length&&(a=this.Ws,null!==this&&null!==a.Pe&&a.Pe.remove(this),a=this.Iv,null!==this&&null!==a.Pe&&a.Pe.remove(this))}};Hp.className="LinkBundle";
function pk(a){Ta(this);this.Fy=this.group=null;this.Ms=!0;this.abort=!1;this.xd=this.wd=1;this.Bo=this.Ao=-1;this.dc=a.width;this.ec=a.height;this.Qb=null;this.Ai=this.zi=0;this.it=11;this.my=this.ly=22}
pk.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.wd=Math.floor((a.x-this.dc)/this.dc)*this.dc;this.xd=Math.floor((b-this.ec)/this.ec)*this.ec;this.Ao=Math.ceil((c+2*this.dc)/this.dc)*this.dc;this.Bo=Math.ceil((d+2*this.ec)/this.ec)*this.ec;a=1+(Math.ceil((this.Ao-this.wd)/this.dc)|0);b=1+(Math.ceil((this.Bo-this.xd)/this.ec)|0);if(null===this.Qb||this.zi<a-1||this.Ai<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Qb=c;this.zi=
a-1;this.Ai=b-1}a=Kp;if(null!==this.Qb)for(b=0;b<=this.zi;b++)if(c=this.Qb[b],c.fill)c.fill(a);else for(d=0;d<=this.Ai;d++)c[d]=a}};function tk(a,b,c){return a.wd<=b&&b<=a.Ao&&a.xd<=c&&c<=a.Bo}function wp(a,b,c){if(!tk(a,b,c))return Kp;b-=a.wd;b/=a.dc;c-=a.xd;c/=a.ec;return a.Qb[b|0][c|0]}function sk(a){if(null!==a.Qb)for(var b=0;b<=a.zi;b++)for(var c=a.Qb[b],d=0;d<=a.Ai;d++)c[d]>=zp&&(c[d]=Kp)}
pk.prototype.qk=function(a,b,c,d){if(a>this.Ao||a+c<this.wd||b>this.Bo||b+d<this.xd)return!0;a=(a-this.wd)/this.dc|0;b=(b-this.xd)/this.ec|0;c=Math.max(0,c)/this.dc+1|0;var e=Math.max(0,d)/this.ec+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.Ai)|0;a<=d;a++){e=this.Qb[a];for(var f=b;f<=c;f++)if(e[f]===uk)return!1}return!0};
function Lp(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.Qb[l][m];if(n>=zp&&n<xp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Qb[l][m]);)a.Qb[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)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Lp(a,b,c,1,!e,f,g,h,k),Lp(a,b,c,-1,!e,f,g,h,
k)}}function Mp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=uk,m=zp;for(a.Qb[b][c]=m;l===uk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Qb[b][c]=m,e?c+=d:b+=d,l=a.Qb[b][c]}function Np(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=uk,m=xp;for(a.Qb[b][c]=m;l===uk&&b>f&&b<g&&c>h&&c<k;)a.Qb[b][c]=m,e?c+=d:b+=d,l=a.Qb[b][c]}
function vp(a,b,c,d,e,f,g){if(null!==a.Qb){a.abort=!1;var h=b.x,k=b.y;if(tk(a,h,k)){h-=a.wd;h/=a.dc;k-=a.xd;k/=a.ec;var l=d.x,m=d.y;if(tk(a,l,m))if(l-=a.wd,l/=a.dc,m-=a.xd,m/=a.ec,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.wd;n/=a.dc;d-=a.xd;d/=a.ec;b-=a.wd;b/=a.dc;p-=a.xd;p/=a.ec;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.Ai,d|0));p=Math.min(a.Ai,Math.max(0,p|0));d=a.Qb;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===uk?(Mp(a,h,k,r,c,f,b,n,p),Mp(a,h,k,1,!c,f,b,n,p),Mp(a,h,k,-1,!c,f,b,n,p)):Mp(a,h,k,r,c,h,k,h,k);d[l][m]===uk?(Np(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),Np(a,l,m,1,!(90===e||270===e),f,b,n,p),Np(a,l,m,-1,!(90===e||270===e),f,b,n,p)):Np(a,l,m,r,c,l,m,l,m);c=Fa();if(g&&Op(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=zp;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 Lp(a,h,k,1,!1,f,b,n,p),Lp(a,h,k,-1,!1,f,b,n,p),Lp(a,h,k,1,!0,f,b,n,p),Lp(a,h,k,-1,!0,f,b,n,p);Ia(c)}}}}
function Op(a,b,c,d,e,f,g){for(var h=a.Qb,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===Pp)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!==Pp){g.push(k);g.push(l);if(Op(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=Pp;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(pk.prototype,{bounds:{get:function(){return new N(this.wd,this.xd,this.Ao-this.wd,this.Bo-this.xd)}},bq:{get:function(){return this.dc},set:function(a){0<a&&a!==this.dc&&(this.dc=a,this.initialize(this.bounds))}},aq:{get:function(){return this.ec},set:function(a){0<a&&a!==this.ec&&(this.ec=a,this.initialize(this.bounds))}}});var uk=0,zp=1,xp=999999,Kp=xp+1,Pp=xp+2;pk.className="PositionArray";
function pp(){Ta(this);this.port=this.node=null;this.ee=[];this.uq=!1}pp.prototype.toString=function(){for(var a=this.ee,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 Qp(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}pp.prototype.mm=function(){this.ee.length=0};
function qp(a,b){var c=a.ee;if(0===c.length){a:if(!a.uq){c=a.uq;a.uq=!0;var d=null,e=a.node,f=e instanceof hf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.Sx();else{if(!f.actualBounds.u()){a.uq=c;break a}d=f;g=d.ov()}f=a.ee.length=0;var h=a.port.da(sc,J.alloc()),k=a.port.da(Cc,J.alloc());e=N.allocAt(h.x,h.y,0,0);e.Le(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Li();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.Fd(d),n=l.computeSpot(m,a.port);if(n.Kc()){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.Oa(p.da(yc));p+=(h.Oa(m)-p)/360;p-=k;0>p?p+=360:360<=p&&(p-=360);n=Qp(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.ee[f];void 0===r?(r=new Rp(l,p,n),a.ee[f]=
r):(r.link=l,r.angle=p,r.xc=n);r.Kv.set(m);f++}}}}J.free(h);a.ee.sort(pp.prototype.j);k=a.ee.length;d=-1;for(f=h=0;f<k;f++)g=a.ee[f],void 0!==g&&(g.xc!==d&&(d=g.xc,h=0),g.oq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.ee[f],void 0!==k&&(k.xc!==d&&(d=k.xc,h=k.oq+1),k.fm=h);f=a.ee;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.da(sc,h);n.da(wc,k);n.da(Cc,g);n.da(Ac,l);r=p=m=n=0;if(d===Xo)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var v=u.link.computeThickness();
switch(u.xc){case 8:p+=v;break;case 2:r+=v;break;case 1:n+=v;break;default:case 4:m+=v}}}var w=q=0,z=1,y=u=0;for(v=0;v<f.length;v++){var A=f[v];if(null!==A){if(q!==A.xc){q=A.xc;switch(q){case 8:var B=g;w=l;break;case 2:B=l;w=h;break;case 1:B=h;w=k;break;default:case 4:B=k,w=g}u=w.x-B.x;y=w.y-B.y;switch(q){case 8:p>Math.abs(u)?(z=Math.abs(u)/p,p=Math.abs(u)):z=1;break;case 2:r>Math.abs(y)?(z=Math.abs(y)/r,r=Math.abs(y)):z=1;break;case 1:n>Math.abs(u)?(z=Math.abs(u)/n,n=Math.abs(u)):z=1;break;default:case 4:m>
Math.abs(y)?(z=Math.abs(y)/m,m=Math.abs(y)):z=1}w=0}var F=A.tq;if(d===Xo){A=A.link.computeThickness();A*=z;F.set(B);switch(q){case 8:F.x=B.x+u/2+p/2-w-A/2;break;case 2:F.y=B.y+y/2+r/2-w-A/2;break;case 1:F.x=B.x+u/2-n/2+w+A/2;break;default:case 4:F.y=B.y+y/2-m/2+w+A/2}w+=A}else{var K=.5;d===Jo&&(K=(A.oq+1)/(A.fm+1));F.x=B.x+u*K;F.y=B.y+y*K}}}J.free(h);J.free(k);J.free(g);J.free(l);B=a.ee;for(f=0;f<B.length;f++)d=B[f],null!==d&&(d.mv=a.computeEndSegmentLength(d));a.uq=c;N.free(e)}c=a.ee}for(a=0;a<c.length;a++)if(e=
c[a],null!==e&&e.link===b)return e;return null}pp.prototype.j=function(a,b){return a===b?0:null===a?-1:null===b?1:a.xc<b.xc?-1:a.xc>b.xc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
pp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,rc,b.fromPort===this.port),d=a.oq;if(0>d)return c;var e=a.fm;if(1>=e||!b.isOrthogonal)return c;b=a.Kv;var f=a.tq;if(2===a.xc||8===a.xc)d=e-1-d;return((a=2===a.xc||4===a.xc)?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)};pp.className="Knot";function Rp(a,b,c){this.link=a;this.angle=b;this.xc=c;this.Kv=new J;this.fm=this.oq=0;this.tq=new J;this.mv=0}
Rp.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.xc.toString()+":"+this.oq.toString()+"/"+this.fm.toString()+" "+this.tq.toString()+" "+this.mv.toString()+" "+this.Kv.toString()};Rp.className="LinkInfo";function cl(){this.ph=this.Jg=Vc;this.oh=this.Ig=this.nh=this.Hg=NaN;this.Mp=this.Mn=null;this.Np=this.Nn=Infinity}
cl.prototype.copy=function(){var a=new cl;a.Jg=this.Jg.I();a.ph=this.ph.I();a.Hg=this.Hg;a.nh=this.nh;a.Ig=this.Ig;a.oh=this.oh;a.Mn=this.Mn;a.Mp=this.Mp;a.Nn=this.Nn;a.Np=this.Np;return a};cl.className="LinkSettings";function li(a){Ta(this);this.o=this.F=null;this.Zh=this.ho=!0;this.no=!1;this.an=(new J(0,0)).freeze();this.ko=!0;this.en=this.jo=null;this.mo=!1;this.j=null;this.C=0;this.Co=this.Tp=null;this.us=!1;this.fg=this.Qj=null;this.ls=!1;a&&Object.assign(this,a)}
li.prototype.cloneProtected=function(a){a.ho=this.ho;a.Zh=this.Zh;a.no=this.no;a.an.assign(this.an);a.ko=this.ko;a.jo=this.jo;a.en=this.en;a.mo=!0;a.Co=this.Co;a.Tp=this.Tp};li.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};li.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
li.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new J(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};li.prototype.gb=function(){};li.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+")"};
li.prototype.B=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.nc(),this.isOngoing&&a.Pi||this.isInitial&&!a.Pi)&&(this.isValidLayout=!1,a.Fb())}}};li.prototype.createNetwork=function(){return new Sp(this)};li.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof T?(b.hg(a.nodes,!0),b.hg(a.links,!0)):a instanceof hf?b.hg(a.memberParts):b.hg(a.iterator);return b};
li.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.wa("Layout"),this.commitLayout()}finally{null!==a&&a.Xa("Layout")}}};li.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()}};
li.prototype.doLayout=function(a){var b=new G;a instanceof T?(Tp(this,b,a.nodes,!0,this.Fh,!0,!1,!0),Tp(this,b,a.parts,!0,this.Fh,!0,!1,!0)):a instanceof hf?Tp(this,b,a.memberParts,!1,this.Fh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.wa("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.Xa("Layout"));this.isValidLayout=!0};
li.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;Up(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof hf&&(h.Fh=!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++}};
li.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 U)&&(Up(h),this.Fh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof hf&&(h.Fh=!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++}}};li.prototype.Fh=function(a){return!a.location.u()||a instanceof hf&&a.Fh?!0:!1};function Tp(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 hf?null===k.layout?Tp(a,b,k.memberParts,!1,e,f,g,h):(Up(k),b.add(k)):(Up(k),b.add(k))):g&&k instanceof U?b.add(k):!h||!k.Jc()||k instanceof W||(Up(k),b.add(k)))}}
function Up(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Sa()}li.prototype.Ni=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};
li.prototype.Hx=function(a){var b=new G;a instanceof T?(Tp(this,b,a.nodes,!0,null,!0,!0,!0),Tp(this,b,a.links,!0,null,!0,!0,!0),Tp(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof hf?Tp(this,b,a.memberParts,!1,null,!0,!0,!0):Tp(this,b,a.iterator,!1,null,!0,!0,!0);return b};
li.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(sc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};li.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};li.prototype.workerLayout=function(){return!1};
function Vp(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.Qj&&(c.running=Wp(a.Qj));null!==a.fg&&(c.waiting=Wp(a.fg));a.workerStateChanged(c,a)}}function Wp(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}li.prototype.qz=function(){var a=Xp(this.constructor);a&&(null!==a.Me&&a.Me.terminate(),a.Me=null,a.om.iteratorValues.each(function(a){a.us=!1;a.Qj=null;a.fg=null;a.ls=!1;Vp(a)}),a.om.clear())};
function Yp(a,b){var c=Xp(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function Xp(a){var b=null;if("function"===typeof a){if(b=Zp.get(a),!b){var c=Ja(a);b=Zp.get(c);b||(b=new $p,b.iv=a,b.name=c,b.j=a.name,b.gy=aq,Zp.set(c,b),Zp.set(a,b),Zp.set(a.name,b))}}else"string"===typeof a&&(b=Zp.get(a));return b}
li.prototype.jw=function(){if("undefined"===typeof Worker||!bq||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.us&&(this.ls=!0,this.fg=this.Qj=null,Vp(this)),!1;var a=Xp(this.constructor);if(null===a)return!1;null===a.Me&&(a.Me=new Worker(bq),a.Me.onerror=function(a){a.preventDefault();ya("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.Me.j=function(a){ya("Worker serialization error: "+a)},a.Me.onmessage=
function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version&&T.version&&c.version!==T.version)ya("Failure: GoJS v"+T.version+"  Worker v"+c.version);else if(b=a.om.get(c.id)){a.om.remove(c.id);b.us=!1;b.Qj=null;if(b.ls)b.ls=!1,b.fg=null;else{var d=cq(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}Vp(b,c.time);c=b.fg;if(null!==c)b.fg=null;else for(d=a.om.iteratorValues;d.next();){var e=d.value;c=e.fg;if(null!==c){e.fg=null;break}}null!==c&&dq(b,c)}},a.Me.postMessage({_GoJS:"_GoJS",
url:a.gy}),Array.isArray(a.scripts)&&a.scripts.forEach(function(b){a.Me.postMessage({_GoJS:"_GoJS",url:b})}),a.Me.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.Qj?this.fg=this.network:dq(this,this.network);Vp(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function dq(a,b){a.us=!0;var c=Xp(a.constructor),d=eq(a,b,!0);d._GoJS="_GoJS";c.Me.postMessage(d);c.om.set(gb(a),a);a.Qj=b}
function eq(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?gb(a):a.id,layout:Ja(a.constructor),p:d,dB:e,Iz:f};a.onNetworkSerialization(2,c,b,d);return d}
function cq(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.dB,g=new I;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Eb(a.key));null!==b?b=e.Zj(b):(b=e.createVertex(),e.ig(b));c&&null!==a.key&&(b.data={ci:a.key});g.set(a.id,b)});var h=b.Iz,k=new I;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));var f=e.createEdge();e.am(f);f.link=b;c&&null!==a.key&&(f.data={ci:a.key});k.set(a.id,f)});
f&&f.forEach(function(a){var b=g.get(a.id);b&&b.deserializeVertexProperties(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}li.prototype.onNetworkSerialization=function(){};
na.Object.defineProperties(li.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},group:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a,null!==a&&(this.F=a.diagram))}},isOngoing:{get:function(){return this.ho},set:function(a){this.ho!==a&&(this.ho=a)}},isInitial:{get:function(){return this.Zh},set:function(a){this.Zh=a;a||(this.mo=!0)}},
isViewportSized:{get:function(){return this.no},set:function(a){this.no!==a&&(this.no=a)&&this.B()}},isRouting:{get:function(){return this.ko},set:function(a){this.ko!==a&&(this.ko=a)}},isRealtime:{get:function(){return this.jo},set:function(a){this.jo!==a&&(this.jo=a)}},isValidLayout:{get:function(){return this.mo},set:function(a){this.mo!==a&&(this.mo=a,a||(a=this.diagram,null!==
a&&(a.Nh=!0)))}},network:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.en},set:function(a){this.en!==a&&(this.en=a,this.B())}},arrangementOrigin:{get:function(){return this.an},set:function(a){this.an.A(a)||(this.an.assign(a),this.B())}},id:{get:function(){return this.C},set:function(a){this.C=
a}},mayUseWorkerFunction:{get:function(){return this.Co},set:function(a){this.Co!==a&&(this.Co=a)}},workerStateChanged:{get:function(){return this.Tp},set:function(a){this.Tp!==a&&(this.Tp=a)}}});li.prototype.useWorker=li.prototype.jw;li.declareWorkerLayout=Yp;li.prototype.cancelWorker=li.prototype.qz;li.prototype.collectParts=li.prototype.Hx;li.prototype.getLayoutBounds=li.prototype.Ni;li.prototype.invalidateLayout=li.prototype.B;
var Zp=new I,aq="object"===typeof x.document&&x.document.currentScript?x.document.currentScript.src:"",bq="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"})):"";li.className="Layout";li.GoJSScriptURL=aq;li.declareWorkerLayout=Yp;
"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:T.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=Xp(a.layout));var d=null;c&&c.iv&&(d=new c.iv);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=cq(d,a,!0);
d.workerLayout=function(){var a=eq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new E)}});function $p(){this.iv=null;this.gy=this.j=this.name="";this.scripts=[];this.Me=null;this.om=new I}function Sp(a){Ta(this);this.Ac=a;this.mf=new G;this.le=new G;this.Xs=new I;this.Ss=new I}
Sp.prototype.clear=function(){if(this.mf)for(var a=this.mf.iterator;a.next();)a.value.clear();if(this.le)for(a=this.le.iterator;a.next();)a.value.clear();this.mf=new G;this.le=new G;this.Xs=new I;this.Ss=new I};
Sp.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.mf.count+" edges: "+this.le.count;if(1<a){for(var c=this.mf.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};Sp.prototype.createVertex=function(){return new fq(this)};Sp.prototype.createEdge=function(){return new gq(this)};
Sp.prototype.hg=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 U){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 hf&&null===d.layout)this.hg(d.memberParts,!1);else if(null===this.Ki(d)){var e=this.createVertex();e.node=
d;this.ig(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof U&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.hq(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.rk(f,e,d))}}};Sp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Ki(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Ki(b);if(null!==a)return a;b=b.containingGroup}return null};
t=Sp.prototype;t.ig=function(a){if(null!==a){this.mf.add(a);var b=a.node;null!==b&&this.Xs.add(b,a);a.network=this}};t.Zj=function(a){if(null===a)return null;var b=this.Ki(a);null===b&&(b=this.createVertex(),b.node=a,this.ig(b));return b};t.lv=function(a){if(null!==a&&hq(this,a)){for(var b=a.qd,c=b.count-1;0<=c;c--){var d=b.J(c);this.gk(d)}b=a.Cd;for(a=b.count-1;0<=a;a--)c=b.J(a),this.gk(c)}};
function hq(a,b){if(null===b)return!1;var c=a.mf.remove(b);c&&(b=b.node,null!==b&&a.Xs.remove(b));return c}t.Dz=function(a){null!==a&&(a=this.Ki(a),null!==a&&this.lv(a))};t.Ki=function(a){return null===a?null:this.Xs.H(a)};t.am=function(a){if(null!==a){iq(this,a);var b=a.toVertex;null!==b&&b.bv(a);b=a.fromVertex;null!==b&&b.$u(a)}};function iq(a,b){if(null!==b){a.le.add(b);var c=b.link;null!==c&&null===a.hq(c)&&a.Ss.add(c,b);b.network=a}}
t.gz=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.hq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Zj(b)),null!==c&&(d.toVertex=this.Zj(c)),this.am(d)):(null!==b?d.fromVertex=this.Zj(b):d.fromVertex=null,null!==c?d.toVertex=this.Zj(c):d.toVertex=null);return d};t.gk=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.kv(a);b=a.fromVertex;null!==b&&b.jv(a);jq(this,a)}};
function jq(a,b){null!==b&&a.le.remove(b)&&(b=b.link,null!==b&&a.Ss.remove(b))}t.Cz=function(a){null!==a&&(a=this.hq(a),null!==a&&this.gk(a))};t.hq=function(a){return null===a?null:this.Ss.H(a)};t.rk=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.am(d);return d}return null};t.Am=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.jv(a),c.kv(a),a.Am(),b.bv(a),c.$u(a))}};
t.fq=function(){for(var a=Fa(),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.gk(a[c]);Ia(a)};Sp.prototype.deleteArtificialVertexes=function(){for(var a=Fa(),b=this.mf.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.lv(a[b]);b=Fa();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.gk(b[d]);Ia(a);Ia(b)};
function kq(a){for(var b=Fa(),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.gk(b[d]);Ia(b)}
Sp.prototype.Gy=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),kq(this),this.fq());a=new E;for(var b=!0;b;){b=!1;for(var c=this.mf.iterator;c.next();){var d=c.value;if(0<d.qd.count||0<d.Cd.count){b=this.layout.createNetwork();a.add(b);lq(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 lq(a,b,c){if(null!==c&&c.network!==b){hq(a,c);b.ig(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(jq(a,e),iq(b,e),lq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(jq(a,c),iq(b,c),lq(a,b,c.toVertex))}}Sp.prototype.Jz=function(){for(var a=new G,b=this.mf.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(Sp.prototype,{layout:{get:function(){return this.Ac},set:function(a){null!==a&&(this.Ac=a)}},vertexes:{get:function(){return this.mf}},edges:{get:function(){return this.le}}});Sp.prototype.findAllParts=Sp.prototype.Jz;Sp.prototype.splitIntoSubNetworks=Sp.prototype.Gy;Sp.prototype.deleteSelfEdges=Sp.prototype.fq;Sp.prototype.reverseEdge=Sp.prototype.Am;Sp.prototype.linkVertexes=Sp.prototype.rk;
Sp.prototype.findEdge=Sp.prototype.hq;Sp.prototype.deleteLink=Sp.prototype.Cz;Sp.prototype.deleteEdge=Sp.prototype.gk;Sp.prototype.addLink=Sp.prototype.gz;Sp.prototype.addEdge=Sp.prototype.am;Sp.prototype.findVertex=Sp.prototype.Ki;Sp.prototype.deleteNode=Sp.prototype.Dz;Sp.prototype.deleteVertex=Sp.prototype.lv;Sp.prototype.addNode=Sp.prototype.Zj;Sp.prototype.addVertex=Sp.prototype.ig;Sp.prototype.addParts=Sp.prototype.hg;Sp.className="LayoutNetwork";
function fq(a){Ta(this);this.Pc=a;this.j=(new N(0,0,10,10)).freeze();this.o=(new J(5,5)).freeze();this.mi=this.ib=null;this.qd=new E;this.Cd=new E}
fq.prototype.serializeVertexProperties=function(a){a.id=gb(this);a.key=this.node?this.node.key:this.data?this.data.ci:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.eB=this.bounds.width;a.mA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.qd.each(function(a){b.push(gb(a))});a.Ey=b;var c=[];this.Cd.each(function(a){c.push(gb(a))});a.Nx=c};
fq.prototype.deserializeVertexProperties=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.eB;this.height=a.mA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.Ey&&a.Ey.forEach(function(a){(a=c.get(a))&&d.qd.add(a)});a.Nx&&a.Nx.forEach(function(a){(a=c.get(a))&&d.Cd.add(a)})}};fq.prototype.clear=function(){this.mi=this.ib=null;this.qd=new E;this.Cd=new E};
fq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+gb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.qd.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Cd.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
fq.prototype.commit=function(){var a=this.ib;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 hf)){c=N.alloc();var d=this.network.layout.Ni(a,c),e=a.locationObject.da(yc);if(d.u()&&e.u()){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)}};fq.prototype.bv=function(a){null!==a&&(this.qd.contains(a)||this.qd.add(a))};
fq.prototype.kv=function(a){null!==a&&this.qd.remove(a)};fq.prototype.$u=function(a){null!==a&&(this.Cd.contains(a)||this.Cd.add(a))};fq.prototype.jv=function(a){null!==a&&this.Cd.remove(a)};function mq(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(fq.prototype,{sourceEdgesArrayAccess:{get:function(){return this.qd._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.Cd._dataArray}},data:{get:function(){return this.ib},set:function(a){this.ib=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.o.h(d/2,b/2);this.j.h(a,c,d,b)}}},node:{get:function(){return this.mi},
set:function(a){if(this.mi!==a){this.mi=a;a.Sa();var b=this.network.layout,c=N.alloc(),d=b.Ni(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.j.h(b,e,f,d);N.free(c);if(!(a instanceof hf)&&(a=a.locationObject.da(yc),a.u())){this.o.h(a.x-b,a.y-e);return}this.o.h(f/2,d/2)}}},bounds:{get:function(){return this.j},set:function(a){this.j.A(a)||this.j.assign(a)}},focus:{get:function(){return this.o},set:function(a){this.o.A(a)||
this.o.assign(a)}},centerX:{get:function(){return this.j.x+this.o.x},set:function(a){var b=this.j;b.x+this.o.x!==a&&(b.ea(),b.x=a-this.o.x,b.freeze())}},centerY:{get:function(){return this.j.y+this.o.y},set:function(a){var b=this.j;b.y+this.o.y!==a&&(b.ea(),b.y=a-this.o.y,b.freeze())}},focusX:{get:function(){return this.o.x},set:function(a){var b=this.o;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.o.y},set:function(a){var b=this.o;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},x:{get:function(){return this.j.x},set:function(a){var b=this.j;b.x!==a&&(b.ea(),b.x=a,b.freeze())}},y:{get:function(){return this.j.y},set:function(a){var b=this.j;b.y!==a&&(b.ea(),b.y=a,b.freeze())}},width:{get:function(){return this.j.width},set:function(a){var b=this.j;b.width!==a&&(b.ea(),b.width=
a,b.freeze())}},height:{get:function(){return this.j.height},set:function(a){var b=this.j;b.height!==a&&(b.ea(),b.height=a,b.freeze())}},network:{get:function(){return this.Pc},set:function(a){this.Pc=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.qd.iterator}},destinationEdges:{get:function(){return this.Cd.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.qd.count+this.Cd.count}}});fq.prototype.deleteDestinationEdge=fq.prototype.jv;fq.prototype.addDestinationEdge=fq.prototype.$u;fq.prototype.deleteSourceEdge=fq.prototype.kv;fq.prototype.addSourceEdge=fq.prototype.bv;fq.className="LayoutVertex";fq.standardComparer=mq;
fq.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 gq(a){Ta(this);this.Oc=a;this.ad=this.Tc=this.tl=this.ib=null}gq.prototype.clear=function(){this.ad=this.Tc=this.tl=this.ib=null};gq.prototype.serializeEdgeProperties=function(a){a.id=gb(this);a.key=this.link?this.link.key:this.data?this.data.ci:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?gb(this.fromVertex):null;a.$A=this.toVertex?gb(this.toVertex):null};
gq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.$A))this.toVertex=a}};gq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+gb(this);0<a&&(b+=null!==this.tl?"("+this.tl.toString()+")":"",1<a&&(b+=" "+(this.Tc?this.Tc.toString():"null")+" --\x3e "+(this.ad?this.ad.toString():"null")));return b};gq.prototype.Am=function(){var a=this.Tc;this.Tc=this.ad;this.ad=a};gq.prototype.commit=function(){};
gq.prototype.ay=function(a){return this.ad===a?this.Tc:this.Tc===a?this.ad:null};
na.Object.defineProperties(gq.prototype,{network:{get:function(){return this.Oc},set:function(a){this.Oc=a}},data:{get:function(){return this.ib},set:function(a){this.ib!==a&&(this.ib=a)}},link:{get:function(){return this.tl},set:function(a){this.tl!==a&&(this.tl=a)}},fromVertex:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a)}},toVertex:{
get:function(){return this.ad},set:function(a){this.ad!==a&&(this.ad=a)}}});gq.prototype.getOtherVertex=gq.prototype.ay;gq.className="LayoutEdge";function Lk(a){li.call(this);this.isViewportSized=!0;this.Up=this.Vp=NaN;this.tg=(new M(NaN,NaN)).freeze();this.ef=(new M(10,10)).freeze();this.wb=nq;this.Gb=oq;this.Yc=pq;this.Rc=qq;a&&Object.assign(this,a)}ma(Lk,li);
Lk.prototype.cloneProtected=function(a){li.prototype.cloneProtected.call(this,a);a.Vp=this.Vp;a.Up=this.Up;a.tg.assign(this.tg);a.ef.assign(this.ef);a.wb=this.wb;a.Gb=this.Gb;a.Yc=this.Yc;a.Rc=this.Rc};Lk.prototype.gb=function(a){a.classType===Lk?a===pq||a===rq||a===sq||a===tq?this.sorting=a:a===oq||a===uq?this.arrangement=a:a===nq||a===vq?this.alignment=a:C("Unknown enum value: "+a):li.prototype.gb.call(this,a)};
Lk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Hx(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Dh()||null===d.fromNode&&null===d.toNode){if(d.Sa(),d instanceof hf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.xa();if(0!==e.length){switch(this.sorting){case tq:e.reverse();break;case pq:e.sort(this.comparer);break;case rq: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.wa("Layout");d=[];switch(this.alignment){case vq: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.Ni(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.Ni(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,v=0,w=0,z=0;z<e.length;z++){var y=e[z],A=this.Ni(y,l),B=Math.ceil((A.width+h)/m)*m,F=Math.ceil((A.height+k)/n)*n;switch(p){case uq:var K=Math.abs(q-A.width);break;default:K=q+A.width}if(0<f&&v>f-1||0<g&&0<v&&K-r>g)d.push(new N(0,u,g+h,w)),v=0,q=r,u+=w,w=0;w=Math.max(w,F);switch(p){case uq:A=-A.width;break;default:A=
0}y.moveTo(q+A,u);switch(p){case uq:q-=B;break;default:q+=B}v++}d.push(new N(0,u,g+h,w));N.free(l);break;case nq: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++)w=e[q],v=this.Ni(w,g),w=vo(w,w.locationObject,w.locationSpot,h),l=Math.max(l,w.x),u=Math.max(u,v.width-w.x),f=Math.max(f,w.y);q=this.arrangement;switch(q){case uq:l+=n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var S=w=this.arrangementOrigin.x;z=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=y=0;B=Math.max(this.cellSize.height,1);A=f=0;F=!0;v=J.alloc();for(K=0;K<e.length;K++){var R=e[K],O=this.Ni(R,g),H=vo(R,R.locationObject,R.locationSpot,h);if(0<u)switch(q){case uq:S=(S-w-(O.width-H.x))/r;S=L.aa(Math.round(S),S)?Math.round(S):Math.floor(S);S=S*r+w;break;default:S=(S-w+H.x)/r,S=L.aa(Math.round(S),S)?Math.round(S):Math.ceil(S),S=S*r+w}else switch(q){case uq:y=S+H.x+O.width;break;default:y=S-H.x}switch(q){case uq:var da=-(S+H.x)+y;break;default:da=S+O.width-H.x-y}if(0<
m&&u>m-1||0<k&&0<u&&da>k){d.push(new N(0,F?z-f:z,k+n,A+f+p));for(S=0;S<u&&K!==u;S++){da=e[K-u+S];var ba=vo(da,da.locationObject,da.locationSpot,v);da.moveTo(da.position.x,da.position.y+f-ba.y)}A+=p;z=F?z+A:z+(A+f);u=A=f=0;S=w;F=!1}S===w&&(l=q===uq?Math.max(l,O.width-H.x):Math.min(l,-H.x));f=Math.max(f,H.y);A=Math.max(A,O.height-H.y);isFinite(B)&&(A=Math.max(A,Math.max(O.height,B)-H.y));F?R.moveTo(S-H.x,z-H.y):R.moveTo(S-H.x,z);switch(q){case uq:S-=H.x+n;break;default:S+=O.width-H.x+n}u++}d.push(new N(0,
z,k+n,(F?A:A+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=vo(m,m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(v);if(q===uq)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===uq?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}};Lk.prototype.commitLayers=function(){};function qq(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
na.Object.defineProperties(Lk.prototype,{wrappingWidth:{get:function(){return this.Vp},set:function(a){this.Vp!==a&&(0<a||isNaN(a))&&(this.Vp=a,this.isViewportSized=isNaN(a),this.B())}},wrappingColumn:{get:function(){return this.Up},set:function(a){this.Up!==a&&(0<a||isNaN(a))&&(this.Up=a,this.B())}},cellSize:{get:function(){return this.tg},set:function(a){this.tg.A(a)||(this.tg.assign(a),this.B())}},spacing:{
get:function(){return this.ef},set:function(a){this.ef.A(a)||(this.ef.assign(a),this.B())}},alignment:{get:function(){return this.wb},set:function(a){this.wb===a||a!==nq&&a!==vq||(this.wb=a,this.B())}},arrangement:{get:function(){return this.Gb},set:function(a){this.Gb===a||a!==oq&&a!==uq||(this.Gb=a,this.B())}},sorting:{get:function(){return this.Yc},set:function(a){this.Yc===a||a!==sq&&a!==tq&&
a!==pq&&a!==rq||(this.Yc=a,this.B())}},comparer:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.Rc=a,this.B())}}});var vq=new D(Lk,"Position",0),nq=new D(Lk,"Location",1),oq=new D(Lk,"LeftToRight",2),uq=new D(Lk,"RightToLeft",3),sq=new D(Lk,"Forward",4),tq=new D(Lk,"Reverse",5),pq=new D(Lk,"Ascending",6),rq=new D(Lk,"Descending",7);Lk.className="GridLayout";Lk.standardComparer=qq;
Lk.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};Lk.Position=vq;Lk.Location=nq;Lk.LeftToRight=oq;Lk.RightToLeft=uq;Lk.Forward=sq;Lk.Reverse=tq;Lk.Ascending=pq;Lk.Descending=rq;function hi(){this.Po=new G;this.wo=new G;this.Fa=new G;this.Re=new I;this.Qe=new I;this.Bj=new I;this.F=null;this.Nq=!1}t=hi.prototype;t.clear=function(){this.Po.clear();this.wo.clear();this.Fa.clear();this.Re.clear();this.Qe.clear();this.Bj.clear()};t.Ke=function(a){this.F=a};
t.Oi=function(a){if(a instanceof W){if(this.Po.add(a),a instanceof hf){var b=a.containingGroup;null===b?this.F.xi.add(a):b.zl.add(a);b=a.layout;null!==b&&(b.diagram=this.F)}}else a instanceof U?this.wo.add(a):a instanceof we||this.Fa.add(a);b=a.data;null===b||a instanceof we||(a instanceof U?this.Qe.add(b,a):this.Re.add(b,a))};
t.bc=function(a){a.$j();if(a instanceof W){if(this.Po.remove(a),a instanceof hf){var b=a.containingGroup;null===b?this.F.xi.remove(a):b.zl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof U?this.wo.remove(a):a instanceof we||this.Fa.remove(a);b=a.data;null===b||a instanceof we||(a instanceof U?this.Qe.remove(b):this.Re.remove(b))};
t.Hd=function(){var a=this.F;if(null!==a){for(var b=a.nodeTemplateMap.iterator;b.next();){var c=b.value,d=b.key;(!c.Jc()||c instanceof hf)&&C('Invalid node template in Diagram.nodeTemplateMap: template for "'+d+'" must be a Node or a simple Part, not a Group or Link: '+c)}for(b=a.groupTemplateMap.iterator;b.next();)c=b.value,d=b.key,c instanceof hf||C('Invalid group template in Diagram.groupTemplateMap: template for "'+d+'" must be a Group, not a normal Node or Link: '+c);for(b=a.linkTemplateMap.iterator;b.next();)c=
b.value,d=b.key,c instanceof U||C('Invalid link template in Diagram.linkTemplateMap: template for "'+d+'" must be a Link, not a normal Node or simple Part: '+c);b=Fa();for(c=a.selection.iterator;c.next();)(d=c.value.data)&&b.push(d);c=Fa();for(a=a.highlighteds.iterator;a.next();)(d=a.value.data)&&c.push(d);a=Fa();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(a.push(e.data),a.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(a.push(e.data),a.push(e.location));
for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(a.push(e.data),a.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<b.length;d++)e=this.vc(b[d]),null!==e&&(e.isSelected=!0);for(d=0;d<c.length;d++)e=this.vc(c[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<a.length;d+=2)e=this.vc(a[d]),null!==e&&(e.location=a[d+1]);Ia(b);Ia(c);Ia(a)}};hi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
hi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.cb(a)&&wq(c,a,!1)});a.forEach(function(a){d.cb(a)&&c.resolveReferencesForData(a)});!1!==b&&Yj(this.diagram,!1)};
function wq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Re.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.F.undoManager.isUndoingRedoing&&!a.Re.contains(b)){var d=a.lq(b);var e=Ho(a,b,d);if(null!==e&&(ng(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Jf=d;e.ib=b;a.Nq&&(e.Og="Tool");a.diagram.add(e);e.ib=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
hi.prototype.insertLink=function(){return null};hi.prototype.resolveReferencesForData=function(){};hi.prototype.lq=function(a){return this.F.model.lq(a)};
function Ho(a,b,c){a=a.F;var d=a.model;d.pk()&&d.Dv(b)?(b=a.groupTemplateMap.H(c),null===b&&(b=a.groupTemplateMap.H(""),null===b&&(xq||(xq=!0,ya('No Group template found for category "'+c+'"'),ya("  Using default group template")),b=a.Qy))):(b=a.nodeTemplateMap.H(c),null===b&&(b=a.nodeTemplateMap.H(""),null===b&&(yq||(yq=!0,ya('No Node template found for category "'+c+'"'),ya("  Using default node template")),b=a.Sy)));return b}hi.prototype.getLinkCategoryForData=function(){return""};
hi.prototype.setLinkCategoryForData=function(){};hi.prototype.setFromNodeForLink=function(){};hi.prototype.setToNodeForLink=function(){};hi.prototype.findLinkTemplateForCategory=function(a){var b=this.F,c=b.linkTemplateMap.H(a);null===c&&(c=b.linkTemplateMap.H(""),null===c&&(zq||(zq=!0,ya('No Link template found for category "'+a+'"'),ya("  Using default link template")),c=b.Ry));return c};hi.prototype.removeAllModeledParts=function(){this.at(this.diagram.model.nodeDataArray)};
hi.prototype.at=function(a){var b=this;a.forEach(function(a){b.Cq(a)})};hi.prototype.Cq=function(a){a=this.vc(a);null!==a&&(Fj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};hi.prototype.unresolveReferencesForPart=function(){};hi.prototype.removeDataForLink=function(){};hi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.F.model.Vb(a);return null!==a?this.Re.H(a):null};
hi.prototype.Eb=function(a){if(null===a||void 0===a)return null;a=this.F.model.Vb(a);if(null===a)return null;a=this.Re.H(a);return a instanceof W?a:null};hi.prototype.findLinkForKey=function(){return null};t=hi.prototype;t.vc=function(a){if(null===a)return null;var b=this.Re.H(a);return null!==b?b:b=this.Qe.H(a)};t.Hi=function(a){if(null===a)return null;a=this.Re.H(a);return a instanceof W?a:null};t.uc=function(a){return null===a?null:this.Qe.H(a)};
t.Ds=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.Po.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)&&Aq(this,e,g)){b.add(d);break}}}return b.iterator};t.Cs=function(a){for(var b=0;b<arguments.length;++b);b=new G;for(var c=this.wo.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)&&Aq(this,e,g)){b.add(d);break}}}return b.iterator};
function Aq(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&&!Bq(a,e[g],h))return!1}}else if(!Bq(a,e,f))return!1}return!0}function Bq(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(!Aq(a,b,c))return!1}else if(b!==c)return!1;return!0}
hi.prototype.doModelChanged=function(a){if(this.F){var b=this.F;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===ce){if("nodeCategory"===d){var e=this.vc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.at(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===ee){var g=a.newValue;"nodeDataArray"===d&&za(g)&&wq(this,g);b.isModified=!0}else if(c===fe){var h=a.oldValue;
"nodeDataArray"===d&&za(h)&&this.Cq(h);b.isModified=!0}else c===de&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.Lq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Hd());else if(c===ce){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Hd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===ee||c===fe){var m=a.change===ee,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.Bj.H(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)kn(q,p,n,!0);else if(!(0>n)){var u=n+bn(q);q.bc(u,!0);nn(q,u,n)}}b.isModified=!0}}finally{b.Z=!0}}}}};hi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Da(a);for(b=this.nodes.iterator;b.next();)b.value.Da(a);for(b=this.links.iterator;b.next();)b.value.Da(a)};
hi.prototype.Lq=function(){for(var a=this.F.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){Cq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.vc(f)&&Dq(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()};hi.prototype.refreshDataBoundLinks=function(){};hi.prototype.updateRelationshipsFromData=function(){};
hi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.vc(a);if(null!==c)c.Da(b);else{c=null;for(var d=this.Bj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].Tx(a);null!==g&&(null===c&&(c=Fa()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Da(b);Ia(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Bj(a,b){var c=b.bi;if(Aa(c)){var d=a.Bj.H(c);if(null===d)d=[],d.push(b),a.Bj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Ej(a,b,c){zj(b,function(a){a=a.T.m;for(var b=a.length,d=0;d<b;d++)Wj(c,a[d])});var d=b.bi;if(Aa(d)){var e=a.Bj.H(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Bj.remove(d);break}}}
hi.prototype.ek=function(a,b,c){void 0===c&&(c=!1);var d=new I;if(Aa(a))for(var e=0;e<a.length;e++)Eq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Eq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.zn.dragsLink;e=new G;for(var f=new I,g=d.iterator;g.next();){var h=g.value;if(h instanceof U)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof W&&null!==h.data&&c.nm()){var k=h;h=g.key;var l=h.lg();null!==l&&(l=
d.H(l),null!==l?(c.fe(k.data,c.pa(l.data)),k=b.uc(k.data),h=h.Ji(),null!==h&&null!==k&&f.add(h,k)):c.fe(k.data,void 0))}}0<e.count&&b.bt(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.F&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new I;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.F.model)}for(b=d.iterator;b.next();)b.value.Da();return d};
function Eq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.H(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.H(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.H(h),null!==h&&(h.toNode=f))}if(b instanceof hf&&f instanceof hf)for(b=b.memberParts;b.next();)g=Eq(a,b.value,c,d,e),g instanceof U||null===g||(g.containingGroup=
f)}else if(b instanceof U&&f instanceof U)for(g=b.fromNode,null!==g&&(g=d.H(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.H(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Eq(a,b.value,c,d,e),null!==g&&g instanceof W&&(g.labeledLink=f);return f}
hi.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof U||(d=e.copyNodeData(d),za(d)&&(e.nf(d),c=b.vc(d)))}else ng(a),c=a.copy(),null!==c&&(e=this.F,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof U||(e=b.copyNodeData(d)),za(e)&&(c.data=e)));return c};
na.Object.defineProperties(hi.prototype,{nodes:{get:function(){return this.Po}},links:{get:function(){return this.wo}},parts:{get:function(){return this.Fa}},diagram:{get:function(){return this.F}},addsToTemporaryLayer:{get:function(){return this.Nq},set:function(a){this.Nq=a}}});hi.prototype.updateAllRelationshipsFromData=hi.prototype.Lq;
hi.prototype.findLinksByExample=hi.prototype.Cs;hi.prototype.findNodesByExample=hi.prototype.Ds;hi.prototype.findLinkForData=hi.prototype.uc;hi.prototype.findNodeForData=hi.prototype.Hi;hi.prototype.findPartForData=hi.prototype.vc;hi.prototype.findNodeForKey=hi.prototype.Eb;hi.prototype.removeModeledPart=hi.prototype.Cq;hi.prototype.removeModeledParts=hi.prototype.at;hi.prototype.rebuildParts=hi.prototype.Hd;var yq=!1,xq=!1,zq=!1;hi.className="PartManager";
function Fq(a){hi.apply(this,arguments)}ma(Fq,hi);Fq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Gq(this,a.linkDataArray)};Fq.prototype.addModeledParts=function(a){hi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Io(a.value);Yj(this.diagram,!1)};function Gq(a,b){b.forEach(function(b){Hq(a,b)});Yj(a.diagram,!1)}
function Hq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Qe.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){ng(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Jf=c;e.ib=b;c=a.diagram.model;var f=Iq(c,b,!0);""!==f&&(e.fromPortId=f);f=Jq(c,b,!0);void 0!==f&&(f=a.Eb(f),f instanceof W&&(e.fromNode=f));f=Iq(c,b,!1);""!==f&&(e.toPortId=f);f=Jq(c,b,!1);void 0!==f&&(f=a.Eb(f),
f instanceof W&&(e.toNode=f));c=c.xf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Eb(b);null!==b&&(b.labeledLink=e)});a.Nq&&(e.Og="Tool");a.diagram.add(e);e.ib=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Fq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Kq(this,a.linkDataArray);this.at(a.nodeDataArray)};function Kq(a,b){b.forEach(function(b){a.Cq(b)})}Fq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Gs(a)};
Fq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.Fq(a,b)};Fq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Wv(a.data,c.pa(null!==b?b.data:null))};Fq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.$v(a.data,c.pa(null!==b?b.data:null))};Fq.prototype.removeDataForLink=function(a){this.diagram.model.vm(a.data)};
Fq.prototype.findPartForKey=function(a){var b=hi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.zh(a),null!==a)?this.Qe.H(a):b};Fq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.zh(a);return null!==a?this.Qe.H(a):null};
Fq.prototype.doModelChanged=function(a){var b=this;hi.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===ce){if("linkFromKey"===e){var f=this.uc(a.object);if(null!==f){var g=this.Eb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.uc(a.object);if(null!==h){var k=this.Eb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.uc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.uc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.vc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Eb(q);u instanceof hf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var v=this.uc(a.object);if(null!==v){var w=a.oldValue,z=a.newValue;Array.isArray(w)&&w.forEach(function(a){0<=z.indexOf(a)||
(a=b.Eb(a),null!==a&&(a.labeledLink=null))});Array.isArray(z)&&z.forEach(function(a){a=b.Eb(a);null!==a&&(a.labeledLink=v)})}}else if("linkCategory"===e){var y=this.uc(a.object),A=a.newValue;null!==y&&"string"===typeof A&&(y.category=A)}else"linkDataArray"===e&&(Kq(this,a.oldValue),Gq(this,a.newValue));c.isModified=!0}else if(d===ee){var B=a.newValue;if("linkDataArray"===e&&"object"===typeof B&&null!==B)Hq(this,B);else if("linkLabelKeys"===e&&Lq(B)){var F=this.uc(a.object),K=this.Eb(B);null!==F&&
null!==K&&(K.labeledLink=F)}c.isModified=!0}else{if(d===fe){var S=a.oldValue;if("linkDataArray"===e&&"object"===typeof S&&null!==S)this.Cq(S);else if("linkLabelKeys"===e&&Lq(S)){var R=this.Eb(S);null!==R&&(R.labeledLink=null)}c.isModified=!0}}else if(d===ce){var O=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==O&&"linkToKeyProperty"!==O&&"linkFromPortIdProperty"!==O&&"linkToPortIdProperty"!==O&&"linkLabelKeysProperty"!==O&&"nodeIsGroupProperty"!==O&&"nodeGroupKeyProperty"!==O&&"linkCategoryProperty"!==
O||c.undoManager.isUndoingRedoing||this.Hd();c.isModified=!0}}finally{c.Z=!0}}}}};Fq.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){Mq(b,a,!1)});d.forEach(function(c){null===a.uc(c)&&Nq(b,c,!1)})};
Fq.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 U){var e=Jq(d,b,!0);e=c.Eb(e);a.fromNode=e;e=Jq(d,b,!1);e=c.Eb(e);a.toNode=e;b=d.xf(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.pa(f.data)===e)return}e=(new G).addAll(b);var g=new G;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.Bq(e);e=
e.copy();e.Bq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Eb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Eb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof we)&&(b=d.Ah(b),b=c.findPartForKey(b),null===b||b instanceof hf)&&(a.containingGroup=b)}}};
Fq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Oq(b,c),e=this.vc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.cb(g)?e instanceof hf&&b.Ah(g)===c&&(g=this.vc(g),null!==g&&(g.containingGroup=e)):(f.link=this.uc(g),null!==f.link&&e instanceof W&&(Jq(b,g,!0)===c&&(f.link.fromNode=e),Jq(b,g,!1)===c&&(f.link.toNode=e),g=b.xf(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}}Pq(b,c)}a=b.Ah(a);void 0!==a&&(a=this.Eb(a),a instanceof hf&&(e.containingGroup=a))}};Fq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Qq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Qq(b,c,d.data));if(a instanceof hf)for(a=a.memberParts;a.next();)d=a.value.data,b.cb(d)&&Qq(b,c,d)}}};
Fq.prototype.copyPartData=function(a,b){var c=hi.prototype.copyPartData.call(this,a,b);if(a instanceof U)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.eq(a);"object"===typeof a&&null!==a&&(d.Ci(a),c=b.uc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.eq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Fq.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 U){if(ng(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&&(ng(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.eq(d),"object"===
typeof d&&null!==d))return null!==a&&Rq(f,d,f.pa(a.data),!0),Sq(f,d,h,!0),null!==c&&Rq(f,d,f.pa(c.data),!1),Sq(f,d,b,!1),f.Ci(d),a=g.archetypeLabelNodeData,null===a||a instanceof W||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.nf(a),a=f.pa(a),void 0!==a&&f.av(d,a))),e.uc(d);return null};Fq.prototype.findLinkForKey=Fq.prototype.findLinkForKey;Fq.prototype.findPartForKey=Fq.prototype.findPartForKey;Fq.prototype.removeAllModeledParts=Fq.prototype.removeAllModeledParts;
Fq.prototype.addModeledParts=Fq.prototype.addModeledParts;Fq.prototype.addAllModeledParts=Fq.prototype.addAllModeledParts;Fq.className="GraphLinksPartManager";function Tq(){hi.apply(this,arguments);this.eh=null}ma(Tq,hi);
function Uq(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||!If(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(ng(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Jf=d;
b.ib=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.ib=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Tq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Js(a)};Tq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.ft(a,b)};
Tq.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.pa(b));else{var e=this.eh;this.eh=a;null!==c&&d.fe(c.data,void 0);d.fe(b,d.pa(null!==a.toNode?a.toNode.data:null));this.eh=e}};
Tq.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.eh;this.eh=a;null!==c&&d.fe(c.data,void 0);d.fe(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.eh=e}else d.fe(a.data,d.pa(b))};Tq.prototype.removeDataForLink=function(a){this.diagram.model.fe(a.data,void 0)};
Tq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Vb(a);return null!==a?this.Qe.H(a):null};
Tq.prototype.doModelChanged=function(a){hi.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===ce){if("nodeParentKey"===d){var e=a.object,f=this.Eb(a.newValue),g=this.Hi(e);if(null!==this.eh)null!==f&&(this.eh.data=e,this.eh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Ji();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:Uq(this,f,g)}}else if("parentLinkCategory"===
d){var k=this.Hi(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Ji();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===ce){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Hd());b.isModified=!0}}finally{b.Z=!0}}}}};
Tq.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.Bh(b),b=c.Eb(b),d=a.lg(),b!==d&&(d=a.Ji(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:Uq(this,b,a):null!==d&&Fj(c,d,!1)))}}};Tq.prototype.updateDataBindings=function(a,b){hi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.vc(a)&&(a=this.uc(a),null!==a&&a.Da(b))};
Tq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Oq(b,c),e=this.vc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.cb(f)&&e instanceof W&&b.Bh(f)===c&&Uq(this,e,this.Hi(f))}Pq(b,c)}a=b.Bh(a);void 0!==a&&e instanceof W&&(a=this.Eb(a),Uq(this,a,e))}};
Tq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof W){var c=b.pa(a.data),d=this.uc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.bc(-1,d,!1);0<=f&&this.diagram.Va(fe,"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.cb(e)&&Qq(b,c,e)}};
Tq.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.pa(d.data)),e.Ji()):null};Tq.prototype.findLinkForKey=Tq.prototype.findLinkForKey;Tq.className="TreePartManager";
function Z(a,b){this.Dl=new G;this.Bl=new G;this.ww=',\n  "insertedNodeKeys": ';this.Oy=',\n  "modifiedNodeData": ';this.yw=',\n  "removedNodeKeys": ';this.Lh=null;Ta(this);this.vn=this.na="";this.Mg=!1;this.j={};this.Cc=[];this.bb=new I;this.ni="key";this.Sk=this.vl=null;this.mn=this.nn=!1;this.pn=!0;this.Ym=null;this.Kj="category";this.Lf=new I;this.hu=new E;this.gh=!1;this.o=null;this.undoManager=new pe;void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}
Z.prototype.cloneProtected=function(a){a.na=this.na;a.vn=this.vn;a.Mg=this.Mg;a.ni=this.ni;a.vl=this.vl;a.Sk=this.Sk;a.nn=this.nn;a.mn=this.mn;a.pn=this.pn;a.Ym=this.Ym;a.Kj=this.Kj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Z.prototype.clear=function(){this.Cc=[];this.bb.clear();this.Lf.clear();this.undoManager.clear()};
Z.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.Hq();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.pa(e)+":"+Ka(e)}}return b};
Z.prototype.aB=function(a){a.change!==de&&C("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof oe))return null;Vq(this,b);a=this.nw(b,"FinishedUndo"===a.propertyName);this.Lh=null;return a};
Z.prototype.nw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Lh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):c.cb(a.object)?f.add(a.object):a.change!==ce||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.cb(a)&&f.add(a)}):a.object instanceof Z||c.Qi()&&c.tc(a.object)||Wq(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.Bl;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.Dl;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a=c.cloneDeep(f.xa());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.xa():m.insertedNodeKeys=k.xa());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.xa():m.removedNodeKeys=l.xa());l.clear();k.clear();return m};
Z.prototype.cloneDeep=function(a){return Xq(this,a,!0)};
function Xq(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=kb++,d.set(a,c),e.set(a,b))}if(!za(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new I);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new I),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(Xq(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof M||b instanceof N||b instanceof ic||b instanceof P)k=b.copy(),
g(b,k);else{if(b instanceof ml||b instanceof Q||b instanceof D)return b;if(b instanceof E)k=(new E).addAll(Xq(a,b.xa(),!1,d,e,f)),g(b,k);else if(b instanceof G)k=(new G).addAll(Xq(a,b.xa(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(Xq(a,b.xa(),!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]=Xq(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Z.prototype;t.quote=function(a){return JSON.stringify(a).replace(/[\u007F-\uFFFF]/g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).substr(-4)})};
t.Nm=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.zq=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 Yq(a,b){b=b.modelData;za(b)&&(a.xm(b),a.modelData=b)}
t.ow=function(){var a=this.modelData,b=!1,c;for(c in a)if(!Zq(c,a[c])){b=!0;break}a="";b&&(a=',\n  "modelData": '+$q(this,this.modelData));return a+',\n  "nodeDataArray": '+ar(this,this.nodeDataArray,!0)};t.Nv=function(a){Yq(this,a);a=a.nodeDataArray;Aa(a)&&(this.xm(a),this.nodeDataArray=a)};
function Vq(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.Lh;null===d&&(d=new I,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===ce)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===ee||b===fe)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Lh=d)}function Wq(a,b){for(var c=new G,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];br(a,b,e,e,c)}return c}
function br(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(br(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(br(a,b,g,d,e))return!0}return!1}
t.mw=function(a,b){var c=this,d=!1,e=new G,f=new G,g=new G,h=this.Lh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):c.cb(a.object)?f.add(a.object):a.change!==ce||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.cb(a)&&f.add(a)}):a.object instanceof Z||c.Qi()&&c.tc(a.object)||Wq(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.Bl;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.Dl;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=',\n  "modelData": '+$q(this,this.modelData));0<k.count&&(a+=(b?this.yw:this.ww)+ar(this,k.xa(),!0));0<f.count&&(a+=this.Oy+ar(this,f.xa(),!0));0<l.count&&(a+=(b?this.ww:this.yw)+ar(this,l.xa(),!0));l.clear();k.clear();return a};
t.yq=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)&&
C("applyIncrementalJson cannot change Model properties");Yq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new I;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(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.Vb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Em(h,g),this.nf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Vb(f),null!==f){for(var k in e)"__gohashid"===k||k===
this.nodeKeyProperty||this.nk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.Fm(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Vb(a[k]),null!==b&&this.wm(b)};
t.Hy=function(a,b){a.change!==de&&C("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof oe))return'{ "incremental": 0 }';void 0===b&&(b=cr(this,this));Vq(this,c);a=this.mw(c,"FinishedUndo"===a.propertyName);this.Lh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Nm()+a+"}"};t.bB=function(a,b){return this.Hy(a,b)};
t.Hq=function(a){void 0===a&&(a=cr(this,this));return'{ "class": '+this.quote(a)+this.Nm()+this.ow()+"}"};t.toJSON=function(a){return this.Hq(a)};t.Cx=function(a){var b=null;if("string"===typeof a)try{b=x.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:C("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&C("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.wa("applyIncrementalJson"),this.yq(b),this.Xa("applyIncrementalJson"))};t.mz=function(a){return this.Cx(a)};
Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.xm=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.xm(d);Array.isArray(a)?a[e]=d:C("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.xm(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 dr(a)}return a};
t.Om=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.Om(a.valueOf()):Aa(a)?ar(this,a):za(a)?$q(this,a):"function"===typeof a?"null":a.toString()};
function ar(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new Va;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.Om(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function Zq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function er(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function $q(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:er(c.x),y:er(c.y)};else if(c instanceof M)b={"class":"go.Size",width:er(c.width),height:er(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:er(c.x),y:er(c.y),width:er(c.width),height:er(c.height)};else if(c instanceof ic)b={"class":"go.Margin",top:er(c.top),right:er(c.right),bottom:er(c.bottom),left:er(c.left)};else if(c instanceof P)c.hb()?b={"class":"go.Spot",x:er(c.x),y:er(c.y),offsetX:er(c.offsetX),offsetY:er(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof ml){b={"class":"go.Brush",type:c.type.name};if(c.type===tl)b.color=c.color;else if(c.type===wl||c.type===nl)b.start=c.start,b.end=c.end,c.type===nl&&(0!==c.startRadius&&(b.startRadius=er(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=er(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 Q?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
er(c.startX)),0!==c.startY&&(b.startY=er(c.startY)),0!==c.endX&&(b.endX=er(c.endX)),0!==c.endY&&(b.endY=er(c.endY)),c.spot1.A(sc)||(b.spot1=c.spot1),c.spot2.A(Cc)||(b.spot2=c.spot2),c.type===Q.o&&(b.path=Q.Ga(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:cr(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=on(b,e);if(!Zq(e,f))if(c?c=!1:d+=",",d+=a.quote(e)+":","points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Om(h.x);
g+=",";g+=a.Om(h.y)}g+="]";d+=g}else d+=a.Om(f)}return d+"}"}function gr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
function dr(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(gr(a.x),gr(a.y));else if("Size"===b)c=new M(gr(a.width),gr(a.height));else if("Rect"===b)c=new N(gr(a.x),gr(a.y),gr(a.width),gr(a.height));else if("Margin"===b)c=new ic(gr(a.top),gr(a.right),gr(a.bottom),gr(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=jd(a["enum"]):c=new P(gr(a.x),
gr(a.y),gr(a.offsetX),gr(a.offsetY));else if("Brush"===b){if(c=new ml,c.type=Ua(ml,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof P&&(c.start=a.start),a.end instanceof P&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=gr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=gr(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=Q.parse(a.path):c=new Q,c.type=Ua(Q,a.type),
"number"===typeof a.startX&&(c.startX=gr(a.startX)),"number"===typeof a.startY&&(c.startY=gr(a.startY)),"number"===typeof a.endX&&(c.endX=gr(a.endX)),"number"===typeof a.endY&&(c.endY=gr(a.endY)),a.spot1 instanceof P&&(c.spot1=a.spot1),a.spot2 instanceof P&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=hr(d),"function"===typeof d&&(c=Ua(d,a.name)));return c}t.uh=function(a){this.hu.add(a);return this};t.Bk=function(a){this.hu.remove(a)};
t.ws=function(a){this.skipsUndoManager||this.undoManager.yv(a);for(var b=this.hu,c=b.length,d=0;d<c;d++)b.J(d)(a)};t.Va=function(a,b,c,d,e,f,g){ir(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){ir(this,"",ce,a,this,b,c,d,e)};t.$s=function(a,b,c,d,e,f){ir(this,"",ce,b,a,c,d,e,f)};function ir(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new be;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.ws(l)}
Z.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===ce){var c=a.object,d=a.propertyName,e=a.H(b);d===this.nodeKeyProperty&&this.cb(c)&&(b=a.H(!b),void 0!==b&&this.bb.remove(b),void 0!==e&&this.bb.add(e,c));Mj(c,d,e)}else a.change===ee?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,za(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Cc[c]===a&&Ea(this.Cc,c),void 0!==d&&this.bb.remove(d)):(this.Cc[c]!==a&&Da(this.Cc,c,a),void 0!==d&&this.bb.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Aa(d)&&a.propertyName&&(d=on(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.newValue,b?Ea(d,c):Da(d,c,a))):C("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===fe?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,za(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Cc[c]!==a&&Da(this.Cc,c,a),void 0!==d&&this.bb.add(d,a)):(this.Cc[c]===a&&Ea(this.Cc,c),void 0!==d&&this.bb.remove(d)))):""===a.modelChange?((d=a.object)&&!Aa(d)&&a.propertyName&&(d=
on(a.object,a.propertyName)),Aa(d)&&"number"===typeof c&&(a=a.oldValue,b?Da(d,c,a):Ea(d,c))):C("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==de&&C("unknown ChangedEvent: "+a.toString())};Z.prototype.wa=function(a){return this.undoManager.wa(a)};Z.prototype.Xa=function(a){return this.undoManager.Xa(a)};Z.prototype.Df=function(){return this.undoManager.Df()};
Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.wa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.Xa(b):this.undoManager.Df(),this.skipsUndoManager=c}};t=Z.prototype;t.Da=function(a,b){void 0===b&&(b="");ir(this,"SourceChanged",de,b,a,null,null)};
t.pa=function(a){if(null!==a){var b=this.ni;if(""!==b&&(b=on(a,b),void 0!==b)){if(Lq(b))return b;C("Key value for node data "+a+" is not a number or a string: "+b)}}};t.Em=function(a,b){if(null!==a){var c=this.ni;if(""!==c)if(this.cb(a)){var d=on(a,c);d!==b&&null===this.Vb(b)&&(Mj(a,c,b),void 0!==d&&this.bb.remove(d),this.bb.add(b,a),ir(this,"nodeKey",ce,c,a,d,b),"string"===typeof c&&this.Da(a,c),this.Dq(d,b))}else Mj(a,c,b)}};function Lq(a){return"number"===typeof a||"string"===typeof a}
t.cb=function(a){var b=this.pa(a);return void 0===b?!1:this.bb.H(b)===a};t.Vb=function(a){null===a&&C("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Lq(a)?this.bb.H(a):null};
t.Fv=function(a){if(null!==a){var b=this.ni;if(""!==b){var c=this.pa(a);if(void 0===c||this.bb.contains(c)){var d=this.vl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.bb.contains(c))){Mj(a,b,c);return}if("string"===typeof c){for(d=2;this.bb.contains(c+d);)d++;Mj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.bb.count-1;this.bb.contains(c);)c--;Mj(a,b,c)}}}}};t.nf=function(a){null!==a&&(ib(a),this.cb(a)||Dq(this,a,!0))};
function Dq(a,b,c){var d=a.pa(b);if(void 0===d||a.bb.H(d)!==b)a.Fv(b),d=a.pa(b),void 0===d&&C("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."),a.bb.add(d,b),d=null,c&&(d=a.Cc.length,Da(a.Cc,d,b)),ir(a,"nodeDataArray",ee,"nodeDataArray",a,null,b,null,d),a.zm(b),a.ym(b)}t.iz=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.nf(a[c]);else for(a=a.iterator;a.next();)this.nf(a.value)};t.wm=function(a){null!==a&&Cq(this,a,!0)};
function Cq(a,b,c){var d=a.pa(b);void 0!==d&&a.bb.remove(d);d=null;if(c){a:if(c=a.Cc,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;Ea(a.Cc,d)}ir(a,"nodeDataArray",fe,"nodeDataArray",a,b,null,d,null);a.Kq(b)}t.QA=function(a){if(Aa(a))for(var b=a.length,c=0;c<b;c++)this.wm(a[c]);else for(a=a.iterator;a.next();)this.wm(a.value)};
t.DA=function(a){if(a!==this.nodeDataArray&&Aa(a)){var b=this.Dl;b.clear();b.addAll(this.bb.iteratorKeys);var c=this.Bl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Vb(g);h!==f&&(null!==h?(this.Yp(h,f),this.Fm(f,h)):(f=this.cloneDeep(f),this.Em(f,g),this.nf(f)))}else g=this.cloneDeep(f),this.nf(g),c.add(this.pa(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Vb(d))&&this.wm(d);b.clear();c.clear()}};
t.Dq=function(a,b){void 0!==b&&(a=Oq(this,a),a instanceof G&&this.Lf.add(b,a))};t.hw=function(){};t.zm=function(){};t.ym=function(){};t.Kq=function(){};function Qq(a,b,c){if(void 0!==b){var d=a.Lf.H(b);null===d&&(d=new G,a.Lf.add(b,d));d.add(c)}}function Pq(a,b,c){if(void 0!==b){var d=a.Lf.H(b);d instanceof G&&(void 0===c||null===c?a.Lf.remove(b):(d.remove(c),0===d.count&&a.Lf.remove(b)))}}function Oq(a,b){if(void 0===b)return null;a=a.Lf.H(b);return a instanceof G?a:null}
t.uz=function(a){void 0===a?this.Lf.clear():this.Lf.remove(a)};Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Sk;a=null!==b?b(a,this):jr(this,a,!0);za(a)&&Ta(a);return a};
function jr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=jr(a,b[c],a.copiesArrayObjects);d.push(e)}Ta(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=on(b,d),g=cr(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 pe||f instanceof oe||f instanceof be?Mj(c,d,f):(f=jr(a,f,!1),Mj(c,d,f))}Ta(c);return c}return b instanceof J?b.copy():b instanceof M?b.copy():b instanceof N?b.copy():b instanceof P?b.copy():b instanceof ic?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.Em(a,c);return}if(b===this.nodeCategoryProperty){this.Dm(a,c);return}}else!kr&&a instanceof Y&&(kr=!0,ya('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),ya("  Is that really your intent?"));var d=on(a,b);d!==c&&(Mj(a,b,c),this.$s(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.Yp=function(a,b){if(b){var c=this.cb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.ez=function(a,b){this.Ks(a,-1,b)};t.Ks=function(a,b,c){0>b&&(b=a.length);Da(a,b,c);ir(this,"",ee,"",a,null,c,null,b)};t.Qv=function(a,b){void 0===b&&(b=-1);a===this.Cc&&C("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ea(a,b);ir(this,"",fe,"",a,c,null,b,null)};
t.lq=function(a){if(null===a)return"";var b=this.Kj;if(""===b)return"";b=on(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getCategoryForNodeData found a non-string category for "+a+": "+b)};t.Dm=function(a,b){if(null!==a){var c=this.Kj;if(""!==c)if(this.cb(a)){var d=on(a,c);void 0===d&&(d="");d!==b&&(Mj(a,c,b),ir(this,"nodeCategory",ce,c,a,d,b))}else Mj(a,c,b)}};t.Fm=function(a,b){this.Dm(b,this.lq(a))};t.nm=function(){return!1};t.nk=function(){return!1};t.Qi=function(){return!1};
t.Ps=function(){return!1};t.pk=function(){return!1};function ji(){return new Z}function cr(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 cr(a,b.constructor);return typeof b}function hr(a){return lr[a]?lr[a]:void 0!==x.go&&x.go[a]?x.go[a]:null}
function on(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 Mj(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.na},set:function(a){var b=this.na;b!==a&&(this.na=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.vn},set:function(a){var b=this.vn;b!==a&&(this.vn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.Mg},set:function(a){var b=this.Mg;b!==a&&(this.Mg=a,this.g("isReadOnly",b,a))}},modelData:{
get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.g("modelData",b,a),this.Da(a))}},undoManager:{get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(null!==b&&b.xy(this),this.o=a,null!==a&&a.Ax(this))}},skipsUndoManager:{get:function(){return this.gh},set:function(a){this.gh=a}},nodeKeyProperty:{get:function(){return this.ni},set:function(a){var b=this.ni;
b!==a&&(""===a&&C("Model.nodeKeyProperty may not be the empty string"),0<this.bb.count&&C("Cannot set Model.nodeKeyProperty when there is existing node data"),this.ni=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.vl},set:function(a){var b=this.vl;b!==a&&(this.vl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Cc},set:function(a){var b=this.Cc;if(b!==a){this.bb.clear();
this.hw();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||C("Model.nodeDataArray must only contain Objects, not: "+e);ib(e)}this.Cc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.bb.H(g)?d.add(f):this.bb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Fv(e),f=this.pa(e),void 0!==f&&this.bb.add(f,e);ir(this,"nodeDataArray",ce,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.zm(d),this.ym(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{
get:function(){return this.Sk},set:function(a){var b=this.Sk;b!==a&&(this.Sk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.nn},set:function(a){var b=this.nn;b!==a&&(this.nn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.mn},set:function(a){var b=this.mn;b!==a&&(this.mn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{get:function(){return this.pn},
set:function(a){var b=this.pn;b!==a&&(this.pn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Ym},set:function(a){var b=this.Ym;b!==a&&(this.Ym=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.Kj},set:function(a){var b=this.Kj;b!==a&&(this.Kj=a,this.g("nodeCategoryProperty",b,a))}},type:{get:function(){return"Model"}}});
Z.prototype.setCategoryForNodeData=Z.prototype.Dm;Z.prototype.getCategoryForNodeData=Z.prototype.lq;Z.prototype.removeArrayItem=Z.prototype.Qv;Z.prototype.insertArrayItem=Z.prototype.Ks;Z.prototype.addArrayItem=Z.prototype.ez;Z.prototype.assignAllDataProperties=Z.prototype.Yp;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.uz;Z.prototype.mergeNodeDataArray=Z.prototype.DA;Z.prototype.removeNodeDataCollection=Z.prototype.QA;Z.prototype.removeNodeData=Z.prototype.wm;
Z.prototype.addNodeDataCollection=Z.prototype.iz;Z.prototype.addNodeData=Z.prototype.nf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.Fv;Z.prototype.findNodeDataForKey=Z.prototype.Vb;Z.prototype.containsNodeData=Z.prototype.cb;Z.prototype.setKeyForNodeData=Z.prototype.Em;Z.prototype.getKeyForNodeData=Z.prototype.pa;Z.prototype.updateTargetBindings=Z.prototype.Da;Z.prototype.commit=Z.prototype.commit;Z.prototype.rollbackTransaction=Z.prototype.Df;Z.prototype.commitTransaction=Z.prototype.Xa;
Z.prototype.startTransaction=Z.prototype.wa;Z.prototype.raiseDataChanged=Z.prototype.$s;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.Va;Z.prototype.removeChangedListener=Z.prototype.Bk;Z.prototype.addChangedListener=Z.prototype.uh;Z.prototype.writeJsonValue=Z.prototype.Om;Z.prototype.replaceJsonObjects=Z.prototype.xm;Z.prototype.applyIncrementalJSON=Z.prototype.mz;Z.prototype.applyIncrementalJson=Z.prototype.Cx;Z.prototype.toJSON=Z.prototype.toJSON;
Z.prototype.toJson=Z.prototype.Hq;Z.prototype.toIncrementalJSON=Z.prototype.bB;Z.prototype.toIncrementalJson=Z.prototype.Hy;Z.prototype.toIncrementalData=Z.prototype.aB;Z.prototype.clear=Z.prototype.clear;var kr=!1,lr={};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:C("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=hr(d)):(e=hr(d),null===e&&(e=x[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:C("Unable to construct a Model of declared class: "+c["class"])}null===b&&(b=Z.constructGraphLinksModel());
b.zq(c);b.Nv(c);return b};Z.safePropertyValue=on;Z.safePropertySet=Mj;lr.Brush=ml;lr.ChangedEvent=be;lr.Geometry=Q;lr.Margin=ic;lr.Panel=X;lr.Point=J;lr.Rect=N;lr.Size=M;lr.Spot=P;lr.Transaction=oe;lr.UndoManager=pe;function ri(a,b,c,d){Ta(this);this.v=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.j=-1;this.md=null;this.Yl=a;this.Xl=this.Jp=0;this.gs=null;this.lo=!1;this.Ql=b;this.ln=c;void 0===d?(this.yl=mr,this.Lk=null):(this.yl=gn,this.Lk=d);this.Ot=new G}
ri.prototype.copy=function(){var a=new ri;a.Yl=this.Yl;a.Jp=this.Jp;a.Xl=this.Xl;a.gs=this.gs;a.lo=this.lo;a.Ql=this.Ql;a.ln=this.ln;a.yl=this.yl;a.Lk=this.Lk;return a};t=ri.prototype;t.gb=function(a){a.classType===ri&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Yi?" "+this.Yi:"")+" "+this.mode.name+")"};t.freeze=function(){this.v=!0;return this};t.ea=function(){this.v=!1;return this};
t.oy=function(a){void 0===a&&(a=null);this.mode=gn;this.backConverter=a;return this};t.wq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.GA=function(){this.sourceName=null;this.isToModel=!0;return this};function fl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.Ya(a)}
t.iw=function(a,b,c){var d=this.Ql;if(void 0===c||""===d||d===c){c=this.Yl;var e=this.ln;if(null===e&&""===c)ya("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=on(b,d));if(void 0!==f)if(null===e)""!==c&&Mj(a,c,f);else try{if(""!==c){var g=e(f,a);Mj(a,c,g)}else e(f,a)}catch(h){}}}};
t.Mq=function(a,b,c,d){if(this.yl===gn){var e=this.Yl;if(void 0===c||e===c){c=this.Ql;var f=this.Lk,g=a;""!==e&&(g=on(a,e));if(void 0!==g&&!this.Ot.contains(a))try{this.Ot.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):Mj(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.Qv(m,l);k.Ks(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Mj(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.Qv(q,r);k.Ks(q,r,p)}}}catch(u){}}finally{this.Ot.remove(a)}}}};
na.Object.defineProperties(ri.prototype,{Yi:{get:function(){return this.j},set:function(a){this.v&&wa(this);this.j=a}},targetProperty:{get:function(){return this.Yl},set:function(a){this.v&&wa(this);this.Yl=a}},sourceName:{get:function(){return this.gs},set:function(a){this.v&&wa(this);this.gs=a;null!==a&&(this.lo=!1)}},isToModel:{get:function(){return this.lo},set:function(a){this.v&&
wa(this);this.lo=a}},sourceProperty:{get:function(){return this.Ql},set:function(a){this.v&&wa(this);this.Ql=a}},converter:{get:function(){return this.ln},set:function(a){this.v&&wa(this);this.ln=a}},backConverter:{get:function(){return this.Lk},set:function(a){this.v&&wa(this);this.Lk=a}},mode:{get:function(){return this.yl},set:function(a){this.v&&wa(this);this.yl=a}}});
ri.prototype.updateSource=ri.prototype.Mq;ri.prototype.updateTarget=ri.prototype.iw;ri.prototype.ofModel=ri.prototype.GA;ri.prototype.ofObject=ri.prototype.wq;ri.prototype.makeTwoWay=ri.prototype.oy;var Ik="Binding",mr=new D(ri,"OneWay",1),gn=new D(ri,"TwoWay",2);ri.className="Binding";ri.parseEnum=function(a,b){return function(c){c=Ua(a,c);return null===c?b:c}};ri.toString=Ka;ri.OneWay=mr;ri.TwoWay=gn;
function nr(a,b,c){Z.call(this);this.vw=',\n  "insertedLinkKeys": ';this.Ny=',\n  "modifiedLinkData": ';this.xw=',\n  "removedLinkKeys": ';this.Xc=[];this.Rf=new G;this.jb=new I;this.gi="";this.mj=this.Rk=this.wl=null;this.Xe="from";this.Ye="to";this.Gj=this.Fj="";this.Ej="category";this.$d="";this.Cl="isGroup";this.xe="group";this.on=!1;void 0!==b&&(this.linkDataArray=b);void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));c&&Object.assign(this,c)}ma(nr,Z);nr.constructGraphLinksModel=Z.constructGraphLinksModel;
nr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.gi=this.gi;a.wl=this.wl;a.Rk=this.Rk;a.Xe=this.Xe;a.Ye=this.Ye;a.Fj=this.Fj;a.Gj=this.Gj;a.Ej=this.Ej;a.$d=this.$d;a.Cl=this.Cl;a.xe=this.xe;a.on=this.on};t=nr.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Xc=[];this.jb.clear();this.Rf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Hq();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.pa(e)+":"+Ka(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Jq(this,e,!0)+"--\x3e"+Jq(this,e,!1)}return b};
t.nw=function(a,b){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Z.prototype.nw.call(this,a,b),d=this,e=new G,f=new G,g=new G,h=this.Lh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):d.tc(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.tc(a)&&f.add(a)}):
a.object instanceof Z||d.cb(a.object)||or(d,a.object).each(function(a){f.add(a)})))});var k=this.Bl;k.clear();e.each(function(a){k.add(d.mc(a));b||f.add(a)});var l=this.Dl;l.clear();g.each(function(a){l.add(d.mc(a));b&&f.add(a)});a=d.cloneDeep(f.xa());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.xa():c.insertedLinkKeys=k.xa());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.xa():c.removedLinkKeys=l.xa());l.clear();k.clear();return c};
t.Nm=function(){var a=Z.prototype.Nm.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.zq=function(a){Z.prototype.zq.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.ow=function(){var a=Z.prototype.ow.call(this),b=',\n  "linkDataArray": '+ar(this,this.linkDataArray,!0);return a+b};t.Nv=function(a){Z.prototype.Nv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.xm(a),this.linkDataArray=a)};
function or(a,b){for(var c=new G,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];br(a,b,e,e,c)}return c}
t.mw=function(a,b){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Z.prototype.mw.call(this,a,b),d=this,e=new G,f=new G,g=new G,h=this.Lh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ee?e.add(a.newValue):a.change===fe&&g.add(a.oldValue):d.tc(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.tc(a)&&f.add(a)}):
a.object instanceof Z||d.cb(a.object)||or(d,a.object).each(function(a){f.add(a)})))});var k=this.Bl;k.clear();e.each(function(a){k.add(d.mc(a));b||f.add(a)});var l=this.Dl;l.clear();g.each(function(a){l.add(d.mc(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.xw:this.vw)+ar(this,k.xa(),!0));0<f.count&&(a+=this.Ny+ar(this,f.xa(),!0));0<l.count&&(a+=(b?this.vw:this.xw)+ar(this,l.xa(),!0));l.clear();k.clear();return a};
t.yq=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)&&C("applyIncrementalJson cannot change Model properties");Z.prototype.yq.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.zh(e);null===f&&(f=this.eq({}),this.dt(f,e),this.Ci(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.mc(e),f=this.zh(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);pr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.zh(a[b]),null!==c&&this.vm(c)};
nr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===ce){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.tc(c)){var e=a.H(b);b=a.H(!b);void 0!==b&&this.jb.remove(b);void 0!==e&&this.jb.add(e,c);Mj(c,d,e);return}}else if(a.change===ee){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;za(a)&&"number"===typeof c&&(d=this.mc(a),b?(this.Rf.remove(a),this.Xc[c]===a&&this.Xc.splice(c,1),void 0!==d&&this.jb.remove(d)):(this.Rf.add(a),this.Xc[c]!==
a&&this.Xc.splice(c,0,a),void 0!==d&&this.jb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.xf(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===fe){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;za(a)&&"number"===typeof c&&(d=this.mc(a),b?(this.Rf.add(a),this.Xc[c]!==a&&this.Xc.splice(c,0,a),void 0!==d&&this.jb.add(d,a)):(this.Rf.remove(a),this.Xc[c]===
a&&this.Xc.splice(c,1),void 0!==d&&this.jb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.xf(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=nr.prototype;t.pm=function(a){if(void 0!==a){var b=this.mj;if(null!==b){var c=this.Vb(a);null===c&&(c=this.copyNodeData(b),Mj(c,this.nodeKeyProperty,a),this.nf(c))}return a}};
t.Zx=function(a){return Jq(this,a,!0)};t.Wv=function(a,b){Rq(this,a,b,!0)};t.by=function(a){return Jq(this,a,!1)};t.$v=function(a,b){Rq(this,a,b,!1)};function Jq(a,b,c){if(null!==b&&(a=c?a.Xe:a.Ye,""!==a&&(a=on(b,a),void 0!==a))){if(Lq(a))return a;C((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function Rq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.Xe:a.Ye;if(""!==e)if(c=a.pm(c),a.tc(b)){var f=on(b,e);f!==c&&(Pq(a,f,b),Mj(b,e,c),null===a.Vb(c)&&Qq(a,c,b),ir(a,d?"linkFromKey":"linkToKey",ce,e,b,f,c),"string"===typeof e&&a.Da(b,e))}else Mj(b,e,c)}}t.$x=function(a){return Iq(this,a,!0)};t.Xv=function(a,b){Sq(this,a,b,!0)};t.ey=function(a){return Iq(this,a,!1)};t.aw=function(a,b){Sq(this,a,b,!1)};
function Iq(a,b,c){if(null===b)return"";a=c?a.Fj:a.Gj;if(""===a)return"";b=on(b,a);return void 0===b?"":b}function Sq(a,b,c,d){if(null!==b){var e=d?a.Fj:a.Gj;if(""!==e)if(a.tc(b)){var f=on(b,e);void 0===f&&(f="");f!==c&&(Mj(b,e,c),ir(a,d?"linkFromPortId":"linkToPortId",ce,e,b,f,c),"string"===typeof e&&a.Da(b,e))}else Mj(b,e,c)}}t.xf=function(a){if(null===a)return qr;var b=this.$d;if(""===b)return qr;a=on(a,b);return void 0===a?qr:a};
t.et=function(a,b){if(null!==a){var c=this.$d;if(""!==c)if(this.tc(a)){var d=on(a,c);void 0===d&&(d=qr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Pq(this,d[f],a);Mj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Vb(g)&&Qq(this,g,a)}ir(this,"linkLabelKeys",ce,c,a,d,b);"string"===typeof c&&this.Da(a,c)}}else Mj(a,c,b)}};
t.av=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.$d;if(""!==c){var d=on(a,c);if(void 0===d)c=[],c.push(b),this.et(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.tc(a)&&(null===this.Vb(b)&&Qq(this,b,a),ir(this,"linkLabelKeys",ee,c,a,null,b,null,e)))}else C(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.wy=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.$d;if(""!==c){var d=on(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.tc(a)&&(Pq(this,b,a),ir(this,"linkLabelKeys",fe,c,a,b,null,e,null)))}else void 0!==d&&C(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.mc=function(a){if(null!==a){var b=this.gi;if(""!==b&&(b=on(a,b),void 0!==b)){if(Lq(b))return b;C("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.dt=function(a,b){if(null!==a){var c=this.gi;if(""!==c)if(this.tc(a)){var d=on(a,c);d!==b&&null===this.zh(b)&&(Mj(a,c,b),void 0!==d&&this.jb.remove(d),this.jb.add(b,a),ir(this,"linkKey",ce,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Mj(a,c,b)}};t.zh=function(a){null===a&&C("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Lq(a)?this.jb.H(a):null};
t.Us=function(a){if(null!==a){var b=this.gi;if(""!==b){var c=this.mc(a);if(void 0===c||this.jb.contains(c)){var d=this.wl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.jb.contains(c))){Mj(a,b,c);return}if("string"===typeof c){for(d=2;this.jb.contains(c+d);)d++;Mj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.jb.count-1;this.jb.contains(c);)c--;Mj(a,b,c)}}}}};t.tc=function(a){return null===a?!1:this.Rf.contains(a)};t.Ci=function(a){null!==a&&(ib(a),this.tc(a)||Nq(this,a,!0))};
function Nq(a,b,c){if(""!==a.linkKeyProperty){var d=a.mc(b);if(void 0!==d&&a.jb.H(d)===b)return;a.Us(b);d=a.mc(b);void 0===d&&C("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");a.jb.add(d,b)}a.Rf.add(b);d=null;c&&(d=a.Xc.length,a.Xc.splice(d,0,b));ir(a,"linkDataArray",ee,"linkDataArray",a,null,b,null,d);rr(a,b)}t.hz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Ci(a[c]);else for(a=a.iterator;a.next();)this.Ci(a.value)};
t.vm=function(a){null!==a&&Mq(this,a,!0)};function Mq(a,b,c){a.Rf.remove(b);var d=a.mc(b);void 0!==d&&a.jb.remove(d);d=null;if(c){d=a.Xc.indexOf(b);if(0>d)return;a.Xc.splice(d,1)}ir(a,"linkDataArray",fe,"linkDataArray",a,b,null,d,null);c=Jq(a,b,!0);Pq(a,c,b);c=Jq(a,b,!1);Pq(a,c,b);d=a.xf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Pq(a,c,b)}t.OA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.vm(a[c]);else for(a=a.iterator;a.next();)this.vm(a.value)};
t.CA=function(a){""===this.linkKeyProperty&&C("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Aa(a)){var b=this.Dl;b.clear();b.addAll(this.jb.iteratorKeys);var c=this.Bl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.mc(f);if(void 0!==g){c.add(g);var h=this.zh(g);h!==f&&(null!==h?(this.Yp(h,f),pr(this,f,h)):(f=this.cloneDeep(f),this.dt(f,g),this.Ci(f)))}else g=this.cloneDeep(f),this.Ci(g),c.add(this.mc(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.zh(d))&&this.vm(d);b.clear();c.clear()}};function rr(a,b){var c=Jq(a,b,!0);c=a.pm(c);null===a.Vb(c)&&Qq(a,c,b);c=Jq(a,b,!1);c=a.pm(c);null===a.Vb(c)&&Qq(a,c,b);var d=a.xf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Vb(c)&&Qq(a,c,b)}
t.eq=function(a){if(null===a)return null;var b=this.Rk;a=null!==b?b(a,this):jr(this,a,!0);za(a)&&(Ta(a),""!==this.Xe&&Mj(a,this.Xe,void 0),""!==this.Ye&&Mj(a,this.Ye,void 0),""!==this.$d&&Mj(a,this.$d,[]));return a};t.Dv=function(a){if(null===a)return!1;var b=this.Cl;return""===b?!1:on(a,b)?!0:!1};t.Ah=function(a){if(null!==a){var b=this.xe;if(""!==b&&(b=on(a,b),void 0!==b)){if(Lq(b))return b;C("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.Gq=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.xe;if(""!==c)if(this.cb(a)){var d=on(a,c);d!==b&&(Pq(this,d,a),Mj(a,c,b),null===this.Vb(b)&&Qq(this,b,a),ir(this,"nodeGroupKey",ce,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Mj(a,c,b)}};nr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.ck||""===this.xe||void 0===on(a,this.xe)||Mj(a,this.xe,void 0);return a};
nr.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.Em(a,c);return}if(b===this.nodeCategoryProperty){this.Dm(a,c);return}if(b===this.nodeGroupKeyProperty){this.Gq(a,c);return}}else if(this.tc(a)){if(b===this.linkFromKeyProperty){Rq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Rq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Sq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Sq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.dt(a,
c);return}if(b===this.linkCategoryProperty){this.Fq(a,c);return}if(b===this.linkLabelKeysProperty){this.et(a,c);return}}var d=on(a,b);d!==c&&(Mj(a,b,c),this.$s(a,b,d,c))};t=nr.prototype;t.Yp=function(a,b){if(b){var c=this.cb(a),d=this.tc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&on(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.Dq=function(a,b){Z.prototype.Dq.call(this,a,b);for(var c=this.bb.iterator;c.next();)this.Sv(c.value,a,b);for(c=this.Rf.iterator;c.next();){var d=c.value,e=a,f=b;if(Jq(this,d,!0)===e){var g=this.Xe;Mj(d,g,f);ir(this,"linkFromKey",ce,g,d,e,f);"string"===typeof g&&this.Da(d,g)}Jq(this,d,!1)===e&&(g=this.Ye,Mj(d,g,f),ir(this,"linkToKey",ce,g,d,e,f),"string"===typeof g&&this.Da(d,g));g=this.xf(d);if(Array.isArray(g))for(var h=g.length,k=this.$d,l=0;l<h;l++)g[l]===e&&(g[l]=f,ir(this,"linkLabelKeys",ee,
k,d,e,f,l,l))}};t.Sv=function(a,b,c){if(this.Ah(a)===b){var d=this.xe;Mj(a,d,c);ir(this,"nodeGroupKey",ce,d,a,b,c);"string"===typeof d&&this.Da(a,d)}};t.hw=function(){Z.prototype.hw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)rr(this,a[c])};
t.zm=function(a){Z.prototype.zm.call(this,a);a=this.pa(a);var b=Oq(this,a);if(null!==b){var c=Fa();for(b=b.iterator;b.next();){var d=b.value;if(this.cb(d)){if(this.Ah(d)===a){var e=this.xe;ir(this,"nodeGroupKey",ce,e,d,a,a);"string"===typeof e&&this.Da(d,e);c.push(d)}}else if(Jq(this,d,!0)===a&&(e=this.Xe,ir(this,"linkFromKey",ce,e,d,a,a),"string"===typeof e&&this.Da(d,e),c.push(d)),Jq(this,d,!1)===a&&(e=this.Ye,ir(this,"linkToKey",ce,e,d,a,a),"string"===typeof e&&this.Da(d,e),c.push(d)),e=this.xf(d),
Array.isArray(e))for(var f=e.length,g=this.$d,h=0;h<f;h++)e[h]===a&&(ir(this,"linkLabelKeys",ee,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Pq(this,a,c[b]);Ia(c)}};t.ym=function(a){Z.prototype.ym.call(this,a);var b=this.Ah(a);null===this.Vb(b)&&Qq(this,b,a)};t.Kq=function(a){Z.prototype.Kq.call(this,a);var b=this.Ah(a);Pq(this,b,a)};
t.Gs=function(a){if(null===a)return"";var b=this.Ej;if(""===b)return"";b=on(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getCategoryForLinkData found a non-string category for "+a+": "+b)};nr.prototype.getLinkCategoryForData=function(a){return this.Gs(a)};nr.prototype.Fq=function(a,b){if(null!==a){var c=this.Ej;if(""!==c)if(this.tc(a)){var d=on(a,c);void 0===d&&(d="");d!==b&&(Mj(a,c,b),ir(this,"linkCategory",ce,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Mj(a,c,b)}};
nr.prototype.setLinkCategoryForData=function(a,b){this.Fq(a,b)};t=nr.prototype;t.Fm=function(a,b){Z.prototype.Fm.call(this,a,b);this.Gq(b,this.Ah(a))};function pr(a,b,c){a.Fq(c,a.Gs(b));a.Wv(c,a.Zx(b));a.$v(c,a.by(b));a.et(c,a.xf(b));a.Xv(c,a.$x(b));a.aw(c,a.ey(b))}t.nk=function(){return!0};t.Qi=function(){return!0};t.Ps=function(){return!0};t.pk=function(){return!0};
na.Object.defineProperties(nr.prototype,{archetypeNodeData:{get:function(){return this.mj},set:function(a){var b=this.mj;b!==a&&(this.mj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.Xe},set:function(a){var b=this.Xe;b!==a&&(this.Xe=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.Ye},set:function(a){var b=this.Ye;b!==a&&(this.Ye=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.Fj},set:function(a){var b=this.Fj;b!==a&&(this.Fj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.Gj},set:function(a){var b=this.Gj;b!==a&&(this.Gj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.$d},set:function(a){var b=this.$d;b!==a&&(this.$d=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Xc},set:function(a){var b=this.Xc;if(b!==a){this.jb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];za(e)||C("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);ib(e)}this.Xc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.mc(f);void 0===g?d.add(f):null!==this.jb.H(g)?d.add(f):this.jb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Us(e),f=this.mc(e),void 0!==f&&this.jb.add(f,
e)}d=new G;for(e=0;e<c;e++)d.add(a[e]);this.Rf=d;ir(this,"linkDataArray",ce,"linkDataArray",this,b,a);for(b=0;b<c;b++)rr(this,a[b])}}},linkKeyProperty:{get:function(){return this.gi},set:function(a){var b=this.gi;if(b!==a){this.gi=a;this.jb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.mc(e);void 0===f&&(this.Us(e),f=this.mc(e));void 0!==f&&this.jb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.wl},set:function(a){var b=this.wl;b!==a&&(this.wl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.Rk},set:function(a){var b=this.Rk;b!==a&&(this.Rk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.Cl},set:function(a){var b=this.Cl;b!==a&&(this.Cl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.xe},set:function(a){var b=this.xe;b!==a&&(this.xe=a,this.g("nodeGroupKeyProperty",b,a))}},ck:{get:function(){return this.on},set:function(a){this.on!==a&&(this.on=a)}},linkCategoryProperty:{get:function(){return this.Ej},set:function(a){var b=this.Ej;b!==a&&(this.Ej=a,this.g("linkCategoryProperty",b,a))}},type:{get:function(){return"GraphLinksModel"}}});
nr.prototype.setCategoryForLinkData=nr.prototype.Fq;nr.prototype.getCategoryForLinkData=nr.prototype.Gs;nr.prototype.assignAllDataProperties=nr.prototype.Yp;nr.prototype.setGroupKeyForNodeData=nr.prototype.Gq;nr.prototype.getGroupKeyForNodeData=nr.prototype.Ah;nr.prototype.isGroupForNodeData=nr.prototype.Dv;nr.prototype.copyLinkData=nr.prototype.eq;nr.prototype.mergeLinkDataArray=nr.prototype.CA;nr.prototype.removeLinkDataCollection=nr.prototype.OA;nr.prototype.removeLinkData=nr.prototype.vm;
nr.prototype.addLinkDataCollection=nr.prototype.hz;nr.prototype.addLinkData=nr.prototype.Ci;nr.prototype.containsLinkData=nr.prototype.tc;nr.prototype.makeLinkDataKeyUnique=nr.prototype.Us;nr.prototype.findLinkDataForKey=nr.prototype.zh;nr.prototype.setKeyForLinkData=nr.prototype.dt;nr.prototype.getKeyForLinkData=nr.prototype.mc;nr.prototype.removeLabelKeyForLinkData=nr.prototype.wy;nr.prototype.addLabelKeyForLinkData=nr.prototype.av;nr.prototype.setLabelKeysForLinkData=nr.prototype.et;
nr.prototype.getLabelKeysForLinkData=nr.prototype.xf;nr.prototype.setToPortIdForLinkData=nr.prototype.aw;nr.prototype.getToPortIdForLinkData=nr.prototype.ey;nr.prototype.setFromPortIdForLinkData=nr.prototype.Xv;nr.prototype.getFromPortIdForLinkData=nr.prototype.$x;nr.prototype.setToKeyForLinkData=nr.prototype.$v;nr.prototype.getToKeyForLinkData=nr.prototype.by;nr.prototype.setFromKeyForLinkData=nr.prototype.Wv;nr.prototype.getFromKeyForLinkData=nr.prototype.Zx;nr.prototype.clear=nr.prototype.clear;
var qr=Object.freeze([]);nr.className="GraphLinksModel";lr.GraphLinksModel=nr;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new nr};Z.initDiagramModel=ji=function(){return new nr};function sr(a,b){Z.call(this);this.ye="parent";this.qn=!1;this.Mj="parentLinkCategory";void 0!==a&&(Aa(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}ma(sr,Z);sr.constructGraphLinksModel=Z.constructGraphLinksModel;
sr.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.ye=this.ye;a.qn=this.qn;a.Mj=this.Mj};t=sr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Hq();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.pa(e)+":"+Ka(e)}}return b};
t.Nm=function(){var a=Z.prototype.Nm.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.zq=function(a){Z.prototype.zq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};
t.yq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&C("applyIncrementalJson cannot change Model properties");Z.prototype.yq.call(this,a)};t.pm=function(a){return a};t.Bh=function(a){if(null!==a){var b=this.ye;if(""!==b&&(b=on(a,b),void 0!==b)){if(Lq(b))return b;C("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.ye;if(""!==c)if(b=this.pm(b),this.cb(a)){var d=on(a,c);d!==b&&(Pq(this,d,a),Mj(a,c,b),null===this.Vb(b)&&Qq(this,b,a),ir(this,"nodeParentKey",ce,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Mj(a,c,b)}};t.Js=function(a){if(null===a)return"";var b=this.Mj;if(""===b)return"";b=on(a,b);if(void 0===b)return"";if("string"===typeof b)return b;C("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};
sr.prototype.getLinkCategoryForData=function(a){return this.Js(a)};sr.prototype.ft=function(a,b){if(null!==a){var c=this.Mj;if(""!==c)if(this.cb(a)){var d=on(a,c);void 0===d&&(d="");d!==b&&(Mj(a,c,b),ir(this,"parentLinkCategory",ce,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Mj(a,c,b)}};sr.prototype.setLinkCategoryForData=function(a,b){this.ft(a,b)};
sr.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.dk||""===this.ye||void 0===on(a,this.ye)||Mj(a,this.ye,void 0);return a};sr.prototype.setDataProperty=function(a,b,c){if(this.cb(a)){if(b===this.nodeKeyProperty){this.Em(a,c);return}if(b===this.nodeCategoryProperty){this.Dm(a,c);return}if(b===this.nodeParentKeyProperty){this.fe(a,c);return}}var d=on(a,b);d!==c&&(Mj(a,b,c),this.$s(a,b,d,c))};t=sr.prototype;
t.Dq=function(a,b){Z.prototype.Dq.call(this,a,b);for(var c=this.bb.iterator;c.next();)this.Sv(c.value,a,b)};t.Sv=function(a,b,c){if(this.Bh(a)===b){var d=this.ye;Mj(a,d,c);ir(this,"nodeParentKey",ce,d,a,b,c);"string"===typeof d&&this.Da(a,d)}};
t.zm=function(a){Z.prototype.zm.call(this,a);a=this.pa(a);var b=Oq(this,a);if(null!==b){var c=Fa();for(b=b.iterator;b.next();){var d=b.value;if(this.cb(d)&&this.Bh(d)===a){var e=this.ye;ir(this,"nodeParentKey",ce,e,d,a,a);"string"===typeof e&&this.Da(d,e);c.push(d)}}for(b=0;b<c.length;b++)Pq(this,a,c[b]);Ia(c)}};t.ym=function(a){Z.prototype.ym.call(this,a);var b=this.Bh(a);b=this.pm(b);null===this.Vb(b)&&Qq(this,b,a)};t.Kq=function(a){Z.prototype.Kq.call(this,a);var b=this.Bh(a);Pq(this,b,a)};
t.Fm=function(a,b){Z.prototype.Fm.call(this,a,b);this.ft(b,this.Js(a));this.fe(b,this.Bh(a))};t.nm=function(){return!0};t.Ps=function(){return!0};
na.Object.defineProperties(sr.prototype,{nodeParentKeyProperty:{get:function(){return this.ye},set:function(a){var b=this.ye;b!==a&&(this.ye=a,this.g("nodeParentKeyProperty",b,a))}},dk:{get:function(){return this.qn},set:function(a){this.qn!==a&&(this.qn=a)}},parentLinkCategoryProperty:{get:function(){return this.Mj},set:function(a){var b=this.Mj;b!==a&&(this.Mj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{get:function(){return"TreeModel"}}});sr.prototype.setParentLinkCategoryForNodeData=sr.prototype.ft;sr.prototype.getParentLinkCategoryForNodeData=sr.prototype.Js;sr.prototype.setParentKeyForNodeData=sr.prototype.fe;sr.prototype.getParentKeyForNodeData=sr.prototype.Bh;sr.className="TreeModel";lr.TreeModel=sr;
function tr(a){li.call(this);this.Mw=this.Dn=this.Zb=0;this.ir=360;this.Lw=ur;this.qj=0;this.zw=new J;this.$q=this.be=0;this.ss=new vr;this.Bt=this.Lj=0;this.Yy=600;this.ep=NaN;this.cn=1;this.Gp=0;this.Vl=360;this.Gb=ur;this.K=wr;this.Yc=xr;this.Rc=mq;this.ef=6;this.Oo=yr;a&&Object.assign(this,a)}ma(tr,li);
tr.prototype.cloneProtected=function(a){li.prototype.cloneProtected.call(this,a);a.ep=this.ep;a.cn=this.cn;a.Gp=this.Gp;a.Vl=this.Vl;a.Gb=this.Gb;a.K=this.K;a.Yc=this.Yc;a.Rc=this.Rc;a.ef=this.ef;a.Oo=this.Oo};
tr.prototype.gb=function(a){if(a.classType===tr)if(a===zr||a===Ar||a===Br||a===Cr||a===xr)this.sorting=a;else if(a===Dr||a===Er||a===wr||a===Fr)this.direction=a;else if(a===Gr||a===Hr||a===ur||a===Ir)this.arrangement=a;else{if(a===Jr||a===yr)this.nodeDiameterFormula=a}else li.prototype.gb.call(this,a)};tr.prototype.createNetwork=function(){return new Kr(this)};
tr.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.$q;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===Ir&&k===Jr?h=ur:h===Ir&&k!==Jr&&(h=this.arrangement);if((this.direction===Dr||this.direction===Er)&&this.sorting!==xr){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===Dr?(this.arrangement===Ir&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Ir&&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===wr?1:-1)/k,u=d.J(r).diameter;isNaN(u)&&(u=Lr(d.J(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Ir){isNaN(b)&&(b=6);if(h!==ur&&h!==Ir){f=-Infinity;for(g=0;g<k;g++)r=d.J(g),e=d.J(g===k-1?0:g+1),isNaN(r.diameter)&&Lr(r,0),isNaN(e.diameter)&&Lr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Gr?l=(f+b)/(2*Math.PI/k):l=Mr(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Mr(this,e+(360<=p?k:k-1)*(h!==Ir?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Nr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===ur||h===Ir)b=(r-e)/(360<=p?k:k-1)}else if(h===ur||h===Ir)r=(r-e)/(360<=p?k:k-1),r<b?(l=Mr(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)&&Lr(q,0),isNaN(u.diameter)&&Lr(u,0),g=Math.max(g,(q.diameter+u.diameter)/2);g+=b;e=Mr(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.Lw=h;this.Zb=l;this.Dn=m;this.Mw=n;this.ir=p;this.qj=b;this.be=f;this.$q=g;b=d;d=this.Lw;h=this.Zb;l=this.Mw;m=this.ir;n=this.qj;p=this.be;k=this.$q;if(this.direction!==Dr&&this.direction!==Er||d!==Ir)if(this.direction===Dr||this.direction===Er){g=0;switch(d){case Hr:g=180*Or(this,h,p,l,k)/Math.PI;break;case ur:k=b=0;g=a.first();null!==g&&(b=Lr(g,Math.PI/2));g=c.first();null!==g&&(k=Lr(g,Math.PI/2));g=180*Or(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Gr:g=m/b.length}if(this.direction===
Dr){switch(d){case Hr:Pr(this,a,l,Fr);break;case ur:Qr(this,a,l,Fr);break;case Gr:Rr(this,a,m/2,l,Fr)}switch(d){case Hr:Pr(this,c,l+g,wr);break;case ur:Qr(this,c,l+g,wr);break;case Gr:Rr(this,c,m/2,l+g,wr)}}else{switch(d){case Hr:Pr(this,c,l,Fr);break;case ur:Qr(this,c,l,Fr);break;case Gr:Rr(this,c,m/2,l,Fr)}switch(d){case Hr:Pr(this,a,l+g,wr);break;case ur:Qr(this,a,l+g,wr);break;case Gr:Rr(this,a,m/2,l+g,wr)}}}else switch(d){case Hr:Pr(this,b,l,this.direction);break;case ur:Qr(this,b,l,this.direction);
break;case Gr:Rr(this,b,m,l,this.direction);break;case Ir:Sr(this,b,m,l,this.direction)}else Sr(this,b,m,l-m/2,wr)}this.updateParts();this.network=null;this.isValidLayout=!0};function Rr(a,b,c,d,e){var f=a.ir,g=a.Zb;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===wr?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 Qr(a,b,c,d){var e=a.Zb,f=a.be,g=a.qj;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)&&Lr(l,0);isNaN(m.diameter)&&Lr(m,0);l=Or(a,e,f,d===wr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===wr?l:-l}}
function Pr(a,b,c,d){var e=a.Zb,f=a.be,g=a.$q;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=Or(a,e,f,d===wr?c:-c,g);c+=d===wr?l:-l}}function Sr(a,b,c,d,e){var f=a.ir;a.Lj=0;a.ss=new vr;if(360>c){for(f=d+(e===wr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Bt=f;Tr(a,b,c,d,e)}else Ur(a,b,c,d,e);a.ss.commit(b)}
function Ur(a,b,c,d,e){var f=a.Zb,g=a.qj,h=a.Dn,k=f*Math.cos(d*Math.PI/180),l=a.be*Math.sin(d*Math.PI/180),m=b.xa();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;Vr(a,k,l,m,n,e,f)||Wr(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.Lj++;if(!(23<a.Lj)){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===wr?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.ss.compare(g,m);1<Math.abs(g)&&(a.Zb=8>a.Lj?a.Zb-g/(2*Math.PI):5>m.length&&10<g?a.Zb/2:a.Zb-(0<g?1.7:-2.3),a.be=a.Zb*h,Ur(a,b,c,d,e))}}}
function Tr(a,b,c,d,e){for(var f=a.Zb,g=a.be,h=a.Dn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.xa(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;Vr(a,k,l,n,p,e,m)||Wr(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.Lj++;if(!(23<a.Lj)){k=Math.atan2(l,k);k=e===wr?a.Bt-k:k-a.Bt;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.ss;if(Math.abs(f)<Math.abs(g.jm))for(g.jm=f,g.Ck=[],g.Pm=[],k=0;k<n.length;k++)g.Ck[k]=n[k].bounds.x,g.Pm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.Zb=8>a.Lj?a.Zb-f/(2*Math.PI):a.Zb-(0<f?1.7:-2.3),a.be=a.Zb*h,Tr(a,b,c,d,e))}}function Vr(a,b,c,d,e,f,g){var h=a.Zb,k=a.be,l=0;a=(d[e].width+d[e+1].width)/2+a.qj;var m=!1;if(0<=c!==(f===wr)){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 Wr(a,b,c,d,e,f,g){var h=a.Zb,k=a.be,l=0;a=(d[e].height+d[e+1].height)/2+a.qj;d=!1;if(0<=b!==(f===wr)){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}tr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
tr.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.Zb,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.Sa(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.ge(c.ge(a)),this.group.move(b),this.zw=b.ge(a))};
tr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Nr(a,b,c,d,e){var f=a.Yy;if(.001>Math.abs(a.Dn-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 Mr(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Nr(a,1,c,d,e):Nr(a,1,c))}function Or(a,b,c,d,e){if(.001>Math.abs(a.Dn-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}}
tr.prototype.sort=function(a){switch(this.sorting){case Br:break;case Cr:a.reverse();break;case zr:a.sort(this.comparer);break;case Ar:a.sort(this.comparer);a.reverse();break;case xr:return this.Zs(Xr(a));default:C("Invalid sorting type.")}return a};
function Xr(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}
tr.prototype.Zs=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],v=b[l],w=0,z=0;z<g.length;z++){var y=f[g[z]],A=f[h[z]];if(y<A){var B=y;y=A}else B=A;if(B<u&&u<=y)for(A=0;A<v.length;A++){var F=v[A];0>c.indexOf(F)||B<f[F]&&f[F]<y||B===f[F]||y===f[F]||w++}else for(A=0;A<v.length;A++)F=v[A],0>c.indexOf(F)||B<f[F]&&f[F]<y&&B!==f[F]&&y!==f[F]&&w++}v=w;for(z=w=0;z<b[l].length;z++)B=
c.indexOf(b[l][z]),0<=B&&(B=Math.abs(u-(B>=u?B+1:B)),w+=B<c.length+1-B?B:c.length+1-B);for(z=0;z<g.length;z++)B=f[g[z]],y=f[h[z]],B>=u&&B++,y>=u&&y++,B>y&&(A=y,y=B,B=A),y-B<(c.length+2)/2===(B<u&&u<=y)&&w++;if(v<m||v===m&&w<n)m=v,n=w,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(tr.prototype,{radius:{get:function(){return this.ep},set:function(a){this.ep!==a&&(0<a||isNaN(a))&&(this.ep=a,this.B())}},aspectRatio:{get:function(){return this.cn},set:function(a){this.cn!==a&&0<a&&(this.cn=a,this.B())}},startAngle:{get:function(){return this.Gp},set:function(a){this.Gp!==a&&(this.Gp=a,this.B())}},sweepAngle:{get:function(){return this.Vl},
set:function(a){this.Vl!==a&&(0<a&&360>=a?this.Vl=a:this.Vl=360,this.B())}},arrangement:{get:function(){return this.Gb},set:function(a){this.Gb===a||a!==Ir&&a!==ur&&a!==Hr&&a!==Gr||(this.Gb=a,this.B())}},direction:{get:function(){return this.K},set:function(a){this.K===a||a!==wr&&a!==Fr&&a!==Dr&&a!==Er||(this.K=a,this.B())}},sorting:{get:function(){return this.Yc},set:function(a){this.Yc===a||a!==Br&&a!==Cr&&
a!==zr&&!Ar&&a!==xr||(this.Yc=a,this.B())}},comparer:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.Rc=a,this.B())}},spacing:{get:function(){return this.ef},set:function(a){this.ef!==a&&(this.ef=a,this.B())}},nodeDiameterFormula:{get:function(){return this.Oo},set:function(a){this.Oo===a||a!==yr&&a!==Jr||(this.Oo=a,this.B())}},actualXRadius:{get:function(){return this.Zb}},
actualYRadius:{get:function(){return this.be}},actualSpacing:{get:function(){return this.qj}},actualCenter:{get:function(){return this.zw}}});
var ur=new D(tr,"ConstantSpacing",0),Hr=new D(tr,"ConstantDistance",1),Gr=new D(tr,"ConstantAngle",2),Ir=new D(tr,"Packed",3),wr=new D(tr,"Clockwise",4),Fr=new D(tr,"Counterclockwise",5),Dr=new D(tr,"BidirectionalLeft",6),Er=new D(tr,"BidirectionalRight",7),Br=new D(tr,"Forwards",8),Cr=new D(tr,"Reverse",9),zr=new D(tr,"Ascending",10),Ar=new D(tr,"Descending",11),xr=new D(tr,"Optimized",12),yr=new D(tr,"Pythagorean",13),Jr=new D(tr,"Circular",14);tr.className="CircularLayout";tr.ConstantSpacing=ur;
tr.ConstantDistance=Hr;tr.ConstantAngle=Gr;tr.Packed=Ir;tr.Clockwise=wr;tr.Counterclockwise=Fr;tr.BidirectionalLeft=Dr;tr.BidirectionalRight=Er;tr.Forwards=Br;tr.Reverse=Cr;tr.Ascending=zr;tr.Descending=Ar;tr.Optimized=xr;tr.Pythagorean=yr;tr.Circular=Jr;function vr(){this.jm=-Infinity;this.Pm=this.Ck=null}
vr.prototype.compare=function(a,b){if(0<a&&0>this.jm||Math.abs(a)<Math.abs(this.jm)&&!(0>a&&0<this.jm))for(this.jm=a,this.Ck=[],this.Pm=[],a=0;a<b.length;a++)this.Ck[a]=b[a].bounds.x,this.Pm[a]=b[a].bounds.y};vr.prototype.commit=function(a){if(null!==this.Ck&&null!==this.Pm)for(var b=0;b<this.Ck.length;b++){var c=a.J(b);c.x=this.Ck[b];c.y=this.Pm[b]}};vr.className="VertexArrangement";function Kr(a){Sp.call(this,a)}ma(Kr,Sp);Kr.prototype.createVertex=function(){return new Yr(this)};
Kr.prototype.createEdge=function(){return new Zr(this)};Kr.className="CircularNetwork";function Yr(a){fq.call(this,a);this.C=this.pj=NaN}ma(Yr,fq);
function Lr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Ir)if(c.nodeDiameterFormula===Jr)a.pj=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.pj=Math.min(a.height/c,a.width/b)}else a.pj=c.nodeDiameterFormula===Jr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.pj}
na.Object.defineProperties(Yr.prototype,{diameter:{get:function(){return this.pj},set:function(a){this.pj!==a&&(this.pj=a)}},actualAngle:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}}});Yr.className="CircularVertex";function Zr(a){gq.call(this,a)}ma(Zr,gq);Zr.className="CircularEdge";
function $r(a){li.call(this);this.sh=null;this.po=0;this.Nd=(new M(100,100)).freeze();this.bn=!1;this.df=!0;this.gd=!1;this.xl=100;this.Gn=1;this.Pf=1E3;this.Jo=10;this.fp=Math;this.Yk=.05;this.Xk=50;this.Vk=150;this.Wk=0;this.yn=10;this.xn=5;a&&Object.assign(this,a)}ma($r,li);
$r.prototype.cloneProtected=function(a){li.prototype.cloneProtected.call(this,a);a.Nd.assign(this.Nd);a.bn=this.bn;a.df=this.df;a.gd=this.gd;a.xl=this.xl;a.Gn=this.Gn;a.Pf=this.Pf;a.Jo=this.Jo;a.fp=this.fp;a.Yk=this.Yk;a.Xk=this.Xk;a.Vk=this.Vk;a.Wk=this.Wk;a.yn=this.yn;a.xn=this.xn};
$r.prototype.serializeLayoutProperties=function(a,b){li.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};
$r.prototype.deserializeLayoutProperties=function(a,b,c,d,e){li.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};$r.prototype.createNetwork=function(){return new as(this)};
$r.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));if(!this.jw()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.fq();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.cv();this.po=0;if(this.needsClusterLayout()){b=this.network;c=b.Gy();
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.Gd=f.vertexes.count;f.Gh=1;f.bk=null;f.Je=null}bs(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=Fa(),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=cs(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=cs(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.ig(e.value);for(c=c.edges.iterator;c.next();)b.am(c.value)}}ds(this,a);this.updateParts()}this.xl=a;this.network=null;this.isValidLayout=!0}};
$r.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.Ic(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};$r.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.Nc(d.bounds)}return b};
function bs(a,b,c){if(es(a,b)){var d=a.Pf;a.Pf*=1+1/(b+1);var e=fs(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;bs(a,b+1,c);ds(a,f);gs(a,e);b=e.vertexes.xa();b.sort(function(a,b){return null===a||null===b||a===b?0:b.Gd-a.Gd});for(c=0;c<b.length;c++)hs(a,b[c]);a.Pf=d}}
function es(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.sh=a.network.vertexes.xa();a=a.sh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Gd-a.Gd});for(b=a.length-1;0<=b&&1>=a[b].Gd;)b--;return 1<a.length-b}
function fs(a,b){for(var c=a.network,d=new as(a),e=0;e<a.sh.length;e++){var f=a.sh[e];if(1<f.Gd){d.ig(f);var g=new is;g.mt=f.Gd;g.nt=f.width;g.lt=f.height;g.pw=f.focus.x;g.qw=f.focus.y;null===f.Je&&(f.Je=new E);f.Je.add(g);f.Uv=f.Je.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.am(h):e.network===d?(h=e.bk,null===h&&(h=new E,e.bk=h),h.add(g),e.Gd--,e.Gh+=g.Gh):g.network===d&&(h=g.bk,null===h&&(h=new E,g.bk=h),h.add(e),
g.Gd--,g.Gh+=e.Gh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,L.sqrt((f.fromVertex.Gh+f.toVertex.Gh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.bk;if(null!==k&&0<k.count&&(g=e.Je.J(e.Je.count-1).mt-e.Gd,!(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.ay(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 gs(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Je){var e=d.Je.J(d.Uv);d.Gd=e.mt;var f=e.pw,g=e.qw;d.bounds=new N(d.centerX-f,d.centerY-g,e.nt,e.lt);d.focus=new J(f,g);d.Uv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function hs(a,b){var c=b.bk;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Je&&0<b.Je.count&&(g=b.Je.J(0),f=g.nt,g=g.lt);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.Gd?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.Gd||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 cs(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}$r.prototype.cv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
$r.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.pv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Ki(c);null===d&&(d=this.network.Zj(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.rk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function js(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 ds(a,b){a.sh=null;for(b=a.po+b;a.po<b&&(a.po++,ks(a)););a.sh=null}
function ks(a){null===a.sh&&(a.sh=a.network.vertexes.xa());var b=a.sh;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.Pf;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=js(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new ls),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=js(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new ls),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}$r.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};$r.prototype.moveFixedVertex=function(){};$r.prototype.commitLayout=function(){this.Yv();this.commitNodes();this.isRouting&&this.commitLinks()};
$r.prototype.Yv=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)}};$r.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)};
$r.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};$r.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Yk:a};$r.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Xk:a};$r.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Vk:a};$r.prototype.electricalFieldX=function(){return 0};$r.prototype.electricalFieldY=function(){return 0};
$r.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Wk:a};$r.prototype.gravitationalFieldX=function(){return 0};$r.prototype.gravitationalFieldY=function(){return 0};$r.prototype.isFixed=function(a){return a.isFixed};
na.Object.defineProperties($r.prototype,{currentIteration:{get:function(){return this.po}},arrangementSpacing:{get:function(){return this.Nd},set:function(a){this.Nd.A(a)||(this.Nd.assign(a),this.B())}},arrangesToOrigin:{get:function(){return this.bn},set:function(a){this.bn!==a&&(this.bn=a,this.B())}},setsPortSpots:{get:function(){return this.df},set:function(a){this.df!==a&&(this.df=
a,this.B())}},comments:{get:function(){return this.gd},set:function(a){this.gd!==a&&(this.gd=a,this.B())}},maxIterations:{get:function(){return this.xl},set:function(a){this.xl!==a&&0<=a&&(this.xl=a,this.B())}},epsilonDistance:{get:function(){return this.Gn},set:function(a){this.Gn!==a&&0<a&&(this.Gn=a,this.B())}},infinityDistance:{get:function(){return this.Pf},set:function(a){this.Pf!==
a&&1<a&&(this.Pf=a,this.B())}},moveLimit:{get:function(){return this.Jo},set:function(a){this.Jo!==a&&1<a&&(this.Jo=a,this.B())}},randomNumberGenerator:{get:function(){return this.fp},set:function(a){this.fp!==a&&(null!==a&&"function"!==typeof a.random&&C('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.fp=a)}},defaultSpringStiffness:{get:function(){return this.Yk},
set:function(a){this.Yk!==a&&(this.Yk=a,this.B())}},defaultSpringLength:{get:function(){return this.Xk},set:function(a){this.Xk!==a&&(this.Xk=a,this.B())}},defaultElectricalCharge:{get:function(){return this.Vk},set:function(a){this.Vk!==a&&(this.Vk=a,this.B())}},defaultGravitationalMass:{get:function(){return this.Wk},set:function(a){this.Wk!==a&&(this.Wk=a,this.B())}},defaultCommentSpringLength:{
get:function(){return this.yn},set:function(a){this.yn!==a&&(this.yn=a,this.B())}},defaultCommentElectricalCharge:{get:function(){return this.xn},set:function(a){this.xn!==a&&(this.xn=a,this.B())}}});$r.className="ForceDirectedLayout";function is(){this.qw=this.pw=this.lt=this.nt=this.mt=0}is.className="ForceDirectedSubnet";function as(a){Sp.call(this,a)}ma(as,Sp);as.prototype.createVertex=function(){return new ms(this)};as.prototype.createEdge=function(){return new ns(this)};
as.className="ForceDirectedNetwork";function ms(a){fq.call(this,a);this.Ha=!1;this.Wa=this.C=NaN;this.Gh=this.Gd=this.Ga=this.M=0;this.Je=this.bk=null;this.Uv=0}ma(ms,fq);ms.prototype.serializeVertexProperties=function(a,b){fq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};
ms.prototype.deserializeVertexProperties=function(a,b,c,d){fq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
na.Object.defineProperties(ms.prototype,{isFixed:{get:function(){return this.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}},charge:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}},mass:{get:function(){return this.Wa},set:function(a){this.Wa!==a&&(this.Wa=a)}},forceX:{get:function(){return this.M},set:function(a){this.M!==a&&(this.M=a)}},forceY:{
get:function(){return this.Ga},set:function(a){this.Ga!==a&&(this.Ga=a)}}});ms.className="ForceDirectedVertex";function ns(a){gq.call(this,a);this.j=this.o=NaN}ma(ns,gq);ns.prototype.serializeEdgeProperties=function(a,b){gq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};ns.prototype.deserializeEdgeProperties=function(a,b,c,d){gq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};
na.Object.defineProperties(ns.prototype,{stiffness:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},length:{get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}}});ns.className="ForceDirectedEdge";function ls(){var a=0;void 0===a&&(a=42);this.seed=a;this.Iy=48271;this.Ky=2147483647;this.Q=44488.07041494893;this.Ly=3399;this.Jy=1/2147483647;this.random()}
ls.prototype.random=function(){var a=this.seed%this.Q*this.Iy-this.seed/this.Q*this.Ly;0<a?this.seed=a:this.seed=a+this.Ky;return this.seed*this.Jy};ls.className="RandomNumberGenerator";
function os(a){li.call(this);this.Yb=this.Zd=25;this.K=0;this.Uk=ps;this.sl=qs;this.il=rs;this.Cj=4;this.Fk=ss;this.Wf=15;this.df=!0;this.vo=4;this.Ca=this.ji=this.ra=-1;this.pc=this.Qg=0;this.Ka=this.ud=this.vd=this.Yd=this.zb=null;this.Xg=0;this.Ko=this.Jj=null;this.Bc=0;this.Lo=null;this.Qc=new J;this.ve=[];this.ve.length=100;a&&Object.assign(this,a)}ma(os,li);
os.prototype.cloneProtected=function(a){li.prototype.cloneProtected.call(this,a);a.Zd=this.Zd;a.Yb=this.Yb;a.K=this.K;a.Uk=this.Uk;a.sl=this.sl;a.il=this.il;a.Cj=this.Cj;a.Fk=this.Fk;a.Wf=this.Wf;a.df=this.df;a.vo=this.vo};
os.prototype.serializeLayoutProperties=function(a,b){li.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.ra=this.ra;a.ji=this.ji;a.Ca=this.Ca;a.Qg=this.Qg;a.pc=this.pc;a.zb=this.zb;a.Xg=this.Xg;a.Bc=this.Bc;a.Qc={x:this.Qc.x,y:this.Qc.y}};
os.prototype.deserializeLayoutProperties=function(a,b,c,d,e){li.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=Ua(os,a.cycleRemoveOption);this.layeringOption=Ua(os,a.layeringOption);this.initializeOption=Ua(os,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=Ua(os,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;
this.linkSpacing=a.linkSpacing;this.ra=a.ra;this.ji=a.ji;this.Ca=a.Ca;this.Qg=a.Qg;this.pc=a.pc;this.zb=a.zb;this.Xg=a.Xg;this.Bc=a.Bc;this.Qc=new J(this.Qc.x,this.Qc.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.qd.count;){var c=b.qd.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.Cd.count;){var d=c.Cd.J(0);
if(d.link){a.link=d.link;break}c=d.toVertex}if(!a.link)for(c=c.qd.iterator;c.next();)if(d=c.value,d.link&&d.fromVertex===b){a.link=d.link;break}}}})};os.prototype.gb=function(a){a.classType===os?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:C("Unknown enum value: "+a):li.prototype.gb.call(this,a)};os.prototype.createNetwork=function(){return new ts(this)};
os.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.ji=-1;this.pc=this.Qg=0;this.Lo=this.Ko=this.Jj=null;for(a=0;a<this.ve.length;a++)this.ve[a]=null;if(0<this.network.vertexes.count){this.network.fq();if(this.jw())return;this.cycleRemoveOption!==us&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.ra=-1;this.assignLayers();for(a.reset();a.next();)this.ra=
Math.max(this.ra,a.value.layer);this.cycleRemoveOption===us&&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.u()&&n.isVisible()?n.actualBounds.u()?(vo(n,p,yc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(vo(n,p,yc,r),r.u()||r.assign(q)):r.assign(q):u.u()?(vo(n,p,yc,r),r.u()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.u()&&k.isVisible()?k.actualBounds.u()?(vo(k,h,yc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(vo(k,h,yc,m),m.u()||m.assign(l)):
m.assign(l):n.u()?(vo(k,h,yc,m),m.u()||m.assign(l)):m.assign(l);90===this.K||270===this.K?(g=Math.round((r.x-q.x)/this.Yb),k=r.x,h=Math.round((m.x-l.x)/this.Yb),l=m.x):(g=Math.round((r.y-q.y)/this.Yb),k=r.y,h=Math.round((m.y-l.y)/this.Yb),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 v=u.fromPort,w=u.toPort;if(null!==v&&
null!==w){var z=u.fromNode;p=u.toNode;if(null!==z&&null!==p){var y=vs(this,!0),A=vs(this,!1),B=this.setsPortSpots?y:u.computeSpot(!0,v);q=this.setsPortSpots?A:u.computeSpot(!1,w);var F=u.isOrthogonal;B.Kc()&&B.zf(A)&&q.Kc()&&q.zf(y)?n=0:(y=u.getLinkPoint(z,v,B,!0,F,p,w,J.alloc()),A=u.getLinkDirection(z,v,y,B,!0,F,p,w),J.free(y),B.Qs()||A!==ws(this,d,!0)?this.setsPortSpots&&null!==z&&1===z.ports.count&&d.rev&&(n+=1):n+=1,B=u.getLinkPoint(p,w,q,!1,F,z,v,J.alloc()),u=u.getLinkDirection(p,w,B,q,!1,F,
z,v),J.free(B),q.Qs()||u!==ws(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.qf=1,q.layer=r,q.near=e,a.ig(q),e=a.rk(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.qf=2;q.layer=r-1;a.ig(q);e=a.rk(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.qf=3,q.layer=r-1,a.ig(q),e=a.rk(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.rk(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.ra;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.Qg=0;c<=this.ra;c++)a[c]>a[this.pc]&&(this.ji=a[c]-1,this.pc=c),a[c]<a[this.Qg]&&(this.Qg=c);this.Lo=[];for(c=0;c<a.length;c++)this.Lo[c]=[];for(b.reset();b.next();)a=b.value,this.Lo[a.layer][a.index]=a;this.Ca=-1;for(a=0;a<=this.ra;a++){b=xs(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);ys(this,a,b)}this.reduceCrossings();this.straightenAndPack();
this.updateParts()}this.network=null;this.isValidLayout=!0};os.prototype.linkMinLength=function(){return 1};function zs(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}os.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};
os.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.vk:a.uk;if(null!==c)return c;c=this.K;return 90===c||270===c?b?a.vk=a.focus.x/this.Yb+1|0:a.uk=(a.bounds.width-a.focus.x)/this.Yb+1|0:b?a.vk=a.focus.y/this.Yb+1|0:a.uk=(a.bounds.height-a.focus.y)/this.Yb+1|0};function As(a){null===a.Jj&&(a.Jj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Jj[b]=d.layer;b++;a.Jj[b]=d.column;b++;a.Jj[b]=d.index;b++}return a.Jj}
function Bs(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 Cs(a,b,c){var d=xs(a,b),e=a.zb[b];if(null===a.Ko||a.Ko.length<e*e)a.Ko=[];for(var f=a.Ko,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.qf===l.qf||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.qf===l.qf||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 v=q.portToPos;q=q.portFromPos;m<v&&(n>u||n===u&&r>q)&&h++;v<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,v=q.portToPos,q=q.portFromPos,r<q&&(n>u||n===u&&m>v)&&h++,q<r&&(u>n||u===n&&v>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var w=0,z=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var y=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<y.length;p++)q=y[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&z++,(u<n||u===n&&q<r)&&w++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,y=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<y.length;p++)q=y[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,v=q.portToPos,(n<u||n===u&&m<v)&&z++,(u<n||u===n&&v<m)&&w++);f[g*e+k]=w;f[k*e+g]=z}}ys(a,b,d);return f}os.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ra;b++)for(var c=Cs(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 Ds(a){for(var b=0,c=0;c<=a.ra;c++){for(var d=a,e=c,f=xs(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)*zs(n)}}}ys(d,e,f);b+=h}return b}
os.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 Es(a,b,c){for(var d=xs(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}ys(a,b,d);return f}
function Fs(a,b,c){for(var d=xs(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)}ys(a,b,d);return f}function Gs(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&&Gs(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&&Gs(a,k,c,d,e,f)}}
function Hs(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Hs(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Hs(a,b.value.fromVertex,c,d,e,f)}}
os.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Uk){default:case Is: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!==Js(a);){for(e=Ks(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Ks(a);for(e=Ls(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Ls(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.Am(b),b.rev=!0);break;case ps:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.jg=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.Xg=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Ms(this,b);for(d.reset();d.next();)b=d.value,-1===b.jg&&Ms(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.jg<b.jg&&c<f&&(this.network.Am(d),d.rev=!0));break;case us: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.Am(b),b.rev=!0)}}};function Js(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Ks(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 Ls(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 Ms(a,b){b.jg=a.Xg;a.Xg++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.jg&&(d.forest=!0,Ms(a,e))}b.finish=a.Xg;a.Xg++}
os.prototype.assignLayers=function(){switch(this.sl){case Ns:Os(this);break;case Ps:for(var a,b=this.network.vertexes.iterator;b.next();)a=Qs(this,b.value),this.ra=Math.max(a,this.ra);for(b.reset();b.next();)a=b.value,a.layer=this.ra-a.layer;break;default:case qs:Os(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&&Rs(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.ra=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.ra=Math.max(this.ra,c.layer)}}};function Os(a){for(var b=a.network.vertexes.iterator;b.next();){var c=Ss(a,b.value);a.ra=Math.max(c,a.ra)}}function Ss(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,Ss(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Qs(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,Qs(a,f)+e)}b.layer=c}else c=b.layer;return c}
function Rs(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Rs(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&&Gs(a,h,0,-1,!0,!1)}for(Gs(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(Gs(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 ws(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}
os.prototype.initializeIndices=function(){switch(this.il){default:case Ts: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 rs:a=this.network.vertexes.iterator;for(b=this.ra;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Us(this,c);break;case Vs:for(a=this.network.vertexes.iterator,b=0;b<=this.ra;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&Ws(this,c)}};
function Us(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&&Us(a,d))}
function Ws(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&&Ws(a,d))}
os.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=As(this),c,d;for(c=0;c<this.Cj;c++){for(d=0;d<=this.ra;d++)Xs(this,d,1),Ys(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=As(this));for(d=this.ra;0<=d;d--)Xs(this,d,-1),Ys(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=As(this))}Bs(this,b);for(c=0;c<this.Cj;c++){for(d=0;d<=this.ra;d++)Xs(this,d,0),Ys(this,d,0);e=this.countCrossings();e<a&&(a=e,b=As(this));for(d=this.ra;0<=d;d--)Xs(this,d,0),Ys(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=As(this))}Bs(this,b);var f,g,h;switch(this.Fk){case Zs:break;case $s:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.ra;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,-1)||f;e=this.countCrossings();e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,1)||f;e=this.countCrossings();e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
Ys(this,d,-1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this))}break;default:case ss:for(c=this.ra,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,-1)||f;e=this.countCrossings();e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,1)||f;e=this.countCrossings();e>=a?Bs(this,b):
(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,-1)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=Ys(this,d,0)||f;e>=a?Bs(this,b):(a=e,b=As(this))}}Bs(this,b)};
function Xs(a,b,c){var d=xs(a,b),e=a.zb[b],f=Fs(a,b,c),g=Es(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);ys(a,b,d)}
function Ys(a,b,c){var d=xs(a,b),e=a.zb[b];c=Cs(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,v=a.nodeMinColumnSpace(d[f],!0),w=a.nodeMinColumnSpace(d[f],!1),z=a.nodeMinColumnSpace(d[f+1],!0),y=a.nodeMinColumnSpace(d[f+1],!1);v=q-v+z;w=u-w+y;var A=d[f].sourceEdges.iterator;for(A.reset();A.next();)if(z=A.value,y=z.fromVertex,
z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;z<f&&(p+=2*(f-z),r+=2*(f+1-z));z===f+1&&(p+=1);z>f+1&&(p+=4*(z-f),r+=4*(z-(f+1)))}A=d[f].destinationEdges.iterator;for(A.reset();A.next();)if(z=A.value,y=z.toVertex,z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;z===f+1&&(r+=1)}A=d[f+1].sourceEdges.iterator;for(A.reset();A.next();)if(z=A.value,y=z.fromVertex,z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;z<f&&(p+=2*(f+1-z),r+=2*(f-z));z===f&&(r+=1);z>f+1&&(p+=4*(z-(f+1)),r+=4*(z-f))}A=d[f+1].destinationEdges.iterator;
for(A.reset();A.next();)if(z=A.value,y=z.toVertex,z.valid&&y.layer===b){for(z=0;d[z]!==y;)z++;z===f&&(p+=1)}z=y=0;A=g[d[f].index];var B=h[d[f].index],F=g[d[f+1].index],K=h[d[f+1].index];-1!==A&&(y+=Math.abs(A-q),z+=Math.abs(A-w));-1!==B&&(y+=Math.abs(B-q),z+=Math.abs(B-w));-1!==F&&(y+=Math.abs(F-u),z+=Math.abs(F-v));-1!==K&&(y+=Math.abs(K-u),z+=Math.abs(K-v));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&z<y-.5)l=k=!0,d[f].column=w,d[f+1].column=v,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;ys(a,b,d);return k}
os.prototype.straightenAndPack=function(){var a=0!==(this.Wf&1);var b=0!==(this.Wf&at);1E3<this.network.edges.count&&b&&(a=!1);if(a){var c=[];for(b=0;b<=this.ra;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.Wf&2))for(c=!0;c;){c=!1;for(b=this.pc+1;b<=this.ra;b++)c=bt(this,b,1)||
c;for(b=this.pc-1;0<=b;b--)c=bt(this,b,-1)||c;c=bt(this,this.pc,0)||c}if(0!==(this.Wf&4)){for(b=this.pc+1;b<=this.ra;b++)ct(this,b,1);for(b=this.pc-1;0<=b;b--)ct(this,b,-1);ct(this,this.pc,0)}a&&(dt(this,-1),dt(this,1));if(0!==(this.Wf&2))for(c=!0;c;){c=!1;c=bt(this,this.pc,0)||c;for(b=this.pc+1;b<=this.ra;b++)c=bt(this,b,0)||c;for(b=this.pc-1;0<=b;b--)c=bt(this,b,0)||c}};function bt(a,b,c){for(var d=!1;et(a,b,c);)d=!0;return d}
function et(a,b,c){var d,e=xs(a,b),f=a.zb[b],g=Es(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Es(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 v=e[d].sourceEdges.iterator;v.next();){var w=v.value;var z=w.fromVertex;
if(w.valid&&z.layer!==b){var y=zs(w);var A=w.portFromColOffset;w=w.portToColOffset;z=z.column;p+=(Math.abs(m+w-(z+A))+1)*y;q+=(Math.abs(r+w-(z+A))+1)*y;u+=(Math.abs(n+w-(z+A))+1)*y}}if(0<=c)for(v=e[d].destinationEdges.iterator;v.next();)w=v.value,z=w.toVertex,w.valid&&z.layer!==b&&(y=zs(w),A=w.portFromColOffset,w=w.portToColOffset,z=z.column,p+=(Math.abs(m+A-(z+w))+1)*y,q+=(Math.abs(r+A-(z+w))+1)*y,u+=(Math.abs(n+A-(z+w))+1)*y);w=A=y=0;v=g[e[d].index];z=h[e[d].index];-1!==v&&(y+=Math.abs(v-m),A+=
Math.abs(v-r),w+=Math.abs(v-n));-1!==z&&(y+=Math.abs(z-m),A+=Math.abs(z-r),w+=Math.abs(z-n));if(q<p||q===p&&A<y)l=k=!0,e[d].column=r;else if(u<p||u===p&&w<y)l=k=!0,e[d].column=n}ys(a,b,e);a.normalize();return k}
function ct(a,b,c){var d=xs(a,b),e=a.zb[b],f=Fs(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)}ys(a,b,d);a.normalize()}
function ft(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 gt(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ra;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.ra;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 dt(a,b){for(var c=0;c<=a.Ca;c++)for(;ft(a,c););a.normalize();for(c=0;c<a.Ca;c++)for(;gt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ca;c++){var e=As(a);var f=Ds(a);for(d=f+1;f<d;){d=f;ht(a,c,1);var g=Ds(a);g>f?Bs(a,e):g<f&&(f=g,e=As(a))}}if(0>b)for(c=a.Ca;0<=c;c--)for(e=As(a),f=Ds(a),d=f+1;f<d;)d=f,ht(a,c,-1),g=Ds(a),g>f?Bs(a,e):g<f&&(f=g,e=As(a));a.normalize()}
function ht(a,b,c){a.Bc=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.Bc)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Bc);a.Bc++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Hs(a,b,a.Bc,-1,!0,!0),a.Bc++);var f;b=[];for(f=0;f<a.Bc*a.Bc;f++)b[f]=!1;e=[];for(f=0;f<(a.ra+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.ra;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.Bc+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.Bc+e[f*(a.Ca+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Bc;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.Bc;f++)b[k*a.Bc+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)}
os.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=vs(this,!0),b=vs(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.gv();this.isRouting&&this.commitLinks()};function vs(a,b){return 270===a.K?b?cd:fd:90===a.K?b?fd:cd:180===a.K?b?dd:ed:b?ed:dd}
os.prototype.commitNodes=function(){this.Yd=[];this.vd=[];this.ud=[];this.Ka=[];for(var a=0;a<=this.ra;a++)this.Yd[a]=0,this.vd[a]=0,this.ud[a]=0,this.Ka[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Yd[c]=Math.max(this.Yd[c],this.nodeMinLayerSpace(b,!0));this.vd[c]=Math.max(this.vd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.Zd;for(var d=0;d<=this.ra;d++){var e=c;0>=this.Yd[d]+this.vd[d]&&(e=0);0<d&&(b+=e/2);90===this.K||0===this.K?(b+=this.vd[d],this.ud[d]=b,
b+=this.Yd[d]):(b+=this.Yd[d],this.ud[d]=b,b+=this.vd[d]);d<this.ra&&(b+=e/2);this.Ka[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ra;d++)270===this.K?this.ud[d]=b.y+this.ud[d]:90===this.K?(this.ud[d]=b.y+c-this.ud[d],this.Ka[d]=c-this.Ka[d]):180===this.K?this.ud[d]=b.x+this.ud[d]:(this.ud[d]=b.x+c-this.ud[d],this.Ka[d]=c-this.Ka[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.Yb*g;f=this.ud[f]}else h=this.ud[f],f=b.y+
this.Yb*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.Qc=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
os.prototype.gv=function(){for(var a=0,b=this.Zd,c=0;c<=this.ra;c++)a+=this.Yd[c],a+=this.vd[c];a+=this.ra*b;b=[];c=this.Yb*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.Ka[0]))):b.push(new N(0,this.Ka[d-1],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):90===this.K?0===d?b.push(new N(0,this.Ka[0],c,Math.abs(this.Ka[0]-a))):b.push(new N(0,this.Ka[d],c,Math.abs(this.Ka[d-1]-this.Ka[d]))):180===this.K?0===d?b.push(new N(0,0,Math.abs(this.Ka[0]),c)):b.push(new N(this.Ka[d-
1],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c)):0===d?b.push(new N(this.Ka[0],0,Math.abs(this.Ka[0]-a),c)):b.push(new N(this.Ka[d],0,Math.abs(this.Ka[d-1]-this.Ka[d]),c));this.commitLayers(b,this.Qc)};os.prototype.commitLayers=function(){};
os.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Hh(),b.ak(),b.rf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.pg();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Hh();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===Yf&&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.u()||c.set(e.actualBounds.center),g.u()||g.set(f.actualBounds.center),b.ak(),b.pf(c.x,c.y),b.pf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.pf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.pf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===rc&&(p=!0);null!==h&&k===rc&&(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;if(p){if(90===this.K||270===this.K){p=
q;var u=(c+d)/2}else p=(q+m)/2,u=c;b.L(1,p,u);l=b.getLinkPoint(e,g,l,!0,!1,f,h);l.u()||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.u()||e.set(f.actualBounds.center),b.L(3,e.x,e.y))}}b.rf()}else if(m.layer===n.layer)b.rf();else{p=r=!1;u=this.Zd;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var v=b.pointsCount;4<v&&b.points.removeRange(2,v-3)}else if(b.curve===Yf)r=!0,v=b.pointsCount,4<v&&b.points.removeRange(2,
v-3),4===v&&(q=2);else{v=b.pointsCount;var w=l===rc,z=k===rc;2<v&&w&&z?b.points.removeRange(1,v-2):3<v&&w&&!z?b.points.removeRange(1,v-3):3<v&&!w&&z?b.points.removeRange(2,v-2):4<v&&!w&&!z&&b.points.removeRange(2,v-3)}if(c.rev){for(;null!==n&&m!==n;){var y=v=null;for(w=n.sourceEdges.iterator;w.next()&&(z=w.value,z.link!==c.link||(v=z.fromVertex,y=z.toVertex,null!==v.node)););if(null===v)break;if(v!==m){w=b.i(q-1).x;z=b.i(q-1).y;var A=v.centerX;var B=v.centerY;if(p)180===this.K||0===this.K?q===b.firstPickIndex+
1?(b.l(q++,w,z),b.l(q++,w,B)):(null!==y?y.centerY:z)!==B&&(y=this.Ka[v.layer-1]+this.Qc.x,b.l(q++,y,z),b.l(q++,y,B)):q===b.firstPickIndex+1?(b.l(q++,w,z),b.l(q++,A,z)):(null!==y?y.centerX:w)!==A&&(y=this.Ka[v.layer-1]+this.Qc.y,b.l(q++,w,y),b.l(q++,A,y));else if(q===b.firstPickIndex+1){y=Math.max(10,this.Yd[n.layer]);var F=Math.max(10,this.vd[n.layer]);if(r)180===this.K?A<=n.bounds.x?(n=n.bounds.x,b.l(q++,n-y,B),b.l(q++,n,B),b.l(q++,n+F,B)):(b.l(q++,A-y,B),b.l(q++,A,B),b.l(q++,A+F,B)):90===this.K?
B>=n.bounds.bottom?(n=n.bounds.y+n.bounds.height,b.l(q++,A,n+F),b.l(q++,A,n),b.l(q++,A,n-y)):(b.l(q++,A,B+F),b.l(q++,A,B),b.l(q++,A,B-y)):270===this.K?B<=n.bounds.y?(n=n.bounds.y,b.l(q++,A,n-y),b.l(q++,A,n),b.l(q++,A,n+F)):(b.l(q++,A,B-y),b.l(q++,A,B),b.l(q++,A,B+F)):0===this.K&&(A>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.l(q++,n+F,B),b.l(q++,n,B),b.l(q++,n-y,B)):(b.l(q++,A+F,B),b.l(q++,A,B),b.l(q++,A-y,B)));else{b.l(q++,w,z);var K=0;if(180===this.K||0===this.K){if(180===this.K?A>=n.bounds.right:
A<=n.bounds.x)K=(0===this.K?-y:F)/2;b.l(q++,w+K,B)}else{if(270===this.K?B>=n.bounds.bottom:B<=n.bounds.y)K=(90===this.K?-y:F)/2;b.l(q++,A,z+K)}b.l(q++,A,B)}}else y=Math.max(10,this.Yd[v.layer]),F=Math.max(10,this.vd[v.layer]),r?180===this.K?(b.l(q++,A-y-u,B),b.l(q++,Math.min(A-y+u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.max(A+F-u/2,A),B),b.l(q++,A+F+u,B)):90===this.K?(b.l(q++,A,B+F+u),b.l(q++,A,Math.max(B+F-u/2,B)),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,A,Math.min(B-y+u/2,B)),b.l(q++,A,B-y-u)):
270===this.K?(b.l(q++,A,B-y-u),b.l(q++,A,Math.min(B-y+u/2,B)),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,A,Math.max(B+F-u/2,B)),b.l(q++,A,B+F+u)):(b.l(q++,A+F+u,B),b.l(q++,Math.max(A+F-u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.min(A-y+u/2,A),B),b.l(q++,A-y-u,B)):b.l(q++,A,B)}n=v}if(null===h||l!==rc||p)if(w=b.i(q-1).x,z=b.i(q-1).y,A=b.i(q).x,B=b.i(q).y,p)u=this.vd[m.layer],180===this.K||0===this.K?(p=z,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.K?A>=m.bounds.x:A<=m.bounds.right)&&(n=m.centerX+(180===
this.K?-u:u),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.Yb/2:p=m.bounds.bottom+this.Yb/2,b.l(q++,n,z),b.l(q++,n,p)),b.l(q++,A,p)):(p=w,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.K?B>=m.bounds.y:B<=m.bounds.bottom)&&(n=m.centerY+(270===this.K?-u:u),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.Yb/2:p=m.bounds.right+this.Yb/2,b.l(q++,w,n),b.l(q++,p,n)),b.l(q++,p,B)),b.l(q++,A,B);else if(r)y=Math.max(10,this.Yd[m.layer]),F=Math.max(10,this.vd[m.layer]),180===this.K&&A>=m.bounds.x?(n=m.bounds.x+
m.bounds.width,b.L(q-2,n,z),b.L(q-1,n+F,z)):90===this.K&&B<=m.bounds.bottom?(n=m.bounds.y,b.L(q-2,w,n),b.L(q-1,w,n-y)):270===this.K&&B>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.L(q-2,w,n),b.L(q-1,w,n+F)):0===this.K&&A<=m.bounds.right&&(n=m.bounds.x,b.L(q-2,n,z),b.L(q-1,n-y,z));else{y=Math.max(10,this.Yd[m.layer]);F=Math.max(10,this.vd[m.layer]);p=0;if(180===this.K||0===this.K){if(180===this.K?A<=m.bounds.x:A>=m.bounds.right)p=(0===this.K?F:-y)/2;b.l(q++,A+p,z)}else{if(270===this.K?B<=m.bounds.y:
B>=m.bounds.bottom)p=(90===this.K?F:-y)/2;b.l(q++,w,B+p)}b.l(q++,A,B)}}else{for(;null!==m&&m!==n;){y=v=null;for(m=m.destinationEdges.iterator;m.next()&&(w=m.value,w.link!==c.link||(v=w.toVertex,y=w.fromVertex,null!==y.node&&(y=null),null!==v.node)););if(null===v)break;v!==n&&(w=b.i(q-1).x,z=b.i(q-1).y,A=v.centerX,B=v.centerY,p?180===this.K||0===this.K?(null!==y?y.centerY:z)!==B&&(y=this.Ka[v.layer]+this.Qc.x,q===b.firstPickIndex+1&&(y=0===this.K?Math.max(y,w):Math.min(y,w)),b.l(q++,y,z),b.l(q++,y,
B)):(null!==y?y.centerX:w)!==A&&(y=this.Ka[v.layer]+this.Qc.y,q===b.firstPickIndex+1&&(y=90===this.K?Math.max(y,z):Math.min(y,z)),b.l(q++,w,y),b.l(q++,A,y)):(y=Math.max(10,this.Yd[v.layer]),F=Math.max(10,this.vd[v.layer]),r?180===this.K?(b.l(q++,A+F+u,B),b.l(q++,Math.max(A+F-u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.min(A-y+u/2,A),B),b.l(q++,A-y-u,B)):90===this.K?(b.l(q++,A,B-y-u),b.l(q++,A,Math.min(B-y+u/2,B)),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,A,Math.max(B+F-u/2,B)),b.l(q++,A,B+F+u)):270===
this.K?(b.l(q++,A,B+F+u),b.l(q++,A,Math.max(B+F-u/2,B)),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,A,Math.min(B-y+u/2,B)),b.l(q++,A,B-y-u)):(b.l(q++,A-y-u,B),b.l(q++,Math.min(A-y+u/2,A),B),b.l(q++,A,B),b.l(q++,A,B),b.l(q++,Math.max(A+F-u/2,A),B),b.l(q++,A+F+u,B)):180===this.K?(b.l(q++,A+F,B),b.l(q++,A-y,B)):90===this.K?(b.l(q++,A,B-y),b.l(q++,A,B+F)):270===this.K?(b.l(q++,A,B+F),b.l(q++,A,B-y)):(b.l(q++,A-y,B),b.l(q++,A+F,B))));m=v}p&&(w=b.i(q-1).x,z=b.i(q-1).y,A=b.i(q).x,B=b.i(q).y,180===this.K||0===this.K?
z!==B&&(y=0===this.K?Math.min(Math.max((A+w)/2,this.Ka[n.layer]+this.Qc.x),A):Math.max(Math.min((A+w)/2,this.Ka[n.layer]+this.Qc.x),A),b.l(q++,y,z),b.l(q++,y,B)):w!==A&&(y=90===this.K?Math.min(Math.max((B+z)/2,this.Ka[n.layer]+this.Qc.y),B):Math.max(Math.min((B+z)/2,this.Ka[n.layer]+this.Qc.y),B),b.l(q++,w,y),b.l(q++,A,y)))}null!==d&&r&&(null!==g&&(l===rc&&(l=b.i(0),d=b.i(2),l.A(d)||b.L(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,rc,!0,!1,f,h),l.u()||l.set(e.actualBounds.center),b.L(0,l.x,l.y)),
null!==h&&(k===rc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.L(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,rc,!1,!1,e,g),e.u()||e.set(f.actualBounds.center),b.L(b.pointsCount-1,e.x,e.y)));b.rf();c.commit()}}}this.avoidOrthogonalOverlaps()};
os.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.w(f.y,g.y)&&!this.w(f.x,g.x)){var h=new it;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.cd=Math.min(f.x,g.x);h.sc=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.j=m}c.push(h)}}}if(1<c.length)for(c.sort(this.By),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].sc;for(e=a+1;e<d&&c[e].cd<g;)g=Math.max(g,c[e].sc),e++;g=e-f;if(1<g){this.Wi(c,this.ct,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.Wi(c,this.Ay,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.Wi(c,this.ct,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.Hh();r.L(p.index,f.x,f.y+q);r.L(p.index+1,g.x,g.y+q);r.rf()}}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.w(f.x,g.x)&&!this.w(f.y,g.y)&&(h=new it,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.cd=Math.min(f.y,g.y),h.sc=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.j=m),c.push(h));if(1<c.length)for(c.sort(this.By),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].sc;for(e=a+1;e<d&&c[e].cd<g;)g=Math.max(g,c[e].sc),e++;g=e-f;if(1<g){this.Wi(c,this.ct,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.Wi(c,this.Ay,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.Wi(c,this.ct,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.Hh(),r.L(p.index,
f.x+q,f.y),r.L(p.index+1,g.x+q,g.y),r.rf()}f=e}a=d}}}};t=os.prototype;t.By=function(a,b){return a instanceof it&&b instanceof it&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.cd<b.cd?-1:a.cd>b.cd?1:a.sc<b.sc?-1:a.sc>b.sc?1:0:0};t.Ay=function(a,b){return a instanceof it&&b instanceof it&&a!==b?a.first<b.first?-1:a.first>b.first||a.j<b.j?1:a.j>b.j||a.cd<b.cd?-1:a.cd>b.cd?1:a.sc<b.sc?-1:a.sc>b.sc?1:0:0};
t.ct=function(a,b){return a instanceof it&&b instanceof it&&a!==b?a.Xb<b.Xb?-1:a.Xb>b.Xb||a.j<b.j?1:a.j>b.j||a.cd<b.cd?-1:a.cd>b.cd?1:a.sc<b.sc?-1:a.sc>b.sc?1:0:0};t.w=function(a,b){a-=b;return-1<a&&1>a};
t.Wi=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&C("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 xs(a,b){var c=a.zb[b];if(c>=a.ve.length){var d=[];for(var e=0;e<a.ve.length;e++)d[e]=a.ve[e];a.ve=d}void 0===a.ve[c]||null===a.ve[c]?d=[]:(d=a.ve[c],a.ve[c]=null);a=a.Lo[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function ys(a,b,c){a.ve[a.zb[b]]=c}
na.Object.defineProperties(os.prototype,{layerSpacing:{get:function(){return this.Zd},set:function(a){this.Zd!==a&&0<=a&&(this.Zd=a,this.B())}},columnSpacing:{get:function(){return this.Yb},set:function(a){this.Yb!==a&&0<a&&(this.Yb=a,this.B())}},direction:{get:function(){return this.K},set:function(a){this.K!==a&&(0===a||90===a||180===a||270===a?(this.K=a,this.B()):C("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Uk},set:function(a){this.Uk===a||a!==Is&&a!==ps&&a!==us||(this.Uk=a,this.B())}},layeringOption:{get:function(){return this.sl},set:function(a){this.sl===a||a!==qs&&a!==Ns&&a!==Ps||(this.sl=a,this.B())}},initializeOption:{get:function(){return this.il},set:function(a){this.il===a||a!==rs&&a!==Vs&&a!==Ts||(this.il=a,this.B())}},iterations:{
get:function(){return this.Cj},set:function(a){this.Cj!==a&&0<=a&&(this.Cj=a,this.B())}},aggressiveOption:{get:function(){return this.Fk},set:function(a){this.Fk===a||a!==Zs&&a!==ss&&a!==$s||(this.Fk=a,this.B())}},packOption:{get:function(){return this.Wf},set:function(a){this.Wf!==a&&0<=a&&8>a&&(this.Wf=a,this.B())}},setsPortSpots:{get:function(){return this.df},set:function(a){this.df!==a&&(this.df=a,this.B())}},
linkSpacing:{get:function(){return this.vo},set:function(a){this.vo!==a&&0<=a&&(this.vo=a,this.B())}},maxLayer:{get:function(){return this.ra}},maxIndex:{get:function(){return this.ji}},maxColumn:{get:function(){return this.Ca}},minIndexLayer:{get:function(){return this.Qg}},maxIndexLayer:{get:function(){return this.pc}}});
var ps=new D(os,"CycleDepthFirst",0),Is=new D(os,"CycleGreedy",1),us=new D(os,"CycleFromLayers",2),qs=new D(os,"LayerOptimalLinkLength",0),Ns=new D(os,"LayerLongestPathSink",1),Ps=new D(os,"LayerLongestPathSource",2),rs=new D(os,"InitDepthFirstOut",0),Vs=new D(os,"InitDepthFirstIn",1),Ts=new D(os,"InitNaive",2),Zs=new D(os,"AggressiveNone",0),ss=new D(os,"AggressiveLess",1),$s=new D(os,"AggressiveMore",2),at=8;os.className="LayeredDigraphLayout";os.CycleDepthFirst=ps;os.CycleGreedy=Is;
os.CycleFromLayers=us;os.LayerOptimalLinkLength=qs;os.LayerLongestPathSink=Ns;os.LayerLongestPathSource=Ps;os.InitDepthFirstOut=rs;os.InitDepthFirstIn=Vs;os.InitNaive=Ts;os.AggressiveNone=Zs;os.AggressiveLess=ss;os.AggressiveMore=$s;os.PackNone=0;os.PackExpand=1;os.PackStraighten=2;os.PackMedian=4;os.PackAll=15;function it(){this.index=this.sc=this.cd=this.Xb=this.first=this.layer=0;this.link=null;this.j=0}it.className="SegInfo";function ts(a){Sp.call(this,a)}ma(ts,Sp);ts.prototype.createVertex=function(){return new jt(this)};
ts.prototype.createEdge=function(){return new kt(this)};ts.className="LayeredDigraphNetwork";function jt(a){fq.call(this,a);this.Qa=this.wg=this.ei=-1;this.C=NaN;this.M=null;this.valid=!1;this.finish=this.jg=NaN;this.qf=0;this.uk=this.vk=null}ma(jt,fq);
jt.prototype.serializeVertexProperties=function(a,b){fq.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?gb(this.near):null;a.valid=this.valid;a.jg=this.jg;a.finish=this.finish;a.qf=this.qf;a.vk=this.vk;a.uk=this.uk};
jt.prototype.deserializeVertexProperties=function(a,b,c,d){fq.prototype.deserializeVertexProperties.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.jg=a.jg;this.finish=a.finish;this.qf=a.qf;this.vk=a.vk;this.uk=a.uk};
na.Object.defineProperties(jt.prototype,{layer:{get:function(){return this.ei},set:function(a){this.ei!==a&&(this.ei=a)}},column:{get:function(){return this.wg},set:function(a){this.wg!==a&&(this.wg=a)}},index:{get:function(){return this.Qa},set:function(a){this.Qa!==a&&(this.Qa=a)}},component:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}},near:{
get:function(){return this.M},set:function(a){this.M!==a&&(this.M=a)}}});jt.className="LayeredDigraphVertex";function kt(a){gq.call(this,a);this.j=this.Ha=this.Wa=!1;this.Ga=this.C=NaN;this.M=this.o=0}ma(kt,gq);
kt.prototype.serializeEdgeProperties=function(a,b){gq.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};
kt.prototype.deserializeEdgeProperties=function(a,b,c,d){gq.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(kt.prototype,{fromVertex:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a)}},toVertex:{get:function(){return this.ad},set:function(a){this.ad!==a&&(this.ad=a)}},valid:{get:function(){return this.Wa},set:function(a){this.Wa!==a&&(this.Wa=a)}},rev:{get:function(){return this.Ha},set:function(a){this.Ha!==a&&(this.Ha=a)}},forest:{
get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a)}},portFromPos:{get:function(){return this.C},set:function(a){this.C!==a&&(this.C=a)}},portToPos:{get:function(){return this.Ga},set:function(a){this.Ga!==a&&(this.Ga=a)}},portFromColOffset:{get:function(){return this.o},set:function(a){this.o!==a&&(this.o=a)}},portToColOffset:{get:function(){return this.M},
set:function(a){this.M!==a&&(this.M=a)}}});kt.className="LayeredDigraphEdge";function lt(a){li.call(this);this.Jb=new G;this.Yo=mt;this.jd=nt;this.Qp=ot;this.Gr=pt;this.Aw=[];this.gd=!0;this.Gb=qt;this.Nd=(new M(10,10)).freeze();var b=new rt(this);this.V=new st(b);this.W=new st(b);this.Qu=[];a&&Object.assign(this,a)}ma(lt,li);
lt.prototype.cloneProtected=function(a){li.prototype.cloneProtected.call(this,a);a.Yo=this.Yo;a.Qp=this.Qp;a.Gr=this.Gr;a.gd=this.gd;a.Gb=this.Gb;a.Nd.assign(this.Nd);a.V.copyInheritedPropertiesFrom(this.V);a.W.copyInheritedPropertiesFrom(this.W)};
lt.prototype.gb=function(a){a.classType===lt?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:C("Unknown enum value: "+a):li.prototype.gb.call(this,a)};lt.prototype.createNetwork=function(){return new rt(this)};
lt.prototype.makeNetwork=function(a){function b(a){if(a instanceof W)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof U){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 T?(c.hg(a.nodes,!0,b),c.hg(a.links,!0,b)):a instanceof hf?c.hg(a.memberParts,!1,b):c.hg(a.iterator,!1,b);return c};
lt.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==tt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof T&&(b=a);this.path===mt&&null!==b?this.jd=b.isTreePathToChildren?nt:ut:this.jd=this.path===mt?nt:this.path;if(0<this.network.vertexes.count){this.network.fq();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.Ki(c),null!==c&&a.add(c)):c instanceof st&&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,vt(this,b));b=this.network.vertexes;for(a=null;a=wt(b),0<a.count;)b=xt(this,a),null!==b&&this.Jb.add(b),b.initialized=!0,vt(this,b),b=a;for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof st&&yt(this,b);for(a=this.Jb.iterator;a.next();)b=
a.value,b instanceof st&&zt(this,b);for(a=this.Jb.iterator;a.next();)b=a.value,b instanceof st&&At(this,b);this.cv();if(this.layerStyle===Bt){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.Aw=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===Ct)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 st&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Jb=new G;this.isValidLayout=!0};function wt(a){var b=new G;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
lt.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.jd){case nt:0===c.sourceEdges.count&&this.Jb.add(c);break;case ut:0===c.destinationEdges.count&&this.Jb.add(c);break;default:C("Unhandled path value "+this.jd.toString())}}0===this.Jb.count&&(a=xt(this,a),null!==a&&this.Jb.add(a))};
function xt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.jd){case nt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case ut:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:C("Unhandled path value "+a.jd.toString())}}return d}
function vt(a,b){if(null!==b){switch(a.jd){case nt:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;Dt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.xa())}break;case ut:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,Dt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.xa())}break;default:C("Unhandled path value"+a.jd.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++)vt(a,c[b])}}function Dt(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}lt.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 yt(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Et&&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];yt(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 Ft(a,b){switch(a.Qp){default:case ot:return null!==b.parent?b.parent:a.V;case Gt:return null===b.parent?a.V:null===b.parent.parent?a.W:b.parent;case Ht:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.W:a.V;case It: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.W:null!==b.parent?b.parent:a.V}}
lt.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Ft(this,a));if(null!==a.parent&&a.parent.alignment===Et){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 zt(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)zt(a,b[d])}}lt.prototype.assignTreeVertexValues=function(){};
function At(a,b){if(null!==b){b.alignment!==Et&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)At(a,b[d])}}lt.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Jt:break;case Kt:a.children.reverse();break;case Lt:a.children.sort(a.comparer);break;case Mt:a.children.sort(a.comparer);a.children.reverse();break;default:C("Unhandled sorting value "+a.sorting.toString())}};lt.prototype.cv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
lt.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=Nt(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.pv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Sa(),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 Nt(a){return a===Ot||a===Et||a===Pt||a===Qt}function Rt(a){return a===Ot||a===Et}
function St(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Nt(c)){if(Rt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Pt)return!0}}return!1}
lt.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=Nt(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=St(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.Dd();r.next();){var u=r.value;u.fromSpot=
dd;u.toSpot=ed}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=dd;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.Dd();r.next();)u=r.value,u.fromSpot=ed,u.toSpot=dd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=dd,u.toSpot=ed;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.Dd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=fd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=fd,u.toSpot=cd;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.Dd();r.next();)u=r.value,u.fromSpot=fd,u.toSpot=cd;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-q.height),
r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=cd,u.toSpot=fd;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.jd===nt)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)}};
lt.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 Tt:Ut(this,a);break;case Vt:if(a.alignment===Et)Ut(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Nt(c)),d=St(a),a.U.h(0,0),a.va.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.sq=null,a.Eq=null;else{var e=Zt(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.va.width:d.va.height);var k=a.alignment,l=k===$t,m=Nt(k),n=Math.max(0,a.breadthLimit);c=au(a);var p=a.nodeSpacing,r=bu(a),q=a.rowSpacing,u=0;if(k===cu||l||a.Bm||a.Cm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var v=a.height,w=0,z=0,y=0,A=null,B=null,F=0,K=0,S=0,R=0,O=0,H=0,da=0,ba=0;m&&!Rt(k)&&135<e&&g.reverse();if(Rt(k))if(1<h)for(var ra=0;ra<h;ra++)0===
ra%2&&ra!==h-1&&(ba=Math.max(ba,b?g[ra].va.width:g[ra].va.height));else 1===h&&(ba=b?g[0].va.width:g[0].va.height);if(m){switch(k){case Ot:z=135>e?du(a,g,ba,w,z):eu(a,g,ba,w,z);ba=z.x;w=z.width;z=z.height;break;case Pt:for(A=0;A<h;A++)B=g[A],n=B.va,y=0===H?0:q,b?(B.U.h(f-n.width,R+y),w=Math.max(w,n.width),z=Math.max(z,R+y+n.height),R+=y+n.height):(B.U.h(S+y,f-n.height),w=Math.max(w,S+y+n.width),z=Math.max(z,n.height),S+=y+n.width),H++;break;case Qt:for(A=0;A<h;A++)B=g[A],f=B.va,n=0===H?0:q,b?(B.U.h(p/
2+a.focus.x,R+n),w=Math.max(w,f.width),z=Math.max(z,R+n+f.height),R+=n+f.height):(B.U.h(S+n,p/2+a.focus.y),w=Math.max(w,S+n+f.width),z=Math.max(z,f.height),S+=n+f.width),H++}A=fu(this,2);B=fu(this,2);b?(A[0].h(0,0),A[1].h(0,z),B[0].h(w,0)):(A[0].h(0,0),A[1].h(w,0),B[0].h(0,z));B[1].h(w,z)}else for(ra=0;ra<h;ra++){var Ca=g[ra],cb=Ca.va;if(b){0<n&&0<H&&S+p+cb.width>n&&(S<f&&gu(a,k,f-S,0,da,ra-1),O++,H=0,da=ra,y=z,S=0,R=135<e?-z-q:z+q);hu(this,Ca,0,R);var db=0;if(0===H){if(A=Ca.sq,B=Ca.Eq,F=cb.width,
K=cb.height,null===A||null===B||e!==Zt(Ca))A=fu(this,2),B=fu(this,2),A[0].h(0,0),A[1].h(0,K),B[0].h(F,0),B[1].h(F,K)}else{var Ha=Fa();K=iu(this,a,Ca,A,B,F,K,Ha);db=K.x;A=Ha[0];B=Ha[1];F=K.width;K=K.height;Ia(Ha);S<cb.width&&0>db&&(ju(a,-db,0,da,ra-1),ku(A,-db,0),ku(B,-db,0),db=0)}Ca.U.h(db,R);w=Math.max(w,F);z=Math.max(z,y+(0===O?0:q)+cb.height);S=F}else{0<n&&0<H&&R+p+cb.height>n&&(R<f&&gu(a,k,0,f-R,da,ra-1),O++,H=0,da=ra,y=w,R=0,S=135<e?-w-q:w+q);hu(this,Ca,S,0);db=0;if(0===H){if(A=Ca.sq,B=Ca.Eq,
F=cb.width,K=cb.height,null===A||null===B||e!==Zt(Ca))A=fu(this,2),B=fu(this,2),A[0].h(0,0),A[1].h(F,0),B[0].h(0,K),B[1].h(F,K)}else Ha=Fa(),K=iu(this,a,Ca,A,B,F,K,Ha),db=K.x,A=Ha[0],B=Ha[1],F=K.width,K=K.height,Ia(Ha),R<cb.height&&0>db&&(ju(a,0,-db,da,ra-1),ku(A,0,-db),ku(B,0,-db),db=0);Ca.U.h(S,db);z=Math.max(z,K);w=Math.max(w,y+(0===O?0:q)+cb.width);R=K}H++}0<O&&(b?(z+=Math.max(0,c),S<w&&gu(a,k,w-S,0,da,h-1),0<u&&(l||ju(a,u,0,0,h-1),w+=u)):(w+=Math.max(0,c),R<z&&gu(a,k,0,z-R,da,h-1),0<u&&(l||ju(a,
0,u,0,h-1),z+=u)));u=l=0;switch(k){case lu:b?l+=w/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2;break;case mu:0<O?b?l+=w/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2:b?(ba=g[0].U.x+g[0].fa.x,l+=ba+(g[h-1].U.x+g[h-1].fa.x+2*g[h-1].focus.x-ba)/2-a.focus.x-r/2):(ba=g[0].U.y+g[0].fa.y,u+=ba+(g[h-1].U.y+g[h-1].fa.y+2*g[h-1].focus.y-ba)/2-a.focus.y-r/2);break;case cu:b?(l-=r,w+=r):(u-=r,z+=r);break;case $t:b?(l+=w-a.width+r,w+=r):(u+=z-a.height+r,z+=r);break;case Ot: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 Pt:b?l+=w+p/2-a.focus.x:u+=z+p/2-a.focus.y;break;case Qt:break;default:C("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)ba=g[r],b?ba.U.h(ba.U.x+ba.fa.x-l,ba.U.y+(135<e?(m?-z:-ba.va.height)+ba.fa.y-c:v+c+ba.fa.y)):ba.U.h(ba.U.x+(135<e?(m?-w:-ba.va.width)+ba.fa.x-c:d+c+ba.fa.x),ba.U.y+ba.fa.y-u);h=g=0;m?b?(w=nu(a,w,l),0>l&&(l=0),135<e&&(u+=z+c),z+=v+c,k===Qt&&(g+=p/2+a.focus.x),h+=v+c):(135<e&&(l+=w+c),w+=d+c,z=ou(a,
z,u),0>u&&(u=0),k===Qt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>w&&(w=pu(k,d-w,0),g=w.x,h=w.y,w=d,l=0):w=nu(a,w,l),0>l&&(g-=l,l=0),135<e&&(u+=z+c),z=Math.max(Math.max(z,v),z+v+c),h+=v+c):(135<e&&(l+=w+c),w=Math.max(Math.max(w,d),w+d+c),null===a.comments?v>z&&(z=pu(k,0,v-z),g=z.x,h=z.y,z=v,u=0):z=ou(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0<O)e=fu(this,4),O=fu(this,4),b?(e[2].h(0,v+c),e[3].h(e[2].x,z),O[2].h(w,e[2].y),O[3].h(O[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(w,e[2].y),O[2].h(e[2].x,z),O[3].h(e[3].x,
O[2].y));else{e=fu(this,A.length+2);O=fu(this,B.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<B.length;k++)m=B[k],O[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,v),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])),O[0].h(l+d,0),O[1].h(O[0].x,v),O[2].y<O[1].y&&(O[2].x<O[0].x?O[2].assign(O[1]):O[1].assign(O[2])),O[3].y<O[2].y&&(O[3].x<O[0].x?O[3].assign(O[2]):O[2].assign(O[3])),e[2].y-=
c/2,O[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])),O[0].h(0,u+v),O[1].h(d,O[0].y),O[2].x<O[1].x&&(O[2].y<O[0].y?O[2].assign(O[1]):O[1].assign(O[2])),O[3].x<O[2].x&&(O[3].y<O[0].y?O[3].assign(O[2]):O[2].assign(O[3])),e[2].x-=c/2,O[2].x-=c/2);qu(this,A);qu(this,B);a.sq=e;a.Eq=O;a.fa.h(l,u);a.va.h(w,z)}break;default:C("Unhandled compaction value "+a.compaction.toString())}}};
function Ut(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Nt(c));var e=St(b);b.U.h(0,0);b.va.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=Zt(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.va.width:k.va.height)}var l=b.alignment,m=l===cu,n=l===
$t;h=Nt(l);var p=Math.max(0,b.breadthLimit);k=au(b);var r=b.nodeSpacing,q=bu(b),u=m||n?0:q/2,v=b.rowSpacing,w=0;if(m||n||b.Bm||b.Cm&&1===b.maxGenerationCount)w=Math.max(0,b.rowIndent);m=b.width;var z=b.height,y=0,A=0,B=0,F=0,K=0,S=0,R=0,O=0,H=0;h&&!Rt(l)&&135<d&&e.reverse();if(Rt(l))if(1<g)for(var da=0;da<g;da++){var ba=e[da],ra=ba.va;0===da%2&&da!==g-1&&(H=Math.max(H,(c?ra.width:ra.height)+ru(ba)-r))}else 1===g&&(H=c?e[0].va.width:e[0].va.height);if(h)switch(l){case Ot:case Et:A=135>d?du(b,e,H,y,
A):eu(b,e,H,y,A);H=A.x;y=A.width;A=A.height;break;case Pt:for(a=0;a<g;a++)p=e[a],u=p.va,B=0===R?0:v,c?(p.U.h(f-u.width,K+B),y=Math.max(y,u.width),A=Math.max(A,K+B+u.height),K+=B+u.height):(p.U.h(F+B,f-u.height),y=Math.max(y,F+B+u.width),A=Math.max(A,u.height),F+=B+u.width),R++;break;case Qt:for(f=0;f<g;f++)a=e[f],p=a.va,u=0===R?0:v,c?(a.U.h(r/2+b.focus.x,K+u),y=Math.max(y,p.width),A=Math.max(A,K+u+p.height),K+=u+p.height):(a.U.h(F+u,r/2+b.focus.y),y=Math.max(y,F+u+p.width),A=Math.max(A,p.height),
F+=u+p.width),R++}else for(da=0;da<g;da++){ba=e[da];ra=ba.va;if(c){0<p&&0<R&&F+r+ra.width>p&&(F<f&&gu(b,l,f-F,0,O,da-1),S++,R=0,O=da,B=A,F=0,K=135<d?-A-v:A+v);var Ca=0===R?u:r;hu(a,ba,0,K);ba.U.h(F+Ca,K);y=Math.max(y,F+Ca+ra.width);A=Math.max(A,B+(0===S?0:v)+ra.height);F+=Ca+ra.width}else 0<p&&0<R&&K+r+ra.height>p&&(K<f&&gu(b,l,0,f-K,O,da-1),S++,R=0,O=da,B=y,K=0,F=135<d?-y-v:y+v),Ca=0===R?u:r,hu(a,ba,F,0),ba.U.h(F,K+Ca),A=Math.max(A,K+Ca+ra.height),y=Math.max(y,B+(0===S?0:v)+ra.width),K+=Ca+ra.height;
R++}0<S&&(c?(A+=Math.max(0,k),F<y&&gu(b,l,y-F,0,O,g-1),0<w&&(n||ju(b,w,0,0,g-1),y+=w)):(y+=Math.max(0,k),K<A&&gu(b,l,0,A-K,O,g-1),0<w&&(n||ju(b,0,w,0,g-1),A+=w)));w=n=0;switch(l){case lu:c?n+=y/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2;break;case mu:0<S?c?n+=y/2-b.focus.x-q/2:w+=A/2-b.focus.y-q/2:c?(l=e[0].U.x+e[0].fa.x,n+=l+(e[g-1].U.x+e[g-1].fa.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].U.y+e[0].fa.y,w+=l+(e[g-1].U.y+e[g-1].fa.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case cu:c?(n-=q,y+=q):(w-=
q,A+=q);break;case $t:c?(n+=y-b.width+q,y+=q):(w+=A-b.height+q,A+=q);break;case Ot:case Et:c?1<g?n+=H+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].fa.x:1<g?w+=H+r/2-b.focus.y:w+=e[0].focus.y-b.focus.y+e[0].fa.y;break;case Pt:c?n+=y+r/2-b.focus.x:w+=A+r/2-b.focus.y;break;case Qt:break;default:C("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.U.h(l.U.x+l.fa.x-n,l.U.y+(135<d?(h?-A:-l.va.height)+l.fa.y-k:z+k+l.fa.y)):l.U.h(l.U.x+(135<d?(h?-y:-l.va.width)+l.fa.x-k:m+k+l.fa.x),l.U.y+
l.fa.y-w);c?(y=nu(b,y,n),0>n&&(n=0),135<d&&(w+=A+k),A=Math.max(Math.max(A,z),A+z+k)):(135<d&&(n+=y+k),y=Math.max(Math.max(y,m),y+m+k),A=ou(b,A,w),0>w&&(w=0));b.fa.h(n,w);b.va.h(y,A)}}
function du(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.va.width,e=a.va.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===Zt(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.va,u=0===l?0:h;if(k){var v=ru(r)-g;r.U.h(c-(q.width+v),n+u);d=Math.max(d,q.width+v);e=Math.max(e,n+u+q.height);n+=u+q.height}else v=ru(r)-g,r.U.h(m+u,c-(q.height+v)),e=Math.max(e,q.height+v),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];v=u.va;var w=0===l?0:h;if(k){var z=ru(u)-g;u.U.h(m+z,n+w);d=Math.max(d,m+v.width+z);e=Math.max(e,n+w+v.height);n+=w+v.height}else z=ru(u)-g,u.U.h(m+w,n+z),d=Math.max(d,m+w+v.width),e=Math.max(e,n+v.height+z),m+=w+v.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.va,h=null===b.parent?0:b.parent.rowSpacing,k?(b.U.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.U.x&&
(c=su(a,b.U.x,!1,c,g))):(b.U.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.U.y&&(c=su(a,b.U.y,!0,c,g))));return new N(c,0,d,e)}
function eu(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.va.width,e=b.va.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===Zt(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.va,u=0===l?0:h;if(k){var v=ru(r)-g;n-=u+q.height;r.U.h(c-(q.width+v),n);d=Math.max(d,q.width+v);e=Math.max(e,Math.abs(n))}else v=ru(r)-g,m-=u+q.width,r.U.h(m,c-(q.height+v)),e=Math.max(e,q.height+v),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];v=u.va;var w=0===l?0:h;if(k){var z=ru(u)-g;n-=w+v.height;u.U.h(m+z,n);d=Math.max(d,m+v.width+z);e=Math.max(e,Math.abs(n))}else z=ru(u)-g,m-=w+v.width,u.U.h(m,n+z),e=Math.max(e,n+v.height+z),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.va,q=null===h.parent?0:h.parent.rowSpacing,k?(h.U.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.U.x&&(c=su(a,h.U.x,!1,c,g))):(h.U.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.U.y&&(c=su(a,h.U.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.U.h(g.U.x,g.U.y+e):g.U.h(g.U.x+d,g.U.y);return new N(c,0,d,e)}function ru(a){return null===a.parent?0:a.parent.nodeSpacing}
function su(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].U.h(a[g].U.x,a[g].U.y-b):a[g].U.h(a[g].U.x-b,a[g].U.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 nu(a,b,c){switch(a.alignment){case mu:case lu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case cu:return a.width>b?a.width:b;case $t:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Ot:case Et:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Pt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Qt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function ou(a,b,c){switch(a.alignment){case mu:case lu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case cu:return a.height>b?a.height:b;case $t:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Ot:case Et:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Pt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Qt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function pu(a,b,c){switch(a){case lu:b/=2;c/=2;break;case mu:b/=2;c/=2;break;case cu:c=b=0;break;case $t:break;default:C("Unhandled alignment value "+a.toString())}return new J(b,c)}function gu(a,b,c,d,e,f){b=pu(b,c,d);ju(a,b.x,b.y,e,f)}function ju(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].U;f.x+=b;f.y+=c}}
function hu(a,b,c,d){var e=b.parent;switch(a.jd){case nt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case ut:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:C("Unhandled path value "+a.jd.toString())}}function ku(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function iu(a,b,c,d,e,f,g,h){var k=Zt(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.sq,q=c.Eq;g=c.va;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==Zt(c))r=fu(a,2),q=fu(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 v=r[e];k=v.x;l=v.y;k+=d;var w=
f;c+1<n.length&&(w=n[c+1]);var z=v;v=z.x;z=z.y;e+1<r.length&&(z=r[e+1],v=z.x,z=z.y,v+=d);var y=p;f.y===l?y=k-f.x:f.y>l&&f.y<z?y=k+(f.y-l)/(z-l)*(v-k)-f.x:l>f.y&&l<w.y&&(y=k-(f.x+(l-f.y)/(w.y-f.y)*(w.x-f.x)));y<p&&(p=y);w.y<=f.y?c++:z<=l?e++:(w.y<=z&&c++,z<=w.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=fu(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=fu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);qu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=fu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)w=n[c++],m[e++].h(w.x,w.y);for(;l<f.length;)w=f[l++],m[e++].h(w.x+k,w.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=fu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);qu(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;qu(a,b);qu(a,r);qu(a,n);qu(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],v=r[e],k=v.x,l=v.y,l+=p,w=f,c+1<n.length&&(w=n[c+1]),z=v,v=z.x,z=z.y,e+1<r.length&&(z=r[e+1],v=z.x,z=z.y,z+=p),y=d,f.x===k?y=l-f.y:f.x>k&&f.x<v?y=l+(f.x-k)/(v-k)*(z-l)-f.y:k>f.x&&k<w.x&&(y=l-(f.y+(k-f.x)/(w.x-f.x)*(w.y-f.y))),y<d&&(d=y),w.x<=f.x?c++:v<=k?e++:(w.x<=v&&c++,v<=w.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=fu(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=fu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);qu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=fu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)w=n[c++],m[e++].h(w.x,w.y);
for(;l<f.length;)w=f[l++],m[e++].h(w.x,w.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=fu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);qu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;qu(a,b);qu(a,r);qu(a,n);qu(a,q);h[0]=d;h[1]=e;return new N(p,0,f,g)}function fu(a,b){a=a.Qu[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 qu(a,b){var c=b.length,d=a.Qu[c];void 0===d&&(d=[],a.Qu[c]=d);d.push(b)}
lt.prototype.arrangeTrees=function(){if(this.Gb===tt)for(var a=this.Jb.iterator;a.next();){var b=a.value;if(b instanceof st){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);tu(this,b,c,d)}}}else{a=[];for(b=this.Jb.iterator;b.next();)c=b.value,c instanceof st&&a.push(c);switch(this.sorting){case Jt:break;case Kt:a.reverse();break;case Lt:a.sort(this.comparer);break;case Mt:a.sort(this.comparer);a.reverse();break;default:C("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];tu(this,e,b+e.fa.x,c+e.fa.y);switch(this.Gb){case qt:c+=e.va.height+this.Nd.height;break;case uu:b+=e.va.width+this.Nd.width;break;default:C("Unhandled arrangement value "+this.Gb.toString())}}}};function tu(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];tu(a,g,c+g.U.x,d+g.U.y)}}}lt.prototype.commitLayout=function(){this.Yv();this.commitNodes();this.gv();this.isRouting&&this.commitLinks()};
lt.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
lt.prototype.gv=function(){if(this.layerStyle===Bt){for(var a=this.Aw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Nc(e.bounds);var f=b[e.level];void 0===f?f=au(e):f=Math.max(f,au(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.Gc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Gc(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)}};lt.prototype.commitLayers=function(){};lt.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
lt.prototype.Yv=function(){for(var a=this.Jb.iterator;a.next();){var b=a.value;b instanceof st&&vu(this,b)}};function vu(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)vu(a,b[d])}}
lt.prototype.setPortSpots=function(a){var b=a.alignment;if(Nt(b)){var c=this.jd===nt,d=Zt(a);switch(d){case 0:var e=ed;break;case 90:e=fd;break;case 180:e=dd;break;default:e=cd}var f=a.children,g=f.length;switch(b){case Ot:case Et: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?dd:cd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=dd;break;case 90:k=cd;break;case 180:k=ed;break;default:k=fd}else 0===b%2&&(k=90===d||270===
d?ed:fd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Pt:d=90===d||270===d?ed:fd;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 Qt:for(d=90===d||270===d?dd:cd,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=Zt(a),this.jd===nt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Lb())switch(c){case 0:d.fromSpot=ed;break;case 90:d.fromSpot=fd;break;case 180:d.fromSpot=dd;break;default:d.fromSpot=cd}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Lb())switch(c){case 0:d.toSpot=dd;break;
case 90:d.toSpot=cd;break;case 180:d.toSpot=ed;break;default:d.toSpot=fd}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.Lb())switch(c){case 0:d.toSpot=ed;break;case 90:d.toSpot=fd;break;case 180:d.toSpot=dd;break;default:d.toSpot=cd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Lb())switch(c){case 0:d.fromSpot=dd;break;case 90:d.fromSpot=cd;break;case 180:d.fromSpot=ed;break;default:d.fromSpot=fd}else d.fromSpot=
a.childPortSpot}};function Zt(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function au(a){var b=Zt(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 bu(a){var b=Zt(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(lt.prototype,{roots:{get:function(){return this.Jb},set:function(a){this.Jb!==a&&(this.Jb=a,this.B())}},path:{get:function(){return this.Yo},set:function(a){this.Yo!==a&&(this.Yo=a,this.B())}},treeStyle:{get:function(){return this.Qp},set:function(a){this.Gb===a||a!==ot&&a!==Ht&&a!==It&&a!==Gt||(this.Qp=a,this.B())}},layerStyle:{get:function(){return this.Gr},
set:function(a){this.Gb===a||a!==pt&&a!==Ct&&a!==Bt||(this.Gr=a,this.B())}},comments:{get:function(){return this.gd},set:function(a){this.gd!==a&&(this.gd=a,this.B())}},arrangement:{get:function(){return this.Gb},set:function(a){this.Gb===a||a!==qt&&a!==uu&&a!==tt||(this.Gb=a,this.B())}},arrangementSpacing:{get:function(){return this.Nd},set:function(a){this.Nd.A(a)||(this.Nd.assign(a),this.B())}},rootDefaults:{
get:function(){return this.V},set:function(a){this.V!==a&&(this.V=a,this.B())}},alternateDefaults:{get:function(){return this.W},set:function(a){this.W!==a&&(this.W=a,this.B())}},sorting:{get:function(){return this.V.sorting},set:function(a){this.V.sorting===a||a!==Jt&&a!==Kt&&a!==Lt&&!Mt||(this.V.sorting=a,this.B())}},comparer:{get:function(){return this.V.comparer},set:function(a){this.V.comparer!==
a&&(this.V.comparer=a,this.B())}},angle:{get:function(){return this.V.angle},set:function(a){this.V.angle!==a&&(0===a||90===a||180===a||270===a?(this.V.angle=a,this.B()):C("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.V.alignment},set:function(a){this.V.alignment!==a&&(this.V.alignment=a,this.B())}},nodeIndent:{get:function(){return this.V.nodeIndent},set:function(a){this.V.nodeIndent!==
a&&0<=a&&(this.V.nodeIndent=a,this.B())}},nodeIndentPastParent:{get:function(){return this.V.nodeIndentPastParent},set:function(a){this.V.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.V.nodeIndentPastParent=a,this.B())}},nodeSpacing:{get:function(){return this.V.nodeSpacing},set:function(a){this.V.nodeSpacing!==a&&(this.V.nodeSpacing=a,this.B())}},layerSpacing:{get:function(){return this.V.layerSpacing},set:function(a){this.V.layerSpacing!==
a&&(this.V.layerSpacing=a,this.B())}},layerSpacingParentOverlap:{get:function(){return this.V.layerSpacingParentOverlap},set:function(a){this.V.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.V.layerSpacingParentOverlap=a,this.B())}},compaction:{get:function(){return this.V.compaction},set:function(a){this.V.compaction===a||a!==Tt&&a!==Vt||(this.V.compaction=a,this.B())}},breadthLimit:{get:function(){return this.V.breadthLimit},
set:function(a){this.V.breadthLimit!==a&&0<=a&&(this.V.breadthLimit=a,this.B())}},rowSpacing:{get:function(){return this.V.rowSpacing},set:function(a){this.V.rowSpacing!==a&&(this.V.rowSpacing=a,this.B())}},rowIndent:{get:function(){return this.V.rowIndent},set:function(a){this.V.rowIndent!==a&&0<=a&&(this.V.rowIndent=a,this.B())}},commentSpacing:{get:function(){return this.V.commentSpacing},set:function(a){this.V.commentSpacing!==
a&&(this.V.commentSpacing=a,this.B())}},commentMargin:{get:function(){return this.V.commentMargin},set:function(a){this.V.commentMargin!==a&&(this.V.commentMargin=a,this.B())}},setsPortSpot:{get:function(){return this.V.setsPortSpot},set:function(a){this.V.setsPortSpot!==a&&(this.V.setsPortSpot=a,this.B())}},portSpot:{get:function(){return this.V.portSpot},set:function(a){this.V.portSpot.A(a)||(this.V.portSpot=
a,this.B())}},setsChildPortSpot:{get:function(){return this.V.setsChildPortSpot},set:function(a){this.V.setsChildPortSpot!==a&&(this.V.setsChildPortSpot=a,this.B())}},childPortSpot:{get:function(){return this.V.childPortSpot},set:function(a){this.V.childPortSpot.A(a)||(this.V.childPortSpot=a,this.B())}},alternateSorting:{get:function(){return this.W.sorting},set:function(a){this.W.sorting===a||a!==Jt&&a!==Kt&&
a!==Lt&&!Mt||(this.W.sorting=a,this.B())}},alternateComparer:{get:function(){return this.W.comparer},set:function(a){this.W.comparer!==a&&(this.W.comparer=a,this.B())}},alternateAngle:{get:function(){return this.W.angle},set:function(a){this.W.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.W.angle=a,this.B())}},alternateAlignment:{get:function(){return this.W.alignment},set:function(a){this.W.alignment!==
a&&(this.W.alignment=a,this.B())}},alternateNodeIndent:{get:function(){return this.W.nodeIndent},set:function(a){this.W.nodeIndent!==a&&0<=a&&(this.W.nodeIndent=a,this.B())}},alternateNodeIndentPastParent:{get:function(){return this.W.nodeIndentPastParent},set:function(a){this.W.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.W.nodeIndentPastParent=a,this.B())}},alternateNodeSpacing:{get:function(){return this.W.nodeSpacing},
set:function(a){this.W.nodeSpacing!==a&&(this.W.nodeSpacing=a,this.B())}},alternateLayerSpacing:{get:function(){return this.W.layerSpacing},set:function(a){this.W.layerSpacing!==a&&(this.W.layerSpacing=a,this.B())}},alternateLayerSpacingParentOverlap:{get:function(){return this.W.layerSpacingParentOverlap},set:function(a){this.W.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.W.layerSpacingParentOverlap=a,this.B())}},alternateCompaction:{
get:function(){return this.W.compaction},set:function(a){this.W.compaction===a||a!==Tt&&a!==Vt||(this.W.compaction=a,this.B())}},alternateBreadthLimit:{get:function(){return this.W.breadthLimit},set:function(a){this.W.breadthLimit!==a&&0<=a&&(this.W.breadthLimit=a,this.B())}},alternateRowSpacing:{get:function(){return this.W.rowSpacing},set:function(a){this.W.rowSpacing!==a&&(this.W.rowSpacing=a,this.B())}},alternateRowIndent:{
get:function(){return this.W.rowIndent},set:function(a){this.W.rowIndent!==a&&0<=a&&(this.W.rowIndent=a,this.B())}},alternateCommentSpacing:{get:function(){return this.W.commentSpacing},set:function(a){this.W.commentSpacing!==a&&(this.W.commentSpacing=a,this.B())}},alternateCommentMargin:{get:function(){return this.W.commentMargin},set:function(a){this.W.commentMargin!==a&&(this.W.commentMargin=a,this.B())}},alternateSetsPortSpot:{
get:function(){return this.W.setsPortSpot},set:function(a){this.W.setsPortSpot!==a&&(this.W.setsPortSpot=a,this.B())}},alternatePortSpot:{get:function(){return this.W.portSpot},set:function(a){this.W.portSpot.A(a)||(this.W.portSpot=a,this.B())}},alternateSetsChildPortSpot:{get:function(){return this.W.setsChildPortSpot},set:function(a){this.W.setsChildPortSpot!==a&&(this.W.setsChildPortSpot=a,this.B())}},alternateChildPortSpot:{
get:function(){return this.W.childPortSpot},set:function(a){this.W.childPortSpot.A(a)||(this.W.childPortSpot=a,this.B())}}});
var mt=new D(lt,"PathDefault",-1),nt=new D(lt,"PathDestination",0),ut=new D(lt,"PathSource",1),Jt=new D(lt,"SortingForwards",10),Kt=new D(lt,"SortingReverse",11),Lt=new D(lt,"SortingAscending",12),Mt=new D(lt,"SortingDescending",13),lu=new D(lt,"AlignmentCenterSubtrees",20),mu=new D(lt,"AlignmentCenterChildren",21),cu=new D(lt,"AlignmentStart",22),$t=new D(lt,"AlignmentEnd",23),Ot=new D(lt,"AlignmentBus",24),Et=new D(lt,"AlignmentBusBranching",25),Pt=new D(lt,"AlignmentTopLeftBus",26),Qt=new D(lt,
"AlignmentBottomRightBus",27),Tt=new D(lt,"CompactionNone",30),Vt=new D(lt,"CompactionBlock",31),ot=new D(lt,"StyleLayered",40),It=new D(lt,"StyleLastParents",41),Ht=new D(lt,"StyleAlternating",42),Gt=new D(lt,"StyleRootOnly",43),qt=new D(lt,"ArrangementVertical",50),uu=new D(lt,"ArrangementHorizontal",51),tt=new D(lt,"ArrangementFixedRoots",52),pt=new D(lt,"LayerIndividual",60),Ct=new D(lt,"LayerSiblings",61),Bt=new D(lt,"LayerUniform",62);lt.className="TreeLayout";lt.PathDefault=mt;
lt.PathDestination=nt;lt.PathSource=ut;lt.SortingForwards=Jt;lt.SortingReverse=Kt;lt.SortingAscending=Lt;lt.SortingDescending=Mt;lt.AlignmentCenterSubtrees=lu;lt.AlignmentCenterChildren=mu;lt.AlignmentStart=cu;lt.AlignmentEnd=$t;lt.AlignmentBus=Ot;lt.AlignmentBusBranching=Et;lt.AlignmentTopLeftBus=Pt;lt.AlignmentBottomRightBus=Qt;lt.CompactionNone=Tt;lt.CompactionBlock=Vt;lt.StyleLayered=ot;lt.StyleLastParents=It;lt.StyleAlternating=Ht;lt.StyleRootOnly=Gt;lt.ArrangementVertical=qt;
lt.ArrangementHorizontal=uu;lt.ArrangementFixedRoots=tt;lt.LayerIndividual=pt;lt.LayerSiblings=Ct;lt.LayerUniform=Bt;function rt(a){Sp.call(this,a)}ma(rt,Sp);rt.prototype.createVertex=function(){return new st(this)};rt.prototype.createEdge=function(){return new wu(this)};rt.className="TreeNetwork";
function st(a){fq.call(this,a);this.Ga=!1;this.yc=null;this.C=[];this.Oc=this.Wa=this.M=this.Ha=0;this.gd=null;this.U=new J(0,0);this.va=new M(0,0);this.fa=new J(0,0);this.Cm=this.Bm=this.TA=!1;this.Eq=this.sq=null;this.Yc=Jt;this.Rc=mq;this.xb=0;this.wb=mu;this.Pr=this.Or=0;this.Qr=20;this.Zd=50;this.Fr=0;this.Yq=Vt;this.Rq=0;this.Zr=25;this.Xq=this.Yr=10;this.Wq=20;this.ds=!0;this.Vr=Vc;this.cs=!0;this.Uq=Vc}ma(st,fq);
st.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Yc=a.sorting,this.Rc=a.comparer,this.xb=a.angle,this.wb=a.alignment,this.Or=a.nodeIndent,this.Pr=a.nodeIndentPastParent,this.Qr=a.nodeSpacing,this.Zd=a.layerSpacing,this.Fr=a.layerSpacingParentOverlap,this.Yq=a.compaction,this.Rq=a.breadthLimit,this.Zr=a.rowSpacing,this.Yr=a.rowIndent,this.Xq=a.commentSpacing,this.Wq=a.commentMargin,this.ds=a.setsPortSpot,this.Vr=a.portSpot,this.cs=a.setsChildPortSpot,this.Uq=a.childPortSpot)};
na.Object.defineProperties(st.prototype,{initialized:{get:function(){return this.Ga},set:function(a){this.Ga!==a&&(this.Ga=a)}},parent:{get:function(){return this.yc},set:function(a){this.yc!==a&&(this.yc=a)}},children:{get:function(){return this.C},set:function(a){if(this.C!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.C=a}}},level:{get:function(){return this.Ha},set:function(a){this.Ha!==
a&&(this.Ha=a)}},descendantCount:{get:function(){return this.M},set:function(a){this.M!==a&&(this.M=a)}},maxChildrenCount:{get:function(){return this.Wa},set:function(a){this.Wa!==a&&(this.Wa=a)}},maxGenerationCount:{get:function(){return this.Oc},set:function(a){this.Oc!==a&&(this.Oc=a)}},comments:{get:function(){return this.gd},set:function(a){if(this.gd!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.gd=a}}},sorting:{get:function(){return this.Yc},set:function(a){this.Yc!==a&&(this.Yc=a)}},comparer:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.Rc=a)}},angle:{get:function(){return this.xb},set:function(a){this.xb!==a&&(this.xb=a)}},alignment:{get:function(){return this.wb},set:function(a){this.wb!==a&&(this.wb=a)}},nodeIndent:{
get:function(){return this.Or},set:function(a){this.Or!==a&&(this.Or=a)}},nodeIndentPastParent:{get:function(){return this.Pr},set:function(a){this.Pr!==a&&(this.Pr=a)}},nodeSpacing:{get:function(){return this.Qr},set:function(a){this.Qr!==a&&(this.Qr=a)}},layerSpacing:{get:function(){return this.Zd},set:function(a){this.Zd!==a&&(this.Zd=a)}},layerSpacingParentOverlap:{
get:function(){return this.Fr},set:function(a){this.Fr!==a&&(this.Fr=a)}},compaction:{get:function(){return this.Yq},set:function(a){this.Yq!==a&&(this.Yq=a)}},breadthLimit:{get:function(){return this.Rq},set:function(a){this.Rq!==a&&(this.Rq=a)}},rowSpacing:{get:function(){return this.Zr},set:function(a){this.Zr!==a&&(this.Zr=a)}},rowIndent:{get:function(){return this.Yr},set:function(a){this.Yr!==
a&&(this.Yr=a)}},commentSpacing:{get:function(){return this.Xq},set:function(a){this.Xq!==a&&(this.Xq=a)}},commentMargin:{get:function(){return this.Wq},set:function(a){this.Wq!==a&&(this.Wq=a)}},setsPortSpot:{get:function(){return this.ds},set:function(a){this.ds!==a&&(this.ds=a)}},portSpot:{get:function(){return this.Vr},set:function(a){this.Vr.A(a)||(this.Vr=a)}},setsChildPortSpot:{
get:function(){return this.cs},set:function(a){this.cs!==a&&(this.cs=a)}},childPortSpot:{get:function(){return this.Uq},set:function(a){this.Uq.A(a)||(this.Uq=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.U},set:function(a){this.U.set(a)}},subtreeSize:{get:function(){return this.va},set:function(a){this.va.set(a)}},
subtreeOffset:{get:function(){return this.fa},set:function(a){this.fa.set(a)}}});st.className="TreeVertex";function wu(a){gq.call(this,a);this.yu=new J(0,0)}ma(wu,gq);
wu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.jd){case nt:c=this.fromVertex;d=this.toVertex;break;case ut:c=this.toVertex;d=this.fromVertex;break;default:C("Unhandled path value "+b.jd.toString())}if(null!==c&&null!==d)if(b=this.yu,0!==b.x||0!==b.y||c.TA){d=c.bounds;var e=Zt(c),f=au(c),g=c.rowSpacing;a.pg();var h=a.curve===Yf,k=a.isOrthogonal,l;a.Hh();if(k||h){for(l=2;4<a.pointsCount;)a.Rv(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.Rv(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===$t?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-bu(c))))):c.alignment===cu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+bu(c))))):e=c.Bm||c.Cm&&1===c.maxGenerationCount?d.top-c.fa.y+b.y:d.y+d.height/2+b.y,h?(a.l(l,m.x,e),l++,a.l(l,d.right+f,e),l++,a.l(l,d.right+f+(b.x-g)/3,e),l++,a.l(l,d.right+f+2*(b.x-g)/3,e),l++,a.l(l,d.right+f+(b.x-
g),e),l++,a.l(l,n.x,e)):(k&&(a.l(l,d.right+f/2,m.y),l++),a.l(l,d.right+f/2,e),l++,a.l(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.l(l,a.i(l-1).x,n.y))):90===e?(c.alignment===$t?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-bu(c))))):c.alignment===cu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+bu(c))))):e=c.Bm||c.Cm&&1===c.maxGenerationCount?d.left-c.fa.x+b.x:d.x+d.width/2+b.x,h?(a.l(l,e,m.y),l++,a.l(l,e,d.bottom+f),l++,a.l(l,e,d.bottom+f+(b.y-g)/
3),l++,a.l(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.l(l,e,d.bottom+f+(b.y-g)),l++,a.l(l,e,n.y)):(k&&(a.l(l,m.x,d.bottom+f/2),l++),a.l(l,e,d.bottom+f/2),l++,a.l(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.l(l,n.x,a.i(l-1).y))):180===e?(c.alignment===$t?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-bu(c))))):c.alignment===cu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+bu(c))))):e=c.Bm||c.Cm&&1===c.maxGenerationCount?d.top-c.fa.y+b.y:d.y+d.height/2+b.y,h?
(a.l(l,m.x,e),l++,a.l(l,d.left-f,e),l++,a.l(l,d.left-f+(b.x+g)/3,e),l++,a.l(l,d.left-f+2*(b.x+g)/3,e),l++,a.l(l,d.left-f+(b.x+g),e),l++,a.l(l,n.x,e)):(k&&(a.l(l,d.left-f/2,m.y),l++),a.l(l,d.left-f/2,e),l++,a.l(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.l(l,a.i(l-1).x,n.y))):270===e?(c.alignment===$t?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-bu(c))))):c.alignment===cu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+bu(c))))):e=c.Bm||c.Cm&&1===c.maxGenerationCount?
d.left-c.fa.x+b.x:d.x+d.width/2+b.x,h?(a.l(l,e,m.y),l++,a.l(l,e,d.top-f),l++,a.l(l,e,d.top-f+(b.y+g)/3),l++,a.l(l,e,d.top-f+2*(b.y+g)/3),l++,a.l(l,e,d.top-f+(b.y+g)),l++,a.l(l,e,n.y)):(k&&(a.l(l,m.x,d.top-f/2),l++),a.l(l,e,d.top-f/2),l++,a.l(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.l(l,n.x,a.i(l-1).y))):C("Invalid angle "+e);a.rf()}else a=this.link,f=Zt(c),f!==Zt(d)&&(g=au(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.pg(),c=a.curve===Yf,b=a.isOrthogonal,d=Nt(this.fromVertex.alignment),a.Hh(),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.l(2,f-20,c),a.l(3,f,c),a.l(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.l(2,f,a.i(2).y):3===a.pointsCount?a.L(1,f,a.i(2).y):2===a.pointsCount&&a.l(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.l(2,c,f-20),
a.l(3,c,f),a.l(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.l(2,a.i(2).x,f):3===a.pointsCount?a.L(1,a.i(2).x,f):2===a.pointsCount&&a.l(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.l(2,f+20,c),a.l(3,f,c),a.l(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.l(2,f,a.i(2).y):3===a.pointsCount?
a.L(1,f,a.i(2).y):2===a.pointsCount&&a.l(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.l(2,c,f+20),a.l(3,c,f),a.l(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.l(2,a.i(2).x,f):3===a.pointsCount?a.L(1,a.i(2).x,f):2===a.pointsCount&&a.l(1,a.i(1).x,f)),a.rf()))}};
na.Object.defineProperties(wu.prototype,{fromVertex:{get:function(){return this.Tc},set:function(a){this.Tc!==a&&(this.Tc=a)}},toVertex:{get:function(){return this.ad},set:function(a){this.ad!==a&&(this.ad=a)}},relativePoint:{get:function(){return this.yu},set:function(a){this.yu.set(a)}}});wu.className="TreeEdge";
Oa.prototype.initializeStandardTools=function(){this.Za("Action",new tg,this.mouseDownTools);this.Za("Relinking",new Ne,this.mouseDownTools);this.Za("LinkReshaping",new Wf,this.mouseDownTools);this.Za("Rotating",new rg,this.mouseDownTools);this.Za("Resizing",new cg,this.mouseDownTools);this.Za("Linking",new Pf,this.mouseMoveTools);this.Za("Dragging",new De,this.mouseMoveTools);this.Za("DragSelecting",new wg,this.mouseMoveTools);this.Za("Panning",new xg,this.mouseMoveTools);this.Za("ContextMenu",new zg,
this.mouseUpTools);this.Za("TextEditing",new Kg,this.mouseUpTools);this.Za("ClickCreating",new ug,this.mouseUpTools);this.Za("ClickSelecting",new sg,this.mouseUpTools)};rn("Horizontal",new tm);rn("Spot",new vm);rn("Table",new Am);rn("Viewbox",new Fm);rn("TableRow",new Dm);rn("TableColumn",new Em);rn("Graduated",new Pm);rn("Grid",new Gm);gi.add("GraphLinksModel",Fq);gi.add("TreeModel",Tq);Yp($r,null);Yp(os,null);
var xu=x.go,yu={get licenseKey(){return T.licenseKey},set licenseKey(a){T.licenseKey=a},get version(){return T.version},Group:hf,EnumValue:D,List:E,Set:G,Map:I,Point:J,Size:M,Rect:N,Margin:ic,Spot:P,Geometry:Q,PathFigure:Wd,PathSegment:Xd,InputEvent:Zd,DiagramEvent:ae,ChangedEvent:be,Model:Z,GraphLinksModel:nr,TreeModel:sr,Binding:ri,Transaction:oe,UndoManager:pe,CommandHandler:Qk,Tool:re,DraggingTool:De,DraggingInfo:Oe,DraggingOptions:Ee,LinkingBaseTool:tf,LinkingTool:Pf,RelinkingTool:Ne,LinkReshapingTool:Wf,
ResizingTool:cg,RotatingTool:rg,ClickSelectingTool:sg,ActionTool:tg,ClickCreatingTool:ug,HTMLInfo:Be,ContextMenuTool:zg,DragSelectingTool:wg,PanningTool:xg,TextEditingTool:Kg,ToolManager:Oa,Animation:fh,AnimationManager:bh,AnimationTrigger:Uh,Layer:Zh,Diagram:T,Palette:Jk,Overview:Mk,Brush:ml,GraphObject:Y,Panel:X,RowColumnDefinition:Nj,Shape:uf,TextBlock:Lg,Picture:Vj,Part:V,Adornment:we,Node:W,Link:U,Placeholder:mg,Layout:li,LayoutNetwork:Sp,LayoutVertex:fq,LayoutEdge:gq,GridLayout:Lk,PanelLayout:Kl,
CircularLayout:tr,CircularNetwork:Kr,CircularVertex:Yr,CircularEdge:Zr,ForceDirectedLayout:$r,ForceDirectedNetwork:as,ForceDirectedVertex:ms,ForceDirectedEdge:ns,LayeredDigraphLayout:os,LayeredDigraphNetwork:ts,LayeredDigraphVertex:jt,LayeredDigraphEdge:kt,TreeLayout:lt,TreeNetwork:rt,TreeVertex:st,TreeEdge:wu};"object"===typeof xu&&xu.version&&C("WARNING: a `go` object on the root object is already defined.  "+("Debug"in xu?"debug ":"")+"version: "+xu.version+", replaced with version: "+yu.version);
T.prototype.go=yu;x.go=yu;("undefined"===typeof x||"undefined"===typeof x.module||"object"!==typeof x.module.exports)&&x.define&&"function"===typeof x.define&&x.define.amd&&x.define(yu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
